Class SolutionListUtils

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

public class SolutionListUtils extends Object
Author:
Antonio J. Nebro
  • Constructor Details

    • SolutionListUtils

      public SolutionListUtils()
  • Method Details

    • getNonDominatedSolutions

      public static <S extends Solution<?>> List<S> getNonDominatedSolutions(List<S> solutionList)
    • findWorstSolution

      public <S> S findWorstSolution(Collection<S> solutionList, Comparator<S> comparator)
    • findIndexOfBestSolution

      public static <S> int findIndexOfBestSolution(List<S> solutionList, Comparator<S> comparator)
      Finds the index of the best solution in the list according to a comparator
      Parameters:
      solutionList -
      comparator -
      Returns:
      The index of the best solution
    • findIndexOfWorstSolution

      public static <S> int findIndexOfWorstSolution(List<? extends S> solutionList, Comparator<S> comparator)
      Finds the index of the worst solution in the list according to a comparator
      Parameters:
      solutionList -
      comparator -
      Returns:
      The index of the best solution
    • findBestSolution

      public static <S> S findBestSolution(List<S> solutionList, Comparator<S> comparator)
    • writeObjectivesToMatrix

      public static <S extends Solution<?>> double[][] writeObjectivesToMatrix(List<S> solutionList)
    • normalizeSolutionList

      public static <S extends Solution<?>> List<S> normalizeSolutionList(List<S> solutions, double[] minValues, double[] maxValues)
      This method receives a list of non-dominated solutions and maximum and minimum values of the objectives, and returns a normalized set of solutions.
      Parameters:
      solutions - A list of non-dominated solutions
      minValues - The minimum values of the objectives
      maxValues - The maximum values of the objectives
      Returns:
      the normalized list of non-dominated solutions
    • normalizeSolutionList

      public static <S extends Solution<?>> List<S> normalizeSolutionList(List<S> solutions)
      This method receives a list of non-dominated solutions and maximum and minimum values of the objectives, and returns a normalized set of solutions.
      Parameters:
      solutions - A list of non-dominated solutions
      Returns:
      the normalized list of non-dominated solutions
    • getInvertedFront

      public static <S extends Solution<?>> List<S> getInvertedFront(List<S> solutionSet)
      This method receives a normalized list of non-dominated solutions and return the inverted one. This operation is needed for minimization problem
      Parameters:
      solutionSet - The front to invert
      Returns:
      The inverted front
    • isSolutionDominatedBySolutionList

      public static <S extends Solution<?>> boolean isSolutionDominatedBySolutionList(S solution, List<? extends S> solutionSet)
    • distanceMatrix

      public static <S extends Solution<?>> double[][] distanceMatrix(List<S> solutionSet)
      Returns a matrix with the euclidean distance between each pair of solutions in the population. Distances are measured in the objective space
      Parameters:
      solutionSet -
      Returns:
    • normalizedDistanceMatrix

      public static <S extends Solution<?>> double[][] normalizedDistanceMatrix(List<S> solutionSet, double[] maxs, double[] mins)
    • restart

      public static <S> void restart(List<S> solutionList, Problem<S> problem, int percentageOfSolutionsToRemove)
      This method takes a list of solutions, removes a percentage of its solutions, and it is filled with new random generated solutions
      Parameters:
      solutionList -
      problem -
      percentageOfSolutionsToRemove -
    • removeSolutionsFromList

      public static <S> void removeSolutionsFromList(List<S> solutionList, int numberOfSolutionsToRemove)
      Removes a number of solutions from a list
      Parameters:
      solutionList - The list of solutions
      numberOfSolutionsToRemove -
    • fillPopulationWithNewSolutions

      public static <S> void fillPopulationWithNewSolutions(List<S> solutionList, Problem<S> problem, int maxListSize)
      Fills a population with new solutions until its size is maxListSize
      Type Parameters:
      S - The type of the solutions to be created
      Parameters:
      solutionList - The list of solutions
      problem - The problem being solved
      maxListSize - The target size of the list
    • getObjectiveArrayFromSolutionList

      public static <S extends Solution<?>> double[] getObjectiveArrayFromSolutionList(List<S> solutionList, int objective)
      Given a solution list and the identifier of an objective (0, 1, etc), returns an array with the values of that objective in all the solutions of the list
      Type Parameters:
      S -
      Parameters:
      solutionList -
      objective -
      Returns:
    • distanceBasedSubsetSelection

      public static <S extends Solution<?>> List<S> distanceBasedSubsetSelection(List<S> originalSolutionList, int finalListSize)
      Method implements a version of the distance-based subset selection algorithm described in: H. K. Singh, K. S. Bhattacharjee, and T. Ray, ‘Distance-based subset selection for benchmarking in evolutionary multi/many-objective optimization,’ IEEE Trans. on Evolutionary Computation, 23(5), 904-912, (2019). DOI: https://doi.org/10.1109/TEVC.2018.2883094
      Type Parameters:
      S -
      Parameters:
      originalSolutionList -
      finalListSize - The size of the result list
      Returns:
    • getMatrixWithObjectiveValues

      public static <S extends Solution<?>> double[][] getMatrixWithObjectiveValues(List<S> solutionList)
      Given a list of solutions, returns a matrix with the objective values of all the solutions
      Type Parameters:
      S -
      Parameters:
      solutionList -
      Returns: