[Avida-SVN] r3265 - in branches/mabinmer/source: actions cpu main

mabinmer at myxo.css.msu.edu mabinmer at myxo.css.msu.edu
Wed May 27 14:23:19 PDT 2009


Author: mabinmer
Date: 2009-05-27 17:23:19 -0400 (Wed, 27 May 2009)
New Revision: 3265

Modified:
   branches/mabinmer/source/actions/PrintActions.cc
   branches/mabinmer/source/cpu/cHardwareCPU.cc
   branches/mabinmer/source/cpu/cHardwareGX.cc
   branches/mabinmer/source/cpu/cTestCPUInterface.cc
   branches/mabinmer/source/cpu/cTestCPUInterface.h
   branches/mabinmer/source/main/cOrgInterface.h
   branches/mabinmer/source/main/cOrganism.h
   branches/mabinmer/source/main/cPopulation.cc
   branches/mabinmer/source/main/cPopulation.h
   branches/mabinmer/source/main/cPopulationInterface.cc
   branches/mabinmer/source/main/cPopulationInterface.h
   branches/mabinmer/source/main/cStats.cc
   branches/mabinmer/source/main/cStats.h
Log:
Added kazi counts, changed "Kaboom" to "Explode", output file for kazi data

Modified: branches/mabinmer/source/actions/PrintActions.cc
===================================================================
--- branches/mabinmer/source/actions/PrintActions.cc	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/actions/PrintActions.cc	2009-05-27 21:23:19 UTC (rev 3265)
@@ -131,6 +131,8 @@
 STATS_OUT_FILE(PrintDynamicMaxMinData,		maxmin.dat			);
 STATS_OUT_FILE(PrintNumOrgsKilledData,      orgs_killed.dat);
 
+STATS_OUT_FILE(PrintExplodeData,			explode_data.dat);
+
 // reputation
 STATS_OUT_FILE(PrintReputationData,         reputation.dat);
 STATS_OUT_FILE(PrintShadedAltruists,         shadedaltruists.dat);
@@ -3088,6 +3090,8 @@
   
   action_lib->Register<cActionPrintNumOrgsKilledData>("PrintNumOrgsKilledData");//ZOOZ
 
+  action_lib->Register<cActionPrintExplodeData>("PrintExplodeData");
+	
   // @DMB - The following actions are DEPRECATED aliases - These will be removed in 2.7.
   action_lib->Register<cActionPrintAverageData>("print_average_data");
   action_lib->Register<cActionPrintErrorData>("print_error_data");

Modified: branches/mabinmer/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/mabinmer/source/cpu/cHardwareCPU.cc	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/cpu/cHardwareCPU.cc	2009-05-27 21:23:19 UTC (rev 3265)
@@ -2958,7 +2958,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(-1);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(-1);
   return true;
 }
 
@@ -2967,7 +2967,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(0);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(0);
   return true;
 }
 
@@ -2975,7 +2975,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(1);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(1);
   return true;
 }
 
@@ -2983,7 +2983,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(2);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(2);
   return true;
 }
 
@@ -2991,7 +2991,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(3);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(3);
   return true;
 }
 
@@ -2999,7 +2999,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(4);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(4);
   return true;
 }
 
@@ -3007,7 +3007,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(5);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(5);
   return true;
 }
 
@@ -3015,7 +3015,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(6);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(6);
   return true;
 }
 
@@ -3023,7 +3023,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(7);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(7);
   return true;
 }
 
@@ -3031,7 +3031,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(8);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(8);
   return true;
 }
 
@@ -3039,7 +3039,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(9);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(9);
   return true;
 }
 
@@ -3047,7 +3047,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(10);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(10);
   return true;
 }
 
@@ -3055,7 +3055,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(100);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(100);
   return true;
 }
 

Modified: branches/mabinmer/source/cpu/cHardwareGX.cc
===================================================================
--- branches/mabinmer/source/cpu/cHardwareGX.cc	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/cpu/cHardwareGX.cc	2009-05-27 21:23:19 UTC (rev 3265)
@@ -2140,7 +2140,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(0);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(0);
   return true;
 }
 
@@ -2148,7 +2148,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(1);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(1);
   return true;
 }
 
@@ -2156,7 +2156,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(2);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(2);
   return true;
 }
 
@@ -2164,7 +2164,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(3);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(3);
   return true;
 }
 
@@ -2172,7 +2172,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(4);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(4);
   return true;
 }
 
@@ -2180,7 +2180,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(5);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(5);
   return true;
 }
 
