Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/18/16 10:50:15 (8 years ago)
Author:
bwerth
Message:

#1087 bugfix + additional relative HV calculation added

File:
1 edited

Legend:

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

    r13729 r13771  
    161161    }
    162162
     163    public IEnumerable<double[]> BestKnownFront {
     164      get {
     165        return Parameters.ContainsKey("BestKnownFront") ? TestFunction.OptimalParetoFront(Objectives) : null;
     166      }
     167    }
     168
    163169    public double[] Evaluate(RealVector individual, IRandom random) {
    164170      return TestFunction.Evaluate(individual, Objectives);
     
    228234        || ProblemSize > TestFunction.MaximumSolutionLength)
    229235        ProblemSize = Math.Min(TestFunction.MaximumSolutionLength, Math.Max(TestFunction.MinimumSolutionLength, ProblemSize));
     236
     237
    230238      Parameterize();
    231239    }
     
    244252      Operators.Add(new SpacingAnalyzer());
    245253      Operators.Add(new ScatterPlotAnalyzer());
     254      Operators.Add(new NormalizedHypervolumeAnalyzer());
    246255      ParameterizeAnalyzers();
    247256      Parameterize();
     
    250259    private void Parameterize() {
    251260      MaximizationParameter.ActualValue = new BoolArray(Maximization);
     261      var front = BestKnownFront;
     262      if (front != null) { BestKnownFrontParameter.ActualValue = new DoubleMatrix(To2D(front.ToArray<double[]>())); }
     263
    252264    }
    253265
     
    259271        analyzer.BestKnownFrontParameter.ActualName = BestKnownFrontParameter.Name;
    260272
    261         BestKnownFrontParameter.ActualValue = new DoubleMatrix(To2D(TestFunction.OptimalParetoFront(Objectives).ToArray<double[]>()));
     273
     274        var front = BestKnownFront;
     275        if (front != null) { BestKnownFrontParameter.ActualValue = new DoubleMatrix(To2D(front.ToArray<double[]>())); }
     276
     277
    262278        if (analyzer is HypervolumeAnalyzer) {
    263279          ((HypervolumeAnalyzer)analyzer).ReferencePointParameter.Value = new DoubleArray(TestFunction.ReferencePoint(Objectives));
     
    265281        }
    266282
     283        if (analyzer is NormalizedHypervolumeAnalyzer) {
     284          ((NormalizedHypervolumeAnalyzer)analyzer).OptimalFrontParameter.ActualValue = (DoubleMatrix)BestKnownFrontParameter.ActualValue;
     285        }
     286
    267287      }
    268288    }
Note: See TracChangeset for help on using the changeset viewer.