[Avida-SVN] r3583 - in branches/matt/InheritInstSet: Avida.xcodeproj source source/cpu source/main

ruppmatt at myxo.css.msu.edu ruppmatt at myxo.css.msu.edu
Mon Jan 4 16:46:33 PST 2010


Author: ruppmatt
Date: 2010-01-04 19:46:32 -0500 (Mon, 04 Jan 2010)
New Revision: 3583

Added:
   branches/matt/InheritInstSet/source/main/cInheritedInstSet.cpp
   branches/matt/InheritInstSet/source/main/cInheritedInstSet.h
Modified:
   branches/matt/InheritInstSet/Avida.xcodeproj/project.pbxproj
   branches/matt/InheritInstSet/source/cpu/cHardwareBase.cc
   branches/matt/InheritInstSet/source/cpu/cHardwareBase.h
   branches/matt/InheritInstSet/source/cpu/cHardwareManager.cc
   branches/matt/InheritInstSet/source/cpu/cHardwareManager.h
   branches/matt/InheritInstSet/source/defs.h
   branches/matt/InheritInstSet/source/main/cAvidaConfig.h
   branches/matt/InheritInstSet/source/main/cOrganism.cc
   branches/matt/InheritInstSet/source/main/cOrganism.h
Log:
Added backend inheritence functionality.

Modified: branches/matt/InheritInstSet/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/matt/InheritInstSet/Avida.xcodeproj/project.pbxproj	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/Avida.xcodeproj/project.pbxproj	2010-01-05 00:46:32 UTC (rev 3583)
@@ -174,6 +174,8 @@
 		70B6514F0BEA6FCC002472ED /* main.cc in Sources */ = {isa = PBXBuildFile; fileRef = 701EF27E0BEA5D2300DAE168 /* main.cc */; };
 		70B651B70BEA9AEC002472ED /* unit-tests in CopyFiles */ = {isa = PBXBuildFile; fileRef = 70B6514C0BEA6FAD002472ED /* unit-tests */; };
 		70DCAC9C097AF7C0002F8733 /* primitive.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70DCAC9B097AF7C0002F8733 /* primitive.cc */; };
+		B4DA5DBE10F289170052C0A5 /* cInheritedInstSet.h in Headers */ = {isa = PBXBuildFile; fileRef = B4DA5DBC10F289170052C0A5 /* cInheritedInstSet.h */; };
+		B4DA5DBF10F289170052C0A5 /* cInheritedInstSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B4DA5DBD10F289170052C0A5 /* cInheritedInstSet.cpp */; };
 		B4FA258A0C5EB65E0086D4B5 /* cPlasticPhenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = B4FA25810C5EB6510086D4B5 /* cPlasticPhenotype.cc */; };
 		B4FA25A90C5EB7880086D4B5 /* cPhenPlastGenotype.cc in Sources */ = {isa = PBXBuildFile; fileRef = B4FA259E0C5EB7600086D4B5 /* cPhenPlastGenotype.cc */; };
 		B516AF840C91E2D400023D53 /* cDemeCellEvent.cc in Sources */ = {isa = PBXBuildFile; fileRef = B516AF790C91E24600023D53 /* cDemeCellEvent.cc */; };
