[Avida-SVN] r1646 - in development: Avida.xcodeproj source/classification source/main

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Tue Jun 5 18:51:15 PDT 2007


Author: brysonda
Date: 2007-06-05 21:51:15 -0400 (Tue, 05 Jun 2007)
New Revision: 1646

Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/classification/cGenotype.cc
   development/source/classification/cGenotypeControl.cc
   development/source/classification/cGenotype_BirthData.cc
   development/source/classification/cGenotype_BirthData.h
   development/source/main/cPopulation.cc
Log:
Now for why some tests were reset.

Change behavior of cGenotypeControl::Remove to check if the genotype being removed is the current coalescence point. If so, clear out the coalescence pointer so that it will be reset on next call to UpdateCoalescent. 

Note, this is a workaround for the fact that our current implementation of coalescence assumes that there will only ever be one ancestor.   This really needs to be reworked, as there are numerous cases where such an assumption will be incorrect.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2007-06-06 01:47:08 UTC (rev 1645)
+++ development/Avida.xcodeproj/project.pbxproj	2007-06-06 01:51:15 UTC (rev 1646)
@@ -198,23 +198,6 @@
 		};
 /* End PBXBuildRule section */
 
-/* Begin PBXBuildStyle section */
-		B56E89620C144AFE00B99261 /* Development */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-				COPY_PHASE_STRIP = NO;
-			};
-			name = Development;
-		};
-		B56E89630C144AFE00B99261 /* Deployment */ = {
-			isa = PBXBuildStyle;
-			buildSettings = {
-				COPY_PHASE_STRIP = YES;
-			};
-			name = Deployment;
-		};
-/* End PBXBuildStyle section */
-
 /* Begin PBXContainerItemProxy section */
 		7023ECA60C0A436000362B9C /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
@@ -1690,12 +1673,6 @@
 		DCC30C4D0762532C008F7A48 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 702442D70859E0B00059BD9B /* Build configuration list for PBXProject "Avida" */;
-			buildSettings = {
-			};
-			buildStyles = (
-				B56E89620C144AFE00B99261 /* Development */,
-				B56E89630C144AFE00B99261 /* Deployment */,
-			);
 			hasScannedForEncodings = 0;
 			mainGroup = DCC30C490762532C008F7A48;
 			productRefGroup = DCC3164E07626CF3008F7A48 /* Products */;

Modified: development/source/classification/cGenotype.cc
===================================================================
--- development/source/classification/cGenotype.cc	2007-06-06 01:47:08 UTC (rev 1645)
+++ development/source/classification/cGenotype.cc	2007-06-06 01:51:15 UTC (rev 1646)
@@ -135,13 +135,14 @@
   sum_merit.Subtract(in.GetDouble());
 }
 
-void cGenotype::SetParent(cGenotype * parent, cGenotype * parent2)
+void cGenotype::SetParent(cGenotype* parent, cGenotype* parent2)
 {
   birth_data.parent_genotype = parent;
   birth_data.parent2_genotype = parent2;
 
+  if (parent == NULL) return;
+
   // If we have a real parent genotype, collect other data about parent.
-  if (parent == NULL) return;
   birth_data.ancestor_ids[0] = parent->GetID();
   birth_data.ancestor_ids[2] = parent->GetAncestorID(0);
   birth_data.ancestor_ids[3] = parent->GetAncestorID(1);
@@ -151,8 +152,7 @@
     birth_data.ancestor_ids[5] = parent2->GetAncestorID(1);    
   }
 
