[Avida-SVN] r1886 - in branches/energy_dev/source: cpu main

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Thu Aug 2 09:17:51 PDT 2007


Author: beckma24
Date: 2007-08-02 12:17:50 -0400 (Thu, 02 Aug 2007)
New Revision: 1886

Modified:
   branches/energy_dev/source/cpu/cHardwareBase.cc
   branches/energy_dev/source/cpu/cHardwareCPU.cc
   branches/energy_dev/source/cpu/cHardwareExperimental.cc
   branches/energy_dev/source/cpu/cHardwareGX.cc
   branches/energy_dev/source/cpu/cHardwareSMT.cc
   branches/energy_dev/source/cpu/cHardwareTransSMT.cc
   branches/energy_dev/source/main/cAvidaConfig.h
   branches/energy_dev/source/main/cMutationRates.cc
   branches/energy_dev/source/main/cMutationRates.h
   branches/energy_dev/source/main/cOrganism.cc
   branches/energy_dev/source/main/cOrganism.h
   branches/energy_dev/source/main/cTaskLib.cc
Log:
Fixed sleeping org. init. bug

Modified: branches/energy_dev/source/cpu/cHardwareBase.cc
===================================================================
--- branches/energy_dev/source/cpu/cHardwareBase.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/cpu/cHardwareBase.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -87,7 +87,7 @@
   const int min_exe_lines = static_cast<int>(parent_size * m_world->GetConfig().MIN_EXE_LINES.Get());
   if (executed_size < min_exe_lines) {
     organism->Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
-          cStringUtil::Stringf("Too few executed lines (%d < %d)", executed_size, min_exe_lines));
+                    cStringUtil::Stringf("Too few executed lines (%d < %d)", executed_size, min_exe_lines));
     return false; // (divide fails)
   }
 	
@@ -95,7 +95,7 @@
   const int min_copied = static_cast<int>(child_size * m_world->GetConfig().MIN_COPIED_LINES.Get());
   if (copied_size < min_copied) {
     organism->Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
-          cStringUtil::Stringf("Too few copied commands (%d < %d)", copied_size, min_copied));
+                    cStringUtil::Stringf("Too few copied commands (%d < %d)", copied_size, min_copied));
     return false; // (divide fails)
   }
   
@@ -132,18 +132,18 @@
 
 
 /*
-  Return the number of mutations that occur on divide.  AWC 06/29/06
-  Limit the number of mutations that occur to be less than or equal to maxmut (defaults to INT_MAX)
-*/
+ Return the number of mutations that occur on divide.  AWC 06/29/06
+ Limit the number of mutations that occur to be less than or equal to maxmut (defaults to INT_MAX)
+ */
 unsigned cHardwareBase::Divide_DoMutations(cAvidaContext& ctx, double mut_multiplier, const int maxmut)
 {
   int totalMutations = 0;
   //cerr << "Maxmut: " << maxmut << endl;
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   cCPUMemory& child_genome = organism->ChildGenome();
   
   organism->GetPhenotype().SetDivType(mut_multiplier);
-
+  
   // @JEB Slip Mutations
   // As if the read head jumped from one random position of the child
   // to another random position and continued reading to the end.
@@ -155,7 +155,7 @@
     cGenome child_copy = cGenome(child_genome);
     int from = ctx.GetRandom().GetInt(child_copy.GetSize());
     int to = ctx.GetRandom().GetInt(child_copy.GetSize());
-
+    
     //Resize child genome
     child_genome.Resize( child_genome.GetSize() + (from-to) );
     for (int i=0; i < child_copy.GetSize() - to; i++) 
@@ -170,12 +170,12 @@
       cout << "Child : " << child_genome.AsString() << endl;
     }
   }
-
+  
   // Divide Mutations
   if (organism->TestDivideMut(ctx) && totalMutations < maxmut) {
     const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize());
     child_genome[mut_line] = m_inst_set->GetRandomInst(ctx);
-    ++cpu_stats.mut_stats.divide_mut_count;
+//    ++cpu_stats.mut_stats.divide_mut_count;
     totalMutations++;
     //cerr << "Mutating HERE!!!! BAD!!!!!" << endl;
   }
@@ -184,7 +184,7 @@
   if (organism->TestDivideIns(ctx) && child_genome.GetSize() < MAX_CREATURE_SIZE && totalMutations < maxmut) {
     const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize() + 1);
     child_genome.Insert(mut_line, m_inst_set->GetRandomInst(ctx));
-    ++cpu_stats.mut_stats.divide_insert_mut_count;
+//    ++cpu_stats.mut_stats.divide_insert_mut_count;
     totalMutations++;
   }
   
@@ -192,7 +192,7 @@
   if (organism->TestDivideDel(ctx) && child_genome.GetSize() > MIN_CREATURE_SIZE && totalMutations < maxmut) {
     const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize());
     child_genome.Remove(mut_line);
-    ++cpu_stats.mut_stats.divide_delete_mut_count;
+//    ++cpu_stats.mut_stats.divide_delete_mut_count;
     totalMutations++;
   }
   
@@ -205,15 +205,14 @@
       for (int i = 0; i < num_mut && totalMutations < maxmut; i++) {
         int site = ctx.GetRandom().GetUInt(child_genome.GetSize());
         child_genome[site] = m_inst_set->GetRandomInst(ctx);
-        ++cpu_stats.mut_stats.div_mut_count;
-	totalMutations++;
-	//cerr << "OK to mutate here " << totalMutations << endl;
+//        ++cpu_stats.mut_stats.div_mut_count;
+        totalMutations++;
       }
     }
   }
   
+
   
