[Avida-SVN] r1888 - in development: Avida.xcodeproj source/actions source/cpu source/main source/tools tests tests/energy_asex_1000u tests/energy_asex_1000u/config tests/energy_asex_1000u/expected tests/energy_asex_1000u/expected/data tests/sex-asex/config tests/string_match_embed3/config

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Thu Aug 2 10:31:08 PDT 2007


Author: beckma24
Date: 2007-08-02 13:31:08 -0400 (Thu, 02 Aug 2007)
New Revision: 1888

Added:
   development/tests/energy_asex_1000u/
   development/tests/energy_asex_1000u/config/
   development/tests/energy_asex_1000u/config/avida.cfg
   development/tests/energy_asex_1000u/config/echo40.org
   development/tests/energy_asex_1000u/config/environment-5tasks.cfg
   development/tests/energy_asex_1000u/config/events-ConstResource.cfg
   development/tests/energy_asex_1000u/config/instset-TEST.cfg
   development/tests/energy_asex_1000u/expected/
   development/tests/energy_asex_1000u/expected/data/
   development/tests/energy_asex_1000u/expected/data/average.dat
   development/tests/energy_asex_1000u/expected/data/count.dat
   development/tests/energy_asex_1000u/expected/data/dominant.dat
   development/tests/energy_asex_1000u/expected/data/instruction.dat
   development/tests/energy_asex_1000u/expected/data/instruction_histogram.dat
   development/tests/energy_asex_1000u/expected/data/resource.dat
   development/tests/energy_asex_1000u/expected/data/sleep.dat
   development/tests/energy_asex_1000u/expected/data/stats.dat
   development/tests/energy_asex_1000u/expected/data/tasks.dat
   development/tests/energy_asex_1000u/expected/data/tasks_exe.dat
   development/tests/energy_asex_1000u/expected/data/time.dat
   development/tests/energy_deme_level_res/
Removed:
   development/tests/energy_asex_1000u/
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/actions/PrintActions.cc
   development/source/cpu/cHardwareBase.cc
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cTestCPU.cc
   development/source/cpu/cTestCPU.h
   development/source/cpu/cTestCPUInterface.cc
   development/source/cpu/cTestCPUInterface.h
   development/source/main/cDeme.cc
   development/source/main/cDeme.h
   development/source/main/cOrgInterface.h
   development/source/main/cOrganism.cc
   development/source/main/cPhenotype.cc
   development/source/main/cPhenotype.h
   development/source/main/cPopulation.cc
   development/source/main/cPopulation.h
   development/source/main/cPopulationCell.cc
   development/source/main/cPopulationInterface.cc
   development/source/main/cPopulationInterface.h
   development/source/main/cResource.cc
   development/source/main/cResource.h
   development/source/main/cResourceCount.cc
   development/source/main/cResourceCount.h
   development/source/main/cSpatialResCount.cc
   development/source/main/cStats.cc
   development/source/main/cStats.h
   development/source/tools/tArray.h
   development/tests/sex-asex/config/avida.cfg
   development/tests/string_match_embed3/config/avida.cfg
Log:
Added deme-level resources and consistency test

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/Avida.xcodeproj/project.pbxproj	2007-08-02 17:31:08 UTC (rev 1888)
@@ -211,6 +211,23 @@
 		};
 /* End PBXBuildRule section */
 
+/* Begin PBXBuildStyle section */
+		B512934E0C4FCA11004B0E41 /* Development */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = NO;
+			};
+			name = Development;
+		};
+		B512934F0C4FCA11004B0E41 /* Deployment */ = {
+			isa = PBXBuildStyle;
+			buildSettings = {
+				COPY_PHASE_STRIP = YES;
+			};
+			name = Deployment;
+		};
+/* End PBXBuildStyle section */
+
 /* Begin PBXContainerItemProxy section */
 		56F555DA0C3B36FC00E2E929 /* PBXContainerItemProxy */ = {
 			isa = PBXContainerItemProxy;
@@ -1771,6 +1788,12 @@
 		DCC30C4D0762532C008F7A48 /* Project object */ = {
 			isa = PBXProject;
 			buildConfigurationList = 702442D70859E0B00059BD9B /* Build configuration list for PBXProject "Avida" */;
+			buildSettings = {
+			};
+			buildStyles = (
+				B512934E0C4FCA11004B0E41 /* Development */,
+				B512934F0C4FCA11004B0E41 /* Deployment */,
+			);
 			hasScannedForEncodings = 0;
 			mainGroup = DCC30C490762532C008F7A48;
 			productRefGroup = DCC3164E07626CF3008F7A48 /* Products */;

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/actions/PrintActions.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -87,6 +87,7 @@
 STATS_OUT_FILE(PrintMarketData,             market.dat          );
 STATS_OUT_FILE(PrintSenseData,              sense.dat           );
 STATS_OUT_FILE(PrintSenseExeData,           sense_exe.dat       );
+STATS_OUT_FILE(PrintSleepData,              sleep.dat          );
 
 
 #define POP_OUT_FILE(METHOD, DEFAULT)                                                     /*  1 */ \
@@ -2354,16 +2355,17 @@
   action_lib->Register<cActionPrintMarketData>("PrintMarketData");
   action_lib->Register<cActionPrintSenseData>("PrintSenseData");
   action_lib->Register<cActionPrintSenseExeData>("PrintSenseExeData");
+  action_lib->Register<cActionPrintSleepData>("PrintSleepData");
 
   // Population Out Files
   action_lib->Register<cActionPrintPhenotypeData>("PrintPhenotypeData");
   action_lib->Register<cActionPrintPhenotypeStatus>("PrintPhenotypeStatus");
   action_lib->Register<cActionPrintDemeStats>("PrintDemeStats");
 	
-	//Coalescence Clade Actions
-	action_lib->Register<cActionPrintCCladeCounts>("PrintCCladeCounts");
+  //Coalescence Clade Actions
+  action_lib->Register<cActionPrintCCladeCounts>("PrintCCladeCounts");
   action_lib->Register<cActionPrintCCladeFitnessHistogram>("PrintCCladeFitnessHistogram");
-	action_lib->Register<cActionPrintCCladeRelativeFitnessHistogram>("PrintCCladeRelativeFitnessHistogram");
+  action_lib->Register<cActionPrintCCladeRelativeFitnessHistogram>("PrintCCladeRelativeFitnessHistogram");
 	
   
   // Processed Data
@@ -2378,8 +2380,8 @@
   action_lib->Register<cActionPrintDominantGenotype>("PrintDominantGenotype");
   action_lib->Register<cActionPrintDominantParasiteGenotype>("PrintDominantParasiteGenotype");
   action_lib->Register<cActionPrintDetailedFitnessData>("PrintDetailedFitnessData");
-	action_lib->Register<cActionPrintLogFitnessHistogram>("PrintLogFitnessHistogram");
-	action_lib->Register<cActionPrintRelativeFitnessHistogram>("PrintRelativeFitnessHistogram");
+  action_lib->Register<cActionPrintLogFitnessHistogram>("PrintLogFitnessHistogram");
+  action_lib->Register<cActionPrintRelativeFitnessHistogram>("PrintRelativeFitnessHistogram");
   action_lib->Register<cActionPrintGeneticDistanceData>("PrintGeneticDistanceData");
   action_lib->Register<cActionPrintPopulationDistanceData>("PrintPopulationDistanceData");
   action_lib->Register<cActionPrintDebug>("PrintDebug");
@@ -2391,7 +2393,7 @@
   action_lib->Register<cActionPrintViableTasksData>("PrintViableTasksData");
   action_lib->Register<cActionPrintTreeDepths>("PrintTreeDepths");
   
-	action_lib->Register<cActionPrintGenomicSiteEntropy>("PrintGenomicSiteEntropy");
+  action_lib->Register<cActionPrintGenomicSiteEntropy>("PrintGenomicSiteEntropy");
 	
   // Grid Information Dumps
   action_lib->Register<cActionDumpMemory>("DumpMemory");

Modified: development/source/cpu/cHardwareBase.cc
===================================================================
--- development/source/cpu/cHardwareBase.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/cpu/cHardwareBase.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -763,9 +763,9 @@
 #if INSTRUCTION_COSTS
   assert(cur_inst.GetOp() < inst_cost.GetSize());
   
-  // check avaliable energy first
+  // TODO:  Get rid of magic number. check avaliable energy first
   double energy_req = inst_energy_cost[cur_inst.GetOp()] * (organism->GetPhenotype().GetMerit().GetDouble() / 100.0); //compensate by factor of 100
-  
+
   if(m_world->GetConfig().ENERGY_ENABLED.Get() > 0 && energy_req > 0.0) {
     if(organism->GetPhenotype().GetStoredEnergy() >= energy_req) {
       inst_energy_cost[cur_inst.GetOp()] = 0;
@@ -782,13 +782,13 @@
           pop.AddBeginSleep(cellID,m_world->GetStats().GetUpdate());
         }
         pop.GetCell(cellID).GetOrganism()->SetSleeping(true);
-        pop.incNumAsleep();
+        m_world->GetStats().incNumAsleep(pop.GetCell(cellID).GetDemeID());
       }
     } else { // not enough energy
       return false;
     }
   }
-  
+
   // If first time cost hasn't been paid off...
   if (m_has_ft_costs && inst_ft_cost[cur_inst.GetOp()] > 0) {
     inst_ft_cost[cur_inst.GetOp()]--;       // dec cost

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/cpu/cHardwareCPU.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -4067,8 +4067,8 @@
     pop.AddEndSleep(organism->GetCellID(), m_world->GetStats().GetUpdate());
   }
   int cellID = organism->GetCellID();
-  pop.GetCell(cellID).GetOrganism()->SetSleeping(false);  //this instruction get executed at the end of a sleep cycle
-  pop.decNumAsleep();
+  organism->SetSleeping(false);  //this instruction get executed at the end of a sleep cycle
+  m_world->GetStats().decNumAsleep(pop.GetCell(cellID).GetDemeID());
   if(m_world->GetConfig().APPLY_ENERGY_METHOD.Get() == 2) {
     organism->GetPhenotype().RefreshEnergy();
     organism->GetPhenotype().ApplyToEnergyStore();

Modified: development/source/cpu/cTestCPU.cc
===================================================================
--- development/source/cpu/cTestCPU.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/cpu/cTestCPU.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -61,6 +61,9 @@
  
 void cTestCPU::InitResources(int res_method, std::vector<std::pair<int, std::vector<double> > > * res, int update, int time_spent_offset)
 {  
+  //FOR DEMES
+  m_deme_resource_count.SetSize(0);
+
   m_res_method = (eTestCPUResourceMethod)res_method;
   // Make sure it's valid
   if(res_method < 0 ||  res_method >= RES_LAST) {

Modified: development/source/cpu/cTestCPU.h
===================================================================
--- development/source/cpu/cTestCPU.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/cpu/cTestCPU.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -74,6 +74,7 @@
   int m_res_time_spent_offset;
   int m_res_update;
   cResourceCount m_resource_count;
+  cResourceCount m_deme_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);
@@ -103,7 +104,8 @@
   void ResetInputs(cAvidaContext& ctx);
 
   inline int GetReceiveValue();
-  inline const tArray<double>& GetResources();  
+  inline const tArray<double>& GetResources();
+  inline const tArray<double>& GetDemeResources(int deme_id);
   inline void SetResource(int id, double new_level);
   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);
@@ -149,6 +151,11 @@
     return m_resource_count.GetResources();
 }
 
+inline const tArray<double>& cTestCPU::GetDemeResources(int deme_id)
+{
+    return m_deme_resource_count.GetResources();
+}
+
 inline void cTestCPU::SetResource(int id, double new_level)
 {
   m_resource_count.Set(id, new_level);

Modified: development/source/cpu/cTestCPUInterface.cc
===================================================================
--- development/source/cpu/cTestCPUInterface.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/cpu/cTestCPUInterface.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -75,6 +75,10 @@
   return m_testcpu->GetResources();  
 }
 
+const tArray<double>& cTestCPUInterface::GetDemeResources(int deme_id) {
+  return m_testcpu->GetDemeResources(deme_id);
+}
+
 void cTestCPUInterface::UpdateResources(const tArray<double>& res_change)
 {
    m_testcpu->ModifyResources(res_change);

Modified: development/source/cpu/cTestCPUInterface.h
===================================================================
--- development/source/cpu/cTestCPUInterface.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/cpu/cTestCPUInterface.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -45,7 +45,9 @@
   virtual ~cTestCPUInterface() { ; }
 
   int GetCellID() { return -1; }
+  int GetDemeID() { return -1; }
   void SetCellID(int in_id) { ; }
+  void SetDemeID(int in_id) { ; }
 
   bool Divide(cAvidaContext& ctx, cOrganism* parent, cGenome& child_genome);
   cOrganism* GetNeighbor();
@@ -57,7 +59,9 @@
   tArray<int> GetInputs();
   int Debug();
   const tArray<double>& GetResources();
+  const tArray<double>& GetDemeResources(int deme_id);
   void UpdateResources(const tArray<double>& res_change);
+  void UpdateDemeResources(const tArray<double>& res_change) {;}
   void Die();
   void Kaboom(int distance);
   void SpawnDeme();

Modified: development/source/main/cDeme.cc
===================================================================
--- development/source/main/cDeme.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cDeme.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -22,6 +22,7 @@
  */
 
 #include "cDeme.h"
+#include "cResource.h"
 
 
 void cDeme::Setup(const tArray<int> & in_cells, int in_width)
@@ -61,9 +62,9 @@
 {
   birth_count = 0; 
   _age = 0;
+  deme_resource_count.ReinitializeResources();
 }
 
-
 /*! Replacing this deme's germline has the effect of changing the deme's lineage.
 There's still some work to do here; the lineage labels of the Genomes in the germline
 are all messed up.
@@ -73,3 +74,25 @@
 void cDeme::ReplaceGermline(const cGermline& germline) {
 	_germline = germline;
 }
+
+void cDeme::ModifyDemeResCount(const tArray<double> & res_change, const int absolute_cell_id) {
+  // find relative cell_id in deme resource count
+  const int relative_cell_id = absolute_cell_id % GetSize();  //assumes all demes are the same size
+  deme_resource_count.ModifyCell(res_change, relative_cell_id);
+}
+
+void cDeme::SetupDemeRes(int id, cResource * res, int verbosity) {
+  const double decay = 1.0 - res->GetOutflow();
+  //addjust the resources cell list pointer here if we want CELL env. commands to be replicated in each deme
+  
+  deme_resource_count.Setup(id, 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(),
+                           verbosity);
+}

Modified: development/source/main/cDeme.h
===================================================================
--- development/source/main/cDeme.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cDeme.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -29,6 +29,7 @@
 #include "cResourceCount.h"
 #include "cStringList.h"
 
+class cResource;
 
 /*! Demes are groups of cells in the population that are somehow bound together
 as a unit.  The deme object is used from within cPopulation to manage these 
@@ -48,11 +49,9 @@
   cDeme(const cDeme&); // @not_implemented
   
   cResourceCount deme_resource_count; //!< Resources available to the deme
-  cStringList deme_resource_names; //!< Name of resources used by this deme
-
   
 public:
-  cDeme() : width(0), birth_count(0), org_count(0), _age(0) { ; }
+  cDeme() : width(0), birth_count(0), org_count(0), _age(0), deme_resource_count(0) { ; }
   ~cDeme() { ; }
 
   void Setup(const tArray<int>& in_cells, int in_width = -1);
@@ -90,7 +89,13 @@
     updates since the last time Reset() was called. */
   int GetAge() const { return _age; }
   
+  const cResourceCount& GetDemeResourceCount() const { return deme_resource_count; }
+  void SetDemeResourceCount(const cResourceCount in_res) { deme_resource_count = in_res; }
+  void ResizeSpatialGrids(const int in_x, const int in_y) { deme_resource_count.ResizeSpatialGrids(in_x, in_y); }
+  void ModifyDemeResCount(const tArray<double> & res_change, const int absolute_cell_id);
+  void SetupDemeRes(int id, cResource * res, int verbosity);
+  void UpdateDemeRes() { deme_resource_count.GetResources(); }
+  void Update(double time_step) { deme_resource_count.Update(time_step); }
 };
 
 #endif
-

Modified: development/source/main/cOrgInterface.h
===================================================================
--- development/source/main/cOrgInterface.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cOrgInterface.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -53,7 +53,9 @@
   virtual ~cOrgInterface() { ; }
 
   virtual int GetCellID() = 0;
+  virtual int GetDemeID() = 0;
   virtual void SetCellID(int in_id) = 0;
+  virtual void SetDemeID(int in_id) = 0;
 
   virtual bool Divide(cAvidaContext& ctx, cOrganism* parent, cGenome& child_genome) = 0;
   virtual cOrganism* GetNeighbor() = 0;
@@ -66,7 +68,9 @@
   virtual tArray<int> GetInputs() = 0;
   virtual int Debug() = 0;
   virtual const tArray<double>& GetResources() = 0;
+  virtual const tArray<double>& GetDemeResources(int deme_id) = 0;  
   virtual void UpdateResources(const tArray<double>& res_change) = 0;
+  virtual void UpdateDemeResources(const tArray<double>& res_change) = 0;
   virtual void Die() = 0;
   virtual void Kaboom(int distance) = 0;
   virtual void SpawnDeme() = 0;

Modified: development/source/main/cOrganism.cc
===================================================================
--- development/source/main/cOrganism.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cOrganism.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -37,6 +37,7 @@
 #include "cInjectGenotype.h"
 #include "cInstSet.h"
 #include "cOrgSinkMessage.h"
+#include "cPopulationCell.h"
 #include "cPopulation.h"
 #include "cStringUtil.h"
 #include "cTaskContext.h"
@@ -67,6 +68,7 @@
   , m_test_receive_pos(0)
   , m_max_executed(-1)
   , m_is_running(false)
+  , m_is_sleeping(false)
   , m_net(NULL)
 {
   // Initialization of structures...
@@ -179,7 +181,9 @@
                          const int value,
                          const bool on_divide)
 {
-  const tArray<double> & resource_count = m_interface->GetResources();
+  const int deme_id = m_interface->GetDemeID();
+  const tArray<double> & global_resource_count = m_interface->GetResources();
+  const tArray<double> & deme_resource_count = m_interface->GetDemeResources(deme_id);
   
   tList<tBuffer<int> > other_input_list;
   tList<tBuffer<int> > other_output_list;
@@ -216,7 +220,8 @@
   // if on IO add value to m_output_buf, if on divide don't need to
   if(!on_divide) output_buffer.Add(value);
   
-  tArray<double> res_change(resource_count.GetSize());
+  tArray<double> global_res_change(global_resource_count.GetSize());
+  tArray<double> deme_res_change(deme_resource_count.GetSize());
   tArray<int> insts_triggered;
   
   tBuffer<int>* received_messages_point = &m_received_messages;
@@ -224,8 +229,17 @@
   
   cTaskContext taskctx(m_interface, input_buffer, output_buffer, other_input_list, 
                        other_output_list, net_valid, 0, on_divide, received_messages_point);
-  bool task_completed = m_phenotype.TestOutput(ctx, taskctx, resource_count, res_change, insts_triggered);
+                       
+  //combine global and deme resource counts
+  const tArray<double> globalAndDeme_resource_count = global_resource_count + deme_resource_count;
+  tArray<double> globalAndDeme_res_change = global_res_change + deme_res_change;
   
+  bool task_completed = m_phenotype.TestOutput(ctx, taskctx, globalAndDeme_resource_count, globalAndDeme_res_change, insts_triggered);
+  
+  //disassemble global and deme resource counts
+  global_res_change = globalAndDeme_res_change.Subset(0, global_res_change.GetSize());
+  deme_res_change = globalAndDeme_res_change.Subset(global_res_change.GetSize(), globalAndDeme_res_change.GetSize());
+    
   if(m_world->GetConfig().ENERGY_ENABLED.Get() && m_world->GetConfig().APPLY_ENERGY_METHOD.Get() == 1 && task_completed) {
     m_phenotype.RefreshEnergy();
     m_phenotype.ApplyToEnergyStore();
@@ -235,7 +249,10 @@
     }
   }
  
-  m_interface->UpdateResources(res_change);
+  m_interface->UpdateResources(global_res_change);
+  
+  //update deme resources
+  m_interface->UpdateDemeResources(deme_res_change);  
 
   //if(m_world->GetConfig().CLEAR_ON_OUTPUT.Get()) input_buffer.Clear();  @JEB Not fully implemented 
 
@@ -243,10 +260,8 @@
     const int cur_inst = insts_triggered[i];
     m_hardware->ProcessBonusInst(ctx, cInstruction(cur_inst));
   }
-  
 }
 
-
 void cOrganism::NetGet(cAvidaContext& ctx, int& value, int& seq)
 {
   assert(m_net);

Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cPhenotype.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -942,7 +942,7 @@
   cReactionResult result(num_resources, num_tasks, num_reactions);
 			
   // Run everything through the environment.
-  bool found = env.TestOutput(ctx, result, taskctx, eff_task_count, cur_reaction_count, res_in);
+  bool found = env.TestOutput(ctx, result, taskctx, eff_task_count, cur_reaction_count, res_in); //NEED different eff_task_count and cur_reaction_count for deme resource
 
   // If nothing was found, stop here.
   if (found == false) {

Modified: development/source/main/cPhenotype.h
===================================================================
--- development/source/main/cPhenotype.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cPhenotype.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -465,7 +465,6 @@
     bool operator()(const cPhenotype* lhs, const cPhenotype* rhs) const
       {return *lhs < *rhs;}   // operator< in cPhenotype
   };
-  
 };
 
 

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cPopulation.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -48,6 +48,7 @@
 #include "cPopulationCell.h"
 #include "cProbSchedule.h"
 #include "cResource.h"
+#include "cResourceCount.h"
 #include "cSaleItem.h"
 #include "cSpecies.h"
 #include "cStats.h"
@@ -71,9 +72,8 @@
 cPopulation::cPopulation(cWorld* world)
 : m_world(world)
 , schedule(NULL)
-, resource_count(world->GetEnvironment().GetResourceLib().GetSize())
+//, resource_count(world->GetEnvironment().GetResourceLib().GetSize())
 , birth_chamber(world)
-, numAsleep(0)
 , environment(world->GetEnvironment())
 , num_organisms(0)
 , sync_events(false)
@@ -119,7 +119,7 @@
   
   // Allocate the cells, resources, and market.
   cell_array.Resize(num_cells);
-  resource_count.ResizeSpatialGrids(world_x, world_y);
+//  resource_count.ResizeSpatialGrids(world_x, world_y);
   market.Resize(MARKET_SIZE);
   
   // Setup the cells.  Do things that are not dependent upon topology here.
@@ -178,11 +178,32 @@
   // Setup the resources...
   const cResourceLib & resource_lib = environment.GetResourceLib();
   int global_res_index = -1;
-  for (int i = 0; i < resource_lib.GetSize(); i++) {
+  int deme_res_index = -1;
+  int num_deme_res = 0;
+
+  //setting size of global and deme-level resources
+  for(int i = 0; i < resource_lib.GetSize(); i++) {
     cResource * res = resource_lib.GetResource(i);
+    if(res->GetDemeResource())
+      num_deme_res++;
+  }
+  
+  cResourceCount tmp_res_count(resource_lib.GetSize() - num_deme_res);
+  resource_count = tmp_res_count;
+  resource_count.ResizeSpatialGrids(world_x, world_y);
+  
+  for(int i = 0; i < GetNumDemes(); i++) {
+    cResourceCount tmp_deme_res_count(num_deme_res);
+    GetDeme(i).SetDemeResourceCount(tmp_deme_res_count);
+    //TODO: make sure grid is the right grid/size
+    //GetDeme(i).GetDemeResourceCount().ResizeSpatialGrids(world_x, world_y);
 
-    // If the resource is not a deme resource set it up
+    GetDeme(i).ResizeSpatialGrids(deme_size_x, deme_size_y);
+//    GetDeme(i).GetDemeResourceCount().
+  }
 
+  for (int i = 0; i < resource_lib.GetSize(); i++) {
+    cResource * res = resource_lib.GetResource(i);
     if (!res->GetDemeResource()) {
       global_res_index++;
       const double decay = 1.0 - res->GetOutflow();
@@ -197,21 +218,31 @@
                            res->GetOutflowY2(), res->GetCellListPtr(),
                            world->GetVerbosity() );
       m_world->GetStats().SetResourceName(global_res_index, res->GetName());
+    } else if(res->GetDemeResource()) {
+      deme_res_index++;
+      for(int j = 0; j < GetNumDemes(); j++) {
+        GetDeme(j).SetupDemeRes(deme_res_index, res, world->GetVerbosity());
+        // could add deme resources to global resource stats here
+      }
+    } else {
+      cerr<< "ERROR: Resource \"" << res->GetName() <<"\"is not a global or deme resource.  Exit";
+      exit(1);
     }
   }
