[Avida-SVN] r2869 - in branches/collect: documentation source/analyze

blwalker at myxo.css.msu.edu blwalker at myxo.css.msu.edu
Thu Oct 23 09:50:29 PDT 2008


Author: blwalker
Date: 2008-10-23 12:50:29 -0400 (Thu, 23 Oct 2008)
New Revision: 2869

Modified:
   branches/collect/documentation/analyze.html
   branches/collect/source/analyze/cAnalyzeGenotype.cc
   branches/collect/source/analyze/cAnalyzeGenotype.h
Log:

Bug fix: inst.n DETAIL option now works, instead of crashing.

This code still contains a couple questionable areas which I will be cleaning up in the next few days.


Modified: branches/collect/documentation/analyze.html
===================================================================
--- branches/collect/documentation/analyze.html	2008-10-23 15:22:20 UTC (rev 2868)
+++ branches/collect/documentation/analyze.html	2008-10-23 16:50:29 UTC (rev 2869)
@@ -639,7 +639,7 @@
 </div>
 
 <p>
-Please note that inst.n is only valid if INSTRUCTION_COUNT is on in defs.h
+Please note that inst.n is only valid if INSTRUCTION_COUNT is on in defs.h.  It gives a count of 0 if there is no such instruction.
 </p>
 
 <p>

Modified: branches/collect/source/analyze/cAnalyzeGenotype.cc
===================================================================
--- branches/collect/source/analyze/cAnalyzeGenotype.cc	2008-10-23 15:22:20 UTC (rev 2868)
+++ branches/collect/source/analyze/cAnalyzeGenotype.cc	2008-10-23 16:50:29 UTC (rev 2869)
@@ -424,24 +424,25 @@
   // The most likely phenotype will be assigned to the phenotype stats
   const cPlasticPhenotype* likely_phenotype = recalc_data.GetMostLikelyPhenotype();
   
-  viable         = likely_phenotype->IsViable();
-  m_env_inputs   = likely_phenotype->GetEnvInputs();
-  executed_flags = likely_phenotype->GetExecutedFlags();
-  length         = likely_phenotype->GetGenomeLength();
-  copy_length    = likely_phenotype->GetCopiedSize();
-  exe_length     = likely_phenotype->GetExecutedSize();
-  merit          = likely_phenotype->GetMerit().GetDouble();
-  gest_time      = likely_phenotype->GetGestationTime();
-  fitness        = likely_phenotype->GetFitness();
-  errors         = likely_phenotype->GetLastNumErrors();
-  div_type       = likely_phenotype->GetDivType();
-  mate_id        = likely_phenotype->MateSelectID();
-  task_counts    = likely_phenotype->GetLastTaskCount();
-  task_qualities = likely_phenotype->GetLastTaskQuality();
-  internal_task_counts = likely_phenotype->GetLastInternalTaskCount();
+  viable                = likely_phenotype->IsViable();
+  m_env_inputs          = likely_phenotype->GetEnvInputs();
+  executed_flags        = likely_phenotype->GetExecutedFlags();
+  inst_executed_counts  = likely_phenotype->GetLastInstCount();
+  length                = likely_phenotype->GetGenomeLength();
+  copy_length           = likely_phenotype->GetCopiedSize();
+  exe_length            = likely_phenotype->GetExecutedSize();
+  merit                 = likely_phenotype->GetMerit().GetDouble();
+  gest_time             = likely_phenotype->GetGestationTime();
+  fitness               = likely_phenotype->GetFitness();
+  errors                = likely_phenotype->GetLastNumErrors();
+  div_type              = likely_phenotype->GetDivType();
+  mate_id               = likely_phenotype->MateSelectID();
+  task_counts           = likely_phenotype->GetLastTaskCount();
+  task_qualities        = likely_phenotype->GetLastTaskQuality();
+  internal_task_counts  = likely_phenotype->GetLastInternalTaskCount();
   internal_task_qualities = likely_phenotype->GetLastInternalTaskQuality();
-  rbins_total    = likely_phenotype->GetLastRBinsTotal();
-  rbins_avail    = likely_phenotype->GetLastRBinsAvail();
+  rbins_total           = likely_phenotype->GetLastRBinsTotal();
+  rbins_avail           = likely_phenotype->GetLastRBinsAvail();
 
   // Setup a new parent stats if we have a parent to work with.
   if (parent_genotype != NULL) {
@@ -515,6 +516,15 @@
   return aligned_executed_flags;
 }
 
+int cAnalyzeGenotype::GetInstExecutedCount(int _inst_num) const
+{
+  if(_inst_num < inst_executed_counts.GetSize() && _inst_num > 0)
+  { return inst_executed_counts[_inst_num]; }
+  
+  // If the instruction is not valid, clearly it has never been executed!
+  return 0;
+}
+
 int cAnalyzeGenotype::GetKO_DeadCount() const
 {
   CalcKnockouts(false);  // Make sure knockouts are calculated

Modified: branches/collect/source/analyze/cAnalyzeGenotype.h
===================================================================
--- branches/collect/source/analyze/cAnalyzeGenotype.h	2008-10-23 15:22:20 UTC (rev 2868)
+++ branches/collect/source/analyze/cAnalyzeGenotype.h	2008-10-23 16:50:29 UTC (rev 2869)
@@ -301,7 +301,7 @@
   cString GetExecutedFlags() const { return executed_flags; }
   cString GetAlignmentExecutedFlags() const;
   const tArray<int>& GetInstExecutedCounts() const { return inst_executed_counts; }
-  int GetInstExecutedCount(int index) const { return inst_executed_counts[index]; }
+  int GetInstExecutedCount(int _inst_num) const;
   const cString & GetTag() const { return tag; }
 
   bool GetViable() const { return viable; }




More information about the Avida-cvs mailing list