Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/05/12 22:05:23 (12 years ago)
Author:
ascheibe
Message:

#1886 worked on mutation performance analyzer

File:
1 edited

Legend:

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

    r8410 r8411  
    2929using HeuristicLab.Operators;
    3030using HeuristicLab.Optimization;
    31 using HeuristicLab.Optimization.Operators;
    3231using HeuristicLab.Parameters;
    3332using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     33using HeuristicLab.Problems.TravelingSalesman;
    3434
    3535namespace HeuristicLab.Analysis.AlgorithmBehavior.Analyzers {
     
    6666      get { return (ILookupParameter<Permutation>)Parameters["PermutationAfterMutation"]; }
    6767    }
    68     public IValueParameter<SingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter {
    69       get { return (IValueParameter<SingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; }
    70     }
    7168    #endregion
    7269
     
    7875
    7976    ScatterPlot plot, diversityPlot;
    80     DataRow dtRow, dtDivRow;
     77    DataRow dtRow;
    8178    int cnt = 0;
    8279
     
    9693
    9794      Parameters.Add(new LookupParameter<Permutation>("PermutationBeforeMutation"));
    98       QualityAfterMutationParameter.ActualName = "TSPTourClone";
     95      PermutationBeforeMutationParameter.ActualName = "TSPTourClone";
    9996
    10097      Parameters.Add(new LookupParameter<Permutation>("PermutationAfterMutation"));
    101       QualityAfterMutationParameter.ActualName = "TSPTour";
    102 
    103       Parameters.Add(new ValueParameter<SingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator"));
     98      PermutationAfterMutationParameter.ActualName = "TSPTour";
    10499    }
    105100
     
    109104
    110105    public override IOperation Apply() {
    111       Point2D<double> curPoint;
     106      Point2D<double> curPoint, divPoint;
    112107      var qualityCX = QualityAfterCrossoverParameter.ActualValue.Value;
    113108      var qualityM = QualityAfterMutationParameter.ActualValue.Value;
     109      var permutationBefore = PermutationBeforeMutationParameter.ActualValue;
     110      var permutationAfter = PermutationAfterMutationParameter.ActualValue;
    114111
     112      divPoint = new Point2D<double>(cnt, TSPSimilarityCalculator.CalculateSimilarity(permutationBefore, permutationAfter));
    115113      curPoint = new Point2D<double>(cnt++, qualityCX - qualityM);
    116114
    117115      string curGenStr = GenerationsParameter.ActualValue.Value.ToString();
    118       ScatterPlotDataRow row;
     116      ScatterPlotDataRow row, divRow;
    119117
    120118      if (!Results.ContainsKey("Mutation Scatter Plot")) {
    121119        InitializePlot();
     120        InitializeDiversityPlot();
    122121        Results.Add(new Result("Mutation Scatter Plot", plot));
    123122        Results.Add(new Result("Mutation Scatter Plot History", new ScatterPlotHistory()));
     123        Results.Add(new Result("Mutation Diversity Plot", diversityPlot));
     124        Results.Add(new Result("Mutation Diversity Plot History", new ScatterPlotHistory()));
    124125        cnt = 0;
    125126
     
    136137            dtRow.Values.Add(avg);
    137138            ((ScatterPlotHistory)Results["Mutation Scatter Plot History"].Value).Add(plot);
     139            ((ScatterPlotHistory)Results["Mutation Diversity Plot History"].Value).Add(diversityPlot);
    138140          }
    139141          InitializePlot();
     142          InitializeDiversityPlot();
    140143          Results["Mutation Scatter Plot"].Value = plot;
     144          Results["Mutation Diversity Plot"].Value = diversityPlot;
    141145          cnt = 0;
    142146        }
     
    148152        row.VisualProperties.PointSize = 5;
    149153        plot.Rows.Add(row);
     154
     155        points = new List<Point2D<double>>();
     156        points.Add(divPoint);
     157        divRow = new ScatterPlotDataRow(curGenStr, null, points);
     158        divRow.VisualProperties.PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle;
     159        divRow.VisualProperties.PointSize = 5;
     160        diversityPlot.Rows.Add(divRow);
    150161      } else {
    151162        plot.Rows[curGenStr].Points.Add(curPoint);
     163        diversityPlot.Rows[curGenStr].Points.Add(divPoint);
    152164      }
    153165
Note: See TracChangeset for help on using the changeset viewer.