[Avida-SVN] r1092 - in development/source: actions analyze main

ofria at myxo.css.msu.edu ofria at myxo.css.msu.edu
Mon Nov 20 19:08:47 PST 2006


Author: ofria
Date: 2006-11-20 22:08:34 -0500 (Mon, 20 Nov 2006)
New Revision: 1092

Modified:
   development/source/actions/LandscapeActions.cc
   development/source/analyze/cAnalyze.cc
   development/source/main/avida.cc
   development/source/main/cAvidaConfig.cc
   development/source/main/cAvidaConfig.h
Log:
Setup avida to take a "-r[eview]" option which will list all settings that are
not at the default in the current avida.cfg file.


Modified: development/source/actions/LandscapeActions.cc
===================================================================
--- development/source/actions/LandscapeActions.cc	2006-11-20 21:15:27 UTC (rev 1091)
+++ development/source/actions/LandscapeActions.cc	2006-11-21 03:08:34 UTC (rev 1092)
@@ -145,10 +145,11 @@
 
 
 /*
- Precalculates landscape data for use in detail files.  The primary advantage of
- this is that it supports multithreaded execution, whereas lazy evaluation during
- detailing will be serialized.
+ * Precalculates landscape data for use in detail files.  The primary
+ * advantage of this is that it supports multithreaded execution, whereas
+ * lazy evaluation during detailing will be serialized.
 */
+
 class cActionPrecalcLandscape : public cAction  // @parallelized
 {
 public:

Modified: development/source/analyze/cAnalyze.cc
===================================================================
--- development/source/analyze/cAnalyze.cc	2006-11-20 21:15:27 UTC (rev 1091)
+++ development/source/analyze/cAnalyze.cc	2006-11-21 03:08:34 UTC (rev 1092)
@@ -6091,6 +6091,8 @@
 }
 
 
+// Analyze the mutations along an aligned lineage.
+
 void cAnalyze::AnalyzeMuts(cString cur_string)
 {
   cout << "Analyzing Mutations" << endl;
@@ -6280,12 +6282,16 @@
   delete [] mut_positions;
 }
 
+
+// Analyze the frequency that each instruction appears in the batch, and
+// make note of those that appear more or less often than expected.
+
 void cAnalyze::AnalyzeInstructions(cString cur_string)
 {
   if (m_world->GetVerbosity() >= VERBOSE_ON) {
     cout << "Analyzing Instructions in batch " << cur_batch << endl;
   }
-  else cout << "Analyzeing Instructions..." << endl;
+  else cout << "Analyzing Instructions..." << endl;
   
   // Load in the variables...
   cString filename("inst_analyze.dat");

Modified: development/source/main/avida.cc
===================================================================
--- development/source/main/avida.cc	2006-11-20 21:15:27 UTC (rev 1091)
+++ development/source/main/avida.cc	2006-11-21 03:08:34 UTC (rev 1092)
@@ -71,16 +71,31 @@
 void printVersionBanner()
 {
   // output copyright message
-  cout << getAvidaVersion() << endl;
   cout << "----------------------------------------------------------------------" << endl;
+  cout << getAvidaVersion() << endl << endl;
+  cout << "by Charles Ofria" << endl << endl;
+  cout << "Lead Developers: David Bryson (Avida) and Kaben Nanlohy (Avida-ED)" << endl << endl;
+  cout << "Portions by Brian Baer, Jeffrey Barrick, Benjamin Beckmann, Jeffrey Clune," << endl
+       << "Travis Collier, Art Covert, Evan Dorn, Sherri Goings, George Hagstrom," << endl
+       << "Dehua Hang, Wei Huang, David Knoester, Dusan Misevic, Elizabeth Ostrowski," << endl
+       << "Matthew Rupp, Jason Stredwick, Bess Walker, Claus Wilke, and Larry Wisne" << endl << endl;
+
+  cout << "With design help from Christoph Adami, C. Titus Brown, Timothy Cooper," << endl
+       << "Santiago Elena, Richard Lenski, Philip McKinley, Robert Pennock, Thomas" << endl
+       << "Schmidt, Robert Schwartz, Eric Torng, Jialan Wang, Daniel Weise, and Gabriel" << endl
+       << "Yedid" << endl;
+
+  cout << endl;
+
   cout << "Copyright (C) 1999-2006 Michigan State University." << endl;
-  cout << "Copyright (C) 1993-2005 California Institute of Technology." << endl << endl;
+  cout << "Copyright (C) 1993-2003 California Institute of Technology." << endl << endl;
   
   cout << "Avida comes with ABSOLUTELY NO WARRANTY." << endl;
   cout << "This is free software, and you are welcome to redistribute it" << endl;
   cout << "under certain conditions. See file COPYING for details." << endl << endl;
 
-  cout << "For more information, see: http://devolab.cse.msu.edu/software/avida/" << endl << endl;
+  cout << "For more information, see: http://devolab.cse.msu.edu/software/avida/" << endl;
+  cout << "----------------------------------------------------------------------" << endl << endl;
 }
 
 void ExitAvida(int exit_code)

Modified: development/source/main/cAvidaConfig.cc
===================================================================
--- development/source/main/cAvidaConfig.cc	2006-11-20 21:15:27 UTC (rev 1091)
+++ development/source/main/cAvidaConfig.cc	2006-11-21 03:08:34 UTC (rev 1092)
@@ -158,6 +158,37 @@
   }
 }
 
