Changeset 8739
- Timestamp:
- 10/04/12 16:19:15 (12 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/CrossoverPerformanceAnalyzer.cs
r8511 r8739 29 29 using HeuristicLab.Operators; 30 30 using HeuristicLab.Optimization; 31 using HeuristicLab.Optimization.Operators;32 31 using HeuristicLab.Parameters; 33 32 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 34 using HeuristicLab.Problems.TravelingSalesman;35 33 36 34 namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers { … … 66 64 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } 67 65 } 68 public IValueParameter<SingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter { 69 get { return (IValueParameter<SingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; } 66 public IValueParameter<ISingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter { 67 get { return (IValueParameter<ISingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; } 68 } 69 public ILookupParameter<ItemCollection<IItem>> OperatorsParameter { 70 get { return (ILookupParameter<ItemCollection<IItem>>)Parameters["Operators"]; } 70 71 } 71 72 #endregion … … 126 127 QualityParameter.ActualName = "TSPTourLength"; 127 128 128 Parameters.Add(new ValueParameter<SingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator")); 129 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator")); 130 Parameters.Add(new LookupParameter<ItemCollection<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.")); 129 131 130 132 plotHelper = new ScatterPlotHelper(false, true); … … 141 143 142 144 public override IOperation Apply() { 143 SimilarityCalculatorParameter.Value.QualityVariableName = "TSPTourLength"; 144 SimilarityCalculatorParameter.Value.SolutionVariableName = "TSPTour"; 145 if (SimilarityCalculatorParameter.Value == null) { 146 SimilarityCalculatorParameter.Value = OperatorsParameter.ActualValue.OfType<ISingleObjectiveSolutionSimilarityCalculator>().FirstOrDefault(); 147 } 145 148 146 149 plotHelper.InitializePlot(Results, "Crossover Performance", "Solution Index", "Absolut Quality Difference"); … … 176 179 qualityPoints.Add(qualityPoint.Y); 177 180 178 if ( TSPSimilarityCalculator.CalculateSimilarity(parent1, parent2)== 1.0) {181 if (parentDiversity == 1.0) { 179 182 equalParents++; 180 183 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/MutationPerformanceAnalyzer.cs
r8661 r8739 66 66 get { return (ILookupParameter<Permutation>)Parameters["PermutationAfterMutation"]; } 67 67 } 68 public ILookupParameter<ItemCollection<IItem>> OperatorsParameter { 69 get { return (ILookupParameter<ItemCollection<IItem>>)Parameters["Operators"]; } 70 } 71 public IValueParameter<ISingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter { 72 get { return (IValueParameter<ISingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; } 73 } 68 74 #endregion 69 75 … … 112 118 PermutationAfterMutationParameter.ActualName = "TSPTour"; 113 119 120 Parameters.Add(new ValueParameter<ISingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator")); 121 Parameters.Add(new LookupParameter<ItemCollection<IItem>>("Operators", "The operators and items that the problem provides to the algorithms.")); 122 114 123 diversityPlotHelper = new ScatterPlotHelper(false, true); 115 124 qualityPlotHelper = new ScatterPlotHelper(false, true); … … 124 133 Point2D<double> curPoint, divPoint; 125 134 135 if (SimilarityCalculatorParameter.Value == null) { 136 SimilarityCalculatorParameter.Value = OperatorsParameter.ActualValue.OfType<ISingleObjectiveSolutionSimilarityCalculator>().FirstOrDefault(); 137 } 138 126 139 var qualityCX = QualityAfterCrossoverParameter.ActualValue.Value; 127 140 var qualityM = QualityAfterMutationParameter.ActualValue.Value; … … 134 147 avgDataTableHelper.InitializeChart(Results, "Average Mutation Performance", "Average Mutation Performance per Generation"); 135 148 136 divPoint = new Point2D<double>(cnt, TSPSimilarityCalculator.CalculateSimilarity(permutationBefore, permutationAfter)); 149 Scope permutationBeforeScope = new Scope(); 150 Scope permutationAfterScope = new Scope(); 151 permutationBeforeScope.Variables.Add(new Variable(PermutationAfterMutationParameter.ActualName, permutationBefore)); 152 permutationAfterScope.Variables.Add(new Variable(PermutationAfterMutationParameter.ActualName, permutationAfter)); 153 154 divPoint = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(permutationBeforeScope, permutationAfterScope)); 137 155 curPoint = new Point2D<double>(cnt++, qualityCX - qualityM); 138 156 qualityPoints.Add(curPoint.Y);
Note: See TracChangeset
for help on using the changeset viewer.