[Avida-cvs] [Avida2-svn] r262 - in branches/developers/matt-hcopy-hack/source: cpu main

matt@myxo.css.msu.edu matt at myxo.css.msu.edu
Mon Jul 25 21:46:56 PDT 2005


Author: matt
Date: 2005-07-26 00:46:56 -0400 (Tue, 26 Jul 2005)
New Revision: 262

Modified:
   branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc
   branches/developers/matt-hcopy-hack/source/cpu/test_cpu.cc
   branches/developers/matt-hcopy-hack/source/main/analyze.cc
   branches/developers/matt-hcopy-hack/source/main/analyze_genotype.cc
   branches/developers/matt-hcopy-hack/source/main/analyze_genotype.hh
   branches/developers/matt-hcopy-hack/source/main/instruction.hh
Log:

Modifications to analyze_genotype's map_tasks command
and assisting data structures to allow for meta-
instruction information to be stored via h-copy's.


Modified: branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc
===================================================================
--- branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc	2005-07-25 18:23:51 UTC (rev 261)
+++ branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc	2005-07-26 04:46:56 UTC (rev 262)
@@ -3326,7 +3326,7 @@
   }
 
   cpu_stats.mut_stats.copies_exec++;
-
+  read_inst.SetMeta(0xff); 
   write_head.SetInst(read_inst);
   write_head.FlagCopied() = true;  // Set the copied flag...
 
@@ -3359,7 +3359,7 @@
   }
 
   cpu_stats.mut_stats.copies_exec++;
-
+  read_inst.SetMeta((int) reduction);
   write_head.SetInst(read_inst);
   write_head.FlagCopied() = true;  // Set the copied flag...
 

Modified: branches/developers/matt-hcopy-hack/source/cpu/test_cpu.cc
===================================================================
--- branches/developers/matt-hcopy-hack/source/cpu/test_cpu.cc	2005-07-25 18:23:51 UTC (rev 261)
+++ branches/developers/matt-hcopy-hack/source/cpu/test_cpu.cc	2005-07-26 04:46:56 UTC (rev 262)
@@ -162,15 +162,15 @@
   // Print out some final info in trace...
   if (trace_fp != NULL) {
     if (time_used == time_allocated) {
-      *trace_fp << endl << "TIMEOUT: No offspring produced." << endl;
+      *trace_fp << endl << "# TIMEOUT: No offspring produced." << endl;
     }
     else if (organism.GetHardware().GetMemory().GetSize() == 0) {
-      *trace_fp << endl << "ORGANISM DEATH: No offspring produced." << endl;
+      *trace_fp << endl << "# ORGANISM DEATH: No offspring produced." << endl;
     }
     else {
-      *trace_fp << endl << "Final Memory: "
+      *trace_fp << endl << " # Final Memory: "
 		<< organism.GetHardware().GetMemory().AsString() << endl
-		<< "Child Memory: " << organism.ChildGenome().AsString()
+		<< "# Child Memory: " << organism.ChildGenome().AsString()
 		<< endl;
     }
   }

Modified: branches/developers/matt-hcopy-hack/source/main/analyze.cc
===================================================================
--- branches/developers/matt-hcopy-hack/source/main/analyze.cc	2005-07-25 18:23:51 UTC (rev 261)
+++ branches/developers/matt-hcopy-hack/source/main/analyze.cc	2005-07-26 04:46:56 UTC (rev 262)
@@ -2406,7 +2406,15 @@
       fp << map_inst_set.GetName(cur_inst) << " ";
       if (link_insts == true) fp << "</a>";
       
+      //mrr
+      if (file_type == FILE_TYPE_HTML) fp << "<td align=center>";
+      fp << genotype->GetFinalGenome()[line_num].GetMeta();
+      fp << " " << genotype->GetChildGenome()[line_num].GetMeta();
+      fp << " ";
+      fp << map_inst_set.GetName(
+		      genotype->GetChildGenome()[line_num].GetOp()) << " ";
       
+      
       // Print the individual columns...
       output_it.Reset();
       tDataEntryCommand<cAnalyzeGenotype> * data_command = NULL;

Modified: branches/developers/matt-hcopy-hack/source/main/analyze_genotype.cc
===================================================================
--- branches/developers/matt-hcopy-hack/source/main/analyze_genotype.cc	2005-07-25 18:23:51 UTC (rev 261)
+++ branches/developers/matt-hcopy-hack/source/main/analyze_genotype.cc	2005-07-26 04:46:56 UTC (rev 262)
@@ -14,7 +14,7 @@
 #include "organism.hh"
 #include "phenotype.hh"
 #include "test_cpu.hh"
