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

barrick at myxo.css.msu.edu barrick at myxo.css.msu.edu
Sat Jun 30 05:55:57 PDT 2007


Author: barrick
Date: 2007-06-30 08:55:57 -0400 (Sat, 30 Jun 2007)
New Revision: 1736

Modified:
   development/source/cpu/cHardwareBase.cc
   development/source/cpu/cHardwareBase.h
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareExperimental.cc
   development/source/cpu/cHardwareGX.cc
   development/source/cpu/cHardwareGX.h
   development/source/cpu/cHardwareSMT.cc
   development/source/cpu/cHardwareTransSMT.cc
   development/source/main/cAvidaConfig.h
   development/source/main/cOrganism.cc
   development/support/config/avida.cfg
Log:
Added/modified configuration options so that Inst_Repro can be triggered after a certain number of CPU cycles have been completed by an organism or after an organism has accumulated a certain bonus. These options will work in all hardware types that have Inst_Repro implemented. Also fixed the default behavior of an implicit GX setting.



Modified: development/source/cpu/cHardwareBase.cc
===================================================================
--- development/source/cpu/cHardwareBase.cc	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareBase.cc	2007-06-30 12:55:57 UTC (rev 1736)
@@ -700,3 +700,21 @@
 {
   return true;
 }
+
+// @JEB Check implicit repro conditions -- meant to be called at the end of SingleProcess
+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())) )
+  {
+    Inst_Repro(ctx);
+  }
+}
+
+//This must be overridden by the specific CPU to function properly
+bool cHardwareBase::Inst_Repro(cAvidaContext& ctx) 
+{
+  cout << "This hardware type does not have a =repro= instruction. IMPLICIT_REPRO conditions cannot be used!" << endl;
+  assert(1);
+  return false;
+}

Modified: development/source/cpu/cHardwareBase.h
===================================================================
--- development/source/cpu/cHardwareBase.h	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareBase.h	2007-06-30 12:55:57 UTC (rev 1736)
@@ -167,6 +167,10 @@
 protected:
   // --------  No-Operation Instruction --------
   bool Inst_Nop(cAvidaContext& ctx);  // A no-operation instruction that does nothing! 
+  
+  // -------- Implicit Repro Check/Instruction -------- @JEB
+  void CheckImplicitRepro(cAvidaContext& ctx);
+  virtual bool Inst_Repro(cAvidaContext& ctx);
 };
 
 

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareCPU.cc	2007-06-30 12:55:57 UTC (rev 1736)
@@ -573,6 +573,7 @@
   }
   
   organism->SetRunning(false);
+  CheckImplicitRepro(ctx);
 }
 
 
@@ -2553,12 +2554,6 @@
   child_genome = GetMemory();
   organism->GetPhenotype().SetLinesCopied(GetMemory().GetSize());
 
-  // @JEB - Make sure that an organism has accumulated any required bonus
-  const int bonus_required = m_world->GetConfig().REQUIRED_BONUS.Get();
-  if (organism->GetPhenotype().GetCurBonus() < bonus_required) {
-    return false; //  (divide fails)
-  }
-  
   int lines_executed = 0;
   for ( int i = 0; i < GetMemory().GetSize(); i++ ) {
     if ( GetMemory().FlagExecuted(i)) lines_executed++;

Modified: development/source/cpu/cHardwareExperimental.cc
===================================================================
--- development/source/cpu/cHardwareExperimental.cc	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareExperimental.cc	2007-06-30 12:55:57 UTC (rev 1736)
@@ -307,6 +307,7 @@
   }
   
   organism->SetRunning(false);
+  CheckImplicitRepro(ctx);
 }
 
 

Modified: development/source/cpu/cHardwareGX.cc
===================================================================
--- development/source/cpu/cHardwareGX.cc	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareGX.cc	2007-06-30 12:55:57 UTC (rev 1736)
@@ -271,7 +271,8 @@
 
     tInstLibEntry<tMethod>("promoter", &cHardwareGX::Inst_Promoter),
     tInstLibEntry<tMethod>("terminator", &cHardwareGX::Inst_Terminator),
