[Avida-SVN] r2167 - branches/uml/source/main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Wed Oct 31 13:26:12 PDT 2007


Author: hjg
Date: 2007-10-31 16:26:11 -0400 (Wed, 31 Oct 2007)
New Revision: 2167

Modified:
   branches/uml/source/main/cPopulation.cc
   branches/uml/source/main/cPopulation.h
   branches/uml/source/main/cUMLModel.cc
Log:


Modified: branches/uml/source/main/cPopulation.cc
===================================================================
--- branches/uml/source/main/cPopulation.cc	2007-10-31 02:43:00 UTC (rev 2166)
+++ branches/uml/source/main/cPopulation.cc	2007-10-31 20:26:11 UTC (rev 2167)
@@ -2785,3 +2785,25 @@
   sleep_log[cellID].RemoveAt(sleep_log[cellID].Size()-1);
   sleep_log[cellID].Add(make_pair(p.first, end_time));
 }
+
+// Check to see if a model is already present in the model_cache
+bool cPopulation::findModel(string mod){
+	bool ret_val = false;
+	if (model_cache.find(mod) != model_cache.end()){
+		ret_val = true;
+	}
+	return ret_val;
+}
+ 
+// Check what the reward is for a model in the model_cache
+float cPopulation::getReward(string mod, string task_name){
+	return 0.0;
+}
+
+// Add a model to the cache
+void cPopulation::addAModel(string mod, map<string, float> rewards){
+	model_cache[mod] = rewards;
+}
+
+  
+  
\ No newline at end of file

Modified: branches/uml/source/main/cPopulation.h
===================================================================
--- branches/uml/source/main/cPopulation.h	2007-10-31 02:43:00 UTC (rev 2166)
+++ branches/uml/source/main/cPopulation.h	2007-10-31 20:26:11 UTC (rev 2167)
@@ -27,6 +27,8 @@
 #define cPopulation_h
 
 #include <fstream>
+#include <map>
+#include <string>
 
 #ifndef cBirthChamber_h
 #include "cBirthChamber.h"
@@ -59,6 +61,7 @@
 #include "tVector.h"
 #endif
 
+
 #if USE_tMemTrack
 # ifndef tMemTrack_h
 #  include "tMemTrack.h"
@@ -80,6 +83,8 @@
 class cSaleItem;
 
 
+
+
 class cPopulation
 {
 #if USE_tMemTrack
@@ -108,6 +113,14 @@
   int world_y;                         // Structured population
   int num_organisms;                   // Cell count with living organisms
   tArray<cDeme> deme_array;            // Deme structure of the population.
+  
+
+  // For the UML branch.	
+  map<string, map<string, float> > model_cache;						// This variable is used for caching models
+																	// and how well the models satisfied the
+																	// property, scenario, and software engineering
+																	// tasks.
+
  
   // Outside interactions...
   bool sync_events;   // Do we need to sync up the event list with population?
@@ -185,7 +198,6 @@
   // Print donation stats
   void PrintDonationStats();
 
-
   // Process a single organism one instruction...
   int ScheduleOrganism();          // Determine next organism to be processed.
   void ProcessStep(cAvidaContext& ctx, double step_size, int cell_id);
@@ -196,6 +208,11 @@
 
   // Clear all but a subset of cells...
   void SerialTransfer(int transfer_size, bool ignore_deads);
+  
+  // UML Branch: 
+  bool findModel(string);						// Check to see if a model is present in a model cache. 
+  float getReward(string, string);				// Get the reward for a specific task for a specific model.
+  void addAModel(string, map<string, float>);	// Add a model to the cache.
 
   // Saving and loading...
   bool SaveClone(std::ofstream& fp);

Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2007-10-31 02:43:00 UTC (rev 2166)
+++ branches/uml/source/main/cUMLModel.cc	2007-10-31 20:26:11 UTC (rev 2167)
@@ -332,7 +332,7 @@
 bool cUMLModel::readyForHydra() 
 {
 	// options: (0) ALL_COMPLETE, (1) ONE_COMPLETE, (2) ONE_NON_EMPTY, (3) ALL_NON_EMPTY
-	//          (4) ALL COMPLETE && DETERMINISTIC
+	//          (4) ALL COMPLETE && DETERMINISTIC, (5) ALL THE TIME
 	// check which option was selected in the seed-model.cfg
 	// check to see if this condition is true. If so, return 1; otherwise, return 0.
 	
@@ -366,8 +366,10 @@
 			//ret_val &= scenario_completion[i];
 			if (scenario_completion[i] != 1) ret_val &= 0;
 		}
-			
 		break;
+	case 5: 
+		ret_val =1;
+		break;
 	default:
 		ret_val = 0;
 	}




More information about the Avida-cvs mailing list