[Avida-SVN] r1245 - in development/source: actions analyze cpu main

barrick at myxo.css.msu.edu barrick at myxo.css.msu.edu
Thu Feb 1 10:28:11 PST 2007


Author: barrick
Date: 2007-02-01 13:28:11 -0500 (Thu, 01 Feb 2007)
New Revision: 1245

Modified:
   development/source/actions/EnvironmentActions.cc
   development/source/analyze/cAnalyze.cc
   development/source/analyze/cAnalyze.h
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareCPU.h
   development/source/cpu/cHardwareStatusPrinter.h
   development/source/cpu/cHardwareTracer.h
   development/source/cpu/cTestCPU.cc
   development/source/cpu/cTestCPU.h
   development/source/main/cEnvironment.cc
   development/source/main/cOrganism.cc
   development/source/main/cOrganism.h
   development/source/main/cPhenotype.cc
   development/source/main/cPhenotype.h
   development/source/main/cReactionProcess.h
   development/source/main/cReactionResult.cc
   development/source/main/cReactionResult.h
   development/source/main/cResourceCount.cc
Log:
==Test CPU Resources

Added an additional mode for resources that can be invoked from analyze mode. In place of a 0 or 1 for the [use_resources] flag in all commands, you can also use 2.

This implements updated and depletable resources, meaning that (1) updates pass in the test CPU -- it will reset resources according to the file whenever it finds a matching update and (2) these units can be used up by an organism. For test CPU purposes, we assume that an update is as long as the average time slice.

You can also specify an offset (in a number of CPU cycles) from the update that you specify for resources. This allows finer control over where organisms start a resource cycle. I added this as a parameter after the filename in the LOAD_RESOURCES command to avoid making the syntax for other commands even messier.

