[Avida-SVN] r1426 - branches/dkdev/source/main
dknoester at myxo.css.msu.edu
dknoester at myxo.css.msu.edu
Sat Mar 24 13:35:17 PDT 2007
Author: dknoester
Date: 2007-03-24 16:35:17 -0400 (Sat, 24 Mar 2007)
New Revision: 1426
Modified:
branches/dkdev/source/main/cAvidaConfig.h
branches/dkdev/source/main/cPopulation.cc
Log:
Added configuration option to turn on/off replacment of source germline on deme replication.
Modified: branches/dkdev/source/main/cAvidaConfig.h
===================================================================
--- branches/dkdev/source/main/cAvidaConfig.h 2007-03-23 19:02:36 UTC (rev 1425)
+++ branches/dkdev/source/main/cAvidaConfig.h 2007-03-24 20:35:17 UTC (rev 1426)
@@ -164,6 +164,7 @@
CONFIG_ADD_VAR(DEMES_USE_GERMLINE, int, 0, "Whether or not demes use a distinct germline; 0=off");
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(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-03-23 19:02:36 UTC (rev 1425)
+++ branches/dkdev/source/main/cPopulation.cc 2007-03-24 20:35:17 UTC (rev 1426)
@@ -346,7 +346,7 @@
// Randomize the facing of organisms if so configured.
if(m_world->GetConfig().RANDOMIZE_ORGANISM_FACING.Get()) {
- int rotate_count=m_world->GetRandom().GetInt(0, target_cell.ConnectionList().GetSize());
+ const int rotate_count=m_world->GetRandom().GetInt(0, target_cell.ConnectionList().GetSize());
for(int i=0; i<rotate_count; ++i) {
target_cell.ConnectionList().CircNext();
}
@@ -882,10 +882,6 @@
// Second, it could be an offspring of the source deme's germline, if the config
// option DEMES_USE_GERMLINE is set.
if(m_world->GetConfig().DEMES_USE_GERMLINE.Get()) {
- // We're using deme germlines, so take the source deme's germ and run
- // it in the test cpu. If it reproduces (with mutations turned on!), use the
- // offspring to seed the target deme.
-
// Get the latest germ from the source deme.
cGermline& source_germline = source_deme.GetGermline();
cGenome& source_germ = source_germline.GetLatest();
@@ -903,17 +899,24 @@
}
}
- source_germline.Add(next_germ);
+ // Here we're adding the next_germ to the germline(s). Note the
+ // config option to determine if we should update the source_germline
+ // as well.
target_deme.ReplaceGermline(source_germline);
+ cGermline& target_germline = target_deme.GetGermline();
+ target_germline.Add(next_germ);
+ if(m_world->GetConfig().GERMLINE_REPLACES_SOURCE.Get()) {
+ source_germline.Add(next_germ);
+ }
// Kill all the organisms in the source deme.
for (int i=0; i<source_deme.GetSize(); i++) {
KillOrganism(cell_array[source_deme.GetCellID(i)]);
}
- // Lineage label is wrong here...
- InjectGenome(source_deme.GetCellID(source_deme.GetSize()/2), next_germ, 0);
- InjectGenome(target_deme.GetCellID(target_deme.GetSize()/2), next_germ, 0);
+ // 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);
// Note: not rotating the clones.
} else {
More information about the Avida-cvs
mailing list