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

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Thu May 1 05:43:12 PDT 2008


Author: hjg
Date: 2008-05-01 08:43:12 -0400 (Thu, 01 May 2008)
New Revision: 2568

Modified:
   branches/uml/source/main/cUMLModel.cc
Log:
New utility formulae for scenarios.


Modified: branches/uml/source/main/cUMLModel.cc
===================================================================
--- branches/uml/source/main/cUMLModel.cc	2008-05-01 01:23:24 UTC (rev 2567)
+++ branches/uml/source/main/cUMLModel.cc	2008-05-01 12:43:12 UTC (rev 2568)
@@ -504,8 +504,7 @@
 {
 	double total_bonus = 0;
 	double temp_bonus = 0;
-	double max_bonus = 0; 
-	int max_sc = 0;
+//	double max_bonus = 0; 
 	double complete_bonus;
 	scenario_info s;
 	
@@ -522,34 +521,19 @@
 		
 		if (s.startState >= 0) complete_bonus++;
 		
-		// Keep track of the best alternative
-		if (max_bonus < temp_bonus) { 
-			max_bonus = temp_bonus; 
-			max_sc = i; 
-		}
-		
-		// hjg: commenting out the following on 4/22 to work with alternative scenarios. This code
-		// will need to change when I move from strict alternatives to different combos....
-		// I'm simplifying until then... 
-		// The next line is commented out to increase the reward for a given scenario. 
-		// total_bonus += (temp_bonus / complete_bonus);
-//		 total_bonus += temp_bonus;
-		
-	scenario_completion[i] = temp_bonus / complete_bonus;
+		scenario_completion[i] = temp_bonus / complete_bonus;
 	
-	// hjg: this uses hard coded user preferences...
-	// The total bonus (i.e., utility) should be computed by performing the following: 
-	// For eac scenario, 
-	//		total_bonus = %complete(util_sc_1 * util_u_1 + util_sc_2 + util_u_2...)
-	//		where util_u_1 indicates the importance the user places on the utility metric
-	//		and util_sc_1 indicates how well this scenario does on that utility	
-	double total_util = s.utilityMap["FaultTolerance"]*.2 + s.utilityMap["EnergyEfficiency"]*.6; 
-	total_util += s.utilityMap["Accuracy"]*.2;
-	total_util = complete_bonus * total_util;
-	s.utilityMap["Total"] = total_util;
+		// hjg: this uses hard coded user preferences...
+		// The total bonus (i.e., utility) should be computed by performing the following: 
+		// For eac scenario, 
+		//		total_bonus = %complete(util_sc_1 * util_u_1 + util_sc_2 + util_u_2...)
+		//		where util_u_1 indicates the importance the user places on the utility metric
+		//		and util_sc_1 indicates how well this scenario does on that utility	
+		double total_util = s.utilityMap["FaultTolerance"]*.2 + s.utilityMap["EnergyEfficiency"]*.6; 
+		total_util += s.utilityMap["Accuracy"]*.2;
+		total_util = total_util + temp_bonus;
+		s.utilityMap["Total"] = total_util;
 	
-//	std::cout << "scenario " << i << " bonus " << temp_bonus << " max bonus " << max_bonus; 
-//	std::cout << " complete_bonus " << complete_bonus << std::endl;
 	}
 	
 
@@ -577,9 +561,6 @@
 			if (current_alt_set_max_util < s.utilityMap["Total"]) {
 				current_alt_set_max_util = s.utilityMap["Total"];
 				current_alt_set_percent_complete = scenario_completion[i];
-				if (scenario_completion[i] > 1) { 
-					int x = 0;
-				}
 			}
 		}
 
@@ -588,19 +569,6 @@
 	
 	total_bonus = accrued_util;
 	
-//	std::cout << " Bonus : " << complete_bonus << std::endl;
-//	std::cout << " i : " << max_sc << std::endl;
-//	std::cout << " num sc : " << scenarios.size() << std::endl;
-
-
-	
-	// commented out to try without utility.
-	
-//	total_bonus = complete_bonus * total_util;
-	//what is total bonus equal to? 
-		
-	//return (total_bonus *5);
-	
 	return total_bonus;
 }
 




More information about the Avida-cvs mailing list