[Avida-SVN] r2295 - in branches/energy/source: actions main

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Fri Feb 1 12:59:04 PST 2008


Author: beckma24
Date: 2008-02-01 15:59:04 -0500 (Fri, 01 Feb 2008)
New Revision: 2295

Modified:
   branches/energy/source/actions/PopulationActions.cc
   branches/energy/source/main/cAvidaConfig.h
   branches/energy/source/main/cPopulation.cc
Log:
Added deme replication based on number of births

Modified: branches/energy/source/actions/PopulationActions.cc
===================================================================
--- branches/energy/source/actions/PopulationActions.cc	2008-02-01 20:32:17 UTC (rev 2294)
+++ branches/energy/source/actions/PopulationActions.cc	2008-02-01 20:59:04 UTC (rev 2295)
@@ -996,6 +996,10 @@
     'full_deme' - ...demes that have been filled up.
     'corners'   - ...demes with upper left and lower right corners filled.
     'deme-age'  - ...demes that are a certain age
+    'sat-msg-pred'  - ...demes whose message predicate was previously satisfied
+    'sat-mov-pred'  - ...demes whose movement predicate was previously satisfied
+    'deme-age-noBirth'  - ...demes who have reached their maximum age
+    'deme-numberOfBirths' - ...demes who have reached a set number of births
 */
 
 class cActionReplicateDemes : public cAction
@@ -1016,6 +1020,7 @@
     else if (in_trigger == "sat-msg-pred") m_rep_trigger = 4;
     else if (in_trigger == "sat-mov-pred") m_rep_trigger = 5;
     else if (in_trigger == "deme-age-noBirth") m_rep_trigger = 6;
+    else if (in_trigger == "deme-numberOfBirths") m_rep_trigger = 7;
     else {
       cString err("Unknown replication trigger '");
       err += in_trigger;

Modified: branches/energy/source/main/cAvidaConfig.h
===================================================================
--- branches/energy/source/main/cAvidaConfig.h	2008-02-01 20:32:17 UTC (rev 2294)
+++ branches/energy/source/main/cAvidaConfig.h	2008-02-01 20:59:04 UTC (rev 2295)
@@ -301,6 +301,7 @@
   CONFIG_ADD_VAR(GERMLINE_RANDOM_PLACEMENT, int, 0, "Defines how the seed for a germline is placed\n within the deme;\n0 = organisms is placed in center of deme, no orientation\n1 = organisms is placed in center of deme and oriented\n2 = organism is randomly placed in deme, no orientation\n3 = deme is filled with identical copies of organism, no orientation\n4 = deme is filled with identical oriented copies of organism");
   CONFIG_ADD_VAR(GERMLINE_INJECT_ORGS, int, 1, "Defines how many organisms are injected.  GERMLINE_RANDOM_PLACEMENT must equal 2");
   CONFIG_ADD_VAR(MAX_DEME_AGE, int, 500, "The maximum age of a deme (in updates) to be\nused for age-based replication (default=500).");  
+  CONFIG_ADD_VAR(MAX_DEME_BIRTHS, int, 500, "The maximum number of births within a deme to be\nused for birth-based replication (default=500)."); 
   
   CONFIG_ADD_GROUP(REPRODUCTION_GROUP, "Birth and Death");
   CONFIG_ADD_VAR(BIRTH_METHOD, int, 0, "Which organism should be replaced on birth?\n0 = Random organism in neighborhood\n1 = Oldest in neighborhood\n2 = Largest Age/Merit in neighborhood\n3 = None (use only empty cells in neighborhood)\n4 = Random from population (Mass Action)\n5 = Oldest in entire population\n6 = Random within deme\n7 = Organism faced by parent\n8 = Next grid cell (id+1)\n9 = Largest energy used in entire population\n10 = Largest energy used in neighborhood");

Modified: branches/energy/source/main/cPopulation.cc
===================================================================
--- branches/energy/source/main/cPopulation.cc	2008-02-01 20:32:17 UTC (rev 2294)
+++ branches/energy/source/main/cPopulation.cc	2008-02-01 20:59:04 UTC (rev 2295)
@@ -1087,6 +1087,7 @@
 4: 'sat-msg-pred'  - ...demes whose message predicate was previously satisfied
 5: 'sat-mov-pred'  - ...demes whose movement predicate was previously satisfied
 6: 'deme-age-noBirth'  - ...demes who have reached their maximum age
+7: 'deme-numberOfBirths' - ...demes who have reached a set number of births
 */
 
 void cPopulation::ReplicateDemes(int rep_trigger)
@@ -1146,6 +1147,12 @@
           continue;
         break;
       }
+      case 7: {
+        // replicate demes who have a a set number of births
+        if(source_deme.GetBirthCount() < m_world->GetConfig().MAX_DEME_BIRTHS.Get())
+          continue;
+        break;
+      }
       default: {
         cerr << "ERROR: Invalid replication trigger " << rep_trigger
         << " in cPopulation::ReplicateDemes()" << endl;




More information about the Avida-cvs mailing list