[Avida-SVN] r1459 - branches/dkdev/source/main

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Wed Apr 4 18:49:27 PDT 2007


Author: dknoester
Date: 2007-04-04 21:49:27 -0400 (Wed, 04 Apr 2007)
New Revision: 1459

Modified:
   branches/dkdev/source/main/cAvidaConfig.h
   branches/dkdev/source/main/cPopulation.cc
Log:
Added config option for random placement of a germline\'s seed within a deme.

Modified: branches/dkdev/source/main/cAvidaConfig.h
===================================================================
--- branches/dkdev/source/main/cAvidaConfig.h	2007-04-05 01:47:13 UTC (rev 1458)
+++ branches/dkdev/source/main/cAvidaConfig.h	2007-04-05 01:49:27 UTC (rev 1459)
@@ -165,6 +165,7 @@
   CONFIG_ADD_VAR(DEMES_HAVE_MERIT, int, 0, "Whether or not demes apply a merit to their members; 0=off");
   CONFIG_ADD_VAR(GERMLINE_COPY_MUT, double, 0.0075, "Probability of copy mutations occuring during germline replication.");
   CONFIG_ADD_VAR(GERMLINE_REPLACES_SOURCE, int, 0, "Whether the source germline is updated on replication; 0=no.");
+  CONFIG_ADD_VAR(GERMLINE_RANDOM_PLACEMENT, int, 0, "Whether the seed for a germline is placed randomly within the deme; 0=no.");
   CONFIG_ADD_VAR(MAX_DEME_AGE, int, 500, "The maximum age of a deme (in updates) to be used for age-based replication (default=500).");
   CONFIG_ADD_VAR(RANDOM_SEED, int, 0, "Random number seed (0 for based on time)");
   CONFIG_ADD_VAR(HARDWARE_TYPE, int, 0, "0 = Original CPUs\n1 = New SMT CPUs\n2 = Transitional SMT");

Modified: branches/dkdev/source/main/cPopulation.cc
===================================================================
--- branches/dkdev/source/main/cPopulation.cc	2007-04-05 01:47:13 UTC (rev 1458)
+++ branches/dkdev/source/main/cPopulation.cc	2007-04-05 01:49:27 UTC (rev 1459)
@@ -951,8 +951,15 @@
 			}
       
 			// Lineage label is wrong here; fix.
-			InjectGenome(source_deme.GetCellID(source_deme.GetSize()/2), source_germline.GetLatest(), 0);
-			InjectGenome(target_deme.GetCellID(target_deme.GetSize()/2), target_germline.GetLatest(), 0);
+      if(m_world->GetConfig().GERMLINE_RANDOM_PLACEMENT.Get()) {
+        InjectGenome(source_deme.GetCellID(m_world->GetRandom().GetInt(0, source_deme.GetSize()-1)),
+                     source_germline.GetLatest(), 0);
+        InjectGenome(target_deme.GetCellID(m_world->GetRandom().GetInt(0, target_deme.GetSize()-1)),
+                     target_germline.GetLatest(), 0);
+      } else {
+        InjectGenome(source_deme.GetCellID(source_deme.GetSize()/2), source_germline.GetLatest(), 0);
+        InjectGenome(target_deme.GetCellID(target_deme.GetSize()/2), target_germline.GetLatest(), 0);
+      }
 			
 			// Note: not rotating the clones.
 		} else {




More information about the Avida-cvs mailing list