-
   // Need to come back and fix tese last two - per site instructions
   // Insert Mutations (per site)
   if (organism->GetInsMutProb() > 0 && totalMutations < maxmut) {
@@ -235,8 +234,8 @@
       // Actually do the mutations (in reverse sort order)
       for (int i = num_mut-1; i >= 0; i--) {
         child_genome.Insert(mut_sites[i], m_inst_set->GetRandomInst(ctx));
-        cpu_stats.mut_stats.insert_mut_count++;
-	totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
+//        cpu_stats.mut_stats.insert_mut_count++;
+        totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
       }
     }
   }
@@ -255,48 +254,82 @@
     for (int i = 0; i < num_mut; i++) {
       int site = ctx.GetRandom().GetUInt(child_genome.GetSize());
       child_genome.Remove(site);
-      cpu_stats.mut_stats.delete_mut_count++;
+//      cpu_stats.mut_stats.delete_mut_count++;
       totalMutations++;
     }
   }
   
+  
+  
+  // Uniform Mutations on Divide
+  if (organism->GetUniformMutProb() > 0 && totalMutations < maxmut) {
+    int num_mut = ctx.GetRandom().GetRandBinomial(child_genome.GetSize(), 
+                                                  organism->GetUniformMutProb() / mut_multiplier);
+    
+    // If we have lines to mutate...
+    if (num_mut > 0 && totalMutations < maxmut) {
+      int mutrange = (m_inst_set->GetSize() * 2) + 1;
+      for (int i = 0; i < num_mut && totalMutations < maxmut; i++) {
+        int mut = ctx.GetRandom().GetUInt(mutrange);
+        
+        if (mut < m_inst_set->GetSize()) { // point
+          int site = ctx.GetRandom().GetUInt(child_genome.GetSize());
+          child_genome[site] = cInstruction(mut);
+        } else if (mut == m_inst_set->GetSize()) { // delete
+          if (child_genome.GetSize() == MIN_CREATURE_SIZE) continue;
+          int site = ctx.GetRandom().GetUInt(child_genome.GetSize());
+          child_genome.Remove(site);
+        } else { // insert
+          if (child_genome.GetSize() == MAX_CREATURE_SIZE) continue;
+          int site = ctx.GetRandom().GetUInt(child_genome.GetSize() + 1);
+          child_genome.Insert(site, cInstruction(mut - m_inst_set->GetSize() - 1));
+        }
+                                               
+        totalMutations++;
+      }
+    }
+  }
+  
+  
+  
+  
   // Mutations in the parent's genome
   if (organism->GetParentMutProb() > 0 && totalMutations < maxmut) {
     for (int i = 0; i < GetMemory().GetSize(); i++) {
       if (organism->TestParentMut(ctx)) {
         GetMemory()[i] = m_inst_set->GetRandomInst(ctx);
-        cpu_stats.mut_stats.parent_mut_line_count++;
-	totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
-
+//        cpu_stats.mut_stats.parent_mut_line_count++;
+        totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
+        
       }
     }
   }
   
   // Count up mutated lines
-  for (int i = 0; i < GetMemory().GetSize(); i++) {
-    if (GetMemory().FlagPointMut(i)) {
-      cpu_stats.mut_stats.point_mut_line_count++;
-    }
-  }
-  for (int i = 0; i < child_genome.GetSize(); i++) {
-    if (child_genome.FlagCopyMut(i)) {
-      cpu_stats.mut_stats.copy_mut_line_count++;
-    }
-  }
-
+//  for (int i = 0; i < GetMemory().GetSize(); i++) {
+//    if (GetMemory().FlagPointMut(i)) {
+//      cpu_stats.mut_stats.point_mut_line_count++;
+//    }
+//  }
+//  for (int i = 0; i < child_genome.GetSize(); i++) {
+//    if (child_genome.FlagCopyMut(i)) {
+//      cpu_stats.mut_stats.copy_mut_line_count++;
+//    }
+//  }
+  
   return totalMutations;
 }
 
 /*
-  Return the number of mutations that occur on divide.  AWC 06/29/06
-  Limit the number of mutations that occur to be less than or equat to maxmut (defaults to INT_MAX)
-*/
+ Return the number of mutations that occur on divide.  AWC 06/29/06
+ Limit the number of mutations that occur to be less than or equat to maxmut (defaults to INT_MAX)
+ */
 unsigned cHardwareBase::Divide_DoExactMutations(cAvidaContext& ctx, double mut_multiplier, const int pointmut)
 {
   int maxmut = pointmut;
   int totalMutations = 0;
   //cerr << "Maxmut: " << maxmut << endl;
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   cCPUMemory& child_genome = organism->ChildGenome();
   
   organism->GetPhenotype().SetDivType(mut_multiplier);
@@ -305,7 +338,7 @@
   if (organism->TestDivideMut(ctx) && totalMutations < maxmut) {
     const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize());
     child_genome[mut_line] = m_inst_set->GetRandomInst(ctx);
-    ++cpu_stats.mut_stats.divide_mut_count;
+//    ++cpu_stats.mut_stats.divide_mut_count;
     totalMutations++;
     //cerr << "Mutating HERE!!!! BAD!!!!!" << endl;
   }
@@ -314,7 +347,7 @@
   if (organism->TestDivideIns(ctx) && child_genome.GetSize() < MAX_CREATURE_SIZE && totalMutations < maxmut) {
     const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize() + 1);
     child_genome.Insert(mut_line, m_inst_set->GetRandomInst(ctx));
-    ++cpu_stats.mut_stats.divide_insert_mut_count;
+//    ++cpu_stats.mut_stats.divide_insert_mut_count;
     totalMutations++;
   }
   
