[Avida-SVN] r2974 - branches/hjg-dev/source/main

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Wed Nov 26 11:06:02 PST 2008


Author: brysonda
Date: 2008-11-26 14:06:02 -0500 (Wed, 26 Nov 2008)
New Revision: 2974

Modified:
   branches/hjg-dev/source/main/cAvidaConfig.h
   branches/hjg-dev/source/main/cPhenotype.h
   branches/hjg-dev/source/main/cPopulation.cc
Log:
Add support to precalc_phenotype to copy last instruction counts.

Modified: branches/hjg-dev/source/main/cAvidaConfig.h
===================================================================
--- branches/hjg-dev/source/main/cAvidaConfig.h	2008-11-26 06:45:10 UTC (rev 2973)
+++ branches/hjg-dev/source/main/cAvidaConfig.h	2008-11-26 19:06:02 UTC (rev 2974)
@@ -433,7 +433,7 @@
   CONFIG_ADD_VAR(MIN_GB_DONATE_THRESHOLD, int, -1, "threshold green beard donates only to orgs above this\ndonation attempt threshold; -1=no thresh");
   CONFIG_ADD_VAR(DONATE_THRESH_QUANTA, int, 10, "The size of steps between quanta donate thresholds");
   CONFIG_ADD_VAR(MAX_DONATES, int, 1000000, "Limit on number of donates organisms are allowed.");
-  CONFIG_ADD_VAR(PRECALC_PHENOTYPE, int, 0, "0 = Disabled\n 1 = Assign precalculated merit at birth (unlimited resources only)\n 2 = Assign precalculated gestation time\n 3 = Assign precalculated merit AND gestation time.\nFitness will be evaluated for organism based on these settings.");
+  CONFIG_ADD_VAR(PRECALC_PHENOTYPE, int, 0, "0 = Disabled\n 1 = Assign precalculated merit at birth (unlimited resources only)\n 2 = Assign precalculated gestation time\n 3 = Assign precalculated merit AND gestation time.\n 4 = Assign last instruction counts \n 5 = Assign last instruction counts and merit\n 6 = Assign last instruction counts and gestation time \n 7 = Assign everything currently supported\nFitness will be evaluated for organism based on these settings.");
   CONFIG_ADD_VAR(FASTFORWARD_UPDATES, int, 0, "Fast-forward if the average generation has not changed in this many updates. (0 = off)");
   CONFIG_ADD_VAR(FASTFORWARD_NUM_ORGS, int, 0, "Fast-forward if population is equal to this");
 

Modified: branches/hjg-dev/source/main/cPhenotype.h
===================================================================
--- branches/hjg-dev/source/main/cPhenotype.h	2008-11-26 06:45:10 UTC (rev 2973)
+++ branches/hjg-dev/source/main/cPhenotype.h	2008-11-26 19:06:02 UTC (rev 2974)
@@ -427,6 +427,7 @@
   void SetCrossNum(int _cross_num) { cross_num = _cross_num; }
   void SetToDie() { to_die = true; }
   void SetToDelete() { to_delete = true; }
+  void SetLastInstCount(const tArray<int>& in_counts) { last_inst_count = in_counts; }
 
   void SetIsDonorCur() { is_donor_cur = true; } 
   void SetIsDonorRand() { SetIsDonorCur(); is_donor_rand = true; }

Modified: branches/hjg-dev/source/main/cPopulation.cc
===================================================================
--- branches/hjg-dev/source/main/cPopulation.cc	2008-11-26 06:45:10 UTC (rev 2973)
+++ branches/hjg-dev/source/main/cPopulation.cc	2008-11-26 19:06:02 UTC (rev 2974)
@@ -370,10 +370,13 @@
         test_cpu->TestGenome(ctx, test_info, parent_organism.GetHardware().GetMemory()); // Use the true genome
         if (pc_phenotype & 1) { // If we must update the merit
           parent_phenotype.SetMerit(test_info.GetTestPhenotype().GetMerit());
-	}
+        }
         if (pc_phenotype & 2) {   // If we must update the gestation time
           parent_phenotype.SetGestationTime(test_info.GetTestPhenotype().GetGestationTime());
-	}
+        }
+        if (pc_phenotype & 4) {   // If we must update the last instruction counts
+          parent_phenotype.SetLastInstCount(test_info.GetTestPhenotype().GetLastInstCount());
+        }
         parent_phenotype.SetFitness(parent_phenotype.GetMerit().CalcFitness(parent_phenotype.GetGestationTime())); //Update fitness
         delete test_cpu;
       }
@@ -504,6 +507,9 @@
       in_organism->GetPhenotype().SetMerit(test_info.GetTestPhenotype().GetMerit()); 
     if (pc_phenotype & 2)
       in_organism->GetPhenotype().SetGestationTime(test_info.GetTestPhenotype().GetGestationTime());
+    if (pc_phenotype & 4) {   // If we must update the last instruction counts
+      in_organism->GetPhenotype().SetLastInstCount(test_info.GetTestPhenotype().GetLastInstCount());
+    }
     in_organism->GetPhenotype().SetFitness(in_organism->GetPhenotype().GetMerit().CalcFitness(in_organism->GetPhenotype().GetGestationTime()));
     delete test_cpu;
   }




More information about the Avida-cvs mailing list