[Avida-SVN] r2457 - in branches/uml/source: cpu main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Fri Mar 14 10:16:18 PDT 2008


Author: hjg
Date: 2008-03-14 13:16:18 -0400 (Fri, 14 Mar 2008)
New Revision: 2457

Modified:
   branches/uml/source/cpu/cHardwareCPU.cc
   branches/uml/source/main/cMDEAbsenceProperty.cc
   branches/uml/source/main/cMDECompoundExpression.h
   branches/uml/source/main/cMDEExistenceProperty.cc
   branches/uml/source/main/cMDEExpression.h
   branches/uml/source/main/cMDEPrecedenceProperty.cc
   branches/uml/source/main/cMDEProperty.h
   branches/uml/source/main/cMDEPropertyGenerator.cc
   branches/uml/source/main/cMDEPropertyGenerator.h
   branches/uml/source/main/cMDEResponseProperty.cc
   branches/uml/source/main/cMDESimpleAttAttExpression.h
   branches/uml/source/main/cMDESimpleAttValExpression.h
   branches/uml/source/main/cMDEUniversalProperty.cc
   branches/uml/source/main/cOrganism.cc
   branches/uml/source/main/cStats.cc
   branches/uml/source/main/cStats.h
   branches/uml/source/main/cUMLModel.cc
Log:
added support for redundancy checking for exist, uni, and abs.

Modified: branches/uml/source/cpu/cHardwareCPU.cc
===================================================================
--- branches/uml/source/cpu/cHardwareCPU.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/cpu/cHardwareCPU.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -5110,14 +5110,15 @@
 	cMDEPropertyGenerator* pg = organism->getUMLModel()->getPropertyGenerator();
 	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().getUMLModel()->getPropertyGenerator();
 	
-	std::string s = pg->getPstring();
+	/*std::string s = pg->getPstring();
 	float intp = pg->getPInterest();
 	bool related = pg->getP()->getUsesRelatedClasses();
 	
 	if (s != "<null>" ) {
 		val = pop_pg->addAbsenceProperty(s, intp, related);
-	}
+	}*/
 	
+	val = pop_pg->addAbsenceProperty(pg->getP());
 	pg->addPropertyReward(val);
 
 	return val;
@@ -5131,15 +5132,16 @@
 	cMDEPropertyGenerator* pg = organism->getUMLModel()->getPropertyGenerator();
 	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().getUMLModel()->getPropertyGenerator();
 	
-	std::string s = pg->getPstring();
+	/*std::string s = pg->getPstring();
 	float intp = pg->getPInterest();
 	bool related = pg->getP()->getUsesRelatedClasses();
 	
 	if (s != "<null>" ) {
 
 		val = pop_pg->addUniversalProperty(s, intp, related);
-	}
+	}*/
 	
+	val = pop_pg->addUniversalProperty(pg->getP());
 	pg->addPropertyReward(val);
 
 	return val;
@@ -5153,14 +5155,15 @@
 	cMDEPropertyGenerator* pg = organism->getUMLModel()->getPropertyGenerator();
 	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().getUMLModel()->getPropertyGenerator();
 	
-	std::string s = pg->getPstring();
+	/*std::string s = pg->getPstring();
 	float intp = pg->getPInterest();
 	bool related = pg->getP()->getUsesRelatedClasses();
 	
 	if (s != "<null>" ) {
 		val = pop_pg->addExistenceProperty(s, intp, related);
-	}
+	}*/
 	
+	val = pop_pg->addExistenceProperty(pg->getP());
 	pg->addPropertyReward(val);
 		
 	return val;
@@ -5172,17 +5175,20 @@
 	cMDEPropertyGenerator* pg = organism->getUMLModel()->getPropertyGenerator();
 	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().getUMLModel()->getPropertyGenerator();
 	
-	std::string p = pg->getPstring();
+	/*std::string p = pg->getPstring();
 	std::string q = pg->getQstring();
 	float intp = pg->getPInterest();
 	float intq = pg->getQInterest();
 	float inttotal = intp + intq;
 	bool related = pg->areExpressionsRelated(pg->getP(), pg->getQ());
+	bool dependent = pg->areExpressionsAtsOpsDependent(pg->getP(), pg->getQ());
 	
-	if (p != q) {
+	// Check that the two expressions are not the same and that they are not dependent.
+	if ((p != q) && (!dependent)) {
 		val = pop_pg->addPrecedenceProperty(p, q, inttotal, related);
-	}
+	}*/
 	