When invoked during a normal Avida run, the test CPU now supplies non-depletable resources in the initial amounts specified for the run. It had been showing no tasks executed whenever an organism tried to complete a task that required a resource in the archive/*.org files.

==Trace File

If you use instructions with an additional time cost (that ages the organism as if it had used more CPU cycles, but doesn't take any longer to execute), then the trace file also includes the actual CPU time that the organism has used in addition to it effective time that it has aged.

I also threw in a quick and ugly print out of current resources levels in the trace file when you use resource option 2 above.

==Successful reactions can clear the input buffer

I was becoming annoyed with test organisms saving an output value to "put" repeatedly in some pilot studies, so I added a REACTION flag (:clearsinput=1) so that successfully completing a reaction can clear the input buffer. It's implemented in a way such that if an IO or put completes one of these reactions then no further reactions that the output might also trigger are rewarded (rather than the standard behavior of rewarding all applicable reactions for an output).

==Misc Instructions

Added a new flavor of "sense" and some flavors of "put" and "IO" with "repro" built in at the request of my organisms.



Modified: development/source/actions/EnvironmentActions.cc
===================================================================
--- development/source/actions/EnvironmentActions.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/actions/EnvironmentActions.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -139,6 +139,7 @@
   tArray<int> m_cell_list;
   cString m_res_name;
   double m_res_count;
+  int m_res_id;
   
 public:
   cActionSetCellResource(cWorld* world, const cString& args) : cAction(world, args), m_cell_list(0), m_res_name(""), m_res_count(0.0)
@@ -151,13 +152,17 @@
     }
     if (largs.GetSize()) m_res_name = largs.PopWord();
     if (largs.GetSize()) m_res_count = largs.PopWord().AsDouble();
+    
+    cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource(m_res_name);
+    assert(res);
+    m_res_id = res->GetID(); // Save the id so we don't have to do many string conversions
   }
 
   static const cString GetDescription() { return "Arguments: <int cell_id> <string res_name> <double res_count>"; }
 
   void Process(cAvidaContext& ctx)
   {
-    cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource(m_res_name);
+    cResource* res = m_world->GetEnvironment().GetResourceLib().GetResource(m_res_id);
     for(int i=0; i<m_cell_list.GetSize(); i++)
     {
       int m_cell_id = m_cell_list[i];

Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/analyze/cAnalyze.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -88,9 +88,9 @@
   
   // Initialize the time oriented resource list to be just the initial
   // concentrations of the resources in the environment.  This will only
-  // be changed if LOAD_RESOURCES analyze command is called.  If there is
+  // be changed if LOAD_RESOURCES analyze command is called.  If there are
   // no resources in the environment or there is no environment, the list
-  // is empty and will cause an assert to be thrown in FindResource function.
+  // is empty then the all resources will default to 0.0
   const cResourceLib &resource_lib = m_world->GetEnvironment().GetResourceLib();
   if(resource_lib.GetSize() > 0) {
     vector<double> r;
@@ -101,7 +101,7 @@
     }
     resources.push_back(make_pair(0, r));
   }
-  // @DMB -  FillResources(0);
+  m_resource_time_spent_offset = 0;
 
   m_testcpu = m_world->GetHardwareManager().CreateTestCPU();
 }
@@ -395,7 +395,7 @@
 void cAnalyze::LoadDominant(cString cur_string)
 {
   (void) cur_string;
-  cerr << "Warning: \"LOAD_DOMINANT\" not implmented yet!"<<endl;
+  cerr << "Warning: \"LOAD_DOMINANT\" not implemented yet!"<<endl;
 }
 
 // Clears the current time oriented list of resources and loads in a new one
@@ -410,6 +410,9 @@
   if(words >= 1) {
     filename = cur_string.PopWord();
   }
+  if(words >= 2) {
+    m_resource_time_spent_offset = cur_string.PopWord().AsInt();
+  }
   
   cout << "Loading Resources from: " << filename << endl;
   
@@ -458,45 +461,6 @@
   return;
 }
 
-
-// Looks up the resource concentrations that are the closest to the
-// given update and then fill in those concentrations into the environment.
-void cAnalyze::FillResources(cTestCPU* testcpu, int update)
-{
-  // There must be some resources for at least one update
-  //assert(!resources.empty());
-  if(resources.empty()) { return; }
-  
-  int which = -1;
-  // Assuming resource vector is sorted by update, front to back
-  if(update <= resources[0].first) {
-    which = 0;
-  } else if(update >= resources.back().first) {
-    which = resources.size() - 1;
-  } else {
-    // Find the update that is closest to the born update
-    for(unsigned int i=0; i<resources.size()-1; i++) {
-      if(update > resources[i+1].first) { continue; }
-      if(update - resources[i].first <=
-         resources[i+1].first - update) {
-        which = i;
-      } else {
-        which = i + 1;
-      }
-      break;
-    }
-  }
-  if(which < 0) { assert(0); }
-  
-  
-  tArray<double> temp(resources[which].second.size());
-  for(unsigned int i=0; i<resources[which].second.size(); i++) {
-    temp[i] = resources[which].second[i];
-  }
-
-  testcpu->SetResourcesFromArray(temp);
-}
-
 double cAnalyze::AnalyzeEntropy(cAnalyzeGenotype * genotype, double mu) 
 {
   double entropy = 0.0;
@@ -1657,10 +1621,7 @@
   int update = -1;
   if(words >= 2) {
     useResources = cur_string.PopWord().AsInt();
-    // All invalid values are considered false
-    if(useResources != 0 && useResources != 1) {
-      useResources = 0;
-    }
+    // All invalid values are considered false (testcpu->InitResources handles)
   }
   if (words >= 3) {
     update = cur_string.PopWord().AsInt();
@@ -1674,11 +1635,8 @@
   }
   
   cTestCPU* testcpu = m_world->GetHardwareManager().CreateTestCPU();  
+  testcpu->InitResources(useResources, &resources, update, m_resource_time_spent_offset);
   
-  if (useResources && update > -1) {
-    FillResources(testcpu, update);
-  }
-  
   tListIterator<cAnalyzeGenotype> batch_it(batch[cur_batch].List());
   cAnalyzeGenotype * genotype = NULL;
   while ((genotype = batch_it.Next()) != NULL) {
@@ -2686,7 +2644,9 @@
   ///////////////////////
   // Create Test CPU
   cTestCPU* testcpu = m_world->GetHardwareManager().CreateTestCPU();
-  FillResources(testcpu, update);
+  // No choice of use_resources for this analyze command...
+  testcpu->InitResources(cTestCPU::RES_CONSTANT, &resources, update, m_resource_time_spent_offset);
+
   
   ///////////////////////////////////////////////////////////////////////
   // Choose the first n most abundant genotypes and put them in community
@@ -3254,9 +3214,9 @@
   ///////////////////////
   // Backup test CPU data
   cTestCPU* testcpu = m_world->GetHardwareManager().CreateTestCPU();
-  FillResources(testcpu, update);
-  
-  
+  // No choice of use_resources for this analyze command...
+  testcpu->InitResources(cTestCPU::RES_CONSTANT, &resources, update, m_resource_time_spent_offset);
+
   vector<cAnalyzeGenotype *> community;
   cAnalyzeGenotype * genotype = NULL;
   tListIterator<cAnalyzeGenotype> batch_it(batch[cur_batch].List());
@@ -6635,10 +6595,7 @@
   // resource usage flag is an optional arguement, but is always the 3rd arg
   if(words >= 3) {
     useResources = cur_string.PopWord().AsInt();
-    // All non-zero values are considered false
-    if(useResources != 0 && useResources != 1) {
-      useResources = 0;
-    }
+    // All non-zero values are considered false (Handled by testcpu->InitResources)
   }
   
   // Batch frequency begins with the first organism, but then skips that 
@@ -6681,10 +6638,8 @@
     lineage_fp << genotype->GetID() << " ";
     
     int updateBorn = -1;
-    if(useResources) {
-      updateBorn = genotype->GetUpdateBorn();
-      FillResources(testcpu, updateBorn);
-    }
+    updateBorn = genotype->GetUpdateBorn();
+    testcpu->InitResources(useResources, &resources, updateBorn, m_resource_time_spent_offset);
     
     // Calculate the stats for the genotype we're working with ...
     genotype->Recalculate(m_ctx, testcpu);
@@ -7040,10 +6995,7 @@
   int update = -1;
   if(words >= 1) {
     useResources = cur_string.PopWord().AsInt();
-    // All non-zero values are considered false
-    if(useResources != 0 && useResources != 1) {
-      useResources = 0;
-    }
+    // All non-zero values are considered false (handled by testcpu->InitResources)
   }
   if (words >= 2) {
     update = cur_string.PopWord().AsInt();
@@ -7071,20 +7023,12 @@
     << "parent and ancestor distances may not be correct" << endl;
   }
   
-  if (useResources && update > -1) {
-    FillResources(testcpu, update);
-  }
-  
   tListIterator<cAnalyzeGenotype> batch_it(batch[cur_batch].List());
   cAnalyzeGenotype * genotype = NULL;
   cAnalyzeGenotype * last_genotype = NULL;
   while ((genotype = batch_it.Next()) != NULL) {
-    // If use resources, load proper resource according to update_born
-    if(useResources && update == -1) {
-      int updateBorn = -1;
-      updateBorn = genotype->GetUpdateBorn();
-      FillResources(testcpu, updateBorn);
-    }
+    // Load proper resources according to update_born
+    testcpu->InitResources(useResources, &resources, update, m_resource_time_spent_offset);
     
     // If the previous genotype was the parent of this one, pass in a pointer
     // to it for improved recalculate (such as distance to parent, etc.)

Modified: development/source/analyze/cAnalyze.h
===================================================================
--- development/source/analyze/cAnalyze.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/analyze/cAnalyze.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -92,6 +92,8 @@
   // This is the storage for the resource information from resource.dat.  It 
   // is a pair of the update and a vector of the resource concentrations
   std::vector<std::pair<int, std::vector<double> > > resources;
+  int m_resource_time_spent_offset; // The amount to offset the time spent when 
+                                    // beginning, using resources that change
 
   int interactive_depth;  // How nested are we if in interactive mode?
 

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/cpu/cHardwareCPU.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -218,6 +218,7 @@
     cInstEntryCPU("stk-get",   &cHardwareCPU::Inst_TaskStackGet),
     cInstEntryCPU("stk-load",  &cHardwareCPU::Inst_TaskStackLoad),
     cInstEntryCPU("put",       &cHardwareCPU::Inst_TaskPut),
+    cInstEntryCPU("put-clear", &cHardwareCPU::Inst_TaskPutClearInput),    
     cInstEntryCPU("put-bcost2", &cHardwareCPU::Inst_TaskPutBonusCost2),
     cInstEntryCPU("put-mcost2", &cHardwareCPU::Inst_TaskPutMeritCost2),
     cInstEntryCPU("IO",        &cHardwareCPU::Inst_TaskIO, true,
@@ -231,6 +232,7 @@
     cInstEntryCPU("send",      &cHardwareCPU::Inst_Send),
     cInstEntryCPU("receive",   &cHardwareCPU::Inst_Receive),
     cInstEntryCPU("sense",     &cHardwareCPU::Inst_SenseLog2),
+    cInstEntryCPU("sense-unit",     &cHardwareCPU::Inst_SenseUnit),
     cInstEntryCPU("sense-m100",     &cHardwareCPU::Inst_SenseMult100),
     
     cInstEntryCPU("donate-rnd",  &cHardwareCPU::Inst_DonateRandom),
@@ -355,6 +357,10 @@
     cInstEntryCPU("repro-Y",    &cHardwareCPU::Inst_Repro),
     cInstEntryCPU("repro-Z",    &cHardwareCPU::Inst_Repro),
 
+    cInstEntryCPU("IO-repro",   &cHardwareCPU::Inst_IORepro),
+    cInstEntryCPU("put-repro",  &cHardwareCPU::Inst_PutRepro),
+    cInstEntryCPU("putc-repro", &cHardwareCPU::Inst_PutClearRepro),
+
     cInstEntryCPU("spawn-deme", &cHardwareCPU::Inst_SpawnDeme),
     
     // Suicide
@@ -480,6 +486,8 @@
   
   cPhenotype & phenotype = organism->GetPhenotype();
   phenotype.IncTimeUsed();
+  phenotype.IncCPUCyclesUsed();
+
   const int num_threads = GetNumThreads();
   
   // If we have threads turned on and we executed each thread in a single
@@ -640,12 +648,20 @@
 
 void cHardwareCPU::PrintStatus(ostream& fp)
 {
-  fp << organism->GetPhenotype().GetTimeUsed() << " " << "IP:" << IP().GetPosition() << "    ";
+  fp << organism->GetPhenotype().GetCPUCyclesUsed() << " ";
+  fp << "IP:" << IP().GetPosition() << "    ";
   
   for (int i = 0; i < NUM_REGISTERS; i++) {
     fp << static_cast<char>('A' + i) << "X:" << GetRegister(i) << " ";
     fp << setbase(16) << "[0x" << GetRegister(i) << "]  " << setbase(10);
   }
+  
+  // Add some extra information if additional time costs are used for instructions,
+  // leave this out if there are no differences to keep it cleaner
+  if ( organism->GetPhenotype().GetTimeUsed() != organism->GetPhenotype().GetCPUCyclesUsed() )
+  {
+    fp << "  AgedTime:" << organism->GetPhenotype().GetTimeUsed();
+  }
   fp << endl;
   
   fp << "  R-Head:" << GetHead(nHardware::HEAD_READ).GetPosition() << " "
@@ -2668,7 +2684,34 @@
   return true;
 }
 
+bool cHardwareCPU::Inst_IORepro(cAvidaContext& ctx)
+{
+  // Do normal IO
+  Inst_TaskIO(ctx);
+  
+  // Immediately attempt a repro
+  return Inst_Repro(ctx);
+}
 
+bool cHardwareCPU::Inst_PutRepro(cAvidaContext& ctx)
+{
+  // Do normal IO
+  Inst_TaskPut(ctx);
+  
+  // Immediately attempt a repro
+  return Inst_Repro(ctx);
+}
+
+bool cHardwareCPU::Inst_PutClearRepro(cAvidaContext& ctx)
+{
+  // Do normal IO
+  Inst_TaskPutClearInput(ctx);
+  
+  // Immediately attempt a repro
+  return Inst_Repro(ctx);
+}
+
+
 bool cHardwareCPU::Inst_SpawnDeme(cAvidaContext& ctx)
 {
   organism->SpawnDeme();
@@ -2853,6 +2896,13 @@
   return true;
 }
 
+bool cHardwareCPU::Inst_TaskPutClearInput(cAvidaContext& ctx)
+{
+  bool return_value = Inst_TaskPut(ctx);
+  organism->ClearInput();
+  return return_value;
+}
+
 bool cHardwareCPU::Inst_TaskPutBonusCost2(cAvidaContext& ctx)
 {
   const int reg_used = FindModifiedRegister(REG_BX);
@@ -2989,6 +3039,11 @@
   return DoSense(ctx, 0, 2);
 }
 
+bool cHardwareCPU::Inst_SenseUnit(cAvidaContext& ctx)
+{
+  return DoSense(ctx, 1, 1);
+}
+
 bool cHardwareCPU::Inst_SenseMult100(cAvidaContext& ctx)
 {
   return DoSense(ctx, 1, 100);

Modified: development/source/cpu/cHardwareCPU.h
===================================================================
--- development/source/cpu/cHardwareCPU.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/cpu/cHardwareCPU.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -381,6 +381,10 @@
   bool Inst_InjectThread(cAvidaContext& ctx);
   bool Inst_Transposon(cAvidaContext& ctx);
   bool Inst_Repro(cAvidaContext& ctx);
+  bool Inst_IORepro(cAvidaContext& ctx);
+  bool Inst_PutRepro(cAvidaContext& ctx);
+  bool Inst_PutClearRepro(cAvidaContext& ctx);
+
   bool Inst_SpawnDeme(cAvidaContext& ctx);
   bool Inst_Kazi(cAvidaContext& ctx);
   bool Inst_Kazi5(cAvidaContext& ctx);
@@ -391,6 +395,7 @@
   bool Inst_TaskStackGet(cAvidaContext& ctx);
   bool Inst_TaskStackLoad(cAvidaContext& ctx);
   bool Inst_TaskPut(cAvidaContext& ctx);
+  bool Inst_TaskPutClearInput(cAvidaContext& ctx);  
   bool Inst_TaskPutBonusCost2(cAvidaContext& ctx);  
   bool Inst_TaskPutMeritCost2(cAvidaContext& ctx); 
   bool Inst_TaskIO(cAvidaContext& ctx);
@@ -401,6 +406,7 @@
   bool Inst_Send(cAvidaContext& ctx);
   bool Inst_Receive(cAvidaContext& ctx);
   bool Inst_SenseLog2(cAvidaContext& ctx);
+  bool Inst_SenseUnit(cAvidaContext& ctx);
   bool Inst_SenseMult100(cAvidaContext& ctx);
   bool DoSense(cAvidaContext& ctx, int conversion_method, double base);
 

Modified: development/source/cpu/cHardwareStatusPrinter.h
===================================================================
--- development/source/cpu/cHardwareStatusPrinter.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/cpu/cHardwareStatusPrinter.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -33,6 +33,7 @@
 
   virtual void TraceHardware(cHardwareBase& hardware, bool bonus);
   virtual void TraceTestCPU(int time_used, int time_allocated, const cOrganism& organism);
+  virtual std::ostream * GetStream() { return &m_trace_fp; }  
 };
 
 

Modified: development/source/cpu/cHardwareTracer.h
===================================================================
--- development/source/cpu/cHardwareTracer.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/cpu/cHardwareTracer.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -21,6 +21,7 @@
   virtual ~cHardwareTracer() { ; }
   virtual void TraceHardware(cHardwareBase&, bool bonus = false) = 0;
   virtual void TraceTestCPU(int time_used, int time_allocated, const cOrganism& organism)= 0;
+  virtual std::ostream * GetStream() { return NULL; }
 };
 
 #endif

Modified: development/source/cpu/cTestCPU.cc
===================================================================
--- development/source/cpu/cTestCPU.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/cpu/cTestCPU.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -35,95 +35,145 @@
 
 using namespace std;
 
+std::vector<std::pair<int, std::vector<double> > > * cTestCPU::s_resources = NULL;
+
 cTestCPU::cTestCPU(cWorld* world)
 {
   m_world = world;
   InitResources();
 }  
  
-void cTestCPU::InitResources()
+void cTestCPU::InitResources(int res_method, std::vector<std::pair<int, std::vector<double> > > * res, int update, int time_spent_offset)
 {  
-   // Setup the resources...
-  // unless another 'set' method is called, they default to zero
-  m_res_method = RES_STATIC;
-
-  const cResourceLib& resource_lib = m_world->GetEnvironment().GetResourceLib();
-  assert(resource_lib.GetSize() >= 0);
-
-  resource_count.SetSize(resource_lib.GetSize());
-  d_resources.ResizeClear(resource_lib.GetSize());
-  for(int i=0; i<resource_lib.GetSize(); i++) {
-    d_resources[i] = 0.0;
+  m_res_method = (eTestCPUResourceMethod)res_method;
+  // Make sure it's valid
+  if(res_method < 0 ||  res_method >= RES_LAST) {
+    m_res_method = RES_INITIAL;
   }
+  
+  // Setup the resources...
+  m_res = res;
+  m_res_time_spent_offset = time_spent_offset;
+  m_res_update = update;
 
-  resource_count.ResizeSpatialGrids(1, 1);
-
-  for (int i = 0; i < resource_lib.GetSize(); i++) {
-    cResource* res = resource_lib.GetResource(i);
-    const double decay = 1.0 - res->GetOutflow();
-    resource_count.Setup(i, res->GetName(), res->GetInitial(), 
-                           res->GetInflow(), decay,
-                           res->GetGeometry(), res->GetXDiffuse(),
-                           res->GetXGravity(), res->GetYDiffuse(), 
-                           res->GetYGravity(), res->GetInflowX1(), 
-                           res->GetInflowX2(), res->GetInflowY1(), 
-                           res->GetInflowY2(), res->GetOutflowX1(), 
-                           res->GetOutflowX2(), res->GetOutflowY1(), 
-                           res->GetOutflowY2(), res->GetCellListPtr(),
-                           m_world->GetVerbosity() );
-  }
-
-}
-
-void cTestCPU::SetResourcesFromArray(const tArray<double> &resources)
-{
-  // Set STATIC resources according to the input array
-  m_res_method = RES_STATIC;
+  // Adjust updates if time_spent_offset is greater than a time slice
+  int ave_time_slice = m_world->GetConfig().AVE_TIME_SLICE.Get();
+  m_res_update += m_res_time_spent_offset / ave_time_slice;
+  m_res_time_spent_offset %= ave_time_slice;
+  assert(m_res_time_spent_offset >= 0);
   
-  for(int i = 0; i < d_resources.GetSize(); i++) {
-    if(i >= resources.GetSize()) {
-      d_resources[i] = 0.0;
-    } else {
-      d_resources[i] = resources[i];
+  // If they didn't send anything (usually during an avida run as opposed to analyze mode),
+  // then we set up a static variable (or just point to it) that reflects the initial conditions of the run
+  // from the environment file.  (JEB -- This code moved from cAnalyze::cAnalyze).
+  if (m_res_method == RES_INITIAL)
+  {
+    // Initialize the time oriented resource list to be just the initial
+    // concentrations of the resources in the environment.  This will only
+    // be changed if LOAD_RESOURCES analyze command is called.  If there are
+    // no resources in the environment or there is no environment, the list
+    // is empty then the all resources will default to 0.0
+    if (!s_resources)
+    {
+      s_resources = new std::vector<std::pair<int, std::vector<double> > >;
+      const cResourceLib &resource_lib = m_world->GetEnvironment().GetResourceLib();
+      if(resource_lib.GetSize() > 0) 
+      {
+        vector<double> r;
+        for(int i=0; i<resource_lib.GetSize(); i++) 
+        {
+          cResource *resource = resource_lib.GetResource(i);
+          assert(resource);
+          r.push_back(resource->GetInitial());
+        }
+        s_resources->push_back(make_pair(0, r));
+      }
     }
+    m_res = s_resources;
   }
+  assert(m_res != NULL);
+  
+  const cResourceLib& resource_lib = m_world->GetEnvironment().GetResourceLib();
+  assert(resource_lib.GetSize() >= 0);
+  
+  // Set the resource count to zero by default
+  m_resource_count.SetSize(resource_lib.GetSize());
+  for(int i=0; i<resource_lib.GetSize(); i++) 
+  {     
+     m_resource_count.Set(i, 0.0);
+  }
+    
+  SetResourceUpdate(m_res_update, true);
+  // Round down to the closest update to choose how to initializae resources
 }
 
-
-void cTestCPU::SetResourcesFromCell(int cell_x, int cell_y)
+void cTestCPU::SetResourceUpdate(int update, bool round_to_closest)
 {
-  // Set DYNAMIC resources according to the input array
-  m_res_method = RES_DYNAMIC;
+  assert(m_res != NULL);
 
-  // Setup the resources...
-  const cResourceLib& resource_lib = m_world->GetEnvironment().GetResourceLib();
-  assert(resource_lib.GetSize() >= 0);
+  m_res_update = update;
 
-  // Make a parallel world that consists of one cell
-  for (int i = 0; i < resource_lib.GetSize(); i++) {
-    cResource* res = resource_lib.GetResource(i);
-    const double decay = 1.0 - res->GetOutflow();
+  int which = -1;
+  if (round_to_closest)
+  {
+    // Assuming resource vector is sorted by update, front to back
     
-    // Set up the resource. 
-    // (1) Diffusion and gravity don't make sense in a one-cell world.
-    // (2) We offset all of the X, Y coords so this cell is at 0,0 (the only valid cell in the world)
-    resource_count.Setup(i, res->GetName(), res->GetInitial(), 
-                           res->GetInflow(), decay,
-                           res->GetGeometry(), 0.0 /*res->GetXDiffuse()*/,
-                           0.0 /*res->GetXGravity()*/, 0.0 /*res->GetYDiffuse()*/, 
-                           0.0 /*res->GetYGravity()*/, res->GetInflowX1() - cell_x, 
-                           res->GetInflowX2() - cell_x, res->GetInflowY1() - cell_y, 
-                           res->GetInflowY2() - cell_y, res->GetOutflowX1() - cell_x, 
-                           res->GetOutflowX2() - cell_x, res->GetOutflowY1() - cell_y, 
-                           res->GetOutflowY2() - cell_y, res->GetCellListPtr(),
-                           m_world->GetVerbosity() );
+    /*
+    if(update <= (*m_res)[0].first) {
+      which = 0;
+    } else if(update >= (*m_res).back().first) {
+      which = m_res->size() - 1;
+    } else {
+      // Find the update that is closest to the born update
+      for(unsigned int i=0; i<(*m_res).size()-1; i++) {
+        if(update >= (*m_res)[i+1].first) { continue; }
+        if(update - (*m_res)[i].first <=
+           (*m_res)[i+1].first - update) {
+          which = i;
+        } else {
+          which = i + 1;
+        }
+        break;
+      */
+      // Find the update that is closest to the born update, round down instead @JEB
+      which = 0;
+      while ( which < (int)m_res->size() )
+      {
+        if ( (*m_res)[which].first > update ) break;
+        which++;
+      }
+      if (which > 0) which--;
+ // }
+    assert(which >= 0);
   }
