Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8511


Ignore:
Timestamp:
08/21/12 13:32:05 (12 years ago)
Author:
ascheibe
Message:

#1886 added an option so that the scatter plot helper can now also produce data tables

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

    r8505 r8511  
    128128      Parameters.Add(new ValueParameter<SingleObjectiveSolutionSimilarityCalculator>("SimilarityCalculator"));
    129129
    130       plotHelper = new ScatterPlotHelper();
    131       childDiversityHelper = new ScatterPlotHelper();
    132       parentDiversityHelper = new ScatterPlotHelper();
     130      plotHelper = new ScatterPlotHelper(false, true);
     131      childDiversityHelper = new ScatterPlotHelper(false, true);
     132      parentDiversityHelper = new ScatterPlotHelper(false, true);
    133133      performanceHelper = new DataTableHelper();
    134134      successHelper = new DataTableHelper();
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/MutationPerformanceAnalyzer.cs

    r8505 r8511  
    112112      PermutationAfterMutationParameter.ActualName = "TSPTour";
    113113
    114       diversityPlotHelper = new ScatterPlotHelper();
    115       qualityPlotHelper = new ScatterPlotHelper();
     114      diversityPlotHelper = new ScatterPlotHelper(false, true);
     115      qualityPlotHelper = new ScatterPlotHelper(false, true);
    116116      avgDataTableHelper = new DataTableHelper();
    117117    }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.AlgorithmBehavior.Analyzers/3.3/ScatterPlotHelper.cs

    r8505 r8511  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    3940    [Storable]
    4041    private string yAxisTitle;
     42    [Storable]
     43    public bool StoreHistory { get; set; }
     44    [Storable]
     45    public bool CreateDataTable { get; set; }
     46    [Storable]
     47    public DataTableHelper dataTableHelper;
     48    [Storable]
     49    private string lastRowName;
    4150
    4251    [Storable]
     
    5564      xAxisTitle = original.xAxisTitle;
    5665      yAxisTitle = original.yAxisTitle;
     66      StoreHistory = original.StoreHistory;
    5767      plot = (ScatterPlot)original.plot.Clone(cloner);
     68      CreateDataTable = original.CreateDataTable;
     69      if (original.dataTableHelper != null)
     70        dataTableHelper = (DataTableHelper)original.dataTableHelper.Clone(cloner);
     71      lastRowName = original.lastRowName;
    5872    }
    59     public ScatterPlotHelper() : base() { }
     73
     74    public ScatterPlotHelper()
     75      : base() {
     76      StoreHistory = true;
     77      CreateDataTable = false;
     78    }
     79
     80    public ScatterPlotHelper(bool storeHistory, bool createDataTable)
     81      : base() {
     82      StoreHistory = storeHistory;
     83      CreateDataTable = createDataTable;
     84    }
    6085
    6186    public override IDeepCloneable Clone(Cloner cloner) {
     
    6489
    6590    public void InitializePlot(ResultCollection results, string chartName, string xAxisTitle, string yAxisTitle) {
     91      if (CreateDataTable) {
     92        if (dataTableHelper == null) {
     93          dataTableHelper = new DataTableHelper();
     94        }
     95        dataTableHelper.InitializeChart(results, chartName + " Chart", yAxisTitle);
     96      }
     97
    6698      if (!results.ContainsKey(chartName)) {
    6799        this.chartName = chartName;
     
    73105
    74106        results.Add(new Result(chartName, Plot));
    75         results.Add(new Result(chartName + " History", new ScatterPlotHistory()));
     107        if (StoreHistory)
     108          results.Add(new Result(chartName + " History", new ScatterPlotHistory()));
    76109      }
    77110    }
     
    79112    public void AddPoint(string rowName, Point2D<double> point) {
    80113      if (!Plot.Rows.ContainsKey(rowName)) {
    81         ((ScatterPlotHistory)resultsCol[chartName + " History"].Value).Add(Plot);
     114        if (StoreHistory)
     115          ((ScatterPlotHistory)resultsCol[chartName + " History"].Value).Add(Plot);
     116
     117        if (CreateDataTable && lastRowName != null && lastRowName != string.Empty) {
     118          double avg = Plot.Rows[lastRowName].Points.Average(x => x.Y);
     119          dataTableHelper.AddPoint(avg);
     120        }
     121
    82122        Initialize();
    83123        resultsCol[chartName].Value = Plot;
     
    89129        row.VisualProperties.PointSize = 5;
    90130        Plot.Rows.Add(row);
     131        lastRowName = rowName;
    91132      } else {
    92133        Plot.Rows[rowName].Points.Add(point);
Note: See TracChangeset for help on using the changeset viewer.