Changeset 13672 for branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Calculators/InvertedGenerationalDistance.cs
- Timestamp:
- 03/09/16 12:44:23 (8 years ago)
- Location:
- branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Calculators
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Calculators/InvertedGenerationalDistance.cs
r13620 r13672 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 2 21 using System.Collections.Generic; 3 using HeuristicLab.Encodings.RealVectorEncoding;4 using HeuristicLab.Problems.MultiObjectiveTestFunctions.Comparators;5 22 6 23 namespace HeuristicLab.Problems.MultiObjectiveTestFunctions { 24 7 25 /// <summary> 8 26 /// The inverted generational Distance is defined as the mean of a all d[i]^(1/p), 9 27 /// where d[i] is the minimal distance the ith point of the optimal pareto front has to any point in the evaluated front. 10 28 /// </summary> 11 public class InvertedGenerationalDistance : IMultiObjectiveDistance { 12 private double p; 29 public class InvertedGenerationalDistance { 13 30 14 public InvertedGenerationalDistance(double p) { 15 if (p <= 0) throw new ArgumentOutOfRangeException("weighting factor p has to be greater than 0"); 16 this.p = 1 / p; 17 } 18 19 /// <summary> 20 /// 21 /// </summary> 22 /// <param name="front"></param> 23 /// <param name="optimalFront"></param> 24 /// <param name="p"></param> 25 /// <returns></returns> 26 public static double GetDistance(IEnumerable<double[]> front, IEnumerable<double[]> optimalFront, double p) { 27 return new InvertedGenerationalDistance(p).Compare(front, optimalFront); 28 } 29 30 public double Compare(IEnumerable<double[]> front, IEnumerable<double[]> optimalFront) { 31 return new GenerationalDistance(p).Compare(optimalFront, front); 31 public static double Calculate(IEnumerable<double[]> front, IEnumerable<double[]> optimalFront, double p) { 32 return GenerationalDistance.Calculate(optimalFront, front, p); 32 33 } 33 34 }
Note: See TracChangeset
for help on using the changeset viewer.