+  else // Only find exact update matches
+  {
+    for(unsigned int i=0; i<m_res->size(); i++)
+    {
+      if (update == (*m_res)[i].first)
+      {
+        which = i;
+        break;
+      }
+    }
+    if (which < 0) return; // Not found (do nothing)
+  }
+  
+  const cResourceLib& resource_lib = m_world->GetEnvironment().GetResourceLib();
+  for(int i=0; i<resource_lib.GetSize(); i++) 
+  {
+    if(i >= (int)(*m_res)[which].second.size()) {
+      m_resource_count.Set(i, 0.0);
+    } else {
+      double temp = (*m_res)[which].second[i];
+      m_resource_count.Set(i, (*m_res)[which].second[i]);
+    }
+  }
 }
 
 void cTestCPU::ModifyResources(const tArray<double>& res_change)
 {
-  //We only let the testCPU modify the resources if we are using DYNAMIC ones.
-  if (m_res_method == RES_DYNAMIC) resource_count.Modify(res_change);
+  //We only let the testCPU modify the resources if we are using a DEPLETABLE options. @JEB
+  if (m_res_method >= RES_UPDATED_DEPLETABLE) m_resource_count.Modify(res_change);
 }
 
 
@@ -136,6 +186,7 @@
 
   // Determine how long this organism should be tested for...
   int time_allocated = m_world->GetConfig().TEST_CPU_TIME_MOD.Get() * organism.GetGenome().GetSize();