+	val = pop_pg->addPrecedenceProperty(pg->getP(), pg->getQ());
 	pg->addPropertyReward(val);
 	
 	return val;
@@ -5194,18 +5200,19 @@
 	cMDEPropertyGenerator* pg = organism->getUMLModel()->getPropertyGenerator();
 	cMDEPropertyGenerator* pop_pg = m_world->GetPopulation().getUMLModel()->getPropertyGenerator();
 	
-	std::string p = pg->getPstring();
+/*	std::string p = pg->getPstring();
 	std::string q = pg->getQstring();
 	float intp = pg->getPInterest();
 	float intq = pg->getQInterest();
 	float inttotal = intp + intq;
 	bool related = pg->areExpressionsRelated(pg->getP(), pg->getQ());
+	bool dependent = pg->areExpressionsAtsOpsDependent(pg->getP(), pg->getQ());
 	
-	
-	if (p != q) {
+	if ((p != q) && (!dependent)) {
 		val = pop_pg->addResponseProperty(p, q, inttotal, related);
 	}
-	
+	*/
+	val = pop_pg->addResponseProperty(pg->getP(), pg->getQ());
 	pg->addPropertyReward(val);
 	
 	return val;

Modified: branches/uml/source/main/cMDEAbsenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEAbsenceProperty.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEAbsenceProperty.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -97,6 +97,7 @@
 	if (_uses_related_classes) {
 		outfile << "true" << ", ";
 	} else { outfile << "false" << ", "; }
+	outfile << "Absence, ";
 	outfile << "Globally, it is never the case that " << _expr_p  << " holds.     "; 
 	outfile << std::endl << std::endl;
 	

Modified: branches/uml/source/main/cMDECompoundExpression.h
===================================================================
--- branches/uml/source/main/cMDECompoundExpression.h	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDECompoundExpression.h	2008-03-14 17:16:18 UTC (rev 2457)
@@ -24,6 +24,7 @@
 		_exp_2 = e2;
 		// Op must be either && or ||
 		_exp_op = op;
+		_compound = true;
 		_expr = getInPromela();
 	}
 // 	~cMDECompoundExpression() {}
@@ -40,6 +41,10 @@
 		s = s + _exp_2->getInPromela() + ")";
 		return (s);}
 	
+	std::string getOp() { return _exp_op; }
+	cMDEExpression* getLeft() { return _exp_1; }
+	cMDEExpression* getRight() { return _exp_2; }
+	
 	// This function is used to see if an expression uses a given attribute
 	bool usesAttribute(std::string s) { 
 		return (_exp_1->usesAttribute(s) || _exp_2->usesAttribute(s)); }
@@ -62,7 +67,7 @@
 		return (num + _exp_1->numANDs() + _exp_2->numANDs());
 	}
 