-    tInstLibEntry<tMethod>("regulate", &cHardwareGX::Inst_HeadRegulate),
+    tInstLibEntry<tMethod>("h-repress", &cHardwareGX::Inst_HeadRepress),
+    tInstLibEntry<tMethod>("h-activate", &cHardwareGX::Inst_HeadActivate),
     tInstLibEntry<tMethod>("end", &cHardwareGX::Inst_EndProgramidExecution),
 
     // These are dummy instructions used for making mutiple programids
@@ -374,21 +375,24 @@
     AddProgramid(p);
   
     // Initialize the promoter state and rates
-    m_promoter_sum = 0.0; // We need to make sure that at least one position has a non-zero rate 
     m_promoter_update_head.Reset(this,0);
     m_promoter_update_head.Set(0);
-    m_promoter_rates.ResizeClear( organism->GetGenome().GetSize() );
+    m_promoter_default_rates.ResizeClear( organism->GetGenome().GetSize() );
+    m_promoter_rates.ResizeClear( organism->GetGenome().GetSize() ); // Initialized in UpdatePromoterRates()
     m_promoter_states.ResizeClear( organism->GetGenome().GetSize() );
+    m_promoter_occupied_sites.ResizeClear( organism->GetGenome().GetSize() );
     
     cInstruction promoter_inst = GetInstSet().GetInst(cStringUtil::Stringf("promoter"));
     do {
-      m_promoter_rates[m_promoter_update_head.GetPosition()] = 
+      m_promoter_default_rates[m_promoter_update_head.GetPosition()] = 
         (m_promoter_update_head.GetInst() == promoter_inst) ? 1 : m_world->GetConfig().IMPLICIT_BG_PROMOTER_RATE.Get();
-      m_promoter_sum += m_promoter_rates[m_promoter_update_head.GetPosition()];
       m_promoter_states[m_promoter_update_head.GetPosition()] = 0.0;
+      m_promoter_occupied_sites[m_promoter_update_head.GetPosition()] = 0;
       m_promoter_update_head++;
     } while (m_promoter_update_head.GetPosition() != 0);
     
+    AdjustPromoterRates();
+    
     // \todo implement different initial conditions for created executable programids
     ProcessImplicitGeneExpression(); 
   }
