[Avida-cvs] [avida-svn] r676 - in development: Avida.xcodeproj notes source source/actions source/analyze source/main

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Thu May 11 19:11:02 PDT 2006


Author: brysonda
Date: 2006-05-11 22:11:01 -0400 (Thu, 11 May 2006)
New Revision: 676

Added:
   development/source/actions/PrintActions.cc
   development/source/actions/PrintActions.h
Modified:
   development/Avida.xcodeproj/project.pbxproj
   development/notes/release-milestones.txt
   development/source/actions/CMakeLists.txt
   development/source/actions/LandscapeActions.cc
   development/source/actions/cAction.h
   development/source/analyze/cAnalyze.cc
   development/source/analyze/cAnalyze.h
   development/source/analyze/cAnalyzeJobQueue.cc
   development/source/defs.h
   development/source/main/cAvidaConfig.h
   development/source/main/cWorld.cc
Log:
Add new action collection, PrintActions.  Implement basic cStats data file actions.  Add FullLandscape action.   Extend landscape actions with intro status message support.

Add config option to specify output verbosity, eventually intended to extend and replace cAnalyze::verbose level.

Remove LANDSCAPE command from cAnalyze.  Functionality has now been completely replaced and enhanced with landscape actions.

Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj	2006-05-09 01:38:54 UTC (rev 675)
+++ development/Avida.xcodeproj/project.pbxproj	2006-05-12 02:11:01 UTC (rev 676)
@@ -92,6 +92,9 @@
 		7054A1B709A810CB00038658 /* cAnalyzeJobWorker.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7054A1B309A810CB00038658 /* cAnalyzeJobWorker.h */; };
 		7054A1B809A810CB00038658 /* cAnalyzeJobWorker.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7054A1B409A810CB00038658 /* cAnalyzeJobWorker.cc */; };
 		7054A1BA09A810CB00038658 /* cAnalyzeJobWorker.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7054A1B409A810CB00038658 /* cAnalyzeJobWorker.cc */; };
+		705ACD4F0A13FED5002D5BA0 /* PrintActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 705ACD4D0A13FED4002D5BA0 /* PrintActions.cc */; };
+		705ACD630A1403A5002D5BA0 /* PrintActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 705ACD4D0A13FED4002D5BA0 /* PrintActions.cc */; };
+		705ACD640A1403AA002D5BA0 /* PrintActions.cc in Sources */ = {isa = PBXBuildFile; fileRef = 705ACD4D0A13FED4002D5BA0 /* PrintActions.cc */; };
 		70658C5A085DF67D00486BED /* libncurses.5.4.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 70658C59085DF67D00486BED /* libncurses.5.4.dylib */; };
 		7073165D097C6C8F00815164 /* cParser.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7073165B097C6C8F00815164 /* cParser.cc */; };
 		70731665097C6DF500815164 /* cASLibrary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70731663097C6DF500815164 /* cASLibrary.cc */; };
