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

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Fri Mar 21 15:52:00 PDT 2008


Author: hjg
Date: 2008-03-21 18:52:00 -0400 (Fri, 21 Mar 2008)
New Revision: 2487

Modified:
   branches/uml/source/main/cMDECompoundExpression.h
   branches/uml/source/main/cMDEPropertyGenerator.cc
   branches/uml/source/main/cUMLModel.cc
Log:
Fixed how strong property was computed. 



Modified: branches/uml/source/main/cMDECompoundExpression.h
===================================================================
--- branches/uml/source/main/cMDECompoundExpression.h	2008-03-21 22:09:38 UTC (rev 2486)
+++ branches/uml/source/main/cMDECompoundExpression.h	2008-03-21 22:52:00 UTC (rev 2487)
@@ -57,6 +57,7 @@
 	int numANDs() { 
 		int num = 0;
 		if (_exp_op == "&&") num = 1;
+
 		return (num + _exp_1->numANDs() + _exp_2->numANDs());
 	}
 	
@@ -64,49 +65,34 @@
 	int numORs() { 
 		int num = 0;
 		if (_exp_op == "||") num = 1;
-		return (num + _exp_1->numANDs() + _exp_2->numANDs());
+		return (num + _exp_1->numORs() + _exp_2->numORs());
 	}
 
 	void interestingStrongANDExpressionEval() { 
-		// Currently, the interesting reward is evaluated based on: 
-		// - whether it includes one of the significant variables/operations
 		float temp =0;
+		float no = numORs();
 		
-		// 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 ANDs
-		temp += _exp_1->numANDs() + _exp_2->numANDs();
+		temp += numANDs();
 		
 		// Decrease interesting based on the number of ORs
-		temp = temp - ((_exp_1->numORs())/2) - ((_exp_2->numORs())/2);
+		temp = temp - (no/2);
 		
 		_interesting = temp;
 		
 	}
 	
 	void interestingWeakANDExpressionEval() {
-			// Currently, the interesting reward is evaluated based on: 
-		// - whether it includes one of the significant variables/operations
 		float temp =0;
+		float na = numANDs();
 		
-		// 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();
-		
+		temp += numORs(); 
 		// Decrease interesting based on the number of ANDs
-		temp = temp - ((_exp_1->numANDs())/2) - ((_exp_2->numANDs())/2);
-		
+		temp = temp - (na/2); 
 		_interesting = temp;
-
-	
 	}
 	
-	//std::set<std::string> getRelatedClasses() { return _related_classes; }
 	
 		
 protected:

Modified: branches/uml/source/main/cMDEPropertyGenerator.cc
===================================================================
--- branches/uml/source/main/cMDEPropertyGenerator.cc	2008-03-21 22:09:38 UTC (rev 2486)
+++ branches/uml/source/main/cMDEPropertyGenerator.cc	2008-03-21 22:52:00 UTC (rev 2487)
@@ -225,6 +225,7 @@
 		// add in how interesting the expression is. Use the WEAK and form. 
 		expr->interestingWeakANDExpressionEval(); 
 		interesting += expr->getInterestingExpressionEval();
+
 		interesting += getExpressionRelevancy(expr);
 		
 		// determine if they are related
@@ -685,6 +686,7 @@
 
 	}
 	
+	return total;
 }
 
 

Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2008-03-21 22:09:38 UTC (rev 2486)
+++ branches/uml/source/main/cUMLModel.cc	2008-03-21 22:52:00 UTC (rev 2487)
@@ -650,7 +650,7 @@
 					// create both an equality and an inequality expression
 					temp2 = a.attribute_values[k];
 					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