Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/04/10 18:08:43 (14 years ago)
Author:
cneumuel
Message:

#1215 worked on metaoptimization

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/BestParameterConfigurationAnalyzer.cs

    r5009 r5023  
    1717  [StorableClass]
    1818  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 anzeigen
    2019
    2120    public ScopeTreeLookupParameter<ParameterConfigurationTree> ParameterConfigurationParameter {
     
    6261      ResultCollection results = ResultsParameter.ActualValue;
    6362      DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue;
    64       ItemArray<ParameterConfigurationTree> parameterConfigurations = ParameterConfigurationParameter.ActualValue;
     63      ItemArray<ParameterConfigurationTree> parameterTrees = ParameterConfigurationParameter.ActualValue;
    6564
    6665      int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
    6766
    68       EngineAlgorithm bestAlg = ((EngineAlgorithm)((ParameterConfigurationTree)parameterConfigurations[i]).ActualValue.Value);
     67      EngineAlgorithm bestAlg = ((EngineAlgorithm)((ParameterConfigurationTree)parameterTrees[i]).ActualValue.Value);
    6968      Run bestRun = new Run(bestAlg);
     69      ((ParameterConfigurationTree)parameterTrees[i]).CollectResultValues(bestRun.Results);
    7070
    71       if (bestKnownQuality == null || qualities[i].Value < bestKnownQuality.Value) {
     71      if (bestKnownQuality == null || qualities[i].Value < bestKnownQuality.Value) { // todo: respect Maximization:true/false
    7272        BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value);
    7373        BestKnownSolutionParameter.ActualValue = bestRun;
     
    8383      }
    8484
     85      // population
    8586      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;
    8989        alg.StoreAlgorithmInEachRun = false;
    9090        IRun run = new Run(alg);
     91        pt.CollectResultValues(run.Results);
    9192        rc.Add(run);
    9293      }
     
    9899        results["Population"].Value = rc;
    99100      }
    100       GC.Collect();
    101101
    102102      return base.Apply();
Note: See TracChangeset for help on using the changeset viewer.