[Avida-SVN] r2272 - in development: Avida.xcodeproj source/actions source/cpu source/main source/script

brysonda at myxo.css.msu.edu brysonda at myxo.css.msu.edu
Thu Jan 24 09:27:20 PST 2008


Author: brysonda
Date: 2008-01-24 12:27:20 -0500 (Thu, 24 Jan 2008)
New Revision: 2272

Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/source/actions/PrintActions.cc
   development/source/cpu/cHardwareCPU.cc
   development/source/cpu/cHardwareExperimental.cc
   development/source/cpu/cInstSet.h
   development/source/main/cPhenotype.cc
   development/source/main/cPhenotype.h
   development/source/script/cASSymbol.h
Log:
Fix cHardwareExperimental promoter model so that it properly initializes the initial promoter in single process.  Also allow cPhenotype::executed_insts to be zero.
Finally, move a couple of optimization flags into the per-architecture settings, as they are architecture specific.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/Avida.xcodeproj/project.pbxproj	2008-01-24 17:27:20 UTC (rev 2272)
@@ -2419,13 +2419,11 @@
 					"-falign-loops=16",
 					"-ftree-loop-linear",
 					"-fvariable-expansion-in-unroller",
-					"-mmultiple",
-					"-mstring",
 					"-fgcse",
 					"-fgcse-las",
 				);
 				PER_ARCH_CFLAGS_i386 = "-DCOMPILE_ARCH=\\\"Intel\\\"";
-				PER_ARCH_CFLAGS_ppc = "-DCOMPILE_ARCH=\\\"G4-G5\\\"";
+				PER_ARCH_CFLAGS_ppc = "-DCOMPILE_ARCH=\\\"G4-G5\\\" -mmultiple -mstring";
 				PREBINDING = NO;
 				WARNING_CFLAGS = (
 					"-Wall",

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/source/actions/PrintActions.cc	2008-01-24 17:27:20 UTC (rev 2272)
@@ -471,6 +471,7 @@
   
   void Process(cAvidaContext& ctx)
   {
+    std::cout << "Genotype Count: " << m_world->GetClassificationManager().GetGenotypeCount() << std::endl;
   }
 };
 

Modified: development/source/cpu/cHardwareCPU.cc
===================================================================
--- development/source/cpu/cHardwareCPU.cc	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/source/cpu/cHardwareCPU.cc	2008-01-24 17:27:20 UTC (rev 2272)
@@ -534,8 +534,7 @@
   cPhenotype& phenotype = organism->GetPhenotype();
   
   // First instruction - check whether we should be starting at a promoter, when enabled.
-  if (phenotype.GetCPUCyclesUsed() == 0 && m_world->GetConfig().PROMOTERS_ENABLED.Get() == 1)
-    Inst_Terminate(m_world->GetDefaultContext());
+  if (phenotype.GetCPUCyclesUsed() == 0 && m_world->GetConfig().PROMOTERS_ENABLED.Get() == 1) Inst_Terminate(ctx);
   
   // Count the cpu cycles used
   phenotype.IncCPUCyclesUsed();

Modified: development/source/cpu/cHardwareExperimental.cc
===================================================================
--- development/source/cpu/cHardwareExperimental.cc	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/source/cpu/cHardwareExperimental.cc	2008-01-24 17:27:20 UTC (rev 2272)
@@ -134,8 +134,6 @@
     // Promoter Model
     tInstLibEntry<tMethod>("promoter", &cHardwareExperimental::Inst_Promoter, nInstFlag::PROMOTER),
     tInstLibEntry<tMethod>("terminate", &cHardwareExperimental::Inst_Terminate),
-    tInstLibEntry<tMethod>("promoter", &cHardwareExperimental::Inst_Promoter),
-    tInstLibEntry<tMethod>("terminate", &cHardwareExperimental::Inst_Terminate),
     tInstLibEntry<tMethod>("regulate", &cHardwareExperimental::Inst_Regulate),
     tInstLibEntry<tMethod>("regulate-sp", &cHardwareExperimental::Inst_RegulateSpecificPromoters),
     tInstLibEntry<tMethod>("s-regulate", &cHardwareExperimental::Inst_SenseRegulate),
@@ -248,8 +246,8 @@
     
     m_promoters.Resize(0);
 