@@ -476,7 +480,7 @@
   // Now kill old programids.
   unsigned int on_p = 0;
   while(on_p < m_programids.size()) {
-    if( (m_programids[on_p]->GetCPUCyclesUsed() > m_world->GetConfig().MAX_PROGRAMID_AGE.Get())
+    if(  ((m_world->GetConfig().MAX_PROGRAMID_AGE.Get() > 0) && (m_programids[on_p]->GetCPUCyclesUsed() > m_world->GetConfig().MAX_PROGRAMID_AGE.Get()) )
       || m_programids[on_p]->m_marked_for_death) {
       RemoveProgramid(on_p);
     } else {
@@ -502,12 +506,7 @@
   }
   
   organism->SetRunning(false);
-  
-  //Implicit Divide (for organisms that divide every so often with repro)
-  if (m_world->GetConfig().IMPLICIT_REPRO_TIME.Get() && (phenotype.GetCPUCyclesUsed() >= m_world->GetConfig().IMPLICIT_REPRO_TIME.Get()))
-  {
-    Inst_Repro(ctx);
-  }
+  CheckImplicitRepro(ctx);
 }
 
 //  const int num_threads = GetNumThreads();
@@ -1242,16 +1241,16 @@
 
 int cHardwareGX::GetCopiedSize(const int parent_size, const int child_size)
 {
-  if (m_world->GetConfig().IMPLICIT_REPRO_TIME.Get()) return parent_size;
+  return parent_size;
 
-  int copied_size = 0;
-  //@JEB - we care about how much has been copied by the current programid
-  // parent_size and child_size are not relevant!
-  const cCPUMemory& memory = m_programids[GetHead(nHardware::HEAD_WRITE).GetMemSpace()]->GetMemory();
-  for (int i = 0; i < memory.GetSize(); i++) {
-    if (memory.FlagCopied(i)) copied_size++;
-  }
-  return copied_size;
+  //@JEB - this is used in a division test. Not clear how to translate to GX for now.
+
+  //int copied_size = 0;
+  //const cCPUMemory& memory = m_programids[GetHead(nHardware::HEAD_WRITE).GetMemSpace()]->GetMemory();
+  //for (int i = 0; i < memory.GetSize(); i++) {
+  //  if (memory.FlagCopied(i)) copied_size++;
+  //}
+  //return copied_size;
 }  
 
 
@@ -2118,7 +2117,7 @@
   // Setup child
   cCPUMemory& child_genome = organism->ChildGenome();
   child_genome = organism->GetGenome();
-  organism->GetPhenotype().SetLinesCopied(GetMemory().GetSize());
+  organism->GetPhenotype().SetLinesCopied(organism->GetGenome().GetSize());
   
   Divide_DoMutations(ctx);
     
@@ -3992,14 +3991,95 @@
 
 /*
 Place the write head of this programid on the next available match
-in the genome. Update promoter rates.
+in the genome. Upgrade to promoter rate at the final position of the label.
 */
-bool cHardwareGX::Inst_HeadRegulate(cAvidaContext& ctx)
+bool cHardwareGX::Inst_HeadActivate(cAvidaContext& ctx)
 {
+  // Remove current regulation first
+  m_current->RemoveRegulation();
+
+  // Find next best match.
+  ReadLabel();
+
+  int match_pos = FindRegulatoryMatch( GetLabel() );
+  if (match_pos == -1) return false;
+
+  GetHead(nHardware::HEAD_WRITE).Set(match_pos, 0); // Used to track regulation
+  GetHead(nHardware::HEAD_FLOW).Set(match_pos+GetLabel().GetSize(), 0); // Used to track regulation
+
+  int regulatory_footprint = 5;  // Positions ahead and behind label that it covers
+  match_pos = (match_pos - regulatory_footprint + m_programids[0]->GetMemory().GetSize() ) %  m_programids[0]->GetMemory().GetSize();
+  
+  cHeadProgramid h(this);
+  h.Set(match_pos, 0);
+  for (int i=0; i < 2*regulatory_footprint + GetLabel().GetSize(); i++)
+  {
+    m_promoter_occupied_sites[h.GetPosition()] = -1; // Repress overlap    
+    // Except where we create a new promoter that starts expression right after the matched label
+    if (i == regulatory_footprint + GetLabel().GetSize() - 1)
+    {
+          m_promoter_occupied_sites[h.GetPosition()] = +1;
+    }
+    
+    h++;    
+  }
+  
+  AdjustPromoterRates();
+  
+  if (m_world->GetVerbosity() >= VERBOSE_DETAILS) 
+	{
+    cout << "Activate: position " << match_pos << " length " << 2*regulatory_footprint + GetLabel().GetSize() << endl;
+    for (int i=0; i < m_programids[0]->GetMemory().GetSize(); i++)
+    {
+      cout << i << " " << m_promoter_rates[i] << " " << m_promoter_default_rates[i] << " " << m_promoter_occupied_sites[i] << endl;
+    }
+  }
   return true;
 }
 
+/*
+Place the write head of this programid on the next available match
+in the genome. Downgrade promoter rates to background for 5 instructions on each side.
+*/
+bool cHardwareGX::Inst_HeadRepress(cAvidaContext& ctx)
+{
+  // Remove current regulation first
+  m_current->RemoveRegulation();
 
+  // Find next best match.
+  ReadLabel();
+
+  int match_pos = FindRegulatoryMatch( GetLabel() );
+  if (match_pos == -1) return false;
+
+  GetHead(nHardware::HEAD_WRITE).Set(match_pos, 0); // Used to track regulation
+  GetHead(nHardware::HEAD_FLOW).Set(match_pos+GetLabel().GetSize(), 0); // Used to track regulation
+  
+  int regulatory_footprint = 5;  // Positions ahead and behind label that it covers
+  match_pos = (match_pos - regulatory_footprint + m_programids[0]->GetMemory().GetSize() ) %  m_programids[0]->GetMemory().GetSize();
+  
+  cHeadProgramid h(this);
+  h.Set(match_pos, 0);
+  for (int i=0; i < 2*regulatory_footprint + GetLabel().GetSize(); i++)
+  {
+    m_promoter_occupied_sites[h.GetPosition()] = -1;
+    h++;
+  }
+  
+  AdjustPromoterRates();
+  
+   if (m_world->GetVerbosity() >= VERBOSE_DETAILS) 
+	{
+    cout << "Repress: position " << match_pos << " length " << 2*regulatory_footprint + GetLabel().GetSize() << endl;
+    for (int i=0; i < m_programids[0]->GetMemory().GetSize(); i++)
+    {
+      cout << i << " " << m_promoter_rates[i] << " " <<m_promoter_default_rates[i] << " " << m_promoter_occupied_sites[i] << endl;
+    }
+  }
+
+  return true;
+}
+
 //! Adds a new programid to the current cHardwareGX.
 void cHardwareGX::AddProgramid(programid_ptr programid) 
 { 
@@ -4014,9 +4094,12 @@
 void cHardwareGX::RemoveProgramid(unsigned int remove_index) 
 {
   assert(remove_index<m_programids.size());
-  
+     
   programid_ptr save=m_current;  
   m_current = m_programids[remove_index];
+  
+  // Remove regulation if in implicit GX mode
+  if (m_world->GetConfig().IMPLICIT_GENE_EXPRESSION.Get() == 1) m_current->RemoveRegulation();
 
   if (m_world->GetVerbosity() >= VERBOSE_DETAILS)
   {
@@ -4062,10 +4145,13 @@
   }
   
   // Finally, also delete whatever programid our write head contacted (if not ourself!)
-  if(write_head_contacted != remove_index) {
-    RemoveProgramid( (write_head_contacted > remove_index) ? write_head_contacted - 1 : write_head_contacted);
+  // DON'T DO THIS in implicit mode, sine the write head means something different (regulation)
+  if (m_world->GetConfig().IMPLICIT_GENE_EXPRESSION.Get() == 0)
+  {
+    if(write_head_contacted != remove_index) {
+      RemoveProgramid( (write_head_contacted > remove_index) ? write_head_contacted - 1 : write_head_contacted);
+    }
   }
-
   m_current = save;
 }
 
@@ -4111,7 +4197,7 @@
     AddProgramid(new_programid);
     
     cHeadProgramid read_head(m_promoter_update_head);
-    read_head++; //Don't copy the promoter instruction itself
+    read_head++; //Don't copy the promoter instruction itself (we start after that position)
     cHeadProgramid write_head(this, 0, new_programid->GetID());
     int copied = 0;
     cInstruction inst;
@@ -4144,6 +4230,80 @@
   
 }
 
+
+void cHardwareGX::AdjustPromoterRates() 
+{
+  cHeadProgramid h(this);
+  h.Set(0,0);
+  
+  m_promoter_sum = 0.0;
+  
+  do {
+    switch (m_promoter_occupied_sites[h.GetPosition()])
+    {
+      case +1: // Activated
+      m_promoter_rates[h.GetPosition()] = 1;
+      break;
+      case 0:
+      m_promoter_rates[h.GetPosition()] = m_promoter_default_rates[h.GetPosition()];
+      break;
+      case -1: // Repressed
+      m_promoter_rates[h.GetPosition()] = m_world->GetConfig().IMPLICIT_BG_PROMOTER_RATE.Get();
+      break;
+      default: //Error
+      assert(1);
+   }   
+    
+    m_promoter_sum += m_promoter_rates[h.GetPosition()];
+    h++;
+	  
+  } while (h.GetPosition() != 0);
+
+}
+
+int cHardwareGX::FindRegulatoryMatch(const cCodeLabel& label)
+{
+  // Examine number of sites matched by overlaying input label and this space in genome
+  // Skip a site if it is already occupied by a regulator.
+  cHeadProgramid h;
+  h.Reset(this,0);
+  
+  int best_site = -1; // No match found
+  int best_site_matched_positions = 0;
+  do {
+    int matched_positions = 0;
+    cHeadProgramid m(h);
+    for (int i=0; i<label.GetSize(); i++)
+    {
+      // Don't allow a site that overlaps current regulation
+      if (m_promoter_occupied_sites[i] != 0)
+      {
+        matched_positions = 0;
+        break;
+      }
+      
+      if ((m_inst_set->IsNop(m.GetInst())) && (label[i] == m_inst_set->GetNopMod( m.GetInst() )))
+      {
+        matched_positions++;
+      }
+      m++;
+    }
+    
+    // Keep new bests
+    if (matched_positions > best_site_matched_positions)
+    {
+      best_site = h.GetPosition();
+      best_site_matched_positions = matched_positions;
+      // If we find an exact match, we can bail early
+      if (best_site_matched_positions == label.GetSize()) return best_site;
+    }
+    
+    h++;
+  } while (h.GetPosition() != 0);  
+  
+  return best_site; 
+}
+
 /*! Construct this cProgramid, and initialize hardware resources.
 */
 cHardwareGX::cProgramid::cProgramid(const cGenome& genome, cHardwareGX* hardware)
@@ -4354,3 +4514,37 @@
   m_gx_hardware->m_programids[head]->RemoveContactingHead(GetHead(nHardware::HEAD_READ));
   GetHead(nHardware::HEAD_READ).Set(0, GetID());
 }
+
+/* End current regulation in implicit GX mode
+*/
+void cHardwareGX::cProgramid::RemoveRegulation()
+{
+  if (GetHead(nHardware::HEAD_WRITE).GetMemSpace() != 0) return;
+  int _pos = GetHead(nHardware::HEAD_WRITE).GetPosition();
+  
+  // Slow but reliable to cycling way of calculating size
+  cHeadProgramid t(GetHead(nHardware::HEAD_WRITE));
+  int _label_size = 0;
+  while (t.GetPosition() != GetHead(nHardware::HEAD_FLOW).GetPosition())
+  {
+    _label_size++;
+    t++;
+  }
+  
+  //Reset heads
+  GetHead(nHardware::HEAD_WRITE).Set(0, m_id);
+  GetHead(nHardware::HEAD_FLOW).Set(0, m_id);
+
+  int regulatory_footprint = 5;  // Positions ahead and behind label that it covers
+  int match_pos = (_pos - regulatory_footprint + m_gx_hardware->m_programids[0]->GetMemory().GetSize() ) %  m_gx_hardware->m_programids[0]->GetMemory().GetSize();
+  
+  cHeadProgramid h(m_gx_hardware);
+  h.Set(match_pos, 0);
+  for (int i=0; i < 2*regulatory_footprint + _label_size; i++)
+  {
+    m_gx_hardware->m_promoter_occupied_sites[h.GetPosition()] = 0; //Zero regulation
+  }
+  h++;    
+  
+  m_gx_hardware->AdjustPromoterRates();
+}

Modified: development/source/cpu/cHardwareGX.h
===================================================================
--- development/source/cpu/cHardwareGX.h	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareGX.h	2007-06-30 12:55:57 UTC (rev 1736)
@@ -150,6 +150,9 @@
     //! Detaches this cProgramid's heads from bound cProgramids.
     void Detach();
     
+    //! Removes regulation in implicit GX mode
+    void RemoveRegulation();
+    
     // Programids keep a count of the total number
     // of READ + WRITE heads of other programids that 
     // have been placed on them. They only execute
@@ -238,7 +241,9 @@
   // Implicit RNAP Model only
   cHeadProgramid m_promoter_update_head; //Promoter position that last executable programid was created from.
   tArray<double> m_promoter_states;
-  tArray<double> m_promoter_rates;
+  tArray<double> m_promoter_rates; // CURRENT promoter rates. Regulation on top of default.
+  tArray<double> m_promoter_default_rates; // Rates sans regulation
+  tArray<int> m_promoter_occupied_sites; // Whether the site is blocked by a currently bound regulatory protein.
   double m_recycle_state;
   double m_promoter_sum;
   
@@ -583,7 +588,8 @@
   
   bool Inst_Promoter(cAvidaContext& ctx);
   bool Inst_Terminator(cAvidaContext& ctx);
-  bool Inst_HeadRegulate(cAvidaContext& ctx);
+  bool Inst_HeadActivate(cAvidaContext& ctx);
+  bool Inst_HeadRepress(cAvidaContext& ctx);
 
   //!< Add/Remove a new programid to/from the list and give it the proper index within the list so we keep track of memory spaces...
   void AddProgramid(programid_ptr programid);
@@ -591,7 +597,8 @@
   
   // Create executable programids in the implicit GX model
   void ProcessImplicitGeneExpression(int in_limit = -1);  
-  
+  void AdjustPromoterRates(); //Call after a change to occupied array to correctly update rates.
+  int FindRegulatoryMatch(const cCodeLabel& label);
 };
 
 

