Changeset 5087 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers
- Timestamp:
- 12/12/10 11:34:13 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/BestParameterConfigurationAnalyzer.cs
r5023 r5087 40 40 } 41 41 42 public BestParameterConfigurationAnalyzer() : base() { 42 public BestParameterConfigurationAnalyzer() 43 : base() { 43 44 Parameters.Add(new ScopeTreeLookupParameter<ParameterConfigurationTree>("ParameterConfigurationTree", "TODO The TSP solutions given in path representation from which the best solution should be analyzed.")); 44 45 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "TODO The qualities of the TSP solutions which should be analyzed.")); … … 63 64 ItemArray<ParameterConfigurationTree> parameterTrees = ParameterConfigurationParameter.ActualValue; 64 65 65 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;66 int idxBest = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 66 67 67 EngineAlgorithm bestAlg = ((EngineAlgorithm)((ParameterConfigurationTree)parameterTrees[i]).ActualValue.Value);68 Run bestRun = new Run(bestAlg);69 ((ParameterConfigurationTree)parameterTrees[i]).CollectResultValues(bestRun.Results);70 68 71 if (bestKnownQuality == null || qualities[i].Value < bestKnownQuality.Value) { // todo: respect Maximization:true/false 72 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value); 69 ParameterConfigurationTree best = (ParameterConfigurationTree)parameterTrees[idxBest]; 70 IRun bestRun = new Run(); 71 best.CollectResultValues(bestRun.Results); 72 best.CollectParameterValues(bestRun.Parameters); 73 74 if (bestKnownQuality == null || qualities[idxBest].Value < bestKnownQuality.Value) { // todo: respect Maximization:true/false 75 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[idxBest].Value); 76 73 77 BestKnownSolutionParameter.ActualValue = bestRun; 74 78 } 75 79 76 IRun best = BestSolutionParameter.ActualValue; 77 if (best == null) { 80 if (BestSolutionParameter.ActualValue == null) { 78 81 BestSolutionParameter.ActualValue = bestRun; 79 82 results.Add(new Result("Best Parameter Settings", bestRun)); … … 84 87 85 88 // population 89 90 int i = 0; 86 91 RunCollection rc = new RunCollection(); 87 92 foreach (ParameterConfigurationTree pt in parameterTrees.OrderByDescending(x => x.BestQuality.Value)) { // todo: respect Maximization:true/false 88 IAlgorithm alg = (IAlgorithm)pt.ActualValue.Value; 89 alg.StoreAlgorithmInEachRun = false; 90 IRun run = new Run(alg); 93 IRun run = new Run(); 94 run.Name = string.Format("Individuum ({0})", i); 91 95 pt.CollectResultValues(run.Results); 96 pt.CollectParameterValues(run.Parameters); 92 97 rc.Add(run); 98 i++; 93 99 } 94 100 if (PopulationParameter.ActualValue == null) {
Note: See TracChangeset
for help on using the changeset viewer.