@@ -322,7 +355,7 @@
   if (organism->TestDivideDel(ctx) && child_genome.GetSize() > MIN_CREATURE_SIZE && totalMutations < maxmut) {
     const unsigned int mut_line = ctx.GetRandom().GetUInt(child_genome.GetSize());
     child_genome.Remove(mut_line);
-    ++cpu_stats.mut_stats.divide_delete_mut_count;
+//    ++cpu_stats.mut_stats.divide_delete_mut_count;
     totalMutations++;
   }
   
@@ -336,20 +369,20 @@
       for (int i = 0; i < num_mut && totalMutations < maxmut; i++) {
         int site = ctx.GetRandom().GetUInt(child_genome.GetSize());
         child_genome[site] = m_inst_set->GetRandomInst(ctx);
-        ++cpu_stats.mut_stats.div_mut_count;
-	totalMutations++;
-	//cerr << "OK to mutate here " << totalMutations << endl;
+//        ++cpu_stats.mut_stats.div_mut_count;
+        totalMutations++;
+        //cerr << "OK to mutate here " << totalMutations << endl;
       }
     }
   }
   
   
-
+  
   // Need to come back and fix tese last two - per site instructions
   // Insert Mutations (per site)
   if (organism->GetInsMutProb() > 0 && totalMutations < maxmut) {
     int num_mut = ctx.GetRandom().GetRandBinomial(child_genome.GetSize(),
-						  organism->GetInsMutProb());
+                                                  organism->GetInsMutProb());
     
     // If would make creature to big, insert up to MAX_CREATURE_SIZE
     if (num_mut + child_genome.GetSize() > MAX_CREATURE_SIZE) {
@@ -367,8 +400,8 @@
       // Actually do the mutations (in reverse sort order)
       for (int i = num_mut-1; i >= 0; i--) {
         child_genome.Insert(mut_sites[i], m_inst_set->GetRandomInst(ctx));
-        cpu_stats.mut_stats.insert_mut_count++;
-	totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
+//        cpu_stats.mut_stats.insert_mut_count++;
+        totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
       }
     }
   }
@@ -387,7 +420,7 @@
     for (int i = 0; i < num_mut; i++) {
       int site = ctx.GetRandom().GetUInt(child_genome.GetSize());
       child_genome.Remove(site);
-      cpu_stats.mut_stats.delete_mut_count++;
+//      cpu_stats.mut_stats.delete_mut_count++;
       totalMutations++;
     }
   }
@@ -397,35 +430,35 @@
     for (int i = 0; i < GetMemory().GetSize(); i++) {
       if (organism->TestParentMut(ctx)) {
         GetMemory()[i] = m_inst_set->GetRandomInst(ctx);
-        cpu_stats.mut_stats.parent_mut_line_count++;
-	totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
-
+//        cpu_stats.mut_stats.parent_mut_line_count++;
+        totalMutations++; //Unlike the others we can't be sure this was done only on divide -- AWC 06/29/06
+        
       }
     }
   }
   
   
   // Count up mutated lines
