[Avida-SVN] r1554 - in development: source/classification source/main support/config

matt at myxo.css.msu.edu matt at myxo.css.msu.edu
Mon May 14 16:42:46 PDT 2007


Author: matt
Date: 2007-05-14 19:42:45 -0400 (Mon, 14 May 2007)
New Revision: 1554

Modified:
   development/source/classification/cLineage.cc
   development/source/main/cPopulation.cc
   development/source/main/cPopulation.h
   development/source/main/cWorld.cc
   development/support/config/avida.cfg
Log:
Base cclade tracking on genotype ID; allow for injected genotypes to be assigned cclade labels; reorder avida world init to read cclade ids before start_creature injection

Modified: development/source/classification/cLineage.cc
===================================================================
--- development/source/classification/cLineage.cc	2007-05-14 18:36:56 UTC (rev 1553)
+++ development/source/classification/cLineage.cc	2007-05-14 23:42:45 UTC (rev 1554)
@@ -149,6 +149,7 @@
   m_ave_fitness_changed = false;
 }
 
+
 tArray<const cGenotype*> cLineage::GetCurrentGenotypes(cAvidaContext& ctx) const
 {
 	tArray<const cGenotype*> genotypes;
@@ -157,4 +158,3 @@
 		genotypes.Push(it->first);
 	return genotypes;
 }
-

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2007-05-14 18:36:56 UTC (rev 1553)
+++ development/source/main/cPopulation.cc	2007-05-14 23:42:45 UTC (rev 1554)
@@ -281,10 +281,8 @@
     LineageSetupOrganism(child_array[i], parent_organism.GetLineage(),
                          parent_organism.GetLineageLabel(), parent_genotype);
 		
-		// @MRR Do coalescence clade set up for new organisms.
-		CCladeSetupOrganism(child_array[i], parent_organism.GetCCladeLabel());
-		
-    
+		//By default, store the parent cclade, this may get modified in ActivateOrgansim (@MRR)
+		child_array[i]->SetCCladeLabel(parent_organism.GetCCladeLabel());
   }
   
   
@@ -397,6 +395,8 @@
   environment.SetupInputs(ctx, target_cell.input_array);
   
   // Update the archive...
