[Avida-cvs] [avida-svn] r705 - in development: source/actions source/event source/main support/config

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Wed May 24 18:25:36 PDT 2006


Author: brysonda
Date: 2006-05-24 21:25:36 -0400 (Wed, 24 May 2006)
New Revision: 705

Modified:
   development/source/actions/PrintActions.cc
   development/source/actions/SaveLoadActions.cc
   development/source/event/cEventManager.cc
   development/source/main/cAvidaConfig.cc
   development/source/main/cAvidaConfig.h
   development/source/main/cBirthChamber.cc
   development/source/main/cPopulation.cc
   development/source/main/cPopulation.h
   development/support/config/avida-smt.cfg
   development/support/config/avida.cfg
   development/support/config/events.cfg
Log:
Transition over various save/load events into the actions framework.

Remove non-functional cPopulation::LoadPopulation.

Update default config files to include new birth chamber setting.

Modified: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/actions/PrintActions.cc	2006-05-25 01:25:36 UTC (rev 705)
@@ -438,6 +438,76 @@
 };
 
 
+/*
+ This is a new version of "detail_pop" or "historic_dump".  It allows you to
+ output one line per genotype in memory where you get to choose what data
+ should be included.
+ 
+ Parameters
+   data_fields (string)
+     This must be a comma separated string of all data you wish to output.
+     Options include: id, parent_id, parent2_id (for sex), parent_dist,
+       num_cpus, total_cpus, length, merit, gest_time, fitness, update_born,
+       update_dead, depth, lineage, sequence
+   historic (int) default: 0
+     How many updates back of history should we include (-1 = all)
+   filename (string) default: "genotypes-<update>.dat"
+     The name of the file into which the population dump should be written.
+*/
+class cActionPrintGenotypes : public cAction
+{
+private:
+  cString m_datafields;
+  cString m_filename;
+  int m_historic;
+  
+public:
+  cActionPrintGenotypes(cWorld* world, const cString& args)
+    : cAction(world, args), m_datafields("all"), m_filename(""), m_historic(0)
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_datafields = largs.PopWord();
+    if (largs.GetSize()) m_historic = largs.PopWord().AsInt();
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "PrintGenotypes [cString data_fields=\"all\"] [int historic=0] [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("genotypes-%d.dat", m_world->GetStats().GetUpdate());
+    m_world->GetClassificationManager().PrintGenotypes(m_world->GetDataFileOFStream(filename),
+                                                       m_datafields, m_historic);
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+
+class cActionDumpMemory : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionDumpMemory(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "PrintDumpMemory [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("memory_dump-%d.dat", m_world->GetStats().GetUpdate());
+    m_world->GetPopulation().DumpMemorySummary(m_world->GetDataFileOFStream(filename));
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+
 void RegisterPrintActions(cActionLibrary* action_lib)
 {
   // Stats Out Files
@@ -476,9 +546,11 @@
   action_lib->Register<cActionPrintDominantGenotype>("PrintDominantGenotype");
   action_lib->Register<cActionPrintDominantParasiteGenotype>("PrintDominantParasiteGenotype");
   action_lib->Register<cActionPrintDebug>("PrintDebug");
-  
 
+  action_lib->Register<cActionPrintGenotypes>("PrintGenotypes");
+  action_lib->Register<cActionDumpMemory>("DumpMemory");
 
+
   // @DMB - The following actions are DEPRECATED aliases - These will be removed in 2.7.
   action_lib->Register<cActionPrintAverageData>("print_average_data");
   action_lib->Register<cActionPrintErrorData>("print_error_data");
@@ -512,4 +584,7 @@
   action_lib->Register<cActionPrintLineageCounts>("print_lineage_counts");
   action_lib->Register<cActionPrintDominantGenotype>("print_dom");
   action_lib->Register<cActionPrintDominantParasiteGenotype>("print_dom_parasite");
+  
+  action_lib->Register<cActionPrintGenotypes>("print_genotypes");
+  action_lib->Register<cActionDumpMemory>("dump_memory");
 }

Modified: development/source/actions/SaveLoadActions.cc
===================================================================
--- development/source/actions/SaveLoadActions.cc	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/actions/SaveLoadActions.cc	2006-05-25 01:25:36 UTC (rev 705)
@@ -9,7 +9,325 @@
 
 #include "SaveLoadActions.h"
 
+#include "cAction.h"
+#include "cActionLibrary.h"
+#include "cClassificationManager.h"
+#include "cPopulation.h"
+#include "cStats.h"
+#include "cWorld.h"
+
+#include <iostream>
+
+/*
+ Saves the population for cloning.
+
+ Parameters:
+   filename (string) default: clone.*
+     The name of the file into which the population should
+     be saved. If it is not given, then the name 'clone.*'
+     is used, with '*' replaced by the current update.
+*/
+class cActionSaveClone : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionSaveClone(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+
+  const cString GetDescription() { return "SaveClone [cString fname='']"; }
+
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("clone.%d", m_world->GetStats().GetUpdate());
+    m_world->GetPopulation().SaveClone(m_world->GetDataFileOFStream(filename));
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+
+/*
+ Loads a population clone.
+ 
+ Parameters:
+   filename (string)
+     The name of the file to open.
+*/
+class cActionLoadClone : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionLoadClone(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "LoadClone <cString fname>"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    std::ifstream fp(m_filename);
+    m_world->GetPopulation().LoadClone(fp);
+  }
+};
+
+
+/*
+ Sets up a population based on a dump file such as written out by
+ detail_pop. It is also possible to append a history file to the dump
+ file, in order to preserve the history of a previous run.
+ 
+ Parameters:
+   filename (string)
+     The name of the file to open.
+   update (int) *optional*
+     ??
+ */
+class cActionLoadPopulation : public cAction
+{
+private:
+  cString m_filename;
+  int m_update;
+  
+public:
+  cActionLoadPopulation(cWorld* world, const cString& args) : cAction(world, args), m_filename(""), m_update(-1)
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+    if (largs.GetSize()) m_update = largs.PopWord().AsInt();
+  }
+  
+  const cString GetDescription() { return "LoadPopulation <cString fname> [int update=-1]"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    m_world->GetPopulation().LoadDumpFile(m_filename, m_update);
+  }
+};
+
+
+/*
+ Writes out a line of data for each genotype in the current population. The
+ line contains the genome as string, the number of organisms of that genotype,
+ and the genotype ID.
+
+ Parameters:
+   filename (string) default: "dump-<update>.pop"
+    The name of the file into which the population dump should be written.
+*/
+class cActionDumpPopulation : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionDumpPopulation(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "DumpPopulation [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("dump-%d.pop", m_world->GetStats().GetUpdate());
+    m_world->GetClassificationManager().DumpTextSummary(m_world->GetDataFileOFStream(filename));
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+/*
+ Like dump_pop, but more detailed data is written out.
+ 
+ Parameters:
+   filename (string) default: "detail-<update>.pop"
+     The name of the file into which the population dump should be written.
+*/
+class cActionSavePopulation : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionSavePopulation(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "SavePopulation [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("detail-%d.pop", m_world->GetStats().GetUpdate());
+    m_world->GetClassificationManager().DumpDetailedSummary(m_world->GetDataFileOFStream(filename));
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+
+/*
+ Like detail_pop, but for sexual populations. 
+ Info for both parents is writen out.
+
+ Parameters:
+   filename (string) default: "detail-<update>.pop"
+     The name of the file into which the population dump should be written.
+*/
+class cActionSaveSexPopulation : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionSaveSexPopulation(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "SaveSexPopulation [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("detail-%d.pop", m_world->GetStats().GetUpdate());
+    m_world->GetClassificationManager().DumpDetailedSexSummary(m_world->GetDataFileOFStream(filename));
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+
+class cActionSaveParasitePopulation : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionSaveParasitePopulation(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "SaveParasitePopulation [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("parasite-%d.pop", m_world->GetStats().GetUpdate());
+    m_world->GetClassificationManager().DumpInjectDetailedSummary(filename, m_world->GetStats().GetUpdate());
+  }
+};
+
+
+/*
+ Similar to detail_pop. However, only genotypes that are not in the
+ current population anymore are included. Genotypes that are not in
+ the line of descent of any of the current genotypes to the ultimate
+ ancestor are excluded.
+
+ Parameters:
+   back_dist (int) default: -1
+     How many updates back should we print?  -1 goes forever.  Use the
+     distance to the last dump historic if you only want a "diff".
+   filename (string) default: "historic-<update>.pop"
+     The name of the file into which the historic dump should be written.
+*/
+class cActionSaveHistoricPopulation : public cAction
+{
+private:
+  int m_backdist;
+  cString m_filename;
+  
+public:
+  cActionSaveHistoricPopulation(cWorld* world, const cString& args)
+    : cAction(world, args), m_backdist(-1), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_backdist = largs.PopWord().AsInt();
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "SaveHistoricPopulation [int back_dist=-1] [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("historic-%d.pop", m_world->GetStats().GetUpdate());
+    m_world->GetClassificationManager().DumpHistoricSummary(m_world->GetDataFileOFStream(filename), m_backdist);
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+
+/*
+ Similar to dump_historic_pop, but for sexual populations. 
+ ID of both parents is writen out. 
+
+ Parameters:
+   filename (string) default: "historic-<update>.pop"
+     The name of the file into which the population dump should be written.
+*/
+class cActionSaveHistoricSexPopulation : public cAction
+{
+private:
+  cString m_filename;
+  
+public:
+  cActionSaveHistoricSexPopulation(cWorld* world, const cString& args) : cAction(world, args), m_filename("")
+  {
+    cString largs(args);
+    if (largs.GetSize()) m_filename = largs.PopWord();
+  }
+  
+  const cString GetDescription() { return "SaveHistoricSexPopulation [cString fname='']"; }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    cString filename(m_filename);
+    if (filename == "") filename.Set("historic-%d.pop", m_world->GetStats().GetUpdate());
+    m_world->GetClassificationManager().DumpHistoricSexSummary(m_world->GetDataFileOFStream(filename));
+    m_world->GetDataFileManager().Remove(filename);
+  }
+};
+
+
 void RegisterSaveLoadActions(cActionLibrary* action_lib)
 {
-  
+  action_lib->Register<cActionSaveClone>("SaveClone");
+  action_lib->Register<cActionLoadClone>("LoadClone");
+
+  action_lib->Register<cActionLoadPopulation>("LoadPopulation");
+
+  action_lib->Register<cActionDumpPopulation>("DumpPopulation");
+  action_lib->Register<cActionSavePopulation>("SavePopulation");
+  action_lib->Register<cActionSaveSexPopulation>("SaveSexPopulation");
+  action_lib->Register<cActionSaveParasitePopulation>("SaveParasitePopulation");
+  action_lib->Register<cActionSaveHistoricPopulation>("SaveHistoricPopulation");
+  action_lib->Register<cActionSaveHistoricSexPopulation>("SaveHistoricSexPopulation");
+
+  // @DMB - The following actions are DEPRECATED aliases - These will be removed in 2.7.
+  action_lib->Register<cActionSaveClone>("save_clone");
+  action_lib->Register<cActionLoadClone>("load_clone");
+
+  action_lib->Register<cActionLoadPopulation>("load_dump_file");
+
+  action_lib->Register<cActionDumpPopulation>("dump_pop");
+  action_lib->Register<cActionSavePopulation>("detail_pop");
+  action_lib->Register<cActionSaveSexPopulation>("detail_sex_pop");
+  action_lib->Register<cActionSaveParasitePopulation>("detail_parasite_pop");
+  action_lib->Register<cActionSaveHistoricPopulation>("dump_historic_pop");
+  action_lib->Register<cActionSaveHistoricSexPopulation>("dump_historic_sex_pop");
 }

Modified: development/source/event/cEventManager.cc
===================================================================
--- development/source/event/cEventManager.cc	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/event/cEventManager.cc	2006-05-25 01:25:36 UTC (rev 705)
@@ -189,474 +189,8 @@
 };
 
 
-///// save_population /////
 
-/**
-* Saves the full state of the population.
- *
- * Parameters:
- * filename (string) default: save_pop.*
-   *   The name of the file into which the population should
-   *   be saved. If it is not given, then the name 'save_pop.*'
-   *   is used, with '*' replaced by the current update.
-   **/
 
-
-class cEvent_save_population : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "save_population"; }
-  const cString GetDescription() const { return "save_population  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// save_population /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("save_pop.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetPopulation().SavePopulation(m_world->GetDataFileOFStream(filename));
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// load_population /////
-
-/**
-* Loads the full state of the population.
- *
- * Parameters:
- * filename (string)
- *   The name of the file to open.
- **/
-
-
-class cEvent_load_population : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "load_population"; }
-  const cString GetDescription() const { return "load_population  <cString fname>"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    fname = args.PopWord();
-  }
-  ///// load_population /////
-  void Process(){
-    ifstream fp(fname);
-    m_world->GetPopulation().LoadPopulation(fp);
-  }
-};
-
-///// save_clone /////
-
-/**
-**/
-
-
-class cEvent_save_clone : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "save_clone"; }
-  const cString GetDescription() const { return "save_clone  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// save_clone /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("clone.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetPopulation().SaveClone(m_world->GetDataFileOFStream(filename));
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// load_clone /////
-
-/**
-**/
-
-
-class cEvent_load_clone : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "load_clone"; }
-  const cString GetDescription() const { return "load_clone  <cString fname>"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    fname = args.PopWord();
-  }
-  ///// load_clone /////
-  void Process(){
-    ifstream fp(fname);
-    m_world->GetPopulation().LoadClone(fp);
-  }
-};
-
-///// load_dump_file /////
-
-/**
-* Sets up a population based on a dump file such as written out by
- * detail_pop. It is also possible to append a history file to the dump
- * file, in order to preserve the history of a previous run.
- **/
-
-
-class cEvent_load_dump_file : public cEvent {
-private:
-  cString fname;
-  int update;
-public:
-    const cString GetName() const { return "load_dump_file"; }
-  const cString GetDescription() const { return "load_dump_file  <cString fname> [int update=-1]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    fname = args.PopWord();
-    if (args == "") update=-1; else update=args.PopWord().AsInt();
-  }
-  ///// load_dump_file /////
-  void Process(){
-    m_world->GetPopulation().LoadDumpFile(fname, update);
-  }
-};
-
-///// dump_pop /////
-
-/**
-* Writes out a line of data for each genotype in the current population. The
- * line contains the genome as string, the number of organisms of that genotype,
- * and the genotype ID.
- *
- * Parameters:
- * filename (string) default: "dump.<update>"
-   *   The name of the file into which the population dump should be written.
-   **/
-
-
-class cEvent_dump_pop : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "dump_pop"; }
-  const cString GetDescription() const { return "dump_pop  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// dump_pop /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("dump.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetClassificationManager().DumpTextSummary(m_world->GetDataFileOFStream(filename));
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// print_genotypes /////
-
-/**
-* This is a new version of "detail_pop" or "historic_dump".  It allows you to
- * output one line per genotype in memory where you get to choose what data
- * should be included.
- *
- * Parameters
- * data_fields (string)
- *   This must be a comma separated string of all data you wish to output.
- *   Options include: id, parent_id, parent2_id (for sex), parent_dist,
- *       num_cpus, total_cpus, length, merit, gest_time, fitness, update_born,
- *       update_dead, depth, lineage, sequence
- * historic (int) default: 0
-   *   How many updates back of history should we include (-1 = all)
-   * filename (string) default: "genotypes-<update>.dat"
-     *   The name of the file into which the population dump should be written.
-     **/
-
-
-class cEvent_print_genotypes : public cEvent {
-private:
-  cString data_fields;
-  int historic;
-  cString fname;
-public:
-    const cString GetName() const { return "print_genotypes"; }
-  const cString GetDescription() const { return "print_genotypes  [cString data_fields=\"all\"] [int historic=0] [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") data_fields="all"; else data_fields=args.PopWord();
-    if (args == "") historic=0; else historic=args.PopWord().AsInt();
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// print_genotypes /////
-  void Process(){
-    cString filename = fname;
-    if (filename == "") {
-      filename.Set("genotypes-%d.dat", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetClassificationManager().PrintGenotypes(m_world->GetDataFileOFStream(filename),
-                                                          data_fields, historic);
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// detail_pop /////
-
-/**
-* Like dump_pop, but more detailed data is written out.
- *
- * Parameters:
- * filename (string) default: "detail_pop.<update>"
-   *   The name of the file into which the population dump should be written.
-   **/
-
-
-class cEvent_detail_pop : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "detail_pop"; }
-  const cString GetDescription() const { return "detail_pop  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// detail_pop /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("detail_pop.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetClassificationManager().DumpDetailedSummary(m_world->GetDataFileOFStream(filename));
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// detail_sex_pop /////
-
-/**
-* Like detail_pop, but for sexual populations. 
- * Info for both parents is writen out.
- *
- * Parameters:
- * filename (string) default: "detail_pop.<update>"
-   *   The name of the file into which the population dump should be written.
-   **/
-
-
-class cEvent_detail_sex_pop : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "detail_sex_pop"; }
-  const cString GetDescription() const { return "detail_sex_pop  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// detail_sex_pop /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("detail_pop.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetClassificationManager().DumpDetailedSexSummary(m_world->GetDataFileOFStream(filename));
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// detail_parasite_pop /////
-
-/**
-* Like dump_pop, but more detailed data is written out.
- *
- * Parameters:
- * filename (string) default: "detail_pop.<update>"
-   *   The name of the file into which the population dump should be written.
-   **/
-
-
-class cEvent_detail_parasite_pop : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "detail_parasite_pop"; }
-  const cString GetDescription() const { return "detail_parasite_pop  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// detail_parasite_pop /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("detail_parasite_pop.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetClassificationManager().DumpInjectDetailedSummary(filename, m_world->GetStats().GetUpdate());
-  }
-};
-
-///// dump_historic_pop /////
-
-/**
-* Similar to detail_pop. However, only genotypes that are not in the
- * current population anymore are included. Genotypes that are not in
- * the line of descent of any of the current genotypes to the ultimate
- * ancestor are excluded.
- *
- * Parameters:
- * back_dist (int) default: -1
-   *   How many updates back should we print?  -1 goes forever.  Use the
-   *   distance to the last dump historic if you only want a "diff".
-     * filename (string) default: "historic_dump.<update>"
-       *   The name of the file into which the historic dump should be written.
-       **/
-
-
-class cEvent_dump_historic_pop : public cEvent {
-private:
-  int back_dist;
-  cString fname;
-public:
-    const cString GetName() const { return "dump_historic_pop"; }
-  const cString GetDescription() const { return "dump_historic_pop  [int back_dist=-1] [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") back_dist=-1; else back_dist=args.PopWord().AsInt();
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// dump_historic_pop /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("historic_dump.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetClassificationManager().DumpHistoricSummary(m_world->GetDataFileOFStream(filename), back_dist);
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// dump_historic_sex_pop /////
-
-/**
-* Similar to dump_historic_pop, but for sexual populations. 
- * ID of both parents is writen out. 
- *
- * Parameters:
- * filename (string) default: "historic_dump.<update>"
-   *   The name of the file into which the historic dump should be written.
-   **/
-
-
-class cEvent_dump_historic_sex_pop : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "dump_historic_sex_pop"; }
-  const cString GetDescription() const { return "dump_historic_sex_pop  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// dump_historic_sex_pop /////
-  void Process(){
-    cString filename;
-    if( fname == "" ){
-      filename.Set("historic_dump.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetClassificationManager().DumpHistoricSexSummary(m_world->GetDataFileOFStream(filename));
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
-///// dump_memory /////
-
-/**
-* Dump the current memory state of all CPUs to a file.
- **/
-
-
-class cEvent_dump_memory : public cEvent {
-private:
-  cString fname;
-public:
-  const cString GetName() const { return "dump_memory"; }
-  const cString GetDescription() const { return "dump_memory  [cString fname=\"\"]"; }
-  
-  void Configure(cWorld* world, const cString& in_args)
-  {
-    m_world = world;
-    m_args = in_args;
-    cString args(in_args);
-    if (args == "") fname=""; else fname=args.PopWord();
-  }
-  ///// dump_memory /////
-  void Process(){
-    cString filename;
-    if (fname == "") {
-      filename.Set("memory_dump.%d", m_world->GetStats().GetUpdate());
-    }
-    m_world->GetPopulation().DumpMemorySummary(m_world->GetDataFileOFStream(filename));
-    m_world->GetDataFileManager().Remove(filename);
-  }
-};
-
 ///// inject /////
 
 /**
@@ -3007,21 +2541,6 @@
   REGISTER(exit_if_ave_lineage_label_smaller);
   REGISTER(exit_if_ave_lineage_label_larger);
   
-  REGISTER(save_population);
-  REGISTER(load_population);
-  REGISTER(save_clone);
-  REGISTER(load_clone);
-  REGISTER(load_dump_file);
-  REGISTER(dump_pop);
-  
-  REGISTER(print_genotypes);
-  REGISTER(detail_pop);
-  REGISTER(detail_sex_pop);
-  REGISTER(detail_parasite_pop);
-  REGISTER(dump_historic_pop);
-  REGISTER(dump_historic_sex_pop);
-  REGISTER(dump_memory);
-  
   REGISTER(inject);
   REGISTER(inject_all);
   REGISTER(inject_range);

Modified: development/source/main/cAvidaConfig.cc
===================================================================
--- development/source/main/cAvidaConfig.cc	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/main/cAvidaConfig.cc	2006-05-25 01:25:36 UTC (rev 705)
@@ -316,7 +316,6 @@
       << "  -v[ersion]            Prints the version number"<<endl
       << "  -set <name> <value>   Overide the genesis file"<<endl
       << "  -l[oad] <filename>    Load a clone file"<<endl
-      << "  -loadpop <filename>   Load a saved population file (precedence over load)"<<endl
       << "  -a[nalyze]            Process analyze.cfg instead of normal run."<<endl
       << "  -i[nteractive]        Run analyze mode interactively."
       << endl;
@@ -349,14 +348,6 @@
         arg_num++;  if (arg_num < argc) cur_arg = args[arg_num];
         cfg->CLONE_FILE.Set(cur_arg);
       }
-    } else if (cur_arg == "-loadpop" || cur_arg == "-lp") {
-      if (arg_num + 1 == argc || args[arg_num + 1][0] == '-') {
-        cerr << "Error: Must include a filename to load from." << endl;
-        exit(0);
-      } else {
-        arg_num++;  if (arg_num < argc) cur_arg = args[arg_num];
-        cfg->POPULATION_FILE.Set(cur_arg);
-      }
     } else if (cur_arg == "-version" || cur_arg == "-v") {
       cout << " For more information, see: http://devolab.cse.msu.edu/software/avida/" << endl;
       exit(0);

Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/main/cAvidaConfig.h	2006-05-25 01:25:36 UTC (rev 705)
@@ -153,7 +153,6 @@
   CONFIG_ADD_VAR(ANALYZE_MODE, int, 0, "0 = Disabled\n1 = Enabled\n2 = Interactive");
   CONFIG_ADD_VAR(VIEW_MODE, int, 0, "Initial viewer screen");
   CONFIG_ADD_VAR(CLONE_FILE, cString, "-", "Clone file to load");
-  CONFIG_ADD_VAR(POPULATION_FILE, cString, "-", "Population file to load");
   CONFIG_ADD_VAR(MT_CONCURRENCY, int, 1, "Number of concurrent analyze threads");
   CONFIG_ADD_VAR(VERBOSITY, int, 0, "Control output verbosity");
   

Modified: development/source/main/cBirthChamber.cc
===================================================================
--- development/source/main/cBirthChamber.cc	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/main/cBirthChamber.cc	2006-05-25 01:25:36 UTC (rev 705)
@@ -189,7 +189,7 @@
 
   // If this is a new largest genome, increase the array size.
   if (size_wait_entry.GetSize() <= child_length) {
-    int old_wait_size = size_wait_entry.GetSize();
+    // @DMB unused? -- int old_wait_size = size_wait_entry.GetSize();
     size_wait_entry.Resize(child_length + 1);
   }
 
@@ -214,7 +214,7 @@
 
   // If this is a new largest ID, increase the array size.
   if (mate_select_wait_entry.GetSize() <= mate_id) {
-    int old_wait_size = mate_select_wait_entry.GetSize();
+    // @DMB unused? -- int old_wait_size = mate_select_wait_entry.GetSize();
     mate_select_wait_entry.Resize(mate_id + 1);
   }
 

Modified: development/source/main/cPopulation.cc
===================================================================
--- development/source/main/cPopulation.cc	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/main/cPopulation.cc	2006-05-25 01:25:36 UTC (rev 705)
@@ -195,35 +195,6 @@
     ifstream fp(m_world->GetConfig().CLONE_FILE.Get());
     LoadClone(fp);
   }
-
-  // Load a saved population if one is provided.
-  cString fname(m_world->GetConfig().POPULATION_FILE.Get());
-  if (fname != "-" && fname != "") {
-    cout << "Loading Population: " <<  fname << endl;
-    
-    // If last three chars of filename are ".gz" , gunzip it first
-    if (fname.Find(".gz") == fname.GetSize() - 3) {
-      cString cmd(fname);
-      cmd.Insert("gunzip ");
-      fname.ClipEnd(3);
-      system(cmd);
-      
-      ifstream fp(fname);
-      if( !fp.good() ){
-        cerr << "Error: Failed to load population file " << fname << ". Exiting...\n" << endl;
-        exit(2);
-      }
-      LoadPopulation(fp);
-      
-      cmd = fname;
-      cmd.Insert("gzip ");
-      system(cmd);
-    } else {
-      // load normally
-      ifstream fp(fname);
-      LoadPopulation(fp);
-    }
-  }
 }
 
 
@@ -1600,42 +1571,7 @@
   return true;
 }
 
-//// Save And Load Populations ////
-bool cPopulation::SavePopulation(ofstream& fp)
-{
-  if (fp.good() == false) return false;
-  
-  // Save the update
-  fp << m_world->GetStats().GetUpdate() << endl;
-  
-  // looping through all cells saving state @DMB - these did nothing...
-  //for (int i = 0; i < cell_array.GetSize(); i++)  cell_array[i].SaveState(fp);
-  
-  return true;
-}
 
-
-bool cPopulation::LoadPopulation(ifstream & fp)
-{
-  if(fp.good() == false) return false;
-  
-  // Load Update...
-  int cur_update;
-  fp >> cur_update;
-  m_world->GetStats().SetCurrentUpdate(cur_update);
-  
-  // Clear out the current population
-  for (int i = 0; i < cell_array.GetSize(); i++) KillOrganism( cell_array[i] );
-  
-  // looping through all organims @DMB - these did nothing...
-  //for (int i = 0; i < cell_array.GetSize(); i++) cell_array[i].LoadState(fp);
-  
-  sync_events = true;
-  
-  return true;
-}
-
-
 bool cPopulation::DumpMemorySummary(ofstream& fp)
 {
   if (fp.good() == false) return false;

Modified: development/source/main/cPopulation.h
===================================================================
--- development/source/main/cPopulation.h	2006-05-24 15:59:17 UTC (rev 704)
+++ development/source/main/cPopulation.h	2006-05-25 01:25:36 UTC (rev 705)
@@ -152,8 +152,6 @@
   bool SaveClone(std::ofstream& fp);
   bool LoadClone(std::ifstream& fp);
   bool LoadDumpFile(cString filename, int update);
-  bool SavePopulation(std::ofstream& fp);
-  bool LoadPopulation(std::ifstream& fp);
   bool DumpMemorySummary(std::ofstream& fp);
 
   bool OK();

Modified: development/support/config/avida-smt.cfg
===================================================================
--- development/support/config/avida-smt.cfg	2006-05-24 15:59:17 UTC (rev 704)
+++ development/support/config/avida-smt.cfg	2006-05-25 01:25:36 UTC (rev 705)
@@ -12,7 +12,6 @@
                    # 2 = Interactive
 VIEW_MODE 0        # Initial viewer screen
 CLONE_FILE -       # Clone file to load
-POPULATION_FILE -  # Population file to load
 MT_CONCURRENCY 1   # Number of concurrent analyze threads
 VERBOSITY 0        # Control output verbosity
 
@@ -68,7 +67,11 @@
                          #     increased on divide.
                          # 1 = Both the generation of the mother and child are
                          #     increased on divide (good with DIVIDE_METHOD 1).
+
+### RECOMBINATION_GROUP ###
+# Sexual Recombination and Modularity
 RECOMBINATION_PROB 1.0   # probability that recombination will happen when div-sex is used
+MAX_BIRTH_WAIT_TIME -1   # Updates incipiant orgs can wait for crossover
 MODULE_NUM 0             # number of modules in the genome
 CONT_REC_REGS 1          # are (modular) recombination regions continuous
 CORESPOND_REC_REGS 1     # are (modular) recombination regions swapped at random or with corresponding ones, by location

Modified: development/support/config/avida.cfg
===================================================================
--- development/support/config/avida.cfg	2006-05-24 15:59:17 UTC (rev 704)
+++ development/support/config/avida.cfg	2006-05-25 01:25:36 UTC (rev 705)
@@ -12,7 +12,6 @@
                    # 2 = Interactive
 VIEW_MODE 0        # Initial viewer screen
 CLONE_FILE -       # Clone file to load
-POPULATION_FILE -  # Population file to load
 MT_CONCURRENCY 1   # Number of concurrent analyze threads
 VERBOSITY 0        # Control output verbosity
 
@@ -68,7 +67,11 @@
                          #     increased on divide.
                          # 1 = Both the generation of the mother and child are
                          #     increased on divide (good with DIVIDE_METHOD 1).
+
+### RECOMBINATION_GROUP ###
+# Sexual Recombination and Modularity
 RECOMBINATION_PROB 1.0   # probability that recombination will happen when div-sex is used
+MAX_BIRTH_WAIT_TIME -1   # Updates incipiant orgs can wait for crossover
 MODULE_NUM 0             # number of modules in the genome
 CONT_REC_REGS 1          # are (modular) recombination regions continuous
 CORESPOND_REC_REGS 1     # are (modular) recombination regions swapped at random or with corresponding ones, by location

Modified: development/support/config/events.cfg
===================================================================
--- development/support/config/events.cfg	2006-05-24 15:59:17 UTC (rev 704)
+++ development/support/config/events.cfg	2006-05-25 01:25:36 UTC (rev 705)
@@ -23,14 +23,14 @@
 u 0:100:end PrintResourceData      # Track resource abundance.
 
 # A few data files not printed by default
-# u 0:100 PrintDominantGenotype    # Save the most abundant genotypes
-# u 100:100:end PrintErrorData     # Std. Error on averages.
-# u 100:100:end PrintVarianceData  # Variance on averages.
-# u 100:100:end PrintTotalsData    # Total counts over entire run.
-# u 100:100:end PrintTasksExeData  # Num. times tasks have been executed.
-# u 100:100:end PrintTasksQualData # Task quality information
+# u 0:100 PrintDominantGenotype      # Save the most abundant genotypes
+# u 100:100:end PrintErrorData       # Std. Error on averages.
+# u 100:100:end PrintVarianceData    # Variance on averages.
+# u 100:100:end PrintTotalsData      # Total counts over entire run.
+# u 100:100:end PrintTasksExeData    # Num. times tasks have been executed.
+# u 100:100:end PrintTasksQualData   # Task quality information
 
 # Setup the exit time and full population data collection.
-u 50000:50000 detail_pop           # Save current state of population.
-u 50000:50000 dump_historic_pop    # Save ancestors of current population.
-u 100000 exit                      # exit
+u 50000:50000 SavePopulation         # Save current state of population.
+u 50000:50000 SaveHistoricPopulation # Save ancestors of current population.
+u 100000 exit                        # exit




More information about the Avida-cvs mailing list