Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8498


Ignore:
Timestamp:
08/18/12 00:15:40 (12 years ago)
Author:
ascheibe
Message:

#1886 added helper classes for generating charts

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3
Files:
2 added
4 edited

Legend:

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

    r8415 r8498  
    5656    }
    5757
    58     private DataRow dtRow;
     58    private DataTableHelper chartingHelper;
    5959    #endregion
    6060
     
    6868      SimilarityCalculatorParameter.Value.SolutionVariableName = "TSPTour";
    6969      SimilarityCalculatorParameter.Value.QualityVariableName = "TSPTourLength";
     70
     71      chartingHelper = new DataTableHelper();
    7072    }
    7173
     
    7577
    7678    public override IOperation Apply() {
    77       if (!Results.ContainsKey("Duplicate Solutions")) {
    78         DataTable dt = new DataTable("Duplicate Solutions");
    79         dtRow = new DataRow("Duplicate Solutions per Generation");
    80         dt.Rows.Add(dtRow);
    81         Results.Add(new Result("Duplicate Solutions", dt));
    82       }
     79      chartingHelper.InitializeChart(Results, "Duplicate Solutions", "Duplicate Solutions per Generation");
    8380
    8481      var similarities = SimilarityCalculatorParameter.Value.CalculateSolutionCrowdSimilarity(ExecutionContext.Scope);
     
    9289        }
    9390      }
    94       dtRow.Values.Add(counter);
    9591
     92      chartingHelper.AddPoint(counter);
    9693      return base.Apply();
    9794    }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers-3.3.csproj

    r8496 r8498  
    9696  <ItemGroup>
    9797    <Compile Include="AlgorithmBehaviorHelpers.cs" />
     98    <Compile Include="ScatterPlotHelper.cs" />
     99    <Compile Include="DataTableHelper.cs" />
    98100    <Compile Include="DuplicateSolutionsAnalyzer.cs" />
    99101    <Compile Include="MutationPerformanceAnalyzer.cs" />
     
    106108    <None Include="HeuristicLab.snk" />
    107109    <None Include="Plugin.cs.frame" />
     110    <None Include="Properties\AssemblyInfo.cs.frame" />
    108111  </ItemGroup>
    109112  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/MutationPerformanceAnalyzer.cs

    r8415 r8498  
    7474    #endregion
    7575
    76     ScatterPlot plot, diversityPlot;
    77     DataRow dtRow;
    78     int cnt = 0;
     76
     77    ScatterPlotHelper diversityPlotHelper, qualityPlotHelper;
     78    DataTableHelper avgDataTableHelper;
     79    int cnt = 0, lastGeneration = 0;
     80    List<double> qualityPoints = new List<double>();
    7981
    8082    [StorableConstructor]
     
    9799      Parameters.Add(new LookupParameter<Permutation>("PermutationAfterMutation"));
    98100      PermutationAfterMutationParameter.ActualName = "TSPTour";
     101
     102      diversityPlotHelper = new ScatterPlotHelper();
     103      qualityPlotHelper = new ScatterPlotHelper();
     104      avgDataTableHelper = new DataTableHelper();
    99105    }
    100106
     
    105111    public override IOperation Apply() {
    106112      Point2D<double> curPoint, divPoint;
     113
    107114      var qualityCX = QualityAfterCrossoverParameter.ActualValue.Value;
    108115      var qualityM = QualityAfterMutationParameter.ActualValue.Value;
     
    110117      var permutationAfter = PermutationAfterMutationParameter.ActualValue;
    111118
     119      qualityPlotHelper.InitializePlot(Results, "Mutation Quality", "Solution Index", "Absolut Quality Difference");
     120      diversityPlotHelper.InitializePlot(Results, "Mutation Diversity", "Solution Index", "Diversity");
     121      avgDataTableHelper.InitializeChart(Results, "Average Mutation Performance", "Average Mutation Performance per Generation");
     122
    112123      divPoint = new Point2D<double>(cnt, TSPSimilarityCalculator.CalculateSimilarity(permutationBefore, permutationAfter));
    113124      curPoint = new Point2D<double>(cnt++, qualityCX - qualityM);
     125      qualityPoints.Add(curPoint.Y);
    114126
    115127      string curGenStr = GenerationsParameter.ActualValue.Value.ToString();
    116       ScatterPlotDataRow row, divRow;
    117128
    118       if (!Results.ContainsKey("Mutation Scatter Plot")) {
    119         InitializePlot();
    120         InitializeDiversityPlot();
    121         Results.Add(new Result("Mutation Scatter Plot", plot));
    122         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()));
    125         cnt = 0;
     129      qualityPlotHelper.AddPoint(curGenStr, curPoint);
     130      diversityPlotHelper.AddPoint(curGenStr, divPoint);
    126131
    127         DataTable dt = new DataTable("Average Mutation Performance");
    128         dtRow = new DataRow("Average Mutation Performance per Generation");
    129         dt.Rows.Add(dtRow);
    130         Results.Add(new Result("Average Mutation Performance", dt));
    131       }
    132 
    133       if (!plot.Rows.ContainsKey(curGenStr)) {
    134         if (GenerationsParameter.ActualValue.Value != 0) {
    135           if (plot.Rows.ContainsKey((GenerationsParameter.ActualValue.Value - 1).ToString())) {
    136             double avg = plot.Rows[(GenerationsParameter.ActualValue.Value - 1).ToString()].Points.Average(x => x.Y);
    137             dtRow.Values.Add(avg);
    138             ((ScatterPlotHistory)Results["Mutation Scatter Plot History"].Value).Add(plot);
    139             ((ScatterPlotHistory)Results["Mutation Diversity Plot History"].Value).Add(diversityPlot);
    140           }
    141           InitializePlot();
    142           InitializeDiversityPlot();
    143           Results["Mutation Scatter Plot"].Value = plot;
    144           Results["Mutation Diversity Plot"].Value = diversityPlot;
     132      if (GenerationsParameter.ActualValue.Value != 0) {
     133        if (GenerationsParameter.ActualValue.Value > lastGeneration) {
     134          double avg = qualityPoints.Average();
     135          avgDataTableHelper.AddPoint(avg);
    145136          cnt = 0;
     137          lastGeneration = GenerationsParameter.ActualValue.Value;
     138          qualityPoints.Clear();
    146139        }
    147 
    148         var points = new List<Point2D<double>>();
    149         points.Add(curPoint);
    150         row = new ScatterPlotDataRow(curGenStr, null, points);
    151         row.VisualProperties.PointStyle = ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle;
    152         row.VisualProperties.PointSize = 5;
    153         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);
    161       } else {
    162         plot.Rows[curGenStr].Points.Add(curPoint);
    163         diversityPlot.Rows[curGenStr].Points.Add(divPoint);
    164140      }
    165141
    166142      return base.Apply();
    167143    }
    168 
    169     private void InitializePlot() {
    170       plot = new ScatterPlot("Mutation Performance", null);
    171       plot.VisualProperties.XAxisTitle = "Solution Index";
    172       plot.VisualProperties.YAxisTitle = "Absolut Quality Difference";
    173     }
    174 
    175     private void InitializeDiversityPlot() {
    176       diversityPlot = new ScatterPlot("Mutation Diversity", null);
    177       diversityPlot.VisualProperties.XAxisTitle = "Solution Index";
    178       diversityPlot.VisualProperties.YAxisTitle = "Diversity";
    179     }
    180144  }
    181145}
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/Properties/AssemblyInfo.cs.frame

    r8336 r8498  
    2727// set of attributes. Change these attribute values to modify the information
    2828// associated with an assembly.
    29 [assembly: AssemblyTitle("HeuristicLab.Analysis.AlgorithmBehavior")]
    30 [assembly: AssemblyDescription("Provides operators and related classes for tracking the evolution within a GA.")]
     29[assembly: AssemblyTitle("HeuristicLab.Analysis.AlgorithmBehavior.Analyzers")]
     30[assembly: AssemblyDescription("Provides analyzers for tracking the behavior of GAs.")]
    3131[assembly: AssemblyConfiguration("")]
    3232[assembly: AssemblyCompany("")]
     
    5454// by using the '*' as shown below:
    5555[assembly: AssemblyVersion("3.3.0.0")]
    56 [assembly: AssemblyFileVersion("3.3.6.$WCREV$")]
     56[assembly: AssemblyFileVersion("3.3.7.$WCREV$")]
Note: See TracChangeset for help on using the changeset viewer.