The Higher Education and Research forge

Home My Page Projects Code Snippets Project Openings EMULSION public releases
Summary Activity Surveys SCM Listes Sympa

SCM Repository

2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
3   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5 <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
6   <head>
7     <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
8     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9     <title>emulsion.agent package &#8212; EMULSION (Epidemiological Multi-Level Simulation framework)</title>
10     <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
11     <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
12     <link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
13     <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
14     <script type="text/javascript" src="_static/jquery.js"></script>
15     <script type="text/javascript" src="_static/underscore.js"></script>
16     <script type="text/javascript" src="_static/doctools.js"></script>
17     <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
18     <link rel="shortcut icon" href="_static/STEMAH-favicon.png"/>
19     <link rel="index" title="Index" href="genindex.html" />
20     <link rel="search" title="Search" href="search.html" />
21     <link rel="next" title="emulsion.agent.core package" href="emulsion.agent.core.html" />
22     <link rel="prev" title="emulsion package" href="emulsion.html" />
23    
24   <link rel="stylesheet" href="_static/custom.css" type="text/css" />
25   
26   
27   <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
29   </head><body>
30   
32     <div class="document">
33       <div class="documentwrapper">
34         <div class="bodywrapper">
35           <div class="body" role="main">
36             
37   <div class="section" id="module-emulsion.agent">
38 <span id="emulsion-agent-package"></span><h1>emulsion.agent package<a class="headerlink" href="#module-emulsion.agent" title="Permalink to this headline">¶</a></h1>
39 <span class="target" id="module-emulsion.agent"></span><p>A Python implementation of EMULSION framework (Epidemiologic
40 MUlti-Level SImulatiONs).</p>
41 <p>This module contains classes and functions for handling all kinds of
42 entities involved in epidemiologic models.</p>
43 <div class="section" id="subpackages">
44 <h2>Subpackages<a class="headerlink" href="#subpackages" title="Permalink to this headline">¶</a></h2>
45 <div class="toctree-wrapper compound">
46 <ul>
47 <li class="toctree-l1"><a class="reference internal" href="emulsion.agent.core.html">emulsion.agent.core package</a><ul>
48 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.core.html#submodules">Submodules</a></li>
49 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.core.html#module-emulsion.agent.core.abstract_agent">emulsion.agent.core.abstract_agent module</a></li>
50 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.core.html#module-emulsion.agent.core.emulsion_agent">emulsion.agent.core.emulsion_agent module</a></li>
51 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.core.html#module-emulsion.agent.core.groups">emulsion.agent.core.groups module</a></li>
52 </ul>
53 </li>
54 <li class="toctree-l1"><a class="reference internal" href="emulsion.agent.managers.html">emulsion.agent.managers package</a><ul>
55 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#submodules">Submodules</a></li>
56 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#module-emulsion.agent.managers.abstract_process_manager">emulsion.agent.managers.abstract_process_manager module</a></li>
57 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#module-emulsion.agent.managers.compart_process_manager">emulsion.agent.managers.compart_process_manager module</a></li>
58 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#module-emulsion.agent.managers.functions">emulsion.agent.managers.functions module</a></li>
59 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#module-emulsion.agent.managers.group_manager">emulsion.agent.managers.group_manager module</a></li>
60 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#module-emulsion.agent.managers.ibm_process_manager">emulsion.agent.managers.ibm_process_manager module</a></li>
61 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#module-emulsion.agent.managers.metapop_process_manager">emulsion.agent.managers.metapop_process_manager module</a></li>
62 <li class="toctree-l2"><a class="reference internal" href="emulsion.agent.managers.html#module-emulsion.agent.managers.multi_process_manager">emulsion.agent.managers.multi_process_manager module</a></li>
63 </ul>
64 </li>
65 </ul>
66 </div>
67 </div>
68 <div class="section" id="submodules">
69 <h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
70 </div>
71 <div class="section" id="module-emulsion.agent.action">
72 <span id="emulsion-agent-action-module"></span><h2>emulsion.agent.action module<a class="headerlink" href="#module-emulsion.agent.action" title="Permalink to this headline">¶</a></h2>
73 <p>A Python implementation of the EMuLSion framework (Epidemiologic
74 MUlti-Level SImulatiONs).</p>
75 <p>Classes and functions for actions.</p>
76 <dl class="class">
77 <dt id="emulsion.agent.action.AbstractAction">
78 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">AbstractAction</code><span class="sig-paren">(</span><em>state_machine=None</em>, <em>**_</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#AbstractAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.AbstractAction" title="Permalink to this definition">¶</a></dt>
79 <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
80 <p>AbstractActions are aimed at describing actions triggered by a
81 state machine.</p>
82 <dl class="classmethod">
83 <dt id="emulsion.agent.action.AbstractAction.build_action">
84 <em class="property">classmethod </em><code class="descname">build_action</code><span class="sig-paren">(</span><em>action_name</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#AbstractAction.build_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.AbstractAction.build_action" title="Permalink to this definition">¶</a></dt>
85 <dd><p>Return an instance of the appropriate Action subclass,
86 depending on its name. The appropriate parameters for this
87 action should be passed as a dictionary.</p>
88 </dd></dl>
90 <dl class="method">
91 <dt id="emulsion.agent.action.AbstractAction.execute_action">
92 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#AbstractAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.AbstractAction.execute_action" title="Permalink to this definition">¶</a></dt>
93 <dd><p>Execute the action on the specified unit.</p>
94 </dd></dl>
96 </dd></dl>
98 <dl class="class">
99 <dt id="emulsion.agent.action.BecomeAction">
100 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">BecomeAction</code><span class="sig-paren">(</span><em>prototypes=[]</em>, <em>probas=None</em>, <em>model=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#BecomeAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.BecomeAction" title="Permalink to this definition">¶</a></dt>
101 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.AbstractAction" title="emulsion.agent.action.AbstractAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.AbstractAction</span></code></a></p>
102 <p>A BecomeAction is aimed at making an agent change its state
103 according to one ore more specified prototypes.</p>
104 <dl class="method">
105 <dt id="emulsion.agent.action.BecomeAction.execute_action">
106 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>agents=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#BecomeAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.BecomeAction.execute_action" title="Permalink to this definition">¶</a></dt>
107 <dd><p>Execute the action in the specified unit. If the <cite>agents</cite> parameter
108 is specified (as a list), each agent of this list will execute
109 the action. If changes of state variables in relation to a
110 state machine occur, the corresponding actions (if any) are
111 executed: on_exit from the current state, and on_enter for the
112 new state.</p>
113 </dd></dl>
115 </dd></dl>
117 <dl class="class">
118 <dt id="emulsion.agent.action.CloneAction">
119 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">CloneAction</code><span class="sig-paren">(</span><em>prototypes=[]</em>, <em>amount=None</em>, <em>probas=None</em>, <em>model=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#CloneAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.CloneAction" title="Permalink to this definition">¶</a></dt>
120 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.AbstractAction" title="emulsion.agent.action.AbstractAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.AbstractAction</span></code></a></p>
121 <p>A CloneAction produces several copies of the agent with a given
122 prototype.</p>
123 <dl class="method">
124 <dt id="emulsion.agent.action.CloneAction.execute_action">
125 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>agents=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#CloneAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.CloneAction.execute_action" title="Permalink to this definition">¶</a></dt>
126 <dd><p>Execute the action in the specified unit. If the <cite>agents</cite> parameter
127 is specified (as a list), each agent of this list will execute
128 the action. If changes of state variables in relation to a
129 state machine occur, the corresponding actions (if any) are
130 executed: on_exit from the current state, and on_enter for the
131 new state.</p>
132 </dd></dl>
134 </dd></dl>
136 <dl class="class">
137 <dt id="emulsion.agent.action.FunctionAction">
138 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">FunctionAction</code><span class="sig-paren">(</span><em>function=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#FunctionAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.FunctionAction" title="Permalink to this definition">¶</a></dt>
139 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.MethodAction" title="emulsion.agent.action.MethodAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.MethodAction</span></code></a></p>
140 <p>A FunctionAction is aimed at making an agent perform an action
141 on a specific population. It requires a function, and optionnally
142 a list and a dictionary of parameters. A FunctionAction runs
143 faster than a MethodAction since it does not require to retrieve
144 the method in each agent.</p>
145 <dl class="method">
146 <dt id="emulsion.agent.action.FunctionAction.execute_action">
147 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>agents=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#FunctionAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.FunctionAction.execute_action" title="Permalink to this definition">¶</a></dt>
148 <dd><p>Execute the action using the specified unit. If the
149 <cite>agents</cite> parameter is a list of units, each unit of this list
150 will execute the action.</p>
151 </dd></dl>
153 </dd></dl>
155 <dl class="exception">
156 <dt id="emulsion.agent.action.InvalidActionException">
157 <em class="property">exception </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">InvalidActionException</code><span class="sig-paren">(</span><em>message</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#InvalidActionException"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.InvalidActionException" title="Permalink to this definition">¶</a></dt>
158 <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
159 <p>Exception raised when a semantic error occurs in action definition.</p>
160 </dd></dl>
162 <dl class="class">
163 <dt id="emulsion.agent.action.MessageAction">
164 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">MessageAction</code><span class="sig-paren">(</span><em>parameter=None</em>, <em>l_params=[]</em>, <em>d_params={}</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#MessageAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.MessageAction" title="Permalink to this definition">¶</a></dt>
165 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.StringAction" title="emulsion.agent.action.StringAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.StringAction</span></code></a></p>
166 <p>A MessageAction is aimed at making an agent print a given
167 string. It requires a string message. This string can contain one
168 reference to a variable or method of the agent, using Python’s
169 formatting syntax.</p>
170 <p>For instance, ‘My state is {.statevars.health_state}’ will print
171 the current health state of the agent.</p>
172 <p>Output is formatted in three comma-separated fields: the time step
173 when the message was produced, the agent speaking, and the message
174 itself.</p>
175 <dl class="method">
176 <dt id="emulsion.agent.action.MessageAction.execute_action">
177 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>agents=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#MessageAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.MessageAction.execute_action" title="Permalink to this definition">¶</a></dt>
178 <dd><p>Execute the action in the specified unit. If the <cite>agents</cite> parameter
179 is specified (as a list), each agent of this list will execute
180 the action.</p>
181 </dd></dl>
183 </dd></dl>
185 <dl class="class">
186 <dt id="emulsion.agent.action.MethodAction">
187 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">MethodAction</code><span class="sig-paren">(</span><em>method=None</em>, <em>l_params=[]</em>, <em>d_params={}</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#MethodAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.MethodAction" title="Permalink to this definition">¶</a></dt>
188 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.AbstractAction" title="emulsion.agent.action.AbstractAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.AbstractAction</span></code></a></p>
189 <p>A MethodAction is aimed at making an agent perform an action on
190 a specific population. It requires a method name, and optionnally
191 a list and a dictionary of parameters.</p>
192 <dl class="method">
193 <dt id="emulsion.agent.action.MethodAction.execute_action">
194 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>agents=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#MethodAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.MethodAction.execute_action" title="Permalink to this definition">¶</a></dt>
195 <dd><p>Execute the action using the specified unit. If the
196 <cite>agents</cite> parameter is a list of units, each unit of this list
197 will execute the action.</p>
198 </dd></dl>
200 </dd></dl>
202 <dl class="class">
203 <dt id="emulsion.agent.action.RateAdditiveAction">
204 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">RateAdditiveAction</code><span class="sig-paren">(</span><em>sign=1</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#RateAdditiveAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.RateAdditiveAction" title="Permalink to this definition">¶</a></dt>
205 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.ValueAction" title="emulsion.agent.action.ValueAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.ValueAction</span></code></a></p>
206 <p>A RateChangeAction is aimed at increasing or decreasing a
207 specific state variable or attribute, according to a specific rate
208 (i.e. the actual increase or decrease is the product of the
209 <cite>parameter</cite> attribute and a population size).</p>
210 <dl class="method">
211 <dt id="emulsion.agent.action.RateAdditiveAction.execute_action">
212 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>population=None</em>, <em>agents=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#RateAdditiveAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.RateAdditiveAction.execute_action" title="Permalink to this definition">¶</a></dt>
213 <dd><p>Execute the action on the specified unit, with the
214 specified population size.</p>
215 </dd></dl>
217 </dd></dl>
219 <dl class="class">
220 <dt id="emulsion.agent.action.RateDecreaseAction">
221 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">RateDecreaseAction</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#RateDecreaseAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.RateDecreaseAction" title="Permalink to this definition">¶</a></dt>
222 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.RateAdditiveAction" title="emulsion.agent.action.RateAdditiveAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.RateAdditiveAction</span></code></a></p>
223 <p>A RateDecreaseAction is aimed at decreasing a specific state
224 variable or attribute, according to a specific rate (i.e. the
225 actual decrease is the product of the <cite>parameter</cite> attribute and a
226 population size).</p>
227 </dd></dl>
229 <dl class="class">
230 <dt id="emulsion.agent.action.RateIncreaseAction">
231 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">RateIncreaseAction</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#RateIncreaseAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.RateIncreaseAction" title="Permalink to this definition">¶</a></dt>
232 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.RateAdditiveAction" title="emulsion.agent.action.RateAdditiveAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.RateAdditiveAction</span></code></a></p>
233 <p>A RateIncreaseAction is aimed at increasing a specific state
234 variable or attribute, according to a specific rate (i.e. the
235 actual increase is the product of the <cite>parameter</cite> attribute and a
236 population size).</p>
237 </dd></dl>
239 <dl class="class">
240 <dt id="emulsion.agent.action.SetVarAction">
241 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">SetVarAction</code><span class="sig-paren">(</span><em>statevar_name=None</em>, <em>parameter=None</em>, <em>model=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#SetVarAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.SetVarAction" title="Permalink to this definition">¶</a></dt>
242 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.ValueAction" title="emulsion.agent.action.ValueAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.ValueAction</span></code></a></p>
243 <p>SetVarAction allow to set the variable of the agent.</p>
244 <dl class="method">
245 <dt id="emulsion.agent.action.SetVarAction.execute_action">
246 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>agents=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#SetVarAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.SetVarAction.execute_action" title="Permalink to this definition">¶</a></dt>
247 <dd><p>Execute the action in the specified unit. If the <cite>agents</cite> parameter
248 is specified (as a list), each agent of this list will execute
249 the action. If changes of state variables in relation to a
250 state machine occur, the corresponding actions (if any) are
251 executed: on_exit from the current state, and on_enter for the
252 new state.</p>
253 </dd></dl>
255 </dd></dl>
257 <dl class="class">
258 <dt id="emulsion.agent.action.StochAdditiveAction">
259 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">StochAdditiveAction</code><span class="sig-paren">(</span><em>sign=1</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#StochAdditiveAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.StochAdditiveAction" title="Permalink to this definition">¶</a></dt>
260 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.ValueAction" title="emulsion.agent.action.ValueAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.ValueAction</span></code></a></p>
261 <p>A StochAdditiveAction is aimed at increasing or decreasing a
262 specific state variable or attribute, according to a specific
263 rate, using a <em>binomial sampling</em>.</p>
264 <dl class="method">
265 <dt id="emulsion.agent.action.StochAdditiveAction.execute_action">
266 <code class="descname">execute_action</code><span class="sig-paren">(</span><em>unit</em>, <em>population=None</em>, <em>agents=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#StochAdditiveAction.execute_action"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.StochAdditiveAction.execute_action" title="Permalink to this definition">¶</a></dt>
267 <dd><p>Execute the action on the specified unit, with the
268 specified population size.</p>
269 </dd></dl>
271 </dd></dl>
273 <dl class="class">
274 <dt id="emulsion.agent.action.StochDecreaseAction">
275 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">StochDecreaseAction</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#StochDecreaseAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.StochDecreaseAction" title="Permalink to this definition">¶</a></dt>
276 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.StochAdditiveAction" title="emulsion.agent.action.StochAdditiveAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.StochAdditiveAction</span></code></a></p>
277 <p>A StochDecreaseAction is aimed at decreasing a specific state
278 variable or attribute, according to a specific rate, using a
279 <em>binomial sampling</em>.</p>
280 </dd></dl>
282 <dl class="class">
283 <dt id="emulsion.agent.action.StochIncreaseAction">
284 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">StochIncreaseAction</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#StochIncreaseAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.StochIncreaseAction" title="Permalink to this definition">¶</a></dt>
285 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.StochAdditiveAction" title="emulsion.agent.action.StochAdditiveAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.StochAdditiveAction</span></code></a></p>
286 <p>A StochIncreaseAction is aimed at increasing a specific state
287 variable or attribute, according to a specific rate, using a
288 <em>binomial sampling</em>.</p>
289 </dd></dl>
291 <dl class="class">
292 <dt id="emulsion.agent.action.StringAction">
293 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">StringAction</code><span class="sig-paren">(</span><em>parameter=None</em>, <em>l_params=[]</em>, <em>d_params={}</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#StringAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.StringAction" title="Permalink to this definition">¶</a></dt>
294 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.AbstractAction" title="emulsion.agent.action.AbstractAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.AbstractAction</span></code></a></p>
295 <p>A StringAction is based on the specification of a string
296 parameter.</p>
297 </dd></dl>
299 <dl class="class">
300 <dt id="emulsion.agent.action.ValueAction">
301 <em class="property">class </em><code class="descclassname">emulsion.agent.action.</code><code class="descname">ValueAction</code><span class="sig-paren">(</span><em>statevar_name=None</em>, <em>parameter=None</em>, <em>delta_t=1</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/action.html#ValueAction"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.action.ValueAction" title="Permalink to this definition">¶</a></dt>
302 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.action.AbstractAction" title="emulsion.agent.action.AbstractAction"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.action.AbstractAction</span></code></a></p>
303 <p>ValueActions represent modifications of state variables or
304 attributes.</p>
305 </dd></dl>
307 </div>
308 <div class="section" id="module-emulsion.agent.atoms">
309 <span id="emulsion-agent-atoms-module"></span><h2>emulsion.agent.atoms module<a class="headerlink" href="#module-emulsion.agent.atoms" title="Permalink to this headline">¶</a></h2>
310 <p>A Python implementation of the EMuLSion framework (Epidemiologic
311 MUlti-Level SImulatiONs).</p>
312 <p>Classes and functions for entities management.</p>
313 <dl class="class">
314 <dt id="emulsion.agent.atoms.AtomAgent">
315 <em class="property">class </em><code class="descclassname">emulsion.agent.atoms.</code><code class="descname">AtomAgent</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#AtomAgent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent" title="Permalink to this definition">¶</a></dt>
316 <dd><p>Bases: <a class="reference internal" href="emulsion.agent.core.html#emulsion.agent.core.emulsion_agent.EmulsionAgent" title="emulsion.agent.core.emulsion_agent.EmulsionAgent"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.core.emulsion_agent.EmulsionAgent</span></code></a></p>
317 <p>The AtomAgent is aimed at representing an ‘individual’, i.e. the
318 smallest organization level to be modeled as an entity in the
319 simulation. An AtomAgent may be situated in several hosts, each one
320 associated with a specific tuple of state variables.</p>
321 <dl class="method">
322 <dt id="emulsion.agent.atoms.AtomAgent.add_host">
323 <code class="descname">add_host</code><span class="sig-paren">(</span><em>host</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#AtomAgent.add_host"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.add_host" title="Permalink to this definition">¶</a></dt>
324 <dd><p>Add the specified host to the current AtomAgent, associated
325 with the specified key.</p>
326 </dd></dl>
328 <dl class="attribute">
329 <dt id="emulsion.agent.atoms.AtomAgent.agcount">
330 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.agcount" title="Permalink to this definition">¶</a></dt>
331 <dd></dd></dl>
333 <dl class="attribute">
334 <dt id="emulsion.agent.atoms.AtomAgent.agdict">
335 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.agdict" title="Permalink to this definition">¶</a></dt>
336 <dd></dd></dl>
338 <dl class="method">
339 <dt id="emulsion.agent.atoms.AtomAgent.clone">
340 <code class="descname">clone</code><span class="sig-paren">(</span><em>prototype=None</em>, <em>custom_prototype=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#AtomAgent.clone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.clone" title="Permalink to this definition">¶</a></dt>
341 <dd><p>Make a copy of the current compartment with the specified
342 observable/value settings. If a prototype is provided, it is
343 applied to the new atom.</p>
344 </dd></dl>
346 <dl class="attribute">
347 <dt id="emulsion.agent.atoms.AtomAgent.families">
348 <code class="descname">families</code><em class="property"> = SortedSet(['AtomAgent'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.families" title="Permalink to this definition">¶</a></dt>
349 <dd></dd></dl>
351 <dl class="method">
352 <dt id="emulsion.agent.atoms.AtomAgent.get_content">
353 <code class="descname">get_content</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#AtomAgent.get_content"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.get_content" title="Permalink to this definition">¶</a></dt>
354 <dd><p>Return the population (1) of the current unit.</p>
355 </dd></dl>
357 <dl class="method">
358 <dt id="emulsion.agent.atoms.AtomAgent.get_host">
359 <code class="descname">get_host</code><span class="sig-paren">(</span><em>key='MASTER'</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#AtomAgent.get_host"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.get_host" title="Permalink to this definition">¶</a></dt>
360 <dd><p>Retrieve the host of the current AtomAgent identified by the
361 specific key.</p>
362 </dd></dl>
364 <dl class="attribute">
365 <dt id="emulsion.agent.atoms.AtomAgent.members">
366 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', '__len__', 'get_content', 'add_host', 'remove_host', 'get_host', 'clone', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.members" title="Permalink to this definition">¶</a></dt>
367 <dd></dd></dl>
369 <dl class="method">
370 <dt id="emulsion.agent.atoms.AtomAgent.remove_host">
371 <code class="descname">remove_host</code><span class="sig-paren">(</span><em>host</em>, <em>keys=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#AtomAgent.remove_host"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.AtomAgent.remove_host" title="Permalink to this definition">¶</a></dt>
372 <dd><p>Remove the specified host from the current AtomAgent,
373 associated with the specified key.</p>
374 </dd></dl>
376 </dd></dl>
378 <dl class="class">
379 <dt id="emulsion.agent.atoms.EvolvingAtom">
380 <em class="property">class </em><code class="descclassname">emulsion.agent.atoms.</code><code class="descname">EvolvingAtom</code><span class="sig-paren">(</span><em>statemachines=[]</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#EvolvingAtom"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom" title="Permalink to this definition">¶</a></dt>
381 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.atoms.AtomAgent" title="emulsion.agent.atoms.AtomAgent"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.atoms.AtomAgent</span></code></a></p>
382 <p>An EvolvingAtom is able to change state according to its
383 own statemachines.</p>
384 <dl class="method">
385 <dt id="emulsion.agent.atoms.EvolvingAtom.add_method_process">
386 <code class="descname">add_method_process</code><span class="sig-paren">(</span><em>process_name</em>, <em>method=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#EvolvingAtom.add_method_process"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.add_method_process" title="Permalink to this definition">¶</a></dt>
387 <dd><p>Add a process based on a method name.</p>
388 </dd></dl>
390 <dl class="attribute">
391 <dt id="emulsion.agent.atoms.EvolvingAtom.agcount">
392 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.agcount" title="Permalink to this definition">¶</a></dt>
393 <dd></dd></dl>
395 <dl class="attribute">
396 <dt id="emulsion.agent.atoms.EvolvingAtom.agdict">
397 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.agdict" title="Permalink to this definition">¶</a></dt>
398 <dd></dd></dl>
400 <dl class="method">
401 <dt id="emulsion.agent.atoms.EvolvingAtom.evolve">
402 <code class="descname">evolve</code><span class="sig-paren">(</span><em>machine=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#EvolvingAtom.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.evolve" title="Permalink to this definition">¶</a></dt>
403 <dd><p>This method is aimed at defining what has systematically to
404 be done in the unit at each time step (e.g. age change…). It
405 has to be overriden if needed in subclasses.</p>
406 </dd></dl>
408 <dl class="method">
409 <dt id="emulsion.agent.atoms.EvolvingAtom.evolve_states">
410 <code class="descname">evolve_states</code><span class="sig-paren">(</span><em>machine=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#EvolvingAtom.evolve_states"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.evolve_states" title="Permalink to this definition">¶</a></dt>
411 <dd><p>Change the state of the current unit according to the
412 specified state machine name. If no special state machine is
413 provided, executes all the machines.</p>
414 </dd></dl>
416 <dl class="attribute">
417 <dt id="emulsion.agent.atoms.EvolvingAtom.families">
418 <code class="descname">families</code><em class="property"> = SortedSet(['EvolvingAtom'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.families" title="Permalink to this definition">¶</a></dt>
419 <dd></dd></dl>
421 <dl class="method">
422 <dt id="emulsion.agent.atoms.EvolvingAtom.get_machine">
423 <code class="descname">get_machine</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#EvolvingAtom.get_machine"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.get_machine" title="Permalink to this definition">¶</a></dt>
424 <dd><p>Return the state machine with the specified name.</p>
425 </dd></dl>
427 <dl class="method">
428 <dt id="emulsion.agent.atoms.EvolvingAtom.init_level_processes">
429 <code class="descname">init_level_processes</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#EvolvingAtom.init_level_processes"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.init_level_processes" title="Permalink to this definition">¶</a></dt>
430 <dd><p>Initialize the level of the agent.</p>
431 </dd></dl>
433 <dl class="attribute">
434 <dt id="emulsion.agent.atoms.EvolvingAtom.members">
435 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', 'set_statemachines', 'init_level_processes', 'add_method_process', 'get_machine', 'evolve', 'evolve_states', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.members" title="Permalink to this definition">¶</a></dt>
436 <dd></dd></dl>
438 <dl class="method">
439 <dt id="emulsion.agent.atoms.EvolvingAtom.set_statemachines">
440 <code class="descname">set_statemachines</code><span class="sig-paren">(</span><em>statemachines</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/atoms.html#EvolvingAtom.set_statemachines"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.atoms.EvolvingAtom.set_statemachines" title="Permalink to this definition">¶</a></dt>
441 <dd><p>Define the state machines that this agent is able to execute.</p>
442 </dd></dl>
444 </dd></dl>
446 </div>
447 <div class="section" id="module-emulsion.agent.comparts">
448 <span id="emulsion-agent-comparts-module"></span><h2>emulsion.agent.comparts module<a class="headerlink" href="#module-emulsion.agent.comparts" title="Permalink to this headline">¶</a></h2>
449 <p>A Python implementation of the EMuLSion framework (Epidemiologic
450 MUlti-Level SImulatiONs).</p>
451 <p>Classes and functions for entities management.</p>
452 <dl class="class">
453 <dt id="emulsion.agent.comparts.Compartment">
454 <em class="property">class </em><code class="descclassname">emulsion.agent.comparts.</code><code class="descname">Compartment</code><span class="sig-paren">(</span><em>population=0</em>, <em>stochastic=True</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/comparts.html#Compartment"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.comparts.Compartment" title="Permalink to this definition">¶</a></dt>
455 <dd><p>Bases: <a class="reference internal" href="emulsion.agent.core.html#emulsion.agent.core.groups.GroupAgent" title="emulsion.agent.core.groups.GroupAgent"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.core.groups.GroupAgent</span></code></a></p>
456 <p>An Compartment is a compartment which does not
457 represent the underlying level but with aggregate information such
458 as the total population (‘individuals’ are not represented).</p>
459 <dl class="method">
460 <dt id="emulsion.agent.comparts.Compartment.add">
461 <code class="descname">add</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/comparts.html#Compartment.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.comparts.Compartment.add" title="Permalink to this definition">¶</a></dt>
462 <dd><p>Add the specified population to the current population of
463 the compartment.</p>
464 </dd></dl>
466 <dl class="attribute">
467 <dt id="emulsion.agent.comparts.Compartment.agcount">
468 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.comparts.Compartment.agcount" title="Permalink to this definition">¶</a></dt>
469 <dd></dd></dl>
471 <dl class="attribute">
472 <dt id="emulsion.agent.comparts.Compartment.agdict">
473 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.comparts.Compartment.agdict" title="Permalink to this definition">¶</a></dt>
474 <dd></dd></dl>
476 <dl class="method">
477 <dt id="emulsion.agent.comparts.Compartment.clone">
478 <code class="descname">clone</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/comparts.html#Compartment.clone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.comparts.Compartment.clone" title="Permalink to this definition">¶</a></dt>
479 <dd><p>Make a copy of the current compartment with the specified
480 observable/value settings. The new content is empty.</p>
481 </dd></dl>
483 <dl class="attribute">
484 <dt id="emulsion.agent.comparts.Compartment.families">
485 <code class="descname">families</code><em class="property"> = SortedSet(['Compartment'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.comparts.Compartment.families" title="Permalink to this definition">¶</a></dt>
486 <dd></dd></dl>
488 <dl class="method">
489 <dt id="emulsion.agent.comparts.Compartment.get_content">
490 <code class="descname">get_content</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/comparts.html#Compartment.get_content"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.comparts.Compartment.get_content" title="Permalink to this definition">¶</a></dt>
491 <dd><p>Return the population of the current unit.</p>
492 </dd></dl>
494 <dl class="attribute">
495 <dt id="emulsion.agent.comparts.Compartment.members">
496 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', '__len__', 'get_content', 'add', 'remove', '_base_move', 'move_to', 'population', 'clone', 'next_states', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.comparts.Compartment.members" title="Permalink to this definition">¶</a></dt>
497 <dd></dd></dl>
499 <dl class="method">
500 <dt id="emulsion.agent.comparts.Compartment.move_to">
501 <code class="descname">move_to</code><span class="sig-paren">(</span><em>other_unit</em>, <em>population</em>, <em>state_machine=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/comparts.html#Compartment.move_to"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.comparts.Compartment.move_to" title="Permalink to this definition">¶</a></dt>
502 <dd><p>Move the specified population from the current population
503 of the compartment (the population is kept positive) to the
504 other unit. If a state machine is provided, executes the
505 corresponding actions when entering/exiting nodes and crossing
506 edges if needed.</p>
507 </dd></dl>
509 <dl class="method">
510 <dt id="emulsion.agent.comparts.Compartment.next_states">
511 <code class="descname">next_states</code><span class="sig-paren">(</span><em>states</em>, <em>values</em>, <em>populations</em>, <em>actions</em>, <em>method=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/comparts.html#Compartment.next_states"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.comparts.Compartment.next_states" title="Permalink to this definition">¶</a></dt>
512 <dd><p>Compute the population moving from the current compartment to each
513 of the destination states, handling the values according the
514 the specified method. Values can be handled either as absolute
515 amounts (‘amount’ method), as proportions (‘rate’, in a
516 deterministic approach) or as probabilities (‘proba’, in a
517 stochastic approach). Actions are to be performed when
518 changing state. The actual population affected by the
519 transitions is stored in the first element of the
520 <cite>populations</cite> parameter, as a dictionary: {‘population’:
521 number, ‘actions’: actions}. Several edges can lead to the
522 same state.</p>
523 <dl class="docutils">
524 <dt>Return a list of tuples:</dt>
525 <dd>(state, {‘population’: qty, ‘actions:’ list of actions})</dd>
526 </dl>
527 </dd></dl>
529 <dl class="attribute">
530 <dt id="emulsion.agent.comparts.Compartment.population">
531 <code class="descname">population</code><a class="headerlink" href="#emulsion.agent.comparts.Compartment.population" title="Permalink to this definition">¶</a></dt>
532 <dd></dd></dl>
534 <dl class="method">
535 <dt id="emulsion.agent.comparts.Compartment.remove">
536 <code class="descname">remove</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/comparts.html#Compartment.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.comparts.Compartment.remove" title="Permalink to this definition">¶</a></dt>
537 <dd><p>Remove the specified population from the current population
538 of the compartment (the population is kept positive).</p>
539 </dd></dl>
541 </dd></dl>
543 </div>
544 <div class="section" id="module-emulsion.agent.exceptions">
545 <span id="emulsion-agent-exceptions-module"></span><h2>emulsion.agent.exceptions module<a class="headerlink" href="#module-emulsion.agent.exceptions" title="Permalink to this headline">¶</a></h2>
546 <p>A Python implementation of the EMuLSion framework (Epidemiologic
547 MUlti-Level SImulatiONs).</p>
548 <p>Exceptions raised by agents.</p>
549 <dl class="exception">
550 <dt id="emulsion.agent.exceptions.InvalidCompartmentOperation">
551 <em class="property">exception </em><code class="descclassname">emulsion.agent.exceptions.</code><code class="descname">InvalidCompartmentOperation</code><span class="sig-paren">(</span><em>source</em>, <em>operation</em>, <em>params</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/exceptions.html#InvalidCompartmentOperation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.exceptions.InvalidCompartmentOperation" title="Permalink to this definition">¶</a></dt>
552 <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
553 <p>Exception raised when a compartiment is asked for impossible
554 operations, such as adding numbers to a list of units.</p>
555 </dd></dl>
557 <dl class="exception">
558 <dt id="emulsion.agent.exceptions.LevelException">
559 <em class="property">exception </em><code class="descclassname">emulsion.agent.exceptions.</code><code class="descname">LevelException</code><span class="sig-paren">(</span><em>cause</em>, <em>level</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/exceptions.html#LevelException"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.exceptions.LevelException" title="Permalink to this definition">¶</a></dt>
560 <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
561 <p>Exception raised when a semantic error occurs during model parsing.</p>
562 </dd></dl>
564 <dl class="exception">
565 <dt id="emulsion.agent.exceptions.StateVarNotFoundException">
566 <em class="property">exception </em><code class="descclassname">emulsion.agent.exceptions.</code><code class="descname">StateVarNotFoundException</code><span class="sig-paren">(</span><em>statevar</em>, <em>source</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/exceptions.html#StateVarNotFoundException"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.exceptions.StateVarNotFoundException" title="Permalink to this definition">¶</a></dt>
567 <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">Exception</span></code></p>
568 <p>Exception raised when a semantic error occurs during model parsing.</p>
569 </dd></dl>
571 </div>
572 <div class="section" id="module-emulsion.agent.meta">
573 <span id="emulsion-agent-meta-module"></span><h2>emulsion.agent.meta module<a class="headerlink" href="#module-emulsion.agent.meta" title="Permalink to this headline">¶</a></h2>
574 <p>A Python implementation of the EMuLSion framework (Epidemiologic
575 MUlti-Level SImulatiONs).</p>
576 <p>Classes and functions for abstract agent management.</p>
577 <p>Part of this code was adapted from the PADAWAN framework (S. Picault,
578 Univ. Lille).</p>
579 <dl class="class">
580 <dt id="emulsion.agent.meta.MetaAgent">
581 <em class="property">class </em><code class="descclassname">emulsion.agent.meta.</code><code class="descname">MetaAgent</code><a class="reference internal" href="_modules/emulsion/agent/meta.html#MetaAgent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.meta.MetaAgent" title="Permalink to this definition">¶</a></dt>
582 <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">abc.ABCMeta</span></code></p>
583 <p>The Metaclass definition for all agents. When created, agents
584 are stored in a class-specific dictionaries of agents. They are
585 given an ID value (unique value within each class) and can be
586 assigned to several agents families (by default, each agent is
587 assigned to its own class).</p>
588 </dd></dl>
590 </div>
591 <div class="section" id="module-emulsion.agent.process">
592 <span id="emulsion-agent-process-module"></span><h2>emulsion.agent.process module<a class="headerlink" href="#module-emulsion.agent.process" title="Permalink to this headline">¶</a></h2>
593 <p>A Python implementation of the EMuLSion framework (Epidemiologic
594 MUlti-Level SImulatiONs).</p>
595 <p>Classes and functions for process management in MultiProcessCompartments.</p>
596 <dl class="class">
597 <dt id="emulsion.agent.process.AbstractProcess">
598 <em class="property">class </em><code class="descclassname">emulsion.agent.process.</code><code class="descname">AbstractProcess</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#AbstractProcess"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.AbstractProcess" title="Permalink to this definition">¶</a></dt>
599 <dd><p>Bases: <code class="xref py py-class docutils literal notranslate"><span class="pre">object</span></code></p>
600 <p>An AbstractProcess is aimed at controlling a specific activity
601 in a compartment, and is identified by its name.</p>
602 <dl class="method">
603 <dt id="emulsion.agent.process.AbstractProcess.evolve">
604 <code class="descname">evolve</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#AbstractProcess.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.AbstractProcess.evolve" title="Permalink to this definition">¶</a></dt>
605 <dd><p>Define the actions that the process must perform.</p>
606 </dd></dl>
608 </dd></dl>
610 <dl class="class">
611 <dt id="emulsion.agent.process.MethodProcess">
612 <em class="property">class </em><code class="descclassname">emulsion.agent.process.</code><code class="descname">MethodProcess</code><span class="sig-paren">(</span><em>name</em>, <em>method</em>, <em>lparams=[]</em>, <em>dparams={}</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#MethodProcess"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.MethodProcess" title="Permalink to this definition">¶</a></dt>
613 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.process.AbstractProcess" title="emulsion.agent.process.AbstractProcess"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.process.AbstractProcess</span></code></a></p>
614 <p>A MethodProcess is aimed at running a specific method (and
615 possibly any function or even any callable object).</p>
616 <dl class="method">
617 <dt id="emulsion.agent.process.MethodProcess.evolve">
618 <code class="descname">evolve</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#MethodProcess.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.MethodProcess.evolve" title="Permalink to this definition">¶</a></dt>
619 <dd><p>Define the actions that the process must perform. In a
620 MethodProcess, those actions consist in running the method of
621 the target compartment.</p>
622 </dd></dl>
624 </dd></dl>
626 <dl class="class">
627 <dt id="emulsion.agent.process.StateMachineProcess">
628 <em class="property">class </em><code class="descclassname">emulsion.agent.process.</code><code class="descname">StateMachineProcess</code><span class="sig-paren">(</span><em>name</em>, <em>agent</em>, <em>state_machine</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#StateMachineProcess"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.StateMachineProcess" title="Permalink to this definition">¶</a></dt>
629 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.process.AbstractProcess" title="emulsion.agent.process.AbstractProcess"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.process.AbstractProcess</span></code></a></p>
630 <p>A StateMachineProcess is aimed at running a specific state machine
631 within the agent (not within a grouping).</p>
632 <dl class="method">
633 <dt id="emulsion.agent.process.StateMachineProcess.evolve">
634 <code class="descname">evolve</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#StateMachineProcess.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.StateMachineProcess.evolve" title="Permalink to this definition">¶</a></dt>
635 <dd><p>Define the actions that the process must perform. In a
636 StateMachineProcess, those actions consist in 1) executing the
637 transitions of the state machine to change the agent’s states
638 and 2) computing productions and transmit them to the upper
639 level of the agent.</p>
640 </dd></dl>
642 <dl class="method">
643 <dt id="emulsion.agent.process.StateMachineProcess.evolve_productions">
644 <code class="descname">evolve_productions</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#StateMachineProcess.evolve_productions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.StateMachineProcess.evolve_productions" title="Permalink to this definition">¶</a></dt>
645 <dd></dd></dl>
647 <dl class="method">
648 <dt id="emulsion.agent.process.StateMachineProcess.evolve_transitions">
649 <code class="descname">evolve_transitions</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/process.html#StateMachineProcess.evolve_transitions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.process.StateMachineProcess.evolve_transitions" title="Permalink to this definition">¶</a></dt>
650 <dd></dd></dl>
652 </dd></dl>
654 </div>
655 <div class="section" id="module-emulsion.agent.views">
656 <span id="emulsion-agent-views-module"></span><h2>emulsion.agent.views module<a class="headerlink" href="#module-emulsion.agent.views" title="Permalink to this headline">¶</a></h2>
657 <p>A Python implementation of the EMuLSion framework (Epidemiologic
658 MUlti-Level SImulatiONs).</p>
659 <p>Classes and functions for entities management.</p>
660 <dl class="class">
661 <dt id="emulsion.agent.views.AdaptiveView">
662 <em class="property">class </em><code class="descclassname">emulsion.agent.views.</code><code class="descname">AdaptiveView</code><span class="sig-paren">(</span><em>observables=(None</em>, <em>)</em>, <em>values=(None</em>, <em>)</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AdaptiveView"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AdaptiveView" title="Permalink to this definition">¶</a></dt>
663 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.views.SimpleView" title="emulsion.agent.views.SimpleView"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.views.SimpleView</span></code></a></p>
664 <p>An AdaptiveView is able to evaluate conditions on individuals
665 (AtomAgents) for state transitions, and to detect changes in its
666 content and automatically report it to the upper level. Each
667 compartment is associated with a particular value of a specific
668 state variable or attribute of the units in its content. At the
669 end of the evolve step, the compartment checks the values of the
670 units in its content and reports units where changes occured.</p>
671 <dl class="attribute">
672 <dt id="emulsion.agent.views.AdaptiveView.agcount">
673 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.agcount" title="Permalink to this definition">¶</a></dt>
674 <dd></dd></dl>
676 <dl class="attribute">
677 <dt id="emulsion.agent.views.AdaptiveView.agdict">
678 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.agdict" title="Permalink to this definition">¶</a></dt>
679 <dd></dd></dl>
681 <dl class="method">
682 <dt id="emulsion.agent.views.AdaptiveView.check_consistency">
683 <code class="descname">check_consistency</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AdaptiveView.check_consistency"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.check_consistency" title="Permalink to this definition">¶</a></dt>
684 <dd><p>Check the value of the observables of the current
685 compartment. Units which do not have the expected values are
686 notified to the upper level.</p>
687 </dd></dl>
689 <dl class="method">
690 <dt id="emulsion.agent.views.AdaptiveView.clone">
691 <code class="descname">clone</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AdaptiveView.clone"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.clone" title="Permalink to this definition">¶</a></dt>
692 <dd><p>Make a copy of the current compartment with the specified
693 observable/value settings. The new content is empty.</p>
694 </dd></dl>
696 <dl class="method">
697 <dt id="emulsion.agent.views.AdaptiveView.evaluate_condition">
698 <code class="descname">evaluate_condition</code><span class="sig-paren">(</span><em>condition</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AdaptiveView.evaluate_condition"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.evaluate_condition" title="Permalink to this definition">¶</a></dt>
699 <dd><p>Return the population of the compartment if the condition
700 is fulfilled, 0 otherwise.</p>
701 </dd></dl>
703 <dl class="method">
704 <dt id="emulsion.agent.views.AdaptiveView.evolve">
705 <code class="descname">evolve</code><span class="sig-paren">(</span><em>machine=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AdaptiveView.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.evolve" title="Permalink to this definition">¶</a></dt>
706 <dd><p>After the ordinary <code class="docutils literal notranslate"><span class="pre">evolve</span></code> step, check units which have
707 changed their value(s) of the compartment-specific
708 observable(s). The corresponding units are reported to the
709 upper level.</p>
710 </dd></dl>
712 <dl class="attribute">
713 <dt id="emulsion.agent.views.AdaptiveView.families">
714 <code class="descname">families</code><em class="property"> = SortedSet(['AdaptiveView'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.families" title="Permalink to this definition">¶</a></dt>
715 <dd></dd></dl>
717 <dl class="attribute">
718 <dt id="emulsion.agent.views.AdaptiveView.members">
719 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', 'evaluate_condition', 'next_states', 'evolve', 'check_consistency', 'clone', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.members" title="Permalink to this definition">¶</a></dt>
720 <dd></dd></dl>
722 <dl class="method">
723 <dt id="emulsion.agent.views.AdaptiveView.next_states">
724 <code class="descname">next_states</code><span class="sig-paren">(</span><em>states</em>, <em>values</em>, <em>populations</em>, <em>actions</em>, <em>method=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AdaptiveView.next_states"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AdaptiveView.next_states" title="Permalink to this definition">¶</a></dt>
725 <dd><p>Compute stochastically the population moving from each population
726 (tuples (‘agents’: list_of_agents)) in the <cite>populations</cite>
727 parameter, to each of the possible destination states,
728 according to each of the values interpreted as
729 probabilities. Actions are to be performed when changing
730 state. Several edges can lead to the same state.</p>
731 <dl class="docutils">
732 <dt>Return a list of tuples:</dt>
733 <dd>(state, {‘agent’: list of agents, ‘actions’: list of actions})</dd>
734 </dl>
735 </dd></dl>
737 </dd></dl>
739 <dl class="class">
740 <dt id="emulsion.agent.views.AutoStructuredView">
741 <em class="property">class </em><code class="descclassname">emulsion.agent.views.</code><code class="descname">AutoStructuredView</code><span class="sig-paren">(</span><em>key_variable=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AutoStructuredView"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AutoStructuredView" title="Permalink to this definition">¶</a></dt>
742 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.views.StructuredView" title="emulsion.agent.views.StructuredView"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.views.StructuredView</span></code></a></p>
743 <p>An AutoStructuredView stores agents in an OrderedDict, using a
744 specific statevar as key.</p>
745 <dl class="method">
746 <dt id="emulsion.agent.views.AutoStructuredView.add">
747 <code class="descname">add</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AutoStructuredView.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AutoStructuredView.add" title="Permalink to this definition">¶</a></dt>
748 <dd><p>Add the specified population (SortedSet or list) to the
749 current view.</p>
750 </dd></dl>
752 <dl class="attribute">
753 <dt id="emulsion.agent.views.AutoStructuredView.agcount">
754 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.views.AutoStructuredView.agcount" title="Permalink to this definition">¶</a></dt>
755 <dd></dd></dl>
757 <dl class="attribute">
758 <dt id="emulsion.agent.views.AutoStructuredView.agdict">
759 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.views.AutoStructuredView.agdict" title="Permalink to this definition">¶</a></dt>
760 <dd></dd></dl>
762 <dl class="attribute">
763 <dt id="emulsion.agent.views.AutoStructuredView.families">
764 <code class="descname">families</code><em class="property"> = SortedSet(['AutoStructuredView'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.views.AutoStructuredView.families" title="Permalink to this definition">¶</a></dt>
765 <dd></dd></dl>
767 <dl class="attribute">
768 <dt id="emulsion.agent.views.AutoStructuredView.members">
769 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', 'add', 'remove', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.views.AutoStructuredView.members" title="Permalink to this definition">¶</a></dt>
770 <dd></dd></dl>
772 <dl class="method">
773 <dt id="emulsion.agent.views.AutoStructuredView.remove">
774 <code class="descname">remove</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#AutoStructuredView.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.AutoStructuredView.remove" title="Permalink to this definition">¶</a></dt>
775 <dd><p>Remove the specified population from the current view. The
776 population is expected to be a SortedSet or list.</p>
777 </dd></dl>
779 </dd></dl>
781 <dl class="class">
782 <dt id="emulsion.agent.views.SimpleView">
783 <em class="property">class </em><code class="descclassname">emulsion.agent.views.</code><code class="descname">SimpleView</code><span class="sig-paren">(</span><em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#SimpleView"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.SimpleView" title="Permalink to this definition">¶</a></dt>
784 <dd><p>Bases: <a class="reference internal" href="emulsion.agent.core.html#emulsion.agent.core.groups.Aggregation" title="emulsion.agent.core.groups.Aggregation"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.core.groups.Aggregation</span></code></a></p>
785 <p>A SimpleView uses a set to store the underlying
786 units. It is rather aimed at storing AtomAgents. All units are
787 considered in the same state, thus conditions in the state
788 machines are evaluated for the whole compartment, not for
789 individuals.</p>
790 <dl class="method">
791 <dt id="emulsion.agent.views.SimpleView.add">
792 <code class="descname">add</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#SimpleView.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.SimpleView.add" title="Permalink to this definition">¶</a></dt>
793 <dd><p>Add the specified population to the current compartment.</p>
794 </dd></dl>
796 <dl class="attribute">
797 <dt id="emulsion.agent.views.SimpleView.agcount">
798 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.views.SimpleView.agcount" title="Permalink to this definition">¶</a></dt>
799 <dd></dd></dl>
801 <dl class="attribute">
802 <dt id="emulsion.agent.views.SimpleView.agdict">
803 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.views.SimpleView.agdict" title="Permalink to this definition">¶</a></dt>
804 <dd></dd></dl>
806 <dl class="attribute">
807 <dt id="emulsion.agent.views.SimpleView.families">
808 <code class="descname">families</code><em class="property"> = SortedSet(['SimpleView'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.views.SimpleView.families" title="Permalink to this definition">¶</a></dt>
809 <dd></dd></dl>
811 <dl class="method">
812 <dt id="emulsion.agent.views.SimpleView.get_content">
813 <code class="descname">get_content</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#SimpleView.get_content"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.SimpleView.get_content" title="Permalink to this definition">¶</a></dt>
814 <dd><p>Return the units contained in the current unit.</p>
815 </dd></dl>
817 <dl class="attribute">
818 <dt id="emulsion.agent.views.SimpleView.members">
819 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', '__iter__', 'get_content', 'add', 'remove', 'next_states', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.views.SimpleView.members" title="Permalink to this definition">¶</a></dt>
820 <dd></dd></dl>
822 <dl class="method">
823 <dt id="emulsion.agent.views.SimpleView.next_states">
824 <code class="descname">next_states</code><span class="sig-paren">(</span><em>states</em>, <em>values</em>, <em>populations</em>, <em>actions</em>, <em>method=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#SimpleView.next_states"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.SimpleView.next_states" title="Permalink to this definition">¶</a></dt>
825 <dd><p>Compute stochastically the population moving from the current
826 compartment to each of the destination states, according to
827 the values interpreted as probabilities. Actions are to be
828 performed when changing state. The population affected by the
829 transitions is stored in the first element of the
830 <cite>populations</cite> parameter, as a tuple: (‘agents’,
831 list_of_agents). Several edges can lead to the same state.</p>
832 <dl class="docutils">
833 <dt>Return a list of tuples:</dt>
834 <dd>(state, {‘agent’: list of agents, ‘actions’: list of actions})</dd>
835 </dl>
836 </dd></dl>
838 <dl class="method">
839 <dt id="emulsion.agent.views.SimpleView.remove">
840 <code class="descname">remove</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#SimpleView.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.SimpleView.remove" title="Permalink to this definition">¶</a></dt>
841 <dd><p>Remove the specified population from the current
842 compartment.</p>
843 </dd></dl>
845 </dd></dl>
847 <dl class="class">
848 <dt id="emulsion.agent.views.StructuredView">
849 <em class="property">class </em><code class="descclassname">emulsion.agent.views.</code><code class="descname">StructuredView</code><span class="sig-paren">(</span><em>keep_history=True</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView" title="Permalink to this definition">¶</a></dt>
850 <dd><p>Bases: <a class="reference internal" href="emulsion.agent.core.html#emulsion.agent.core.groups.Aggregation" title="emulsion.agent.core.groups.Aggregation"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.core.groups.Aggregation</span></code></a></p>
851 <p>A StructuredView uses ad dict list to store the underlying
852 units. It is rather aimed at storing other compartiments.</p>
853 <dl class="method">
854 <dt id="emulsion.agent.views.StructuredView.add">
855 <code class="descname">add</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView.add" title="Permalink to this definition">¶</a></dt>
856 <dd><p>Add the specified population to the current
857 compartment. The population is expected to be a dictionary
858 with names as keys and compartments as values.</p>
859 </dd></dl>
861 <dl class="attribute">
862 <dt id="emulsion.agent.views.StructuredView.agcount">
863 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.views.StructuredView.agcount" title="Permalink to this definition">¶</a></dt>
864 <dd></dd></dl>
866 <dl class="attribute">
867 <dt id="emulsion.agent.views.StructuredView.agdict">
868 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.views.StructuredView.agdict" title="Permalink to this definition">¶</a></dt>
869 <dd></dd></dl>
871 <dl class="method">
872 <dt id="emulsion.agent.views.StructuredView.evolve">
873 <code class="descname">evolve</code><span class="sig-paren">(</span><em>machine=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView.evolve" title="Permalink to this definition">¶</a></dt>
874 <dd><p>Ask each unit in the current compartment to make its content evolve
875 according to its own capabilities. A specific state machine
876 can be specified if needed.</p>
877 </dd></dl>
879 <dl class="attribute">
880 <dt id="emulsion.agent.views.StructuredView.families">
881 <code class="descname">families</code><em class="property"> = SortedSet(['StructuredView'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.views.StructuredView.families" title="Permalink to this definition">¶</a></dt>
882 <dd></dd></dl>
884 <dl class="method">
885 <dt id="emulsion.agent.views.StructuredView.get_content">
886 <code class="descname">get_content</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView.get_content"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView.get_content" title="Permalink to this definition">¶</a></dt>
887 <dd><p>Return the agents contained in the current view.</p>
888 </dd></dl>
890 <dl class="method">
891 <dt id="emulsion.agent.views.StructuredView.get_or_build">
892 <code class="descname">get_or_build</code><span class="sig-paren">(</span><em>key</em>, <em>source=None</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView.get_or_build"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView.get_or_build" title="Permalink to this definition">¶</a></dt>
893 <dd><p>Return the compartment with the specified key if any, or
894 build one by cloning the source if not found.</p>
895 </dd></dl>
897 <dl class="method">
898 <dt id="emulsion.agent.views.StructuredView.handle_notifications">
899 <code class="descname">handle_notifications</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView.handle_notifications"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView.handle_notifications" title="Permalink to this definition">¶</a></dt>
900 <dd><p>Handle all notifications received during the time step.</p>
901 </dd></dl>
903 <dl class="attribute">
904 <dt id="emulsion.agent.views.StructuredView.members">
905 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', '__iter__', '__getitem__', 'get_content', 'add', 'remove', 'notify_changed_units', 'handle_notifications', 'get_or_build', 'evolve', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.views.StructuredView.members" title="Permalink to this definition">¶</a></dt>
906 <dd></dd></dl>
908 <dl class="method">
909 <dt id="emulsion.agent.views.StructuredView.notify_changed_units">
910 <code class="descname">notify_changed_units</code><span class="sig-paren">(</span><em>source_compartment</em>, <em>units</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView.notify_changed_units"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView.notify_changed_units" title="Permalink to this definition">¶</a></dt>
911 <dd><p>Receive a change notification concerning several units
912 which cannot be stored anymore in the source compartment.</p>
913 </dd></dl>
915 <dl class="method">
916 <dt id="emulsion.agent.views.StructuredView.remove">
917 <code class="descname">remove</code><span class="sig-paren">(</span><em>population</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredView.remove"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredView.remove" title="Permalink to this definition">¶</a></dt>
918 <dd><p>Remove the specified population from the current
919 compartment.  The population is expected to be a dictionary
920 with names as keys and compartments as values.</p>
921 </dd></dl>
923 </dd></dl>
925 <dl class="class">
926 <dt id="emulsion.agent.views.StructuredViewWithCounts">
927 <em class="property">class </em><code class="descclassname">emulsion.agent.views.</code><code class="descname">StructuredViewWithCounts</code><span class="sig-paren">(</span><em>allowed_values=None</em>, <em>**others</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredViewWithCounts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts" title="Permalink to this definition">¶</a></dt>
928 <dd><p>Bases: <a class="reference internal" href="#emulsion.agent.views.StructuredView" title="emulsion.agent.views.StructuredView"><code class="xref py py-class docutils literal notranslate"><span class="pre">emulsion.agent.views.StructuredView</span></code></a></p>
929 <p>Same as StructuredView, plus the capability of handling counts for
930 key values.</p>
931 <dl class="attribute">
932 <dt id="emulsion.agent.views.StructuredViewWithCounts.agcount">
933 <code class="descname">agcount</code><em class="property"> = 0</em><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts.agcount" title="Permalink to this definition">¶</a></dt>
934 <dd></dd></dl>
936 <dl class="attribute">
937 <dt id="emulsion.agent.views.StructuredViewWithCounts.agdict">
938 <code class="descname">agdict</code><em class="property"> = {}</em><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts.agdict" title="Permalink to this definition">¶</a></dt>
939 <dd></dd></dl>
941 <dl class="method">
942 <dt id="emulsion.agent.views.StructuredViewWithCounts.evolve">
943 <code class="descname">evolve</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredViewWithCounts.evolve"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts.evolve" title="Permalink to this definition">¶</a></dt>
944 <dd><p>Ask each unit in the current compartment to make its content evolve
945 according to its own capabilities. A specific state machine
946 can be specified if needed.</p>
947 </dd></dl>
949 <dl class="attribute">
950 <dt id="emulsion.agent.views.StructuredViewWithCounts.families">
951 <code class="descname">families</code><em class="property"> = SortedSet(['StructuredViewWithCounts'], key=None, load=1000)</em><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts.families" title="Permalink to this definition">¶</a></dt>
952 <dd></dd></dl>
954 <dl class="method">
955 <dt id="emulsion.agent.views.StructuredViewWithCounts.init_counts">
956 <code class="descname">init_counts</code><span class="sig-paren">(</span><em>index=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredViewWithCounts.init_counts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts.init_counts" title="Permalink to this definition">¶</a></dt>
957 <dd><p>Initialize the counts.</p>
958 </dd></dl>
960 <dl class="attribute">
961 <dt id="emulsion.agent.views.StructuredViewWithCounts.members">
962 <code class="descname">members</code><em class="property"> = ('agcount', 'agdict', 'families', '__module__', '__qualname__', '__doc__', '__init__', 'init_counts', 'update_counts', '__contains__', 'evolve', '__classcell__')</em><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts.members" title="Permalink to this definition">¶</a></dt>
963 <dd></dd></dl>
965 <dl class="method">
966 <dt id="emulsion.agent.views.StructuredViewWithCounts.update_counts">
967 <code class="descname">update_counts</code><span class="sig-paren">(</span><em>index=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/emulsion/agent/views.html#StructuredViewWithCounts.update_counts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#emulsion.agent.views.StructuredViewWithCounts.update_counts" title="Permalink to this definition">¶</a></dt>
968 <dd><p>Update the counts.</p>
969 </dd></dl>
971 </dd></dl>
973 </div>
974 </div>
977           </div>
978         </div>
979       </div>
980       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
981         <div class="sphinxsidebarwrapper">
982 <h1 class="logo"><a href="index.html">EMULSION</a></h1>
986 <p class="blurb">Epidemiological Multi-Level Simulation Framework</p>
993 <h3>Navigation</h3>
994 <ul class="current">
995 <li class="toctree-l1"><a class="reference internal" href="pages/Install.html">Installation</a></li>
996 <li class="toctree-l1"><a class="reference internal" href="pages/Getting_started.html">Getting started with EMULSION</a></li>
997 <li class="toctree-l1"><a class="reference internal" href="pages/Modelling_principles.html">Modelling principles</a></li>
998 <li class="toctree-l1"><a class="reference internal" href="pages/Modelling_language_basics.html">Modelling language (basics)</a></li>
999 <li class="toctree-l1"><a class="reference internal" href="pages/Modelling_language_advanced.html">Modelling language (advanced)</a></li>
1000 <li class="toctree-l1"><a class="reference internal" href="pages/Feature_examples.html">Feature examples</a></li>
1001 <li class="toctree-l1"><a class="reference internal" href="pages/Information.html">Information</a></li>
1002 <li class="toctree-l1"><a class="reference internal" href="pages/License.html">License</a></li>
1003 <li class="toctree-l1"><a class="reference internal" href="emulsion_for_modellers.html">High-level functions for model designers</a></li>
1004 <li class="toctree-l1 current"><a class="reference internal" href="emulsion.html">emulsion package</a><ul class="current">
1005 <li class="toctree-l2 current"><a class="reference internal" href="emulsion.html#subpackages">Subpackages</a><ul class="current">
1006 <li class="toctree-l3 current"><a class="current reference internal" href="#">emulsion.agent package</a></li>
1007 <li class="toctree-l3"><a class="reference internal" href="emulsion.model.html">emulsion.model package</a></li>
1008 <li class="toctree-l3"><a class="reference internal" href="emulsion.tools.html">emulsion.tools package</a></li>
1009 </ul>
1010 </li>
1011 <li class="toctree-l2"><a class="reference internal" href="emulsion.html#submodules">Submodules</a></li>
1012 <li class="toctree-l2"><a class="reference internal" href="emulsion.html#module-emulsion.init_emulsion">emulsion.init_emulsion module</a></li>
1013 </ul>
1014 </li>
1015 </ul>
1017 <div class="relations">
1018 <h3>Related Topics</h3>
1019 <ul>
1020   <li><a href="index.html">Documentation overview</a><ul>
1021   <li><a href="emulsion.html">emulsion package</a><ul>
1022       <li>Previous: <a href="emulsion.html" title="previous chapter">emulsion package</a></li>
1023       <li>Next: <a href="emulsion.agent.core.html" title="next chapter">emulsion.agent.core package</a></li>
1024   </ul></li>
1025   </ul></li>
1026 </ul>
1027 </div>
1028 <div id="searchbox" style="display: none" role="search">
1029   <h3>Quick search</h3>
1030     <div class="searchformwrapper">
1031     <form class="search" action="search.html" method="get">
1032       <input type="text" name="q" />
1033       <input type="submit" value="Go" />
1034       <input type="hidden" name="check_keywords" value="yes" />
1035       <input type="hidden" name="area" value="default" />
1036     </form>
1037     </div>
1038 </div>
1039 <script type="text/javascript">$('#searchbox').show(0);</script>
1040         </div>
1041       </div>
1042       <div class="clearer"></div>
1043     </div>
1044     <div class="footer">
1045       &copy;2016, INRA and Univ. Lille.
1046       
1047       |
1048       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
1049       &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
1050       
1051       |
1052       <a href="_sources/emulsion.agent.rst.txt"
1053           rel="nofollow">Page source</a>
1054     </div>
1056     
1058     
1059   </body>
1060 </html>