+  time_allocated += m_res_time_spent_offset; // If the resource offset has us starting at a different time, adjust @JEB
 
   // Prepare the inputs...
   cur_input = 0;
@@ -143,15 +194,42 @@
 
   // Determine if we're tracing and what we need to print.
   cHardwareTracer* tracer = test_info.GetTraceExecution() ? (test_info.GetTracer()) : NULL;
+  std::ostream * tracerStream = NULL;
+  if (tracer != NULL) tracerStream = tracer->GetStream();
 
-  int time_used = 0;
+  int time_used = m_res_time_spent_offset; // Note: this is zero by default if no resources being used @JEB
+  int ave_time_slice = m_world->GetConfig().AVE_TIME_SLICE.Get();
+  
   organism.GetHardware().SetTrace(tracer);
   while (time_used < time_allocated && organism.GetHardware().GetMemory().GetSize() &&
          organism.GetPhenotype().GetNumDivides() == 0)
   {
     time_used++;
-    organism.GetHardware().SingleProcess(ctx);
+    
     // @CAO Need to watch out for parasites.
+    
+    // Assume an update is based on the average time slice for updating test cpu resources @JEB
+    if ((m_res_method >= RES_UPDATED_DEPLETABLE) && (time_used % ave_time_slice == 0))
+    {
+      SetResourceUpdate(m_res_update+1);
+    }
+    
+    // Add extra info to trace files so that we can watch resource changes. 
+    // This is a clumsy way to insert it in the trace file, but works for my purposes @JEB
+    if ( (m_res_method >= RES_UPDATED_DEPLETABLE) && (tracerStream != NULL) ) 
+    {
+      const cResourceLib& resource_lib = m_world->GetEnvironment().GetResourceLib();
+      assert(resource_lib.GetSize() >= 0);
+      *tracerStream << "Resources:";
+      // Print out resources
+      for(int i=0; i<resource_lib.GetSize(); i++) 
+      {     
+         *tracerStream << " " << m_resource_count.Get(i);
+      }
+      *tracerStream << endl;
+     }
+     
+     organism.GetHardware().SingleProcess(ctx);
   }
   organism.GetHardware().SetTrace(NULL);
 

