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

index a2c7931..6d51bc4 100644 (file)
         <span class="c1"># iterate over all compartments</span>
         <span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">compart</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">_content</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
             <span class="c1"># compute the current population of each source compartment</span>
-            <span class="n">current_pop</span> <span class="o">=</span> <span class="n">compart</span><span class="o">.</span><span class="n">get_information</span><span class="p">(</span><span class="s1">&#39;population&#39;</span><span class="p">)</span>
-            <span class="c1"># no action if current pop &lt;= 0</span>
-            <span class="k">if</span> <span class="n">current_pop</span> <span class="o">&lt;=</span> <span class="mi">0</span><span class="p">:</span>
+            <span class="n">current_pop</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span><span class="n">compart</span><span class="o">.</span><span class="n">get_information</span><span class="p">(</span><span class="s1">&#39;population&#39;</span><span class="p">),</span> <span class="mi">0</span><span class="p">)</span>
+            <span class="c1"># no action if &quot;fake&quot; compartment</span>
+            <span class="k">if</span> <span class="nb">set</span><span class="p">(</span><span class="n">name</span><span class="p">)</span> <span class="o">==</span> <span class="p">{</span><span class="kc">None</span><span class="p">}:</span>
                 <span class="k">continue</span>
+            <span class="c1"># # no action if current pop &lt;= 0</span>
+            <span class="c1"># if current_pop &lt;= 0:</span>
+            <span class="c1">#     continue</span>
             <span class="c1"># compute all possible transitions from the current state</span>
             <span class="n">current_state</span> <span class="o">=</span> <span class="n">compart</span><span class="o">.</span><span class="n">get_information</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">state_machine</span><span class="o">.</span><span class="n">machine_name</span><span class="p">)</span>
             <span class="c1"># get the possible transitions from the current state</span>