@@ -492,8 +495,6 @@
 		7005A70909BA0FBE0007E16E /* cOrgInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cOrgInterface.h; sourceTree = "<group>"; };
 		700AE91B09DB65F200A073FD /* cTaskContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cTaskContext.h; sourceTree = "<group>"; };
 		700E11BC0A0815B600B604CD /* cDataEntry.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cDataEntry.cc; sourceTree = "<group>"; };
-		700E123F0A084D3D00B604CD /* cTemplateTests.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cTemplateTests.cc; sourceTree = "<group>"; };
-		700E12400A084D3D00B604CD /* cTemplateTests.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cTemplateTests.h; sourceTree = "<group>"; };
 		700E12610A097A0800B604CD /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
 		700E12630A097A1700B604CD /* CMakeLists.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = CMakeLists.txt; sourceTree = "<group>"; };
 		700E28CF0859FFD700CF158A /* tObjectFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tObjectFactory.h; sourceTree = "<group>"; };
@@ -568,6 +569,8 @@
 		7054A17D09A8032600038658 /* tAnalyzeJob.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tAnalyzeJob.h; sourceTree = "<group>"; };
 		7054A1B309A810CB00038658 /* cAnalyzeJobWorker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cAnalyzeJobWorker.h; sourceTree = "<group>"; };
 		7054A1B409A810CB00038658 /* cAnalyzeJobWorker.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cAnalyzeJobWorker.cc; sourceTree = "<group>"; };
+		705ACD4C0A13FED4002D5BA0 /* PrintActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrintActions.h; sourceTree = "<group>"; };
+		705ACD4D0A13FED4002D5BA0 /* PrintActions.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PrintActions.cc; sourceTree = "<group>"; };
 		70658C59085DF67D00486BED /* libncurses.5.4.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libncurses.5.4.dylib; path = /usr/lib/libncurses.5.4.dylib; sourceTree = "<absolute>"; };
 		706D30CC0852328F00D7DC8F /* tInstLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tInstLib.h; sourceTree = "<group>"; };
 		7073165A097C6C8F00815164 /* cParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cParser.h; sourceTree = "<group>"; };
@@ -1049,6 +1052,8 @@
 				707AEEFE09E83381001AEA89 /* cActionLibrary.h */,
 				707AF04409EAB529001AEA89 /* LandscapeActions.h */,
 				707AF04509EAB529001AEA89 /* LandscapeActions.cc */,
+				705ACD4C0A13FED4002D5BA0 /* PrintActions.h */,
+				705ACD4D0A13FED4002D5BA0 /* PrintActions.cc */,
 			);
 			path = actions;
 			sourceTree = "<group>";