-  
+
   // Load a clone if one is provided, otherwise setup start organism.
   if (m_world->GetConfig().CLONE_FILE.Get() == "-" || m_world->GetConfig().CLONE_FILE.Get() == "") {
     cGenome start_org(0);
     const cString& filename = m_world->GetConfig().START_CREATURE.Get();
-    
+
     if (filename != "-" && filename != "") {
       if (!cGenomeUtil::LoadGenome(filename, world->GetHardwareManager().GetInstSet(), start_org)) {
         cerr << "Error: Unable to load start creature" << endl;
         exit(-1);
       }
-      
-      if (start_org.GetSize() != 0) Inject(start_org);
+      if (start_org.GetSize() != 0) {
+        Inject(start_org);
+      }
       else cerr << "Warning: Zero length start organism, not injecting into initial population." << endl;
     } else {
       cerr << "Warning: No start organism specified." << endl;
@@ -416,8 +447,7 @@
   
   // Setup the inputs in the target cell.
   environment.SetupInputs(ctx, target_cell.input_array);
-  
-  
+    
   // Precalculate the phenotype if requested
   int pc_phenotype = m_world->GetConfig().PRECALC_PHENOTYPE.Get();
   if (pc_phenotype){
@@ -434,8 +464,7 @@
     delete test_cpu;
   }
   // Update the archive...
-  
-  
+      
   in_genotype->AddOrganism();
   
   if (old_genotype != NULL) {
@@ -591,7 +620,7 @@
 
   if(GetCell(cellID).GetOrganism()->IsSleeping()) {
     GetCell(cellID).GetOrganism()->SetSleeping(false);
-    decNumAsleep();
+    m_world->GetStats().decNumAsleep(GetCell(cellID).GetDemeID());
   }
   if(m_world->GetConfig().LOG_SLEEP_TIMES.Get() == 1) {
     if(sleep_log[cellID].Size() > 0) {
@@ -1441,6 +1470,7 @@
   cDataFile & df_donor = m_world->GetDataFile("deme_donor.dat");
   cDataFile & df_receiver = m_world->GetDataFile("deme_receiver.dat");
   cDataFile & df_mut_rates = m_world->GetDataFile("deme_mut_rates.dat");
+  cDataFile & df_resources = m_world->GetDataFile("deme_resources.dat");
   
   df_fit.WriteComment("Average fitnesses for each deme in the population");
   df_life_fit.WriteComment("Average life fitnesses for each deme in the population");
@@ -1450,6 +1480,7 @@
   df_donor.WriteComment("Num orgs doing doing a donate for each deme in population");
   df_receiver.WriteComment("Num orgs doing receiving a donate for each deme in population");
   df_mut_rates.WriteComment("Average mutation rates for organisms in each deme");
+  df_resources.WriteComment("Avida deme resource data");
   
   df_fit.WriteTimeStamp();
   df_life_fit.WriteTimeStamp();
@@ -1459,6 +1490,7 @@
   df_donor.WriteTimeStamp();
   df_receiver.WriteTimeStamp();
   df_mut_rates.WriteTimeStamp();
+  df_resources.WriteTimeStamp();
   
   df_fit.Write(stats.GetUpdate(), "update");
   df_life_fit.Write(stats.GetUpdate(), "update");
@@ -1468,6 +1500,7 @@
   df_donor.Write(stats.GetUpdate(), "update");
   df_receiver.Write(stats.GetUpdate(), "update");
   df_mut_rates.Write(stats.GetUpdate(), "update");
+  df_resources.Write(stats.GetUpdate(), "update");
   
   const int num_inst = m_world->GetNumInstructions();
   const int num_task = environment.GetNumTasks();
@@ -1543,6 +1576,17 @@
       df_inst.Write((int) single_deme_inst[j].Sum(), comment);
     }
     df_inst.Endl();
+    
+    GetDeme(deme_id).UpdateDemeRes();
+    cResourceCount res = GetDeme(deme_id).GetDemeResourceCount();
+    for(int j = 0; j < res.GetSize(); j++) {
+      const char * tmp = res.GetResName(j);
+      df_resources.Write(res.Get(j), cStringUtil::Stringf("Deme %d Resource %s", deme_id, tmp)); //comment);
+      
+      if ((res.GetResourcesGeometry())[j] != nGeometry::GLOBAL) {
+        PrintDemeSpatialResData(res, j, deme_id);
+      }
+    }
   } 
   
   df_mut_rates.Write(total_mut_rate.Ave(), "Average deme mutation rate averaged across Demes.");
@@ -1555,9 +1599,34 @@
   df_donor.Endl();
   df_receiver.Endl();
   df_mut_rates.Endl();
+  df_resources.Endl();
 }
 
+// Write spatial data to a file that can easily be read into Matlab
+void cPopulation::PrintDemeSpatialResData( cResourceCount res, const int i, const int deme_id){
+  const char* tmpResName = res.GetResName(i);
+  cString tmpfilename = cStringUtil::Stringf( "deme_spacial_resource_%s_%i.m", tmpResName, deme_id );
+//  tmpfilename +=  res.GetResName(i) + ".m";
+  cDataFile& df = m_world->GetDataFile(tmpfilename);
+  cString UpdateStr = cStringUtil::Stringf( "deme_%07i_", deme_id ) + res.GetResName(i) + 
+                      cStringUtil::Stringf( "_%07i", m_world->GetStats().GetUpdate() ) + " = [ ...";
 
+  df.WriteRaw(UpdateStr);
+
+  cSpatialResCount sp_res = res.GetSpatialResource(i);
+  int gridsize = sp_res.GetSize();
+  int xsize = m_world->GetConfig().WORLD_X.Get();
+
+  // write grid to file
+
+  for (int j = 0; j < gridsize; j++) {
+    df.WriteBlockElement(sp_res.GetAmount(j), j, xsize);
+  }
+  df.WriteRaw("];");
+}
+
+
+
 /**
 * This function is responsible for adding an organism to a given lineage,
  * and setting the organism's lineage label and the lineage pointer.
@@ -1745,9 +1814,12 @@
   if (cur_org->GetPhenotype().GetToDelete() == true) {
     delete cur_org;
   }
-   m_world->GetStats().IncExecuted();
- resource_count.Update(step_size);
- }
+  m_world->GetStats().IncExecuted();
+  resource_count.Update(step_size);
+  for(int i = 0; i < GetNumDemes(); i++) {
+    GetDeme(i).Update(step_size);
+  }
+}
 
 
 void cPopulation::UpdateOrganismStats()
@@ -1918,6 +1990,12 @@
   stats.SetResources(resource_count.GetResources());
   stats.SetSpatialRes(resource_count.GetSpatialRes());
   stats.SetResourcesGeometry(resource_count.GetResourcesGeometry());
+  
+  //TODO: update deme resource  (what calls DoOutput)
+  
+  for(int i = 0; i < GetNumDemes(); i++) {
+    GetDeme(i).UpdateDemeRes();
+  }
 }
 
 
@@ -2433,6 +2511,12 @@
   resource_count.ModifyCell(res_change, cell_id);
 }
 
+void cPopulation::UpdateDemeCellResources(const tArray<double> & res_change, 
+                                          const int cell_id)
+{
+  GetDeme(GetCell(cell_id).GetDemeID()).ModifyDemeResCount(res_change, cell_id);
+}
+
 void cPopulation::SetResource(int id, double new_level)
 {
   resource_count.Set(id, new_level);
@@ -2582,10 +2666,7 @@
   // BB - Don't need to fix metabolic rate here, only on birth
 
   phenotype.SetMerit( cMerit(new_genotype->GetTestMerit(ctx)) );
-  
-  // @DMB - this appears to be debugging output
-  //cerr<<"initial energy: " << phenotype.GetStoredEnergy() <<endl<<"initial Merit: "<<phenotype.GetMerit().GetDouble()<<endl;
-  
+    
   // @CAO are these really needed?
   phenotype.SetLinesCopied( new_genotype->GetTestCopiedSize(ctx) );
   phenotype.SetLinesExecuted( new_genotype->GetTestExecutedSize(ctx) );
@@ -2776,7 +2857,6 @@
   if (new_merit <= old_merit) {
 	  phenotype.SetIsDonorCur(); }  
   else  { phenotype.SetIsReceiver(); } 
-  std::cerr<<"[cPopulation::UpdateMerit] phenotype.GetMerit() = "<<phenotype.GetMerit()<< " new_merit = " << new_merit << std::endl; 
   schedule->Adjust(cell_id, phenotype.GetMerit());
   
   return true;

Modified: development/source/main/cPopulation.h
===================================================================
--- development/source/main/cPopulation.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cPopulation.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -95,7 +95,6 @@
   tArray<tList<cSaleItem> > market;   // list of lists of items for sale, each list goes with 1 label
 
   tVector<pair<int,int> > *sleep_log;
-  int numAsleep;
   
   // Data Tracking...
   tList<cPopulationCell> reaper_queue; // Death order in some mass-action runs
@@ -181,7 +180,8 @@
   void CopyDeme(int deme1_id, int deme2_id);
   void SpawnDeme(int deme1_id, int deme2_id=-1);
   void PrintDemeStats();
-
+  void PrintDemeSpatialResData( cResourceCount res, const int i, const int deme_id);
+  
   // Print donation stats
   void PrintDonationStats();
 
@@ -214,11 +214,14 @@
   cPopulationCell& GetCell(int in_num);
   const tArray<double>& GetResources() const { return resource_count.GetResources(); }
   const tArray<double>& GetCellResources(int cell_id) const { return resource_count.GetCellResources(cell_id); }
+  const tArray<double>& GetDemeResources(int deme_id) { return GetDeme(deme_id).GetDemeResourceCount().GetResources(); }
   cBirthChamber& GetBirthChamber(int id) { (void) id; return birth_chamber; }
 
   void UpdateResources(const tArray<double>& res_change);
   void UpdateResource(int id, double change);
   void UpdateCellResources(const tArray<double>& res_change, const int cell_id);
+  void UpdateDemeCellResources(const tArray<double>& res_change, const int cell_id);
+
   void SetResource(int id, double new_level);
   double GetResource(int id) const { return resource_count.Get(id); }
   cResourceCount& GetResourceCount() { return resource_count; }
@@ -240,10 +243,6 @@
   void AddEndSleep(int cellID, int end_time);
  
   tVector<pair<int,int> > getCellSleepLog(int i) { return sleep_log[i]; }
-  
-  int getNumAsleep() { return numAsleep; }
-  void incNumAsleep() { numAsleep++; }
-  void decNumAsleep() { numAsleep--; }
 };
 
 

Modified: development/source/main/cPopulationCell.cc
===================================================================
--- development/source/main/cPopulationCell.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cPopulationCell.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -183,6 +183,7 @@
 
   // Adjust the organism's attributes to match this cell.
   organism->GetOrgInterface().SetCellID(cell_id);
+  organism->GetOrgInterface().SetDemeID(deme_id);
 }
 
 cOrganism * cPopulationCell::RemoveOrganism()

Modified: development/source/main/cPopulationInterface.cc
===================================================================
--- development/source/main/cPopulationInterface.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cPopulationInterface.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -109,11 +109,21 @@
   return m_world->GetPopulation().GetCellResources(m_cell_id);
 }
 
+const tArray<double> & cPopulationInterface::GetDemeResources(int deme_id)
+{
+  return m_world->GetPopulation().GetDemeResources(deme_id);
+}
+
 void cPopulationInterface::UpdateResources(const tArray<double> & res_change)
 {
   return m_world->GetPopulation().UpdateCellResources(res_change, m_cell_id);
 }
 
+void cPopulationInterface::UpdateDemeResources(const tArray<double> & res_change)
+{
+  return m_world->GetPopulation().UpdateDemeCellResources(res_change, m_cell_id);
+}
+
 void cPopulationInterface::Die()
 {
   cPopulationCell & cell = m_world->GetPopulation().GetCell(m_cell_id);

Modified: development/source/main/cPopulationInterface.h
===================================================================
--- development/source/main/cPopulationInterface.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cPopulationInterface.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -44,17 +44,20 @@
 private:
   cWorld* m_world;
   int m_cell_id;
+  int m_deme_id;
 
   cPopulationInterface(); // @not_implemented
   cPopulationInterface(const cPopulationInterface&); // @not_implemented
   cPopulationInterface operator=(const cPopulationInterface&); // @not_implemented
   
 public:
-  cPopulationInterface(cWorld* world) : m_world(world), m_cell_id(-1) { ; }
+  cPopulationInterface(cWorld* world) : m_world(world), m_cell_id(-1), m_deme_id(-1) { ; }
   virtual ~cPopulationInterface() { ; }
 
   int GetCellID() { return m_cell_id; }
+  int GetDemeID() { return m_deme_id; }
   void SetCellID(int in_id) { m_cell_id = in_id; }
+  void SetDemeID(int in_id) { m_deme_id = in_id; }
 
   bool Divide(cAvidaContext& ctx, cOrganism* parent, cGenome& child_genome);
   cOrganism* GetNeighbor();
@@ -67,7 +70,9 @@
   tArray<int> GetInputs();
   int Debug();
   const tArray<double>& GetResources();
+  const tArray<double>& GetDemeResources(int deme_id);
   void UpdateResources(const tArray<double>& res_change);
+  void UpdateDemeResources(const tArray<double>& res_change);
   void Die();
   void Kaboom(int distance);
   void SpawnDeme();

Modified: development/source/main/cResource.cc
===================================================================
--- development/source/main/cResource.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cResource.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -89,16 +89,13 @@
      }
 }
 
-bool cResource::SetDemeResource(cString _deme_resource)
-
 /* Set if the resource is going to be accessable by demes */
-
-{
+bool cResource::SetDemeResource(cString _deme_resource) {
   _deme_resource.ToLower();
-  if ((_deme_resource == "false") || (_deme_resource = "0")) {
+  if ((_deme_resource == "false") || (_deme_resource == "0")) {
     deme_resource = false;
     return(true);
-  } else if ((_deme_resource == "true") || (_deme_resource = "1")) {
+  } else if ((_deme_resource == "true") || (_deme_resource == "1")) {
     deme_resource = true;
     return(true);
   } else {

Modified: development/source/main/cResource.h
===================================================================
--- development/source/main/cResource.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cResource.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -23,7 +23,7 @@
  *
  */
 
-/*! Classes to held global and local information about a given resource */
+/*! Classes to hold global and local information about a given resource */
 
 #ifndef cResource_h
 #define cResource_h

Modified: development/source/main/cResourceCount.cc
===================================================================
--- development/source/main/cResourceCount.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cResourceCount.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -24,6 +24,7 @@
  */
 
 #include "cResourceCount.h"
+#include "cResource.h"
 
 #include "nGeometry.h"
 
@@ -114,6 +115,8 @@
 }
 
 const cResourceCount &cResourceCount::operator=(const cResourceCount &rc) {
+  resource_name = rc.resource_name;
+  resource_initial = rc.resource_initial;
   resource_count = rc.resource_count;
   decay_rate = rc.decay_rate;
   inflow_rate = rc.inflow_rate;
@@ -131,6 +134,8 @@
 
 void cResourceCount::SetSize(int num_resources)
 {
+  resource_name.ResizeClear(num_resources);
+  resource_initial.ResizeClear(num_resources);
   resource_count.ResizeClear(num_resources);
   decay_rate.ResizeClear(num_resources);
   inflow_rate.ResizeClear(num_resources);
@@ -143,6 +148,8 @@
   curr_grid_res_cnt.ResizeClear(num_resources);
   curr_spatial_res_cnt.ResizeClear(num_resources);
 
+  resource_name.SetAll("");
+  resource_initial.SetAll(0.0);
   resource_count.SetAll(0.0);
   decay_rate.SetAll(0.0);
   inflow_rate.SetAll(0.0);
@@ -150,6 +157,7 @@
   inflow_precalc.SetAll(0.0);
   geometry.SetAll(nGeometry::GLOBAL);
   curr_grid_res_cnt.SetAll(0.0);
+  //DO spacial resources need to be set to zero?
 }
 
 cResourceCount::~cResourceCount()
@@ -203,9 +211,10 @@
     exit(2);
   }
 
+
   /* If the verbose flag is set print out information about resources */
-
-  if (verbosity_level > VERBOSE_NORMAL) {
+  verbosity = verbosity_level;
+  if (verbosity > VERBOSE_NORMAL) {
     cout << "Setting up resource " << name
          << "(" << geo_name 
          << ") with initial quatity=" << initial
@@ -233,6 +242,8 @@
 
   /* recource_count gets only the values for global resources */
 
+  resource_name[id] = name;
+  resource_initial[id] = initial;
   if (in_geometry == nGeometry::GLOBAL) {
     resource_count[id] = initial;
     spatial_resource_count[id].RateAll(0);
@@ -368,12 +379,25 @@
   }
 }
 
+double cResourceCount::Get(int id) const
+{
+  assert(id < resource_count.GetSize());
+  if(geometry[id] == nGeometry::GLOBAL) {
+    return resource_count[id];
+  } //else return spacial resource sum
+  return spatial_resource_count[id].SumAll();
+}
 
 void cResourceCount::Set(int id, double new_level)
 {
   assert(id < resource_count.GetSize());
-
-  resource_count[id] = new_level;
+  if(geometry[id] == nGeometry::GLOBAL) {
+    resource_count[id] = new_level;
+  } else {
+    for(int i = 0; i < spatial_resource_count[id].GetSize(); i++) {
+      spatial_resource_count[id].SetCellAmount(i, new_level/spatial_resource_count[id].GetSize());
+    }
+  }
 }
 
 void cResourceCount::ResizeSpatialGrids(int in_x, int in_y)
@@ -430,3 +454,9 @@
     }
   }
 }
+
+void cResourceCount::ReinitializeResources(){
+  for(int i = 0; i < resource_name.GetSize(); i++) {
+    Set(i, resource_initial[i]);
+  }
+}

Modified: development/source/main/cResourceCount.h
===================================================================
--- development/source/main/cResourceCount.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cResourceCount.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -45,6 +45,8 @@
 class cResourceCount
 {
 private:
+  mutable tArray<cString> resource_name;
+  mutable tArray<double> resource_initial;  // Initial quantity of each resource
   mutable tArray<double> resource_count;  // Current quantity of each resource
   tArray<double> decay_rate;      // Multiplies resource count at each step
   tArray<double> inflow_rate;     // An increment for resource at each step
@@ -54,6 +56,7 @@
   mutable tArray<cSpatialResCount> spatial_resource_count;
   mutable tArray<double> curr_grid_res_cnt;
   mutable tArray< tArray<double> > curr_spatial_res_cnt;
+  int verbosity;
 
   // Setup the update process to use lazy evaluation...
   mutable double update_time;     // Portion of an update compleated...
@@ -94,16 +97,15 @@
   void Modify(int id, double change);
   void ModifyCell(const tArray<double> & res_change, int cell_id);
   void Set(int id, double new_level);
-  double Get(int id) const
-  {
-    assert(id < resource_count.GetSize());
-    return resource_count[id];
-  }
+  double Get(int id) const;
   void ResizeSpatialGrids(int in_x, int in_y);
   cSpatialResCount GetSpatialResource(int id) { return spatial_resource_count[id]; }
+  void ReinitializeResources();
+  cString GetResName(int id) { return resource_name[id]; }
 };
 
 
+
 #ifdef ENABLE_UNIT_TESTS
 namespace nResourceCount {
   /**

Modified: development/source/main/cSpatialResCount.cc
===================================================================
--- development/source/main/cSpatialResCount.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cSpatialResCount.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -231,9 +231,11 @@
 
 /* Set the rate variable for one element using the array index */
 
-void cSpatialResCount::Rate(int x, double ratein) const { 
+void cSpatialResCount::Rate(int x, double ratein) const {
   if (x >= 0 && x < grid.GetSize()) {
     grid[x].Rate(ratein);
+  } else {
+    assert(false); // x not valid id
   }
 }
 
@@ -242,6 +244,8 @@
 void cSpatialResCount::Rate(int x, int y, double ratein) const { 
   if (x >= 0 && x < world_x && y>= 0 && y < world_y) {
     grid[y * world_x + x].Rate(ratein);
+  } else {
+    assert(false); // x or y not valid id
   }
 }
 
@@ -251,6 +255,8 @@
 void cSpatialResCount::State(int x) { 
   if (x >= 0 && x < grid.GetSize()) {
     grid[x].State();
+  } else {
+    assert(false); // x not valid id
   }
 }
 
@@ -260,6 +266,8 @@
 void cSpatialResCount::State(int x, int y) { 
   if (x >= 0 && x < world_x && y >= 0 && y < world_y) {
     grid[y*world_x + x].State();
+  } else {
+    assert(false); // x or y not valid id
   }
 }
 

Modified: development/source/main/cStats.cc
===================================================================
--- development/source/main/cStats.cc	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cStats.cc	2007-08-02 17:31:08 UTC (rev 1888)
@@ -29,6 +29,7 @@
 #include "cEnvironment.h"
 #include "cHardwareManager.h"
 #include "cInstSet.h"
+#include "cPopulation.h"
 #include "cStringUtil.h"
 #include "cWorld.h"
 #include "cWorldDriver.h"
@@ -208,6 +209,10 @@
 
   
   genotype_map.Resize( m_world->GetConfig().WORLD_X.Get() * m_world->GetConfig().WORLD_Y.Get() );
+
+  numAsleep.Resize(m_world->GetConfig().NUM_DEMES.Get());
+  numAsleep.SetAll(0);
+
   SetupPrintDatabase();
 }
 
@@ -1007,3 +1012,17 @@
   }
   df.Endl();
 }
+
+void cStats::PrintSleepData(const cString& filename){
+  cDataFile& df = m_world->GetDataFile(filename);
+
+  df.WriteComment( "Number of organisms sleeping\n" );
+  df.WriteComment("total number of organisms sleeping" );
+  
+  df.Write( GetUpdate(), "update" );
+    
+  for( int i=0; i < numAsleep.GetSize(); i++ ){
+    df.Write(numAsleep[i], cStringUtil::Stringf("DemeID %d", i));
+  }
+  df.Endl();
+}

Modified: development/source/main/cStats.h
===================================================================
--- development/source/main/cStats.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/main/cStats.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -249,6 +249,8 @@
   tArray<int> sense_last_exe_count;
   tArray<cString> sense_names;
 
+  tArray<int> numAsleep;
+
   cStats(); // @not_implemented
   cStats(const cStats&); // @not_implemented
   cStats& operator=(const cStats&); // @not_implemented
@@ -572,6 +574,10 @@
 
   int GetNumSenseSlots();
 
+  int getNumAsleep(int demeID) { return numAsleep[demeID]; }
+  void incNumAsleep(int demeID) { numAsleep[demeID]++; }
+  void decNumAsleep(int demeID) { numAsleep[demeID]--; }
+
   // this value gets recorded when a creature with the particular
   // fitness value gets born. It will never change to a smaller value,
   // i.e., when the maximum fitness in the population drops, this value will
@@ -605,7 +611,7 @@
   void PrintMarketData(const cString& filename);
   void PrintSenseData(const cString& filename);
   void PrintSenseExeData(const cString& filename);
-  
+  void PrintSleepData(const cString& filename);
 };
 
 

Modified: development/source/tools/tArray.h
===================================================================
--- development/source/tools/tArray.h	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/source/tools/tArray.h	2007-08-02 17:31:08 UTC (rev 1888)
@@ -75,6 +75,30 @@
     return *this;
   }
 