Modified: development/source/cpu/cTestCPU.h
===================================================================
--- development/source/cpu/cTestCPU.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/cpu/cTestCPU.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -12,6 +12,7 @@
 #define cTestCPU_h
 
 #include <fstream>
+#include <vector>
 
 #ifndef tArray_h
 #include "tArray.h"
@@ -35,6 +36,15 @@
 
 class cTestCPU
 {
+public:
+  enum eTestCPUResourceMethod { RES_INITIAL = 0, RES_CONSTANT, RES_UPDATED_DEPLETABLE, RES_DYNAMIC, RES_LAST };  
+  // Modes for how the test CPU handles resources:
+  // OFF - all resources are at zero. (OLD: use_resources = 0)
+  // CONSTANT - resources stay constant at input values for the specified update. (OLD: use_resources = 1)
+  // UPDATED_DEPLETABLE - resources change every update according to resource data file (assuming an update
+  //    is an average time slice). The organism also depletes these resources when using them.
+  // DYNAMIC - UPDATED_DEPLETABLE + resources inflow/outflow (NOT IMPLEMENTED YET!)
+
 private:
   cWorld* m_world;
   tArray<int> input_array;
@@ -42,14 +52,18 @@
   int cur_input;
   int cur_receive;  
 
-  enum tTestCPUResourceMethod { RES_STATIC = 0, RES_DYNAMIC };  
-  tTestCPUResourceMethod m_res_method;
-  cResourceCount resource_count;
-  tArray<double> d_resources;
+  eTestCPUResourceMethod m_res_method;
+  std::vector<std::pair<int, std::vector<double> > > * m_res;
+  int m_res_time_spent_offset;
+  int m_res_update;
+  cResourceCount m_resource_count;
 
   bool ProcessGestation(cAvidaContext& ctx, cCPUTestInfo& test_info, int cur_depth);
   bool TestGenome_Body(cAvidaContext& ctx, cCPUTestInfo& test_info, const cGenome& genome, int cur_depth);
 
+  // one copy of resources initialized from environment file
+  static std::vector<std::pair<int, std::vector<double> > > * s_resources;
+
   cTestCPU(); // @not_implemented
   cTestCPU(const cTestCPU&); // @not_implemented
   cTestCPU& operator=(const cTestCPU&); // @not_implemented
@@ -71,11 +85,10 @@
   inline int GetReceiveValue();
   inline const tArray<double>& GetResources();  
   inline void SetResource(int id, double new_level);
-  void InitResources();
-  void SetResourcesFromArray(const tArray<double> &resources);
-  void SetResourcesFromCell(int cell_x, int cell_y);
+  void InitResources(int res_method = RES_INITIAL, std::vector<std::pair<int, std::vector<double> > > * res = NULL, int update = 0, int time_spent_offset = 0);
+  void SetResourceUpdate(int update, bool round_to_closest = false);
   void ModifyResources(const tArray<double>& res_change);
-  cResourceCount& GetResourceCount() { return resource_count; }
+  cResourceCount& GetResourceCount() { return m_resource_count; }
 };
 
 #ifdef ENABLE_UNIT_TESTS
