Package org.uma.jmetal.util
Class SolutionUtils
java.lang.Object
org.uma.jmetal.util.SolutionUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <S extends Solution<?>>
doubleaverageDistanceToSolutionList(S solution, List<S> solutionList) Returns the average euclidean distance of a solution to the solutions of a list.static <S extends Solution<?>>
doubledistanceBetweenObjectives(S firstSolution, S secondSolution) Returns the Euclidean distance between a pair of solutions in the objective spacestatic doubledistanceBetweenSolutionsInObjectiveSpace(DoubleSolution solutionI, DoubleSolution solutionJ) Returns the distance between two solutions in the search space.static doubledistanceToSolutionListInSolutionSpace(DoubleSolution solution, List<DoubleSolution> solutionList) Returns the minimum distance from aSolutionto aSolutionSet according to the encodings.variable values.static <S extends Solution<?>>
SgetBestSolution(S solution1, S solution2, Comparator<S> comparator) Return the best solution between those passed as arguments.static <S extends Solution<?>>
SgetBestSolution(S solution1, S solution2, Comparator<S> comparator, BinaryOperator<S> equalityPolicy) Return the best solution between those passed as arguments.static <S extends Solution<?>>
SgetBestSolution(S solution1, S solution2, Comparator<S> comparator, RandomGenerator<Double> randomGenerator) Return the best solution between those passed as arguments.static <S extends Solution<?>>
Snormalize(S solution, double[] minValues, double[] maxValues) It returns the normalized solution given the minimum and maximum values for each objectivestatic <S extends Solution<?>>
doublenormalizedDistanceBetweenObjectives(S firstSolution, S secondSolution, double[] maxs, double[] mins)
-
Constructor Details
-
SolutionUtils
public SolutionUtils()
-
-
Method Details
-
getBestSolution
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator) Return the best solution between those passed as arguments. If they are equal or incomparable one of them is chosen randomly.- Returns:
- The best solution
-
getBestSolution
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator, RandomGenerator<Double> randomGenerator) Return the best solution between those passed as arguments. If they are equal or incomparable one of them is chosen randomly.- Parameters:
randomGenerator-RandomGeneratorfor the equality case- Returns:
- The best solution
-
getBestSolution
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator, BinaryOperator<S> equalityPolicy) Return the best solution between those passed as arguments. If they are equal or incomparable one of them is chosen based on the given policy.- Returns:
- The best solution
-
distanceBetweenObjectives
public static <S extends Solution<?>> double distanceBetweenObjectives(S firstSolution, S secondSolution) Returns the Euclidean distance between a pair of solutions in the objective space -
normalizedDistanceBetweenObjectives
public static <S extends Solution<?>> double normalizedDistanceBetweenObjectives(S firstSolution, S secondSolution, double[] maxs, double[] mins) -
distanceToSolutionListInSolutionSpace
public static double distanceToSolutionListInSolutionSpace(DoubleSolution solution, List<DoubleSolution> solutionList) Returns the minimum distance from aSolutionto aSolutionSet according to the encodings.variable values.- Parameters:
solution- TheSolution.solutionList- TheList.invalid input: '<'/> - Returns:
- The minimum distance between solution and the set.
-
distanceBetweenSolutionsInObjectiveSpace
public static double distanceBetweenSolutionsInObjectiveSpace(DoubleSolution solutionI, DoubleSolution solutionJ) Returns the distance between two solutions in the search space.- Parameters:
solutionI- The firstSolution.solutionJ- The secondSolution.- Returns:
- the distance between solutions.
-
averageDistanceToSolutionList
-
normalize
public static <S extends Solution<?>> S normalize(S solution, double[] minValues, double[] maxValues) It returns the normalized solution given the minimum and maximum values for each objective- Parameters:
solution- to be normalizedminValues- minimum values for each objectivemaxValues- maximum value for each objective- Returns:
- normalized solution
-