+  tArray operator+(const tArray in) const {
+    tArray tmp(0);
+    for(int i = 0; i < GetSize(); i++) {
+      tmp.Push(m_data[i]);
+    }
+    
+    for(int i = 0; i < in.GetSize(); i++) {
+      tmp.Push(in[i]);
+    }
+    return tmp;
+  }
+  
+  tArray Subset(int start, int end) {
+    assert(start <= end);
+    assert(0 <= start && start <= GetSize());
+    assert(0 <= end && end <= GetSize());
+    
+    tArray tmp(0);
+    for(int i = start; i < end; i++) {
+      tmp.Push(m_data[i]);
+    }
+    return tmp;
+  }
+  
   bool Good() const { return (m_data != NULL); }
   int GetSize() const { return m_size; }
 

Added: development/tests/energy_asex_1000u/config/avida.cfg
===================================================================
--- development/tests/energy_asex_1000u/config/avida.cfg	                        (rev 0)
+++ development/tests/energy_asex_1000u/config/avida.cfg	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,233 @@
+#############################################################################
+# This file includes all the basic run-time defines for Avida.
+# For more information, see doc/config.html
+#############################################################################
+
+VERSION_ID 2.7.0   # Do not change this value.
+
+### GENERAL_GROUP ###
+# General Settings
+ANALYZE_MODE 0  # 0 = Disabled
+                # 1 = Enabled
+                # 2 = Interactive
+VIEW_MODE 1     # Initial viewer screen
+CLONE_FILE -    # Clone file to load
+VERBOSITY 1     # Control output verbosity
+
+### ARCH_GROUP ###
+# Architecture Variables
+WORLD_X 60        # Width of the Avida world
+WORLD_Y 60        # Height of the Avida world
+WORLD_GEOMETRY 2  # 1 = Bounded Grid
+                  # 2 = Torus
+#NUM_DEMES 0       # Number of independed groups in the population; 0=off
+RANDOM_SEED 7     # Random number seed (0 for based on time)
+HARDWARE_TYPE 0   # 0 = Original CPUs
+                  # 1 = New SMT CPUs
+                  # 2 = Transitional SMT
+
+### CONFIG_FILE_GROUP ###
+# Configuration Files
+DATA_DIR data                       # Directory in which config files are found
+INST_SET instset-TEST.cfg           # File containing instruction set
+EVENT_FILE events-ConstResource.cfg # File containing list of events during run
+ANALYZE_FILE analyze.cfg            # File used for analysis mode
+ENVIRONMENT_FILE environment-5tasks.cfg    # File that describes the environment
+START_CREATURE echo40.org           # Organism to seed the soup
+
+### REPRODUCTION_GROUP ###
+# Birth and Death
+BIRTH_METHOD 4           # Which organism should be replaced on birth?
+                         # 0 = Random organism in neighborhood
+                         # 1 = Oldest in neighborhood
+                         # 2 = Largest Age/Merit in neighborhood
+                         # 3 = None (use only empty cells in neighborhood)
+                         # 4 = Random from population (Mass Action)
+                         # 5 = Oldest in entire population
+                         # 6 = Random within deme
+                         # 7 = Organism faced by parent
+                         # 8 = Next grid cell (id+1)
+                         # 9= Largest energy used in entire population
+                         # 10= Largest energy used in neighborhood
+PREFER_EMPTY 1           # Give empty cells preference in offsping placement?
+DEATH_METHOD 0           # 0 = Never die of old age.
+                         # 1 = Die when inst executed = AGE_LIMIT (+deviation)
+                         # 2 = Die when inst executed = length*AGE_LIMIT (+dev)
+AGE_LIMIT 20             # Modifies DEATH_METHOD
+AGE_DEVIATION 0          # Creates a distribution around AGE_LIMIT
+ALLOC_METHOD 0           # (Orignal CPU Only)
+                         # 0 = Allocated space is set to default instruction.
+                         # 1 = Set to section of dead genome (Necrophilia)
+                         # 2 = Allocated space is set to random instruction.
+DIVIDE_METHOD 1          # 0 = Divide leaves state of mother untouched.
+                         # 1 = Divide resets state of mother
+                         #     (after the divide, we have 2 children)
+                         # 2 = Divide resets state of current thread only
+                         #     (does not touch possible parasite threads)
+GENERATION_INC_METHOD 1  # 0 = Only the generation of the child is
+                         #     increased on divide.
+                         # 1 = Both the generation of the mother and child are
+                         #     increased on divide (good with DIVIDE_METHOD 1).
+
+### RECOMBINATION_GROUP ###
+# Sexual Recombination and Modularity
+RECOMBINATION_PROB 1.0  # probability of recombination in div-sex
+MAX_BIRTH_WAIT_TIME -1  # Updates incipiant orgs can wait for crossover
+MODULE_NUM 0            # number of modules in the genome
+CONT_REC_REGS 1         # are (modular) recombination regions continuous
+CORESPOND_REC_REGS 1    # are (modular) recombination regions swapped randomly
+                        #  or with corresponding positions?
+TWO_FOLD_COST_SEX 0     # 1 = only one recombined offspring is born.
+                        # 2 = both offspring are born
+SAME_LENGTH_SEX 0       # 0 = recombine with any genome
+                        # 1 = only recombine w/ same length
+
+### 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.
+
+### MUTATION_GROUP ###
+# Mutations
+POINT_MUT_PROB 0.0    # Mutation rate (per-location per update)
+COPY_MUT_PROB 0.0075  # Mutation rate (per copy)
+INS_MUT_PROB 0.0      # Insertion rate (per site, applied on divide)
+DEL_MUT_PROB 0.0      # Deletion rate (per site, applied on divide)
+DIV_MUT_PROB 0.0      # Mutation rate (per site, applied on divide)
+DIVIDE_MUT_PROB 0.0   # Mutation rate (per divide)
+DIVIDE_INS_PROB 0.05  # Insertion rate (per divide)
+DIVIDE_DEL_PROB 0.05  # Deletion rate (per divide)
+PARENT_MUT_PROB 0.0   # Per-site, in parent, on divide
+SPECIAL_MUT_LINE -1   # If this is >= 0, ONLY this line is mutated
+INJECT_INS_PROB 0.0   # Insertion rate (per site, applied on inject)
+INJECT_DEL_PROB 0.0   # Deletion rate (per site, applied on inject)
+INJECT_MUT_PROB 0.0   # Mutation rate (per site, applied on inject)
+META_COPY_MUT 0.0     # Prob. of copy mutation rate changing (per gen)
+META_STD_DEV 0.0      # Standard deviation of meta mutation size.
+MUT_RATE_SOURCE 1     # 1 = Mutation rates determined by environment.
+                      # 2 = Mutation rates inherited from parent.
+
+### REVERSION_GROUP ###
+# Mutation Reversion
+# These slow down avida a lot, and should be set to 0.0 normally.
+REVERT_FATAL 0.0           # Should any mutations be reverted on birth?
+REVERT_DETRIMENTAL 0.0     #   0.0 to 1.0; Probability of reversion.
+REVERT_NEUTRAL 0.0         # 
+REVERT_BENEFICIAL 0.0      # 
+STERILIZE_FATAL 0.0        # Should any mutations clear (kill) the organism?
+STERILIZE_DETRIMENTAL 0.0  # 
+STERILIZE_NEUTRAL 0.0      # 
+STERILIZE_BENEFICIAL 0.0   # 
+FAIL_IMPLICIT 0            # Should copies that failed *not* due to mutations
+                           # be eliminated?
+NEUTRAL_MAX 0.0            # The percent benifical change from parent fitness to be considered neutral.
+NEUTRAL_MIN 0.0            # The percent deleterious change from parent fitness to be considered neutral.
+
+### TIME_GROUP ###
+# Time Slicing
+AVE_TIME_SLICE 1        # Ave number of insts per org per update
+SLICING_METHOD 1         # 0 = CONSTANT: all organisms get default...
+                         # 1 = PROBABILISTIC: Run _prob_ proportional to merit.
+                         # 2 = INTEGRATED: Perfectly integrated deterministic.
+BASE_MERIT_METHOD 4      # 0 = Constant (merit independent of size)
+                         # 1 = Merit proportional to copied size
+                         # 2 = Merit prop. to executed size
+                         # 3 = Merit prop. to full size
+                         # 4 = Merit prop. to min of executed or copied size
+                         # 5 = Merit prop. to sqrt of the minimum size
+BASE_CONST_MERIT 100     # Base merit when BASE_MERIT_METHOD set to 0
+DEFAULT_BONUS 1.0        # Initial bonus before any tasks
+MERIT_DEFAULT_BONUS 0    # Scale the merit of an offspring by the default bonus
+                         # rather than the accumulated bonus of the parent?
+MAX_CPU_THREADS 1        # Number of Threads a CPU can spawn
+THREAD_SLICING_METHOD 0  # Formula for and organism's thread slicing
+                         #   (num_threads-1) * THREAD_SLICING_METHOD + 1
+                         # 0 = One thread executed per time slice.
+                         # 1 = All threads executed each time slice.
+MAX_LABEL_EXE_SIZE 1     # Max nops marked as executed when labels are used
+DONATE_SIZE 5.0          # Amount of merit donated with 'donate' command
+DONATE_MULT 10.0         # Multiple of merit given that the target receives.
+MAX_DONATE_KIN_DIST -1   # Limit on distance of relation for donate; -1=no max
+MAX_DONATE_EDIT_DIST -1  # Limit on edit distance for donate; -1=no max
+MAX_DONATES 1000000      # Limit on number of donates organisms are allowed.
+
+### GENEOLOGY_GROUP ###
+# Geneology
+TRACK_MAIN_LINEAGE 1  # Keep all ancestors of the active population?
+                      # 0=no, 1=yes, 2=yes,w/sexual population
+THRESHOLD 3           # Number of organisms in a genotype needed for it
+                      #   to be considered viable.
+GENOTYPE_PRINT 0      # 0/1 (off/on) Print out all threshold genotypes?
+GENOTYPE_PRINT_DOM 0  # Print out a genotype if it stays dominant for
+                      #   this many updates. (0 = off)
+SPECIES_THRESHOLD 2   # max failure count for organisms to be same species
+SPECIES_RECORDING 0   # 1 = full, 2 = limited search (parent only)
+SPECIES_PRINT 0       # 0/1 (off/on) Print out all species?
+TEST_CPU_TIME_MOD 20  # Time allocated in test CPUs (multiple of length)
+
+### LOG_GROUP ###
+# Log Files
+LOG_CREATURES 0  # 0/1 (off/on) toggle to print file.
+LOG_GENOTYPES 0  # 0 = off, 1 = print ALL, 2 = print threshold ONLY.
+LOG_THRESHOLD 0  # 0/1 (off/on) toggle to print file.
+LOG_SPECIES 0    # 0/1 (off/on) toggle to print file.
+
+### LINEAGE_GROUP ###
+# Lineage
+# NOTE: This should probably be called "Clade"
+# This one can slow down avida a lot. It is used to get an idea of how
+# often an advantageous mutation arises, and where it goes afterwards.
+# Lineage creation options are.  Works only when LOG_LINEAGES is set to 1.
+#   0 = manual creation (on inject, use successive integers as lineage labels).
+#   1 = when a child's (potential) fitness is higher than that of its parent.
+#   2 = when a child's (potential) fitness is higher than max in population.
+#   3 = when a child's (potential) fitness is higher than max in dom. lineage
+# *and* the child is in the dominant lineage, or (2)
+#   4 = when a child's (potential) fitness is higher than max in dom. lineage
+# (and that of its own lineage)
+#   5 = same as child's (potential) fitness is higher than that of the
+#       currently dominant organism, and also than that of any organism
+#       currently in the same lineage.
+#   6 = when a child's (potential) fitness is higher than any organism
+#       currently in the same lineage.
+#   7 = when a child's (potential) fitness is higher than that of any
+#       organism in its line of descent
+LOG_LINEAGES 0             # 
+LINEAGE_CREATION_METHOD 0  # 
+
+### ORGANISM_NETWORK_GROUP ###
+# Organism Network Communication
+NET_ENABLED 0      # Enable Network Communication Support
+NET_DROP_PROB 0.0  # Message drop rate
+NET_MUT_PROB 0.0   # Message corruption probability
+NET_MUT_TYPE 0     # Type of message corruption.  0 = Random Single Bit, 1 = Always Flip Last
+NET_STYLE 0        # Communication Style.  0 = Random Next, 1 = Receiver Facing
+
+### BUY_SELL_GROUP ###
+# Buying and Selling Parameters
+SAVE_RECEIVED 0  # Enable storage of all inputs bought from other orgs
+BUY_PRICE 0      # price offered by organisms attempting to buy
+SELL_PRICE 0     # price offered by organisms attempting to sell
+
+### ANALYZE_GROUP ###
+# Analysis Settings
+MT_CONCURRENCY 1   # Number of concurrent analyze threads
+ANALYZE_OPTION_1   # String variable accessible from analysis scripts
+ANALYZE_OPTION_2   # String variable accessible from analysis scripts
+
+### ENERGY_GROUP ###
+# Energy Settings
+ENERGY_ENABLED 1                       # Enable Energy Model. 0/1 (off/on)
+ENERGY_GIVEN_ON_INJECT 100000               # Energy given to organism upon injection.
+ENERGY_GIVEN_AT_BIRTH 0.0                # Energy given to offspring upon birth.
+FRAC_PARENT_ENERGY_GIVEN_AT_BIRTH 0.5  # Fraction of energy given to offspring.
+FRAC_ENERGY_DECAY_AT_BIRTH 0.05         # Fraction of energy lost due to decay during reproduction.
+NUM_INST_EXC_BEFORE_0_ENERGY 1000000         # Number of instructions executed before energy is exhausted.
+ENERGY_CAP -1                          # Maximun amount of energy that can be stored in an organism.  -1 means the cap is set to Max Int
+ENERGY_VERBOSE 0                       # Print energy and merit values. 0/1 (off/on)

