Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/04/12 16:19:15 (12 years ago)
Author:
ascheibe
Message:

#1886 removed static method calls to similarity calculators

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/MutationPerformanceAnalyzer.cs

    r8661 r8739  
    6666      get { return (ILookupParameter<Permutation>)Parameters["PermutationAfterMutation"]; }
    6767    }
     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    }
    6874    #endregion
    6975
     
    112118      PermutationAfterMutationParameter.ActualName = "TSPTour";
    113119
     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
    114123      diversityPlotHelper = new ScatterPlotHelper(false, true);
    115124      qualityPlotHelper = new ScatterPlotHelper(false, true);
     
    124133      Point2D<double> curPoint, divPoint;
    125134
     135      if (SimilarityCalculatorParameter.Value == null) {
     136        SimilarityCalculatorParameter.Value = OperatorsParameter.ActualValue.OfType<ISingleObjectiveSolutionSimilarityCalculator>().FirstOrDefault();
     137      }
     138
    126139      var qualityCX = QualityAfterCrossoverParameter.ActualValue.Value;
    127140      var qualityM = QualityAfterMutationParameter.ActualValue.Value;
     
    134147        avgDataTableHelper.InitializeChart(Results, "Average Mutation Performance", "Average Mutation Performance per Generation");
    135148
    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));
    137155        curPoint = new Point2D<double>(cnt++, qualityCX - qualityM);
    138156        qualityPoints.Add(curPoint.Y);
Note: See TracChangeset for help on using the changeset viewer.