@@ -1532,8 +1537,6 @@
 		DCC314D8076253A2008F7A48 /* tools */ = {
 			isa = PBXGroup;
 			children = (
-				700E123F0A084D3D00B604CD /* cTemplateTests.cc */,
-				700E12400A084D3D00B604CD /* cTemplateTests.h */,
 				700E11BC0A0815B600B604CD /* cDataEntry.cc */,
 				70B08B9008FB2E6B00FC65FE /* cTools.cc */,
 				70B08B9108FB2E6B00FC65FE /* cWeightedIndex.cc */,
@@ -2046,6 +2049,7 @@
 				7054A1B809A810CB00038658 /* cAnalyzeJobWorker.cc in Sources */,
 				7005A70609BA0FA90007E16E /* cTestCPUInterface.cc in Sources */,
 				707AF0B409EAC805001AEA89 /* LandscapeActions.cc in Sources */,
+				705ACD630A1403A5002D5BA0 /* PrintActions.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2174,6 +2178,7 @@
 				7054A1B609A810CB00038658 /* cAnalyzeJobWorker.cc in Sources */,
 				7005A70409BA0FA90007E16E /* cTestCPUInterface.cc in Sources */,
 				707AF0B309EAC801001AEA89 /* LandscapeActions.cc in Sources */,
+				705ACD640A1403AA002D5BA0 /* PrintActions.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -2286,6 +2291,7 @@
 				7005A70809BA0FA90007E16E /* cTestCPUInterface.cc in Sources */,
 				7005A83209BA621F0007E16E /* cOrgMessage.cc in Sources */,
 				707AF0B209EAC7FD001AEA89 /* LandscapeActions.cc in Sources */,
+				705ACD4F0A13FED5002D5BA0 /* PrintActions.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: development/notes/release-milestones.txt
===================================================================
--- development/notes/release-milestones.txt	2006-05-09 01:38:54 UTC (rev 675)
+++ development/notes/release-milestones.txt	2006-05-12 02:11:01 UTC (rev 676)
@@ -53,7 +53,7 @@
 + Merge (meaningful) events and analyze commands into actions framework
 * Consistency test support
 * Framework for unit testing
-  * Move UnitTest functions from classes to namespaces
+* Move UnitTest functions from classes to namespaces
 
 
 Version 2.6 - stable      - Target: < Mid 2007     - Status: Pending version 2.5 completion

Modified: development/source/actions/CMakeLists.txt
===================================================================
--- development/source/actions/CMakeLists.txt	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/actions/CMakeLists.txt	2006-05-12 02:11:01 UTC (rev 676)
@@ -2,6 +2,7 @@
 
 SET(libactions_a_SOURCES
   LandscapeActions.cc
+  PrintActions.cc
 )
 
 ADD_LIBRARY(actions ${libactions_a_SOURCES})

Modified: development/source/actions/LandscapeActions.cc
===================================================================
--- development/source/actions/LandscapeActions.cc	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/actions/LandscapeActions.cc	2006-05-12 02:11:01 UTC (rev 676)
@@ -22,7 +22,9 @@
 #include "cStats.h"
 #include "cString.h"
 #include "cWorld.h"
+#include "cWorldDriver.h"
 #include "tSmartArray.h"
+#include "defs.h"
 
 
 class cActionAnalyzeLandscape : public cAction
@@ -57,6 +59,14 @@
     cLandscape* land = NULL;
     
     if (ctx.GetAnalyzeMode()) {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_ON) {
+        cString msg("Performing landscape analysis on batch ");
+        msg += cStringUtil::Convert(m_world->GetAnalyze().GetCurrentBatchID());
+        m_world->GetDriver().NotifyComment(msg);
+      } else if (m_world->GetConfig().VERBOSITY.Get() > VERBOSE_SILENT) {
+        m_world->GetDriver().NotifyComment("Performing landscape analysis...");
+      }
+
       cAnalyzeGenotype* genotype = NULL;
       tListIterator<cAnalyzeGenotype> batch_it(m_world->GetAnalyze().GetCurrentBatch().List());
       while (genotype = batch_it.Next()) {
@@ -64,6 +74,9 @@
         m_depths.Push(genotype->GetDepth());
       }
     } else {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_DETAILS)
+        m_world->GetDriver().NotifyComment("Performing landscape analysis...");
+
       cGenotype* genotype = m_world->GetClassificationManager().GetBestGenotype();
       LoadGenome(genotype->GetGenome());
       m_depths.Push(genotype->GetDepth());
@@ -119,6 +132,74 @@
 };
 
 
+class cActionFullLandscape : public cAction
+{
+private:
+  cString m_filename;
+  int m_dist;
+  tList<cLandscape> m_batch;
+  
+public:
+  cActionFullLandscape(cWorld* world, const cString& args)
+    : cAction(world, args), m_filename("land-full.dat"), m_dist(1)
+  {
+      cString largs(args);
+      if (largs.GetSize()) m_filename = largs.PopWord();
+      if (largs.GetSize()) m_dist = largs.PopWord().AsInt();
+  }
+  
+  const cString GetDescription()
+  {
+    return "FullLandscape [filename='land-full.dat'] [int distance=1]";
+  }
+  
+  void Process(cAvidaContext& ctx)
+  {
+    int update = -1;
+    cLandscape* land = NULL;
+    
+    if (ctx.GetAnalyzeMode()) {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_ON) {
+        cString msg("Full Landscaping batch ");
+        msg += cStringUtil::Convert(m_world->GetAnalyze().GetCurrentBatchID());
+        m_world->GetDriver().NotifyComment(msg);
+      } else if (m_world->GetConfig().VERBOSITY.Get() > VERBOSE_SILENT) {
+        m_world->GetDriver().NotifyComment("Full Landscapping...");
+      }
+
+      cAnalyzeJobQueue& jobqueue = m_world->GetAnalyze().GetJobQueue();
+      cInstSet& inst_set = m_world->GetHardwareManager().GetInstSet();
+      
+      tListIterator<cAnalyzeGenotype> batch_it(m_world->GetAnalyze().GetCurrentBatch().List());
+      cAnalyzeGenotype* genotype = NULL;
+      while (genotype = batch_it.Next()) {
+        cLandscape* land = new cLandscape(m_world, genotype->GetGenome(), inst_set);
+        land->SetDistance(m_dist);
+        m_batch.PushRear(land);
+        jobqueue.AddJob(new tAnalyzeJob<cLandscape>(land, &cLandscape::Process));
+      }
+      jobqueue.Execute();
+    } else {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_DETAILS)
+        m_world->GetDriver().NotifyComment("Full Landscaping...");
+      
+      land = new cLandscape(m_world, m_world->GetClassificationManager().GetBestGenotype()->GetGenome(),
+                            m_world->GetHardwareManager().GetInstSet());
+      m_batch.PushRear(land);
+      land->SetDistance(m_dist);
+      land->Process(ctx);
+      update = m_world->GetStats().GetUpdate();      
+    }
+    
+    std::ofstream& outfile = m_world->GetDataFileOFStream(m_filename);
+    while (land = m_batch.Pop()) {
+      land->PrintStats(outfile, update);
+      delete land;
+    }
+  }
+};
+
+
 class cActionRandomLandscape : public cAction
 {
 private:
@@ -148,6 +229,14 @@
     cLandscape* land = NULL;
     
     if (ctx.GetAnalyzeMode()) {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_ON) {
+        cString msg("Random Landscaping batch ");
+        msg += cStringUtil::Convert(m_world->GetAnalyze().GetCurrentBatchID());
+        m_world->GetDriver().NotifyComment(msg);
+      } else if (m_world->GetConfig().VERBOSITY.Get() > VERBOSE_SILENT) {
+        m_world->GetDriver().NotifyComment("Random Landscapping...");
+      }
+
       cAnalyzeJobQueue& jobqueue = m_world->GetAnalyze().GetJobQueue();
       cInstSet& inst_set = m_world->GetHardwareManager().GetInstSet();
       
@@ -162,6 +251,9 @@
       }
       jobqueue.Execute();
     } else {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_DETAILS)
+        m_world->GetDriver().NotifyComment("Random Landscaping...");
+
       land = new cLandscape(m_world, m_world->GetClassificationManager().GetBestGenotype()->GetGenome(),
                             m_world->GetHardwareManager().GetInstSet());
       m_batch.PushRear(land);
@@ -208,6 +300,14 @@
     cLandscape* land = NULL;
     
     if (ctx.GetAnalyzeMode()) {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_ON) {
+        cString msg("Sample Landscaping batch ");
+        msg += cStringUtil::Convert(m_world->GetAnalyze().GetCurrentBatchID());
+        m_world->GetDriver().NotifyComment(msg);
+      } else if (m_world->GetConfig().VERBOSITY.Get() > VERBOSE_SILENT) {
+        m_world->GetDriver().NotifyComment("Sample Landscapping...");
+      }
+
       cAnalyzeJobQueue& jobqueue = m_world->GetAnalyze().GetJobQueue();
       cInstSet& inst_set = m_world->GetHardwareManager().GetInstSet();
       
@@ -221,6 +321,9 @@
       }
       jobqueue.Execute();
     } else {
+      if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_DETAILS)
+        m_world->GetDriver().NotifyComment("Sample Landscaping...");
+
       land = new cLandscape(m_world, m_world->GetClassificationManager().GetBestGenotype()->GetGenome(),
                             m_world->GetHardwareManager().GetInstSet());
       m_batch.PushRear(land);
@@ -241,6 +344,7 @@
 void RegisterLandscapeActions(cActionLibrary* action_lib)
 {
   action_lib->Register<cActionAnalyzeLandscape>("AnalyzeLandscape");
+  action_lib->Register<cActionRandomLandscape>("FullLandscape");
   action_lib->Register<cActionRandomLandscape>("RandomLandscape");
   action_lib->Register<cActionSampleLandscape>("SampleLandscape");
 }

Added: development/source/actions/PrintActions.cc
===================================================================
--- development/source/actions/PrintActions.cc	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/actions/PrintActions.cc	2006-05-12 02:11:01 UTC (rev 676)
@@ -0,0 +1,73 @@
+/*
+ *  PrintActions.cc
+ *  Avida
+ *
+ *  Created by David on 5/11/06.
+ *  Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "PrintActions.h"
+
+#include "cAction.h"
+#include "cActionLibrary.h"
+#include "cStats.h"
+#include "cWorld.h"
+
+
+#define STATS_OUT_FILE(METHOD, DEFAULT)                                                   /*  1 */ \
+class cAction ## METHOD : public cAction {                                                /*  2 */ \
+private:                                                                                  /*  3 */ \
+  cString m_filename;                                                                     /*  4 */ \
+public:                                                                                   /*  5 */ \
+  cAction ## METHOD(cWorld* world, const cString& args) : cAction(world, args)            /*  6 */ \
+  {                                                                                       /*  7 */ \
+    cString largs(args);                                                                  /*  8 */ \
+    if (largs == "") m_filename = #DEFAULT; else m_filename = largs.PopWord();            /*  9 */ \
+  }                                                                                       /* 10 */ \
+  const cString GetDescription() { return #METHOD " [cString fname=\"" #DEFAULT "\"]"; }  /* 11 */ \
+  void Process(cAvidaContext& ctx) { m_world->GetStats().METHOD(m_filename); }            /* 12 */ \
+}                                                                                         /* 13 */ \
+
+STATS_OUT_FILE(PrintAverageData,       average.dat         );
+STATS_OUT_FILE(PrintErrorData,         error.dat           );
+STATS_OUT_FILE(PrintVarianceData,      variance.dat        );
+STATS_OUT_FILE(PrintDominantData,      dominant.dat        );
+STATS_OUT_FILE(PrintStatsData,         stats.dat           );
+STATS_OUT_FILE(PrintCountData,         count.dat           );
+STATS_OUT_FILE(PrintTotalsData,        totals.dat          );
+STATS_OUT_FILE(PrintTasksData,         tasks.dat           );
+STATS_OUT_FILE(PrintTasksExeData,      tasks_exe.dat       );
+STATS_OUT_FILE(PrintTasksQualData,     tasks_quality.dat   );
+STATS_OUT_FILE(PrintResourceData,      resource.dat        );
+STATS_OUT_FILE(PrintTimeData,          time.dat            );
+STATS_OUT_FILE(PrintMutationData,      mutation.dat        );
+STATS_OUT_FILE(PrintMutationRateData,  mutation_rates.dat  );
+STATS_OUT_FILE(PrintDivideMutData,     divide_mut.dat      );
+STATS_OUT_FILE(PrintDominantParaData,  parasite.dat        );
+STATS_OUT_FILE(PrintInstructionData,   instruction.dat     );
+STATS_OUT_FILE(PrintGenotypeMap,       genotype_map.m      );
+
+
+void RegisterPrintActions(cActionLibrary* action_lib)
+{
+  action_lib->Register<cActionPrintAverageData>("PrintAverageData");
+  action_lib->Register<cActionPrintErrorData>("PrintErrorData");
+  action_lib->Register<cActionPrintVarianceData>("PrintVarianceData");
+  action_lib->Register<cActionPrintDominantData>("PrintDominantData");
+  action_lib->Register<cActionPrintStatsData>("PrintStatsData");
+  action_lib->Register<cActionPrintCountData>("PrintCountData");
+  action_lib->Register<cActionPrintTotalsData>("PrintTotalsData");
+  action_lib->Register<cActionPrintTasksData>("PrintTasksData");
+  action_lib->Register<cActionPrintTasksExeData>("PrintTasksExeData");
+  action_lib->Register<cActionPrintTasksQualData>("PrintTasksQualData");
+  action_lib->Register<cActionPrintResourceData>("PrintResourceData");
+  action_lib->Register<cActionPrintTimeData>("PrintTimeData");
+  action_lib->Register<cActionPrintMutationData>("PrintMutationData");
+  action_lib->Register<cActionPrintMutationRateData>("PrintMutationRateData");
+  action_lib->Register<cActionPrintDivideMutData>("PrintDivideMutData");
+  action_lib->Register<cActionPrintDominantParaData>("PrintDominantParaData");
+  action_lib->Register<cActionPrintInstructionData>("PrintInstructionData");
+  action_lib->Register<cActionPrintGenotypeMap>("PrintGenotypeMap");
+  
+}

Added: development/source/actions/PrintActions.h
===================================================================
--- development/source/actions/PrintActions.h	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/actions/PrintActions.h	2006-05-12 02:11:01 UTC (rev 676)
@@ -0,0 +1,17 @@
+/*
+ *  PrintActions.h
+ *  Avida
+ *
+ *  Created by David on 5/11/06.
+ *  Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef PrintActions_h
+#define PrintActions_h
+
+class cActionLibrary;
+
+void RegisterPrintActions(cActionLibrary* action_lib);
+
+#endif

Modified: development/source/actions/cAction.h
===================================================================
--- development/source/actions/cAction.h	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/actions/cAction.h	2006-05-12 02:11:01 UTC (rev 676)
@@ -38,15 +38,4 @@
   virtual void Process(cAvidaContext& ctx) = 0;
 };
 
-#ifdef ENABLE_UNIT_TESTS
-namespace nAction {
-  /**
-   * Run unit tests
-   *
-   * @param full Run full test suite; if false, just the fast tests.
-   **/
-  void UnitTests(bool full = false);
-}
-#endif  
-
 #endif

Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/analyze/cAnalyze.cc	2006-05-12 02:11:01 UTC (rev 676)
@@ -3389,37 +3389,6 @@
   return;
 }
 
