[avida-cvs] avida CVS commits: /current/source/main birth_chamber.cc config.cc config.hh

dule123 avida-cvs at alife.org
Thu Dec 11 22:13:04 PST 2003


dule123		Thu Dec 11 14:13:04 2003 EDT

  Modified files:              
    /avida/current/source/main	birth_chamber.cc config.cc config.hh 
  Log:
  Added a new variable, RECOMBINATION_PROB, to genesis. 
  
  It specifies the probability that each of the recombination events in the 
  birth chamber will actually happen. 
  By default it's set to 1, so organisms with divide-sex will always recombine. 
  
  
  
Index: avida/current/source/main/birth_chamber.cc
diff -u avida/current/source/main/birth_chamber.cc:1.9 avida/current/source/main/birth_chamber.cc:1.10
--- avida/current/source/main/birth_chamber.cc:1.9	Tue Nov 25 09:37:56 2003
+++ avida/current/source/main/birth_chamber.cc	Thu Dec 11 14:13:04 2003
@@ -24,6 +24,9 @@
 #ifndef TOOLS_HH
 #include "tools.hh"
 #endif
+#ifndef CONFIG_HH
+#include "config.hh"
+#endif
 
 using namespace std;
 
@@ -72,7 +75,10 @@
   genome_waiting = false;
 
   // How many crossovers should be do? For now, 0 or 1
-  if (parent.GetPhenotype().CrossNum() ==0) {
+  // Also check the probability of recombination in case
+  // it is less then 1 
+  if (parent.GetPhenotype().CrossNum() ==0 || 
+	cConfig::GetRecombProb() < g_random.GetDouble()) {
     child_array.Resize(2);
     child_array[0] = new cOrganism(wait_entry.genome, pop_interface,
 				   environment);
@@ -83,6 +89,7 @@
     return true;
   }
   else {
+
     cCPUMemory genome0 = wait_entry.genome;
     cCPUMemory genome1 = child_genome;
 
Index: avida/current/source/main/config.cc
diff -u avida/current/source/main/config.cc:1.67 avida/current/source/main/config.cc:1.68
--- avida/current/source/main/config.cc:1.67	Wed Dec 10 13:56:57 2003
+++ avida/current/source/main/config.cc	Thu Dec 11 14:13:04 2003
@@ -58,6 +58,7 @@
 double cConfig::divide_del_prob;
 double cConfig::parent_mut_prob;
 int cConfig::special_mut_line;
+double cConfig::recomb_prob;
 int cConfig::num_instructions;
 int cConfig::hardware_type;
 int cConfig::max_cpu_threads;
@@ -177,6 +178,8 @@
 		   "0 = Divide leaves state of mother untouched.\n1 = Divide resets state of mother (after the divide, we have 2 children)\n2 = Divide resets state of current thread only(does not touch possible parasite threads)");
   repro_group->Add(generation_inc_method, "1", "GENERATION_INC_METHOD",
 		   "0 = Only the generation of the child is\n    increased on divide.\n1 = Both the generation of the mother and child are\n    increased on divide (good with DIVIDE_METHOD 1).");
+  repro_group->Add(recomb_prob, "1", "RECOMBINATION_PROB",
+		   "probability that recombination will happen when div-sex is used");
 
 
   // Divide Restrictions Group.
@@ -218,9 +221,9 @@
   muts_group->Add(parent_mut_prob, "0.0", "PARENT_MUT_PROB",
 		  "Per-site, in parent, on divide");
   muts_group->Add(special_mut_line, "-1", "SPECIAL_MUT_LINE",
-		  "If this is >= 0, ONLY this line is mutated");
+                  "If this is >= 0, ONLY this line is mutated");
+
 
-  
   // Mutation reversions group
   cConfigGroup * rev_group = new cConfigGroup("Mutation Reversion");
   rev_group->SetComment("These slow down avida a lot, and should be set to 0.0 normally.");
Index: avida/current/source/main/config.hh
diff -u avida/current/source/main/config.hh:1.60 avida/current/source/main/config.hh:1.61
--- avida/current/source/main/config.hh:1.60	Wed Dec 10 13:56:57 2003
+++ avida/current/source/main/config.hh	Thu Dec 11 14:13:04 2003
@@ -223,6 +223,7 @@
   static int death_method;
   static int alloc_method;
   static int divide_method;
+  static double recomb_prob;
   static int required_task;
   static int lineage_creation_method;
   static int generation_inc_method;
@@ -345,6 +346,7 @@
   static int GetDeathMethod() { return death_method; }
   static int GetAllocMethod() { return alloc_method; }
   static int GetDivideMethod() { return divide_method; }
+  static double GetRecombProb() { return recomb_prob; }
   static int GetRequiredTask() { return required_task; }
   static int GetLineageCreationMethod() { return lineage_creation_method; }
   static int GetGenerationIncMethod() { return generation_inc_method; }






More information about the Avida-cvs mailing list