[Avida-SVN] r2360 - in branches/uml: Avida.xcodeproj source/cpu source/main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Fri Feb 22 10:03:03 PST 2008


Author: hjg
Date: 2008-02-22 13:03:03 -0500 (Fri, 22 Feb 2008)
New Revision: 2360

Modified:
   branches/uml/Avida.xcodeproj/project.pbxproj
   branches/uml/source/cpu/cHardwareCPU.cc
   branches/uml/source/main/cMDEAbsenceProperty.cc
   branches/uml/source/main/cMDEAbsenceProperty.h
   branches/uml/source/main/cMDEExistenceProperty.cc
   branches/uml/source/main/cMDEExistenceProperty.h
   branches/uml/source/main/cMDEExpression.h
   branches/uml/source/main/cMDEPrecedenceProperty.cc
   branches/uml/source/main/cMDEPrecedenceProperty.h
   branches/uml/source/main/cMDEProperty.cc
   branches/uml/source/main/cMDEProperty.h
   branches/uml/source/main/cMDEResponseProperty.cc
   branches/uml/source/main/cMDEResponseProperty.h
   branches/uml/source/main/cMDEUniversalProperty.cc
   branches/uml/source/main/cMDEUniversalProperty.h
   branches/uml/source/main/cOrganism.cc
   branches/uml/source/main/cTaskLib.cc
   branches/uml/source/main/cUMLModel.cc
   branches/uml/source/main/cUMLModel.h
Log:
Refactored code to create a new property generator class. 



Modified: branches/uml/Avida.xcodeproj/project.pbxproj
===================================================================
--- branches/uml/Avida.xcodeproj/project.pbxproj	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/Avida.xcodeproj/project.pbxproj	2008-02-22 18:03:03 UTC (rev 2360)
@@ -23,6 +23,8 @@
 /* End PBXAggregateTarget section */
 
 /* Begin PBXBuildFile section */
+		3E13BB350D6F49BD0014F96F /* cMDEPropertyGenerator.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3E13BB330D6F49BD0014F96F /* cMDEPropertyGenerator.cc */; };
+		3E13BB360D6F49BD0014F96F /* cMDEPropertyGenerator.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3E13BB340D6F49BD0014F96F /* cMDEPropertyGenerator.h */; };
 		3E26D9070CFA0453009616CC /* cMDEAbsenceProperty.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3E26D8FF0CFA0453009616CC /* cMDEAbsenceProperty.cc */; };
 		3E26D9080CFA0453009616CC /* cMDEAbsenceProperty.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 3E26D9000CFA0453009616CC /* cMDEAbsenceProperty.h */; };
 		3E26D9090CFA0453009616CC /* cMDEExistenceProperty.cc in Sources */ = {isa = PBXBuildFile; fileRef = 3E26D9010CFA0453009616CC /* cMDEExistenceProperty.cc */; };
@@ -347,6 +349,7 @@
 				3E849FD60D4A7ECB003DE1BF /* cMDEExistenceProperty.h in CopyFiles */,
 				3E849FF00D4A8331003DE1BF /* cMDEPrecedenceProperty.h in CopyFiles */,
 				3E97D6CA0D63307E00FA7028 /* cMDEExpression.h in CopyFiles */,
+				3E13BB360D6F49BD0014F96F /* cMDEPropertyGenerator.h in CopyFiles */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -375,6 +378,8 @@
 /* Begin PBXFileReference section */
 		1097463D0AE9606E00929ED6 /* cDeme.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cDeme.cc; sourceTree = "<group>"; };
 		1097463E0AE9606E00929ED6 /* cDeme.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cDeme.h; sourceTree = "<group>"; };
+		3E13BB330D6F49BD0014F96F /* cMDEPropertyGenerator.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cMDEPropertyGenerator.cc; sourceTree = "<group>"; };
+		3E13BB340D6F49BD0014F96F /* cMDEPropertyGenerator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cMDEPropertyGenerator.h; sourceTree = "<group>"; };
 		3E26D8FF0CFA0453009616CC /* cMDEAbsenceProperty.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cMDEAbsenceProperty.cc; sourceTree = "<group>"; };
 		3E26D9000CFA0453009616CC /* cMDEAbsenceProperty.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cMDEAbsenceProperty.h; sourceTree = "<group>"; };
 		3E26D9010CFA0453009616CC /* cMDEExistenceProperty.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = cMDEExistenceProperty.cc; sourceTree = "<group>"; };
@@ -874,7 +879,7 @@
 		DCC315CE076253A5008F7A48 /* environment.rotate */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = environment.rotate; sourceTree = "<group>"; };
 		DCC315D0076253A5008F7A48 /* task_event_gen.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.cc; sourceTree = "<group>"; };
 		DCC315D1076253A5008F7A48 /* task_event_gen.old.cc */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = task_event_gen.old.cc; sourceTree = "<group>"; };