Added: development/tests/energy_asex_1000u/config/echo40.org
===================================================================
--- development/tests/energy_asex_1000u/config/echo40.org	                        (rev 0)
+++ development/tests/energy_asex_1000u/config/echo40.org	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,100 @@
+h-alloc    # Allocate space for child
+h-search   # Locate the end of the organism
+nop-C      #
+nop-A      #
+mov-head   # Place write-head at beginning of offspring.
+nop-C      #
+IO
+nop-C      #
+IO         # 1
+nop-C      #
+IO         # 2
+nop-C      #
+IO         # 3
+nop-C      #
+IO         # 4
+nop-C      #
+IO         # 5
+nop-C      #
+IO         # 6
+nop-C      #
+IO         # 7
+nop-C      #
+IO         # 8
+nop-C      #
+IO         # 9
+nop-C      #
+IO         # 10
+nop-C      #
+IO         # 11
+nop-C      #
+IO         # 12
+nop-C      #
+IO         # 13
+nop-C      #
+IO         # 14
+nop-C      #
+IO         # 15
+nop-C      #
+IO         # 16
+nop-C      #
+IO         # 17
+nop-C      #
+IO         # 18
+nop-C      #
+IO         # 19
+nop-C      #
+IO         # 20
+nop-C      #
+IO         # 21
+nop-C      #
+IO         # 22
+nop-C      #
+IO         # 23
+nop-C      #
+IO         # 24
+nop-C      #
+IO         # 25
+nop-C      #
+IO         # 26
+nop-C      #
+IO         # 27
+nop-C      #
+IO         # 28
+nop-C      #
+IO         # 29
+nop-C      #
+IO         # 30
+nop-C      #
+IO         # 31
+nop-C      #
+IO         # 32
+nop-C      #
+IO         # 33
+nop-C      #
+IO         # 34
+nop-C      #
+IO         # 35
+nop-C      #
+IO         # 36
+nop-C      #
+IO         # 37
+nop-C      #
+IO         # 38
+nop-C      #
+IO         # 39
+nop-C      #
+IO         # 40
+nop-C      #
+nop-C      #
+nop-C      #
+nop-C      #
+h-search   # Mark the beginning of the copy loop
+h-copy     # Do the copy
+if-label   # If we're done copying....
+nop-C      #
+nop-A      #
+h-divide   #    ...divide!
+mov-head   # Otherwise, loop back to the beginning of the copy loop.
+nop-A      # End label.
+nop-B      #

Added: development/tests/energy_asex_1000u/config/environment-5tasks.cfg
===================================================================
--- development/tests/energy_asex_1000u/config/environment-5tasks.cfg	                        (rev 0)
+++ development/tests/energy_asex_1000u/config/environment-5tasks.cfg	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,32 @@
+##############################################################################
+#
+# This is the setup file for the task/resource system.  From here, you can
+# setup the available resources (including their inflow and outflow rates) as
+# well as the reactions that the organisms can trigger by performing tasks.
+#
+# This file is currently setup to reward 9 tasks, all of which use the
+# "infinite" resource, which is undepletable.
+#
+# For information on how to use this file, see:  doc/environment.html
+# For other sample environments, see:  source/support/config/ 
+#
+##############################################################################
+
+RESOURCE sun_light:initial=1.0
+
+REACTION  ECHO echo  process:resource=sun_light:value=1000.0:type=energy:frac=1.0:product=sun_light:conversion=1.0 requisite:max_count=35
+
+REACTION  NAND nand  process:resource=sun_light:value=1500.0:type=energy:frac=1.0:product=sun_light:conversion=1.0 requisite:max_count=20
+
+REACTION  NOT  not   process:resource=sun_light:value=1500.0:type=energy:frac=1.0:product=sun_light:conversion=1.0 requisite:max_count=20
+
+REACTION  AND  and   process:resource=sun_light:value=2000.0:type=energy:frac=1.0:product=sun_light:conversion=1.0 requisite:max_count=13
+
+REACTION  ORN  orn   process:resource=sun_light:value=2000.0:type=energy:frac=1.0:product=sun_light:conversion=1.0 requisite:max_count=13
+
+
+#REACTION  OR   or    process:value=3.0:type=pow  requisite:max_count=1
+#REACTION  ANDN andn  process:value=3.0:type=pow  requisite:max_count=1
+#REACTION  NOR  nor   process:value=4.0:type=pow  requisite:max_count=1
+#REACTION  XOR  xor   process:value=4.0:type=pow  requisite:max_count=1
+#REACTION  EQU  equ   process:value=5.0:type=pow  requisite:max_count=1

Added: development/tests/energy_asex_1000u/config/events-ConstResource.cfg
===================================================================
--- development/tests/energy_asex_1000u/config/events-ConstResource.cfg	                        (rev 0)
+++ development/tests/energy_asex_1000u/config/events-ConstResource.cfg	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,45 @@
+##############################################################################
+#
+# This is the setup file for the events system.  From here, you can
+# configure any actions that you want to have happen during the course of
+# an experiment, including setting the times for data collection.
+#
+# basic syntax: [trigger] [start:interval:stop] [action/event] [arguments...]
+#
+# This file is currently setup to record key information every 100 updates.
+#
+# For information on how to use this file, see:  doc/events.html
+# For other sample event configurations, see:  support/config/
+#
+##############################################################################
+
+
+# Print all of the standard data files...
+u 0:100:end PrintAverageData       # Save info about they average genotypes
+u 0:100:end PrintDominantData      # Save info about most abundant genotypes
+u 0:100:end PrintStatsData         # Collect satistics about entire pop.
+u 0:100:end PrintCountData         # Count organisms, genotypes, species, etc.
+u 0:100:end PrintTasksData         # Save organisms counts for each task.
+u 0:100:end PrintTimeData          # Track time conversion (generations, etc.)
+u 0:4:end PrintResourceData      # Track resource abundance.
+
+# A few data files not printed by default
+# u 0:100 PrintDominantGenotype      # Save the most abundant genotypes
+# u 100:100:end PrintErrorData       # Std. Error on averages.
+# u 100:100:end PrintVarianceData    # Variance on averages.
+# u 100:100:end PrintTotalsData      # Total counts over entire run.
+u 100:100:end PrintTasksExeData    # Num. times tasks have been executed.
+# u 100:100:end PrintTasksQualData   # Task quality information
+
+# Setup the exit time and full population data collection.
+
+u 0:100:end PrintInstructionAbundanceHistogram
+u 0:100:end PrintInstructionData
+u 16:16:end PrintSleepData
+
+#u 128000:128000:end SavePopulation         # Save current state of population.
+#u 128000:128000:end SaveHistoricPopulation # Save ancestors of current population.
+#u end SavePopulation         # Save current state of population.
+#u end SaveHistoricPopulation # Save ancestors of current population.
+
+u 1000 exit
\ No newline at end of file