@@ -113,14 +126,12 @@
 
 inline const tArray<double>& cTestCPU::GetResources()
 {
-  if(m_res_method == RES_STATIC) return d_resources;
-  
-  return resource_count.GetResources();
+    return m_resource_count.GetResources();
 }
 
 inline void cTestCPU::SetResource(int id, double new_level)
 {
-  resource_count.Set(id, new_level);
+  m_resource_count.Set(id, new_level);
 }
 
 #endif

Modified: development/source/main/cEnvironment.cc
===================================================================
--- development/source/main/cEnvironment.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cEnvironment.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -195,8 +195,12 @@
         return false;
       new_process->SetDetectionError(var_value.AsDouble());
     }
-	else if (var_name == "string") {
-		new_process->SetMatchString(var_value);
+    else if (var_name == "clearsinput") {
+      if (!AssertInputInt(var_value, "clearsinput", var_type)) return false;
+      new_process->SetClearsInput( (bool)var_value.AsInt() );
+    }
+    else if (var_name == "string") {
+      new_process->SetMatchString(var_value);
 	}
     else {
       cerr << "Error: Unknown process variable '" << var_name
@@ -822,12 +826,19 @@
     
     // Mark this reaction as occuring...
     result.MarkReaction(cur_reaction->GetID());
+    
+    // If the a process has marked to clear the input queue...
+    if (result.GetClearInput())
+    {
+      break; //no other tasks should be allowed to complete
+    }
   }  
   
   return result.GetActive();
 }
 
 
+
 bool cEnvironment::TestRequisites(const tList<cReactionRequisite>& req_list,
                                   int task_count, const tArray<int>& reaction_count, const bool on_divide) const
 {
@@ -978,6 +989,13 @@
     }
     
     result.Lethal(cur_process->GetLethal());
+    
+    // If the reaction clears the input queue...
+    if (cur_process->GetClearsInput())
+    {
+      result.SetClearInput(true);
+      //break; //should other processes depending on that task be allowed to complete?
+    }
   }
 }
 

Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cOrganism.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -186,18 +186,21 @@
   
   tArray<double> res_change(resource_count.GetSize());
   tArray<int> insts_triggered;