-
+#include "hardware_base.hh"  //mrr: does this break levels?
 using namespace std;
 
 //////////////////////
@@ -52,6 +52,8 @@
   , ancestor_dist(0)
   , parent_muts("")
   , landscape_stats(NULL)
+  , child_genome(NULL)
+  , final_genome(NULL)	
 {
   // Make sure that the sequences jive with the inst_set
   for (int i = 0; i < genome.GetSize(); i++) {
@@ -94,6 +96,8 @@
   , ancestor_dist(0)
   , parent_muts("")
   , landscape_stats(NULL)
+  , child_genome(NULL)
+  , final_genome(NULL)	
 {
 }
 
@@ -127,6 +131,8 @@
   , ancestor_dist(_gen.ancestor_dist)
   , parent_muts(_gen.parent_muts)
   , landscape_stats(NULL)
+  , child_genome(NULL)
+  , final_genome(NULL)	
 {
   if (_gen.landscape_stats != NULL) {
     landscape_stats = new cAnalyzeLandscape;
@@ -137,6 +143,8 @@
 cAnalyzeGenotype::~cAnalyzeGenotype()
 {
   if (landscape_stats != NULL) delete landscape_stats;
+  if (child_genome != NULL) delete child_genome;
+  if (final_genome != NULL) delete final_genome;
 }
 
 
@@ -171,6 +179,8 @@
   cTestCPU::TestGenome(test_info, genome);
   cTestCPU::SetInstSet(inst_set_backup);
 
+  
+  
   viable = test_info.IsViable();
 
   cOrganism * test_organism = test_info.GetTestOrganism();
@@ -186,6 +196,11 @@
   div_type = test_phenotype.GetDivType();
   task_counts = test_phenotype.GetLastTaskCount();
 
+  final_genome = 
+	  new cGenome(*dynamic_cast<cGenome*>(&test_organism->GetHardware().GetMemory()));
+  child_genome =
+	  new cGenome(*dynamic_cast<cGenome*>(&test_organism->ChildGenome()));
+
   // Setup a new parent stats if we have a parent to work with.
   if (parent_genotype != NULL) {
     fitness_ratio = GetFitness() / parent_genotype->GetFitness();

Modified: branches/developers/matt-hcopy-hack/source/main/analyze_genotype.hh
===================================================================
--- branches/developers/matt-hcopy-hack/source/main/analyze_genotype.hh	2005-07-25 18:23:51 UTC (rev 261)
+++ branches/developers/matt-hcopy-hack/source/main/analyze_genotype.hh	2005-07-26 04:46:56 UTC (rev 262)
@@ -46,6 +46,9 @@
   cString aligned_sequence;  // Sequence (in ASCII) after alignment
   cString tag;               // All genotypes in a batch can be tagged
 
+  cGenome * final_genome;      // mrr -- from test CPU in Recalculate
+  cGenome * child_genome;
+  
   bool viable;
 
   // Group 1 : Load-in Stats (Only obtained if available for input file)
@@ -157,6 +160,12 @@
 //    void SetFracPos(double in_frac);
 
   // Accessors...
+  const cGenome & GetFinalGenome() const 
+        {assert(final_genome != NULL); return *final_genome;}  //mrr 
+  const cGenome & GetChildGenome() const 
+        {assert(child_genome != NULL); return *child_genome;}
+  
+  
   const cGenome & GetGenome() const { return genome; }
   const cString & GetName() const { return name; }
   const cString & GetAlignedSequence() const { return aligned_sequence; }

Modified: branches/developers/matt-hcopy-hack/source/main/instruction.hh
===================================================================
--- branches/developers/matt-hcopy-hack/source/main/instruction.hh	2005-07-25 18:23:51 UTC (rev 261)
+++ branches/developers/matt-hcopy-hack/source/main/instruction.hh	2005-07-26 04:46:56 UTC (rev 262)
@@ -17,15 +17,19 @@
 class cInstruction {
 private:
   UCHAR operand;
-
+  UCHAR meta;
+  
 public:
   // Accessors...
-  int GetOp() const { return (int) operand; }
+  int  GetOp() const    { return (int) operand; }
   void SetOp(int in_op) { assert(in_op < 256); operand = in_op; }
-
+   
+  int  GetMeta() const    {return (int) meta; }
+  void SetMeta(int in_mt) {assert (in_mt < 256); meta = in_mt; }
+  
   // Operators...
   void operator=(const cInstruction & inst)
-    { if (this != &inst) operand = inst.operand; }
+    { if (this != &inst) operand = inst.operand; meta = inst.meta;}
   bool operator==(const cInstruction & inst) const
     { return (operand == inst.operand); }
   bool operator!=(const cInstruction & inst) const




More information about the Avida-cvs mailing list