Class SolutionUtils

java.lang.Object
org.uma.jmetal.util.SolutionUtils

public class SolutionUtils extends Object
Created by Antonio J. Nebro on 6/12/14.
  • 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 - RandomGenerator for 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 a Solution to a SolutionSet according to the encodings.variable values.
      Parameters:
      solution - The Solution.
      solutionList - The List</>.
      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 first Solution.
      solutionJ - The second Solution.
      Returns:
      the distance between solutions.
    • averageDistanceToSolutionList

      public static <S extends Solution<?>> double averageDistanceToSolutionList(S solution, List<S> solutionList)
      Returns the average euclidean distance of a solution to the solutions of a list.
    • 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 normalized
      minValues - minimum values for each objective
      maxValues - maximum value for each objective
      Returns:
      normalized solution