+  bool clear_input = false;
 
   tBuffer<int>* received_messages_point = &m_received_messages;
   if (!m_world->GetConfig().SAVE_RECEIVED.Get()) received_messages_point = NULL;
   
   cTaskContext taskctx(m_interface, m_input_buf, m_output_buf, other_input_list, other_output_list, net_valid, 0, on_divide, received_messages_point);
-  m_phenotype.TestOutput(ctx, taskctx, resource_count, res_change, insts_triggered);
+  m_phenotype.TestOutput(ctx, taskctx, resource_count, res_change, insts_triggered, &  clear_input);
   m_interface->UpdateResources(res_change);
 
   for (int i = 0; i < insts_triggered.GetSize(); i++) {
     const int cur_inst = insts_triggered[i];
     m_hardware->ProcessBonusInst(ctx, cInstruction(cur_inst));
   }
+  
+  if (clear_input) m_input_buf.Clear();
 }
 
 
@@ -351,14 +354,18 @@
     m_output_buf.Add(value);
     tArray<double> res_change(resource_count.GetSize());
     tArray<int> insts_triggered;
+    bool clear_input;
+
     cTaskContext taskctx(m_interface, m_input_buf, m_output_buf, other_input_list, other_output_list, false, completed);
-    m_phenotype.TestOutput(ctx, taskctx, resource_count, res_change, insts_triggered);
+    m_phenotype.TestOutput(ctx, taskctx, resource_count, res_change, insts_triggered, &clear_input);
     m_interface->UpdateResources(res_change);
     
     for (int i = 0; i < insts_triggered.GetSize(); i++) {
       const int cur_inst = insts_triggered[i];
       m_hardware->ProcessBonusInst(ctx, cInstruction(cur_inst) );
     }
+    
+    if (clear_input) m_input_buf.Clear();
   }
   
   return true;

Modified: development/source/main/cOrganism.h
===================================================================
--- development/source/main/cOrganism.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cOrganism.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -181,8 +181,8 @@
   // --------  Input and Output Methods  --------
   void DoInput(const int value);
   void DoOutput(cAvidaContext& ctx, const int value, const bool on_divide = false);
+  void ClearInput() { m_input_buf.Clear(); }
 
-
   // --------  Divide Methods  --------
   bool Divide_CheckViable();
   bool ActivateDivide(cAvidaContext& ctx);

Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cPhenotype.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -66,6 +66,7 @@
   assert(last_fitness >= 0.0);
   assert(num_divides >= 0);
   assert(generation >= 0);
+  assert(cpu_cycles_used >= 0);  
   assert(time_used >= 0);
   assert(age >= 0);
   assert(child_copied_size >= 0);
@@ -131,6 +132,7 @@
   num_divides     = 0;
   generation      = parent_phenotype.generation;
   if (m_world->GetConfig().GENERATION_INC_METHOD.Get() != GENERATION_INC_BOTH) generation++;
+  cpu_cycles_used = 0;
   time_used       = 0;
   age             = 0;
   fault_desc      = "";
@@ -212,6 +214,7 @@
   // Setup other miscellaneous values...
   num_divides     = 0;
   generation      = 0;
+  cpu_cycles_used = 0;
   time_used       = 0;
   age             = 0;
   fault_desc      = "";
@@ -335,6 +338,7 @@
   // a second child on the divide.
   if (m_world->GetConfig().DIVIDE_METHOD.Get() == DIVIDE_METHOD_SPLIT) {
     gestation_start = 0;
+    cpu_cycles_used = 0;
     time_used = 0;
     neutral_metric += m_world->GetRandom().GetRandNormal();
   }
@@ -484,6 +488,7 @@
   num_divides     = 0;
   generation      = clone_phenotype.generation;
   if (m_world->GetConfig().GENERATION_INC_METHOD.Get() != GENERATION_INC_BOTH) generation++;
+  cpu_cycles_used = 0;
   time_used       = 0;
   age             = 0;
   fault_desc      = "";
@@ -531,9 +536,11 @@
 
 bool cPhenotype::TestOutput(cAvidaContext& ctx, cTaskContext& taskctx,
 			    const tArray<double>& res_in, tArray<double>& res_change,
-			    tArray<int>& insts_triggered)
+			    tArray<int>& insts_triggered, bool* clear_input)
 {
   assert(initialized == true);
+  assert(clear_input!= NULL);
+  *clear_input = false; // set default in case we bail in the middle
   
   taskctx.SetTaskStates(&m_task_states);
 
@@ -583,6 +590,8 @@
   //Kill any cells that did lethal reactions
   to_die = result.GetLethal();
 
+  *clear_input = result.GetClearInput();
+  
   return true;
 }
 
@@ -633,6 +642,7 @@
 
   fp << num_divides         << " ";
   fp << generation          << " ";
+  fp << cpu_cycles_used     << " ";
   fp << time_used           << " ";
   fp << age                 << " ";
   fp << neutral_metric      << " ";
@@ -709,6 +719,7 @@
 
   fp >> num_divides;
   fp >> generation;
+  fp >> cpu_cycles_used;
   fp >> time_used;
   fp >> age;
   fp >> neutral_metric;

Modified: development/source/main/cPhenotype.h
===================================================================
--- development/source/main/cPhenotype.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cPhenotype.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -71,14 +71,15 @@
   bool initialized;
 
   // 1. These are values calculated at the last divide (of self or offspring)
-  cMerit merit;          // Relative speed of CPU
-  int genome_length;     // Number of instructions in genome.
-  int copied_size;       // Instructions copied into genome.
-  int executed_size;     // Instructions executed from genome.
-  int gestation_time;    // CPU cycles to produce offspring (or be produced)
-  int gestation_start;   // Total instructions executed at last divide.
-  double fitness;        // Relative efective replication rate...
-  double div_type;	     // Type of the divide command used
+  cMerit merit;             // Relative speed of CPU
+  int genome_length;        // Number of instructions in genome.
+  int copied_size;          // Instructions copied into genome.
+  int executed_size;        // Instructions executed from genome.
+  int gestation_time;       // CPU cycles to produce offspring (or be produced),
+                            // including additional time costs of some instructions.
+  int gestation_start;      // Total instructions executed at last divide.
+  double fitness;           // Relative efective replication rate...
+  double div_type;          // Type of the divide command used
 
   // 2. These are "in progress" variables, updated as the organism operates
   double cur_bonus;               // Current Bonus