+void cAvidaConfig::PrintReview()
+{
+  cout << endl << "Non-Default Settings: " << endl << endl;
+
+  // Loop through all possible groups.
+  tListIterator<cBaseConfigGroup> group_it(group_list);
+  cBaseConfigGroup * cur_group;
+  while ((cur_group = group_it.Next()) != NULL) {
+    // Loop through entries for this group...
+    tConstListIterator<cBaseConfigEntry> entry_it(cur_group->GetEntryList());
+    const cBaseConfigEntry* cur_entry;
+    while ((cur_entry = entry_it.Next()) != NULL) {
+      if (cur_entry->EqualsString( cur_entry->GetDefault() ) == false) {
+	cout << " " << cur_entry->GetName() << " ";
+	if (cur_entry->GetType() == "double") {
+	  cout << cur_entry->AsString().AsDouble() << " ";
+	} else if (cur_entry->GetType() == "int") {
+	  cout << cur_entry->AsString().AsInt() << " ";
+	} else {
+	  cout << cur_entry->AsString() << " ";
+	}
+	cout << "(default=" << cur_entry->GetDefault() << ")"
+	     << endl;
+      }
+    }
+  }
+  cout << endl;
+  
+}
+
+
 void cAvidaConfig::GenerateOverides()
 {
   ofstream fp("config_overrides.h");  
@@ -305,23 +336,33 @@
     
     // Test against the possible inputs.
 
-    if (cur_arg == "-e") {
+    // Print out a list of all possibel actions (was events).
+    if (cur_arg == "-e" || cur_arg == "-events" || cur_arg == "-actions") {
       cout << endl << "Supported Actions:" << endl;
       cout << cDriverManager::GetActionLibrary()->DescribeAll() << endl;
       exit(0);
-    } else if (cur_arg == "--help" || cur_arg == "-help" || cur_arg == "-h") {
+    }
+
+    // Review configuration options, listing those non-default.
+    else if (cur_arg == "-review" || cur_arg == "-r") {
+      cfg->PrintReview();
+      exit(0);
+    }
+    
+    else if (cur_arg == "--help" || cur_arg == "-help" || cur_arg == "-h") {
       cout << "Options:"<<endl
-      << "  -c[onfig] <filename>  Set config file to be <filename>"<<endl
-      << "  -h[elp]               Help on options (this listing)"<<endl
-      << "  -e                    Print a list of all known actions"<< endl
-      << "  -s[eed] <value>       Set random seed to <value>"<<endl
-      << "  -v[ersion]            Prints the version number"<<endl
-      << "  -v0 -v1 -v2 -v3 -v4   Set output verbosity to 0..4"
-      << "  -set <name> <value>   Overide the genesis file"<<endl
-      << "  -l[oad] <filename>    Load a clone file"<<endl
-      << "  -a[nalyze]            Process analyze.cfg instead of normal run."<<endl
-      << "  -i[nteractive]        Run analyze mode interactively."
-      << endl;
+	   << "  -a[nalyze]            Process analyze.cfg instead of normal run." << endl
+	   << "  -c[onfig] <filename>  Set config file to be <filename>"<<endl
+	   << "  -e; -actions          Print a list of all known actions"<< endl
+	   << "  -h[elp]               Help on options (this listing)"<<endl
+	   << "  -i[nteractive]        Run analyze mode interactively" << endl
+	   << "  -l[oad] <filename>    Load a clone file" << endl
+	   << "  -r[eview]             Review analyze.cfg settings."
+	   << "  -s[eed] <value>       Set random seed to <value>" << endl
+	   << "  -set <name> <value>   Overide values in avida.cfg" << endl
+	   << "  -v[ersion]            Prints the version number" << endl
+	   << "  -v0 -v1 -v2 -v3 -v4   Set output verbosity to 0..4" << endl
+	   << endl;
       
       exit(0);
     }
@@ -351,15 +392,12 @@
         arg_num++;  if (arg_num < argc) cur_arg = args[arg_num];
         cfg->CLONE_FILE.Set(cur_arg);
       }
-    } else if (cur_arg == "-version") {
+    } else if (cur_arg == "-version" || cur_arg == "-v") {
+      // We've already showed version info, so just quit.
       exit(0);
     } else if (cur_arg.Substring(0, 2) == "-v") {
-      if (cur_arg.GetSize() == 2) { // equivalent to -version
-        exit(0);
-      } else { // set verbosity
-        int level = cur_arg.Substring(2, cur_arg.GetSize() - 2).AsInt();
-        cfg->VERBOSITY.Set(level);
-      }
+      int level = cur_arg.Substring(2, cur_arg.GetSize() - 2).AsInt();
+      cfg->VERBOSITY.Set(level);
     } else if (cur_arg == "-set") {
       if (arg_num + 1 == argc || arg_num + 2 == argc) {
         cerr << "'-set' option must be followed by name and value" << endl;

Modified: development/source/main/cAvidaConfig.h
===================================================================
--- development/source/main/cAvidaConfig.h	2006-11-20 21:15:27 UTC (rev 1091)
+++ development/source/main/cAvidaConfig.h	2006-11-21 03:08:34 UTC (rev 1092)
@@ -30,41 +30,47 @@
 // entry for a new setting in the configuration.
 //
 // To step through what we are doing:
-// 1 - Load in four variables representing the setting name, its type, its
-//     default value, and a brief description of what its for.  The description
-//     should be a string, enclosed in quotes.
+// 1 - Load in four variables representing the setting:
+//     NAME = The name of the variable in the config file.
+//     TYPE = The type of the variable (int, double, or cString)
+//     DEFAULT = Value to use if this isn't set by user.
+//     DESC = a brief description of the setting (a string, enclosed in quotes)
 // 2 - Build a new class using the setting name with the prefix cEntry_
 //     This class will contain all of the info about this setting, and will
 //     be derived from the cBaseConfigEntry class so that we may easily refer
 //     to any of these dynamically created classes.
 // 3 - Create a private value for this setting.
 // 4 - Create a LoadString() method to load the settings in from a string.
-// 5 - Create a constructor that passes all of the information to the base
+// 5 - Create a EqualsString() method to determine if the values are the same.
+// 6 - Create a constructor that passes all of the information to the base
 //     class that it can manage to.
-// 6 - Initialize the value of this setting to its default.
-// 7 - Insert the newly built object into the full list of settings objects.
-// 8 - Create Get() and Set() methods to act as accessors.
-// 9 - Setup a method to return the value of this setting as a string.
-// 10 - Declare a variable of this class's type to use in the future.  Since
+// 7 - Initialize the value of this setting to its default.
+// 8 - Insert the newly built object into the full list of settings objects.
+// 9 - Create Get() and Set() methods to act as accessors.
+// 10 - Setup a method to return the value of this setting as a string.
+// 11 - Declare a variable of this class's type to use in the future.  Since
 //     accessors were declared above, we can refer to this setting by the
 //     setting name inside of config.
 
-#define CONFIG_ADD_VAR(NAME, TYPE, DEFAULT, DESC)                      /* 1 */ \
-class cEntry_ ## NAME : public cBaseConfigEntry {                      /* 2 */ \
-private:                                                                       \
-  TYPE value;                                                          /* 3 */ \
-public:                                                                        \
-  void LoadString(const cString& str_value) {                          /* 4 */ \
-    value = cStringUtil::Convert(str_value, value);                            \
-  }                                                                            \
-  cEntry_ ## NAME() : cBaseConfigEntry(#NAME, #TYPE, #DEFAULT, DESC) { /* 5 */ \
-    LoadString(GetDefault());                                          /* 6 */ \
-    global_group_list.GetLast()->AddEntry(this);                       /* 7 */ \
-  }                                                                            \
-  TYPE Get() const { return value; }                                   /* 8 */ \
-  void Set(TYPE in_value) { value = in_value; }                                \
-  cString AsString() const { return cStringUtil::Convert(value); }     /*  9 */ \
-} NAME                                                                 /* 10 */ \
+#define CONFIG_ADD_VAR(NAME, TYPE, DEFAULT, DESC)                     /* 1 */ \
+class cEntry_ ## NAME : public cBaseConfigEntry {                     /* 2 */ \
+private:                                                                      \
+  TYPE value;                                                         /* 3 */ \
+public:                                                                       \
+  void LoadString(const cString& str_value) {                         /* 4 */ \
+    value = cStringUtil::Convert(str_value, value);                           \
+  }                                                                           \
+  bool EqualsString(const cString& str_value) const {                 /* 5 */ \
+    return (value == cStringUtil::Convert(str_value, value));                 \
+  }                                                                           \
+  cEntry_ ## NAME() : cBaseConfigEntry(#NAME,#TYPE,#DEFAULT,DESC) {   /* 6 */ \
+    LoadString(GetDefault());                                         /* 7 */ \
+    global_group_list.GetLast()->AddEntry(this);                      /* 8 */ \
+  }                                                                           \
+  TYPE Get() const { return value; }                                  /* 9 */ \
+  void Set(TYPE in_value) { value = in_value; }                               \
+  cString AsString() const { return cStringUtil::Convert(value); }    /* 10 */\
+} NAME                                                                /* 11 */\
 
 
 // Now we're going to make another macro to deal with groups.  This time its
@@ -97,11 +103,12 @@
     bool use_overide;
     
   public:
-      cBaseConfigEntry(const cString& _name, const cString& _type,
-                       const cString& _def, const cString& _desc);
+    cBaseConfigEntry(const cString& _name, const cString& _type,
+		     const cString& _def, const cString& _desc);
     virtual ~cBaseConfigEntry() { ; }
     
-    virtual void LoadString(const cString& str_value) = 0;
+    virtual void LoadString(const cString & str_value) = 0;
+    virtual bool EqualsString(const cString & str_value) const = 0;
     
     const cString& GetName() const { return config_name; }
     const cString& GetType() const { return type; }
@@ -288,6 +295,7 @@
   void Load(const cString& filename);
   void Print(const cString& filename);
   void Status();
+  void PrintReview();
   
   bool Get(const cString& entry, cString& ret) const;
   bool Set(const cString& entry, const cString& val);




More information about the Avida-cvs mailing list