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

matt at myxo.css.msu.edu matt at myxo.css.msu.edu
Fri Aug 31 12:19:24 PDT 2007


Author: matt
Date: 2007-08-31 15:19:23 -0400 (Fri, 31 Aug 2007)
New Revision: 2031

Modified:
   development/source/actions/PrintActions.cc
   development/source/analyze/cAnalyzeGenotype.cc
   development/source/main/cPlasticPhenotype.cc
   development/source/main/cPlasticPhenotype.h
Log:
Modifying environment input storage for phenotypic plasticity functions.

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2007-08-30 19:04:02 UTC (rev 2030)
+++ development/source/actions/PrintActions.cc	2007-08-31 19:19:23 UTC (rev 2031)
@@ -1515,6 +1515,8 @@
           << "# gestation time" << endl;
       for (int k = 0; k < m_world->GetEnvironment().GetNumTasks(); k++)
         fot << "# task." << k << endl;
+      for (int k = 0; k < m_world->GetEnvironment().GetInputSize(); k++)
+        fot << "# env_input." << k << endl;
       fot << endl;
     }
     
@@ -1533,7 +1535,11 @@
         tArray<int> tasks = pp->GetLastTaskCount();
         for (int t = 0; t < tasks.GetSize(); t++)
           fot << tasks[t] << " ";
+        tArray<int> env_inputs = pp->GetEnvInputs();
+        for (int e = 0; e < env_inputs.GetSize(); e++)
+          fot << env_inputs[e] << " ";
         fot << endl;
+        
       }
     }
     

Modified: development/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- development/source/analyze/cAnalyzeGenotype.cc	2007-08-30 19:04:02 UTC (rev 2030)
+++ development/source/analyze/cAnalyzeGenotype.cc	2007-08-31 19:19:23 UTC (rev 2031)
@@ -414,7 +414,7 @@
   const cPlasticPhenotype* likely_phenotype = recalc_data.GetMostLikelyPhenotype();
   
   viable         = likely_phenotype->IsViable();
-  m_env_inputs   = likely_phenotype->GetEnvInputs()[0];
+  m_env_inputs   = likely_phenotype->GetEnvInputs();
   executed_flags = likely_phenotype->GetExecutedFlags();
   length         = likely_phenotype->GetGenomeLength();
   copy_length    = likely_phenotype->GetCopiedSize();

Modified: development/source/main/cPlasticPhenotype.cc
===================================================================
--- development/source/main/cPlasticPhenotype.cc	2007-08-30 19:04:02 UTC (rev 2030)
+++ development/source/main/cPlasticPhenotype.cc	2007-08-31 19:19:23 UTC (rev 2031)
@@ -29,16 +29,13 @@
 
 bool cPlasticPhenotype::AddObservation( cCPUTestInfo& test_info )
 {
-  tArray<int> env_inputs = test_info.GetTestCPUInputs();
   cPhenotype& test_phenotype = test_info.GetTestPhenotype();
   if (test_phenotype == *this ){
     if (m_num_observations == 0){
-      m_env_inputs.Resize(1, env_inputs.GetSize());
+      m_env_inputs = test_info.GetTestCPUInputs();
       SetExecutedFlags(test_info);
       m_viable = test_info.IsViable();
-    } else
-      m_env_inputs.Resize(m_env_inputs.GetNumRows()+1, env_inputs.GetSize());
-    m_env_inputs[m_env_inputs.GetNumRows()-1] = env_inputs;
+    } 
     m_num_observations++;
     return true;
   }

Modified: development/source/main/cPlasticPhenotype.h
===================================================================
--- development/source/main/cPlasticPhenotype.h	2007-08-30 19:04:02 UTC (rev 2030)
+++ development/source/main/cPlasticPhenotype.h	2007-08-31 19:19:23 UTC (rev 2031)
@@ -36,8 +36,8 @@
 #include "cPhenotype.h"
 #endif
 
-#ifndef tMatrix_h
-#include "tMatrix.h"
+#ifndef tArray_h
+#include "tArray.h"
 #endif
 
 
@@ -48,7 +48,7 @@
   private:
     int m_num_observations;
     int m_num_trials;
-    tMatrix<int> m_env_inputs;
+    tArray<int> m_env_inputs;
     
     //Information retrieved from test_info not available in phenotype
     cString m_executed_flags;
@@ -70,7 +70,7 @@
     int GetNumObservations()      const { return m_num_observations; }
     int GetNumTrials()            const { return m_num_trials; }
     double GetFrequency()         const { return static_cast<double>(m_num_observations) / m_num_trials; }
-    tMatrix<int> GetEnvInputs()   const { return m_env_inputs; }
+    tArray<int> GetEnvInputs()   const { return m_env_inputs; }
     int IsViable()               const { return m_viable; }
     cString GetExecutedFlags()    const { return m_executed_flags; }
   




More information about the Avida-cvs mailing list