-  for (int i = 0; i < GetMemory().GetSize(); i++) {
-    if (GetMemory().FlagPointMut(i)) {
-      cpu_stats.mut_stats.point_mut_line_count++;
-    }
-  }
-  for (int i = 0; i < child_genome.GetSize(); i++) {
-    if (child_genome.FlagCopyMut(i)) {
-      cpu_stats.mut_stats.copy_mut_line_count++;
-    }
-  }
-
+//  for (int i = 0; i < GetMemory().GetSize(); i++) {
+//    if (GetMemory().FlagPointMut(i)) {
+//      cpu_stats.mut_stats.point_mut_line_count++;
+//    }
+//  }
+//  for (int i = 0; i < child_genome.GetSize(); i++) {
+//    if (child_genome.FlagCopyMut(i)) {
+//      cpu_stats.mut_stats.copy_mut_line_count++;
+//    }
+//  }
+  
   return totalMutations;
 }
 
 
 // test whether the offspring creature contains an advantageous mutation.
 /*
-  Return true iff only a reversion is performed -- returns false is sterilized regardless of whether or 
-  not a reversion is performed.  AWC 06/29/06
-*/
+ Return true iff only a reversion is performed -- returns false is sterilized regardless of whether or 
+ not a reversion is performed.  AWC 06/29/06
+ */
 bool cHardwareBase::Divide_TestFitnessMeasures(cAvidaContext& ctx)
 {
   cPhenotype & phenotype = organism->GetPhenotype();
@@ -443,49 +476,49 @@
 	
   const double parent_fitness = organism->GetTestFitness(ctx);
   const double neut_min = parent_fitness * (1.0 - organism->GetNeutralMin());//nHardware::FITNESS_NEUTRAL_MIN;
-  const double neut_max = parent_fitness * (1.0 + organism->GetNeutralMax());//nHardware::FITNESS_NEUTRAL_MAX;
-  
-  cTestCPU* testcpu = m_world->GetHardwareManager().CreateTestCPU();
-  cCPUTestInfo test_info;
-  test_info.UseRandomInputs();
-  testcpu->TestGenome(ctx, test_info, organism->ChildGenome());
-  const double child_fitness = test_info.GetGenotypeFitness();
-  delete testcpu;
-  
-  bool revert = false;
-  bool sterilize = false;
-  
-  // If implicit mutations are turned off, make sure this won't spawn one.
-  if (organism->GetFailImplicit() == true) {
-    if (test_info.GetMaxDepth() > 0) sterilize = true;
-  }
-
-  if (child_fitness == 0.0) {
-    // Fatal mutation... test for reversion.
-    if (ctx.GetRandom().P(organism->GetRevertFatal())) revert = true;
-    if (ctx.GetRandom().P(organism->GetSterilizeFatal())) sterilize = true;
-  } else if (child_fitness < neut_min) {
-    if (ctx.GetRandom().P(organism->GetRevertNeg())) revert = true;
-    if (ctx.GetRandom().P(organism->GetSterilizeNeg())) sterilize = true;
-  } else if (child_fitness <= neut_max) {
-    if (ctx.GetRandom().P(organism->GetRevertNeut())) revert = true;
-    if (ctx.GetRandom().P(organism->GetSterilizeNeut())) sterilize = true;
-  } else {
-    if (ctx.GetRandom().P(organism->GetRevertPos())) revert = true;
-    if (ctx.GetRandom().P(organism->GetSterilizePos())) sterilize = true;
-  }
-  
-  // Ideally, we won't have reversions and sterilizations turned on at the
-  // same time, but if we do, give revert the priority.
-  if (revert == true) {
-    organism->ChildGenome() = organism->GetGenome();
-  }
-	
-  if (sterilize == true) {
-    organism->GetPhenotype().ChildFertile() = false;
-  }
-
-  return (!sterilize) && revert;
+    const double neut_max = parent_fitness * (1.0 + organism->GetNeutralMax());//nHardware::FITNESS_NEUTRAL_MAX;
+      
+      cTestCPU* testcpu = m_world->GetHardwareManager().CreateTestCPU();
+      cCPUTestInfo test_info;
+      test_info.UseRandomInputs();
+      testcpu->TestGenome(ctx, test_info, organism->ChildGenome());
+      const double child_fitness = test_info.GetGenotypeFitness();
+      delete testcpu;
+      
+      bool revert = false;
+      bool sterilize = false;
+      
+      // If implicit mutations are turned off, make sure this won't spawn one.
+      if (organism->GetFailImplicit() == true) {
+        if (test_info.GetMaxDepth() > 0) sterilize = true;
+      }
+      
+      if (child_fitness == 0.0) {
+        // Fatal mutation... test for reversion.
+        if (ctx.GetRandom().P(organism->GetRevertFatal())) revert = true;
+        if (ctx.GetRandom().P(organism->GetSterilizeFatal())) sterilize = true;
+      } else if (child_fitness < neut_min) {
+        if (ctx.GetRandom().P(organism->GetRevertNeg())) revert = true;
+        if (ctx.GetRandom().P(organism->GetSterilizeNeg())) sterilize = true;
+      } else if (child_fitness <= neut_max) {
+        if (ctx.GetRandom().P(organism->GetRevertNeut())) revert = true;
+        if (ctx.GetRandom().P(organism->GetSterilizeNeut())) sterilize = true;
+      } else {
+        if (ctx.GetRandom().P(organism->GetRevertPos())) revert = true;
+        if (ctx.GetRandom().P(organism->GetSterilizePos())) sterilize = true;
+      }
+      
+      // Ideally, we won't have reversions and sterilizations turned on at the
+      // same time, but if we do, give revert the priority.
+      if (revert == true) {
+        organism->ChildGenome() = organism->GetGenome();
+      }
+      
+      if (sterilize == true) {
+        organism->GetPhenotype().ChildFertile() = false;
+      }
+      
+      return (!sterilize) && revert;
 }
 
 int cHardwareBase::PointMutate(cAvidaContext& ctx, const double mut_rate)
@@ -498,7 +531,7 @@
     memory[pos] = m_inst_set->GetRandomInst(ctx);
     memory.SetFlagMutated(pos);
     memory.SetFlagPointMut(pos);
-    organism->CPUStats().mut_stats.point_mut_count++;
+//    organism->CPUStats().mut_stats.point_mut_count++;
   }
   
   return num_muts;
@@ -632,7 +665,7 @@
 					has_mutation = true;
 					mut_info.IncCount(mut_id, num_muts);
 				}
-        break;
+          break;
     }
   }
 	
@@ -708,7 +741,7 @@
 void cHardwareBase::CheckImplicitRepro(cAvidaContext& ctx)         
 {  
   if( (m_world->GetConfig().IMPLICIT_REPRO_TIME.Get() && (organism->GetPhenotype().GetCPUCyclesUsed() >= m_world->GetConfig().IMPLICIT_REPRO_TIME.Get()))
-   || (m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get() && (organism->GetPhenotype().GetCurBonus() >= m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get())) )
+      || (m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get() && (organism->GetPhenotype().GetCurBonus() >= m_world->GetConfig().IMPLICIT_REPRO_BONUS.Get())) )
   {
     Inst_Repro(ctx);
   }

Modified: branches/energy_dev/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/energy_dev/source/cpu/cHardwareCPU.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/cpu/cHardwareCPU.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -2240,14 +2240,14 @@
 
   const cHeadCPU from(this, GetRegister(op1));
   cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   
   if (organism->TestCopyMut(ctx)) {
     to.SetInst(m_inst_set->GetRandomInst(ctx));
     to.SetFlagMutated();  // Mark this instruction as mutated...
     to.SetFlagCopyMut();  // Mark this instruction as copy mut...
                               //organism->GetPhenotype().IsMutated() = true;
-    cpu_stats.mut_stats.copy_mut_count++;
+//    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(from.GetInst());
     to.ClearFlagMutated();  // UnMark
@@ -2255,7 +2255,7 @@
   }
   
   to.SetFlagCopied();  // Set the copied flag.
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -2280,7 +2280,7 @@
 
   cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
   const int value = Mod(GetRegister(src), m_inst_set->GetSize());
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
 
   // Change value on a mutation...
   if (organism->TestCopyMut(ctx)) {
@@ -2288,7 +2288,7 @@
     to.SetFlagMutated();      // Mark this instruction as mutated...
     to.SetFlagCopyMut();      // Mark this instruction as copy mut...
                                   //organism->GetPhenotype().IsMutated() = true;
-    cpu_stats.mut_stats.copy_mut_count++;
+//    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(cInstruction(value));
     to.ClearFlagMutated();     // UnMark
@@ -2296,7 +2296,7 @@
   }
 
   to.SetFlagCopied();  // Set the copied flag.
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -2314,7 +2314,7 @@
   const int op1 = REG_AX;
   cHeadCPU to(this, GetRegister(op1) + GetRegister(dst));
   const int value = Mod(StackPop(), m_inst_set->GetSize());
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   
   // Change value on a mutation...
   if (organism->TestCopyMut(ctx)) {
@@ -2322,7 +2322,7 @@
     to.SetFlagMutated();      // Mark this instruction as mutated...
     to.SetFlagCopyMut();      // Mark this instruction as copy mut...
                                   //organism->GetPhenotype().IsMutated() = true;
-    cpu_stats.mut_stats.copy_mut_count++;
+//    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(cInstruction(value));
     to.ClearFlagMutated();     // UnMark
@@ -2330,7 +2330,7 @@
   }
   
   to.SetFlagCopied();  // Set the copied flag.
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -3933,20 +3933,20 @@
   
   const int head_id = FindModifiedHead(nHardware::HEAD_READ);
   GetHead(head_id).Adjust();
