Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8382 for branches


Ignore:
Timestamp:
08/02/12 10:08:05 (12 years ago)
Author:
ascheibe
Message:

#1886 added more plots for crossover performance analysis

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
Files:
3 edited

Legend:

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

    r8337 r8382  
    2929using HeuristicLab.Operators;
    3030using HeuristicLab.Optimization;
     31using HeuristicLab.Optimization.Operators;
    3132using HeuristicLab.Parameters;
    3233using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    6566      get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; }
    6667    }
     68    public IValueParameter<SingleObjectiveSolutionSimilarityCalculator> SimilarityCalculatorParameter {
     69      get { return (IValueParameter<SingleObjectiveSolutionSimilarityCalculator>)Parameters["SimilarityCalculator"]; }
     70    }
    6771    #endregion
    6872
     
    7377    #endregion
    7478
    75     ScatterPlot plot;
    76     DataRow dtRow;
     79    ScatterPlot plot, childDiversityPlot, parentDiversityPlot;
     80    DataRow dtRow, dtRowSuccess;
    7781    int cnt = 0;
     82    int success = 0;
    7883
    7984    [StorableConstructor]
     
    96101      Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The evaluated quality of the child solution."));
    97102      QualityParameter.ActualName = "TSPTourLength";
     103
     104      Parameters.Add(new ValueParameter<SingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator"));
    98105    }
    99106
     
    103110
    104111    public override IOperation Apply() {
     112      SimilarityCalculatorParameter.Value.QualityVariableName = "TSPTourLength";
     113      SimilarityCalculatorParameter.Value.SolutionVariableName = "TSPTour";
     114
     115      Point2D<double> qualityPoint, diversityPointChild, diversityPointParent;
    105116      var qualityParent1 = ParentsQualityParameter.ActualValue.First().Value;
    106117      var qualityParent2 = ParentsQualityParameter.ActualValue.Last().Value;
    107       Point2D<double> curPoint;
    108 
     118      var child = ChildParameter.ActualValue;
     119      var parent1 = ParentsParameter.ActualValue.First();
     120      var parent2 = ParentsParameter.ActualValue.Last();
     121      var parentDiversity = SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope.SubScopes.First(), ExecutionContext.Scope.SubScopes.Last());
     122
     123      diversityPointParent = new Point2D<double>(cnt, parentDiversity);
    109124      double worseQuality = qualityParent1 > qualityParent2 ? qualityParent1 : qualityParent2;
    110       curPoint = new Point2D<double>(cnt++, worseQuality - QualityParameter.ActualValue.Value);
     125      if (qualityParent1 > qualityParent2) {
     126        diversityPointChild = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.First()));
     127      } else {
     128        diversityPointChild = new Point2D<double>(cnt, SimilarityCalculatorParameter.Value.CalculateSolutionSimilarity(ExecutionContext.Scope, ExecutionContext.Scope.SubScopes.Last()));
     129      }
     130
     131      qualityPoint = new Point2D<double>(cnt++, worseQuality - QualityParameter.ActualValue.Value);
     132      if ((worseQuality - QualityParameter.ActualValue.Value) > 0) {
     133        success++;
     134      }
    111135
    112136      string curGenStr = GenerationsParameter.ActualValue.Value.ToString();
    113       ScatterPlotDataRow row;
    114137
    115138      if (!Results.ContainsKey("Scatter Plot")) {
    116139        InitializePlot();
     140        InitializeChildDiversityPlot();
     141        InitializeParentDiversityPlot();
     142
    117143        Results.Add(new Result("Scatter Plot", plot));
    118144        Results.Add(new Result("Scatter Plot History", new ScatterPlotHistory()));
     145
     146        Results.Add(new Result("Child Diversity Scatter Plot", childDiversityPlot));
     147        Results.Add(new Result("Child Diversity Scatter Plot History", new ScatterPlotHistory()));
     148
     149        Results.Add(new Result("Parent Diversity Scatter Plot", parentDiversityPlot));
     150        Results.Add(new Result("Parent Diversity Scatter Plot History", new ScatterPlotHistory()));
    119151        cnt = 0;
    120152
     
    123155        dt.Rows.Add(dtRow);
    124156        Results.Add(new Result("Average Crossover Performance", dt));
     157
     158        DataTable dtSuccess = new DataTable("Successfull Crossovers");
     159        dtRowSuccess = new DataRow("Successfull Crossovers per Generation");
     160        dtSuccess.Rows.Add(dtRowSuccess);
     161        Results.Add(new Result("Successfull Crossovers", dtSuccess));
     162
     163        success = 0;
    125164      }
    126165
     
    129168          double avg = plot.Rows[(GenerationsParameter.ActualValue.Value - 1).ToString()].Points.Average(x => x.Y);
    130169          dtRow.Values.Add(avg);
     170          dtRowSuccess.Values.Add(success);
    131171
    132172          ((ScatterPlotHistory)Results["Scatter Plot History"].Value).Add(plot);
     173          ((ScatterPlotHistory)Results["Child Diversity Scatter Plot History"].Value).Add(childDiversityPlot);
     174          ((ScatterPlotHistory)Results["Parent Diversity Scatter Plot History"].Value).Add(parentDiversityPlot);
    133175          InitializePlot();
     176          InitializeChildDiversityPlot();
     177          InitializeParentDiversityPlot();
    134178          Results["Scatter Plot"].Value = plot;
     179          Results["Child Diversity Scatter Plot"].Value = childDiversityPlot;
     180          Results["Parent Diversity Scatter Plot"].Value = parentDiversityPlot;
    135181          cnt = 0;
     182          success = 0;
    136183        }
    137184
    138185        var points = new List<Point2D<double>>();
    139         points.Add(curPoint);
     186        points.Add(qualityPoint);
     187        ScatterPlotDataRow row;
    140188        row = new ScatterPlotDataRow(curGenStr, null, points);
    141189        row.VisualProperties.PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle;
    142190        row.VisualProperties.PointSize = 5;
    143191        plot.Rows.Add(row);
     192
     193        points = new List<Point2D<double>>();
     194        points.Add(diversityPointChild);
     195        row = new ScatterPlotDataRow(curGenStr, null, points);
     196        row.VisualProperties.PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle;
     197        row.VisualProperties.PointSize = 5;
     198        childDiversityPlot.Rows.Add(row);
     199
     200        points = new List<Point2D<double>>();
     201        points.Add(diversityPointParent);
     202        row = new ScatterPlotDataRow(curGenStr, null, points);
     203        row.VisualProperties.PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle;
     204        row.VisualProperties.PointSize = 5;
     205        parentDiversityPlot.Rows.Add(row);
    144206      } else {
    145         plot.Rows[curGenStr].Points.Add(curPoint);
     207        plot.Rows[curGenStr].Points.Add(qualityPoint);
     208        childDiversityPlot.Rows[curGenStr].Points.Add(diversityPointChild);
     209        parentDiversityPlot.Rows[curGenStr].Points.Add(diversityPointParent);
    146210      }
    147211
     
    154218      plot.VisualProperties.YAxisTitle = "Absolut Quality Difference";
    155219    }
     220    private void InitializeChildDiversityPlot() {
     221      childDiversityPlot = new ScatterPlot("Child Diversity", null);
     222      childDiversityPlot.VisualProperties.XAxisTitle = "Solution Index";
     223      childDiversityPlot.VisualProperties.YAxisTitle = "Diversity";
     224    }
     225    private void InitializeParentDiversityPlot() {
     226      parentDiversityPlot = new ScatterPlot("Parent Diversity", null);
     227      parentDiversityPlot.VisualProperties.XAxisTitle = "Solution Index";
     228      parentDiversityPlot.VisualProperties.YAxisTitle = "Diversity";
     229    }
    156230  }
    157231}
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj

    r8352 r8382  
    7070      <Private>False</Private>
    7171    </Reference>
     72    <Reference Include="HeuristicLab.Optimization.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     73      <Private>True</Private>
     74    </Reference>
    7275    <Reference Include="HeuristicLab.Parameters-3.3">
    7376      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Plugin.cs.frame

    r8336 r8382  
    3232  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3333  [PluginDependency("HeuristicLab.Optimization", "3.3")]
     34  [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")]
    3435  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    3536  [PluginDependency("HeuristicLab.Persistence", "3.3")]
Note: See TracChangeset for help on using the changeset viewer.