Changeset 8722
- Timestamp:
- 10/02/12 22:20:08 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/DuplicateSolutionsAnalyzer.cs
r8505 r8722 21 21 22 22 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Operators; 26 27 using HeuristicLab.Optimization; 27 using HeuristicLab.Optimization.Operators;28 28 using HeuristicLab.Parameters; 29 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Problems.TravelingSalesman;31 30 32 31 namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers { … … 46 45 get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; } 47 46 } 48 public IValueParameter<SingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter { 49 get { return (IValueParameter<SingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; } 47 public IValueParameter<ISingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter { 48 get { return (IValueParameter<ISingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; } 49 } 50 public ILookupParameter<ItemCollection<IItem>> OperatorsParameter { 51 get { return (ILookupParameter<ItemCollection<IItem>>)Parameters["Operators"]; } 50 52 } 51 53 #endregion … … 62 64 [StorableConstructor] 63 65 private DuplicateSolutionsAnalyzer(bool deserializing) : base(deserializing) { } 64 65 private DuplicateSolutionsAnalyzer(DuplicateSolutionsAnalyzer original, Cloner cloner) : base(original, cloner) { 66 67 private DuplicateSolutionsAnalyzer(DuplicateSolutionsAnalyzer original, Cloner cloner) 68 : base(original, cloner) { 66 69 chartingHelper = (DataTableHelper)original.chartingHelper.Clone(cloner); 67 70 } 68 71 69 72 public DuplicateSolutionsAnalyzer() 70 73 : base() { 71 74 Parameters.Add(new LookupParameter<ResultCollection>(ResultsParameterName, "The results collection where the analysis values should be stored.")); 72 Parameters.Add(new ValueParameter<SingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator", new TSPSimilarityCalculator())); 73 SimilarityCalculatorParameter.Value.SolutionVariableName = "TSPTour"; 74 SimilarityCalculatorParameter.Value.QualityVariableName = "TSPTourLength"; 75 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator")); 76 Parameters.Add(new LookupParameter<ItemCollection<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.")); 75 77 76 78 chartingHelper = new DataTableHelper(); … … 82 84 83 85 public override IOperation Apply() { 86 if (SimilarityCalculatorParameter.Value == null) { 87 SimilarityCalculatorParameter.Value = OperatorsParameter.ActualValue.OfType<ISingleObjectiveSolutionSimilarityCalculator>().FirstOrDefault(); 88 } 84 89 chartingHelper.InitializeChart(Results, "Duplicate Solutions", "Duplicate Solutions per Generation"); 85 90 … … 95 100 } 96 101 97 chartingHelper.AddPoint(counter );102 chartingHelper.AddPoint(counter / (double)similarities.Length); 98 103 return base.Apply(); 99 104 }
Note: See TracChangeset
for help on using the changeset viewer.