-  birth_data.parent_distance =
-    cGenomeUtil::FindEditDistance(genome, parent->genome);
+  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/cGenotypeControl.cc
===================================================================
--- development/source/classification/cGenotypeControl.cc	2007-06-06 01:47:08 UTC (rev 1645)
+++ development/source/classification/cGenotypeControl.cc	2007-06-06 01:51:15 UTC (rev 1646)
@@ -85,12 +85,9 @@
 
 void cGenotypeControl::Remove(cGenotype & in_genotype)
 {
-  if (size == 1) {
-    best = NULL;
-  }
-  if (&in_genotype == best) {
-    best = best->GetNext();
-  }
+  if (size == 1) best = NULL;
+  if (&in_genotype == best) best = best->GetNext();
+  if (&in_genotype == coalescent) coalescent = NULL;
 
   in_genotype.GetNext()->SetPrev(in_genotype.GetPrev());
   in_genotype.GetPrev()->SetNext(in_genotype.GetNext());
@@ -140,9 +137,7 @@
   // Test to see if any updating needs to be done...
   // Don't update active coalescent genotype, or if there is more than
   // one offspring.
-  if (coalescent != NULL &&
-      (coalescent->GetNumOrganisms() > 0 ||
-       coalescent->GetNumOffspringGenotypes() > 1)) {
+  if (coalescent != NULL && (coalescent->GetNumOrganisms() > 0 || coalescent->GetNumOffspringGenotypes() > 1)) {
     return coalescent->GetDepth();
   }
 
@@ -150,14 +145,13 @@
   if (best == NULL) return -1;
 
   // Find the new point...
-  cGenotype * test_gen = best;
-  cGenotype * found_gen = best;
-  cGenotype * parent_gen = best->GetParentGenotype();
+  cGenotype* test_gen = best;
+  cGenotype* found_gen = best;
+  cGenotype* parent_gen = best->GetParentGenotype();
 
   while (parent_gen != NULL) {
     // See if this genotype should be the new found genotype...
-    if (test_gen->GetNumOrganisms() > 0 ||
-	test_gen->GetNumOffspringGenotypes() > 1) {
+    if (test_gen->GetNumOrganisms() > 0 || test_gen->GetNumOffspringGenotypes() > 1) {
       found_gen = test_gen;
     }
 

Modified: development/source/classification/cGenotype_BirthData.cc
===================================================================
--- development/source/classification/cGenotype_BirthData.cc	2007-06-06 01:47:08 UTC (rev 1645)
+++ development/source/classification/cGenotype_BirthData.cc	2007-06-06 01:51:15 UTC (rev 1646)
@@ -25,9 +25,6 @@
 
 #include "cGenotype_BirthData.h"
 
-#include "defs.h"
-
-
 cGenotype_BirthData::cGenotype_BirthData(int in_update_born)
   : update_born(in_update_born)
   , parent_distance(-1)

Modified: development/source/classification/cGenotype_BirthData.h
===================================================================
--- development/source/classification/cGenotype_BirthData.h	2007-06-06 01:47:08 UTC (rev 1645)
+++ development/source/classification/cGenotype_BirthData.h	2007-06-06 01:51:15 UTC (rev 1646)
@@ -53,9 +53,9 @@
   int lineage_label;    // Unique label for the lineage of this genotype.
 
   int update_deactivated;       // If not, when did it get deactivated?
-  cGenotype * parent_genotype;  // Pointer to parent genotype...
-  cGenotype * parent2_genotype; // Pointer to secondary parent genotype...
-  cSpecies * parent_species;
+  cGenotype* parent_genotype;  // Pointer to parent genotype...
+  cGenotype* parent2_genotype; // Pointer to secondary parent genotype...
+  cSpecies* parent_species;
   int num_offspring_genotypes;  // Num offspring genotypes still in memory.
 
   // Ancestral IDs.  This array contains all of the information about the

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2007-06-06 01:47:08 UTC (rev 1645)
+++ development/source/main/cPopulation.cc	2007-06-06 01:51:15 UTC (rev 1646)
@@ -2432,7 +2432,8 @@
 
   phenotype.SetMerit( cMerit(new_genotype->GetTestMerit(ctx)) );
   
-  cerr<<"initial energy: " << phenotype.GetStoredEnergy() <<endl<<"initial Merit: "<<phenotype.GetMerit().GetDouble()<<endl;
+  // @DMB - this appears to be debugging output
+  //cerr<<"initial energy: " << phenotype.GetStoredEnergy() <<endl<<"initial Merit: "<<phenotype.GetMerit().GetDouble()<<endl;
   
   // @CAO are these really needed?
   phenotype.SetLinesCopied( new_genotype->GetTestCopiedSize(ctx) );




More information about the Avida-cvs mailing list