[Avida-SVN] r2533 - in branches/jobScheduling/source: cpu main

beckma24 at myxo.css.msu.edu beckma24 at myxo.css.msu.edu
Mon Apr 14 12:34:41 PDT 2008


Author: beckma24
Date: 2008-04-14 15:34:41 -0400 (Mon, 14 Apr 2008)
New Revision: 2533

Modified:
   branches/jobScheduling/source/cpu/cHardwareBase.cc
   branches/jobScheduling/source/cpu/cHardwareCPU.cc
   branches/jobScheduling/source/main/cAvidaConfig.h
   branches/jobScheduling/source/main/cDeme.cc
   branches/jobScheduling/source/main/cStats.cc
   branches/jobScheduling/source/main/cStats.h
Log:
Bug fixes

Modified: branches/jobScheduling/source/cpu/cHardwareBase.cc
===================================================================
--- branches/jobScheduling/source/cpu/cHardwareBase.cc	2008-04-11 20:22:47 UTC (rev 2532)
+++ branches/jobScheduling/source/cpu/cHardwareBase.cc	2008-04-14 19:34:41 UTC (rev 2533)
@@ -810,11 +810,16 @@
                         * cMerit::EnergyToMerit(organism->GetPhenotype().GetStoredEnergy() * organism->GetPhenotype().GetEnergyUsageRatio() * 2.0, m_world)
                         / 100.0; //compensate by factor of 100
 
-  return organism->GetPhenotype().DoubleEnergyUsage(energy_req);
+  organism->GetPhenotype().DoubleEnergyUsage(energy_req);
+  double newOrgMerit = cMerit::EnergyToMerit(organism->GetPhenotype().GetStoredEnergy()  * organism->GetPhenotype().GetEnergyUsageRatio(), m_world);
+  organism->UpdateMerit(newOrgMerit);
+  return true;
 }
 
 bool cHardwareBase::Inst_HalfEnergyUsage(cAvidaContext& ctx) {
   organism->GetPhenotype().HalfEnergyUsage();
+  double newOrgMerit = cMerit::EnergyToMerit(organism->GetPhenotype().GetStoredEnergy()  * organism->GetPhenotype().GetEnergyUsageRatio(), m_world);
+  organism->UpdateMerit(newOrgMerit);
   return true;
 }
 

Modified: branches/jobScheduling/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/jobScheduling/source/cpu/cHardwareCPU.cc	2008-04-11 20:22:47 UTC (rev 2532)
+++ branches/jobScheduling/source/cpu/cHardwareCPU.cc	2008-04-14 19:34:41 UTC (rev 2533)
@@ -4055,13 +4055,12 @@
   
   for(int i = 0; i < organism->GetNeighborhoodSize(); i++) {
     if(organism->IsNeighborCellOccupied()) // cannot move into occupied cell
-      continue;
+      organism->Rotate(1);
     else if(organism->GetNeighborCellContents() > 0) { 
       Inst_Move(ctx);
       GetRegister(reg_used) = 1;
       return true;
     }
-    organism->Rotate(1);
   }
   assert(organism->GetFacing() == orginalFacing);
   
@@ -4075,11 +4074,10 @@
   
   for(int i = 0; i < organism->GetNeighborhoodSize(); i++) {
     if(organism->IsNeighborCellOccupied()) // cannot move into occupied cell
-      continue;
+      organism->Rotate(1);
     else if(organism->GetNeighborCellContents() > 0) { 
       return true;
     }
-    organism->Rotate(1);
   }
   assert(organism->GetFacing() == orginalFacing);
   IP().Advance();

Modified: branches/jobScheduling/source/main/cAvidaConfig.h
===================================================================
--- branches/jobScheduling/source/main/cAvidaConfig.h	2008-04-11 20:22:47 UTC (rev 2532)
+++ branches/jobScheduling/source/main/cAvidaConfig.h	2008-04-14 19:34:41 UTC (rev 2533)
@@ -474,6 +474,7 @@
   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(FRAC_ENERGY_RELINQUISH, double, 1.0, "Fraction of organisms energy to relinquish");
   CONFIG_ADD_VAR(ENERGY_PASSED_ON_DEME_REPLICATION_METHOD, int, 0, "Who get energy passed from a parent deme\n0 = Energy divided among organisms injected to offspring deme\n1 = Energy divided among cells in offspring deme");
+ 
 
   CONFIG_ADD_GROUP(SECOND_PASS_GROUP, "Tracking metrics known after the running experiment previously");
   CONFIG_ADD_VAR(TRACK_CCLADES, int, 0, "Enable tracking of coalescence clades");

