[Avida-SVN] r1925 - in branches/energy: documentation source/main

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Fri Aug 10 13:34:47 PDT 2007


Author: beckma24
Date: 2007-08-10 16:34:47 -0400 (Fri, 10 Aug 2007)
New Revision: 1925

Modified:
   branches/energy/documentation/environment.html
   branches/energy/source/main/cAvidaConfig.h
   branches/energy/source/main/cDeme.cc
   branches/energy/source/main/cDeme.h
   branches/energy/source/main/cEnvironment.cc
   branches/energy/source/main/cPopulation.cc
   branches/energy/source/main/cPopulation.h
   branches/energy/source/main/cPopulationCell.cc
   branches/energy/source/main/cPopulationCell.h
   branches/energy/source/main/cResource.cc
   branches/energy/source/main/cResource.h
   branches/energy/source/main/cWorld.cc
Log:
Added energy resource and FRAC_ENERGY_TRANSFER.  FRAC_ENERGY_TRANSFER specifies the amount of energy that is transfered from an organism begin replaced to the new organism.  When an organism is removed its energy is placed in the cPopulationCell.  When an organism in inserted in the cell it gains the cell's energy plus the the sum of all deme-level spacial energy resources.  Energy uptake is no implemeted for any other type of resource

Modified: branches/energy/documentation/environment.html
===================================================================
--- branches/energy/documentation/environment.html	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/documentation/environment.html	2007-08-10 20:34:47 UTC (rev 1925)
@@ -133,6 +133,17 @@
   </td>
 </tr>
 <tr>
+  <td class="resall">energy</td>
+  <td>
+    Is this an energy resource. Currently, only implemented for
+    spacial resources, and the energy model must be used.
+    (<em>True</em> or <em>False</em>)
+  </td>
+  <td>
+    false
+  </td>
+</tr>
+<tr>
   <td class="resspatial">inflowx1</td>
   <td>
     Leftmost coordinate of the rectangle where resource will flow

Modified: branches/energy/source/main/cAvidaConfig.h
===================================================================
--- branches/energy/source/main/cAvidaConfig.h	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cAvidaConfig.h	2007-08-10 20:34:47 UTC (rev 1925)
@@ -355,6 +355,7 @@
   CONFIG_ADD_VAR(NUM_INST_EXC_BEFORE_0_ENERGY, int, 0, "Number of instructions executed before energy is exhausted.");
   CONFIG_ADD_VAR(ENERGY_CAP, int, -1, "Maximum amount of energy that can be stored in an organism.  -1 means the cap is set to Max Int");  // TODO - is this done?
   CONFIG_ADD_VAR(APPLY_ENERGY_METHOD, int, 0, "When should rewarded energy be applied to current energy?\n0 = on divide\n1 = on completion of task\n2 = on sleep");  
+  CONFIG_ADD_VAR(FRAC_ENERGY_TRANSFER, double, 0.0, "Fraction of replaced organism's energy take by new resident");
 //  CONFIG_ADD_VAR(ENERGY_VERBOSE, bool, 0, "Print energy and merit values. 0/1 (off/on)");
   CONFIG_ADD_VAR(LOG_SLEEP_TIMES, bool, 0, "Log sleep start and end times. 0/1 (off/on)\nWARNING: may use lots of memory.");
   //  CONFIG_ADD_VAR(FIX_METABOLIC_RATE, bool, 0, "When activated the metabolic rate of all orgiansims are equal. 0/1 (off/on)"); // TODO - check for correctness

Modified: branches/energy/source/main/cDeme.cc
===================================================================
--- branches/energy/source/main/cDeme.cc	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cDeme.cc	2007-08-10 20:34:47 UTC (rev 1925)
@@ -34,6 +34,8 @@
   // If width is negative, set it to the full number of cells.
   width = in_width;
   if (width < 1) width = cell_ids.GetSize();
+  
+  // drain spacial energy resources and place energy in cells
 }
 
 
@@ -51,10 +53,10 @@
 monotonically increasing order!! */
 std::pair<int, int> cDeme::GetCellPosition(int cellid) const 
 {
-	assert(cell_ids.GetSize()>0);
+  assert(cell_ids.GetSize()>0);
   assert(GetWidth() > 0);
-	cellid -= cell_ids[0];
-	return std::make_pair(cellid % GetWidth(), cellid / GetWidth());
+  cellid -= cell_ids[0];
+  return std::make_pair(cellid % GetWidth(), cellid / GetWidth());
 }
 
 
@@ -77,7 +79,7 @@
 
 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
+  const int relative_cell_id = GetRelativeCellID(absolute_cell_id);
   deme_resource_count.ModifyCell(res_change, relative_cell_id);
 }
 
@@ -95,4 +97,31 @@
                            res->GetOutflowX2(), res->GetOutflowY1(), 
                            res->GetOutflowY2(), res->GetCellListPtr(),
                            verbosity);
+                           
+  if(res->GetEnergyResource()) {
+    energy_res_ids.Push(id);
+  }
 }
+
+double cDeme::GetAndClearCellEnergy(int absolute_cell_id) {
+  assert(cell_ids[0] <= absolute_cell_id);
+  assert(absolute_cell_id <= cell_ids[cell_ids.GetSize()-1]);
+
+  double total_energy = 0.0;
+  int relative_cell_id = GetRelativeCellID(absolute_cell_id);
+  tArray<double> cell_resources = deme_resource_count.GetCellResources(relative_cell_id);
+  tArray<double> modified_cell_resource(cell_resources.GetSize());
+  modified_cell_resource.SetAll(0.0);
+  
+  // sum all energy resources
+  for(int i = 0; i < energy_res_ids.GetSize(); i++) {
+    if(cell_resources[energy_res_ids[i]] > 0.0) {
+      total_energy += cell_resources[energy_res_ids[i]];
+      modified_cell_resource[energy_res_ids[i]] = -1.0 * cell_resources[energy_res_ids[i]];      
+    }
+  }
+  
+  // set energy resources to zero
+  deme_resource_count.ModifyCell(modified_cell_resource, relative_cell_id);
+  return total_energy;
+}

Modified: branches/energy/source/main/cDeme.h
===================================================================
--- branches/energy/source/main/cDeme.h	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cDeme.h	2007-08-10 20:34:47 UTC (rev 1925)
@@ -49,6 +49,7 @@
   cDeme(const cDeme&); // @not_implemented
   
   cResourceCount deme_resource_count; //!< Resources available to the deme
+  tArray<int> energy_res_ids; //!< IDs of energy resources
   
 public:
   cDeme() : width(0), birth_count(0), org_count(0), _age(0), deme_resource_count(0) { ; }
@@ -93,9 +94,11 @@
   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);
+  double GetAndClearCellEnergy(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); }
+  int GetRelativeCellID(int absolute_cell_id) { return absolute_cell_id % GetSize(); } //!< assumes all demes are the same size
 };
 
 #endif

Modified: branches/energy/source/main/cEnvironment.cc
===================================================================
--- branches/energy/source/main/cEnvironment.cc	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cEnvironment.cc	2007-08-10 20:34:47 UTC (rev 1925)
@@ -396,6 +396,15 @@
           return false;
         }
       }
+      else if (var_name == "energy") {
+        if (!new_resource->SetEnergyResource( var_value )) {
+          cerr << "Error: In " << var_type << "," << var_value <<
+          " must be true or false" << endl;
+          return false;
+        } else if(m_world->GetConfig().ENERGY_ENABLED.Get() == 0) {
+          cerr <<"Error: Energy resources can not be used without the energy model.\n";
+        }
+      }
       else {
         cerr << "Error: Unknown variable '" << var_name
         << "' in resource '" << name << "'" << endl;

Modified: branches/energy/source/main/cPopulation.cc
===================================================================
--- branches/energy/source/main/cPopulation.cc	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cPopulation.cc	2007-08-10 20:34:47 UTC (rev 1925)
@@ -230,13 +230,17 @@
     }
   }
 
+}
+
+void cPopulation::InitiatePop() {
+
   // 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)) {
+      if (!cGenomeUtil::LoadGenome(filename, m_world->GetHardwareManager().GetInstSet(), start_org)) {
         cerr << "Error: Unable to load start creature" << endl;
         exit(-1);
       }
@@ -1063,12 +1067,12 @@
   const int num_demes = GetNumDemes();
   
   // Loop through all candidate demes...
-	for (int deme_id = 0; deme_id < num_demes; deme_id++) {
-		cDeme & source_deme = deme_array[deme_id];
-
+  for (int deme_id = 0; deme_id < num_demes; deme_id++) {
+    cDeme & source_deme = deme_array[deme_id];
+    
     // Doesn't make sense to try and replicate a deme that *has no organisms*.
     if(source_deme.IsEmpty()) continue;
-
+    
     // Test this deme to determine if it should be replicated.  If not,
     // continue on to the next deme.
     switch (rep_trigger) {
@@ -1085,46 +1089,46 @@
       case 2: {
         // Replicate all demes with the corners filled in.
         // The first and last IDs represent the two corners.
-				const int id1 = source_deme.GetCellID(0);
-				const int id2 = source_deme.GetCellID(source_deme.GetSize() - 1);
-				if(cell_array[id1].IsOccupied() == false ||
+        const int id1 = source_deme.GetCellID(0);
+        const int id2 = source_deme.GetCellID(source_deme.GetSize() - 1);
+        if(cell_array[id1].IsOccupied() == false ||
            cell_array[id2].IsOccupied() == false) continue;
-				break;
+        break;
       }
-			case 3: {
+      case 3: {
         // Replicate old demes.
         if(source_deme.GetAge() < m_world->GetConfig().MAX_DEME_AGE.Get()) continue;
         break;
       }
-			default: {
-				cerr << "ERROR: Invalid replication trigger " << rep_trigger
-				<< " in cPopulation::ReplicateDemes()" << endl;
+      default: {
+        cerr << "ERROR: Invalid replication trigger " << rep_trigger
+        << " in cPopulation::ReplicateDemes()" << endl;
         assert(false);
       }
     }
     
-		// -- If we made it this far, we should replicate this deme --
-		cRandom& random = m_world->GetRandom();
-		
-		// Choose a random target deme to replicate to, and kill all the organisms
-		// in that deme.
-		int target_id = deme_id;
-		while(target_id == deme_id) {
-			target_id = random.GetUInt(num_demes);
-		}
-		cDeme& target_deme = deme_array[target_id];
-		for (int i=0; i<target_deme.GetSize(); i++) {
-			KillOrganism(cell_array[target_deme.GetCellID(i)]);
-		}
-		
-		// Ok, there are two potential places where the seed for the target deme can
-		// come from.  First, it could be a random organism in the source deme.
-		// Second, it could be an offspring of the source deme's germline, if the config
-		// option DEMES_USE_GERMLINE is set.
-		if(m_world->GetConfig().DEMES_USE_GERMLINE.Get()) {
-			// Get the latest germ from the source deme.
-			cGermline& source_germline = source_deme.GetGermline();
-			cGenome& source_germ = source_germline.GetLatest();
+    // -- If we made it this far, we should replicate this deme --
+    cRandom& random = m_world->GetRandom();
+    
+    // Choose a random target deme to replicate to, and kill all the organisms
+    // in that deme.
+    int target_id = deme_id;
+    while(target_id == deme_id) {
+      target_id = random.GetUInt(num_demes);
+    }
+    cDeme& target_deme = deme_array[target_id];
+    for (int i=0; i<target_deme.GetSize(); i++) {
+      KillOrganism(cell_array[target_deme.GetCellID(i)]);
+    }
+    
+    // Ok, there are two potential places where the seed for the target deme can
+    // come from.  First, it could be a random organism in the source deme.
+    // Second, it could be an offspring of the source deme's germline, if the config
+    // option DEMES_USE_GERMLINE is set.
+    if(m_world->GetConfig().DEMES_USE_GERMLINE.Get()) {
+      // Get the latest germ from the source deme.
+      cGermline& source_germline = source_deme.GetGermline();
+      cGenome& source_germ = source_germline.GetLatest();
       
       // Now create the next germ by manually mutating the source.
       // @refactor (strategy pattern)
@@ -1139,10 +1143,10 @@
         }
       }
       
-			// Here we're adding the next_germ to the germline(s).  Note the
+      // Here we're adding the next_germ to the germline(s).  Note the
       // config option to determine if we should update the source_germline
       // as well.
-			target_deme.ReplaceGermline(source_germline);
+      target_deme.ReplaceGermline(source_germline);
       cGermline& target_germline = target_deme.GetGermline();
       target_germline.Add(next_germ);
       if(m_world->GetConfig().GERMLINE_REPLACES_SOURCE.Get()) {
@@ -1150,11 +1154,11 @@
       }
       
       // Kill all the organisms in the source deme.
-			for (int i=0; i<source_deme.GetSize(); i++) {
-				KillOrganism(cell_array[source_deme.GetCellID(i)]);
-			}
+      for (int i=0; i<source_deme.GetSize(); i++) {
+        KillOrganism(cell_array[source_deme.GetCellID(i)]);
+      }
       
-			// Lineage label is wrong here; fix.
+      // Lineage label is wrong here; fix.
       if(m_world->GetConfig().GERMLINE_RANDOM_PLACEMENT.Get()) {
         InjectGenome(source_deme.GetCellID(m_world->GetRandom().GetInt(0, source_deme.GetSize()-1)),
                      source_germline.GetLatest(), 0);
@@ -1164,46 +1168,46 @@
         InjectGenome(source_deme.GetCellID(source_deme.GetSize()/2), source_germline.GetLatest(), 0);
         InjectGenome(target_deme.GetCellID(target_deme.GetSize()/2), target_germline.GetLatest(), 0);
       }
-			
-			// Note: not rotating the clones.
-		} else {
-			// Not using germline; choose a random organism from this deme.
-			int cell1_id = -1;
-			while (cell1_id == -1 || cell_array[cell1_id].IsOccupied() == false) {
-				cell1_id = source_deme.GetCellID(random.GetUInt(source_deme.GetSize()));
-			}
-			
-			cOrganism* seed = cell_array[cell1_id].GetOrganism();
-			
-			// And do the replication into the central cell of the target deme...
-			const int cell2_id = target_deme.GetCellID(target_deme.GetWidth()/2, target_deme.GetHeight()/2);
-			InjectClone(cell2_id, *seed);
       
-			// Kill all the organisms in the source deme.
-			seed = 0; // Note that we're killing the organism that seed points to.
-			for (int i=0; i<source_deme.GetSize(); i++) {
-				KillOrganism(cell_array[source_deme.GetCellID(i)]);
-			}
-			
-			// Inject the target offspring back into the source ID.
-			const int cell3_id = source_deme.GetCellID(source_deme.GetWidth()/2, source_deme.GetHeight()/2);
-			InjectClone(cell3_id, *cell_array[cell2_id].GetOrganism());
+      // Note: not rotating the clones.
+    } else {
+      // Not using germline; choose a random organism from this deme.
+      int cell1_id = -1;
+      while (cell1_id == -1 || cell_array[cell1_id].IsOccupied() == false) {
+        cell1_id = source_deme.GetCellID(random.GetUInt(source_deme.GetSize()));
+      }
       
-			// Rotate both injected cells to face northwest.
+      cOrganism* seed = cell_array[cell1_id].GetOrganism();
+      
+      // And do the replication into the central cell of the target deme...
+      const int cell2_id = target_deme.GetCellID(target_deme.GetWidth()/2, target_deme.GetHeight()/2);
+      InjectClone(cell2_id, *seed);
+      
+      // Kill all the organisms in the source deme.
+      seed = 0; // Note that we're killing the organism that seed points to.
+      for (int i=0; i<source_deme.GetSize(); i++) {
+        KillOrganism(cell_array[source_deme.GetCellID(i)]);
+      }
+      
+      // Inject the target offspring back into the source ID.
+      const int cell3_id = source_deme.GetCellID(source_deme.GetWidth()/2, source_deme.GetHeight()/2);
+      InjectClone(cell3_id, *cell_array[cell2_id].GetOrganism());
+      
+      // Rotate both injected cells to face northwest.
       int offset=target_deme.GetCellID(0);
-			cell_array[cell2_id].Rotate(cell_array[GridNeighbor(cell2_id-offset,
+      cell_array[cell2_id].Rotate(cell_array[GridNeighbor(cell2_id-offset,
                                                           target_deme.GetWidth(), 
                                                           target_deme.GetHeight(), -1, -1)+offset]);
       offset = source_deme.GetCellID(0);
-			cell_array[cell3_id].Rotate(cell_array[GridNeighbor(cell3_id-offset,
+      cell_array[cell3_id].Rotate(cell_array[GridNeighbor(cell3_id-offset,
                                                           source_deme.GetWidth(),
                                                           source_deme.GetHeight(), -1, -1)+offset]);
-		}
-		
-		// And reset both demes, in case they have any cleanup work to do.
-		source_deme.Reset();
-		target_deme.Reset();
-	}
+    }
+    
+    // And reset both demes, in case they have any cleanup work to do.
+    source_deme.Reset();
+    target_deme.Reset();
+  }
 }
 
 // Loop through all demes to determine if any are ready to be divided.  All

Modified: branches/energy/source/main/cPopulation.h
===================================================================
--- branches/energy/source/main/cPopulation.h	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cPopulation.h	2007-08-10 20:34:47 UTC (rev 1925)
@@ -151,6 +151,8 @@
   cPopulation(cWorld* world);
   ~cPopulation();
 
+  void InitiatePop();
+
   // Activate the offspring of an organism in the population
   bool ActivateOffspring(cAvidaContext& ctx, cGenome& child_genome, cOrganism& parent_organism);
   bool ActivateParasite(cOrganism& parent, const cCodeLabel& label, const cGenome& injected_code);

Modified: branches/energy/source/main/cPopulationCell.cc
===================================================================
--- branches/energy/source/main/cPopulationCell.cc	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cPopulationCell.cc	2007-08-10 20:34:47 UTC (rev 1925)
@@ -31,6 +31,8 @@
 #include "cTools.h"
 #include "cWorld.h"
 #include "cEnvironment.h"
+#include "cPopulation.h"
+#include "cDeme.h"
 
 using namespace std;
 
@@ -184,6 +186,17 @@
   // Adjust the organism's attributes to match this cell.
   organism->GetOrgInterface().SetCellID(cell_id);
   organism->GetOrgInterface().SetDemeID(deme_id);
+  
+  if(m_world->GetConfig().ENERGY_ENABLED.Get() == 1 && m_world->GetConfig().FRAC_ENERGY_TRANSFER.Get() > 0.0) {
+    // uptake all the cells energy
+    double uptake_energy = UptakeCellEnergy(1.0);
+    if(uptake_energy != 0.0) {
+      // update energy and merit
+      cPhenotype& phen = organism->GetPhenotype();
+      phen.ReduceEnergy(-1.0 * uptake_energy);
+      phen.SetMerit(cMerit(cMerit::EnergyToMerit(phen.GetStoredEnergy(), m_world)));
+    }
+  }
 }
 
 cOrganism * cPopulationCell::RemoveOrganism()
@@ -192,11 +205,29 @@
 
   // For the moment, the cell doesn't keep track of much...
   cOrganism * out_organism = organism;
+  if(m_world->GetConfig().ENERGY_ENABLED.Get() == 1 && m_world->GetConfig().FRAC_ENERGY_TRANSFER.Get() > 0.0) {
+    IncreaseCellEnergy(organism->GetPhenotype().GetStoredEnergy() * m_world->GetConfig().FRAC_ENERGY_TRANSFER.Get()); // put remaining energy back into cell
+  }
   organism = NULL;
   return out_organism;
 }
 
+void cPopulationCell::UpdateCellEnergy() {
+  // ONLY DEME-LEVEL SPACIAL RESOURCES ARE IMPLEMENTED
+  cell_energy += m_world->GetPopulation().GetDeme(deme_id).GetAndClearCellEnergy(cell_id);
+}
 
+double cPopulationCell::UptakeCellEnergy(double frac_to_uptake) {
+  assert(0.0 <= frac_to_uptake);
+  assert(frac_to_uptake <= 1.0);
+
+  UpdateCellEnergy();
+  double uptakeAmount = cell_energy * frac_to_uptake;
+  cell_energy -= uptakeAmount;
+  return uptakeAmount;
+}
+
+
 bool cPopulationCell::OK()
 {
   // Nothing for the moment...

Modified: branches/energy/source/main/cPopulationCell.h
===================================================================
--- branches/energy/source/main/cPopulationCell.h	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cPopulationCell.h	2007-08-10 20:34:47 UTC (rev 1925)
@@ -61,9 +61,13 @@
   int m_x; //!< The x-coordinate of the position of this cell in the environment.
   int m_y; //!< The y-coordinate of the position of this cell in the environment.
 
+  double cell_energy; //!< energy stored in the cell
+
   void InsertOrganism(cOrganism & new_org);
   cOrganism* RemoveOrganism();
 
+  void UpdateCellEnergy();
+
 public:
   cPopulationCell();
   cPopulationCell(const cPopulationCell& in_cell);
@@ -94,6 +98,10 @@
 
   bool IsOccupied() const { return organism != NULL; }
 
+//  void SetCellEnergy(const double in_energy) { cell_energy = in_energy; }
+  void IncreaseCellEnergy(const double in_energy) { cell_energy += in_energy; }
+  double UptakeCellEnergy(double frac_to_uptake);
+
   bool OK();
 };
 

Modified: branches/energy/source/main/cResource.cc
===================================================================
--- branches/energy/source/main/cResource.cc	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cResource.cc	2007-08-10 20:34:47 UTC (rev 1925)
@@ -66,6 +66,7 @@
   , ydiffuse(1.0)
   , ygravity(0.0)
   , deme_resource(false)
+  , energy_resource(false)
 {
 }
 
@@ -94,11 +95,23 @@
   _deme_resource.ToLower();
   if ((_deme_resource == "false") || (_deme_resource == "0")) {
     deme_resource = false;
-    return(true);
+    return true;
   } else if ((_deme_resource == "true") || (_deme_resource == "1")) {
     deme_resource = true;
-    return(true);
-  } else {
-    return false;
+    return true;
   }
+  return false;
 }
+
+/* Set if the resource is a energy resource */
+bool cResource::SetEnergyResource(cString _energy_resource) {
+  _energy_resource.ToLower();
+  if ((_energy_resource == "false") || (_energy_resource == "0")) {
+    energy_resource = false;
+    return true;
+  } else if ((_energy_resource == "true") || (_energy_resource == "1")) {
+    energy_resource = true;
+    return true;
+  }
+  return false;
+}

Modified: branches/energy/source/main/cResource.h
===================================================================
--- branches/energy/source/main/cResource.h	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cResource.h	2007-08-10 20:34:47 UTC (rev 1925)
@@ -79,6 +79,7 @@
   double ydiffuse;
   double ygravity;
   bool deme_resource;
+  bool energy_resource;  // only implemented for spacial resource
   tArray<cCellResource> cell_list;
  
   
@@ -107,6 +108,7 @@
   double GetYDiffuse() const { return ydiffuse; }
   double GetYGravity() const { return ygravity; }
   bool GetDemeResource() const { return deme_resource; }
+  bool GetEnergyResource() const { return energy_resource; }
   tArray<cCellResource> *GetCellListPtr() { return &cell_list; }
 
 
@@ -127,6 +129,7 @@
   void SetYDiffuse(double _ydiffuse) { ydiffuse = _ydiffuse; }
   void SetYGravity(double _ygravity) { ygravity = _ygravity; }
   bool SetDemeResource(cString _deme_resource);
+  bool SetEnergyResource(cString _energy_resource);
   void AddCellResource(cCellResource new_cell) { cell_list.Push(new_cell); }
 };
 

Modified: branches/energy/source/main/cWorld.cc
===================================================================
--- branches/energy/source/main/cWorld.cc	2007-08-10 14:35:33 UTC (rev 1924)
+++ branches/energy/source/main/cWorld.cc	2007-08-10 20:34:47 UTC (rev 1925)
@@ -107,6 +107,7 @@
 		m_class_mgr->LoadCCladeFounders(m_conf->TRACK_CCLADES_IDS.Get());
   
 	m_pop = new cPopulation(this);
+        m_pop->InitiatePop();
   
   // Setup Event List
   m_event_list = new cEventList(this);




More information about the Avida-cvs mailing list