@@ -2188,7 +2188,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(6);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(6);
   return true;
 }
 
@@ -2196,7 +2196,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(7);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(7);
   return true;
 }
 
@@ -2204,7 +2204,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(8);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(8);
   return true;
 }
 
@@ -2212,7 +2212,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(9);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(9);
   return true;
 }
 
@@ -2220,7 +2220,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(10);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(10);
   return true;
 }
 
@@ -2228,7 +2228,7 @@
 {
   const int reg_used = FindModifiedRegister(REG_AX);
   double percentProb = ((double) (GetRegister(reg_used) % 100)) / 100.0;
-  if ( ctx.GetRandom().P(percentProb) ) m_organism->Kaboom(100);
+  if ( ctx.GetRandom().P(percentProb) ) m_organism->Explode(100);
   return true;
 }
 

Modified: branches/mabinmer/source/cpu/cTestCPUInterface.cc
===================================================================
--- branches/mabinmer/source/cpu/cTestCPUInterface.cc	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/cpu/cTestCPUInterface.cc	2009-05-27 21:23:19 UTC (rev 3265)
@@ -102,7 +102,7 @@
 {
 }
 
-void cTestCPUInterface::Kaboom(int distance)
+void cTestCPUInterface::Explode(int distance)
 {
   (void) distance;
   // @CAO We should keep a note that the organism tried to explode, and

Modified: branches/mabinmer/source/cpu/cTestCPUInterface.h
===================================================================
--- branches/mabinmer/source/cpu/cTestCPUInterface.h	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/cpu/cTestCPUInterface.h	2009-05-27 21:23:19 UTC (rev 3265)
@@ -82,7 +82,7 @@
   void UpdateResources(const tArray<double>& res_change);
   void UpdateDemeResources(const tArray<double>& res_change) {;}
   void Die();
-  void Kaboom(int distance);
+  void Explode(int distance);
   void SpawnDeme();
   cOrgSinkMessage* NetReceive() { return NULL; } // @DMB - todo: receive message
   bool NetRemoteValidate(cAvidaContext& ctx, cOrgSinkMessage* msg) { return false; } // @DMB - todo: validate message

Modified: branches/mabinmer/source/main/cOrgInterface.h
===================================================================
--- branches/mabinmer/source/main/cOrgInterface.h	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cOrgInterface.h	2009-05-27 21:23:19 UTC (rev 3265)
@@ -93,7 +93,7 @@
   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 Explode(int distance) = 0;
   virtual void SpawnDeme() = 0;
   virtual cOrgSinkMessage* NetReceive() = 0;
   virtual bool NetRemoteValidate(cAvidaContext& ctx, cOrgSinkMessage* msg) = 0;

Modified: branches/mabinmer/source/main/cOrganism.h
===================================================================
--- branches/mabinmer/source/main/cOrganism.h	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cOrganism.h	2009-05-27 21:23:19 UTC (rev 3265)
@@ -256,7 +256,7 @@
   tBuffer<int>& GetInputBuf() { return m_input_buf; }
   tBuffer<int>& GetOutputBuf() { return m_output_buf; }
   void Die() { m_interface->Die(); m_is_dead = true; }
-  void Kaboom(int dist) { m_interface->Kaboom(dist);}
+  void Explode(int dist) { m_interface->Explode(dist);}
   void SpawnDeme() { m_interface->SpawnDeme(); }
   int GetDebugInfo() { return m_interface->Debug(); }
   bool GetSentActive() { return m_sent_active; }

Modified: branches/mabinmer/source/main/cPopulation.cc
===================================================================
--- branches/mabinmer/source/main/cPopulation.cc	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cPopulation.cc	2009-05-27 21:23:19 UTC (rev 3265)
@@ -767,7 +767,7 @@
   m_world->GetClassificationManager().AdjustGenotype(*genotype);
 }
 