-		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
+		DCC3164D07626CF3008F7A48 /* avida */ = {isa = PBXFileReference; includeInIndex = 0; lastKnownFileType = "compiled.mach-o.executable"; path = avida; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -1401,6 +1406,8 @@
 		DCC310040762539D008F7A48 /* main */ = {
 			isa = PBXGroup;
 			children = (
+				3E13BB330D6F49BD0014F96F /* cMDEPropertyGenerator.cc */,
+				3E13BB340D6F49BD0014F96F /* cMDEPropertyGenerator.h */,
 				3E97D6C90D63307D00FA7028 /* cMDEExpression.h */,
 				3E26D8FF0CFA0453009616CC /* cMDEAbsenceProperty.cc */,
 				3E26D9000CFA0453009616CC /* cMDEAbsenceProperty.h */,
@@ -2053,6 +2060,7 @@
 				3ED30B220D43D73D00B3E0A7 /* cUMLClass.cc in Sources */,
 				3E849FD80D4A7F04003DE1BF /* cMDEResponseProperty.cc in Sources */,
 				3E849FEF0D4A8331003DE1BF /* cMDEPrecedenceProperty.cc in Sources */,
+				3E13BB350D6F49BD0014F96F /* cMDEPropertyGenerator.cc in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: branches/uml/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/uml/source/cpu/cHardwareCPU.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/cpu/cHardwareCPU.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -5107,16 +5107,16 @@
 	float val = 0;
 	// Call a function on the model to create this property.
 	// Currently it just uses p
-	std::string s = organism->getUMLModel()->getPstring();
+	std::string s = organism->getUMLModel()->getPropertyGenerator()->getPstring();
 	
 	if (s != "<null>" ) {
 //		std::string n = organism->getStateDiagram()->getName();
 //		s = n + "." + s;
 //		val = organism->getUMLModel()->addAbsenceProperty(s);
-		val = m_world->GetPopulation().getUMLModel()->addAbsenceProperty(s);
+		val = m_world->GetPopulation().getUMLModel()->getPropertyGenerator()->addAbsenceProperty(s);
 	}
 	
-	organism->getUMLModel()->addPropertyReward(val);
+	organism->getUMLModel()->getPropertyGenerator()->addPropertyReward(val);
 
 	return val;
 } 
@@ -5125,16 +5125,16 @@
 { 
 	float val = 0;
 	// Call a function on the model to create this property.
-	std::string s = organism->getUMLModel()->getPstring();
+	std::string s = organism->getUMLModel()->getPropertyGenerator()->getPstring();
 	
 	if (s != "<null>" ) {
 //		std::string n = organism->getStateDiagram()->getName();
 //		s = n + "." + s;
 //		val = organism->getUMLModel()->addUniversalProperty(s);
-		val = m_world->GetPopulation().getUMLModel()->addUniversalProperty(s);
+		val = m_world->GetPopulation().getUMLModel()->getPropertyGenerator()->addUniversalProperty(s);
 	}
 	
-	organism->getUMLModel()->addPropertyReward(val);
+	organism->getUMLModel()->getPropertyGenerator()->addPropertyReward(val);
 
 	return val;
 } 
@@ -5143,16 +5143,16 @@
 {
 	float val = 0;
 	// Call a function on the model to create this property.
-	std::string s = organism->getUMLModel()->getPstring();
+	std::string s = organism->getUMLModel()->getPropertyGenerator()->getPstring();
 	
 	if (s != "<null>" ) {
 //		std::string n = organism->getStateDiagram()->getName();
 //		s = n + "." + s;
 //		val = organism->getUMLModel()->addExistenceProperty(s);
-		val = m_world->GetPopulation().getUMLModel()->addExistenceProperty(s);
+		val = m_world->GetPopulation().getUMLModel()->getPropertyGenerator()->addExistenceProperty(s);
 	}
 	
-	organism->getUMLModel()->addPropertyReward(val);
+	organism->getUMLModel()->getPropertyGenerator()->addPropertyReward(val);
 		
 	return val;
 } 
@@ -5161,14 +5161,14 @@
 {
 	float val = 0;
 	// Call a function on the model to create this property.
-	std::string p = organism->getUMLModel()->getPstring();
-	std::string q = organism->getUMLModel()->getQstring();
+	std::string p = organism->getUMLModel()->getPropertyGenerator()->getPstring();
+	std::string q = organism->getUMLModel()->getPropertyGenerator()->getQstring();
 	
 	if (p != q) {
-		val = m_world->GetPopulation().getUMLModel()->addPrecedenceProperty(p, q);
+		val = m_world->GetPopulation().getUMLModel()->getPropertyGenerator()->addPrecedenceProperty(p, q);
 	}
 	
-	organism->getUMLModel()->addPropertyReward(val);
+	organism->getUMLModel()->getPropertyGenerator()->addPropertyReward(val);
 	
 	return val;
 } 
@@ -5177,14 +5177,14 @@
 {
 	float val = 0;
 	// Call a function on the model to create this property.
-	std::string p = organism->getUMLModel()->getPstring();
-	std::string q = organism->getUMLModel()->getQstring();
+	std::string p = organism->getUMLModel()->getPropertyGenerator()->getPstring();
+	std::string q = organism->getUMLModel()->getPropertyGenerator()->getQstring();
 	
 	if (p != q) {
-		val = m_world->GetPopulation().getUMLModel()->addResponseProperty(p, q);
+		val = m_world->GetPopulation().getUMLModel()->getPropertyGenerator()->addResponseProperty(p, q);
 	}
 	
-	organism->getUMLModel()->addPropertyReward(val);
+	organism->getUMLModel()->getPropertyGenerator()->addPropertyReward(val);
 	
 	return val;
 } 
@@ -5193,82 +5193,82 @@
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->getUMLModel()->relativeMoveExpressionP(jump_amount));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionP(jump_amount));
 }
 
 bool cHardwareCPU::Inst_NextExpressionP(cAvidaContext& ctx)
 {
-	return (organism->getUMLModel()->relativeMoveExpressionP(1));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionP(1));
 }
 
 bool cHardwareCPU::Inst_PrevExpressionP(cAvidaContext& ctx)
 {
-	return (organism->getUMLModel()->relativeMoveExpressionP(-1));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionP(-1));
 }
 
 bool cHardwareCPU::Inst_AbsoluteMoveExpressionP(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->getUMLModel()->absoluteMoveExpressionP(jump_amount));
+	return (organism->getUMLModel()->getPropertyGenerator()->absoluteMoveExpressionP(jump_amount));
 }
 
 bool cHardwareCPU::Inst_RelativeMoveExpressionQ(cAvidaContext& ctx) 
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->getUMLModel()->relativeMoveExpressionQ(jump_amount));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionQ(jump_amount));
 }
 
 bool cHardwareCPU::Inst_NextExpressionQ(cAvidaContext& ctx)
 {
-	return (organism->getUMLModel()->relativeMoveExpressionQ(1));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionQ(1));
 }
 
 bool cHardwareCPU::Inst_PrevExpressionQ(cAvidaContext& ctx)
 {
-	return (organism->getUMLModel()->relativeMoveExpressionQ(-1));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionQ(-1));
 }
 
 bool cHardwareCPU::Inst_AbsoluteMoveExpressionQ(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->getUMLModel()->absoluteMoveExpressionQ(jump_amount));
+	return (organism->getUMLModel()->getPropertyGenerator()->absoluteMoveExpressionQ(jump_amount));
 }
 
 bool cHardwareCPU::Inst_RelativeMoveExpressionR(cAvidaContext& ctx) 
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->getUMLModel()->relativeMoveExpressionR(jump_amount));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionR(jump_amount));
 }
 
 bool cHardwareCPU::Inst_NextExpressionR(cAvidaContext& ctx)
 {
-	return (organism->getUMLModel()->relativeMoveExpressionR(1));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionR(1));
 }
 
 bool cHardwareCPU::Inst_PrevExpressionR(cAvidaContext& ctx)
 {
-	return (organism->getUMLModel()->relativeMoveExpressionR(-1));
+	return (organism->getUMLModel()->getPropertyGenerator()->relativeMoveExpressionR(-1));
 }
 
 bool cHardwareCPU::Inst_AbsoluteMoveExpressionR(cAvidaContext& ctx)
 {
 	ReadLabel();
 	int jump_amount = GetLabel().AsInt(NUM_NOPS);
-	return (organism->getUMLModel()->absoluteMoveExpressionR(jump_amount));
+	return (organism->getUMLModel()->getPropertyGenerator()->absoluteMoveExpressionR(jump_amount));
 }
 
 bool cHardwareCPU::Inst_ANDExpressions(cAvidaContext& ctx)
 {	
-	return (organism->getUMLModel()->ANDExpressions());
+	return (organism->getUMLModel()->getPropertyGenerator()->ANDExpressions());
 }
 
 bool cHardwareCPU::Inst_ORExpressions(cAvidaContext& ctx)
 {
-	return (organism->getUMLModel()->ORExpressions());
+	return (organism->getUMLModel()->getPropertyGenerator()->ORExpressions());
 }
   
   
\ No newline at end of file

Modified: branches/uml/source/main/cMDEAbsenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEAbsenceProperty.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEAbsenceProperty.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -9,18 +9,13 @@
 
 #include "cMDEAbsenceProperty.h"
 
-bool cMDEAbsenceProperty::print() {
+void cMDEAbsenceProperty::print() {
 	
-	// Create the file...
-	std::string cmd = "cp " + _promela + " " + _property_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode...
 	std::ofstream outfile;
-	outfile.open (_property_file_name.c_str(), std::ios_base::app);
+//	outfile.open (_name.c_str());
+	outfile.open ("property");
 	assert(outfile.is_open());
 	
-	// Add the absence property to the end of the file...
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* !([](!p)) */" << std::endl;
 	outfile << "T0_init :    /* init */" << std::endl;
@@ -33,19 +28,15 @@
 	outfile << "}" << std::endl;
 	
 	outfile.close();
-	return true;
 
 }
 
-bool cMDEAbsenceProperty::printWitness() {
+void cMDEAbsenceProperty::printWitness() {
 	
-	// Create the file
-	std::string cmd = "cp " + _promela + " " + _witness_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode
 	std::ofstream outfile;
-	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
+//	std::string file_name= "w" + _name;
+	std::string file_name = "witness-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
 	outfile << "/* Absence property " << _expr_p << "*/" << std::endl;
@@ -60,8 +51,9 @@
 	outfile << "skip " << std::endl;
 	outfile << "}" << std::endl;
 	
+
+	
 	outfile.close();
-	return true;
 	
 }
 
@@ -69,8 +61,6 @@
 void cMDEAbsenceProperty::evaluate()
 {
 	float verify_reward = 0;
-	_count =1;
-
 	
 	// print the property
 	print();
@@ -80,24 +70,23 @@
 
 		// if this property passed, then save it to a file
 	if (verify_reward) { 
-//		cmd = "cat english-property >> " + work_prop;
-//		system(cmd.c_str());
-		printInEnglish();
+		cmd = "cat english-property >> " + work_prop;
+		system(cmd.c_str());
 	}
 	
 	_reward = verify_reward;
 }
 
 
-bool cMDEAbsenceProperty::printInEnglish() {
+void cMDEAbsenceProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	outfile.open (_properties.c_str(), std::ios_base::app);
+	std::string file_name = "english-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
 	outfile << "Globally, it is never the case that " << _expr_p  << " holds." << std::endl << std::endl;
 	
 	outfile.close();
-	return true;
 	
 }
\ No newline at end of file

Modified: branches/uml/source/main/cMDEAbsenceProperty.h
===================================================================
--- branches/uml/source/main/cMDEAbsenceProperty.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEAbsenceProperty.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -21,17 +21,11 @@
 class cMDEAbsenceProperty : public cMDEProperty{
 	
 public:
-	cMDEAbsenceProperty(std::string expr, std::string q) { _expr_p = expr; 
-		_name = ("Absence" + q); _reward = -1; 
-		_property_file_name = "tmp-property.pr"; 
-		_witness_file_name = "tmp-witness.pr";
-		_properties = "properties_that_passed";
-		_promela = "tmp.pr";
-	}
+	cMDEAbsenceProperty(std::string expr) { _expr_p = expr;  _reward = -1; }
 	virtual ~cMDEAbsenceProperty() {}
-	bool print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	bool printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	bool printInEnglish();
+	void print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	void printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	void printInEnglish();
 	void evaluate();
 	std::string getPropertyType() { return "Absence"; } 
 	std::string getPropertyParameters() { return _expr_p; }

Modified: branches/uml/source/main/cMDEExistenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEExistenceProperty.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEExistenceProperty.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -9,19 +9,13 @@
 
 #include "cMDEExistenceProperty.h"
 
-/* This function prepares the file tmp-property.pr to be verified. */
-
-bool cMDEExistenceProperty::print() {
-	// Create the file...
-	std::string cmd = "cp " + _promela + " " + _property_file_name;
-	if(system(cmd.c_str())!=0) return false;
+void cMDEExistenceProperty::print() {
 	
-	// Open the file in append mode...
 	std::ofstream outfile;
-	outfile.open (_property_file_name.c_str(), std::ios_base::app);
+//	outfile.open (_name.c_str());
+	outfile.open ("property");
 	assert(outfile.is_open());
 	
-	// Add the existence property to the end of the file...
 	outfile << "/* Existence property " << _expr_p << "*/" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* !(<>(p)) */ " << std::endl;
@@ -30,23 +24,17 @@
 	outfile << ":: (!p) -> goto accept_init " << std::endl;
 	outfile << "fi; }" << std::endl;
 	
-	// close the file...
 	outfile.close();
-	return true;
+
 }
 
-bool cMDEExistenceProperty::printWitness() {
+void cMDEExistenceProperty::printWitness() {
 	
-	// Create the file
-	std::string cmd = "cp " + _promela + " " + _witness_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode
 	std::ofstream outfile;
-	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
+	std::string file_name = "witness-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
-	// Add existence witness
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* !([](!p)) */ " << std::endl;
 	outfile << "T0_init :    /* init */ " << std::endl;
@@ -59,19 +47,18 @@
 
 	
 	outfile.close();
-	return true;
 	
 }
 
-bool cMDEExistenceProperty::printInEnglish() {
+void cMDEExistenceProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	outfile.open (_properties.c_str(), std::ios_base::app);
+	std::string file_name = "english-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
 	outfile << "Globally, " << _expr_p  << " eventually holds." << std::endl<< std::endl;
 	
 	outfile.close();
-	return true;
 	
 }
\ No newline at end of file

Modified: branches/uml/source/main/cMDEExistenceProperty.h
===================================================================
--- branches/uml/source/main/cMDEExistenceProperty.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEExistenceProperty.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -22,19 +22,13 @@
 class cMDEExistenceProperty : public cMDEProperty{
 	
 public:
-	cMDEExistenceProperty(std::string expr, std::string q) { _expr_p = expr; 
-		_name = ("Existence" + q); _reward = -1;
-		_property_file_name = "tmp-property.pr"; 
-		_witness_file_name = "tmp-witness.pr";
-		_properties = "properties_that_passed";
-		_promela = "tmp.pr";
-	}
+	cMDEExistenceProperty(std::string expr) { _expr_p = expr; _reward = -1;}
 	
 	virtual ~cMDEExistenceProperty() {}
 
-	bool print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	bool printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	bool printInEnglish();
+	void print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	void printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	void printInEnglish();
 	std::string getPropertyType() { return "Existence"; } 
 	std::string getPropertyParameters() { return _expr_p; }
 

Modified: branches/uml/source/main/cMDEExpression.h
===================================================================
--- branches/uml/source/main/cMDEExpression.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEExpression.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -11,6 +11,7 @@
 #include <string>
 #include <iostream>
 #include <cassert>
+#include <set>
 
 
 
@@ -21,17 +22,29 @@
 	std::string getExpr() const { return _expr; }
 	void setExpr(std::string s) { _expr = s; }
 	bool operator==(const cMDEExpression that) {
-//		std::cout << _expr << " " << that.getExpr() << std::endl;
 		return (_expr == that.getExpr());
 	}
+	
+	// the related classes are the classes that this expression may be 
+	// related to.
 	void addRelatedClass(std::string c) { _related_classes.insert(c); }
-	void setRelatedClasses(std::set<std::string> s) { _related_classes = s; }
+	void setRelatedClasses(std::set<std::string> s) { _related_classes = s; }	
 	std::set<std::string> getRelatedClasses() { return _related_classes; }
+	bool isRelatedClass(std::string c) { 
+		return false;// find(_related_classes.begin(), _related_classes.end(), c)
+	}
 
+	// the classes are the classes involved in the expression
+	void addClass(std::string c) {_class_names.insert(c); }
+	bool isClass(std::string c) { 
+		return false; //find(_class_names.begin(), _class_names.end(), c)
+	}
+
 		
 protected:
 	std::string _expr;
 	std::set<std::string> _related_classes;
+	std::set<std::string> _class_names;
 	// Ok, eventually, to do more complex expression creation, we need to get it to check the types...
 	
 //	std::string _types;
@@ -41,18 +54,4 @@
 
 
 
-/*
-struct ltcMDEExpression{ 
-	bool operator() (cMDEExpression* p1, cMDEExpression* p2) const
-	{
-		std::string name1, name2;
-		
-		name1 = p1->getExpr();
-		name2 = p2->getExpr(); 
-		// 1st less than 2nd & 2nd never equal to the first. 
-		
-		return (name1 < name2);
-	}
-};
-*/
 #endif

Modified: branches/uml/source/main/cMDEPrecedenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEPrecedenceProperty.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEPrecedenceProperty.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -9,19 +9,12 @@
 
 #include "cMDEPrecedenceProperty.h"
 
-bool cMDEPrecedenceProperty::print() {
+void cMDEPrecedenceProperty::print() {
 	
-	// Create the file...
-	std::string cmd = "cp " + _promela + " " + _property_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode...
 	std::ofstream outfile;
-	outfile.open (_property_file_name.c_str(), std::ios_base::app);
+	outfile.open ("property");
 	assert(outfile.is_open());
 	
-	
-	// Add the precedence property to the end of the file...
 	outfile << "/* Precedence property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define s (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -52,22 +45,16 @@
 	outfile << "skip }" << std::endl;
 	
 	outfile.close();
-	return true;
 
 }
 
-bool cMDEPrecedenceProperty::printWitness() {
+void cMDEPrecedenceProperty::printWitness() {
 	
-	// Create the file
-	std::string cmd = "cp " + _promela + " " + _witness_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode
 	std::ofstream outfile;
-	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
+	std::string file_name = "witness-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
-	// Add precedence property witness to the end of the file....
 	outfile << "/* Precedence property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define q (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -87,21 +74,20 @@
     outfile << "skip }" << std::endl;
 
 	outfile.close();
-	return true;
 	
 }
 
-bool cMDEPrecedenceProperty::printInEnglish() {
+void cMDEPrecedenceProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	outfile.open (_properties.c_str(), std::ios_base::app);
+	std::string file_name = "english-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
 	outfile << "Globally, it is always the case that if " << _expr_p  << " holds, ";
 	outfile << "then "<< _expr_q << " previously held." << std::endl << std::endl;
 	
 	outfile.close();
-	return true;
 	
 }
 

Modified: branches/uml/source/main/cMDEPrecedenceProperty.h
===================================================================
--- branches/uml/source/main/cMDEPrecedenceProperty.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEPrecedenceProperty.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -22,21 +22,17 @@
 class cMDEPrecedenceProperty : public cMDEProperty{
 	
 public:
-	cMDEPrecedenceProperty(std::string p, std::string q, std::string r) { 
+	cMDEPrecedenceProperty(std::string p, std::string q) { 
 		_expr_p = p;
 		_expr_q = q;
-		_name = ("Precedence" + r); _reward = -1;
-		_property_file_name = "tmp-property.pr"; 
-		_witness_file_name = "tmp-witness.pr";
-		_properties = "properties_that_passed";
-		_promela = "tmp.pr";
+		_reward = -1;
 	}
 	
 	virtual ~cMDEPrecedenceProperty() {}
 
-	bool print(); 
-	bool printWitness(); 
-	bool printInEnglish();
+	void print(); 
+	void printWitness(); 
+	void printInEnglish();
 	std::string getPropertyType() { return "Precedence"; } 
 	std::string getPropertyParameters() { return (_expr_p + " " + _expr_q); }
 

Modified: branches/uml/source/main/cMDEProperty.cc
===================================================================
--- branches/uml/source/main/cMDEProperty.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEProperty.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -19,17 +19,18 @@
 #include <errno.h>
 
 float cMDEProperty::numWitnesses() {
-/*	
+	
+//	std::string file_name = "tmp-witness" + _name + ".pr";
 	std::string file_name = "tmp-witness.pr";
 	std::string cmd = "cp tmp.pr "+ file_name;
-	if(system(cmd.c_str())!=0) return 0.0;*/
+	int num_witness = 0;
 	
-///	std::string file_name = "tmp-witness.pr";
-	int num_witness = 0;
-
-	std::string cmd = "./spin -a " +  _witness_file_name + " &> /dev/null";
 	if(system(cmd.c_str())!=0) return 0.0;
 	
+//	cmd = "cat w" + _name + " >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
+	cmd = "cat witness-property >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
+	if(system(cmd.c_str())!=0) return 0.0;
+	
 	if(system("/usr/bin/gcc -DMEMLIM=512 pan.c -o pan &> /dev/null")!=0) return 0.0;
 	if(system("./pan -e -n -a -w19  -m100000 -c1 &> ./pan.out")!=0) return 0.0;
 	num_witness = (system("cat pan.out | perl -e 'while(<STDIN>) { if(/errors:\\s(\\d+)/) {exit($1);}}'"));
@@ -42,11 +43,14 @@
 
 
 float cMDEProperty::verify() { 
-
-//	std::string file_name = "tmp-property.pr";
-	std::string cmd;
+//	std::string file_name = "tmp-" + _name + ".pr";
+	std::string file_name = "tmp-property.pr";
+	std::string cmd = "cp tmp.pr "+ file_name;
+	if(system(cmd.c_str())!=0) return 0.0;
 	
-	cmd = "./spin -a " +  _property_file_name + " &> /dev/null";
+	
+//	cmd = "cat " + _name + " >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
+	cmd = "cat property >> " + file_name + " && ./spin -a " +  file_name + " &> /dev/null";
 	if(system(cmd.c_str())!=0) return 0.0;
 	
 	if(system("/usr/bin/gcc -DMEMLIM=512 pan.c -o pan &> /dev/null")!=0) return 0.0;
@@ -62,12 +66,10 @@
 	float verify_reward = 0;
 	std::string cmd;
 	std::string work_prop = "properties_that_passed";
-	_count =1;
 
 	
 	// print the witness property
 	printWitness();
-	
 	// call numWitnesses
 	wit_reward = numWitnesses();
 	
@@ -81,8 +83,9 @@
 	// if this property passed, then save it to a file
 	if (verify_reward) { 
 		printInEnglish();
-//		cmd = "cat english-property >> " + work_prop;
-//		system(cmd.c_str());
+//		cmd = "cat " + _name + " >> " + work_prop;
+		cmd = "cat english-property >> " + work_prop;
+		system(cmd.c_str());
 	}
 	
 //	_reward = wit_reward + verify_reward;

Modified: branches/uml/source/main/cMDEProperty.h
===================================================================
--- branches/uml/source/main/cMDEProperty.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEProperty.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -11,23 +11,17 @@
 #include <string>
 #include <iostream>
 #include <cassert>
-#include<fstream>
 
 
 
 class cMDEProperty{
 	
 public:
-	virtual ~cMDEProperty() {
-		_property_file_name = "tmp-property.pr"; 
-		_witness_file_name = "tmp-witness.pr";
-		_properties = "properties_that_passed";
-		_promela = "tmp.pr";
-	}
+	virtual ~cMDEProperty() {}
 	// A function that prints the property to a file.
-	virtual bool print() = 0;
-	virtual bool printWitness() = 0;
-	virtual bool printInEnglish() =0;
+	virtual void print() = 0;
+	virtual void printWitness() = 0;
+	virtual void printInEnglish() =0;
 	virtual std::string getPropertyType() = 0;
 	virtual std::string getPropertyParameters() { return ""; } 
 	
@@ -38,21 +32,12 @@
 	float verify();
 	// A function that evaluates a property	
 	virtual void evaluate(); 
-	std::string getMDEPropertyName() { return _name; } 
 	void setEvaluationInformation (float eval) { _reward = eval; }
 	float getEvaluationInformation() { return _reward; }
-	void incCount() { _count++; }
-	int getCount() {return _count; }
 		
 protected:
-	std::string _name;
 	std::string _scope;
 	float _reward;
-	std::string _property_file_name; // = "tmp-property.pr"; 
-	std::string _witness_file_name; // = "tmp-witness.pr";
-	std::string _properties; // = "properties_that_passed";
-	std::string _promela; 
-	int _count; 
 	
 };
 

Modified: branches/uml/source/main/cMDEResponseProperty.cc
===================================================================
--- branches/uml/source/main/cMDEResponseProperty.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEResponseProperty.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -9,19 +9,13 @@
 
 #include "cMDEResponseProperty.h"
 
-bool cMDEResponseProperty::print() {
+void cMDEResponseProperty::print() {
 	
-	// Create the file...
-	std::string cmd = "cp " + _promela + " " + _property_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode...
 	std::ofstream outfile;
-	outfile.open (_property_file_name.c_str(), std::ios_base::app);
+//	outfile.open (_name.c_str());
+	outfile.open ("property");
 	assert(outfile.is_open());
 	
-	
-	// Add the response property to the end of the file...
 	outfile << "/* Response property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define s (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -37,22 +31,16 @@
 	outfile << "fi; }" << std::endl;
 	
 	outfile.close();
-	return true;
 
 }
 
-bool cMDEResponseProperty::printWitness() {
+void cMDEResponseProperty::printWitness() {
 	
-	// Create the file
-	std::string cmd = "cp " + _promela + " " + _witness_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode
 	std::ofstream outfile;
-	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
+	std::string file_name = "witness-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
-	// Add response property to the end of the file...
 	outfile << "/* Response property " << _expr_p  << " " << _expr_q << "*/" << std::endl;
 	outfile << "#define s (" << _expr_q << ")" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -72,21 +60,20 @@
 	outfile << "skip}" << std::endl;
 	
 	outfile.close();
-	return true;
 	
 }
 
 
-bool cMDEResponseProperty::printInEnglish() {
+void cMDEResponseProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	outfile.open (_properties.c_str(), std::ios_base::app);
+	std::string file_name = "english-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
 	outfile << "Globally, it is always the case that if " << _expr_p  << " holds, ";
 	outfile << "then "<< _expr_q << " eventually holds." << std::endl << std::endl;
 	
 	outfile.close();
-	return true;
 	
 }

Modified: branches/uml/source/main/cMDEResponseProperty.h
===================================================================
--- branches/uml/source/main/cMDEResponseProperty.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEResponseProperty.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -22,21 +22,17 @@
 class cMDEResponseProperty : public cMDEProperty{
 	
 public:
-	cMDEResponseProperty(std::string p, std::string q, std::string r) { 
+	cMDEResponseProperty(std::string p, std::string q) { 
 		_expr_p = p;
 		_expr_q = q;
-		_name = ("Response" + r); _reward = -1;
-		_property_file_name = "tmp-property.pr"; 
-		_witness_file_name = "tmp-witness.pr";
-		_properties = "properties_that_passed";
-		_promela = "tmp.pr";
+		_reward = -1;
 	}
 	
 	virtual ~cMDEResponseProperty() {}
 
-	bool print(); 
-	bool printWitness(); 
-	bool printInEnglish();
+	void print(); 
+	void printWitness(); 
+	void printInEnglish();
 	std::string getPropertyType() { return "Response"; } 
 	std::string getPropertyParameters() { return (_expr_p + " " + _expr_q); }
 

Modified: branches/uml/source/main/cMDEUniversalProperty.cc
===================================================================
--- branches/uml/source/main/cMDEUniversalProperty.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEUniversalProperty.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -9,19 +9,13 @@
 
 #include "cMDEUniversalProperty.h"
 
-bool cMDEUniversalProperty::print() {
+void cMDEUniversalProperty::print() {
 	
-	
-	// Create the file...
-	std::string cmd = "cp " + _promela + " " + _property_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode...
 	std::ofstream outfile;
-	outfile.open (_property_file_name.c_str(), std::ios_base::app);
+//	outfile.open (_name.c_str());
+	outfile.open ("property");
 	assert(outfile.is_open());
 	
-	// Add the universal property to the end of the file...
 	outfile << "/* Universal property " << _expr_p << "*/" << std::endl;
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
 	outfile << "never { /* ![]p */" << std::endl;
@@ -35,19 +29,15 @@
 	outfile << "}" << std::endl;
 	
 	outfile.close();
-	return true;
 
 }
 
-bool cMDEUniversalProperty::printWitness() {
+void cMDEUniversalProperty::printWitness() {
 	
-	// Create the file
-	std::string cmd = "cp " + _promela + " " + _witness_file_name;
-	if(system(cmd.c_str())!=0) return false;
-	
-	// Open the file in append mode
 	std::ofstream outfile;
-	outfile.open (_witness_file_name.c_str(), std::ios_base::app);
+//	std::string file_name = "w" + _name;
+	std::string file_name = "witness-property";
+	outfile.open (file_name.c_str());
 	assert(outfile.is_open());
 	
 	outfile << "#define p (" << _expr_p << ")" << std::endl;
@@ -62,7 +52,6 @@
 	outfile << "}" << std::endl;
 	
 	outfile.close();
-	return true;
 	
 }
 
@@ -70,8 +59,6 @@
 void cMDEUniversalProperty::evaluate()
 {
 	float verify_reward = 0;
-	_count =1;
-
 	
 	// print the property
 	print();
@@ -82,9 +69,8 @@
 	// if this property passed, then save it to a file
 	if (verify_reward) { 
 //		cmd = "cat " + _name + " >> " + work_prop;
-//		cmd = "cat english-property >> " + work_prop;
-		printInEnglish();
-//		system(cmd.c_str());
+		cmd = "cat english-property >> " + work_prop;
+		system(cmd.c_str());
 	}
 	
 	_reward = verify_reward;
@@ -92,15 +78,15 @@
 
 
 
-bool cMDEUniversalProperty::printInEnglish() {
+void cMDEUniversalProperty::printInEnglish() {
 	
 	std::ofstream outfile;
-	outfile.open (_properties.c_str(), std::ios_base::app);
-	assert(outfile.is_open());	
+	std::string file_name = "english-property";
+	outfile.open (file_name.c_str());
+	assert(outfile.is_open());
 	
 	outfile << "Globally, it is always the case that " << _expr_p  << " holds." << std::endl << std::endl;
 	
 	outfile.close();
-	return true;
 	
 }
\ No newline at end of file

Modified: branches/uml/source/main/cMDEUniversalProperty.h
===================================================================
--- branches/uml/source/main/cMDEUniversalProperty.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cMDEUniversalProperty.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -21,17 +21,11 @@
 class cMDEUniversalProperty : public cMDEProperty{
 	
 public:
-	cMDEUniversalProperty(std::string expr, std::string q) { _expr_p = expr; 
-		_name = ("Universal" + q); _reward = -1;
-		_property_file_name = "tmp-property.pr"; 
-		_witness_file_name = "tmp-witness.pr";
-		_properties = "properties_that_passed";
-		_promela = "tmp.pr";
-	}
+	cMDEUniversalProperty(std::string expr) { _expr_p = expr; _reward = -1;}
 	virtual ~cMDEUniversalProperty() {}
-	bool print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	bool printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
-	bool printInEnglish();
+	void print(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	void printWitness(); // { std::cout << _scope << " " << _expr_p  << std::endl; }
+	void printInEnglish();
 	void evaluate();
 	std::string getPropertyType() { return "Universal"; } 
 	std::string getPropertyParameters() { return _expr_p; }

Modified: branches/uml/source/main/cOrganism.cc
===================================================================
--- branches/uml/source/main/cOrganism.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cOrganism.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -678,29 +678,29 @@
 	}
 	
 	cUMLModel* pop_model = m_world->GetPopulation().getUMLModel();
-	m_world->GetStats().propSuccess(pop_model->numSuccess());
-	m_world->GetStats().propFailure(pop_model->numFailure());
-	m_world->GetStats().propTotal(pop_model->numTotalProperty());
-	m_world->GetStats().absPropSuccess(pop_model->numAbsencePropertySuccess());
-	m_world->GetStats().absPropFailure(pop_model->numAbsencePropertyFailure());
-	m_world->GetStats().absPropTotal(pop_model->numAbsencePropertyTotal());
-	m_world->GetStats().uniPropSuccess(pop_model->numUniversalPropertySuccess());
-	m_world->GetStats().uniPropFailure(pop_model->numUniversalPropertyFailure());
-	m_world->GetStats().uniPropTotal(pop_model->numUniversalPropertyTotal());
-	m_world->GetStats().existPropSuccess(pop_model->numExistencePropertySuccess());
-	m_world->GetStats().existPropFailure(pop_model->numExistencePropertyFailure());
-	m_world->GetStats().existPropTotal(pop_model->numExistencePropertyTotal());
-	m_world->GetStats().precPropSuccess(pop_model->numPrecedencePropertySuccess());
-	m_world->GetStats().precPropFailure(pop_model->numPrecedencePropertyFailure());
-	m_world->GetStats().precPropTotal(pop_model->numPrecedencePropertyTotal());
-	m_world->GetStats().respPropSuccess(pop_model->numResponsePropertySuccess());
-	m_world->GetStats().respPropFailure(pop_model->numResponsePropertyFailure());
-	m_world->GetStats().respPropTotal(pop_model->numResponsePropertyTotal());	
+	m_world->GetStats().propSuccess(pop_model->getPropertyGenerator()->numSuccess());
+	m_world->GetStats().propFailure(pop_model->getPropertyGenerator()->numFailure());
+	m_world->GetStats().propTotal(pop_model->getPropertyGenerator()->numTotalProperty());
+	m_world->GetStats().absPropSuccess(pop_model->getPropertyGenerator()->numAbsencePropertySuccess());
+	m_world->GetStats().absPropFailure(pop_model->getPropertyGenerator()->numAbsencePropertyFailure());
+	m_world->GetStats().absPropTotal(pop_model->getPropertyGenerator()->numAbsencePropertyTotal());
+	m_world->GetStats().uniPropSuccess(pop_model->getPropertyGenerator()->numUniversalPropertySuccess());
+	m_world->GetStats().uniPropFailure(pop_model->getPropertyGenerator()->numUniversalPropertyFailure());
+	m_world->GetStats().uniPropTotal(pop_model->getPropertyGenerator()->numUniversalPropertyTotal());
+	m_world->GetStats().existPropSuccess(pop_model->getPropertyGenerator()->numExistencePropertySuccess());
+	m_world->GetStats().existPropFailure(pop_model->getPropertyGenerator()->numExistencePropertyFailure());
+	m_world->GetStats().existPropTotal(pop_model->getPropertyGenerator()->numExistencePropertyTotal());
+	m_world->GetStats().precPropSuccess(pop_model->getPropertyGenerator()->numPrecedencePropertySuccess());
+	m_world->GetStats().precPropFailure(pop_model->getPropertyGenerator()->numPrecedencePropertyFailure());
+	m_world->GetStats().precPropTotal(pop_model->getPropertyGenerator()->numPrecedencePropertyTotal());
+	m_world->GetStats().respPropSuccess(pop_model->getPropertyGenerator()->numResponsePropertySuccess());
+	m_world->GetStats().respPropFailure(pop_model->getPropertyGenerator()->numResponsePropertyFailure());
+	m_world->GetStats().respPropTotal(pop_model->getPropertyGenerator()->numResponsePropertyTotal());	
 //	int x = pop_model->propertySize();
 //	int y = pop_model->numTotalProperty();
 	
 		
-	m_model.resetPropertyReward();
+	m_model.getPropertyGenerator()->resetPropertyReward();
 	
 
 	

Modified: branches/uml/source/main/cTaskLib.cc
===================================================================
--- branches/uml/source/main/cTaskLib.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cTaskLib.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -2967,7 +2967,7 @@
 	//cPopulation* pop = (&m_world->GetPopulation());
 	
 	// call some sort of check properties function for the model.
-	bonus =  org->getUMLModel()->getPropertyReward();
+	bonus =  org->getUMLModel()->getPropertyGenerator()->getPropertyReward();
 	//pop->getUMLModel()->checkProperties();
 	//m_world->GetStats().propSuccess(pop->getUMLModel()->numSuccess());
 	//m_world->GetStats().propFailure(pop->getUMLModel()->numFailure());

Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cUMLModel.cc	2008-02-22 18:03:03 UTC (rev 2360)
@@ -177,36 +177,16 @@
   scenarios = _cfg_scenarios;
   hydraMode = _cfg_hydra_mode; 
   witnessMode = _cfg_witness_mode;
-  expression_p = 0;
-  expression_q = 0;
-  expression_r = 0;
+  
+  // Initialize the property generator.
+  gen = new cMDEPropertyGenerator();
   createExpressionsFromClasses();
-  m_property_reward = 0;
-  m_property_success =0;
-  m_property_failure =0;
-  m_absence_property_success =0;
-  m_absence_property_failure =0;
-  m_existence_property_success =0;
-  m_existence_property_failure =0;
-  m_universal_property_success =0;
-  m_universal_property_failure =0;
-  m_precedence_property_success =0;
-  m_precedence_property_failure =0;
-  m_response_property_success =0;
-  m_response_property_failure =0;
 }
 
 
 cUMLModel::~cUMLModel()
 {
-	for( std::set<cMDEProperty*, ltcMDEProperty>::iterator it = mdeprops.begin(),
-		e = mdeprops.end(); it != e; )
-	{
-		cMDEProperty *p = *it;
-		mdeprops.erase(it++);
-		delete p;
-	}
-
+	delete gen;
 }
 
 float cUMLModel::getBonusInfo (std::string s)  
@@ -439,104 +419,9 @@
 }*/
 
 
-float cUMLModel::addExistenceProperty(std::string s)
-{
-	// a pointer to the existence property
-	std::string temp = StringifyAnInt(mdeprops.size());
-	float val = 0;
-	//cMDEExistenceProperty* e = new cMDEExistenceProperty(s, temp);
-	
-	cMDEExistenceProperty e(s, temp);
-	
-	// first, try to find the property
-	//
-	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
-	if (mdepropiter != mdeprops.end()) {
-		val = (*mdepropiter)->getEvaluationInformation();
-		e.incCount();
-	} else {
-		e.evaluate();
-		val = e.getEvaluationInformation();
-		mdeprops.insert(new cMDEExistenceProperty(e));
-		if (val >0) {
-			m_property_success++;
-			m_existence_property_success++;
-		} else { 
-			m_property_failure++;
-			m_existence_property_failure++;
-		}
-	}
-	
-	val = (val / e.getCount()); 
-	return val;
-}
 
-float cUMLModel::addAbsenceProperty(std::string s)
-{
-	// a pointer to the absence property
-	std::string temp = StringifyAnInt(mdeprops.size());
-	float val = 0;
-	//	cMDEAbsenceProperty* e = new cMDEAbsenceProperty(s, temp);
-	cMDEAbsenceProperty e(s, temp);
-	
-	//	mdeprops.insert (e);
-	//int q = mdeprops.size();
-	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
-	if (mdepropiter != mdeprops.end()) {
-		val = (*mdepropiter)->getEvaluationInformation();
-		e.incCount();
-	} else {
-		e.evaluate();
-		val = e.getEvaluationInformation();
-		mdeprops.insert (new cMDEAbsenceProperty(e));
-		if (val >0) {
-			m_property_success++;
-			m_absence_property_success++;
-		} else { 
-			m_property_failure++;
-			m_absence_property_failure++;
-		}
-	}
-	
-	val = (val / e.getCount()); 
-	return val;
-	
-}
 
-float cUMLModel::addUniversalProperty(std::string s)
-{
-	// a pointer to the universal property
-	std::string temp = StringifyAnInt(mdeprops.size());
-	float val = 0;	
-	//	cMDEUniversalProperty* e = new cMDEUniversalProperty(s, temp);
-	cMDEUniversalProperty e(s, temp);
-	
-	//	mdeprops.insert (e);
-	//int q = mdeprops.size();
-	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
-	if (mdepropiter != mdeprops.end()) {
-		val = (*mdepropiter)->getEvaluationInformation();
-		e.incCount();
-	} else {
-		e.evaluate();
-		val = e.getEvaluationInformation();
-		mdeprops.insert (new cMDEUniversalProperty(e));
-		if (val >0) {
-			m_property_success++;
-			m_universal_property_success++;
-		} else { 
-			m_property_failure++;
-			m_universal_property_failure++;
-		}
-	}
-	
-	val = (val / e.getCount()); 
-	return val;
-	
-}
 
-
-
 // Create expressions for each class. Expressions are: 
 //   Equality of an attribute and each of its values
 //   Inequality of an attribute and each of its values
@@ -569,23 +454,23 @@
 					// create both an equality and an inequality expression
 					temp2 = a.attribute_values[k];
 					temp3 = temp1 + "==" + temp2;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 					//std::cout << temp3 << std::endl;
 					temp3 = temp1 + "!=" + temp2;
 					//std::cout << temp3 << std::endl;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 				
 					temp3 = temp1 + ">" + temp2;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 
 					temp3 = temp1 + "<" + temp2;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 				
 					temp3 = temp1 + ">=" + temp2;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 				
 					temp3 = temp1 + "<=" + temp2;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 				
 				}
 			} else if ((at_type == "bool")||(at_type == "boolean")) {
@@ -593,11 +478,11 @@
 					// create both an equality and an inequality expression
 					temp2 = a.attribute_values[k];
 					temp3 = temp1 + "==" + temp2;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 					//std::cout << temp3 << std::endl;
 					temp3 = temp1 + "!=" + temp2;
 					//std::cout << temp3 << std::endl;
-					addExpression(temp3, c.getAssociatedClasses());
+					gen->addExpression(temp3, c.getAssociatedClasses());
 				}
 			}
 		}
@@ -608,7 +493,7 @@
 			o = c.getOperation(m);
 			temp1 = class_name;
 			temp3 = class_name + "_q??[" + o.op_name + "]";
-			addExpression(temp3, c.getAssociatedClasses());
+			gen->addExpression(temp3, c.getAssociatedClasses());
 			//std::cout << temp1 << std::endl;
 		}
 	}
@@ -616,150 +501,3 @@
 
 
 
-// print the label. Change - signs to _
-std::string cUMLModel::StringifyAnInt(int x) { 
-	
-	std::ostringstream o;
-	if (x < 0) {
-		x = abs(x);
-		o << "_";
-	} 
-	o << x;
-	return o.str();
-}
-
-// Check if the expression exists in the vector. If not, add it.
-bool cUMLModel::addExpression(std::string s, std::set<std::string> t)
-{ 
-	bool val = false;
-	cMDEExpression e; 
-	e.setExpr(s);
-	e.setRelatedClasses(t);
-	std::vector<cMDEExpression>::iterator exprit;
-	exprit = find(expressions.begin(), expressions.end(), e); 
-	if (exprit == expressions.end()) { 
-		expressions.push_back(e); 
-		val = true;
-	} 
-	return val;
-}
-
-// AND expressions p & q to create a new expression
-// return true if this is a new expression
-// return false otherwise
-bool cUMLModel::ANDExpressions()
-{
-	bool val = false;
-	std::set<std::string> classes;
-	std::string totalstring;
-	cMDEExpression p, q;
-	
-	if (expression_p != expression_q){
-		p = getP();
-		q = getQ();
-		totalstring = "(" + p.getExpr() + " && " + q.getExpr() + ")";
-
-	//	classes = p.getRelatedClasses();
-	//	classes.insert(q.getRelatedClasses().begin(), q.getRelatedClasses().end());
-		val = addExpression(totalstring, classes); 
-	}
-	return (val);
-}
-
-// OR expressions p & q to create a new expression
-// return true if this is a new expression
-// return false otherwise
-bool cUMLModel::ORExpressions()
-{
-	
-	bool val = false;
-	std::set<std::string> classes;
-	std::string totalstring;
-	cMDEExpression p, q;
-
-	if (expression_p != expression_q){
-		p = getP();
-		q = getQ();
-//		classes = p.getRelatedClasses();
-//		classes.insert(q.getRelatedClasses().begin(), q.getRelatedClasses().end());
-		totalstring = "(" + p.getExpr() + " || " + q.getExpr() + ")";
-		val = addExpression(totalstring, classes); 
-	}
-	return (val);
-}
-
-float cUMLModel::addResponseProperty(std::string s1, std::string s2)
-{
-	// a pointer to the universal property
-	std::string temp = StringifyAnInt(mdeprops.size());
-	float val = 0;	
-	//	cMDEResponseProperty* e = new cMDEResponseProperty(s1, s2, temp);
-	cMDEResponseProperty e(s1, s2, temp);
-	
-	//	mdeprops.insert (e);
-	//int q = mdeprops.size();
-	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
-	if (mdepropiter != mdeprops.end()) {
-		val = (*mdepropiter)->getEvaluationInformation();
-		e.incCount();
-	} else {
-		e.evaluate();
-		val = e.getEvaluationInformation();
-		mdeprops.insert (new cMDEResponseProperty(e));
-		if (val >0) {
-			m_property_success++;
-			m_response_property_success++;
-		} else { 
-			m_property_failure++;
-			m_response_property_failure++;
-		}
-	}
-	
-	val = (val / e.getCount()); 
-	return val;
-}
-
-float cUMLModel::addPrecedenceProperty(std::string s1, std::string s2)
-{
-	// a pointer to the universal property
-	std::string temp = StringifyAnInt(mdeprops.size());
-	float val = 0;	
-	//	cMDEPrecedenceProperty* e = new cMDEPrecedenceProperty(s1, s2, temp);
-	cMDEPrecedenceProperty e(s1, s2, temp);
-	
-	//	mdeprops.insert (e);
-	//int q = mdeprops.size();
-	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
-	if (mdepropiter != mdeprops.end()) {
-		val = (*mdepropiter)->getEvaluationInformation();
-		e.incCount();
-	} else {
-		e.evaluate();
-		val = e.getEvaluationInformation();
-		mdeprops.insert (new cMDEPrecedenceProperty(e));
-		if (val >0) {
-			m_property_success++;
-			m_precedence_property_success++;
-		} else { 
-			m_property_failure++;
-			m_precedence_property_failure++;
-		}
-	}
-	
-	val = (val / e.getCount()); 
-	return val;	
-	
-}
-
-
-	
-void cUMLModel::printExpressions() 
-{
-	std::vector<cMDEExpression>::iterator exprit;
-	for (exprit = expressions.begin(); exprit < expressions.end(); exprit++){
-		std::cout << exprit->getExpr() << std::endl;
-	}
-
-}
-
-

Modified: branches/uml/source/main/cUMLModel.h
===================================================================
--- branches/uml/source/main/cUMLModel.h	2008-02-22 04:16:54 UTC (rev 2359)
+++ branches/uml/source/main/cUMLModel.h	2008-02-22 18:03:03 UTC (rev 2360)
@@ -3,13 +3,7 @@
 
 #include "cUMLClass.h"
 #include "cUMLStateDiagram.h"
-#include "cMDEProperty.h"
-#include "cMDEExistenceProperty.h"
-#include "cMDEAbsenceProperty.h"
-#include "cMDEUniversalProperty.h"
-#include "cMDEResponseProperty.h"
-#include "cMDEPrecedenceProperty.h"
-#include "cMDEExpression.h"
+#include "cMDEPropertyGenerator.h"
 
 #include <string>
 #include <iostream>
@@ -70,47 +64,10 @@
 	int numActions();
 	int numSDs();
 	int numSCs();
-	int numSuccess() { return m_property_success; } 
-	int numFailure() { return m_property_failure; }
-	int numTotalProperty() { return m_property_success + m_property_failure; }
-	int numAbsencePropertySuccess() { return m_absence_property_success; }
-	int numAbsencePropertyFailure() { return m_absence_property_failure; }
-	int numAbsencePropertyTotal() { return m_absence_property_success + m_absence_property_failure; }
-	int numExistencePropertySuccess() { return m_existence_property_success; }
-	int numExistencePropertyFailure() { return m_existence_property_failure; }
-	int numExistencePropertyTotal() { 
-		return m_existence_property_success + m_existence_property_failure; }
-	int numUniversalPropertySuccess() { return m_universal_property_success; }
-	int numUniversalPropertyFailure() { return m_universal_property_failure; }
-	int numUniversalPropertyTotal() { 
-		return m_universal_property_success + m_universal_property_failure; }	
-	int numPrecedencePropertySuccess() { return m_precedence_property_success; }
-	int numPrecedencePropertyFailure() { return m_precedence_property_failure; }
-	int numPrecedencePropertyTotal() { 
-		return m_precedence_property_success + m_precedence_property_failure; }	
-	int numResponsePropertySuccess() { return m_response_property_success; }
-	int numResponsePropertyFailure() { return m_response_property_failure; }
-	int numResponsePropertyTotal() { return m_response_property_success + m_response_property_failure; }	
-	
-	int propertySize() { return mdeprops.size(); }
-	
-	void resetPropertyReward() { m_property_reward = 0; }
-	void addPropertyReward(float x) { m_property_reward += x; }
-	float getPropertyReward() { return m_property_reward; }
-	
-	
-	
-	// Properties
-	float addExistenceProperty(std::string);
-	float addAbsenceProperty(std::string);
-	float addUniversalProperty(std::string);
-	float addResponseProperty(std::string, std::string);
-	float addPrecedenceProperty(std::string, std::string);
-
-	bool addExpression(std::string, std::set<std::string>);  
+	cMDEPropertyGenerator* getPropertyGenerator() { return gen; }
 	void createExpressionsFromClasses();
-	void printExpressions();
-	std::string StringifyAnInt(int);
+
+
 	template <typename T>
 		bool absoluteMoveIndex (T x, int &y, int z)
 	{
@@ -145,22 +102,7 @@
 			}	
 			return true;
 	}	
-	cMDEExpression getP() { return expressions[expression_p]; } 
-	cMDEExpression getQ() { return (expressions[expression_q]);  }
-	cMDEExpression getR() { return (expressions[expression_r]); }
-	std::string getPstring() { return (expressions[expression_p]).getExpr(); } 
-	std::string getQstring() { return (expressions[expression_q]).getExpr();  }
-	std::string getRstring() { return (expressions[expression_r]).getExpr(); }
-	bool relativeMoveExpressionP(int x) { return relativeMoveIndex(expressions, expression_p, x); }
-	bool absoluteMoveExpressionP(int x) { return absoluteMoveIndex(expressions, expression_p, x); }
-	bool relativeMoveExpressionQ(int x) { return relativeMoveIndex(expressions, expression_q, x); }
-	bool absoluteMoveExpressionQ(int x) { return absoluteMoveIndex(expressions, expression_q, x); }
-	bool relativeMoveExpressionR(int x) { return relativeMoveIndex(expressions, expression_r, x); }
-	bool absoluteMoveExpressionR(int x) { return absoluteMoveIndex(expressions, expression_r, x); }
-	
-	bool ANDExpressions();
-	bool ORExpressions();
-	
+
 	// check if the model is ready for hydra
 	bool readyForHydra(); 
 	bool getWitnessMode() {return witnessMode; }
@@ -178,31 +120,7 @@
 	std::vector<double> scenario_completion;
 	int hydraMode; 
 	bool witnessMode;
-	int expression_p;
-	int expression_q;
-	int expression_r;
 	
-	// set of properties.
-	std::set<cMDEProperty*, ltcMDEProperty> mdeprops;
-	int m_property_success;
-	int m_property_failure;
-	int m_absence_property_success;
-	int m_absence_property_failure;
-	int m_existence_property_success;
-	int m_existence_property_failure;
-	int m_universal_property_success;
-	int m_universal_property_failure;
-	int m_precedence_property_success;
-	int m_precedence_property_failure;
-	int m_response_property_success;
-	int m_response_property_failure;
-	float m_property_reward;
-	
-
-	// vector of expressions
-	std::vector<cMDEExpression> expressions;
-	
-	
   // The following are set once per Avida experiment, when the first cUMLModel is constructed:
   static bool _cfgLoaded; //!< Whether or not we've already loaded seed-model.cfg.
   static std::vector<cUMLStateDiagram> _cfg_state_diagrams; //!< State diagrams as read from seed-model.cfg.
@@ -211,6 +129,8 @@
   static std::vector<scenario_info> _cfg_scenarios; //!< Scenarios as read from seed-model.cfg.
   static int _cfg_hydra_mode; //!< Execution mode for hydra, as read from seed-model.cfg.
   static bool _cfg_witness_mode; //!< Execution mode for hydra, as read from seed-model.cfg.
+  
+  cMDEPropertyGenerator* gen; 
 
 };
 




More information about the Avida-cvs mailing list