-  sCPUStats & cpu_stats = organism->CPUStats();
+//  sCPUStats & cpu_stats = organism->CPUStats();
   
   // Mutations only occur on the read, for the moment.
   int read_inst = 0;
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx).GetOp();
-    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
+//    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
   } else {
     read_inst = GetHead(head_id).GetInst().GetOp();
   }
   GetRegister(dst) = read_inst;
   ReadInst(read_inst);
   
-  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
+//  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
   GetHead(head_id).Advance();
   return true;
 }
@@ -3975,7 +3975,7 @@
   // For the moment, this cannot be nop-modified.
   cHeadCPU& read_head = GetHead(nHardware::HEAD_READ);
   cHeadCPU& write_head = GetHead(nHardware::HEAD_WRITE);
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   
   read_head.Adjust();
   write_head.Adjust();
@@ -3985,12 +3985,12 @@
   ReadInst(read_inst.GetOp());
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx);
-    cpu_stats.mut_stats.copy_mut_count++; 
+//    cpu_stats.mut_stats.copy_mut_count++; 
     write_head.SetFlagMutated();
     write_head.SetFlagCopyMut();
   }
   
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   
   write_head.SetInst(read_inst);
   write_head.SetFlagCopied();  // Set the copied flag...
@@ -4005,7 +4005,7 @@
   // For the moment, this cannot be nop-modified.
   cHeadCPU & read_head = GetHead(nHardware::HEAD_READ);
   cHeadCPU & write_head = GetHead(nHardware::HEAD_WRITE);
-  sCPUStats & cpu_stats = organism->CPUStats();
+//  sCPUStats & cpu_stats = organism->CPUStats();
   
   read_head.Adjust();
   write_head.Adjust();
@@ -4015,13 +4015,13 @@
   ReadInst(read_inst.GetOp());
   if ( ctx.GetRandom().P(organism->GetCopyMutProb() / reduction) ) {
     read_inst = m_inst_set->GetRandomInst(ctx);
-    cpu_stats.mut_stats.copy_mut_count++; 
+//    cpu_stats.mut_stats.copy_mut_count++; 
     write_head.SetFlagMutated();
     write_head.SetFlagCopyMut();
     //organism->GetPhenotype().IsMutated() = true;
   }
   
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   
   write_head.SetInst(read_inst);
   write_head.SetFlagCopied();  // Set the copied flag...

Modified: branches/energy_dev/source/cpu/cHardwareExperimental.cc
===================================================================
--- branches/energy_dev/source/cpu/cHardwareExperimental.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/cpu/cHardwareExperimental.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -1103,20 +1103,20 @@
   
   const int head_id = FindModifiedHead(nHardware::HEAD_READ);
   GetHead(head_id).Adjust();
-  sCPUStats & cpu_stats = organism->CPUStats();
+//  sCPUStats & cpu_stats = organism->CPUStats();
   
   // Mutations only occur on the read, for the moment.
   int read_inst = 0;
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx).GetOp();
-    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
+//    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
   } else {
     read_inst = GetHead(head_id).GetInst().GetOp();
   }
   GetRegister(dst) = read_inst;
   ReadInst(read_inst);
   
-  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
+//  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
   GetHead(head_id).Advance();
   return true;
 }
@@ -1145,7 +1145,7 @@
   // For the moment, this cannot be nop-modified.
   cHeadCPU& read_head = GetHead(nHardware::HEAD_READ);
   cHeadCPU& write_head = GetHead(nHardware::HEAD_WRITE);
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   
   read_head.Adjust();
   write_head.Adjust();
@@ -1155,12 +1155,12 @@
   ReadInst(read_inst.GetOp());
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx);
-    cpu_stats.mut_stats.copy_mut_count++; 
+//    cpu_stats.mut_stats.copy_mut_count++; 
     write_head.SetFlagMutated();
     write_head.SetFlagCopyMut();
   }
   
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   
   write_head.SetInst(read_inst);
   write_head.SetFlagCopied();  // Set the copied flag...

