[Avida-SVN] r1753 - in development/source: analyze main

matt at myxo.css.msu.edu matt at myxo.css.msu.edu
Thu Jul 5 15:22:25 PDT 2007


Author: matt
Date: 2007-07-05 18:22:25 -0400 (Thu, 05 Jul 2007)
New Revision: 1753

Modified:
   development/source/analyze/cAnalyze.cc
   development/source/analyze/cAnalyzeGenotype.cc
   development/source/analyze/cAnalyzeGenotype.h
   development/source/main/cEnvironment.h
Log:
Added access to testcpu inputs to cAnalyzeGenotype and analyze data entries.

Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc	2007-07-05 19:06:47 UTC (rev 1752)
+++ development/source/analyze/cAnalyze.cc	2007-07-05 22:22:25 UTC (rev 1753)
@@ -8015,6 +8015,14 @@
                                 (t_name, t_desc, &cAnalyzeGenotype::GetTaskCount, i, 5));
   }
   
+  for (int i = 0; i < environment.GetInputSize(); i++){
+    cString t_name, t_desc;
+    t_name.Set("env_input.%d", i);
+    t_desc.Set("env_input.%d", i);
+    genotype_data_list.PushRear(new tArgDataEntry<cAnalyzeGenotype, int, int>
+                                (t_name, t_desc, &cAnalyzeGenotype::GetEnvInput, i, 0));
+  }
+  
   // The remaining values should actually go in a seperate list called
   // "population_data_list", but for the moment we're going to put them
   // here so that we only need to worry about a single system to load and

Modified: development/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- development/source/analyze/cAnalyzeGenotype.cc	2007-07-05 19:06:47 UTC (rev 1752)
+++ development/source/analyze/cAnalyzeGenotype.cc	2007-07-05 22:22:25 UTC (rev 1753)
@@ -391,6 +391,7 @@
   cOrganism* test_organism = test_info->GetTestOrganism();
   cPhenotype& test_phenotype = test_organism->GetPhenotype();
 
+  m_env_inputs = test_info->GetTestCPUInputs();
   SetExecutedFlags(test_organism->GetHardware().GetMemory());
 
   length = test_organism->GetGenome().GetSize();

Modified: development/source/analyze/cAnalyzeGenotype.h
===================================================================
--- development/source/analyze/cAnalyzeGenotype.h	2007-07-05 19:06:47 UTC (rev 1752)
+++ development/source/analyze/cAnalyzeGenotype.h	2007-07-05 22:22:25 UTC (rev 1753)
@@ -130,6 +130,7 @@
   cString executed_flags; // converted into a string
   tArray<int> task_counts;
   tArray<double> task_qualities;
+  tArray<int> m_env_inputs;
 
   // Group 3 : Stats requiring parental genotype (Also from test CPUs)
   double fitness_ratio;
@@ -339,6 +340,13 @@
   const tArray<int> & GetTaskCounts() const {
     return task_counts;
   }
+  int GetEnvInput(int input_id) const{
+    if (input_id >= m_env_inputs.GetSize()) return 0;
+    return m_env_inputs[input_id];
+  }
+  const tArray<int>& GetEnvInputs() const{
+    return m_env_inputs;
+  }
 
   double GetTaskQuality(int task_id) const {
 	  if (task_id >= task_counts.GetSize()) return 0;

Modified: development/source/main/cEnvironment.h
===================================================================
--- development/source/main/cEnvironment.h	2007-07-05 19:06:47 UTC (rev 1752)
+++ development/source/main/cEnvironment.h	2007-07-05 22:22:25 UTC (rev 1753)
@@ -142,8 +142,8 @@
   cReactionLib& GetReactionLib() { return reaction_lib; }
   cMutationRates& GetMutRates() { return mut_rates; }
   
-  int GetInputSize() { return m_input_size; }
-  int GetOutputSize() { return m_output_size; }
+  int GetInputSize()  const { return m_input_size; };
+  int GetOutputSize() const { return m_output_size; };
 
   double GetReactionValue(int& reaction_id);
   bool SetReactionValue(cAvidaContext& ctx, const cString& name, double value);




More information about the Avida-cvs mailing list