-void cAnalyze::CommandLandscape(cString cur_string)
-{
-  if (verbose >= nAnalyze::VERBOSE_ON) cout << "Landscaping batch " << cur_batch << endl;
-  else cout << "Landscapping..." << endl;
-  
-  // Load in the variables...
-  cString filename;
-  if (cur_string.GetSize() != 0) filename = cur_string.PopWord();
-  int dist = 1;
-  if (cur_string.GetSize() != 0) dist = cur_string.PopWord().AsInt();
-  int num_test = 0;
-  if (cur_string.GetSize() != 0) num_test=cur_string.PopWord().AsInt();
-  
-  // If we're given a file, write to it.
-  ofstream& fp = m_world->GetDataFileOFStream(filename);
-  
-  // Loop through all of the genotypes in this batch...
-  tListIterator<cAnalyzeGenotype> batch_it(batch[cur_batch].List());
-  cAnalyzeGenotype * genotype = NULL;
-  while ((genotype = batch_it.Next()) != NULL) {
-    cLandscape landscape(m_world, genotype->GetGenome(), inst_set);
-    landscape.SetDistance(dist);
-    if (num_test == 0) {
-      landscape.Process(m_ctx);
-    } else {
-      landscape.SetTrials(num_test);
-      landscape.RandomProcess(m_ctx);
-    }
-    landscape.PrintStats(fp);
-  }
-}
 
 
 