@@ -713,6 +715,8 @@
 		70F7DE76092967A8009E311D /* cGenotypeBatch.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cGenotypeBatch.h; sourceTree = "<group>"; };
 		70F9FD990C4E89C40083B788 /* tAutoRelease.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tAutoRelease.h; sourceTree = "<group>"; };
 		70FB86A908BFAFEC00BDF589 /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
+		B4DA5DBC10F289170052C0A5 /* cInheritedInstSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = cInheritedInstSet.h; path = source/main/cInheritedInstSet.h; sourceTree = SOURCE_ROOT; };
+		B4DA5DBD10F289170052C0A5 /* cInheritedInstSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = cInheritedInstSet.cpp; path = source/main/cInheritedInstSet.cpp; sourceTree = SOURCE_ROOT; };
 		B4FA25800C5EB6510086D4B5 /* cPhenPlastGenotype.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cPhenPlastGenotype.h; sourceTree = "<group>"; };
 		B4FA25810C5EB6510086D4B5 /* cPlasticPhenotype.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cPlasticPhenotype.cc; sourceTree = "<group>"; };
 		B4FA25820C5EB6510086D4B5 /* cPlasticPhenotype.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cPlasticPhenotype.h; sourceTree = "<group>"; };
@@ -1139,6 +1143,8 @@
 		DCC30F7C0762539D008F7A48 /* cpu */ = {
 			isa = PBXGroup;
 			children = (
+				B4DA5DBC10F289170052C0A5 /* cInheritedInstSet.h */,
+				B4DA5DBD10F289170052C0A5 /* cInheritedInstSet.cpp */,
 				705261050B87AF5C0007426F /* cInstLib.h */,
 				706C703E0B83FB95003174C1 /* tInstLibEntry.h */,
 				706C6FFE0B83F265003174C1 /* cInstSet.cc */,
@@ -1447,6 +1453,7 @@
 			isa = PBXHeadersBuildPhase;
 			buildActionMask = 2147483647;
 			files = (
+				B4DA5DBE10F289170052C0A5 /* cInheritedInstSet.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1729,6 +1736,7 @@
 				B4FA258A0C5EB65E0086D4B5 /* cPlasticPhenotype.cc in Sources */,
 				B4FA25A90C5EB7880086D4B5 /* cPhenPlastGenotype.cc in Sources */,
 				B516AF840C91E2D400023D53 /* cDemeCellEvent.cc in Sources */,
+				B4DA5DBF10F289170052C0A5 /* cInheritedInstSet.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: branches/matt/InheritInstSet/source/cpu/cHardwareBase.cc
===================================================================
--- branches/matt/InheritInstSet/source/cpu/cHardwareBase.cc	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/cpu/cHardwareBase.cc	2010-01-05 00:46:32 UTC (rev 3583)
@@ -48,6 +48,12 @@
 #include "functions.h"
 
 
+cHardwareBase::~cHardwareBase(){
+  if (m_inherited_instset)
+    delete static_cast<cInheritedInstSet*>(m_inst_set);
+}
+
+
 int cHardwareBase::GetExecutedSize(const int parent_size)
 {
   int executed_size = 0;

Modified: branches/matt/InheritInstSet/source/cpu/cHardwareBase.h
===================================================================
--- branches/matt/InheritInstSet/source/cpu/cHardwareBase.h	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/cpu/cHardwareBase.h	2010-01-05 00:46:32 UTC (rev 3583)
@@ -34,6 +34,10 @@
 #include "tBuffer.h"
 #endif
 
+#ifndef cInheritedInstSet_h
+#include "cInheritedInstSet.h"
+#endif
+
 using namespace std;
 
 class cAvidaContext;
@@ -49,6 +53,8 @@
 class cOrganism;
 class cString;
 class cWorld;
+
+
 //class cStats; //AWC 06/29/06
 
 class cHardwareBase
@@ -58,6 +64,7 @@
   cOrganism* organism;       // Organism using this hardware.
   cInstSet* m_inst_set;      // Instruction set being used.
   cHardwareTracer* m_tracer; // Set this if you want execution traced.
+  bool m_inherited_instset;  // True if this hardware contains a unique instruction set (cast from cInheritedInstSet)
 
   // Instruction costs...
 //#if INSTRUCTION_COSTS
@@ -92,17 +99,28 @@
   cHardwareBase& operator=(const cHardwareBase&); // @not_implemented
 
 public:
-  cHardwareBase(cWorld* world, cOrganism* in_organism, cInstSet* inst_set)
-    : m_world(world), organism(in_organism), m_inst_set(inst_set), m_tracer(NULL)
+  cHardwareBase(cWorld* world, cOrganism* in_organism, cInstSet* inst_set, bool inherited=false)
+    : m_world(world), organism(in_organism), m_inst_set(inst_set), m_tracer(NULL), m_inherited_instset(inherited)
   {
     assert(organism != NULL);
   }
-  virtual ~cHardwareBase() { ; }
+  virtual ~cHardwareBase();
 
   // --------  Organism ---------
   cOrganism* GetOrganism() { return organism; }
   const cInstSet& GetInstSet() { return *m_inst_set; }
-  void SetInstSet(cInstSet* _in) {m_inst_set = _in; }
+  cInstSet* GetInstSetPtr() { return m_inst_set; } //Be Careful!
+  void SetInstSet(cInstSet* _in){ 
+    if (!m_inherited_instset)
+      m_inst_set = _in; 
+    else{
+      cInheritedInstSet* ptr = static_cast<cInheritedInstSet*>(m_inst_set);
+      delete ptr;
+      m_inst_set = _in;
+    }
+  }
+  
+  bool IsInheritedInstSet() const { return m_inherited_instset; } 
 
   
   // --------  Core Functionality  --------

Modified: branches/matt/InheritInstSet/source/cpu/cHardwareManager.cc
===================================================================
--- branches/matt/InheritInstSet/source/cpu/cHardwareManager.cc	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/cpu/cHardwareManager.cc	2010-01-05 00:46:32 UTC (rev 3583)
@@ -38,7 +38,9 @@
 #include "cPopulationCell.h"
 #include "tDictionary.h"
 #include "cStats.h"
+#include "cInheritedInstSet.h"
 
+
 cHardwareManager::cHardwareManager(cWorld* world)
 : m_world(world), m_type(world->GetConfig().HARDWARE_TYPE.Get()) /*, m_testres(world) */
 {
@@ -71,9 +73,11 @@
     m_world->GetDriver().NotifyComment(cString("Using default instruction set: ") + filename);
   }
   AddInstSet(filename);
+  LoadRedundancyFile(m_world->GetConfig().EIS_REDUNDANCY_FILE.Get());
 }
 
 
+
 bool cHardwareManager::AddInstSet(const cString& filename, int id)
 {
   
@@ -133,25 +137,64 @@
   return true;
 }
 
+                          
+void cHardwareManager::LoadRedundancyFile(cString path){
+  
+  if (path == "-"){
+    m_inherited_instset = false;
+    return;
+  }
+  
+  cInitFile file(path);
+    
+  if (file.WasOpened() == false) {
+    tConstListIterator<cString> err_it(file.GetErrors());
+    const cString* errstr = NULL;
+    while ((errstr = err_it.Next())) m_world->GetDriver().RaiseException(*errstr);
+    m_world->GetDriver().RaiseFatalException(1, cString("Could not open redundancy allowance file '") + path + "'.");
+  }
+  
+  if (file.GetNumLines() != m_inst_sets[0]->GetSize())
+    m_world->GetDriver().RaiseFatalException(1, cString("Allowed instruction redundancies has an incorrect number of entries for the loaded instruction set."));
+  
+  m_allowed_redundancies = tArray< tArray<int> >( m_inst_sets[0]->GetSize(), tArray<int>(0));
+  for (int line_id = 0; line_id < file.GetNumLines(); line_id++) {
+    cString cur_line = file.GetLine(line_id);
+    cString inst_name = cur_line.PopWord();
+    if (inst_name != m_inst_sets[0]->GetName(line_id))
+      m_world->GetDriver().RaiseFatalException(1, cString("Allowed instruction redundancies are not in the same order as the loaded instruction set."));
+    while (cur_line.GetSize())
+      m_allowed_redundancies[line_id].Push( cur_line.PopWord().AsInt() );
+  }
+  m_inherited_instset = true;
+  m_init_redundancy = m_world->GetConfig().EIS_INIT_RED.Get();
+  return;
+}
+                          
 
-cHardwareBase* cHardwareManager::Create(cOrganism* in_org)
+cHardwareBase* cHardwareManager::Create(cOrganism* in_org, cOrganism* parent_org)
 {
   assert(in_org != NULL);
   
   int inst_id = in_org->GetInstSetID();
   assert(inst_id <= m_inst_sets.GetSize()-1 && m_inst_sets[inst_id] != NULL);
+
+  cInstSet* this_instset = (!m_inherited_instset) ? m_inst_sets[inst_id] :
+              (parent_org == NULL) ? new cInheritedInstSet(m_inst_sets[inst_id], m_init_redundancy, m_allowed_redundancies) :
+                                     new cInheritedInstSet(static_cast<cInheritedInstSet*>(parent_org->GetHardware().GetInstSetPtr()));
+  
   switch (m_type)
   {
     case HARDWARE_TYPE_CPU_ORIGINAL:
-      return new cHardwareCPU(m_world, in_org, m_inst_sets[inst_id]);
+      return new cHardwareCPU(m_world, in_org, this_instset);
     case HARDWARE_TYPE_CPU_SMT:
-      return new cHardwareSMT(m_world, in_org, m_inst_sets[inst_id]);
+      return new  cHardwareSMT(m_world, in_org, this_instset);
     case HARDWARE_TYPE_CPU_TRANSSMT:
-      return new cHardwareTransSMT(m_world, in_org, m_inst_sets[inst_id]);
+      return  new cHardwareTransSMT(m_world, in_org, this_instset);
     case HARDWARE_TYPE_CPU_EXPERIMENTAL:
-      return new cHardwareExperimental(m_world, in_org, m_inst_sets[inst_id]);
+      return new cHardwareExperimental(m_world, in_org, this_instset);
     case HARDWARE_TYPE_CPU_GX:
-      return new cHardwareGX(m_world, in_org, m_inst_sets[inst_id]);
+      return new cHardwareGX(m_world, in_org, this_instset);
     default:
       return NULL;
   }

Modified: branches/matt/InheritInstSet/source/cpu/cHardwareManager.h
===================================================================
--- branches/matt/InheritInstSet/source/cpu/cHardwareManager.h	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/cpu/cHardwareManager.h	2010-01-05 00:46:32 UTC (rev 3583)
@@ -45,6 +45,10 @@
 #include "cInstSet.h"
 #endif
 
+#ifndef tList_h
+#include "tArray.h"
+#endif
+
 class cHardwareBase;
 class cOrganism;
 class cWorld;
@@ -57,10 +61,17 @@
 #endif
 private:
   cWorld* m_world;
-  tArray<cInstSet*> m_inst_sets;
+  tArray<cInstSet*> m_inst_sets;  //Global instruction sets
+  bool m_inherited_instset;       //Are we using per-organism instruction sets?
+  tArray< tArray<int> > m_allowed_redundancies;  //Global restriction on per-organsim instruction sets.
+  int m_init_redundancy;
+
   int m_type;
+  
 //  cTestResources m_testres;
   
+  void LoadRedundancyFile(cString path);
+  
   cHardwareManager(); // @not_implemented
   cHardwareManager(const cHardwareManager&); // @not_implemented
   cHardwareManager& operator=(const cHardwareManager&); // @not_implemented
@@ -70,7 +81,7 @@
   cHardwareManager(cWorld* world);
   ~cHardwareManager() { for(int i = 0; i < m_inst_sets.GetSize(); i++) delete m_inst_sets[i]; }
   
-  cHardwareBase* Create(cOrganism* in_org);
+  cHardwareBase* Create(cOrganism* in_org, cOrganism* parent_org = NULL);
   cTestCPU* CreateTestCPU() { return new cTestCPU(m_world /*, &m_testres*/); }
 
   const cInstSet& GetInstSet(int id=0) const { assert(id < m_inst_sets.GetSize()); return *(m_inst_sets[id]); }

Modified: branches/matt/InheritInstSet/source/defs.h
===================================================================
--- branches/matt/InheritInstSet/source/defs.h	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/defs.h	2010-01-05 00:46:32 UTC (rev 3583)
@@ -172,5 +172,11 @@
   VERBOSE_DEBUG         // Print Debug Information, as applicable.
 };
 
+//@MRR
+//Inherited Instruction Set Mutation Types
+enum eIIS_MUT_TYPE{
+  PER_INST = 0,      //By Instruction
+  PER_INSTSET        //By Instruction Set
+};
 
 #endif

Modified: branches/matt/InheritInstSet/source/main/cAvidaConfig.h
===================================================================
--- branches/matt/InheritInstSet/source/main/cAvidaConfig.h	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/main/cAvidaConfig.h	2010-01-05 00:46:32 UTC (rev 3583)
@@ -495,9 +495,19 @@
   CONFIG_ADD_VAR(BIOMIMETIC_K, int, 0, "Carrying capacity in number of organisms");
   
   
+  
+  // @MRR: Information for inherited, mutable instruction sets
+  CONFIG_ADD_GROUP(EVOLVABLE_INSTSETS, "Evolvable Instruction Set Settings");
+  CONFIG_ADD_VAR(EIS_REDUNDANCY_FILE, cString, "-", "If not -, the file to load instructions allowable redudancies from.\nMust in the same order as the default instruction set.\nIf not set, this group is disabled.");
+  CONFIG_ADD_VAR(EIS_INIT_RED, int, 0, "Set the initial redundancy of instructions.\n>0 is the initial value\n0=Random\n-1=Use Default instruction set redundancy.");
+  CONFIG_ADD_VAR(EIS_MUT_RED_PERINST, double, 0.0, "The mutation rate of instruction sets, applied per organism divide, per instruction.");
+  CONFIG_ADD_VAR(EIS_MUT_RED_PERSET, double, 0.0, "The probability of mutating a single instruction redundanc, applied on divide.");
+  
   CONFIG_ADD_CUSTOM_FORMAT(INST_SET_NEW, "Instruction Set Definition");
   CONFIG_ADD_FORMAT_VAR(INST, "Instruction entry in the instruction set");
   
+  
+  
 #endif
   
   void Load(const cString& filename, const bool& crash_if_not_found);

Added: branches/matt/InheritInstSet/source/main/cInheritedInstSet.cpp
===================================================================
--- branches/matt/InheritInstSet/source/main/cInheritedInstSet.cpp	                        (rev 0)
+++ branches/matt/InheritInstSet/source/main/cInheritedInstSet.cpp	2010-01-05 00:46:32 UTC (rev 3583)
@@ -0,0 +1,133 @@
+/*
+ *  cInheritedInstSet.cpp
+ *  Avida
+ *
+ *  Created by Matthew Rupp on 1/4/10.
+ *  Copyright 2010 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cInheritedInstSet.h"
+#include "cInstSet.h"
+#include "cRandom.h"
+#include "cWorld.h"
+#include <cassert>
+
+
+cInheritedInstSet::cInheritedInstSet(const cInheritedInstSet* in) : cInstSet(* ((cInstSet*) in) )
+{
+
+  m_redundancies = in->m_redundancies;
+  m_allowed_redundancies = in->m_allowed_redundancies;
+}
+
+
+
+cInheritedInstSet::cInheritedInstSet(const cInstSet* in, int init_val, const tArray< tArray<int> >& allowed_redundancies) : cInstSet(*in)
+{
+  m_allowed_redundancies = allowed_redundancies;
+  if (init_val == 0)
+    InitRedRandomly();
+  else if (init_val < 0)
+    InitRedByBaseInstSet();
+  else
+    InitRedByValue(init_val);
+  Sync();
+}
+
+
+
+void cInheritedInstSet::InitRedRandomly()
+{
+  m_redundancies = tArray<int>(m_allowed_redundancies.GetSize(),-1);
+  for (int x = 0; x < m_redundancies.GetSize(); x++)
+    m_redundancies[x] = GetRandomRedundancy(x);
+  return;
+}
+
+
+
+void cInheritedInstSet::InitRedByBaseInstSet()
+{
+  m_redundancies = tArray<int>(m_allowed_redundancies.GetSize(), -1);
+  for (int id = 0; id < m_lib_name_map.GetSize(); id++){
+    m_redundancies[id] = m_lib_name_map[id].redundancy;
+  }
+  return;
+}
+
+
+void cInheritedInstSet::InitRedByValue(int val)
+{
+  m_redundancies = tArray<int>(m_allowed_redundancies.GetSize(), -1);
+  for (int x = 0; x < m_redundancies.GetSize(); x++){
+    m_redundancies[x] = val;
+  }
+  return;
+}
+
+
+
+void cInheritedInstSet::DoMutation(eIIS_MUT_TYPE type, double p)
+{
+  bool did_mutate = false;
+  if (type == PER_INST){
+    did_mutate = MutateAllInsts(p);
+  } else if (type == PER_INSTSET){
+    if (RandProceed(p))
+      did_mutate = MutateSingleInst();
+  }
+  if (did_mutate)
+    Sync();
+  return;
+}
+
+
+bool cInheritedInstSet::MutateAllInsts(double p)
+{
+  bool did_mutate = false;
+  for (int id = 0; id < m_redundancies.GetSize(); id++)
+    if (RandProceed(p)){
+      m_redundancies[id] = GetRandomRedundancy(id);
+      did_mutate = true;
+    }
+  return did_mutate;
+}
+
+
+bool cInheritedInstSet::MutateSingleInst()
+{
+  int id = m_world->GetRandom().GetUInt(0,m_redundancies.GetSize());
+  m_redundancies[id] = GetRandomRedundancy(id);
+  return true;
+}
+
+
+
+void cInheritedInstSet::Sync()
+{
+  int sum = 0;
+  for (int x = 0; x < m_redundancies.GetSize(); x++)
+    sum += m_redundancies[x];
+  assert(sum <= 255);
+  m_mutation_chart = tArray<int>(sum, -1);
+  int ndx = 0;
+  for (int id = 0; id < m_redundancies.GetSize(); id++)
+    for (int n = 0; n < m_redundancies[id]; n++)
+      m_mutation_chart[ndx++] = id;
+}
+
+
+
+inline bool cInheritedInstSet::RandProceed(double p){
+  return (m_world->GetRandom().GetDouble(0,1) < p);
+}
+
+
+
+inline int cInheritedInstSet::GetRandomRedundancy(int id){
+  return m_allowed_redundancies[id][m_world->GetRandom().GetUInt(0,m_allowed_redundancies[id].GetSize())];
+}
+
+
+

Added: branches/matt/InheritInstSet/source/main/cInheritedInstSet.h
===================================================================
--- branches/matt/InheritInstSet/source/main/cInheritedInstSet.h	                        (rev 0)
+++ branches/matt/InheritInstSet/source/main/cInheritedInstSet.h	2010-01-05 00:46:32 UTC (rev 3583)
@@ -0,0 +1,57 @@
+/*
+ *  cInheritedInstSet.h
+ *  Avida
+ *
+ *  Created by Matthew Rupp on 1/4/10.
+ *  Copyright 2010 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cInheritedInstSet_h
+#define cInheritedInstSet_h
+
+#include "tArray.h"
+#include "tList.h"
+#include "defs.h"
+
+#include "cInstSet.h"
+
+
+class cInstSet;
+class cWorld;
+
+class cInheritedInstSet : public cInstSet{
+
+  private:
+    tArray<int>    m_redundancies;  
+    tArray< tArray<int> >  m_allowed_redundancies;
+  
+    void InitRedRandomly();
+    void InitRedByBaseInstSet();
+    void InitRedByValue(int val);
+    
+  
+    bool MutateAllInsts(double p);
+    bool MutateSingleInst();
+  
+    inline int GetRandomRedundancy(int id);
+    inline bool RandProceed(double p);
+  
+    cInheritedInstSet();  // @not_implemented
+    cInheritedInstSet& operator=(const cInheritedInstSet&); // @not_implemented
+  
+  
+  public:
+    cInheritedInstSet(const cInheritedInstSet* in);
+    cInheritedInstSet(const cInstSet* in, int init_val, 
+                      const tArray< tArray<int> >& allowed_redundancies);
+    cInstSet* MakeInstSet();
+    
+    void DoMutation(eIIS_MUT_TYPE type, double prob);
+  
+    void Sync();
+  
+
+};
+
+#endif

Modified: branches/matt/InheritInstSet/source/main/cOrganism.cc
===================================================================
--- branches/matt/InheritInstSet/source/main/cOrganism.cc	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/main/cOrganism.cc	2010-01-05 00:46:32 UTC (rev 3583)
@@ -44,7 +44,6 @@
 #include "cTools.h"
 #include "cWorld.h"
 #include "cStats.h"
-
 #include <iomanip>
 
 using namespace std;

Modified: branches/matt/InheritInstSet/source/main/cOrganism.h
===================================================================
--- branches/matt/InheritInstSet/source/main/cOrganism.h	2009-12-28 22:06:06 UTC (rev 3582)
+++ branches/matt/InheritInstSet/source/main/cOrganism.h	2010-01-05 00:46:32 UTC (rev 3583)
@@ -71,12 +71,13 @@
 #ifndef tSmartArray_h
 #include "tSmartArray.h"
 #endif
+#ifndef cGenotype
+#include "cGenotype.h"
+#endif
 
-
 class cAvidaContext;
 class cCodeLabel;
 class cEnvironment;
-class cGenotype;
 class cHardwareBase;
 class cInjectGenotype;
 class cLineage;
@@ -123,7 +124,7 @@
   bool m_is_running;       // Does this organism have the CPU?
   bool m_is_sleeping;      // Is this organisms sleeping?
   bool m_is_dead;          // Is this organism dead?
-  
+
   class cNetSupport
   {
   public:




More information about the Avida-cvs mailing list