+	
+	
   in_genotype->AddOrganism();
   
   if (old_genotype != NULL) {
@@ -422,7 +422,10 @@
   // Statistics...
   m_world->GetStats().RecordBirth(target_cell.GetID(), in_genotype->GetID(),
                                   in_organism->GetPhenotype().ParentTrue());
-                                  
+	
+	// @MRR Do coalescence clade set up for new organisms.
+	CCladeSetupOrganism(in_organism ); 
+	
   //count how many times MERIT_BONUS_INST (rewarded instruction) is in the genome
   //only relevant if merit is proportional to # times MERIT_BONUS_INST is in the genome
   int rewarded_instruction = m_world->GetConfig().MERIT_BONUS_INST.Get();
@@ -1299,19 +1302,26 @@
 
 /**
 This function will set up coalescence clade information.  If this feature is activated in the configuration,
- a list of coalescence ids must be read in initially.  These are furnished by doing an initial run with the
- same seed and setup and retrieving information from the final dominant lineage and coalescence points.
+ a list of coalescence genotype ids must be read in initially.  These are furnished by doing an initial run 
+ with the same seed and setup and retrieving information from the final dominant lineage and coalescence points.
+ 
+ The value is either (by default) inherited from the parent or the organism's genotypeID if it is known
+ to be a coalescence id.
+ 
+ Defaulting is established in Inject or ActivateOffspring methods of this class.
+ 
  @MRR May 2007
  **/
-void cPopulation::CCladeSetupOrganism(cOrganism* organism, int parent_cclade_id)
+void cPopulation::CCladeSetupOrganism(cOrganism* organism)
 {
-		int clade_id = -1;  //Default if this isn't being used;
+		int gen_id = organism->GetGenotype()->GetID();	
 		if (m_world->GetConfig().TRACK_CCLADES.Get() > 0)
 		{
-			clade_id = (m_world->GetClassificationManager().IsCCladeFounder(organism->GetID())) ?
-			organism->GetID() : parent_cclade_id;
+			if (m_world->GetClassificationManager().IsCCladeFounder(gen_id))
+			{	
+				organism->SetCCladeLabel(gen_id);
+			}
 		}
-		organism->SetCCladeLabel(clade_id);
 }
 
 
@@ -2274,6 +2284,9 @@
   cAvidaContext& ctx = m_world->GetDefaultContext();
   
   cOrganism* new_organism = new cOrganism(m_world, ctx, new_genotype->GetGenome());
+	
+	//Coalescense Clade Setup
+	new_organism->SetCCladeLabel(-1);  
   
   // Set the genotype...
   new_organism->SetGenotype(new_genotype);

Modified: development/source/main/cPopulation.h
===================================================================
--- development/source/main/cPopulation.h	2007-05-14 18:36:56 UTC (rev 1553)
+++ development/source/main/cPopulation.h	2007-05-14 23:42:45 UTC (rev 1554)
@@ -131,7 +131,7 @@
   void InjectClone(int cell_id, cOrganism& orig_org);
 
   void LineageSetupOrganism(cOrganism* organism, cLineage* lineage, int lin_label, cGenotype* parent_genotype = NULL);
-	void CCladeSetupOrganism(cOrganism* organism, int parent_cclade_id); 
+	void CCladeSetupOrganism(cOrganism* organism); 
 	
   // Must be called to activate *any* organism in the population.
   void ActivateOrganism(cAvidaContext& ctx, cOrganism* in_organism, cPopulationCell& target_cell);

Modified: development/source/main/cWorld.cc
===================================================================
--- development/source/main/cWorld.cc	2007-05-14 18:36:56 UTC (rev 1553)
+++ development/source/main/cWorld.cc	2007-05-14 23:42:45 UTC (rev 1554)
@@ -102,8 +102,11 @@
   for (int i = 0; i < inst_set.GetSize(); i++)
     m_stats->SetInstName(i, inst_set.GetName(i));
   
+  // @MRR CClade Tracking
+	if (m_conf->TRACK_CCLADES.Get() > 0)
+		m_class_mgr->LoadCCladeFounders(m_conf->TRACK_CCLADES_IDS.Get());
   
-  m_pop = new cPopulation(this);
+	m_pop = new cPopulation(this);
   
   // Setup Event List
   m_event_list = new cEventList(this);
@@ -112,9 +115,7 @@
     ExitAvida(-1);
   }
   
-	// @MRR CClade Tracking
-	if (m_conf->TRACK_CCLADES.Get() > 0)
-		m_class_mgr->LoadCCladeFounders(m_conf->TRACK_CCLADES_IDS.Get());
+	
   
   const bool revert_fatal = m_conf->REVERT_FATAL.Get() > 0.0;
   const bool revert_neg = m_conf->REVERT_DETRIMENTAL.Get() > 0.0;

Modified: development/support/config/avida.cfg
===================================================================
--- development/support/config/avida.cfg	2007-05-14 18:36:56 UTC (rev 1553)
+++ development/support/config/avida.cfg	2007-05-14 23:42:45 UTC (rev 1554)
@@ -255,3 +255,8 @@
 MT_CONCURRENCY 1   # Number of concurrent analyze threads
 ANALYZE_OPTION_1   # String variable accessible from analysis scripts
 ANALYZE_OPTION_2   # String variable accessible from analysis scripts
+
+### SECOND_PASS_GROUP ###
+# Tracking metrics known after the running experiment previously
+TRACK_CCLADES 0                    # Enable tracking of coalescence clades
+TRACK_CCLADES_IDS coalescence.ids  # File storing coalescence IDs




More information about the Avida-cvs mailing list