Changeset 6018 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/PMOBestSolutionHistoryAnalyzer.cs
- Timestamp:
- 04/17/11 18:22:28 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/PMOBestSolutionHistoryAnalyzer.cs
r5576 r6018 7 7 using HeuristicLab.Parameters; 8 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 9 using System.Collections.Generic;10 using System;11 using HeuristicLab.Analysis;12 9 13 10 namespace HeuristicLab.Problems.MetaOptimization { … … 34 31 get { return (LookupParameter<IntValue>)Parameters["Generations"]; } 35 32 } 33 public LookupParameter<BoolValue> MaximizationParameter { 34 get { return (LookupParameter<BoolValue>)Parameters["Maximization"]; } 35 } 36 36 37 37 public PMOBestSolutionHistoryAnalyzer() … … 42 42 Parameters.Add(new LookupParameter<ConstrainedItemList<IProblem>>(MetaOptimizationProblem.ProblemsParameterName)); 43 43 Parameters.Add(new LookupParameter<IntValue>("Generations", "")); 44 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "Set to false if the problem should be minimized.")); 44 45 } 45 46 … … 56 57 ItemArray<ParameterConfigurationTree> parameterTrees = ParameterConfigurationParameter.ActualValue; 57 58 int currentGeneration = GenerationsParameter.ActualValue.Value; 58 int idxBest = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; // todo: respect Min/Max 59 bool maximization = MaximizationParameter.ActualValue.Value; 60 61 int idxBest; 62 if (maximization) 63 idxBest = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).Last().index; 64 else 65 idxBest = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; 66 59 67 ParameterConfigurationTree best = parameterTrees[idxBest]; 60 68
Note: See TracChangeset
for help on using the changeset viewer.