-	void interestingExpressionEval() { 
+	void interestingStrongANDExpressionEval() { 
 		// Currently, the interesting reward is evaluated based on: 
 		// - whether it includes one of the significant variables/operations
 		float temp =0;
@@ -81,6 +86,26 @@
 		
 	}
 	
+	void interestingWeakANDExpressionEval() {
+			// Currently, the interesting reward is evaluated based on: 
+		// - whether it includes one of the significant variables/operations
+		float temp =0;
+		
+		// Check to see if the expressions use suspend or restart operations
+		temp += _exp_1->usesOperation("suspend") + _exp_1->usesOperation("restart");
+		temp += _exp_2->usesOperation("suspend") + _exp_2->usesOperation("restart");
+		
+		// Increase interesting based on the number of ORs
+		temp += _exp_1->numORs() + _exp_2->numORs();
+		
+		// Decrease interesting based on the number of ANDs
+		temp = temp - ((_exp_1->numANDs())/2) - ((_exp_2->numANDs())/2);
+		
+		_interesting = temp;
+
+	
+	}
+	
 	//std::set<std::string> getRelatedClasses() { return _related_classes; }
 	
 		

Modified: branches/uml/source/main/cMDEExistenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEExistenceProperty.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEExistenceProperty.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -71,6 +71,7 @@
 	if (_uses_related_classes) {
 		outfile << "true" << ", ";
 	} else { outfile << "false" << ", "; }
+	outfile << "Existence, ";
 	outfile << "Globally, " << _expr_p  << " eventually holds." << std::endl<< std::endl;
 	
 	outfile.close();

Modified: branches/uml/source/main/cMDEExpression.h
===================================================================
--- branches/uml/source/main/cMDEExpression.h	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEExpression.h	2008-03-14 17:16:18 UTC (rev 2457)
@@ -44,7 +44,8 @@
 	// This function calculates the number of ORs used by a given expression
 	virtual int numORs() { return 0; }
 	
-	virtual void interestingExpressionEval() { _interesting = 0; }
+	virtual void interestingStrongANDExpressionEval() { _interesting = 0; }
+	virtual void interestingWeakANDExpressionEval() { _interesting = 0; }
 	virtual float getInterestingExpressionEval() { return _interesting; } 
 	
 	// the related classes are the classes that this expression may be 
@@ -66,10 +67,16 @@
 	
 	bool getUsesRelatedClasses() { return _uses_related_classes; } 
 	void setUsesRelatedClasses(bool t) { _uses_related_classes = t; }
+	
+	bool getCompound() { return _compound; }
+	virtual std::string getOp() { return ""; }
+	virtual cMDEExpression* getLeft() { return 0; }
+	virtual cMDEExpression* getRight() { return 0; }
 		
 protected:
 	std::string _expr;
 	float _interesting;
+	bool _compound; 
 	std::set<std::string> _related_class_names;
 	std::set<std::string> _used_class_names;
 	std::set<std::string> _at_op_names;

Modified: branches/uml/source/main/cMDEPrecedenceProperty.cc
===================================================================
--- branches/uml/source/main/cMDEPrecedenceProperty.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEPrecedenceProperty.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -96,6 +96,7 @@
 	if (_uses_related_classes) {
 		outfile << "true" << ", ";
 	} else { outfile << "false" << ", "; }
+	outfile << "Precedence, ";
 	outfile << "Globally, it is always the case that if " << _expr_p  << " holds, ";
 	outfile << "then "<< _expr_q << " previously held.     "; 
 	outfile << std::endl << std::endl;

Modified: branches/uml/source/main/cMDEProperty.h
===================================================================
--- branches/uml/source/main/cMDEProperty.h	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEProperty.h	2008-03-14 17:16:18 UTC (rev 2457)
@@ -40,6 +40,9 @@
 	void setInterestingProperty(float inter) {_interesting = inter; }
 	float getInteresting() { return _interesting; }
 	
+	// True means the property's value was determined without checking it.
+	void setSuppressed(bool s) { _suppressed = s; }
+	
 	// These functions get and set whether the expressions used by the property
 	// involve classes that are (or are not) related to one another. 
 	// This information is calculated and set by the property generator class.
@@ -52,6 +55,7 @@
 	float _reward;
 	float _interesting;
 	bool _uses_related_classes;
+	bool _suppressed;
 	
 	// Name of the output filesw:
 	std::string _property_file_name; // = "tmp-property.pr"; 

Modified: branches/uml/source/main/cMDEPropertyGenerator.cc
===================================================================
--- branches/uml/source/main/cMDEPropertyGenerator.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEPropertyGenerator.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -27,6 +27,7 @@
   m_precedence_property_failure =0;
   m_response_property_success =0;
   m_response_property_failure =0;
+  m_suppressed = 0;
   m_related_class_mode = rcm; 
 }
 
@@ -50,26 +51,76 @@
 }
 
 
