[Avida-SVN] r1510 - in branches/dkdev: Avida.xcodeproj source/main

dknoester at myxo.css.msu.edu dknoester at myxo.css.msu.edu
Tue May 1 05:49:29 PDT 2007


Author: dknoester
Date: 2007-05-01 08:49:29 -0400 (Tue, 01 May 2007)
New Revision: 1510

Modified:
   branches/dkdev/Avida.xcodeproj/project.pbxproj
   branches/dkdev/source/main/cAvidaConfig.h
   branches/dkdev/source/main/cPopulation.cc
Log:
Added config option to fully populate replicated demes; works well with germlines.

Modified: branches/dkdev/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/dkdev/Avida.xcodeproj/project.pbxproj	2007-04-29 23:51:53 UTC (rev 1509)
+++ branches/dkdev/Avida.xcodeproj/project.pbxproj	2007-05-01 12:49:29 UTC (rev 1510)
@@ -244,10 +244,6 @@
 		70F7DE7409296794009E311D /* cGenotype_BirthData.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70F7DE700929678E009E311D /* cGenotype_BirthData.cc */; };
 		DCC3166107628531008F7A48 /* avida.cc in Sources */ = {isa = PBXBuildFile; fileRef = DCC3109C0762539E008F7A48 /* avida.cc */; };
 		E03F28DC0B8A2840009966B8 /* cDeme.cc in Sources */ = {isa = PBXBuildFile; fileRef = E03F28DA0B8A2840009966B8 /* cDeme.cc */; };
-		E03F28DD0B8A2840009966B8 /* cDeme.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E03F28DB0B8A2840009966B8 /* cDeme.h */; };
-		E08178BA0B3DCB9600B474B6 /* cTopology.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E08178B90B3DCB9600B474B6 /* cTopology.h */; };
-		E0D1973A0B8B2F4C005EF7EE /* cOrgMessage.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E0D197390B8B2F4C005EF7EE /* cOrgMessage.h */; };
-		E0F61AE80BA2FDBD00B53C23 /* cGermline.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = E0F61AE70BA2FDBD00B53C23 /* cGermline.h */; };
 		E0F61B210BA33F5D00B53C23 /* cGermline.cc in Sources */ = {isa = PBXBuildFile; fileRef = E0F61B200BA33F5D00B53C23 /* cGermline.cc */; };
 		E626209E0A372C2A00C07685 /* SaveLoadActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 708051A80A1F65FE00CBB8B6 /* SaveLoadActions.cc */; };
 /* End PBXBuildFile section */
@@ -292,10 +288,6 @@
 				7049F3710A66AD7E00640512 /* default-sex-classic.org in CopyFiles */,
 				7049F3720A66AD7E00640512 /* default-smt.org in CopyFiles */,
 				7049F3730A66AD7E00640512 /* default-transsmt.org in CopyFiles */,
-				E08178BA0B3DCB9600B474B6 /* cTopology.h in CopyFiles */,
-				E03F28DD0B8A2840009966B8 /* cDeme.h in CopyFiles */,
-				E0D1973A0B8B2F4C005EF7EE /* cOrgMessage.h in CopyFiles */,
-				E0F61AE80BA2FDBD00B53C23 /* cGermline.h in CopyFiles */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: branches/dkdev/source/main/cAvidaConfig.h
===================================================================
--- branches/dkdev/source/main/cAvidaConfig.h	2007-04-29 23:51:53 UTC (rev 1509)
+++ branches/dkdev/source/main/cAvidaConfig.h	2007-05-01 12:49:29 UTC (rev 1510)
@@ -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(FILL_DEME_ON_REPLICATE, int, 0, "Whether to fill the source and target demes upon 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).");

Modified: branches/dkdev/source/main/cPopulation.cc
===================================================================
--- branches/dkdev/source/main/cPopulation.cc	2007-04-29 23:51:53 UTC (rev 1509)
+++ branches/dkdev/source/main/cPopulation.cc	2007-05-01 12:49:29 UTC (rev 1510)
@@ -950,15 +950,28 @@
 				KillOrganism(cell_array[source_deme.GetCellID(i)]);
 			}
       
-			// Lineage label is wrong here; fix.
-      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);
+      // And inject the genomes into the source and target demes.  There are a
+      // couple of different ways we can do this:
+      if(m_world->GetConfig().FILL_DEME_ON_REPLICATE.Get()) {
+        // Fill each deme with copies of the new organism:
+        for(int i=0; i<source_deme.GetSize(); ++i) {
+          InjectGenome(source_deme.GetCellID(i), source_germline.GetLatest(), 0);
+        }
+        for(int i=0; i<target_deme.GetSize(); ++i) {
+          InjectGenome(target_deme.GetCellID(i), 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);
+        if(m_world->GetConfig().GERMLINE_RANDOM_PLACEMENT.Get()) {
+          // Place the new organisms randomly:
+          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 {
+          // Place the new organisms in the 'middle' of the demes:
+          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.




More information about the Avida-cvs mailing list