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

matt@myxo.css.msu.edu matt at myxo.css.msu.edu
Fri Jul 22 12:17:51 PDT 2005


Author: matt
Date: 2005-07-22 15:17:51 -0400 (Fri, 22 Jul 2005)
New Revision: 252

Modified:
   branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc
   branches/developers/matt-hcopy-hack/source/main/analyze.cc
   branches/developers/matt-hcopy-hack/source/main/instruction.hh
   branches/developers/matt-hcopy-hack/source/main/organism.hh
Log:
MRR - Added instruction meta member and support in analyze
geno/phenotype map.


Modified: branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc
===================================================================
--- branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc	2005-07-22 18:38:34 UTC (rev 251)
+++ branches/developers/matt-hcopy-hack/source/cpu/hardware_cpu.cc	2005-07-22 19:17:51 UTC (rev 252)
@@ -1740,8 +1740,16 @@
   // tests...  Theoretically, we need to worry about the parent changing,
   // but as long as the child is always compared to the original genotype,
   // this won't be an issue.
-  if (phenotype.CopyTrue() == true) return;
-
+  //
+  // Modified to copy hcopy meta attributes into parent genome. --mrr
+  if (phenotype.CopyTrue() == true) 
+  {
+	  cGenome & prnt = organism->GetGenotype()->GetGenome();
+	  cGenome & chld = organism->ChildGenome();
+	  for (int i = 0; i < chld.GetSize(); i++)
+             prnt[i].SetMeta(chld[i].GetMeta());
+	  return;
+  }
   const double parent_fitness = organism->GetTestFitness();
   const double neut_min = parent_fitness * FITNESS_NEUTRAL_MIN;
   const double neut_max = parent_fitness * FITNESS_NEUTRAL_MAX;
@@ -3326,7 +3334,8 @@
   }
 
   cpu_stats.mut_stats.copies_exec++;
-
+  
+  read_inst.SetMeta(0);
   write_head.SetInst(read_inst);
   write_head.FlagCopied() = true;  // Set the copied flag...
 
@@ -3360,6 +3369,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/main/analyze.cc
===================================================================
--- branches/developers/matt-hcopy-hack/source/main/analyze.cc	2005-07-22 18:38:34 UTC (rev 251)
+++ branches/developers/matt-hcopy-hack/source/main/analyze.cc	2005-07-22 19:17:51 UTC (rev 252)
@@ -2386,9 +2386,9 @@
     
     // Loop through all the lines of code, testing the removal of each.
     for (int line_num = 0; line_num < max_line; line_num++) {
-      int cur_inst = base_genome[line_num].GetOp();
+      int  cur_inst   = base_genome[line_num].GetOp();
       char cur_symbol = base_genome[line_num].GetSymbol();
-      
+      int  cur_meta   = base_genome[line_num].GetMeta();
       mod_genome[line_num] = null_inst;
       cAnalyzeGenotype test_genotype(mod_genome, map_inst_set);
       test_genotype.Recalculate();
@@ -2406,6 +2406,9 @@
       fp << map_inst_set.GetName(cur_inst) << " ";
       if (link_insts == true) fp << "</a>";
       
+      //mrr -- display meta data
+      if (file_type == FILE_TYPE_HTML) fp << "<td align=center>";
+      fp << cur_meta << " ";
       
       // Print the individual columns...
       output_it.Reset();

Modified: branches/developers/matt-hcopy-hack/source/main/instruction.hh
===================================================================
--- branches/developers/matt-hcopy-hack/source/main/instruction.hh	2005-07-22 18:38:34 UTC (rev 251)
+++ branches/developers/matt-hcopy-hack/source/main/instruction.hh	2005-07-22 19:17:51 UTC (rev 252)
@@ -17,22 +17,25 @@
 class cInstruction {
 private:
   UCHAR operand;
-
+  UCHAR meta;
+  
 public:
   // Accessors...
   int GetOp() const { return (int) operand; }
+  int GetMeta() const {return (int) meta; }
   void SetOp(int in_op) { assert(in_op < 256); operand = in_op; }
-
+  void SetMeta(int in_met) {assert(in_met < 256); meta = in_met; }
+  
   // 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
     { return !(operator==(inst)); }
 
   // Constructors and Destructor...
-  cInstruction() { operand = 0; }
+  cInstruction() { operand = 0; meta = 0;}
   cInstruction(const cInstruction & _inst) { *this = _inst; }
   explicit cInstruction(int in_op) { SetOp(in_op); }
   ~cInstruction() { ; }

Modified: branches/developers/matt-hcopy-hack/source/main/organism.hh
===================================================================
--- branches/developers/matt-hcopy-hack/source/main/organism.hh	2005-07-22 18:38:34 UTC (rev 251)
+++ branches/developers/matt-hcopy-hack/source/main/organism.hh	2005-07-22 19:17:51 UTC (rev 252)
@@ -210,7 +210,7 @@
   cPopulationInterface & PopInterface() { return pop_interface; }
   
   const cGenome & GetGenome() const { return initial_genome; }
-  
+
   /*
   int GetCurGestation() const;
   */




More information about the Avida-cvs mailing list