@@ -3434,12 +3403,6 @@
 
 
 
-
-
-
-
-
-
 //@ MRR @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
 void cAnalyze::CommandPairwiseEntropy(cString cur_string)
 {
@@ -7742,7 +7705,6 @@
   AddLibraryDef("COMMUNITY_COMPLEXITY", &cAnalyze::AnalyzeCommunityComplexity);
   
   // Individual organism analysis...
-  AddLibraryDef("LANDSCAPE", &cAnalyze::CommandLandscape);
   AddLibraryDef("FITNESS_MATRIX", &cAnalyze::CommandFitnessMatrix);
   AddLibraryDef("MAP", &cAnalyze::CommandMapTasks);  // Deprecated...
   AddLibraryDef("MAP_TASKS", &cAnalyze::CommandMapTasks);

Modified: development/source/analyze/cAnalyze.h
===================================================================
--- development/source/analyze/cAnalyze.h	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/analyze/cAnalyze.h	2006-05-12 02:11:01 UTC (rev 676)
@@ -180,7 +180,6 @@
   void AnalyzeCommunityComplexity(cString cur_string);
 
   // Individual Organism Analysis...
-  void CommandLandscape(cString cur_string);
   void CommandFitnessMatrix(cString cur_string);
   void CommandMapTasks(cString cur_string);
   void CommandAverageModularity(cString cur_string);
@@ -277,6 +276,7 @@
   void RunFile(cString filename);
   void RunInteractive();
   
+  int GetCurrentBatchID() { return cur_batch; }
   cGenotypeBatch& GetCurrentBatch() { return batch[cur_batch]; }
   cAnalyzeJobQueue& GetJobQueue() { return m_jobqueue; }
 };

