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>Modelling language (advanced) &#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="Feature examples" href="Feature_examples.html" />
22     <link rel="prev" title="Modelling language (basics)" href="Modelling_language_basics.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   <div class="document">
31     
32       <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
33         <div class="sphinxsidebarwrapper">
34 <h1 class="logo"><a href="../index.html">EMULSION</a></h1>
38 <p class="blurb">Epidemiological Multi-Level Simulation Framework</p>
45 <h3>Navigation</h3>
46 <ul class="current">
47 <li class="toctree-l1"><a class="reference internal" href="Install.html">Installation</a></li>
48 <li class="toctree-l1"><a class="reference internal" href="Getting_started.html">Getting started with EMULSION</a></li>
49 <li class="toctree-l1"><a class="reference internal" href="Modelling_principles.html">Modelling principles</a></li>
50 <li class="toctree-l1"><a class="reference internal" href="Modelling_language_basics.html">Modelling language (basics)</a></li>
51 <li class="toctree-l1 current"><a class="current reference internal" href="#">Modelling language (advanced)</a><ul>
52 <li class="toctree-l2"><a class="reference internal" href="#compartments-ibm-or-hybrid-models">Compartments, IBM or hybrid models?</a></li>
53 <li class="toctree-l2"><a class="reference internal" href="#master-state-machines">Master state machines</a><ul>
54 <li class="toctree-l3"><a class="reference internal" href="#set-states-attributes">Set states attributes</a></li>
55 <li class="toctree-l3"><a class="reference internal" href="#customize-transitions">Customize transitions</a></li>
56 <li class="toctree-l3"><a class="reference internal" href="#produce-new-individuals">Produce new individuals</a></li>
57 <li class="toctree-l3"><a class="reference internal" href="#remove-transitions">Remove transitions</a></li>
58 </ul>
59 </li>
60 <li class="toctree-l2"><a class="reference internal" href="#regulate-time">Regulate time</a></li>
61 <li class="toctree-l2"><a class="reference internal" href="#complexify-grouping">Complexify grouping</a></li>
62 <li class="toctree-l2"><a class="reference internal" href="#aggregate-variables">Aggregate variables</a></li>
63 <li class="toctree-l2"><a class="reference internal" href="#automatic-variables">Automatic variables</a></li>
64 <li class="toctree-l2"><a class="reference internal" href="#built-in-functions">Built-in functions</a></li>
65 <li class="toctree-l2"><a class="reference internal" href="#built-in-actions">Built-in actions</a></li>
66 <li class="toctree-l2"><a class="reference internal" href="#changing-scale-metapopulations">Changing scale: metapopulations</a></li>
67 <li class="toctree-l2"><a class="reference internal" href="#connecting-to-python-code-add-ons">Connecting to Python code add-ons</a></li>
68 </ul>
69 </li>
70 <li class="toctree-l1"><a class="reference internal" href="Feature_examples.html">Feature examples</a></li>
71 <li class="toctree-l1"><a class="reference internal" href="Information.html">Information</a></li>
72 <li class="toctree-l1"><a class="reference internal" href="License.html">License</a></li>
73 <li class="toctree-l1"><a class="reference internal" href="../emulsion_for_modellers.html">High-level functions for model designers</a></li>
74 <li class="toctree-l1"><a class="reference internal" href="../emulsion.html">emulsion package</a></li>
75 </ul>
77 <div class="relations">
78 <h3>Related Topics</h3>
79 <ul>
80   <li><a href="../index.html">Documentation overview</a><ul>
81       <li>Previous: <a href="Modelling_language_basics.html" title="previous chapter">Modelling language (basics)</a></li>
82       <li>Next: <a href="Feature_examples.html" title="next chapter">Feature examples</a></li>
83   </ul></li>
84 </ul>
85 </div>
86 <div id="searchbox" style="display: none" role="search">
87   <h3>Quick search</h3>
88     <div class="searchformwrapper">
89     <form class="search" action="../search.html" method="get">
90       <input type="text" name="q" />
91       <input type="submit" value="Go" />
92       <input type="hidden" name="check_keywords" value="yes" />
93       <input type="hidden" name="area" value="default" />
94     </form>
95     </div>
96 </div>
97 <script type="text/javascript">$('#searchbox').show(0);</script>
98         </div>
99       </div>
100       <div class="documentwrapper">
101         <div class="bodywrapper">
102           <div class="body" role="main">
103             
104   <div class="section" id="modelling-language-advanced">
105 <h1>Modelling language (advanced)<a class="headerlink" href="#modelling-language-advanced" title="Permalink to this headline">¶</a></h1>
106 <p>EMULSION modelling language allows model designers to specify complex
107 assumptions in a readable way, to foster interactions with other
108 scientists and facilitate model revision throughout the design process
109 without having to dive into the simulation code.</p>
110 <p>Most language features documented below are associated with example
111 files, located in the <code class="docutils literal notranslate"><span class="pre">models/features</span></code> directory.</p>
112 <div class="section" id="compartments-ibm-or-hybrid-models">
113 <h2>Compartments, IBM or hybrid models?<a class="headerlink" href="#compartments-ibm-or-hybrid-models" title="Permalink to this headline">¶</a></h2>
114 <p>EMULSION helps to transform compartment-based models into
115 invidual-based models (or vice-versa, assuming the individual-based
116 model can get rid of individual specificities). An intermediate
117 approach is the hybrid model, which preserves individual
118 characteristics but drives system evolution through compartment-like
119 groupings (see: <a class="reference internal" href="Modelling_principles.html#individuals-populations-metapopulations"><span class="std std-ref">Individuals, populations, metapopulations</span></a>).</p>
120 <p>The table below summarises the main differences between each kind of
121 models, regarding the sections and keywords to modify in an EMULSION
122 model file.</p>
123 <table border="1" class="docutils">
124 <colgroup>
125 <col width="26%" />
126 <col width="24%" />
127 <col width="18%" />
128 <col width="13%" />
129 <col width="19%" />
130 </colgroup>
131 <thead valign="bottom">
132 <tr class="row-odd"><th class="head" rowspan="2">EMULSION section</th>
133 <th class="head" rowspan="2">section keyword</th>
134 <th class="head" colspan="3">Modelling paradigm</th>
135 </tr>
136 <tr class="row-even"><th class="head">compartment</th>
137 <th class="head">hybrid</th>
138 <th class="head">IBM</th>
139 </tr>
140 </thead>
141 <tbody valign="top">
142 <tr class="row-odd"><td rowspan="2"><code class="docutils literal notranslate"><span class="pre">levels</span></code></td>
143 <td><code class="docutils literal notranslate"><span class="pre">aggregation_type</span></code></td>
144 <td><code class="docutils literal notranslate"><span class="pre">compartment</span></code></td>
145 <td><code class="docutils literal notranslate"><span class="pre">hybrid</span></code></td>
146 <td><code class="docutils literal notranslate"><span class="pre">IBM</span></code></td>
147 </tr>
148 <tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">contains</span></code></td>
149 <td><em>not used</em></td>
150 <td colspan="2"><em>sublevels</em></td>
151 </tr>
152 <tr class="row-odd"><td rowspan="2"><code class="docutils literal notranslate"><span class="pre">grouping</span></code></td>
153 <td><code class="docutils literal notranslate"><span class="pre">key_variables</span></code></td>
154 <td colspan="2"><em>list of variables</em></td>
155 <td rowspan="2"><em>not used</em></td>
156 </tr>
157 <tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">state_machine</span></code></td>
158 <td colspan="2"><em>machine name</em> (optional)</td>
159 </tr>
160 <tr class="row-odd"><td rowspan="2"><code class="docutils literal notranslate"><span class="pre">processes</span></code></td>
161 <td><em>level</em></td>
162 <td colspan="2"><em>population</em></td>
163 <td><em>individuals</em></td>
164 </tr>
165 <tr class="row-even"><td><em>list of processes</em></td>
166 <td colspan="2"><em>names of groupings</em></td>
167 <td><em>machine name</em></td>
168 </tr>
169 <tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">state_machines</span></code></td>
170 <td><code class="docutils literal notranslate"><span class="pre">productions</span></code></td>
171 <td>&#160;</td>
172 <td colspan="2"><em>based on prototypes</em></td>
173 </tr>
174 <tr class="row-even"><td><code class="docutils literal notranslate"><span class="pre">prototypes</span></code></td>
175 <td>&#160;</td>
176 <td><em>not used</em></td>
177 <td colspan="2"><em>for individuals/populations</em></td>
178 </tr>
179 <tr class="row-odd"><td><code class="docutils literal notranslate"><span class="pre">initial_conditions</span></code></td>
180 <td>&#160;</td>
181 <td><em>per state</em></td>
182 <td colspan="2"><em>based on prototypes</em></td>
183 </tr>
184 </tbody>
185 </table>
186 <div class="admonition seealso">
187 <p class="first admonition-title">See also</p>
188 <p>Also, in <code class="docutils literal notranslate"><span class="pre">model/features</span></code>, many examples are provided with the
189 three modelling paradigms when possible, especially the simplest
190 SIR model (<code class="docutils literal notranslate"><span class="pre">compart_SIR.yaml</span></code>, <code class="docutils literal notranslate"><span class="pre">hybrid_SIR.yaml</span></code>,
191 <code class="docutils literal notranslate"><span class="pre">IBM_SIR.yaml</span></code>) and the corresponding version with demographic
192 processes (<code class="docutils literal notranslate"><span class="pre">compart_SIR_demo.yaml</span></code>, <code class="docutils literal notranslate"><span class="pre">hybrid_SIR_demo.yaml</span></code>,
193 <code class="docutils literal notranslate"><span class="pre">IBM_SIR_demo.yaml</span></code>).</p>
194 <p class="last">See <a class="reference internal" href="Feature_examples.html#sir-model"><span class="std std-ref">SIR model</span></a>, <a class="reference internal" href="Feature_examples.html#seirs-model"><span class="std std-ref">SEIRS model</span></a>, <a class="reference internal" href="Feature_examples.html#sir-model-with-basic-demography-births-deaths"><span class="std std-ref">SIR model with basic demography (births/deaths)</span></a> and many others in <a class="reference internal" href="Feature_examples.html#feature-examples"><span class="std std-ref">Feature examples</span></a>.</p>
195 </div>
196 </div>
197 <div class="section" id="master-state-machines">
198 <h2>Master state machines<a class="headerlink" href="#master-state-machines" title="Permalink to this headline">¶</a></h2>
199 <div class="section" id="set-states-attributes">
200 <h3>Set states attributes<a class="headerlink" href="#set-states-attributes" title="Permalink to this headline">¶</a></h3>
201 <p>States can be endowed with <em>attributes</em>. For instance, <code class="docutils literal notranslate"><span class="pre">fillcolor</span></code>
202 defines the color of the boxes on state machine diagrams, which is the
203 same than the color of plots in outputs.</p>
204 <p>A state can define three main properties:</p>
205 <dl class="docutils">
206 <dt><code class="docutils literal notranslate"><span class="pre">autoremove:</span> <span class="pre">yes</span></code></dt>
207 <dd><p class="first">Autoremove states are intended as “sink”, so that all individuals
208 that reach such a state are removed from the system. This is a
209 very convenient way to represent deaths or outgoing commercial
210 movements.</p>
211 <div class="last admonition seealso">
212 <p class="first admonition-title">See also</p>
213 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-basic-demography-births-deaths"><span class="std std-ref">SIR model with basic demography (births/deaths)</span></a></p>
214 </div>
215 </dd>
216 <dt><code class="docutils literal notranslate"><span class="pre">default:</span> <span class="pre">yes</span></code></dt>
217 <dd><p class="first">A state can be labelled as “default state”. Default state plays
218 the same role but the way to use them differs in compartment-based
219 models and in others:</p>
220 <ul class="last">
221 <li><p class="first">in compartment-based models, when no indication is provided in
222 initial conditions or production links regarding new
223 individuals, they will be put in the default state for each of
224 their state machines</p>
225 </li>
226 <li><p class="first">in IBM/hybrid models and metapopulations, <code class="docutils literal notranslate"><span class="pre">default</span></code> is a valid
227 value for prototypes definition. For instance, writing
228 <code class="docutils literal notranslate"><span class="pre">health_state:</span> <span class="pre">default</span></code> in a prototype will set the health
229 state to the default state of the <code class="docutils literal notranslate"><span class="pre">health_state</span></code> state machine</p>
230 <div class="admonition seealso">
231 <p class="first admonition-title">See also</p>
232 <p class="last"><span class="xref std std-ref">Default state</span>, <a class="reference internal" href="Feature_examples.html#sir-model-with-age-groups"><span class="std std-ref">SIR model with age groups</span></a></p>
233 </div>
234 </li>
235 </ul>
236 </dd>
237 <dt><code class="docutils literal notranslate"><span class="pre">duration</span></code> (valid for <strong>IBM</strong>/<strong>hybrid</strong> models)</dt>
238 <dd><p class="first">This keyword allows to assign a specific duration to a
239 state. Durations can be constant values or arbitrary expressions,
240 including a random distribution. When an individual enters the
241 state, it receives a value calculated from this expression
242 (possibly involving a random sample) and cannot leave this state
243 until the duration is over (with the exception of <a class="reference internal" href="#escape-conditions"><span class="std std-ref">escape
244 conditions</span></a>).</p>
245 <div class="last admonition seealso">
246 <p class="first admonition-title">See also</p>
247 <p class="last"><a class="reference internal" href="Feature_examples.html#custom-state-durations"><span class="std std-ref">Custom state durations</span></a></p>
248 </div>
249 </dd>
250 <dt><code class="docutils literal notranslate"><span class="pre">on_enter</span></code>, <code class="docutils literal notranslate"><span class="pre">on_stay</span></code>, <code class="docutils literal notranslate"><span class="pre">on_exit</span></code> (valid for <strong>IBM</strong>/<strong>hybrid</strong> models)</dt>
251 <dd><p class="first">These keywords are used to specify lists of <strong>actions</strong> that
252 individuals have to perform when, respectively, entering, staying
253 in, or leaving the state.</p>
254 <p>Actions can be either built-in actions (listed <a class="reference internal" href="#built-in-actions"><span class="std std-ref">there</span></a>) or the name of a function provided in a code
255 add-on (e.g. <code class="docutils literal notranslate"><span class="pre">action:</span> <span class="pre">my_custom_function</span></code>).</p>
256 <div class="last admonition seealso">
257 <p class="first admonition-title">See also</p>
258 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-individual-actions-and-variable-aggregation"><span class="std std-ref">SIR model with individual actions and variable aggregation</span></a></p>
259 </div>
260 </dd>
261 </dl>
262 </div>
263 <div class="section" id="customize-transitions">
264 <h3>Customize transitions<a class="headerlink" href="#customize-transitions" title="Permalink to this headline">¶</a></h3>
265 <p>In state machines, transitions are composed of at least three items:</p>
266 <ul class="simple" id="quantifiers">
267 <li><code class="docutils literal notranslate"><span class="pre">from</span></code> followed by the origin state</li>
268 <li><code class="docutils literal notranslate"><span class="pre">to</span></code> followed by the destination state</li>
269 <li>a <strong>quantifier</strong> to indicate the flow from origin to destination
270 state, which can be:<ul>
271 <li><code class="docutils literal notranslate"><span class="pre">rate</span></code> with a transition rate per individual i.e. a number per
272 time unit. In stochastic models , rates are automatically
273 converted into probabilities, assuming that durations in the
274 origin state follow an exponential distribution</li>
275 <li><code class="docutils literal notranslate"><span class="pre">proba</span></code> with the probabiliy that, during <em>one time unit</em>, an
276 individual moves from origin to destination state</li>
277 <li><code class="docutils literal notranslate"><span class="pre">amount</span></code> which indicates an absolute number of individuals,
278 (bounded by the number of individuals actually in origin state)</li>
279 <li><code class="docutils literal notranslate"><span class="pre">amount-all-but</span></code> which indicates an absolute number of
280 individuals which have to <em>stay</em> in origin state while the others
281 move to destination state. Hence, writing <code class="docutils literal notranslate"><span class="pre">amount-all-but:</span> <span class="pre">0</span></code>
282 means “all individuals in origin state”</li>
283 </ul>
284 </li>
285 </ul>
286 <div class="admonition warning">
287 <p class="first admonition-title">Warning</p>
288 <p class="last">In a state machine, all quantifiers may be used. However, from a
289 given origin state, all transitions that can be used simultaneously
290 must have the same quantifiers (i.e. only <code class="docutils literal notranslate"><span class="pre">rate</span></code>, or only
291 <code class="docutils literal notranslate"><span class="pre">proba</span></code>, or only <code class="docutils literal notranslate"><span class="pre">amount</span></code>/<code class="docutils literal notranslate"><span class="pre">amount-all-but</span></code>).</p>
292 </div>
293 <p>Transitions can also incorporate additional elements:</p>
294 <ul class="simple" id="escape-conditions">
295 <li><code class="docutils literal notranslate"><span class="pre">cond</span></code> followed with a expression (logical or numeric, non-zero
296 values being considered true) specifies which individuals are
297 allowed to cross the transition</li>
298 <li><code class="docutils literal notranslate"><span class="pre">escape</span></code> is a special condition for origin states endowed with a
299 specific duration, which allows individuals that fulfil the
300 expression to exit their state <em>before</em> the normal term. For
301 instance, a gestating state has a duration before which individuals should
302 not be able to leave the state, but if abortions are possible, the
303 corresponding condition can be used as escape condition to permit a
304 premature exit of gestation.</li>
305 <li><code class="docutils literal notranslate"><span class="pre">when</span></code> is a special condition which refers to <em>events</em> from a
306 <a class="reference internal" href="#regulate-time"><span class="std std-ref">calendar</span></a> (useful to handle seasonality)</li>
307 <li><code class="docutils literal notranslate"><span class="pre">on_cross</span></code> is used to specify a list of actions that indivuals
308 moving from origin state to destination state through this
309 transition have to perform</li>
310 </ul>
311 </div>
312 <div class="section" id="produce-new-individuals">
313 <h3>Produce new individuals<a class="headerlink" href="#produce-new-individuals" title="Permalink to this headline">¶</a></h3>
314 <ul>
315 <li><p class="first">Section <code class="docutils literal notranslate"><span class="pre">productions</span></code> in state machines allow to define how some
316 states can produce new individuals. Production links are very
317 similar to transitions in their syntax, except that:</p>
318 <ul>
319 <li><p class="first"><code class="docutils literal notranslate"><span class="pre">escape</span></code> conditions and <code class="docutils literal notranslate"><span class="pre">amount-all-but</span></code> quantifier are not allowed</p>
320 </li>
321 <li><p class="first">in IBM/hybrid models, a <code class="docutils literal notranslate"><span class="pre">prototype</span></code> must be specified for the new
322 individuals</p>
323 <p>Besides, the computation of actual flows uses sampling in Poisson
324 distribution rather than binomial/multinomial sampling.</p>
325 </li>
326 </ul>
327 <div class="admonition seealso">
328 <p class="first admonition-title">See also</p>
329 <dl class="last docutils">
330 <dt><a class="reference internal" href="Feature_examples.html#sir-model-with-basic-demography-births-deaths"><span class="std std-ref">SIR model with basic demography (births/deaths)</span></a>, :ref:<a href="#id1"><span class="problematic" id="id2">`</span></a>SIR</dt>
331 <dd><p class="first last">model with age groups`</p>
332 </dd>
333 </dl>
334 </div>
335 </li>
336 <li><p class="first">Another way to produce new individuals is using an action: <code class="docutils literal notranslate"><span class="pre">clone</span></code>
337 (aka <code class="docutils literal notranslate"><span class="pre">produce_offspring</span></code>) associated with a transition or
338 with a state (see <a class="reference internal" href="#set-states-attributes"><span class="std std-ref">Set states attributes</span></a> and <a class="reference internal" href="#built-in-actions"><span class="std std-ref">Built-in actions</span></a>).</p>
339 <div class="admonition seealso">
340 <p class="first admonition-title">See also</p>
341 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-explicit-gestation"><span class="std std-ref">SIR model with explicit gestation</span></a></p>
342 </div>
343 </li>
344 </ul>
345 </div>
346 <div class="section" id="remove-transitions">
347 <h3>Remove transitions<a class="headerlink" href="#remove-transitions" title="Permalink to this headline">¶</a></h3>
348 <p>State machines can also be used only for states, e.g. to differentiate
349 male/female individuals. In that case, the state machine does not
350 require any transition at all.</p>
351 <div class="admonition seealso">
352 <p class="first admonition-title">See also</p>
353 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-explicit-gestation"><span class="std std-ref">SIR model with explicit gestation</span></a></p>
354 </div>
355 </div>
356 </div>
357 <div class="section" id="regulate-time">
358 <h2>Regulate time<a class="headerlink" href="#regulate-time" title="Permalink to this headline">¶</a></h2>
359 <ul>
360 <li><p class="first">The simulation time step can be changed either in the model file
361 (section <code class="docutils literal notranslate"><span class="pre">time_info</span></code>), or at runtime with option <code class="docutils literal notranslate"><span class="pre">-p</span>
362 <span class="pre">delta_t=value</span></code></p>
363 </li>
364 <li><p class="first">Section <code class="docutils literal notranslate"><span class="pre">time_info</span></code> allows the definition of calendars with
365 events, for instance a pasture period:</p>
366 <div class="admonition-example admonition">
367 <p class="first admonition-title">Example</p>
368 <blockquote>
369 <div><div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">calendars</span><span class="p p-Indicator">:</span>
370   <span class="l l-Scalar l-Scalar-Plain">pasture</span><span class="p p-Indicator">:</span>
371     <span class="l l-Scalar l-Scalar-Plain">period</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">{</span><span class="nv">days</span><span class="p p-Indicator">:</span> <span class="nv">365</span><span class="p p-Indicator">}</span>
372   <span class="l l-Scalar l-Scalar-Plain">events</span><span class="p p-Indicator">:</span>
373     <span class="l l-Scalar l-Scalar-Plain">pasture_period</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">{</span><span class="nv">begin</span><span class="p p-Indicator">:</span> <span class="s">&#39;April</span><span class="nv"> </span><span class="s">1&#39;</span><span class="p p-Indicator">,</span> <span class="nv">end</span><span class="p p-Indicator">:</span> <span class="s">&#39;October</span><span class="nv"> </span><span class="s">1&#39;</span><span class="p p-Indicator">}</span>
374     <span class="l l-Scalar l-Scalar-Plain">open_days</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">{</span><span class="nv">date</span><span class="p p-Indicator">:</span> <span class="s">&#39;May</span><span class="nv"> </span><span class="s">1&#39;</span><span class="p p-Indicator">}</span>
375 </pre></div>
376 </div>
377 </div></blockquote>
378 <p>A calendar can be periodic or not, and define events that span from
379 a <code class="docutils literal notranslate"><span class="pre">begin</span></code> date to and <code class="docutils literal notranslate"><span class="pre">end</span></code> date, or that take place at a
380 specific <code class="docutils literal notranslate"><span class="pre">date</span></code>. Each event (here <code class="docutils literal notranslate"><span class="pre">pasture_period</span></code> and
381 <code class="docutils literal notranslate"><span class="pre">open_days</span></code>) can be used in conditions, especially in the
382 <code class="docutils literal notranslate"><span class="pre">when</span></code> clause of transition or productions. A transition with
383 e.g. <code class="docutils literal notranslate"><span class="pre">Not(pasture_period)</span></code> will not be considered at all when the
384 condition is not fulfilled.</p>
385 <p>Besides, events with a begin and an end date automatically generate
386 two other events, here for instance <code class="docutils literal notranslate"><span class="pre">begin_pasture_period</span></code> and
387 <code class="docutils literal notranslate"><span class="pre">end_pasture_period</span></code>.</p>
388 <div class="last admonition seealso">
389 <p class="first admonition-title">See also</p>
390 <p class="last">model <a class="reference internal" href="Install.html#test-your-installation"><span class="std std-ref">Quickstart</span></a> provided to test
391 EMULSION installation</p>
392 </div>
393 </div>
394 </li>
395 </ul>
396 </div>
397 <div class="section" id="complexify-grouping">
398 <h2>Complexify grouping<a class="headerlink" href="#complexify-grouping" title="Permalink to this headline">¶</a></h2>
399 <p>Grouping can be based on several variables, especially when the
400 dynamics of one process is affected by another one. For instance, if
401 infection is driven by age groups, the grouping section should be
402 rewritten as follows:</p>
403 <div class="admonition-example admonition">
404 <p class="first admonition-title">Example</p>
405 <div class="last highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">grouping</span><span class="p p-Indicator">:</span>
406   <span class="l l-Scalar l-Scalar-Plain">herd</span><span class="p p-Indicator">:</span>
407     <span class="l l-Scalar l-Scalar-Plain">infection</span><span class="p p-Indicator">:</span>
408       <span class="l l-Scalar l-Scalar-Plain">state_machine</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">health_state</span>
409       <span class="l l-Scalar l-Scalar-Plain">key_variables</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">[</span><span class="nv">health_state</span><span class="p p-Indicator">,</span> <span class="nv">age_group</span><span class="p p-Indicator">]</span>
410     <span class="l l-Scalar l-Scalar-Plain">age_group</span><span class="p p-Indicator">:</span>
411       <span class="l l-Scalar l-Scalar-Plain">state_machine</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">age_group</span>
412       <span class="l l-Scalar l-Scalar-Plain">key_variables</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">[</span><span class="nv">age_group</span><span class="p p-Indicator">]</span>
413 </pre></div>
414 </div>
415 </div>
416 <div class="admonition seealso">
417 <p class="first admonition-title">See also</p>
418 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-structured-population"><span class="std std-ref">SIR model with structured population</span></a></p>
419 </div>
420 <p>Grouping are especially useful in hybrid models, either to accelerate
421 simulation time, or to benefit from <a class="reference internal" href="#automatic-variables"><span class="std std-ref">automatic variables</span></a>.</p>
422 <p>A grouping can also be designed just to have access to specific
423 subgroups in the population, and thus indicate no state machine, nor
424 rely on variables related to state machines.</p>
425 <div class="admonition warning">
426 <p class="first admonition-title">Warning</p>
427 <p class="last">In any case, the name of the grouping must appear in the list of
428 processes: otherwise the grouping is not updated at each time step
429 (individuals are not distributed in the proper groups).</p>
430 </div>
431 </div>
432 <div class="section" id="aggregate-variables">
433 <h2>Aggregate variables<a class="headerlink" href="#aggregate-variables" title="Permalink to this headline">¶</a></h2>
434 <p>When defining levels, variables that aggregate other variables from a
435 sublevel can be defined, for instance:</p>
436 <div class="admonition-example admonition">
437 <p class="first admonition-title">Example</p>
438 <div class="last highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="l l-Scalar l-Scalar-Plain">levels</span><span class="p p-Indicator">:</span>
439   <span class="l l-Scalar l-Scalar-Plain">herd</span><span class="p p-Indicator">:</span>
440     <span class="l l-Scalar l-Scalar-Plain">...</span>
441     <span class="l l-Scalar l-Scalar-Plain">aggregate_vars</span><span class="p p-Indicator">:</span>
442       <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">name</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">pop_affected_over_time</span>
443         <span class="l l-Scalar l-Scalar-Plain">collect</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">nb_episodes</span>
444         <span class="l l-Scalar l-Scalar-Plain">operator</span><span class="p p-Indicator">:</span> <span class="s">&#39;sum&#39;</span>
445       <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">name</span><span class="p p-Indicator">:</span> <span class="s">&#39;avg_inf_duration&#39;</span>
446         <span class="l l-Scalar l-Scalar-Plain">collect</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">duration_infected</span>
447         <span class="l l-Scalar l-Scalar-Plain">operator</span><span class="p p-Indicator">:</span> <span class="s">&#39;mean&#39;</span>
448 </pre></div>
449 </div>
450 </div>
451 <p>Aggregated variables (here, <code class="docutils literal notranslate"><span class="pre">pop_affected_over_time</span></code> and
452 <code class="docutils literal notranslate"><span class="pre">avg_inf_duration</span></code>) defined by a level (here, <code class="docutils literal notranslate"><span class="pre">herd</span></code>) consist in
453 collecting the values of other variables (<code class="docutils literal notranslate"><span class="pre">nb_episodes</span></code>,
454 <code class="docutils literal notranslate"><span class="pre">duration_infected</span></code>) in the sublevels (<code class="docutils literal notranslate"><span class="pre">individuals</span></code>) and applying
455 an operator (<code class="docutils literal notranslate"><span class="pre">sum</span></code>, <code class="docutils literal notranslate"><span class="pre">mean</span></code>) to compute the resulting value.</p>
456 <p>Operators can be any classical usual operation operating on lists:
457 sum, prod, min, max, mean, var, std, median, all, any. Shortcuts have
458 been defined so that e.g. <code class="docutils literal notranslate"><span class="pre">percentile20</span></code> computes the 20th
459 percentile.</p>
460 <div class="admonition seealso">
461 <p class="first admonition-title">See also</p>
462 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-individual-actions-and-variable-aggregation"><span class="std std-ref">SIR model with individual actions and variable aggregation</span></a></p>
463 </div>
464 </div>
465 <div class="section" id="automatic-variables">
466 <h2>Automatic variables<a class="headerlink" href="#automatic-variables" title="Permalink to this headline">¶</a></h2>
467 <p>EMULSION automatically provides variables in relation to model
468 components.</p>
469 <ul class="simple">
470 <li><code class="docutils literal notranslate"><span class="pre">step</span></code> represents the current time step, <code class="docutils literal notranslate"><span class="pre">delta_t</span></code> the duration
471 of one time step (in time units), and <code class="docutils literal notranslate"><span class="pre">time</span></code> the time elapsed
472 since the beginning of simulation (in time units)</li>
473 <li>When defining a level, e.g. <code class="docutils literal notranslate"><span class="pre">herd</span></code>: <code class="docutils literal notranslate"><span class="pre">total_herd</span></code> gives the total
474 population of this level.</li>
475 <li>When defining a state machine, e.g. <code class="docutils literal notranslate"><span class="pre">health_state</span></code>, and its
476 states, e.g. <code class="docutils literal notranslate"><span class="pre">S</span></code>:<ul>
477 <li><code class="docutils literal notranslate"><span class="pre">is_S</span></code> tests whether or not an individual is in state <code class="docutils literal notranslate"><span class="pre">S</span></code></li>
478 <li><code class="docutils literal notranslate"><span class="pre">duration_in_health_state</span></code> contains the duration elapsed since
479 the individual entered the current state of state machine
480 <code class="docutils literal notranslate"><span class="pre">health_state</span></code></li>
481 <li><code class="docutils literal notranslate"><span class="pre">total_S</span></code> is the number of individuals in state <code class="docutils literal notranslate"><span class="pre">S</span></code></li>
482 </ul>
483 </li>
484 <li>When defining complex groupings, e.g. <code class="docutils literal notranslate"><span class="pre">[age_group,</span> <span class="pre">health_state]</span></code>:<ul>
485 <li><code class="docutils literal notranslate"><span class="pre">total_J_I</span></code> is the number of individuals in age group <code class="docutils literal notranslate"><span class="pre">J</span></code> and
486 in health state <code class="docutils literal notranslate"><span class="pre">I</span></code></li>
487 <li>if aggregated variables (e.g. <code class="docutils literal notranslate"><span class="pre">mean_age</span></code>) were also defined,
488 their counterpart is automatically defined for the grouping
489 (e.g. <code class="docutils literal notranslate"><span class="pre">mean_age_J_I</span></code> etc.)</li>
490 </ul>
491 </li>
492 </ul>
493 <div class="admonition seealso">
494 <p class="first admonition-title">See also</p>
495 <p class="last"><a class="reference internal" href="Feature_examples.html#sirs-model-with-periodic-external-risk"><span class="std std-ref">SIRS model with periodic external risk</span></a>,
496 <a class="reference internal" href="Feature_examples.html#sir-model-with-structured-population"><span class="std std-ref">SIR model with structured population</span></a></p>
497 </div>
498 </div>
499 <div class="section" id="built-in-functions">
500 <h2>Built-in functions<a class="headerlink" href="#built-in-functions" title="Permalink to this headline">¶</a></h2>
501 <p>Expressions used in EMULSION models can refer to classical Python
502 mathematical operators (<code class="docutils literal notranslate"><span class="pre">+</span></code>, <code class="docutils literal notranslate"><span class="pre">-</span></code>, <code class="docutils literal notranslate"><span class="pre">*</span></code>, <code class="docutils literal notranslate"><span class="pre">/</span></code>, <code class="docutils literal notranslate"><span class="pre">**</span></code> for
503 exponentiation, etc. ) and functions (e.g. <code class="docutils literal notranslate"><span class="pre">sqrt</span></code>, <code class="docutils literal notranslate"><span class="pre">cos</span></code>, <code class="docutils literal notranslate"><span class="pre">sin</span></code>,
504 <code class="docutils literal notranslate"><span class="pre">exp</span></code>, <code class="docutils literal notranslate"><span class="pre">log</span></code>, <code class="docutils literal notranslate"><span class="pre">log10</span></code>, etc.).</p>
505 <p>The following functions are also available:</p>
506 <dl class="docutils">
507 <dt><code class="docutils literal notranslate"><span class="pre">AND(cond1,</span> <span class="pre">cond2)</span></code></dt>
508 <dd>Logical conjunction: return true (1) if <code class="docutils literal notranslate"><span class="pre">cond1</span></code> and <code class="docutils literal notranslate"><span class="pre">cond2</span></code> are
509 both true, false (0) otherwise</dd>
510 <dt><code class="docutils literal notranslate"><span class="pre">OR(cond1,</span> <span class="pre">cond2)</span></code></dt>
511 <dd>Logical disjunction: return true (1) if <code class="docutils literal notranslate"><span class="pre">cond1</span></code> is true or
512 <code class="docutils literal notranslate"><span class="pre">cond2</span></code> is true, false (0) otherwise</dd>
513 <dt><code class="docutils literal notranslate"><span class="pre">Not(cond)</span></code></dt>
514 <dd>Logical negation: return true (1) if <code class="docutils literal notranslate"><span class="pre">cond1</span></code> and <code class="docutils literal notranslate"><span class="pre">cond2</span></code> are
515 both true, false (0) otherwise</dd>
516 <dt><code class="docutils literal notranslate"><span class="pre">IfThenElse(condition,</span> <span class="pre">val_if_true,</span> <span class="pre">val_if_false)</span></code></dt>
517 <dd>Ternary conditional function: return either <code class="docutils literal notranslate"><span class="pre">val_if_true</span></code> or
518 <code class="docutils literal notranslate"><span class="pre">val_if_false</span></code> depending on <code class="docutils literal notranslate"><span class="pre">condition</span></code>.</dd>
519 <dt><code class="docutils literal notranslate"><span class="pre">random_bool(proba_success)</span></code></dt>
520 <dd>Return a random boolean value (0 or 1) depending on
521 <code class="docutils literal notranslate"><span class="pre">proba_success</span></code></dd>
522 </dl>
523 <p>Shortcuts to distributions from package <code class="docutils literal notranslate"><span class="pre">numpy.random</span></code> are also
524 available:</p>
525 <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">random_uniform</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
526 <span class="n">random_integers</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
527 <span class="n">random_exponential</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
528 <span class="n">random_poisson</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
529 <span class="n">random_beta</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
530 <span class="n">random_normal</span><span class="p">(</span><span class="n">m</span><span class="p">,</span> <span class="n">sd</span><span class="p">)</span>
531 <span class="n">random_gamma</span> <span class="o">=</span> <span class="n">np</span><span class="o">.</span><span class="n">random</span><span class="o">.</span><span class="n">gamma</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
532 </pre></div>
533 </div>
534 <div class="admonition seealso">
535 <p class="first admonition-title">See also</p>
536 <p class="last"><a class="reference internal" href="Feature_examples.html#custom-state-durations"><span class="std std-ref">Custom state durations</span></a>,
537 <a class="reference internal" href="Feature_examples.html#sirs-model-with-periodic-external-risk"><span class="std std-ref">SIRS model with periodic external risk</span></a></p>
538 </div>
539 </div>
540 <div class="section" id="built-in-actions">
541 <h2>Built-in actions<a class="headerlink" href="#built-in-actions" title="Permalink to this headline">¶</a></h2>
542 <dl class="docutils">
543 <dt><code class="docutils literal notranslate"><span class="pre">{action:</span> <span class="pre">action_name,</span> <span class="pre">d_params:</span> <span class="pre">dict_of_parameters}</span></code></dt>
544 <dd><p class="first">The generic keyword to call an external actions, requires Python code.</p>
545 <ul>
546 <li><p class="first"><code class="docutils literal notranslate"><span class="pre">action_name</span></code> has to be described (<code class="docutils literal notranslate"><span class="pre">desc:</span> <span class="pre">...</span></code>) explicitly in
547 main section <code class="docutils literal notranslate"><span class="pre">actions</span></code></p>
548 </li>
549 <li><p class="first"><code class="docutils literal notranslate"><span class="pre">action_name</span></code> must be provided in a separate Python file, as a
550 <em>method</em> in a class associated with the level at which the action
551 will be performed. This method will look as (assuming that
552 <code class="docutils literal notranslate"><span class="pre">d_params</span></code> contains two keys, <code class="docutils literal notranslate"><span class="pre">param1</span></code> and <code class="docutils literal notranslate"><span class="pre">param2</span></code>):</p>
553 <div class="admonition-example admonition">
554 <p class="first admonition-title">Example</p>
555 <div class="last highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">action_name</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">param1</span><span class="p">,</span> <span class="n">param2</span><span class="p">):</span>
556     <span class="sd">&quot;&quot;&quot;Do somethin with *param1* and *param2* as specified in</span>
557 <span class="sd">    section ``actions``&quot;&quot;&quot;</span>
558     <span class="c1"># here the Python code for the action</span>
559 </pre></div>
560 </div>
561 </div>
562 </li>
563 </ul>
564 <p class="last">Whenever possible, prefer other built-in actions described below.</p>
565 </dd>
566 <dt><code class="docutils literal notranslate"><span class="pre">{message:</span> <span class="pre">'Some</span> <span class="pre">important</span> <span class="pre">information'}</span></code></dt>
567 <dd>Print the specified character string on the standard output while
568 running the model, preceded by the time step and the identifier of
569 the individual.</dd>
570 <dt><code class="docutils literal notranslate"><span class="pre">{set_var:</span> <span class="pre">varname,</span> <span class="pre">value:</span> <span class="pre">expression}</span></code></dt>
571 <dd><p class="first">Change the value of <code class="docutils literal notranslate"><span class="pre">varname</span></code> according to what is calculated in
572 <code class="docutils literal notranslate"><span class="pre">expression</span></code>.</p>
573 <div class="last admonition seealso">
574 <p class="first admonition-title">See also</p>
575 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-individual-actions-and-variable-aggregation"><span class="std std-ref">SIR model with individual actions and variable aggregation</span></a></p>
576 </div>
577 </dd>
578 </dl>
579 <dl class="docutils" id="clone-action">
580 <dt><code class="docutils literal notranslate"><span class="pre">{clone:</span> <span class="pre">a_prototype_or_list,</span> <span class="pre">amount:</span> <span class="pre">value,</span> <span class="pre">proba:</span> <span class="pre">value_or_list}</span></code></dt>
581 <dd><p class="first">Clone the individual into new ones. The newly produced individuals
582 follow the specified prototypes, according the given amount and
583 probabilities.</p>
584 <ul class="simple">
585 <li>default amount is 1</li>
586 <li>if no probabilities are given, prototypes are considered
587 equiprobable</li>
588 <li>a single prototype can be given as a single value instead of a
589 list</li>
590 <li>the list or probabilites must be of same size of prototypes
591 list, only the last value may be omitted to ensure that the sum
592 of probabilities is 1. When N prototypes are associated with N
593 probability values which sum to S &lt; 1, then there is a
594 probability 1-S to produce no offspring. Once probabilies are
595 actualized, a multinomial sampling is performed to determine the
596 number of new individuals in each category</li>
597 </ul>
598 <div class="admonition-example admonition">
599 <p class="first admonition-title">Example</p>
600 <p>A model with explicit gestation states and possibly vertical disease
601 transmission:</p>
602 <div class="last highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">from</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">G</span>
603   <span class="l l-Scalar l-Scalar-Plain">to</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">NG</span>
604   <span class="l l-Scalar l-Scalar-Plain">proba</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">1</span>
605   <span class="l l-Scalar l-Scalar-Plain">on_cross</span><span class="p p-Indicator">:</span>
606     <span class="p p-Indicator">-</span> <span class="l l-Scalar l-Scalar-Plain">clone</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">[</span><span class="nv">infected</span><span class="p p-Indicator">,</span> <span class="nv">healthy</span><span class="p p-Indicator">]</span>
607       <span class="l l-Scalar l-Scalar-Plain">amount</span><span class="p p-Indicator">:</span> <span class="l l-Scalar l-Scalar-Plain">1</span>
608       <span class="l l-Scalar l-Scalar-Plain">proba</span><span class="p p-Indicator">:</span> <span class="p p-Indicator">[</span><span class="nv">proba_vertical_transmission</span><span class="p p-Indicator">]</span>
609       <span class="c1"># prototype &#39;healthy&#39; has proba: 1-proba_vertical_transmission</span>
610 </pre></div>
611 </div>
612 </div>
613 <p>..seealso:</p>
614 <div class="last highlight-default notranslate"><div class="highlight"><pre><span></span>:ref:`SIR model with explicit gestation`
615 </pre></div>
616 </div>
617 </dd>
618 <dt><code class="docutils literal notranslate"><span class="pre">{produce_offspring:</span> <span class="pre">a_prototype_or_list,</span> <span class="pre">amount:</span> <span class="pre">value,</span> <span class="pre">proba:</span> <span class="pre">value_or_list}</span></code></dt>
619 <dd>Synonym of <code class="docutils literal notranslate"><span class="pre">clone</span></code>.</dd>
620 <dt><code class="docutils literal notranslate"><span class="pre">{become:</span> <span class="pre">a_prototype}</span></code></dt>
621 <dd>Force the individual to adopt the specified prototype. Useful to
622 couple states from distinct state machines.</dd>
623 </dl>
624 </div>
625 <div class="section" id="changing-scale-metapopulations">
626 <h2>Changing scale: metapopulations<a class="headerlink" href="#changing-scale-metapopulations" title="Permalink to this headline">¶</a></h2>
627 <p>In EMULSION, <code class="docutils literal notranslate"><span class="pre">metapopulation</span></code> is an aggregation type which allows to
628 handle multiple populations without regard to how this population is
629 built (compartment-based/hybrid/IBM).</p>
630 <p>It consists in defining a new level and completing initial conditions
631 through new population prototypes.</p>
632 <p>It may be also necessary to transform within-population parameters
633 into variables to allow for heterogeneous populations.</p>
634 <div class="admonition seealso">
635 <p class="first admonition-title">See also</p>
636 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-metapopulation"><span class="std std-ref">SIR model with metapopulation</span></a></p>
637 </div>
638 </div>
639 <div class="section" id="connecting-to-python-code-add-ons">
640 <h2>Connecting to Python code add-ons<a class="headerlink" href="#connecting-to-python-code-add-ons" title="Permalink to this headline">¶</a></h2>
641 <p>EMULSION is aimed at providing <em>generic</em> features required for
642 designing epidemiological models. Thus, some very specific operations
643 are not available in the generic engine. In such cases, a small code
644 add-on is required to provide additional functionalities.</p>
645 <p>Code add-ons are mainly used for specific requirements regarding:</p>
646 <ul class="simple">
647 <li>variables which are complicated to change through expressions and
648 actions</li>
649 <li>actions which are not realizable through built-in ones</li>
650 <li>processes which are not realizable through state machines</li>
651 <li>complex intial conditions</li>
652 <li>data loading</li>
653 </ul>
654 <p>To link a level with a code add-on, two elements are required:</p>
655 <ul class="simple">
656 <li><code class="docutils literal notranslate"><span class="pre">file:</span> <span class="pre">my_code_add_on.py</span></code> which specified the Python source code to use</li>
657 <li><code class="docutils literal notranslate"><span class="pre">class_name:</span> <span class="pre">AClassName</span></code> which defines the name of the Python
658 class associated with the level</li>
659 </ul>
660 <p>EMULSION provides an (experimental) code generator (<code class="docutils literal notranslate"><span class="pre">emulsion</span>
661 <span class="pre">generate</span> <span class="pre">MODEL.yaml</span></code>) which builds a code skeletton for files and
662 classes mentioned in the level definition. All actions and variables
663 listed respectively in <code class="docutils literal notranslate"><span class="pre">actions</span></code> and <code class="docutils literal notranslate"><span class="pre">statevars</span></code> sections, as well
664 as processes not associated with state machines or groupings, are
665 assumed to be defined in the Python file. All you need then is to fill
666 the relevant methods with the corresponding code, or remove
667 unnecessary parts.</p>
668 <div class="admonition seealso">
669 <p class="first admonition-title">See also</p>
670 <p class="last"><a class="reference internal" href="Feature_examples.html#sir-model-with-metapopulation-and-data-driven-movements"><span class="std std-ref">SIR model with metapopulation and data-driven movements</span></a></p>
671 </div>
672 </div>
673 </div>
676           </div>
677         </div>
678       </div>
679     <div class="clearer"></div>
680   </div>
681     <div class="footer">
682       &copy;2016, INRA and Univ. Lille.
683       
684       |
685       Powered by <a href="http://sphinx-doc.org/">Sphinx 1.7.5</a>
686       &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
687       
688       |
689       <a href="../_sources/pages/Modelling_language_advanced.rst.txt"
690           rel="nofollow">Page source</a>
691     </div>
693     
695     
696   </body>
697 </html>