Modified: development/source/cpu/cHardwareSMT.cc
===================================================================
--- development/source/cpu/cHardwareSMT.cc	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareSMT.cc	2007-06-30 12:55:57 UTC (rev 1736)
@@ -252,6 +252,7 @@
   }
   
   organism->SetRunning(false);
+  CheckImplicitRepro(ctx);
 }
 
 

Modified: development/source/cpu/cHardwareTransSMT.cc
===================================================================
--- development/source/cpu/cHardwareTransSMT.cc	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/cpu/cHardwareTransSMT.cc	2007-06-30 12:55:57 UTC (rev 1736)
@@ -250,6 +250,7 @@
   }
   
   organism->SetRunning(false);
+  CheckImplicitRepro(ctx);
 }
 
 

Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/main/cAvidaConfig.h	2007-06-30 12:55:57 UTC (rev 1736)
@@ -245,8 +245,9 @@
   CONFIG_ADD_VAR(REQUIRED_TASK, int, -1, "Task ID required for successful divide.");
   CONFIG_ADD_VAR(IMMUNITY_TASK, int, -1, "Task providing immunity from the required task.");
   CONFIG_ADD_VAR(REQUIRED_REACTION, int, -1, "Reaction ID required for successful divide.");
-  CONFIG_ADD_VAR(REQUIRED_BONUS, int, 0, "The bonus that an organism must accumulate to divide.");  
- 
+  CONFIG_ADD_VAR(IMPLICIT_REPRO_BONUS, int, 0, "Immediately call Inst_Repro to divide when upon achieving this bonus. 0 = OFF");  
+  CONFIG_ADD_VAR(IMPLICIT_REPRO_TIME, int, 0, "Immediately call Inst_Repro after this many cpu cycles. 0 = OFF");  
+
   CONFIG_ADD_GROUP(MUTATION_GROUP, "Mutations");
   CONFIG_ADD_VAR(POINT_MUT_PROB, double, 0.0, "Mutation rate (per-location per update)");
   CONFIG_ADD_VAR(COPY_MUT_PROB, double, 0.0075, "Mutation rate (per copy)");