@@ -108,7 +109,8 @@
   // 4. Records from this organisms life...
   int num_divides;       // Total successful divides organism has produced.
   int generation;        // Number of birth events to original ancestor.
-  int time_used;         // Total CPU cycles consumed.
+  int cpu_cycles_used;   // Total CPU cycles consumed. @JEB
+  int time_used;         // Total CPU cycles consumed, including additional time costs of some instructions.
   int age;               // Number of updates organism has survived for.
   cString fault_desc;    // A description of the most recent error.
   double neutral_metric; // Undergoes drift (gausian 0,1) per generation
@@ -172,7 +174,7 @@
   bool TestInput(tBuffer<int>& inputs, tBuffer<int>& outputs);
   bool TestOutput(cAvidaContext& ctx, cTaskContext& taskctx,
                   const tArray<double>& res_in, tArray<double>& res_change,
-		  tArray<int>& insts_triggered);
+                  tArray<int>& insts_triggered, bool* clear_input);
 
   // State saving and loading, and printing...
   bool SaveState(std::ofstream& fp);
@@ -225,6 +227,7 @@
 
   int GetNumDivides() const { assert(initialized == true); return num_divides;}
   int GetGeneration() const { assert(initialized == true); return generation; }
+  int GetCPUCyclesUsed() const { assert(initialized == true); return cpu_cycles_used; }
   int GetTimeUsed()   const { assert(initialized == true); return time_used; }
   int GetAge()        const { assert(initialized == true); return age; }
   const cString& GetFault() const { assert(initialized == true); return fault_desc; }
@@ -279,6 +282,7 @@
   void ActivateTransposon(cCodeLabel & in_label) { assert(initialized == true); active_transposons.Push(in_label); }
 
   void IncAge()      { assert(initialized == true); age++; }
+  void IncCPUCyclesUsed() { assert(initialized == true); cpu_cycles_used++; }
   void IncTimeUsed(int i=1) { assert(initialized == true); time_used+=i; }
   void IncErrors()   { assert(initialized == true); cur_num_errors++; }
   void IncDonates()   { assert(initialized == true); cur_num_donates++; }

Modified: development/source/main/cReactionProcess.h
===================================================================
--- development/source/main/cReactionProcess.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cReactionProcess.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -40,6 +40,7 @@
   bool lethal;		 // Lethality of reaction
   cString match_string;	 // Bit string to match if this is a match string reaction
   int inst_id;           // Instruction to be triggered if reaction successful.
+  bool clears_input;     // Does execution of this task clear the input buffer
 
   // Resource detection
   cResource * detect;    // Resource Measured
@@ -62,6 +63,7 @@
     , conversion(1.0)
     , lethal(0)
     , inst_id(-1)
+    , clears_input(false)
     , detect(NULL)
     , detection_threshold(0.0)
     , detection_error(0.0)
@@ -78,6 +80,7 @@
   cResource* GetProduct() const { return product; }
   double GetConversion() const { return conversion; }
   int GetInstID() const { return inst_id; }
+  bool GetClearsInput() const { return clears_input; }
   bool GetLethal() const { return lethal; }
   cResource* GetDetect() const { return detect; }
   double GetDetectionThreshold() const { return detection_threshold; }
@@ -93,6 +96,7 @@
   void SetProduct(cResource* _in) { product = _in; }
   void SetConversion(double _in) { conversion = _in; }
   void SetInstID(int _in) { inst_id = _in; }
+  void SetClearsInput(bool _in) { clears_input = _in; }  
   void SetLethal(int _in) { lethal = _in; }
   void SetDetect(cResource* _in) { detect = _in; }
   void SetDetectionThreshold(double _in) { detection_threshold = _in; }

Modified: development/source/main/cReactionResult.cc
===================================================================
--- development/source/main/cReactionResult.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cReactionResult.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -25,6 +25,7 @@
   , insts_triggered(0)
   , lethal(false)
   , active_reaction(false)
+  , clear_input(false)
 {
 }
 

Modified: development/source/main/cReactionResult.h
===================================================================
--- development/source/main/cReactionResult.h	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cReactionResult.h	2007-02-01 18:28:11 UTC (rev 1245)
@@ -28,6 +28,7 @@
   tArray<int> insts_triggered;
   bool lethal;
   bool active_reaction;
+  bool clear_input;
 
 
   inline void ActivateReaction();
@@ -52,11 +53,14 @@
   void AddBonus(double value);
   void MultBonus(double value);
   void AddInst(int id);
+  
+  void SetClearInput(bool _in) { clear_input = _in; }
 
   double GetConsumed(int id);
   double GetProduced(int id);
   double GetDetected(int id);
-  bool GetLethal();
+  bool GetLethal();  
+  bool GetClearInput() { return clear_input; }
   bool ReactionTriggered(int id);
   bool TaskDone(int id);
   double TaskQuality(int id);

Modified: development/source/main/cResourceCount.cc
===================================================================
--- development/source/main/cResourceCount.cc	2007-02-01 16:48:32 UTC (rev 1244)
+++ development/source/main/cResourceCount.cc	2007-02-01 18:28:11 UTC (rev 1245)
@@ -133,7 +133,7 @@
   resource_count.SetAll(0.0);
   decay_rate.SetAll(0.0);
   inflow_rate.SetAll(0.0);
-  decay_precalc.SetAll(0.0);
+  decay_precalc.SetAll(1.0); // This is 1-inflow, so there should be no inflow by default, JEB
   inflow_precalc.SetAll(0.0);
   geometry.SetAll(nGeometry::GLOBAL);
   curr_grid_res_cnt.SetAll(0.0);




More information about the Avida-cvs mailing list