Added: development/tests/energy_asex_1000u/config/instset-TEST.cfg
===================================================================
--- development/tests/energy_asex_1000u/config/instset-TEST.cfg	                        (rev 0)
+++ development/tests/energy_asex_1000u/config/instset-TEST.cfg	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,64 @@
+nop-A      1 1 0 100   # a
+nop-B      1 1 0 100   # b
+nop-C      1 1 0 100   # c
+if-n-equ   1 1 0 100   # d
+if-less    1 1 0 100   # e
+pop        1 1 0 100   # f
+push       1 1 0 100   # g
+swap-stk   1 1 0 100   # h
+swap       1 1 0 100   # i 
+shift-r    1 1 0 100   # j
+shift-l    1 1 0 100   # k
+inc        1 1 0 100   # l
+dec        1 1 0 100   # m
+add        1 1 0 100   # n
+sub        1 1 0 100   # o
+nand       1 1 0 100   # p
+IO         1 1 0 100   # q   Puts current contents of register and gets new.
+h-alloc    1 1 0 100   # r   Allocate as much memory as organism can use.
+h-divide   1 1 0 100   # s   Cuts off everything between the read and write heads
+h-copy     1 1 0 100   # t   Combine h-read and h-write
+h-search   1 1 0 100   # u   Search for matching template, set flow head & return info
+               #   #   if no template, move flow-head here, set size&offset=0.
+mov-head   1 1 0 100   # v   Move ?IP? head to flow control.
+jmp-head   1 1 0 100   # w   Move ?IP? head by fixed amount in CX.  Set old pos in CX.
+get-head   1 1 0 100   # x   Get position of specified head in CX.
+if-label   1 1 0 100   # y
+set-flow   1 1 0 100   # z   Move flow-head to address in ?CX? 
+
+sense-m100 1 1 0 100
+
+if-equ-0   1 1 0 100
+
+time       1 1 0 100
+
+sleep1	   1 10 0 1
+sleep2	   1 20 0 1
+sleep3	   1 40 0 1
+sleep4	   1 80 0 1
+
+
+#adv-head   1
+#jump-f     1
+#jump-b     1
+#call       1
+#return     1
+#if-bit-1   1
+#get        1
+#put        1
+#h-read     1
+#h-write    1
+#set-head   1
+#search-f   1
+#search-b   1
+
+
+# Works on multiple nops:  pop  push  inc  dec  IO  adv-head 
+
+# What if we add a new head.  Search will return the location of something,
+# and put the new head there.  Then set-head will move another head to that
+# point.  In the case of the copy loop, it only needs to be set once and
+# this will speed up the code quite a bit!
+
+# Search with no template returns current position (abs line number) in
+# genome.
\ No newline at end of file

Added: development/tests/energy_asex_1000u/expected/data/average.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/average.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/average.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,30 @@
+# Avida Average Data
+# Tue Jul 24 16:43:36 2007
+#  1: Update
+#  2: Merit
+#  3: Gestation Time
+#  4: Fitness
+#  5: Repro Rate?
+#  6: Size
+#  7: Copied Size
+#  8: Executed Size
+#  9: Abundance
+# 10: Proportion of organisms that gave birth in this update
+# 11: Proportion of Breed True Organisms
+# 12: Genotype Depth
+# 13: Generation
+# 14: Neutral Metric
+# 15: Lineage Label
+# 16: True Replication Rate (based on births/update, time-averaged)
+
+0 97.000000 348.000000 0.000000 0.000000 100.000000 100.000000 97.000000 1.000000 1.000000 1.000000 0.000000 0.000000 0.000000 0.000000 0.000000 
+100 97 348 0 0 100 100 97 1 0 0 0 0 0 0 0 
+200 97 348 0 0 100 100 97 1 0 0 0 0 0 0 0 
+300 97 348 0 0 100 100 97 1 0 0 0 0 0 0 0 
+400 4.80909 348 0.278736 0 100 100 97 2 0 0 0 1 0.411824 0 0 
+500 4.80909 348 0.278736 0 100 100 97 2 0 0 0 1 0.411824 0 0.198809 
+600 4.80909 348 0.278736 0 100 100 97 2 0 0 0 1 0.411824 0 0.00480909 
+700 3.86732 348 0.278736 0 100 100 97 2 0.25 0 0.25 2 0.812366 0 0.00759659 
+800 3.86732 348 0.278736 0 100 100 97 2 0 0 0.25 2 0.812366 0 0.00953025 
+900 3.86732 348 0.278736 0 100 100 97 2 0 0 0.25 2 0.812366 0 0.00472116 
+1000 3.86732 348 0.278736 0 100 100 97 2 0 0 0.25 2 0.812366 0 0.00472116 

Added: development/tests/energy_asex_1000u/expected/data/count.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/count.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/count.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,30 @@
+# Avida count data
+# Tue Jul 24 16:43:36 2007
+#  1: update
+#  2: number of insts executed this update
+#  3: number of organisms
+#  4: number of different genotypes
+#  5: number of different threshold genotypes
+#  6: number of different species
+#  7: number of different threshold species
+#  8: number of different lineages
+#  9: number of births in this update
+# 10: number of deaths in this update
+# 11: number of breed true
+# 12: number of breed true organisms?
+# 13: number of no-birth organisms
+# 14: number of single-threaded organisms
+# 15: number of multi-threaded organisms
+# 16: number of modified organisms
+
+0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 0 
+100 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 
+200 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 
+300 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 
+400 2 2 1 1 0 0 0 0 0 0 2 1 2 0 0 
+500 2 2 1 1 0 0 0 0 0 0 2 1 2 0 0 
+600 2 2 1 1 0 0 0 0 0 0 2 1 2 0 0 
+700 3 4 2 1 0 0 0 1 0 0 3 2 4 0 0 
+800 4 4 2 1 0 0 0 0 0 0 3 2 4 0 0 
+900 4 4 2 1 0 0 0 0 0 0 3 2 4 0 0 
+1000 4 4 2 1 0 0 0 0 0 0 3 2 4 0 0 

Added: development/tests/energy_asex_1000u/expected/data/dominant.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/dominant.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/dominant.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,30 @@
+# Avida Dominant Data
+# Tue Jul 24 16:43:36 2007
+#  1: Update
+#  2: Average Merit of the Dominant Genotype
+#  3: Average Gestation Time of the Dominant Genotype
+#  4: Average Fitness of the Dominant Genotype
+#  5: Repro Rate?
+#  6: Size of Dominant Genotype
+#  7: Copied Size of Dominant Genotype
+#  8: Executed Size of Dominant Genotype
+#  9: Abundance of Dominant Genotype
+# 10: Number of Births
+# 11: Number of Dominant Breed True?
+# 12: Dominant Gene Depth
+# 13: Dominant Breed In
+# 14: Max Fitness?
+# 15: Genotype ID of Dominant Genotype
+# 16: Name of the Dominant Genotype
+
+0 0.000000 0.000000 0.000000 0.000000 100 0.000000 0.000000 1 0 0 0 0 0.000000 1 100-aaaaa 
+100 0 0 0 0 100 0 0 1 0 0 0 0 0 1 100-aaaaa 
+200 0 0 0 0 100 0 0 1 0 0 0 0 0 1 100-aaaaa 
+300 0 0 0 0 100 0 0 1 0 0 0 0 0 1 100-aaaaa 
+400 4.80909 348 0.278736 0.00287356 100 100 97 2 0 0 0 0 0.278736 1 100-aaaaa 
+500 4.80909 348 0.278736 0.00287356 100 100 97 2 0 0 0 0 0.278736 1 100-aaaaa 
+600 4.80909 348 0.278736 0.00287356 100 100 97 2 0 0 0 0 0.278736 1 100-aaaaa 
+700 4.18125 348 0.278736 0.00287356 100 100 97 3 1 0 0 0 0.278736 1 100-aaaaa 
+800 4.18125 348 0.278736 0.00287356 100 100 97 3 0 0 0 0 0.278736 1 100-aaaaa 
+900 4.18125 348 0.278736 0.00287356 100 100 97 3 0 0 0 0 0.278736 1 100-aaaaa 
+1000 4.18125 348 0.278736 0.00287356 100 100 97 3 0 0 0 0 0.278736 1 100-aaaaa 

Added: development/tests/energy_asex_1000u/expected/data/instruction.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/instruction.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/instruction.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,48 @@
+# Avida instruction execution data
+# Tue Jul 24 16:43:36 2007
+#  1: Update
+#  2: nop-A
+#  3: nop-B
+#  4: nop-C
+#  5: if-n-equ
+#  6: if-less
+#  7: pop
+#  8: push
+#  9: swap-stk
+# 10: swap
+# 11: shift-r
+# 12: shift-l
+# 13: inc
+# 14: dec
+# 15: add
+# 16: sub
+# 17: nand
+# 18: IO
+# 19: h-alloc
+# 20: h-divide
+# 21: h-copy
+# 22: h-search
+# 23: mov-head
+# 24: jmp-head
+# 25: get-head
+# 26: if-label
+# 27: set-flow
+# 28: sense-m100
+# 29: if-equ-0
+# 30: time
+# 31: sleep1
+# 32: sleep2
+# 33: sleep3
+# 34: sleep4
+
+0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
+400 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 82 2 2 200 4 200 0 0 200 0 0 0 0 0 0 0 0 
+500 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 82 2 2 200 4 200 0 0 200 0 0 0 0 0 0 0 0 
+600 0 0 6 0 0 0 0 0 0 0 0 0 0 0 0 0 82 2 2 200 4 200 0 0 200 0 0 0 0 0 0 0 0 
+700 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 164 4 4 400 8 400 0 0 400 0 0 0 0 0 0 0 0 
+800 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 164 4 4 400 8 400 0 0 400 0 0 0 0 0 0 0 0 
+900 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 164 4 4 400 8 400 0 0 400 0 0 0 0 0 0 0 0 
+1000 0 0 12 0 0 0 0 0 0 0 0 0 0 0 0 0 164 4 4 400 8 400 0 0 400 0 0 0 0 0 0 0 0 

Added: development/tests/energy_asex_1000u/expected/data/instruction_histogram.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/instruction_histogram.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/instruction_histogram.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,46 @@
+#  1: Update
+#  2: nop-A
+#  3: nop-B
+#  4: nop-C
+#  5: if-n-equ
+#  6: if-less
+#  7: pop
+#  8: push
+#  9: swap-stk
+# 10: swap
+# 11: shift-r
+# 12: shift-l
+# 13: inc
+# 14: dec
+# 15: add
+# 16: sub
+# 17: nand
+# 18: IO
+# 19: h-alloc
+# 20: h-divide
+# 21: h-copy
+# 22: h-search
+# 23: mov-head
+# 24: jmp-head
+# 25: get-head
+# 26: if-label
+# 27: set-flow
+# 28: sense-m100
+# 29: if-equ-0
+# 30: time
+# 31: sleep1
+# 32: sleep2
+# 33: sleep3
+# 34: sleep4
+
+0 203 1 47 0 0 0 0 0 0 0 0 0 0 0 0 0 41 1 1 1 2 2 0 0 1 0 0 0 0 0 0 0 0 
+100 186 1 55 0 0 0 0 0 0 0 0 0 0 0 0 0 47 2 1 1 3 3 0 0 1 0 0 0 0 0 0 0 0 
+200 153 1 71 0 0 0 0 0 0 0 0 0 0 0 0 0 64 2 1 1 3 3 0 0 1 0 0 0 0 0 0 0 0 
+300 119 1 88 0 0 0 0 0 0 0 0 0 0 0 0 0 81 2 1 1 3 3 0 0 1 0 0 0 0 0 0 0 0 
+400 403 2 95 0 0 0 0 0 0 0 0 0 0 0 0 0 82 3 2 2 5 4 0 0 2 0 0 0 0 0 0 0 0 
+500 338 2 127 0 0 0 0 0 0 0 0 0 0 0 0 0 111 4 2 2 6 6 0 0 2 0 0 0 0 0 0 0 0 
+600 270 2 160 0 0 0 0 0 0 0 0 0 0 0 0 0 145 4 2 2 6 6 0 0 2 0 1 0 0 0 0 0 0 
+700 412 4 188 0 0 0 0 0 0 0 0 0 0 0 0 0 163 4 4 4 8 8 0 0 4 0 1 0 0 0 0 0 0 
+800 737 4 223 0 0 0 0 0 0 0 0 0 0 0 0 0 190 8 4 5 12 12 0 0 4 0 1 0 0 0 0 0 0 
+900 605 4 287 0 0 0 0 0 0 0 0 0 0 0 0 0 256 8 4 5 12 12 0 0 4 0 2 0 0 0 0 1 0 
+1000 471 4 356 0 0 0 0 0 0 0 0 0 0 0 0 0 321 8 4 5 12 12 0 0 4 0 2 0 0 0 0 1 0 

