[Avida-SVN] r3179 - in development/source: classification main

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri Mar 6 14:12:27 PST 2009


Author: brysonda
Date: 2009-03-06 17:12:27 -0500 (Fri, 06 Mar 2009)
New Revision: 3179

Modified:
   development/source/classification/cGenotype.cc
   development/source/classification/cGenotype.h
   development/source/main/cAvidaConfig.h
Log:
Add support for toggling during-run parent distance tracking. When TRACK_MAIN_LINEAGE is enabled these calculations are unnecessary since recalculate in analyze mode can and already does perform these calculations again.   The avida.cfg option TRACK_PARENT_DIST will default to disabled, however it can be enabled for experiments that want parent distance information but have disabled TRACK_MAIN_LINEAGE for performance reasons.

NOTE: This will break a number of consistency tests, since the 'parent_dist' column will be filled with -1 by default.   Although it would be preferable to actually remove the column altogether, certain code currently depends on the exact ordering and number of columns in the default dump files in order to work correctly.   Future versions of Avida will fix this.


Modified: development/source/classification/cGenotype.cc
===================================================================
--- development/source/classification/cGenotype.cc	2009-03-06 22:05:17 UTC (rev 3178)
+++ development/source/classification/cGenotype.cc	2009-03-06 22:12:27 UTC (rev 3179)
@@ -41,8 +41,9 @@
   : m_world(world)
   , genome(1)
   , name("001-no_name")
-  , flag_threshold(false)
-  , is_active(true)
+  , m_flag_threshold(false)
+  , m_is_active(true)
+  , m_track_parent_dist(m_world->GetConfig().TRACK_PARENT_DIST.Get())
   , defer_adjust(0)
   , id_num(in_id)
   , symbol(0)
@@ -154,7 +155,7 @@
     birth_data.ancestor_ids[5] = parent2->GetAncestorID(1);    
   }
 
-  birth_data.parent_distance = cGenomeUtil::FindEditDistance(genome, parent->genome);
+  if (m_track_parent_dist) birth_data.parent_distance = cGenomeUtil::FindEditDistance(genome, parent->genome);
   birth_data.parent_species = parent->GetSpecies();
   birth_data.gene_depth = parent->GetDepth() + 1;
   birth_data.lineage_label = parent->GetLineageLabel();

Modified: development/source/classification/cGenotype.h
===================================================================
--- development/source/classification/cGenotype.h	2009-03-06 22:05:17 UTC (rev 3178)
+++ development/source/classification/cGenotype.h	2009-03-06 22:12:27 UTC (rev 3179)
@@ -55,8 +55,12 @@
   cWorld* m_world;
   cGenome genome;
   cString name;
-  bool flag_threshold;
-  bool is_active;      // Is this genotype still alive?
+  
+  struct {
+    bool m_flag_threshold:1;
+    bool m_is_active:1;      // Is this genotype still alive?
+    bool m_track_parent_dist:1;
+  };
   int defer_adjust;    // Don't adjust in the archive until all are cleared.
 
   int id_num;
@@ -205,7 +209,7 @@
     { return birth_data.num_offspring_genotypes; }
   void AddOffspringGenotype() { birth_data.num_offspring_genotypes++; }
   void RemoveOffspringGenotype() { birth_data.num_offspring_genotypes--; }
-  bool GetActive() const { return is_active; }
+  bool GetActive() const { return m_is_active; }
   bool GetDeferAdjust() const { return defer_adjust > 0; }
   int GetUpdateDeactivated() { return birth_data.update_deactivated; }
   void Deactivate(int update, int org_id = -1);
@@ -221,7 +225,7 @@
   cSpecies* GetParentSpecies()  { return birth_data.parent_species; }
   cGenotype* GetNext()          { return next; }
   cGenotype* GetPrev()          { return prev; }
-  bool GetThreshold() const     { return flag_threshold; }
+  bool GetThreshold() const     { return m_flag_threshold; }
   int GetID() const             { return id_num; }
   char GetSymbol() const        { return symbol; }
   int GetMapColor() const       { return map_color_id; }
@@ -270,7 +274,7 @@
 
 inline void cGenotype::SetThreshold()
 {
-  flag_threshold = true;
+  m_flag_threshold = true;
   if (symbol == '.') symbol = '+';
   if (map_color_id == -2) map_color_id = -1;
 }
@@ -335,7 +339,7 @@
 
 inline void cGenotype::Deactivate(int update, int org_id)
 {
-  is_active = false;
+  m_is_active = false;
   birth_data.update_deactivated = update;
   birth_data.death_org_id = org_id;
 }

Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h	2009-03-06 22:05:17 UTC (rev 3178)
+++ development/source/main/cAvidaConfig.h	2009-03-06 22:12:27 UTC (rev 3179)
@@ -465,7 +465,9 @@
   CONFIG_ADD_VAR(SPECIES_RECORDING, int, 0, "1 = full, 2 = limited search (parent only)");
   CONFIG_ADD_VAR(SPECIES_PRINT, int, 0, "0/1 (off/on) Print out all species?");
   CONFIG_ADD_VAR(TEST_CPU_TIME_MOD, int, 20, "Time allocated in test CPUs (multiple of length)");
+  CONFIG_ADD_VAR(TRACK_PARENT_DIST, bool, 0, "Track parent distance during run. This is unnecessary when track main lineage is on.");
   
+  
   CONFIG_ADD_GROUP(LOG_GROUP, "Log Files");
   CONFIG_ADD_VAR(LOG_CREATURES, bool, 0, "0/1 (off/on) toggle to print file.");
   CONFIG_ADD_VAR(LOG_GENOTYPES, int, 0, "0 = off, 1 = print ALL, 2 = print threshold ONLY.");




More information about the Avida-cvs mailing list