@@ -364,7 +365,6 @@
   CONFIG_ADD_VAR(IMPLICIT_BG_PROMOTER_RATE, double, 0.0, "Relative rate of non-promoter sites creating programids.");
   CONFIG_ADD_VAR(IMPLICIT_TURNOVER_RATE, double, 0.0, "Number of programids recycled per CPU cycle. 0 = OFF");
   CONFIG_ADD_VAR(IMPLICIT_MAX_PROGRAMID_LENGTH, int, 0, "Creation of an executable programid terminates after this many instructions. 0 = disabled");
-  CONFIG_ADD_VAR(IMPLICIT_REPRO_TIME, int, 0, "Implicitly call the repro instruction after completing this many cpu cycles. 0 = disabled."); // TODO - implmement for all hardware types and move to Reproduction Group 
 //  CONFIG_ADD_VAR(CLEAR_ON_OUTPUT, int, 0, "Reset input buffer every time output called?"); @JEB Not fully implemented
 
   CONFIG_ADD_GROUP(PROMOTER_GROUP, "Promoters");

Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/source/main/cOrganism.cc	2007-06-30 12:55:57 UTC (rev 1736)
@@ -533,14 +533,6 @@
     return false; //  (divide fails)
   }
   
-  // Make sure that an organism has accumulated any required bonus
-  const int bonus_required = m_world->GetConfig().REQUIRED_BONUS.Get();
-  if (m_phenotype.GetCurBonus() < bonus_required) {
-    Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR,
-          cStringUtil::Stringf("Lacks required bonus to divide (has %d, needs %d)", m_phenotype.GetCurBonus(), bonus_required));
-    return false; //  (divide fails)
-  }
-
   // Make sure the parent is fertile
   if ( m_phenotype.IsFertile() == false ) {
     Fault(FAULT_LOC_DIVIDE, FAULT_TYPE_ERROR, "Infertile organism");

Modified: development/support/config/avida.cfg
===================================================================
--- development/support/config/avida.cfg	2007-06-29 21:29:49 UTC (rev 1735)
+++ development/support/config/avida.cfg	2007-06-30 12:55:57 UTC (rev 1736)
@@ -103,14 +103,15 @@
 
 ### DIVIDE_GROUP ###
 # Divide Restrictions
-CHILD_SIZE_RANGE 2.0  # Maximal differential between child and parent sizes.
-MIN_COPIED_LINES 0.5  # Code fraction which must be copied before divide.
-MIN_EXE_LINES 0.5     # Code fraction which must be executed before divide.
-REQUIRE_ALLOCATE 1    # (Original CPU Only) Require allocate before divide?
-REQUIRED_TASK -1      # Task ID required for successful divide.
-IMMUNITY_TASK -1      # Task providing immunity from the required task.
-REQUIRED_REACTION -1  # Reaction ID required for successful divide.
-REQUIRED_BONUS 0      # The bonus that an organism must accumulate to divide.
+CHILD_SIZE_RANGE 2.0    # Maximal differential between child and parent sizes.
+MIN_COPIED_LINES 0.5    # Code fraction which must be copied before divide.
+MIN_EXE_LINES 0.5       # Code fraction which must be executed before divide.
+REQUIRE_ALLOCATE 1      # (Original CPU Only) Require allocate before divide?
+REQUIRED_TASK -1        # Task ID required for successful divide.
+IMMUNITY_TASK -1        # Task providing immunity from the required task.
+REQUIRED_REACTION -1    # Reaction ID required for successful divide.
+IMPLICIT_REPRO_BONUS 0  # Immediately call Inst_Repro to divide when upon achieving this bonus. 0 = OFF
+IMPLICIT_REPRO_TIME 0   # Immediately call Inst_Repro after this many cpu cycles. 0 = OFF
 
 ### MUTATION_GROUP ###
 # Mutations
@@ -291,7 +292,6 @@
 IMPLICIT_BG_PROMOTER_RATE 0.0    # Relative rate of non-promoter sites creating programids.
 IMPLICIT_TURNOVER_RATE 0.0       # Number of programids recycled per CPU cycle. 0 = OFF
 IMPLICIT_MAX_PROGRAMID_LENGTH 0  # Creation of an executable programid terminates after this many instructions. 0 = disabled
-IMPLICIT_REPRO_TIME 0            # Implicitly call the repro instruction after completing this many cpu cycles. 0 = disabled.
 
 ### PROMOTER_GROUP ###
 # Promoters




More information about the Avida-cvs mailing list