Modified: development/source/analyze/cAnalyzeJobQueue.cc
===================================================================
--- development/source/analyze/cAnalyzeJobQueue.cc	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/analyze/cAnalyzeJobQueue.cc	2006-05-12 02:11:01 UTC (rev 676)
@@ -11,10 +11,13 @@
 
 #include "cAnalyzeJobWorker.h"
 #include "cWorld.h"
+#include "cWorldDriver.h"
+#include "defs.h"
 
 #include <iostream>
 using namespace std;
 
+
 cAnalyzeJobQueue::cAnalyzeJobQueue(cWorld* world) : m_world(world), m_last_jobid(0)
 {
   for (int i = 0; i < MT_RANDOM_POOL_SIZE; i++) {
@@ -33,11 +36,11 @@
 
 void cAnalyzeJobQueue::Execute()
 {
-  const int num_workers = 1; //m_world->GetConfig().ANALYZE_MT_CONCURRENCY.Get();
-  
+  const int num_workers = m_world->GetConfig().MT_CONCURRENCY.Get();
   cAnalyzeJobWorker* workers[num_workers];
   
-  cout << "Going Multithreaded..." << endl;
+  if (m_world->GetConfig().VERBOSITY.Get() >= VERBOSE_DETAILS)
+    m_world->GetDriver().NotifyComment("Going Multithreaded...");
   
   for (int i = 0; i < num_workers; i++) {
     workers[i] = new cAnalyzeJobWorker(this);

Modified: development/source/defs.h
===================================================================
--- development/source/defs.h	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/defs.h	2006-05-12 02:11:01 UTC (rev 676)
@@ -165,4 +165,13 @@
   SIZE_MERIT_SQRT_LEAST
 };
 
+typedef enum eVerbosity {
+  VERBOSE_SILENT = 0,   // No output at all
+  VERBOSE_QUIET,        // Notification at start of commands.
+  VERBOSE_ON,           // Verbose output, detailing progress
+  VERBOSE_DETAILS,      // High level of details, as available.
+  VERBOSE_DEBUG         // Print Debug Information, as applicable.
+};
+
+
 #endif

Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/main/cAvidaConfig.h	2006-05-12 02:11:01 UTC (rev 676)
@@ -154,7 +154,8 @@
   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(ANALYZE_MT_CONCURRENCY, int, 1, "Number of concurrent analyze threads");
+  CONFIG_ADD_VAR(MT_CONCURRENCY, int, 1, "Number of concurrent analyze threads");
+  CONFIG_ADD_VAR(VERBOSITY, int, 0, "Control output verbosity");
   
   CONFIG_ADD_GROUP(ARCH_GROUP, "Architecture Variables");
   CONFIG_ADD_VAR(MAX_UPDATES, int, -1, "Maximum updates to run experiment (-1 = no limit)");

Modified: development/source/main/cWorld.cc
===================================================================
--- development/source/main/cWorld.cc	2006-05-09 01:38:54 UTC (rev 675)
+++ development/source/main/cWorld.cc	2006-05-12 02:11:01 UTC (rev 676)
@@ -26,6 +26,7 @@
 #include "cFallbackWorldDriver.h"
 
 #include "LandscapeActions.h"
+#include "PrintActions.h"
 
 
 cWorld::~cWorld()
@@ -61,6 +62,7 @@
   
   m_actlib = new cActionLibrary();
   RegisterLandscapeActions(m_actlib);
+  RegisterPrintActions(m_actlib);
   
   // The data directory should end in a '/'
   cString dir = m_conf->DATA_DIR.Get();




More information about the Avida-cvs mailing list