[Avida-SVN] r2814 - branches/collect/source/main

blwalker at myxo.css.msu.edu blwalker at myxo.css.msu.edu
Tue Oct 7 12:19:36 PDT 2008


Author: blwalker
Date: 2008-10-07 15:19:36 -0400 (Tue, 07 Oct 2008)
New Revision: 2814

Modified:
   branches/collect/source/main/cEnvironment.cc
   branches/collect/source/main/cOrganism.cc
   branches/collect/source/main/cPopulation.cc
Log:
Committing some files in the midst of debugging.  This branch is currently broken in analyze mode.


Modified: branches/collect/source/main/cEnvironment.cc
===================================================================
--- branches/collect/source/main/cEnvironment.cc	2008-10-02 19:38:38 UTC (rev 2813)
+++ branches/collect/source/main/cEnvironment.cc	2008-10-07 19:19:36 UTC (rev 2814)
@@ -1016,9 +1016,12 @@
       bool may_use_rbins = m_world->GetConfig().USE_RESOURCE_BINS.Get();
       bool using_rbins = false;  //default: not using resource bins
       
+      if (may_use_rbins) {
+      	assert(rbins_count.GetSize() > res_id);
+      }
+      
       //check to see if we do want to use this resource from a bin instead of the environment
-      if (may_use_rbins && rbins_count[res_id] > consumed && rbins_count[res_id] > 0)
-      {
+      if (may_use_rbins && rbins_count[res_id] > consumed && rbins_count[res_id] > 0) {
         consumed = rbins_count[res_id];
         using_rbins = true;
       }

Modified: branches/collect/source/main/cOrganism.cc
===================================================================
--- branches/collect/source/main/cOrganism.cc	2008-10-02 19:38:38 UTC (rev 2813)
+++ branches/collect/source/main/cOrganism.cc	2008-10-07 19:19:36 UTC (rev 2814)
@@ -60,7 +60,7 @@
   , m_interface(NULL)
   , m_lineage_label(-1)
   , m_lineage(NULL)
-  , m_rbins(world->GetNumResources())
+  , m_rbins(0)
   , m_input_pointer(0)
   , m_input_buf(world->GetEnvironment().GetInputSize())
   , m_output_buf(world->GetEnvironment().GetOutputSize())
@@ -92,6 +92,7 @@
   , m_interface(NULL)
   , m_lineage_label(-1)
   , m_lineage(NULL)
+  , m_rbins(0)
   , m_input_pointer(0)
   , m_input_buf(world->GetEnvironment().GetInputSize())
   , m_output_buf(world->GetEnvironment().GetOutputSize())
@@ -131,9 +132,6 @@
     // m_max_executed must be positive or an organism will not die!
     if (m_max_executed < 1) m_max_executed = 1;
   }
-
-  // Ensure all those nice new resource bins are set to 0
-  m_rbins.SetAll(0.0);
   
   if (m_world->GetConfig().NET_ENABLED.Get()) m_net = new cNetSupport();
   m_id = m_world->GetStats().GetTotCreatures();  

Modified: branches/collect/source/main/cPopulation.cc
===================================================================
--- branches/collect/source/main/cPopulation.cc	2008-10-02 19:38:38 UTC (rev 2813)
+++ branches/collect/source/main/cPopulation.cc	2008-10-07 19:19:36 UTC (rev 2814)
@@ -475,7 +475,17 @@
   assert(in_organism->GetGenome().GetSize() >= 1);
   
   in_organism->SetOrgInterface(new cPopulationInterface(m_world));
+
+cerr << "# resources: " << (in_organism->GetOrgInterface()).GetResources().GetSize() << endl;
+
+  // Now that the interface is specified, we have the resource information to set up the rbins
+  tArray<double> activated_rbins = (in_organism->GetOrgInterface()).GetResources();
+  activated_rbins.SetAll(0.0);  // if initial resource distribution ever differs, it changes here
+  in_organism->SetRBins(activated_rbins);
   
+cerr << "temp size: " << activated_rbins.GetSize() << endl;
+cerr << "rbins size: " << (in_organism->GetRBins()).GetSize();
+  
   // If the organism does not have a genotype, give it one!  No parent
   // information is provided so we must set parents to NULL.
   if (in_organism->GetGenotype() == NULL) {




More information about the Avida-cvs mailing list