Changeset 4830 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers
- Timestamp:
- 11/18/10 00:53:15 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Analyzers/BestQualityAnalyzer.cs
r4516 r4830 9 9 using HeuristicLab.Parameters; 10 10 using HeuristicLab.Data; 11 using HeuristicLab.Common; 11 12 12 13 namespace HeuristicLab.Problems.MetaOptimization { … … 16 17 [Item("BestQualityAnalyzer", "TODO An operator for analyzing the best solution of Traveling Salesman Problems given in path representation using city coordinates.")] 17 18 [StorableClass] 18 public sealed class BestQualityAnalyzer : SingleSuccessorOperator, IAnalyzer { 19 public sealed class BestParameterConfigurationAnalyzer : SingleSuccessorOperator, IAnalyzer { 20 // Wagner: Spezielle View für die Lösungen (ParameterConfigurations): So wie bei Runs: die zu Optimierenden Parameter(-werte) der besten solution anzeigen 19 21 20 public ScopeTreeLookupParameter<IParameter Set> ParameterSetParameter {21 get { return (ScopeTreeLookupParameter<IParameter Set>)Parameters["ParameterSet"]; }22 public ScopeTreeLookupParameter<IParameterConfiguration> ParameterVectorParameter { 23 get { return (ScopeTreeLookupParameter<IParameterConfiguration>)Parameters["ParameterConfiguration"]; } 22 24 } 23 25 public ScopeTreeLookupParameter<DoubleValue> QualityParameter { 24 26 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 25 27 } 26 public LookupParameter<IParameter Set> BestSolutionParameter {27 get { return (LookupParameter<IParameter Set>)Parameters["BestSolution"]; }28 public LookupParameter<IParameterConfiguration> BestSolutionParameter { 29 get { return (LookupParameter<IParameterConfiguration>)Parameters["BestSolution"]; } 28 30 } 29 31 public ValueLookupParameter<ResultCollection> ResultsParameter { … … 33 35 get { return (LookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; } 34 36 } 35 public LookupParameter<IParameter Set> BestKnownSolutionParameter {36 get { return (LookupParameter<IParameter Set>)Parameters["BestKnownSolution"]; }37 public LookupParameter<IParameterConfiguration> BestKnownSolutionParameter { 38 get { return (LookupParameter<IParameterConfiguration>)Parameters["BestKnownSolution"]; } 37 39 } 38 40 39 public Best QualityAnalyzer()41 public BestParameterConfigurationAnalyzer() 40 42 : base() { 41 Parameters.Add(new ScopeTreeLookupParameter<IParameter Set>("ParameterSet", "TODO The TSP solutions given in path representation from which the best solution should be analyzed."));43 Parameters.Add(new ScopeTreeLookupParameter<IParameterConfiguration>("ParameterConfiguration", "TODO The TSP solutions given in path representation from which the best solution should be analyzed.")); 42 44 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "TODO The qualities of the TSP solutions which should be analyzed.")); 43 Parameters.Add(new LookupParameter<IParameter Set>("BestSolution", "TODO The best TSP solution."));45 Parameters.Add(new LookupParameter<IParameterConfiguration>("BestSolution", "TODO The best TSP solution.")); 44 46 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "TODO The result collection where the best TSP solution should be stored.")); 45 47 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "TODO The quality of the best known solution of this TSP instance.")); 46 Parameters.Add(new LookupParameter<IParameterSet>("BestKnownSolution", "TODO The best known solution of this TSP instance.")); 48 Parameters.Add(new LookupParameter<IParameterConfiguration>("BestKnownSolution", "TODO The best known solution of this TSP instance.")); 49 } 50 51 [StorableConstructor] 52 private BestParameterConfigurationAnalyzer(bool deserializing) : base(deserializing) { } 53 private BestParameterConfigurationAnalyzer(BestParameterConfigurationAnalyzer original, Cloner cloner) : base(original, cloner) { } 54 public override IDeepCloneable Clone(Cloner cloner) { 55 return new BestParameterConfigurationAnalyzer(this, cloner); 47 56 } 48 57 … … 51 60 ResultCollection results = ResultsParameter.ActualValue; 52 61 DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue; 53 ItemArray<IParameter Set> parameterSets = ParameterSetParameter.ActualValue;62 ItemArray<IParameterConfiguration> parameterVectors = ParameterVectorParameter.ActualValue; 54 63 55 64 int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index; … … 57 66 if (bestKnownQuality == null || qualities[i].Value < bestKnownQuality.Value) { 58 67 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[i].Value); 59 BestKnownSolutionParameter.ActualValue = (IParameter Set)parameterSets[i].Clone();68 BestKnownSolutionParameter.ActualValue = (IParameterConfiguration)parameterVectors[i].Clone(); 60 69 } 61 70
Note: See TracChangeset
for help on using the changeset viewer.