-float cMDEPropertyGenerator::addExistenceProperty(std::string s, float i, bool related)
+float cMDEPropertyGenerator::addExistenceProperty(cMDEExpression* expr)
 {
-	// a pointer to the existence property
+
 	float val = 0;	
-	float interesting = i + 1; // 1 point for an existence property.
+	float interesting = 1; // 1 point for an existence property.
+	bool related;
+	bool left = false;
+	bool right = false;
 	
-	cMDEExistenceProperty e(s);
+	// get the string representation of the expression.
+	cMDEExistenceProperty e(expr->getExpr());
 	
+	// exit if expression is null. (Should never be the case)
+	if (expr->getExpr() == "<null>") return val;
 	
-	// first, try to find the property
+	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdeiterleft, mdeiterright;
+	// if an OR compound, compute the left & right pieces of the OR. 
+	if (expr->getCompound()) { 
+		if (expr->getOp() == "||") { 
+			cMDEExistenceProperty e_left(expr->getLeft()->getExpr()); 
+			cMDEExistenceProperty e_right(expr->getRight()->getExpr()); 
+			
+			mdeiterleft = mdeprops.find(&e_left);
+			mdeiterright = mdeprops.find(&e_right);
+		
+			if (mdeiterleft != mdeprops.end()) {
+				left = ((*mdeiterleft)->getEvaluationInformation());
+			}
+			if (mdeiterright != mdeprops.end()) {
+				right = ((*mdeiterright)->getEvaluationInformation());
+			}
+
+		}
+	}
+	
+	// first, try to find the property & check for redundancy....
 	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
+	
 	if (mdepropiter != mdeprops.end()) {
 		val = (*mdepropiter)->getEvaluationInformation();
 		val += (*mdepropiter)->getInteresting();
 	} else {
+		// add in how interesting the expression is. Use the STRONG and form. 
+		expr->interestingStrongANDExpressionEval(); 
+		interesting += expr->getInterestingExpressionEval();
+			
+		// determine if they are related
+		related = expr->getUsesRelatedClasses();
 		e.setInterestingProperty(interesting);
 		e.setUsesRelatedClasses(related);
-		e.evaluate();
-		val = e.getEvaluationInformation();
+
+		if (left) { 
+//			std::cout << "LEFT" << std::endl;
+			// the left expression is the stronger form of this expression... 
+			val = (*mdeiterleft)->getEvaluationInformation();
+			e.setSuppressed(true);
+			m_suppressed++;
+		} else if (right) {
+//			std::cout << "RIGHT" << std::endl;
+			// the left expression is the stronger form of this expression... 
+			val = (*mdeiterright)->getEvaluationInformation();
+			e.setSuppressed(true);
+			m_suppressed++;
+		} else {
+			e.evaluate();
+			val = e.getEvaluationInformation();
+			e.setSuppressed(false);
+		}
 		mdeprops.insert(new cMDEExistenceProperty(e));
+//		std::cout << "val: " << val << std::endl;
 		if (val >0) {
 			m_property_success++;
 			m_existence_property_success++;
@@ -86,22 +137,78 @@
 	return val;
 }
 
-float cMDEPropertyGenerator::addAbsenceProperty(std::string s, float i, bool related)
+
+
+float cMDEPropertyGenerator::addAbsenceProperty(cMDEExpression* expr)
 {
 	// a pointer to the absence property
 	float val = 0;
-	float interesting = i + 3; // 3 points for an absence property.
+	float interesting = 3; // 3 points for an absence property.
+	bool related;	
+	bool left = false;
+	bool right = false;
 
-	cMDEAbsenceProperty e(s);
+
+	// get the string representation of the expression.
+	cMDEAbsenceProperty e(expr->getExpr());
 	
+	// exit if expression is null. (Should never be the case)
+	if (expr->getExpr() == "<null>") return val;
+	
+	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdeiterleft, mdeiterright;
+	// if an AND compound, compute the left & right pieces of the OR. 
+	if (expr->getCompound()) { 
+		if (expr->getOp() == "&&") { 
+			cMDEExistenceProperty e_left(expr->getLeft()->getExpr()); 
+			cMDEExistenceProperty e_right(expr->getRight()->getExpr()); 
+			
+			mdeiterleft = mdeprops.find(&e_left);
+			mdeiterright = mdeprops.find(&e_right);
+		
+			if (mdeiterleft != mdeprops.end()) {
+				left = ((*mdeiterleft)->getEvaluationInformation());
+			}
+			if (mdeiterright != mdeprops.end()) {
+				right = ((*mdeiterright)->getEvaluationInformation());
+			}
+
+		}
+	}
+	
+	// first, try to find the property & check for redundancy....
 	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
 	if (mdepropiter != mdeprops.end()) {
 		val = (*mdepropiter)->getEvaluationInformation();
 		val += (*mdepropiter)->getInteresting();
 	} else {
+	
+		// add in how interesting the expression is. Use the WEAK and form. 
+		expr->interestingWeakANDExpressionEval(); 
+		interesting += expr->getInterestingExpressionEval();
+		
+		// determine if they are related
+		related = expr->getUsesRelatedClasses();
+		
 		e.setInterestingProperty(interesting);
-		e.evaluate();
-		val = e.getEvaluationInformation();
+		
+		if (left) { 
+			std::cout << "LEFT" << std::endl;
+			// the left expression is the stronger form of this expression... 
+			val = (*mdeiterleft)->getEvaluationInformation();
+			e.setSuppressed(true);
+			m_suppressed++;
+		} else if (right) {
+//			std::cout << "RIGHT" << std::endl;
+			// the left expression is the stronger form of this expression... 
+			val = (*mdeiterright)->getEvaluationInformation();
+			e.setSuppressed(true);
+			m_suppressed++;
+		} else {
+			e.evaluate();
+			val = e.getEvaluationInformation();
+			e.setSuppressed(false);
+		}
+		
 		mdeprops.insert (new cMDEAbsenceProperty(e));
 		if (val >0) {
 			m_property_success++;
@@ -113,6 +220,7 @@
 		}
 	}
 	
+	
 	if ((m_related_class_mode == 2) && (related == 1)) { val += .5; }
 	if ((m_related_class_mode == 3) && (related == 0)) { val =0; }
 	
@@ -120,22 +228,71 @@
 	
 }
 
-float cMDEPropertyGenerator::addUniversalProperty(std::string s, float i, bool related)
+float cMDEPropertyGenerator::addUniversalProperty(cMDEExpression* expr)
 {
 	// a pointer to the universal property
 	float val = 0;	
-	float interesting = i + 3; // 3 points for a universal property.
-
-	cMDEUniversalProperty e(s);
+	float interesting = 3; // 3 points for a universal property.
+	bool related;
+	bool left = false;
+	bool right = false;
 	
+	cMDEUniversalProperty e(expr->getExpr());
+	// exit if expression is null. (Should never be the case)
+	if (expr->getExpr() == "<null>") return val;
+	
+	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdeiterleft, mdeiterright;
+	// if an OR compound, compute the left & right pieces of the OR. 
+	if (expr->getCompound()) { 
+		if (expr->getOp() == "||") { 
+			cMDEExistenceProperty e_left(expr->getLeft()->getExpr()); 
+			cMDEExistenceProperty e_right(expr->getRight()->getExpr()); 
+			
+			mdeiterleft = mdeprops.find(&e_left);
+			mdeiterright = mdeprops.find(&e_right);
+					
+			if (mdeiterleft != mdeprops.end()) {
+				left = ((*mdeiterleft)->getEvaluationInformation());
+			}
+			if (mdeiterright != mdeprops.end()) {
+				right = ((*mdeiterright)->getEvaluationInformation());
+			}
+		}
+	}
+	
+	
 	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
 	if (mdepropiter != mdeprops.end()) {
 		val = (*mdepropiter)->getEvaluationInformation();
 		val += (*mdepropiter)->getInteresting();
 	} else {
+	
+		// add in how interesting the expression is. Use the STRONG and form. 
+		expr->interestingStrongANDExpressionEval(); 
+		interesting += expr->getInterestingExpressionEval();
 		e.setInterestingProperty(interesting);
-		e.evaluate();
-		val = e.getEvaluationInformation();
+		
+		// determine if they are related
+		related = expr->getUsesRelatedClasses();
+		
+		if (left) { 
+			std::cout << "LEFT" << std::endl;
+			// the left expression is the stronger form of this expression... 
+			val = (*mdeiterleft)->getEvaluationInformation();
+			e.setSuppressed(true);
+			m_suppressed++;
+		} else if (right) {
+			std::cout << "RIGHT" << std::endl;
+			// the left expression is the stronger form of this expression... 
+			val = (*mdeiterright)->getEvaluationInformation();
+			e.setSuppressed(true);
+			m_suppressed++;
+		} else {
+			e.evaluate();
+			val = e.getEvaluationInformation();
+			e.setSuppressed(false);
+		}
+		
 		mdeprops.insert (new cMDEUniversalProperty(e));
 		if (val >0) {
 			m_property_success++;
@@ -155,22 +312,31 @@
 }
 
 
-float cMDEPropertyGenerator::addResponseProperty(std::string s1, 
-												 std::string s2, 
-												 float i, 
-												 bool related)
+float cMDEPropertyGenerator::addResponseProperty(cMDEExpression* e1, cMDEExpression* e2)
 {
 	// a pointer to the universal property
 	float val = 0;	
-	float interesting = i + 2; // 2 points for a response property.
+	float interesting = 2; // 2 points for a response property.
+	bool related;
+	
 
-	cMDEResponseProperty e(s1, s2);
-	
+	cMDEResponseProperty e(e1->getExpr(), e2->getExpr());
+	bool dependent = areExpressionsAtsOpsDependent(e1, e2);
+	// exit if the expressions are dependent.
+	if (dependent) return val;
+
 	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
 	if (mdepropiter != mdeprops.end()) {
 		val = (*mdepropiter)->getEvaluationInformation();
 		val += (*mdepropiter)->getInteresting();
 	} else {
+	
+		e1->interestingStrongANDExpressionEval(); 
+		e2->interestingStrongANDExpressionEval(); 
+		interesting += e1->getInterestingExpressionEval() + e1->getInterestingExpressionEval();
+		bool related = areExpressionsRelated(e1, e2);
+
+		e.setSuppressed(false);
 		e.setInterestingProperty(interesting);
 		e.evaluate();
 		val = e.getEvaluationInformation();
@@ -191,22 +357,32 @@
 	return val;
 }
 
-float cMDEPropertyGenerator::addPrecedenceProperty(std::string s1, 
-												   std::string s2, 
-												   float i, 
-												   bool related)
+float cMDEPropertyGenerator::addPrecedenceProperty(cMDEExpression* e1, cMDEExpression* e2)
 {
 	// a pointer to the universal property
 	float val = 0;	
-	float interesting = i + 2; // 2 points for a precedence property.
+	float interesting = 2; // 2 points for a precedence property.
+	bool related;
 
-	cMDEPrecedenceProperty e(s1, s2);
 	
+	bool dependent = areExpressionsAtsOpsDependent(e1, e2);
+	// exit if the expressions are dependent.
+	if (dependent) return val;
+
+	cMDEPrecedenceProperty e(e1->getExpr(), e2->getExpr());
+	
 	std::set<cMDEProperty*, ltcMDEProperty>::iterator mdepropiter = mdeprops.find(&e);
 	if (mdepropiter != mdeprops.end()) {
 		val = (*mdepropiter)->getEvaluationInformation();
 		val += (*mdepropiter)->getInteresting();
 	} else {
+	
+		e.setSuppressed(false);
+		e1->interestingStrongANDExpressionEval(); 
+		e2->interestingStrongANDExpressionEval(); 
+		interesting += e1->getInterestingExpressionEval() + e1->getInterestingExpressionEval();
+		bool related = areExpressionsRelated(e1, e2);
+		
 		e.setInterestingProperty(interesting);
 		e.evaluate();
 		val = e.getEvaluationInformation();

Modified: branches/uml/source/main/cMDEPropertyGenerator.h
===================================================================
--- branches/uml/source/main/cMDEPropertyGenerator.h	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEPropertyGenerator.h	2008-03-14 17:16:18 UTC (rev 2457)
@@ -51,6 +51,7 @@
 	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 numSuppressed() { return m_suppressed; }
 	
 	int propertySize() { return mdeprops.size(); }
 	
@@ -67,11 +68,16 @@
 																											  
 
 	// Properties
-	float addExistenceProperty(std::string, float, bool);
-	float addAbsenceProperty(std::string, float, bool);
-	float addUniversalProperty(std::string, float, bool);
-	float addResponseProperty(std::string, std::string, float, bool);
-	float addPrecedenceProperty(std::string, std::string, float, bool);
+//	float addExistenceProperty(std::string, float, bool);
+	float addExistenceProperty(cMDEExpression*);
+//	float addAbsenceProperty(std::string, float, bool);
+	float addAbsenceProperty(cMDEExpression*);
+//	float addUniversalProperty(std::string, float, bool);
+	float addUniversalProperty(cMDEExpression*);
+//	float addResponseProperty(std::string, std::string, float, bool);
+	float addResponseProperty(cMDEExpression*, cMDEExpression*);
+//	float addPrecedenceProperty(std::string, std::string, float, bool);
+	float addPrecedenceProperty(cMDEExpression*, cMDEExpression*);
 
 //	bool addExpression(std::string, std::set<std::string>);  
 //	bool relatedExpressions(cMDEExpression*, cMDEExpression*); 
@@ -83,7 +89,7 @@
 	std::string getQstring() { return (expressions[expression_q])->getExpr();  }
 	std::string getRstring() { return (expressions[expression_r])->getExpr(); }
 	
-	float getPInterest() { 
+/*	float getPInterest() { 
 		(expressions[expression_p])->interestingExpressionEval(); 
 		return (expressions[expression_p])->getInterestingExpressionEval() ; }
 	float getQInterest() { 		
@@ -91,7 +97,7 @@
 		return (expressions[expression_q])->getInterestingExpressionEval() ; }
 	float getRInterest() { 
 		(expressions[expression_r])->interestingExpressionEval(); 
-		return (expressions[expression_r])->getInterestingExpressionEval() ; }
+		return (expressions[expression_r])->getInterestingExpressionEval() ; }*/
 	
 	bool relativeMoveExpressionP(int x) { return relativeMoveIndex(expressions, expression_p, x); }
 	bool absoluteMoveExpressionP(int x) { return absoluteMoveIndex(expressions, expression_p, x); }
@@ -161,6 +167,7 @@
 	int m_precedence_property_failure;
 	int m_response_property_success;
 	int m_response_property_failure;
+	int m_suppressed;
 	float m_property_reward;
 	int m_related_class_mode;
 	

Modified: branches/uml/source/main/cMDEResponseProperty.cc
===================================================================
--- branches/uml/source/main/cMDEResponseProperty.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEResponseProperty.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -82,6 +82,7 @@
 	if (_uses_related_classes) {
 		outfile << "true" << ", ";
 	} else { outfile << "false" << ", "; }
+	outfile << "Response, ";
 	outfile << "Globally, it is always the case that if " << _expr_p  << " holds, ";
 	outfile << "then "<< _expr_q << " eventually holds.     "; 
 	outfile <<  std::endl << std::endl;

Modified: branches/uml/source/main/cMDESimpleAttAttExpression.h
===================================================================
--- branches/uml/source/main/cMDESimpleAttAttExpression.h	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDESimpleAttAttExpression.h	2008-03-14 17:16:18 UTC (rev 2457)
@@ -27,6 +27,7 @@
 		_att_1 = a1;
 		_att_2 = a2;
 		_att_operator = op;
+		_compound = false;
 		_expr = getInPromela();
 	}
  	~cMDESimpleAttAttExpression() {}

Modified: branches/uml/source/main/cMDESimpleAttValExpression.h
===================================================================
--- branches/uml/source/main/cMDESimpleAttValExpression.h	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDESimpleAttValExpression.h	2008-03-14 17:16:18 UTC (rev 2457)
@@ -24,6 +24,7 @@
 		_att_1 = a1;
 		_att_val = val;
 		_att_operator = op;
+		_compound = false;
 		_expr = getInPromela();
 	}
  	~cMDESimpleAttValExpression() {}

Modified: branches/uml/source/main/cMDEUniversalProperty.cc
===================================================================
--- branches/uml/source/main/cMDEUniversalProperty.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cMDEUniversalProperty.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -96,6 +96,7 @@
 	if (_uses_related_classes) {
 		outfile << "true" << ", ";
 	} else { outfile << "false" << ", "; }
+	outfile << "Universal, ";
 	outfile << "Globally, it is always the case that " << _expr_p  << " holds.     ";
 	outfile << std::endl << std::endl;
 	

Modified: branches/uml/source/main/cOrganism.cc
===================================================================
--- branches/uml/source/main/cOrganism.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cOrganism.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -702,6 +702,7 @@
 	m_world->GetStats().respPropSuccess(pop_model->getPropertyGenerator()->numResponsePropertySuccess());
 	m_world->GetStats().respPropFailure(pop_model->getPropertyGenerator()->numResponsePropertyFailure());
 	m_world->GetStats().respPropTotal(pop_model->getPropertyGenerator()->numResponsePropertyTotal());	
+	m_world->GetStats().suppressedTotal(pop_model->getPropertyGenerator()->numSuppressed());
 //	int x = pop_model->propertySize();
 //	int y = pop_model->numTotalProperty();
 	

Modified: branches/uml/source/main/cStats.cc
===================================================================
--- branches/uml/source/main/cStats.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cStats.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -1038,6 +1038,7 @@
 	df.Write(sum_merit.Average(), "Merit");	
 	df.Write( m_propertySuccess, "total number of properties that passed" );
 	df.Write( m_propertyFailure, "total number of properties that failed" );
+	df.Write( m_suppressed, "total number of suppressed properties" );
 	df.Write( m_propertyTotal, "total number of properties" );
 	df.Write( m_absPropertySuccess, "absence properties that passed" );
 	df.Write( m_absPropertyFailure, "absence properties that failed" );

Modified: branches/uml/source/main/cStats.h
===================================================================
--- branches/uml/source/main/cStats.h	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cStats.h	2008-03-14 17:16:18 UTC (rev 2457)
@@ -289,6 +289,7 @@
   int m_respPropertySuccess; 
   int m_respPropertyFailure; 
   int m_respPropertyTotal; 
+  int m_suppressed;
     
 
   
@@ -707,6 +708,7 @@
   void respPropFailure(int x) {m_respPropertyFailure =x;}
   void respPropTotal(int x)  {m_respPropertyTotal =x;}
   int getPropTotal () { return m_propertyTotal; }
+  void suppressedTotal(int x) { m_suppressed = x; }
 
   
   

Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2008-03-14 12:44:29 UTC (rev 2456)
+++ branches/uml/source/main/cUMLModel.cc	2008-03-14 17:16:18 UTC (rev 2457)
@@ -567,19 +567,19 @@
 						gen->addSimpleAttValExpression(a1, temp2, "==", c.getAssociatedClasses());
 						gen->addSimpleAttValExpression(a1, temp2, "!=", c.getAssociatedClasses());
 						gen->addSimpleAttValExpression(a1, temp2, ">", c.getAssociatedClasses());
-						gen->addSimpleAttValExpression(a1, temp2, ">=", c.getAssociatedClasses());
+//						gen->addSimpleAttValExpression(a1, temp2, ">=", c.getAssociatedClasses());
 					} else if (k==(a.attribute_values.size() -1)) {
 						gen->addSimpleAttValExpression(a1, temp2, "==", c.getAssociatedClasses());
 						gen->addSimpleAttValExpression(a1, temp2, "!=", c.getAssociatedClasses());
-						gen->addSimpleAttValExpression(a1, temp2, "<=", c.getAssociatedClasses());
+//						gen->addSimpleAttValExpression(a1, temp2, "<=", c.getAssociatedClasses());
 						gen->addSimpleAttValExpression(a1, temp2, "<", c.getAssociatedClasses());
 					} else {
 						gen->addSimpleAttValExpression(a1, temp2, "==", c.getAssociatedClasses());
 						gen->addSimpleAttValExpression(a1, temp2, "!=", c.getAssociatedClasses());
-						gen->addSimpleAttValExpression(a1, temp2, "<=", c.getAssociatedClasses());
+//						gen->addSimpleAttValExpression(a1, temp2, "<=", c.getAssociatedClasses());
 						gen->addSimpleAttValExpression(a1, temp2, "<", c.getAssociatedClasses());
 						gen->addSimpleAttValExpression(a1, temp2, ">", c.getAssociatedClasses());
-						gen->addSimpleAttValExpression(a1, temp2, ">=", c.getAssociatedClasses());
+//						gen->addSimpleAttValExpression(a1, temp2, ">=", c.getAssociatedClasses());
 					}
 				
 				}




More information about the Avida-cvs mailing list