Changeset 5023 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/BestParameterConfigurationAnalyzer.cs
- Timestamp:
- 12/04/10 18:08:43 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/BestParameterConfigurationAnalyzer.cs
r5009 r5023 17 17 [StorableClass] 18 18 public sealed class BestParameterConfigurationAnalyzer : SingleSuccessorOperator, IAnalyzer { 19 // Wagner: Spezielle View für die Lösungen (ParameterConfigurations): So wie bei Runs: die zu Optimierenden Parameter(-werte) der besten solution anzeigen20 19 21 20 public ScopeTreeLookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter { … … 62 61 ResultCollection results = ResultsParameter.ActualValue; 63 62 DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue; 64 ItemArray<ParameterConfigurationTree> parameter Configurations = ParameterConfigurationParameter.ActualValue;63 ItemArray<ParameterConfigurationTree> parameterTrees = ParameterConfigurationParameter.ActualValue; 65 64 66 65 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 67 66 68 EngineAlgorithm bestAlg = ((EngineAlgorithm)((ParameterConfigurationTree)parameter Configurations[i]).ActualValue.Value);67 EngineAlgorithm bestAlg = ((EngineAlgorithm)((ParameterConfigurationTree)parameterTrees[i]).ActualValue.Value); 69 68 Run bestRun = new Run(bestAlg); 69 ((ParameterConfigurationTree)parameterTrees[i]).CollectResultValues(bestRun.Results); 70 70 71 if (bestKnownQuality == null || qualities[i].Value < bestKnownQuality.Value) { 71 if (bestKnownQuality == null || qualities[i].Value < bestKnownQuality.Value) { // todo: respect Maximization:true/false 72 72 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value); 73 73 BestKnownSolutionParameter.ActualValue = bestRun; … … 83 83 } 84 84 85 // population 85 86 RunCollection rc = new RunCollection(); 86 87 foreach (ParameterConfigurationTree pc in parameterConfigurations.OrderBy(x => x.Quality.Value*-1)) { 88 IAlgorithm alg = (IAlgorithm)pc.ActualValue.Value; 87 foreach (ParameterConfigurationTree pt in parameterTrees.OrderByDescending(x => x.BestQuality.Value)) { // todo: respect Maximization:true/false 88 IAlgorithm alg = (IAlgorithm)pt.ActualValue.Value; 89 89 alg.StoreAlgorithmInEachRun = false; 90 90 IRun run = new Run(alg); 91 pt.CollectResultValues(run.Results); 91 92 rc.Add(run); 92 93 } … … 98 99 results["Population"].Value = rc; 99 100 } 100 GC.Collect();101 101 102 102 return base.Apply();
Note: See TracChangeset
for help on using the changeset viewer.