Modified: branches/energy_dev/source/cpu/cHardwareGX.cc
===================================================================
--- branches/energy_dev/source/cpu/cHardwareGX.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/cpu/cHardwareGX.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -1931,14 +1931,14 @@
 
   const cHeadCPU from(this, GetRegister(op1));
   cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   
   if (organism->TestCopyMut(ctx)) {
     to.SetInst(m_inst_set->GetRandomInst(ctx));
     to.SetFlagMutated();  // Mark this instruction as mutated...
     to.SetFlagCopyMut();  // Mark this instruction as copy mut...
                               //organism->GetPhenotype().IsMutated() = true;
-    cpu_stats.mut_stats.copy_mut_count++;
+//    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(from.GetInst());
     to.ClearFlagMutated();  // UnMark
@@ -1946,7 +1946,7 @@
   }
   
   to.SetFlagCopied();  // Set the copied flag.
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -1971,7 +1971,7 @@
 
   cHeadCPU to(this, GetRegister(op2) + GetRegister(op1));
   const int value = Mod(GetRegister(src), m_inst_set->GetSize());
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
 
   // Change value on a mutation...
   if (organism->TestCopyMut(ctx)) {
@@ -1979,7 +1979,7 @@
     to.SetFlagMutated();      // Mark this instruction as mutated...
     to.SetFlagCopyMut();      // Mark this instruction as copy mut...
                                   //organism->GetPhenotype().IsMutated() = true;
-    cpu_stats.mut_stats.copy_mut_count++;
+//    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(cInstruction(value));
     to.ClearFlagMutated();     // UnMark
@@ -1987,7 +1987,7 @@
   }
 
   to.SetFlagCopied();  // Set the copied flag.
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -2005,7 +2005,7 @@
   const int op1 = REG_AX;
   cHeadCPU to(this, GetRegister(op1) + GetRegister(dst));
   const int value = Mod(StackPop(), m_inst_set->GetSize());
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   
   // Change value on a mutation...
   if (organism->TestCopyMut(ctx)) {
@@ -2013,7 +2013,7 @@
     to.SetFlagMutated();      // Mark this instruction as mutated...
     to.SetFlagCopyMut();      // Mark this instruction as copy mut...
                                   //organism->GetPhenotype().IsMutated() = true;
-    cpu_stats.mut_stats.copy_mut_count++;
+//    cpu_stats.mut_stats.copy_mut_count++;
   } else {
     to.SetInst(cInstruction(value));
     to.ClearFlagMutated();     // UnMark
@@ -2021,7 +2021,7 @@
   }
   
   to.SetFlagCopied();  // Set the copied flag.
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   return true;
 }
 
@@ -3195,7 +3195,7 @@
   
   const int head_id = FindModifiedHead(nHardware::HEAD_READ);
   GetHead(head_id).Adjust();
-  sCPUStats & cpu_stats = organism->CPUStats();
+//  sCPUStats & cpu_stats = organism->CPUStats();
   
     // <--- GX addition
   if ( !m_programids[GetHead(head_id).GetMemSpace()]->GetReadable() ) return false;
@@ -3205,14 +3205,14 @@
   int read_inst = 0;
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx).GetOp();
-    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
+//    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
   } else {
     read_inst = GetHead(head_id).GetInst().GetOp();
   }
   GetRegister(dst) = read_inst;
   ReadInst(read_inst);
   
-  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
+//  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
   GetHead(head_id).Advance();
   return true;
 }
@@ -3245,7 +3245,7 @@
   // For the moment, this cannot be nop-modified.
   cHeadCPU& read_head = GetHead(nHardware::HEAD_READ);
   cHeadCPU& write_head = GetHead(nHardware::HEAD_WRITE);
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
   
   read_head.Adjust();
   write_head.Adjust();
@@ -3255,12 +3255,12 @@
   ReadInst(read_inst.GetOp());
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx);
-    cpu_stats.mut_stats.copy_mut_count++; 
+//    cpu_stats.mut_stats.copy_mut_count++; 
     write_head.SetFlagMutated();
     write_head.SetFlagCopyMut();
   }
   
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   
   write_head.SetInst(read_inst);
   write_head.SetFlagCopied();  // Set the copied flag...
@@ -3275,7 +3275,7 @@
   // For the moment, this cannot be nop-modified.
   cHeadCPU & read_head = GetHead(nHardware::HEAD_READ);
   cHeadCPU & write_head = GetHead(nHardware::HEAD_WRITE);
-  sCPUStats & cpu_stats = organism->CPUStats();
+//  sCPUStats & cpu_stats = organism->CPUStats();
   
   read_head.Adjust();
   write_head.Adjust();
@@ -3285,13 +3285,13 @@
   ReadInst(read_inst.GetOp());
   if ( ctx.GetRandom().P(organism->GetCopyMutProb() / reduction) ) {
     read_inst = m_inst_set->GetRandomInst(ctx);
-    cpu_stats.mut_stats.copy_mut_count++; 
+//    cpu_stats.mut_stats.copy_mut_count++; 
     write_head.SetFlagMutated();
     write_head.SetFlagCopyMut();
     //organism->GetPhenotype().IsMutated() = true;
   }
   
-  cpu_stats.mut_stats.copies_exec++;
+//  cpu_stats.mut_stats.copies_exec++;
   
   write_head.SetInst(read_inst);
   write_head.SetFlagCopied();  // Set the copied flag...

Modified: branches/energy_dev/source/cpu/cHardwareSMT.cc
===================================================================
--- branches/energy_dev/source/cpu/cHardwareSMT.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/cpu/cHardwareSMT.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -1285,20 +1285,20 @@
 #endif
   
   GetHead(head_id).Adjust();
-  sCPUStats& cpu_stats = organism->CPUStats();
+//  sCPUStats& cpu_stats = organism->CPUStats();
 	
   // Mutations only occur on the read, for the moment.
   int read_inst = 0;
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx).GetOp();
-    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
+//    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
   } else {
     read_inst = GetHead(head_id).GetInst().GetOp();
   }
   Stack(dst).Push(read_inst);
   ReadInst(read_inst);
 	
-  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
+//  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
   GetHead(head_id).Advance();
   return true;
 }

Modified: branches/energy_dev/source/cpu/cHardwareTransSMT.cc
===================================================================
--- branches/energy_dev/source/cpu/cHardwareTransSMT.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/cpu/cHardwareTransSMT.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -1190,20 +1190,20 @@
 #endif
   
   GetHead(head_id).Adjust();
