Changeset 5212 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers
- Timestamp:
- 01/05/11 02:03:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/BestParameterConfigurationAnalyzer.cs
r5087 r5212 40 40 } 41 41 42 // stores the medians of the qualities of each problem 43 public LookupParameter<DoubleArray> ProblemQualityMediansParameter { 44 get { return (LookupParameter<DoubleArray>)Parameters["ProblemQualityMedians"]; } 45 } 46 public LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>> ProblemsParameter { 47 get { return (LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>)Parameters[MetaOptimizationProblem.ProblemsParameterName]; } 48 } 49 42 50 public BestParameterConfigurationAnalyzer() 43 51 : base() { … … 49 57 Parameters.Add(new LookupParameter<IRun>("BestKnownSolution", "TODO The best known solution of this TSP instance.")); 50 58 Parameters.Add(new LookupParameter<RunCollection>("Population", "TODO The best known solution of this TSP instance.")); 59 Parameters.Add(new LookupParameter<DoubleArray>("ProblemQualityMedians", "")); 60 Parameters.Add(new LookupParameter<ConstrainedItemList<ISingleObjectiveProblem>>(MetaOptimizationProblem.ProblemsParameterName)); 51 61 } 52 62 … … 65 75 66 76 int idxBest = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 67 68 77 69 78 ParameterConfigurationTree best = (ParameterConfigurationTree)parameterTrees[idxBest]; … … 87 96 88 97 // population 89 90 98 int i = 0; 91 99 RunCollection rc = new RunCollection(); 92 foreach (ParameterConfigurationTree pt in parameterTrees.OrderBy Descending(x => x.BestQuality.Value)) { // todo: respect Maximization:true/false100 foreach (ParameterConfigurationTree pt in parameterTrees.OrderBy(x => x.AverageQualityNormalized)) { // todo: respect Maximization:true/false 93 101 IRun run = new Run(); 94 102 run.Name = string.Format("Individuum ({0})", i); … … 106 114 } 107 115 116 // medians for the problems 117 DoubleArray medians = new DoubleArray(ProblemsParameter.ActualValue.Count); 118 for (int pi = 0; pi < ProblemsParameter.ActualValue.Count; pi++) { 119 double[] values = new double[rc.Count]; 120 for (int ri = 0; ri < rc.Count; ri++) { 121 values[ri] = ((DoubleArray)rc.ElementAt(ri).Results["RunsAverageQualities"])[pi]; 122 } 123 medians[pi] = values.Median(); 124 } 125 ProblemQualityMediansParameter.ActualValue = medians; 126 127 if (results.ContainsKey("ProblemsAverageQualityMedians")) { 128 results["ProblemsAverageQualityMedians"].Value = medians; 129 } else { 130 results.Add(new Result("ProblemsAverageQualityMedians", medians)); 131 } 132 108 133 return base.Apply(); 109 134 }
Note: See TracChangeset
for help on using the changeset viewer.