Added: development/tests/energy_asex_1000u/expected/data/resource.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/resource.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/resource.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,258 @@
+# Avida resource data
+# Tue Jul 24 16:43:36 2007
+# First column gives the current update, all further columns give the quantity
+# of the particular resource at that update.
+#  1: Update
+#  2: sun_light
+
+0 1.000000 
+4 1 
+8 1 
+12 1 
+16 1 
+20 1 
+24 1 
+28 1 
+32 1 
+36 1 
+40 1 
+44 1 
+48 1 
+52 1 
+56 1 
+60 1 
+64 1 
+68 1 
+72 1 
+76 1 
+80 1 
+84 1 
+88 1 
+92 1 
+96 1 
+100 1 
+104 1 
+108 1 
+112 1 
+116 1 
+120 1 
+124 1 
+128 1 
+132 1 
+136 1 
+140 1 
+144 1 
+148 1 
+152 1 
+156 1 
+160 1 
+164 1 
+168 1 
+172 1 
+176 1 
+180 1 
+184 1 
+188 1 
+192 1 
+196 1 
+200 1 
+204 1 
+208 1 
+212 1 
+216 1 
+220 1 
+224 1 
+228 1 
+232 1 
+236 1 
+240 1 
+244 1 
+248 1 
+252 1 
+256 1 
+260 1 
+264 1 
+268 1 
+272 1 
+276 1 
+280 1 
+284 1 
+288 1 
+292 1 
+296 1 
+300 1 
+304 1 
+308 1 
+312 1 
+316 1 
+320 1 
+324 1 
+328 1 
+332 1 
+336 1 
+340 1 
+344 1 
+348 1 
+352 1 
+356 1 
+360 1 
+364 1 
+368 1 
+372 1 
+376 1 
+380 1 
+384 1 
+388 1 
+392 1 
+396 1 
+400 1 
+404 1 
+408 1 
+412 1 
+416 1 
+420 1 
+424 1 
+428 1 
+432 1 
+436 1 
+440 1 
+444 1 
+448 1 
+452 1 
+456 1 
+460 1 
+464 1 
+468 1 
+472 1 
+476 1 
+480 1 
+484 1 
+488 1 
+492 1 
+496 1 
+500 1 
+504 1 
+508 1 
+512 1 
+516 1 
+520 1 
+524 1 
+528 1 
+532 1 
+536 1 
+540 1 
+544 1 
+548 1 
+552 1 
+556 1 
+560 1 
+564 1 
+568 1 
+572 1 
+576 1 
+580 1 
+584 1 
+588 1 
+592 1 
+596 1 
+600 1 
+604 1 
+608 1 
+612 1 
+616 1 
+620 1 
+624 1 
+628 1 
+632 1 
+636 1 
+640 1 
+644 1 
+648 1 
+652 1 
+656 1 
+660 1 
+664 1 
+668 1 
+672 1 
+676 1 
+680 1 
+684 1 
+688 1 
+692 1 
+696 1 
+700 1 
+704 1 
+708 1 
+712 1 
+716 1 
+720 1 
+724 1 
+728 1 
+732 1 
+736 1 
+740 1 
+744 1 
+748 1 
+752 1 
+756 1 
+760 1 
+764 1 
+768 1 
+772 1 
+776 1 
+780 1 
+784 1 
+788 1 
+792 1 
+796 1 
+800 1 
+804 1 
+808 1 
+812 1 
+816 1 
+820 1 
+824 1 
+828 1 
+832 1 
+836 1 
+840 1 
+844 1 
+848 1 
+852 1 
+856 1 
+860 1 
+864 1 
+868 1 
+872 1 
+876 1 
+880 1 
+884 1 
+888 1 
+892 1 
+896 1 
+900 1 
+904 1 
+908 1 
+912 1 
+916 1 
+920 1 
+924 1 
+928 1 
+932 1 
+936 1 
+940 1 
+944 1 
+948 1 
+952 1 
+956 1 
+960 1 
+964 1 
+968 1 
+972 1 
+976 1 
+980 1 
+984 1 
+988 1 
+992 1 
+996 1 
+1000 1 

Added: development/tests/energy_asex_1000u/expected/data/sleep.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/sleep.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/sleep.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,68 @@
+# Number of organisms sleeping
+
+# total number of organisms sleeping
+#  1: update
+#  2: DemeID 0
+
+16 0 
+32 0 
+48 0 
+64 0 
+80 0 
+96 0 
+112 0 
+128 0 
+144 0 
+160 0 
+176 0 
+192 0 
+208 0 
+224 0 
+240 0 
+256 0 
+272 0 
+288 0 
+304 0 
+320 0 
+336 0 
+352 0 
+368 0 
+384 0 
+400 0 
+416 0 
+432 0 
+448 0 
+464 0 
+480 0 
+496 0 
+512 0 
+528 0 
+544 0 
+560 0 
+576 0 
+592 0 
+608 0 
+624 0 
+640 0 
+656 0 
+672 0 
+688 0 
+704 0 
+720 0 
+736 0 
+752 0 
+768 0 
+784 0 
+800 0 
+816 0 
+832 0 
+848 0 
+864 0 
+880 0 
+896 0 
+912 0 
+928 0 
+944 0 
+960 0 
+976 0 
+992 0 

Added: development/tests/energy_asex_1000u/expected/data/stats.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/stats.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/stats.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,26 @@
+# Generic Statistics Data
+# Tue Jul 24 16:43:36 2007
+#  1: update
+#  2: average inferiority (energy)
+#  3: ave probability of any mutations in genome
+#  4: probability of any mutations in dom genome
+#  5: log(average fidelity)
+#  6: log(dominant fidelity)
+#  7: change in number of genotypes
+#  8: genotypic entropy
+#  9: species entropy
+# 10: depth of most reacent coalescence
+# 11: Total number of resamplings this generation
+# 12: Total number of organisms that failed to resample this generation
+
+0 0.000000 0.565047 0.565047 0.832517 0.832517 1 0.000000 0.000000 0 0 0 
+100 0 0.565047 0.565047 0.832517 0.832517 0 0 0 0 0 0 
+200 0 0.565047 0.565047 0.832517 0.832517 0 0 0 0 0 0 
+300 0 0.565047 0.565047 0.832517 0.832517 0 0 0 0 0 0 
+400 0 0.565047 0.565047 0.832517 0.832517 0 0 0 0 0 0 
+500 0 0.565047 0.565047 0.832517 0.832517 0 0 0 0 0 0 
+600 0 0.565047 0.565047 0.832517 0.832517 0 0 0 0 0 0 
+700 0 0.565047 0.565047 0.832517 0.832517 1 0.562335 0 0 0 0 
+800 0 0.565047 0.565047 0.832517 0.832517 0 0.562335 0 0 0 0 
+900 0 0.565047 0.565047 0.832517 0.832517 0 0.562335 0 0 0 0 
+1000 0 0.565047 0.565047 0.832517 0.832517 0 0.562335 0 0 0 0 

Added: development/tests/energy_asex_1000u/expected/data/tasks.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/tasks.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/tasks.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,22 @@
+# Avida tasks data
+# Tue Jul 24 16:43:36 2007
+# First column gives the current update, next columns give the number
+# of organisms that have the particular task as a component of their merit
+#  1: Update
+#  2: Echo
+#  3: Nand
+#  4: Not
+#  5: And
+#  6: OrNot
+
+0 0 0 0 0 0 
+100 0 0 0 0 0 
+200 0 0 0 0 0 
+300 0 0 0 0 0 
+400 2 0 0 0 0 
+500 2 0 0 0 0 
+600 2 0 0 0 0 
+700 4 0 0 0 0 
+800 4 0 0 0 0 
+900 4 0 0 0 0 
+1000 4 0 0 0 0 

Added: development/tests/energy_asex_1000u/expected/data/tasks_exe.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/tasks_exe.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/tasks_exe.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,21 @@
+# Avida tasks execution data
+# Tue Jul 24 16:43:36 2007
+# First column gives the current update, all further columns give the number
+# of times the particular task has been executed this update.
+#  1: Update
+#  2: Echo
+#  3: Nand
+#  4: Not
+#  5: And
+#  6: OrNot
+
+100 0 0 0 0 0 
+200 0 0 0 0 0 
+300 0 0 0 0 0 
+400 70 0 0 0 0 
+500 70 0 0 0 0 
+600 70 0 0 0 0 
+700 140 0 0 0 0 
+800 140 0 0 0 0 
+900 140 0 0 0 0 
+1000 140 0 0 0 0 

Added: development/tests/energy_asex_1000u/expected/data/time.dat
===================================================================
--- development/tests/energy_asex_1000u/expected/data/time.dat	                        (rev 0)
+++ development/tests/energy_asex_1000u/expected/data/time.dat	2007-08-02 17:31:08 UTC (rev 1888)
@@ -0,0 +1,18 @@
+# Avida time data
+# Tue Jul 24 16:43:36 2007
+#  1: update
+#  2: avida time
+#  3: average generation
+#  4: num_executed?
+
+0 0.000000 0.000000 1 
+100 1.03093 0 1 
+200 2.06186 0 1 
+300 3.09278 0 1 
+400 14.5981 1 2 
+500 35.3921 1 2 
+600 56.186 1 2 
+700 77.3547 2 3 
+800 103.212 2 4 
+900 129.07 2 4 
+1000 154.928 2 4 

Copied: development/tests/energy_deme_level_res (from rev 1886, branches/energy_dev/tests/energy_deme_level_res)

Modified: development/tests/sex-asex/config/avida.cfg
===================================================================
--- development/tests/sex-asex/config/avida.cfg	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/tests/sex-asex/config/avida.cfg	2007-08-02 17:31:08 UTC (rev 1888)
@@ -21,7 +21,7 @@
 WORLD_Y 60       # Height of the Avida world
 WORLD_GEOMETRY 2  # 1 = Bounded Grid
                   # 2 = Torus
-NUM_DEMES 0       # Number of independed groups in the population; 0=off
+#NUM_DEMES 0       # Number of independed groups in the population; 0=off
 RANDOM_SEED 7     # Random number seed (0 for based on time)
 HARDWARE_TYPE 0   # 0 = Original CPUs
                   # 1 = New SMT CPUs

Modified: development/tests/string_match_embed3/config/avida.cfg
===================================================================
--- development/tests/string_match_embed3/config/avida.cfg	2007-08-02 16:56:07 UTC (rev 1887)
+++ development/tests/string_match_embed3/config/avida.cfg	2007-08-02 17:31:08 UTC (rev 1888)
@@ -25,7 +25,7 @@
 WORLD_Y 15            # Height of the Avida world
 WORLD_GEOMETRY 2      # 1 = Bounded Grid
                       # 2 = Torus
-NUM_DEMES 0           # Number of independed groups in the population; 0=off
+#NUM_DEMES 0           # Number of independed groups in the population; 0=off
 RANDOM_SEED 0         # Random number seed (0 for based on time)
 HARDWARE_TYPE 0       # 0 = Original CPUs
                       # 1 = New, Stack-based CPUs




More information about the Avida-cvs mailing list