-    for (int i=0; i < GetMemory().GetSize(); i++) {
-      if (m_inst_set->IsPromoter(GetMemory()[i])) {
+    for (int i=0; i < m_memory.GetSize(); i++) {
+      if (m_inst_set->IsPromoter(m_memory[i])) {
         int code = Numberate(i - 1, -1, m_world->GetConfig().PROMOTER_CODE_SIZE.Get());
         m_promoters.Push(cPromoter(i, code));
       }
@@ -294,7 +292,11 @@
   // Mark this organism as running...
   organism->SetRunning(true);
   
-  cPhenotype & phenotype = organism->GetPhenotype();
+  cPhenotype& phenotype = organism->GetPhenotype();
+
+  // First instruction - check whether we should be starting at a promoter, when enabled.
+  if (phenotype.GetCPUCyclesUsed() == 0 && m_world->GetConfig().PROMOTERS_ENABLED.Get() == 1) Inst_Terminate(ctx);
+  
   phenotype.IncCPUCyclesUsed();
   if (!m_world->GetConfig().NO_CPU_CYCLE_TIME.Get()) phenotype.IncTimeUsed();
 
@@ -1139,6 +1141,7 @@
   const int value_in = organism->GetNextInput();
   GetRegister(reg_used) = value_in;
   organism->DoInput(value_in);
+  
   return true;
 }
 

Modified: development/source/cpu/cInstSet.h
===================================================================
--- development/source/cpu/cInstSet.h	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/source/cpu/cInstSet.h	2008-01-24 17:27:20 UTC (rev 2272)
@@ -121,8 +121,10 @@
 
   // Instruction Analysis.
   int IsNop(const cInstruction& inst) const { return (inst.GetOp() < m_lib_nopmod_map.GetSize()); }
-  int IsLabel(const cInstruction& inst) const { return m_inst_lib->Get(GetLibFunctionIndex(inst)).IsLabel(); }
-  int IsPromoter(const cInstruction& inst) const { return m_inst_lib->Get(GetLibFunctionIndex(inst)).IsPromoter(); }
+  bool IsLabel(const cInstruction& inst) const { return m_inst_lib->Get(GetLibFunctionIndex(inst)).IsLabel(); }
+  bool IsPromoter(const cInstruction& inst) const { return m_inst_lib->Get(GetLibFunctionIndex(inst)).IsPromoter(); }
+  
+  unsigned int GetFlags(const cInstruction& inst) const { return m_inst_lib->Get(GetLibFunctionIndex(inst)).GetFlags(); }
 
   // Insertion of new instructions...
   cInstruction ActivateNullInst();

Modified: development/source/main/cPhenotype.cc
===================================================================
--- development/source/main/cPhenotype.cc	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/source/main/cPhenotype.cc	2008-01-24 17:27:20 UTC (rev 2272)
@@ -218,7 +218,6 @@
 {
   assert(genome_length >= 0);
   assert(copied_size >= 0);
-  assert(executed_size >= 0);
   assert(gestation_time >= 0);
   assert(gestation_start >= 0);
   assert(fitness >= 0.0);
@@ -262,7 +261,6 @@
   genome_length   = _genome.GetSize();
   copied_size     = parent_phenotype.child_copied_size;
   executed_size   = parent_phenotype.executed_size;
-  assert (executed_size > 0);
   
   gestation_time  = parent_phenotype.gestation_time;
   gestation_start = 0;
@@ -272,7 +270,6 @@
 
   assert(genome_length > 0);
   assert(copied_size > 0);
-  assert(executed_size > 0);
   assert(gestation_time >= 0); //@JEB 0 valid for some fitness methods
   assert(div_type > 0);
 
@@ -828,7 +825,6 @@
 
   assert(genome_length > 0);
   assert(copied_size > 0);
-  assert(executed_size > 0);
   assert(gestation_time >= 0); //@JEB 0 valid for some fitness methods
   assert(div_type > 0);
 
@@ -1266,7 +1262,6 @@
 int cPhenotype::CalcSizeMerit() const
 {
   assert(genome_length > 0);
-  assert(executed_size > 0);
   assert(copied_size > 0);
 
   int out_size;

Modified: development/source/main/cPhenotype.h
===================================================================
--- development/source/main/cPhenotype.h	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/source/main/cPhenotype.h	2008-01-24 17:27:20 UTC (rev 2272)
@@ -394,7 +394,7 @@
   void SetFault(const cString& in_fault) { fault_desc = in_fault; }
   void SetNeutralMetric(double _in){ neutral_metric = _in; }
   void SetLifeFitness(double _in){ life_fitness = _in; }
-  void SetLinesExecuted(int _exe_size) { executed_size = _exe_size;   assert(executed_size > 0); }
+  void SetLinesExecuted(int _exe_size) { executed_size = _exe_size; }
   void SetLinesCopied(int _copied_size) { child_copied_size = _copied_size; }
   void SetDivType(double _div_type) { div_type = _div_type; }  
   void SetDivideSex(bool _divide_sex) { divide_sex = _divide_sex; }  

Modified: development/source/script/cASSymbol.h
===================================================================
--- development/source/script/cASSymbol.h	2008-01-24 03:47:12 UTC (rev 2271)
+++ development/source/script/cASSymbol.h	2008-01-24 17:27:20 UTC (rev 2272)
@@ -25,6 +25,9 @@
 #ifndef cASSymbol_h
 #define cASSymbol_h
 
+#ifndef AvidaScript_h
+#include "AvidaScript.h"
+#endif
 #ifndef cString_h
 #include "cString.h"
 #endif
@@ -33,7 +36,10 @@
 {
 private:
   cString m_name;
+  ASType_t m_type;
+  cString* 
   
+  
   cASSymbol();
   
 public:




More information about the Avida-cvs mailing list