Changeset 5293 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators
- Timestamp:
- 01/14/11 00:41:58 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/ParameterConfigurationEvaluator.cs
r5281 r5293 40 40 } 41 41 42 public LookupParameter<DoubleArray> ProblemQuality MediansParameter {43 get { return (LookupParameter<DoubleArray>)Parameters["ProblemQuality Medians"]; }42 public LookupParameter<DoubleArray> ProblemQualityReferencesParameter { 43 get { return (LookupParameter<DoubleArray>)Parameters["ProblemQualityReferences"]; } 44 44 } 45 45 … … 55 55 Parameters.Add(new LookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", "Missing description.")); 56 56 Parameters.Add(new LookupParameter<IntValue>(MetaOptimizationProblem.RepetitionsParameterName, "Number of evaluations on one problem.")); 57 Parameters.Add(new LookupParameter<DoubleArray>("ProblemQuality Medians", ""));57 Parameters.Add(new LookupParameter<DoubleArray>("ProblemQualityReferences", "")); 58 58 } 59 59 … … 72 72 ParameterConfigurationTree parameterConfiguration = ParameterConfigurationParameter.ActualValue; 73 73 74 double[] medians;75 if (ProblemQuality MediansParameter.ActualValue == null) {74 double[] referenceQualities; 75 if (ProblemQualityReferencesParameter.ActualValue == null) { 76 76 // this is generation zero. no reference qualities for normalization have been calculated yet. 77 medians = new double[problems.Count];78 for (int i = 0; i < medians.Length; i++) {79 medians[i] = 1;77 referenceQualities = new double[problems.Count]; 78 for (int i = 0; i < referenceQualities.Length; i++) { 79 referenceQualities[i] = 1; 80 80 } 81 81 } else { 82 medians = ProblemQualityMediansParameter.ActualValue.ToArray();82 referenceQualities = ProblemQualityReferencesParameter.ActualValue.ToArray(); 83 83 } 84 84 … … 131 131 parameterConfiguration.Runs = (RunCollection)algorithm.Runs.Clone(); 132 132 133 this.QualityParameter.ActualValue = new DoubleValue(NormalizeQualities(parameterConfiguration, medians));133 this.QualityParameter.ActualValue = new DoubleValue(NormalizeQualities(parameterConfiguration, referenceQualities)); 134 134 135 135 return base.Apply(); 136 136 } 137 137 138 public static double NormalizeQualities(ParameterConfigurationTree parameterConfigurationTree, double[] medians) {139 double[] qualitiesNormalized = new double[ medians.Length];140 for (int i = 0; i < medians.Length; i++) {141 qualitiesNormalized[i] = parameterConfigurationTree.AverageQualities[i] / medians[i];138 public static double NormalizeQualities(ParameterConfigurationTree parameterConfigurationTree, double[] referenceQualities) { 139 double[] qualitiesNormalized = new double[referenceQualities.Length]; 140 for (int i = 0; i < referenceQualities.Length; i++) { 141 qualitiesNormalized[i] = parameterConfigurationTree.AverageQualities[i] / referenceQualities[i]; 142 142 } 143 143 parameterConfigurationTree.QualitiesNormalized = new DoubleArray(qualitiesNormalized);
Note: See TracChangeset
for help on using the changeset viewer.