Class VectorUtils

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

public class VectorUtils extends Object
  • Constructor Details

    • VectorUtils

      public VectorUtils()
  • Method Details

    • dominanceTest

      public static int dominanceTest(double[] vector1, double[] vector2)
      Method that apply a dominance test between two vectors. It is assumed that the vectors have been properly tested before calling this method to ensure that they have the same length
      Parameters:
      vector1 -
      vector2 -
      Returns:
      0 if the vectors are non-dominated, -1 if vector1 dominates vector2, and 1 if vector2 dominates vector 1
    • readVectors

      public static double[][] readVectors(String filePath, String separator) throws IOException
      Parameters:
      filePath - the file need to read
      Returns:
      referenceVectors. referenceVectors[i][j] means the i-th vector's j-th value
      Throws:
      JMetalException - if error while read file
      IOException
    • readVectors

      public static double[][] readVectors(String filePath) throws IOException
      Throws:
      IOException
    • isVectorDominatedByAFront

      public static boolean isVectorDominatedByAFront(double[] vector, double[][] front)
      Checks whether a vector is dominated by a front
      Parameters:
      vector -
      front -
      Returns:
    • distanceToClosestVector

      public static double distanceToClosestVector(double[] vector, double[][] front)
    • distanceToClosestVector

      public static double distanceToClosestVector(double[] vector, double[][] front, Distance<double[],double[]> distance)
    • distanceToNearestVector

      public static double distanceToNearestVector(double[] vector, double[][] front)
    • distanceToNearestVector

      public static double distanceToNearestVector(double[] vector, double[][] front, Distance<double[],double[]> distance)
    • getInvertedFront

      public static double[][] getInvertedFront(double[][] front)
      This method receives a normalized front and return the inverted one. This method is for minimization problems
      Parameters:
      front - The front
      Returns:
      The inverted front
    • toArray

      public static double[] toArray(List<Double> list)
      Converts a list of doubles to an array
      Parameters:
      list -
      Returns: