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

blwalker at myxo.css.msu.edu blwalker at myxo.css.msu.edu
Fri Oct 10 08:06:36 PDT 2008


Author: blwalker
Date: 2008-10-10 11:06:36 -0400 (Fri, 10 Oct 2008)
New Revision: 2830

Modified:
   branches/collect/source/main/cOrganism.cc
   branches/collect/source/main/cOrganism.h
   branches/collect/source/main/cPopulation.cc
Log:

Bug fix: fixes m_rbins sizing problem in analyze mode.

Note this branch still has at least one known bug having to do with instruction execution counts.  (This so far appears to be unconnected to the core resource collection/hoarding code.)


Modified: branches/collect/source/main/cOrganism.cc
===================================================================
--- branches/collect/source/main/cOrganism.cc	2008-10-10 13:13:49 UTC (rev 2829)
+++ branches/collect/source/main/cOrganism.cc	2008-10-10 15:06:36 UTC (rev 2830)
@@ -158,6 +158,10 @@
 {
   delete m_interface;
   m_interface = interface;
+  
+  // initialize m_rbins as soon as the interface is available
+  m_rbins = m_interface->GetResources();
+  m_rbins.SetAll(0.0);
 }
 
 double cOrganism::GetRBinsTotal()

Modified: branches/collect/source/main/cOrganism.h
===================================================================
--- branches/collect/source/main/cOrganism.h	2008-10-10 13:13:49 UTC (rev 2829)
+++ branches/collect/source/main/cOrganism.h	2008-10-10 15:06:36 UTC (rev 2830)
@@ -104,6 +104,7 @@
   cLineage* m_lineage;                    // A lineage descriptor... (different from label)
 	int cclade_id;				                  // @MRR Coalescence clade information (set in cPopulation)
   tArray<double> m_rbins;				          // Holds amount of resources internal to org
+  																				// Note: m_rbins gets its proper size in SetOrgInterface()
   
 	// Other stats
   cCPUMemory m_child_genome;              // Child genome, while under construction.

Modified: branches/collect/source/main/cPopulation.cc
===================================================================
--- branches/collect/source/main/cPopulation.cc	2008-10-10 13:13:49 UTC (rev 2829)
+++ branches/collect/source/main/cPopulation.cc	2008-10-10 15:06:36 UTC (rev 2830)
@@ -475,17 +475,7 @@
   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