Modified: branches/jobScheduling/source/main/cDeme.cc
===================================================================
--- branches/jobScheduling/source/main/cDeme.cc	2008-04-11 20:22:47 UTC (rev 2532)
+++ branches/jobScheduling/source/main/cDeme.cc	2008-04-14 19:34:41 UTC (rev 2533)
@@ -113,8 +113,8 @@
       else
         consecutiveSuccessfulEventPeriods = 0;
       
-      (m_world->GetStats().FlowRateTuple())[(*iter).second].first.Add(GetOrgCount());
-      (m_world->GetStats().FlowRateTuple())[(*iter).second].second.Add(GetEventsKilledThisSlot());
+      (m_world->GetStats().FlowRateTuples())[(*iter).second].first.Add(GetOrgCount());
+      (m_world->GetStats().FlowRateTuples())[(*iter).second].second.Add(GetEventsKilledThisSlot());
       eventsKilledThisSlot = 0;
       break;
     }
@@ -317,8 +317,8 @@
   // setup stats.flow_rate_tuples
   cStats& stats = m_world->GetStats();
   for(int i = m_total_events_per_slot_min; i <= m_total_events_per_slot_max; i+=flow_level_increment) {
-    (stats.FlowRateTuple())[i].first.Clear();
-    (stats.FlowRateTuple())[i].second.Clear();
+    (stats.FlowRateTuples())[i].first.Clear();
+    (stats.FlowRateTuples())[i].second.Clear();
   }
 }
 

Modified: branches/jobScheduling/source/main/cStats.cc
===================================================================
--- branches/jobScheduling/source/main/cStats.cc	2008-04-11 20:22:47 UTC (rev 2532)
+++ branches/jobScheduling/source/main/cStats.cc	2008-04-14 19:34:41 UTC (rev 2533)
@@ -598,7 +598,7 @@
 
   df.Write(m_update,                                        "Update");
   // write each tuple
-  for(map<int, pair<cIntSum, cIntSum> >::iterator iter = flow_rate_tuple.begin(); iter != flow_rate_tuple.end(); iter++) {
+  for(map<int, pair<cIntSum, cIntSum> >::iterator iter = flow_rate_tuples.begin(); iter != flow_rate_tuples.end(); iter++) {
     ostringstream oss;
     oss << "flow rate " << (*iter).first;
     string flow_rate_str(oss.str());
@@ -613,7 +613,7 @@
   df.Endl();
 
   // reset all tuples
-  for(map<int, pair<cIntSum, cIntSum> >::iterator iter = flow_rate_tuple.begin(); iter != flow_rate_tuple.end(); iter++) {
+  for(map<int, pair<cIntSum, cIntSum> >::iterator iter = flow_rate_tuples.begin(); iter != flow_rate_tuples.end(); iter++) {
     (*iter).second.first.Clear();
     (*iter).second.second.Clear();
   }

Modified: branches/jobScheduling/source/main/cStats.h
===================================================================
--- branches/jobScheduling/source/main/cStats.h	2008-04-11 20:22:47 UTC (rev 2532)
+++ branches/jobScheduling/source/main/cStats.h	2008-04-14 19:34:41 UTC (rev 2533)
@@ -283,7 +283,7 @@
   cDoubleSum EnergyTestamentAcceptedByDeme;
   
   //(event flow rate, (deme pop size, events killed))
-  std::map<int, std::pair<cIntSum, cIntSum> > flow_rate_tuple;
+  std::map<int, std::pair<cIntSum, cIntSum> > flow_rate_tuples;
 
   // Speculative Execution Stats
   int m_spec_total;
@@ -437,7 +437,7 @@
   cDoubleSum& SumEnergyTestamentAcceptedByDeme() { return EnergyTestamentAcceptedByDeme; }
 
   
-  std::map<int, std::pair<cIntSum, cIntSum> >&  FlowRateTuple() { return flow_rate_tuple; }
+  std::map<int, std::pair<cIntSum, cIntSum> >&  FlowRateTuples() { return flow_rate_tuples; }
 
 #if INSTRUCTION_COUNT
   void ZeroInst();
@@ -486,7 +486,7 @@
   const cDoubleSum& SumEnergyTestamentAcceptedByOrganisms() const { return EnergyTestamentAcceptedByOrganisms; }
   const cDoubleSum& SumEnergyTestamentAcceptedByDeme() const { return EnergyTestamentAcceptedByDeme; }
 
-  const std::map<int, std::pair<cIntSum, cIntSum> >&  FlowRateTuple() const { return flow_rate_tuple; }
+  const std::map<int, std::pair<cIntSum, cIntSum> >&  FlowRateTuples() const { return flow_rate_tuples; }
 
 
   void IncResamplings() { ++num_resamplings; }  // @AWC 06/29/06




More information about the Avida-cvs mailing list