Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/14/12 15:12:56 (12 years ago)
Author:
ascheibe
Message:

#1886 also track quality of solutions

File:
1 edited

Legend:

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

    r9054 r9058  
    3838
    3939    #region Parameter properties
     40    public IValueLookupParameter<BoolValue> MaximizationParameter {
     41      get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; }
     42    }
    4043    public ILookupParameter<ResultCollection> ResultsParameter {
    4144      get { return (ILookupParameter<ResultCollection>)Parameters[ResultsParameterName]; }
     
    6669    }
    6770    [Storable]
    68     private ScatterPlotHelper populationDiversityPlot, populationQualityPlot;
     71    private ScatterPlotHelper populationDiversityPlot, populationQualityPlot, qualityPlot;
    6972    [Storable]
    7073    private int cnt = 0;
     
    8184      populationDiversityPlot = (ScatterPlotHelper)populationDiversityPlot.Clone(cloner);
    8285      populationQualityPlot = (ScatterPlotHelper)populationQualityPlot.Clone(cloner);
     86      qualityPlot = (ScatterPlotHelper)qualityPlot.Clone(cloner);
    8387    }
    8488
     
    9498      Parameters.Add(new ValueParameter<StringValue>("ChartPostfix", new StringValue(string.Empty)));
    9599      Parameters.Add(new LookupParameter<ItemCollection<IItem>>("Operators", "The operators and items that the problem provides to the algorithms."));
     100      Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, false otherwise"));
    96101
    97102      populationDiversityPlot = new ScatterPlotHelper(false, true);
    98103      populationQualityPlot = new ScatterPlotHelper(false, true);
     104      qualityPlot = new ScatterPlotHelper(false, true);
    99105    }
    100106
     
    110116      populationDiversityPlot.InitializePlot(Results, "Solution to Population Diversity " + ChartPostfixParameter.Value.Value, "Solution Index", "Diversity");
    111117      populationQualityPlot.InitializePlot(Results, "Solution Quality Difference to Population " + ChartPostfixParameter.Value.Value, "Solution Index", "Quality Difference");
     118      qualityPlot.InitializePlot(Results, "Solution Quality " + ChartPostfixParameter.Value.Value, "Solution Index", "Quality");
    112119
    113120      Reset();
     
    147154        }
    148155
    149         var diversityPoint = new Point2D<double>(cnt++, solToPopDiversity / popSize);
    150         var qualityPoint = new Point2D<double>(cnt, Math.Abs((oldPopQuality / popSize) - quality));
     156        Point2D<double> popQualityPoint;
     157        if (MaximizationParameter.ActualValue.Value) {
     158          popQualityPoint = new Point2D<double>(cnt, quality - (oldPopQuality / popSize));
     159        } else {
     160          popQualityPoint = new Point2D<double>(cnt, (oldPopQuality / popSize) - quality);
     161        }
     162
     163        Point2D<double> solQuality = new Point2D<double>(cnt, quality);
     164        Point2D<double> diversityPoint = new Point2D<double>(cnt++, solToPopDiversity / popSize);
    151165
    152166        populationDiversityPlot.AddPoint(curGenStr, diversityPoint);
    153         populationQualityPlot.AddPoint(curGenStr, qualityPoint);
     167        populationQualityPlot.AddPoint(curGenStr, popQualityPoint);
     168        qualityPlot.AddPoint(curGenStr, solQuality);
    154169      }
    155170
     
    165180      populationQualityPlot.CleanUp();
    166181      populationDiversityPlot.CleanUp();
     182      qualityPlot.CleanUp();
    167183    }
    168184
Note: See TracChangeset for help on using the changeset viewer.