-  sCPUStats & cpu_stats = organism->CPUStats();
+//  sCPUStats & cpu_stats = organism->CPUStats();
 	
   // Mutations only occur on the read, for the moment.
   int read_inst = 0;
   if (organism->TestCopyMut(ctx)) {
     read_inst = m_inst_set->GetRandomInst(ctx).GetOp();
-    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
+//    cpu_stats.mut_stats.copy_mut_count++;  // @CAO, hope this is good!
   } else {
     read_inst = GetHead(head_id).GetInst().GetOp();
   }
   Stack(dst).Push(read_inst);
   ReadInst(read_inst);
 	
-  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
+//  cpu_stats.mut_stats.copies_exec++;  // @CAO, this too..
   GetHead(head_id).Advance();
   return true;
 }

Modified: branches/energy_dev/source/main/cAvidaConfig.h
===================================================================
--- branches/energy_dev/source/main/cAvidaConfig.h	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/main/cAvidaConfig.h	2007-08-02 16:17:50 UTC (rev 1886)
@@ -254,6 +254,7 @@
   CONFIG_ADD_VAR(INS_MUT_PROB, double, 0.0, "Insertion rate (per site, applied on divide)");
   CONFIG_ADD_VAR(DEL_MUT_PROB, double, 0.0, "Deletion rate (per site, applied on divide)");
   CONFIG_ADD_VAR(DIV_MUT_PROB, double, 0.0, "Mutation rate (per site, applied on divide)");
+  CONFIG_ADD_VAR(UNIFORM_MUT_PROB, double, 0.0, "Uniform mutation probability (per site, applied on divide)\n- Randomly applies any of the three classes of mutations (ins, del, point).");
   CONFIG_ADD_VAR(DIVIDE_MUT_PROB, double, 0.0, "Mutation rate (per divide)");
   CONFIG_ADD_VAR(DIVIDE_INS_PROB, double, 0.05, "Insertion rate (per divide)");
   CONFIG_ADD_VAR(DIVIDE_DEL_PROB, double, 0.05, "Deletion rate (per divide)");

Modified: branches/energy_dev/source/main/cMutationRates.cc
===================================================================
--- branches/energy_dev/source/main/cMutationRates.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/main/cMutationRates.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -36,6 +36,7 @@
   divide.ins_prob = world->GetConfig().INS_MUT_PROB.Get();
   divide.del_prob = world->GetConfig().DEL_MUT_PROB.Get();
   divide.mut_prob = world->GetConfig().DIV_MUT_PROB.Get();
+  divide.uniform_prob = world->GetConfig().UNIFORM_MUT_PROB.Get();
   divide.divide_mut_prob = world->GetConfig().DIVIDE_MUT_PROB.Get();
   divide.divide_ins_prob = world->GetConfig().DIVIDE_INS_PROB.Get();
   divide.divide_del_prob = world->GetConfig().DIVIDE_DEL_PROB.Get();
@@ -55,6 +56,7 @@
   divide.ins_prob = 0.0;
   divide.del_prob = 0.0;
   divide.mut_prob = 0.0;
+  divide.uniform_prob = 0.0;
   divide.divide_mut_prob = 0.0;
   divide.divide_ins_prob = 0.0;
   divide.divide_del_prob = 0.0;
@@ -74,6 +76,7 @@
   divide.ins_prob = in_muts.divide.ins_prob;
   divide.del_prob = in_muts.divide.del_prob;
   divide.mut_prob = in_muts.divide.mut_prob;
+  divide.uniform_prob = in_muts.divide.uniform_prob;
   divide.divide_mut_prob = in_muts.divide.divide_mut_prob;
   divide.divide_ins_prob = in_muts.divide.divide_ins_prob;
   divide.divide_del_prob = in_muts.divide.divide_del_prob;

Modified: branches/energy_dev/source/main/cMutationRates.h
===================================================================
--- branches/energy_dev/source/main/cMutationRates.h	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/main/cMutationRates.h	2007-08-02 16:17:50 UTC (rev 1886)
@@ -57,6 +57,7 @@
     double ins_prob;        // Per site
     double del_prob;        // Per site
     double mut_prob;        // Per site
+    double uniform_prob;
     double divide_mut_prob;     // Max one per divide
     double divide_ins_prob;     // Max one per divide
     double divide_del_prob;     // Max one per divide
@@ -116,6 +117,7 @@
   double GetInsMutProb() const       { return divide.ins_prob; }
   double GetDelMutProb() const       { return divide.del_prob; }
   double GetDivMutProb() const       { return divide.mut_prob; }
+  double GetUniformMutProb() const   { return divide.uniform_prob; }
   double GetDivideMutProb() const    { return divide.divide_mut_prob; }
   double GetDivideInsProb() const    { return divide.divide_ins_prob; }
   double GetDivideDelProb() const    { return divide.divide_del_prob; }
@@ -131,6 +133,7 @@
   void SetInsMutProb(double in_prob)    { divide.ins_prob        = in_prob; }
   void SetDelMutProb(double in_prob)    { divide.del_prob        = in_prob; }
   void SetDivMutProb(double in_prob)    { divide.mut_prob        = in_prob; }
+  void SetUniformMutProb(double in_prob){ divide.uniform_prob    = in_prob; }
   void SetDivideMutProb(double in_prob) { divide.divide_mut_prob = in_prob; }
   void SetDivideInsProb(double in_prob) { divide.divide_ins_prob = in_prob; }
   void SetDivideDelProb(double in_prob) { divide.divide_del_prob = in_prob; }

Modified: branches/energy_dev/source/main/cOrganism.cc
===================================================================
--- branches/energy_dev/source/main/cOrganism.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/main/cOrganism.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -68,11 +68,12 @@
   , m_test_receive_pos(0)
   , m_max_executed(-1)
   , m_is_running(false)
