- Timestamp:
- 07/27/20 20:14:29 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2825-NSGA3/HeuristicLab.Algorithms.NSGA3/3.3/NSGA3.cs
r17700 r17701 83 83 private const string GenerationalDistanceResultName = "Generational Distance"; 84 84 private const string InvertedGenerationalDistanceResultName = "Inverted Generational Distance"; 85 private const string HypervolumeResultName = "Hypervolume"; 86 private const string BestKnownHypervolumeResultName = "Best known hypervolume"; 87 private const string DifferenceToBestKnownHypervolumeResultName = "Absolute Distance to BestKnownHypervolume"; 85 88 private const string ScatterPlotResultName = "Scatter Plot"; 86 89 private const string CurrentFrontResultName = "Pareto Front"; // Do not touch this … … 171 174 get { return (DoubleValue)Results[InvertedGenerationalDistanceResultName].Value; } 172 175 set { Results[InvertedGenerationalDistanceResultName].Value = value; } 176 } 177 178 public DoubleValue ResultsHypervolume 179 { 180 get { return (DoubleValue)Results[HypervolumeResultName].Value; } 181 set { Results[HypervolumeResultName].Value = value; } 182 } 183 184 public DoubleValue ResultsBestKnownHypervolume 185 { 186 get { return (DoubleValue)Results[BestKnownHypervolumeResultName].Value; } 187 set { Results[BestKnownHypervolumeResultName].Value = value; } 188 } 189 190 public DoubleValue ResultsDifferenceToBestKnownHypervolume 191 { 192 get { return (DoubleValue)Results[DifferenceToBestKnownHypervolumeResultName].Value; } 193 set { Results[DifferenceToBestKnownHypervolumeResultName].Value = value; } 173 194 } 174 195 … … 250 271 Results.Add(new Result(GenerationalDistanceResultName, "The generational distance to an optimal pareto front defined in the Problem", new DoubleValue(double.NaN))); 251 272 Results.Add(new Result(InvertedGenerationalDistanceResultName, "The inverted generational distance to an optimal pareto front defined in the Problem", new DoubleValue(double.NaN))); 273 Results.Add(new Result(HypervolumeResultName, "The hypervolume of the current front considering the Reference point defined in the Problem", new DoubleValue(double.NaN))); 274 Results.Add(new Result(BestKnownHypervolumeResultName, "The best known hypervolume considering the Reference point defined in the Problem", new DoubleValue(double.NaN))); 275 Results.Add(new Result(DifferenceToBestKnownHypervolumeResultName, "The difference between the current and the best known hypervolume", new DoubleValue(double.NaN))); 252 276 Results.Add(new Result(ScatterPlotResultName, "A scatterplot displaying the evaluated solutions and (if available) the analytically optimal front", new ParetoFrontScatterPlot())); 253 277 Results.Add(new Result(CurrentFrontResultName, "The Pareto Front", new DoubleMatrix())); … … 256 280 // todo: add BestKnownFront parameter 257 281 ResultsScatterPlot = new ParetoFrontScatterPlot(new double[0][], new double[0][], problem.BestKnownFront.ToJaggedArray(), problem.Objectives, problem.ProblemSize); 282 ResultsBestKnownHypervolume = new DoubleValue(Hypervolume.Calculate(problem.BestKnownFront.ToJaggedArray(), problem.ReferencePoint.CloneAsArray(), problem.Maximization)); 258 283 } 259 284 … … 262 287 random = new MersenneTwister(); 263 288 solutions = GetInitialPopulation(); 264 InitReferencePoints();265 }266 267 private void InitReferencePoints()268 {269 // Generate reference points and add them to results270 289 referencePoints = ReferencePoint.GenerateReferencePoints(random, NumberOfObjectives); 271 290 ResultsGeneratedReferencePoints = Utility.ConvertToDoubleMatrix(referencePoints); … … 348 367 if (!(Problem is MultiObjectiveTestFunctionProblem problem)) return; 349 368 369 // Indicators 350 370 ResultsGenerationalDistance = new DoubleValue(problem.BestKnownFront != null ? GenerationalDistance.Calculate(solutions.Select(s => s.Fitness), problem.BestKnownFront.ToJaggedArray(), 1) : double.NaN); 351 371 ResultsInvertedGenerationalDistance = new DoubleValue(problem.BestKnownFront != null ? InvertedGenerationalDistance.Calculate(solutions.Select(s => s.Fitness), problem.BestKnownFront.ToJaggedArray(), 1) : double.NaN); 372 373 var front = NonDominatedSelect.GetDominatingVectors(solutions.Select(x => x.Fitness), problem.ReferencePoint.CloneAsArray(), Problem.Maximization, true).ToArray(); 374 if (front.Length == 0) return; 375 ResultsHypervolume = new DoubleValue(Hypervolume.Calculate(front, problem.ReferencePoint.CloneAsArray(), problem.Maximization)); 376 ResultsDifferenceToBestKnownHypervolume = new DoubleValue(ResultsBestKnownHypervolume.Value - ResultsHypervolume.Value); 352 377 353 378 Problem.Analyze(
Note: See TracChangeset
for help on using the changeset viewer.