Changeset 6489 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators
- Timestamp:
- 06/27/11 23:56:35 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmRunsAnalyzer.cs
r6473 r6489 69 69 public IScope CurrentScope { 70 70 get { return CurrentScopeParameter.ActualValue; } 71 } 72 public LookupParameter<StringValue> QualityMeasureNameParameter { 73 get { return (LookupParameter<StringValue>)Parameters[MetaOptimizationProblem.QualityMeasureNameName]; } 71 74 } 72 75 #endregion … … 93 96 Parameters.Add(new LookupParameter<DoubleValue>(MetaOptimizationProblem.StandardDeviationWeightParameterName)); 94 97 Parameters.Add(new LookupParameter<DoubleValue>(MetaOptimizationProblem.EvaluatedSolutionsWeightParameterName)); 98 Parameters.Add(new LookupParameter<StringValue>(MetaOptimizationProblem.QualityMeasureNameName)); 95 99 Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose sub-scopes represent the parents.")); 96 100 } … … 104 108 private void AfterDeserialization() { 105 109 if (!Parameters.ContainsKey("CurrentScope")) Parameters.Add(new ScopeParameter("CurrentScope", "The current scope whose sub-scopes represent the parents.")); // backwards compatibility 110 if (!Parameters.ContainsKey(MetaOptimizationProblem.QualityMeasureNameName)) Parameters.Add(new LookupParameter<StringValue>(MetaOptimizationProblem.QualityMeasureNameName)); // backwards compatibility 106 111 } 107 112 … … 118 123 double standardDeviationWeight = StandardDeviationWeightParameter.ActualValue.Value; 119 124 double evaluatedSolutionsWeight = EvaluatedSolutionsWeightParameter.ActualValue.Value; 120 var resultNames = new List<string> { "BestQuality", "Execution Time", "EvaluatedSolutions" }; 125 string qualityMeasureName = QualityMeasureNameParameter.ActualValue.Value; 126 var resultNames = new List<string> { qualityMeasureName, "Execution Time", "EvaluatedSolutions" }; 121 127 int currentGeneration = GenerationsParameter.ActualValue != null ? GenerationsParameter.ActualValue.Value : 0; 122 128 double[] referenceQualityAverages; … … 146 152 MetaOptimizationUtil.ClearResults(run, resultNames); 147 153 MetaOptimizationUtil.ClearParameters(run, parameterNames); 148 run.Results.Add("Meta .FromCache", new BoolValue(false));149 run.Results.Add("Meta .Generation", new IntValue(currentGeneration));150 run.Results.Add("Meta .ProblemIndex", new IntValue(problemIndex));154 run.Results.Add("Meta-FromCache", new BoolValue(false)); 155 run.Results.Add("Meta-Generation", new IntValue(currentGeneration)); 156 run.Results.Add("Meta-ProblemIndex", new IntValue(problemIndex)); 151 157 run.Name = string.Format("{0} Problem {1} Run {2}", parameterConfiguration.ParameterInfoString, problemIndex, repetitionIndex); 152 qualities[problemIndex][repetitionIndex] = (((DoubleValue)run.Results["BestQuality"]).Value); 158 159 qualities[problemIndex][repetitionIndex] = GetResultValue<DoubleValue>(run.Results, qualityMeasureName).Value; 153 160 executionTimes[problemIndex][repetitionIndex] = (((TimeSpanValue)run.Results["Execution Time"]).Value); 154 161 evaluatedSolutions[problemIndex][repetitionIndex] = (((IntValue)run.Results["EvaluatedSolutions"]).Value); … … 203 210 204 211 return base.Apply(); 212 } 213 214 private T1 GetResultValue<T1>(IDictionary<string, IItem> results, string resultName) { 215 return (T1)results[resultName]; 216 217 //string separator = "."; 218 //string[] tokens = resultName.Split(separator.ToCharArray()); 219 220 //IDictionary<string, IItem> currentResults = results; 221 //IItem currentResult = null; 222 //for (int i = 0; i < tokens.Length; i++) { 223 // if(currentResults == null) 224 // throw new KeyNotFoundException("Result value " + resultName + " was not found"); 225 // if (currentResults.ContainsKey(tokens[i])) { 226 // currentResult = currentResults[tokens[i]]; 227 // currentResults = currentResult as IDictionary<string, IItem>; 228 // } else { 229 // throw new KeyNotFoundException("Result value " + resultName + " was not found"); 230 // } 231 //} 232 //return (T1)currentResult; 205 233 } 206 234
Note: See TracChangeset
for help on using the changeset viewer.