+  , m_is_sleeping(false)
   , m_net(NULL)
 {
   // Initialization of structures...
   m_hardware = m_world->GetHardwareManager().Create(this);
-  m_cpu_stats.Setup();
+//  m_cpu_stats.Setup();
 
   if (m_world->GetConfig().DEATH_METHOD.Get() > DEATH_METHOD_OFF) {
     m_max_executed = m_world->GetConfig().AGE_LIMIT.Get();

Modified: branches/energy_dev/source/main/cOrganism.h
===================================================================
--- branches/energy_dev/source/main/cOrganism.h	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/main/cOrganism.h	2007-08-02 16:17:50 UTC (rev 1886)
@@ -31,9 +31,9 @@
 #ifndef cCPUMemory_h
 #include "cCPUMemory.h"
 #endif
-#ifndef sCPUStats_h
-#include "sCPUStats.h"
-#endif
+//#ifndef sCPUStats_h
+//#include "sCPUStats.h"
+//#endif
 #ifndef cGenome_h
 #include "cGenome.h"
 #endif
@@ -99,7 +99,7 @@
  
 	// Other stats
   cCPUMemory m_child_genome; // Child genome, while under construction.
-  sCPUStats m_cpu_stats;     // Info for statistics
+//  sCPUStats m_cpu_stats;     // Info for statistics
 
   // Input and Output with the environment
   int m_input_pointer;
@@ -169,7 +169,7 @@
   int GetMaxExecuted() const { return m_max_executed; }
   
   cCPUMemory& ChildGenome() { return m_child_genome; }
-  sCPUStats& CPUStats() { return m_cpu_stats; }
+//  sCPUStats& CPUStats() { return m_cpu_stats; }
 
   void SetRunning(bool in_running) { m_is_running = in_running; }
   bool IsRunning() { return m_is_running; }
@@ -266,6 +266,7 @@
   double GetInsMutProb() const { return m_mut_rates.GetInsMutProb(); }
   double GetDelMutProb() const { return m_mut_rates.GetDelMutProb(); }
   double GetDivMutProb() const { return m_mut_rates.GetDivMutProb(); }
+  double GetUniformMutProb() const { return m_mut_rates.GetUniformMutProb(); }
   double GetParentMutProb() const { return m_mut_rates.GetParentMutProb();}
 
   double GetInjectInsProb() const { return m_mut_rates.GetInjectInsProb(); }

Modified: branches/energy_dev/source/main/cTaskLib.cc
===================================================================
--- branches/energy_dev/source/main/cTaskLib.cc	2007-08-02 13:57:12 UTC (rev 1885)
+++ branches/energy_dev/source/main/cTaskLib.cc	2007-08-02 16:17:50 UTC (rev 1886)
@@ -2137,7 +2137,7 @@
   {
     if (args->GetInt(1))
     {
-      envreqs.SetMinOutputs(args->GetInt(2)*2);
+      envreqs.SetMinOutputs(args->GetInt(2)*args->GetInt(3));
     }
     else 
     {
@@ -2147,10 +2147,15 @@
       {
       case 1:
         envreqs.SetMinOutputs(1);
+		break;
       case 2:
         envreqs.SetMinOutputs(2);
+		break;
       case 3:
         envreqs.SetMinOutputs(2);
+		break;
+	  default:
+		  envreqs.SetMinOutputs(2);
       };
     }
 
@@ -2163,6 +2168,7 @@
   // if the org hasn't output yet enough numbers, just return without completing any tasks
   if (ctx.GetOutputBuffer().GetNumStored() < ctx.GetOutputBuffer().GetCapacity()) return 0;
 
+
   double quality = 0.0;
   const cArgContainer& args = ctx.GetTaskEntry()->GetArguments();
 
@@ -2196,6 +2202,7 @@
 	}
 	for (int i=0; i<args.GetInt(3); i++)
 		vars[i] = tempVars[i] / tot;
+	//	cout << "x: " << vars[0] << " ";
   } 
   else 
   {
@@ -2214,7 +2221,8 @@
   switch(function) {
     case 1:
 	  Fx = vars[0];		// F1
-      break;
+	  //	  cout << "Fx1: " << Fx << " ";
+	  break;
 
     case 2:
       Fx = (1.0 + vars[1]) * (1.0 - sqrt(vars[0] / (1.0 + vars[1])));   // F2
@@ -2251,9 +2259,11 @@
     case 9:
     {
       double sum = 0;
+      //      cout << "9x: " << vars[0] << " ";
       for (int i=1; i<5; i++)
 	sum += vars[i]/4.0;
-      Fx = (1.0 + 9*sum) * (1.0 - sqrt(vars[0] / (1.0 + 9*sum)));
+      double Gx = 1+9*sum;
+      Fx = Gx * (1.0 - sqrt(vars[0]/Gx));
       break;
     }
 
@@ -2262,10 +2272,21 @@
       double sum = 0;
       for (int i=1; i<5; i++)
 	sum += vars[i]/4.0;
-      Fx = (1.0 + sum) * (1.0 - pow(vars[0] / (1.0 + sum), 2.0));
+      double Gx = 1+9*sum;
+      Fx = Gx * (1.0 - pow(vars[0]/Gx, 2.0));
       break;
     }
 
+    case 11:
+    {
+      double sum = 0;
+      for (int i=1; i<5; i++)
+	sum += vars[i]/4.0;
+      double Gx = 1+9*sum;
+      Fx = Gx * (1 - sqrt(vars[0]/Gx) - (vars[0]/Gx)*(sin(3.14159*vars[0]*10)));
+      break;
+    }
+
     default:
       quality = .001;
   }




More information about the Avida-cvs mailing list