Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/18/16 13:50:08 (7 years ago)
Author:
bwerth
Message:

#1087 removed NormalizedHypervolumeAnalyzer and IMOFrontModel.cs, refactored ScatterPlotAnalyzer ,fixed bug in HypervolumeAnalyzer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Analyzers/HypervolumeAnalyzer.cs

    r14090 r14092  
    3535  public class HypervolumeAnalyzer : MOTFAnalyzer {
    3636
     37    public ILookupParameter<DoubleArray> ReferencePointParameter {
     38      get { return (ILookupParameter<DoubleArray>)Parameters["ReferencePoint"]; }
     39    }
     40
    3741    [StorableConstructor]
    38     protected HypervolumeAnalyzer(bool deserializing) : base(deserializing) { }
     42    protected HypervolumeAnalyzer(bool deserializing) : base(deserializing) {
     43    }
    3944
    4045    protected HypervolumeAnalyzer(HypervolumeAnalyzer original, Cloner cloner)
     
    4550    }
    4651
    47     public HypervolumeAnalyzer() { }
     52    public HypervolumeAnalyzer() {
     53      Parameters.Add(new LookupParameter<DoubleArray>("ReferencePoint", "The reference point for hypervolume calculation"));
     54    }
    4855
    4956    public override IOperation Apply() {
     
    5259      var testFunction = TestFunctionParameter.ActualValue;
    5360      int objectives = qualities[0].Length;
    54       var referencePoint = testFunction.ReferencePoint(objectives);
     61      var referencePoint = ReferencePointParameter.ActualValue;
    5562
    56       if (!results.ContainsKey("Hypervolume")) results.Add(new Result("Hypervolume", typeof(DoubleValue)));
    57       if (!results.ContainsKey("Absolute Distance to BestKnownHypervolume")) results.Add(new Result("Absolute Distance to BestKnownHypervolume", typeof(DoubleValue)));
     63      if (!results.ContainsKey("Hypervolume")) results.Add(new Result("Hypervolume", new DoubleValue(0)));
     64      if (!results.ContainsKey("Absolute Distance to BestKnownHypervolume")) results.Add(new Result("Absolute Distance to BestKnownHypervolume", new DoubleValue(0)));
    5865
    5966      double best = testFunction.OptimalHypervolume(objectives);
    6067      if (!results.ContainsKey("BestKnownHypervolume")) {
    61         results.Add(new Result("BestKnownHypervolume", typeof(DoubleValue)));
     68        results.Add(new Result("BestKnownHypervolume", new DoubleValue(0)));
     69      } else {
     70        best = Math.Max(best, ((DoubleValue)(results["BestKnownHypervolume"].Value)).Value);
    6271      }
    63       best = Math.Max(best, ((DoubleValue)(results["BestKnownHypervolume"].Value)).Value);
     72
    6473
    6574      IEnumerable<double[]> front = NonDominatedSelect.SelectNonDominatedVectors(qualities.Select(q => q.ToArray()), testFunction.Maximization(objectives), true);
    6675
    67       double hv = Hypervolume.Calculate(front, (double[])referencePoint.Clone(), testFunction.Maximization(objectives));
     76      double hv = Hypervolume.Calculate(front, referencePoint.ToArray(), testFunction.Maximization(objectives));
    6877
    6978      if (double.IsNaN(best) || best < hv) {
Note: See TracChangeset for help on using the changeset viewer.