-void cPopulation::Kaboom(cPopulationCell & in_cell, int distance)
+void cPopulation::Explode(cPopulationCell & in_cell, int distance)
 {
   cOrganism * organism = in_cell.GetOrganism();
   cGenotype * genotype = organism->GetGenotype();

Modified: branches/mabinmer/source/main/cPopulation.h
===================================================================
--- branches/mabinmer/source/main/cPopulation.h	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cPopulation.h	2009-05-27 21:23:19 UTC (rev 3265)
@@ -179,7 +179,7 @@
   void MoveOrganisms(cAvidaContext& ctx, cPopulationCell& src_cell, cPopulationCell& dest_cell);
 
   // Specialized functionality
-  void Kaboom(cPopulationCell& in_cell, int distance=0);
+  void Explode(cPopulationCell& in_cell, int distance=0);
   void AddSellValue(const int data, const int label, const int sell_price, const int org_id, const int cell_id);
   int BuyValue(const int label, const int buy_price, const int cell_id);
   void SwapCells(cPopulationCell & cell1, cPopulationCell & cell2);

Modified: branches/mabinmer/source/main/cPopulationInterface.cc
===================================================================
--- branches/mabinmer/source/main/cPopulationInterface.cc	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cPopulationInterface.cc	2009-05-27 21:23:19 UTC (rev 3265)
@@ -170,10 +170,10 @@
   m_world->GetPopulation().KillOrganism(cell);
 }
 
-void cPopulationInterface::Kaboom(int distance)
+void cPopulationInterface::Explode(int distance)
 {
   cPopulationCell & cell = m_world->GetPopulation().GetCell(m_cell_id);
-  m_world->GetPopulation().Kaboom(cell, distance);
+  m_world->GetPopulation().Explode(cell, distance);
 }
 
 void cPopulationInterface::SpawnDeme()

Modified: branches/mabinmer/source/main/cPopulationInterface.h
===================================================================
--- branches/mabinmer/source/main/cPopulationInterface.h	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cPopulationInterface.h	2009-05-27 21:23:19 UTC (rev 3265)
@@ -95,7 +95,7 @@
   void UpdateResources(const tArray<double>& res_change);
   void UpdateDemeResources(const tArray<double>& res_change);
   void Die();
-  void Kaboom(int distance);
+  void Explode(int distance);
   void SpawnDeme();
   cOrgSinkMessage* NetReceive();
   bool NetRemoteValidate(cAvidaContext& ctx, cOrgSinkMessage* msg);

Modified: branches/mabinmer/source/main/cStats.cc
===================================================================
--- branches/mabinmer/source/main/cStats.cc	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cStats.cc	2009-05-27 21:23:19 UTC (rev 3265)
@@ -781,6 +781,21 @@
   df.Endl();
 }
 
+void cStats::PrintExplodeData(const cString& filename)
+{
+  cDataFile& df = m_world->GetDataFile(filename);
+	
+  df.WriteComment("Avida Kazi Explosion Data");
+  df.WriteTimeStamp();
+	
+  df.Write(m_update, "Update");
+  df.Write(sum_total_explosions.Ave(), "Average of total explosions");
+  df.Write(sum_successful_explosions.Ave(), "Average of successful explosions");
+  df.Endl();
+  sum_total_explosions.Clear();
+  sum_successful_explosions.Clear();
+}
+
 void cStats::PrintParasiteData(const cString& filename)
 {
   cDataFile& df = m_world->GetDataFile(filename);

Modified: branches/mabinmer/source/main/cStats.h
===================================================================
--- branches/mabinmer/source/main/cStats.h	2009-05-27 17:30:41 UTC (rev 3264)
+++ branches/mabinmer/source/main/cStats.h	2009-05-27 21:23:19 UTC (rev 3265)
@@ -558,6 +558,9 @@
   void IncExecuted() { num_executed++; }
   
   void IncNumOrgsKilled() { num_orgs_killed++; }
+	
+  cIntSum sum_total_explosions;
+  cIntSum sum_successful_explosions;
 
   void AddCurTask(int task_num) { task_cur_count[task_num]++; }
   void AddCurTaskQuality(int task_num, double quality) 
@@ -727,6 +730,9 @@
   int GetSpeculativeWaste() const { return m_spec_waste; }
   
   int GetNumOrgsKilled() const { return num_orgs_killed; }
+   
+  cIntSum& SumTotalExplosions() { return sum_total_explosions; }
+  cIntSum& SumSuccessfulExplosions() { return sum_successful_explosions; }
 
   // this value gets recorded when a creature with the particular
   // fitness value gets born. It will never change to a smaller value,
@@ -775,8 +781,7 @@
   void PrintCellVisitsData(const cString& filename);
   void PrintExtendedTimeData(const cString& filename);
   void PrintNumOrgsKilledData(const cString& filename);
-  void PrintExplodeTotalData(const cString& filename);
-  void PrintExplodeSuccessesData(const cString& filename);
+  void PrintExplodeData(const cString& filename);
   
   // deme predicate stats
   void IncEventCount(int x, int y);




More information about the Avida-cvs mailing list