[Avida-SVN] r3578 - in development: source source/cpu source/main support/config

jbarrick at myxo.css.msu.edu jbarrick at myxo.css.msu.edu
Wed Dec 23 18:43:53 PST 2009


Author: jbarrick
Date: 2009-12-23 21:43:53 -0500 (Wed, 23 Dec 2009)
New Revision: 3578

Modified:
   development/source/cpu/cHardwareCPU.cc
   development/source/defs.h
   development/source/main/cPhenotype.cc
   development/support/config/avida.cfg
Log:
New BASE_MERIT_METHOD 7 = assign merit from gestation time. Fixed cMutSteps not being cleared at each generation by Inst_Repro in cHardwareCPU.cc. Untested in other CPU types.

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2009-12-23 21:47:22 UTC (rev 3577)
+++ development/source/cpu/cHardwareCPU.cc	2009-12-24 02:43:53 UTC (rev 3578)
@@ -3171,6 +3171,8 @@
   // Setup child
   cGenome& child_genome = m_organism->OffspringGenome().GetGenome();
   child_genome = m_organism->GetGenome();
+  
+  
   m_organism->OffspringGenome().SetHardwareType(GetType());
   m_organism->OffspringGenome().SetInstSetID(GetInstSetID());
 
@@ -3186,6 +3188,10 @@
     }
   }
   
+  //Need to clear the mutation steps, so that only most recent are there...
+  child_genome.GetMutationSteps().Clear();
+  
+  //Perform divide mutations...
   Divide_DoMutations(ctx);
   
   // Check viability

Modified: development/source/defs.h
===================================================================
--- development/source/defs.h	2009-12-23 21:47:22 UTC (rev 3577)
+++ development/source/defs.h	2009-12-24 02:43:53 UTC (rev 3578)
@@ -170,7 +170,9 @@
   BASE_MERIT_FULL_SIZE,
   BASE_MERIT_LEAST_SIZE,
   BASE_MERIT_SQRT_LEAST_SIZE,
-  BASE_MERIT_NUM_BONUS_INST
+  BASE_MERIT_NUM_BONUS_INST,
+  BASE_MERIT_GESTATION_TIME
+  
 };
 
 enum eINST_CODE_DEFAULT

Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc	2009-12-23 21:47:22 UTC (rev 3577)
+++ development/source/main/cPhenotype.cc	2009-12-24 02:43:53 UTC (rev 3578)
@@ -1357,6 +1357,9 @@
     else if (m_world->GetConfig().MERIT_BONUS_EFFECT.Get()<0) {out_size = genome_length - (bonus_instruction_count -1);}
     else {out_size = 1;}  //the extra 1 point in all these case is so the orgs are not jilted by the scheduler        
     break;
+  case BASE_MERIT_GESTATION_TIME:
+    out_size = cpu_cycles_used;
+    break;
   case BASE_MERIT_CONST:
   default:
     out_size = m_world->GetConfig().BASE_CONST_MERIT.Get();

Modified: development/support/config/avida.cfg
===================================================================
--- development/support/config/avida.cfg	2009-12-23 21:47:22 UTC (rev 3577)
+++ development/support/config/avida.cfg	2009-12-24 02:43:53 UTC (rev 3578)
@@ -302,6 +302,7 @@
                              # 4 = Merit prop. to min of executed or copied size
                              # 5 = Merit prop. to sqrt of the minimum size
                              # 6 = Merit prop. to num times MERIT_BONUS_INST is in genome.
+                             # 7 = Merit prop. to gestation time
 BASE_CONST_MERIT 100         # Base merit when BASE_MERIT_METHOD set to 0
 DEFAULT_BONUS 1.0            # Initial bonus before any tasks
 MERIT_DEFAULT_BONUS 0        # Scale the merit of an offspring by this default bonus




More information about the Avida-cvs mailing list