Package planner.utils

Class MathTools

java.lang.Object
planner.utils.MathTools

public class MathTools extends Object
MathTools provides some useful and frequently used mathematical tools needed when developing Differential Evolution algorithms throught this framework.
Since:
1.0
Version:
%I%, %G%.
Author:
Alicia Vazquez Ramos.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static Random
    Random object of the DEFramework.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    arithmeticMean(double[] values)
    Computes the arithmetic mean for an array of real values.
    static double
    Computes the arithmetic mean for a set of real values.
    static double
    cauchyRND(double location, double scale)
    Computes a pseudorandom real number in Cauchy distribution given the location and scale parameters.
    static double
    lehmerMean(double[] values)
    Computes the Lehmer mean for sn array of real values.
    static double
    Computes the Lehmer mean for a set of real values.
    static double
    max(double... s)
    Computes the maximum given a set of real values.
    static double
    min(double... s)
    Computes the maximum given a set of real values.
    static double
    normalRND(double mean, double stdev)
    Computes a pseudorandom real number in Normal distribution given the mean and statistic deviation parameters.
    static void
    setRandomSeed(long seed)
    Updates random object seed.
    static int[]
    uniformDistinctRND(int N, int L)
     
    static int[]
    uniformIntegerDistinctRND(int i, int N, int L)
    Generates an array of N non-negative integer pseudorandom values in an interval [0, L) in Uniform distribution distinct among them and from a given integer value i.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RND

      public static Random RND
      Random object of the DEFramework.
  • Constructor Details

    • MathTools

      public MathTools()
  • Method Details

    • setRandomSeed

      public static void setRandomSeed(long seed)
      Updates random object seed.
      Parameters:
      seed - of the execution of the DEFramework.
    • max

      public static double max(double... s)
      Computes the maximum given a set of real values.
      Parameters:
      s - set of real values.
      Returns:
      maximum value.
    • min

      public static double min(double... s)
      Computes the maximum given a set of real values.
      Parameters:
      s - set of real values.
      Returns:
      minimum value.
    • arithmeticMean

      public static double arithmeticMean(double[] values)
      Computes the arithmetic mean for an array of real values.
      Parameters:
      values - real values.
      Returns:
      the arithmetic mean.
    • arithmeticMean

      public static double arithmeticMean(ArrayList<Double> values)
      Computes the arithmetic mean for a set of real values.
      Parameters:
      values - real values.
      Returns:
      the arithmetic mean.
    • lehmerMean

      public static double lehmerMean(double[] values)
      Computes the Lehmer mean for sn array of real values.
      Parameters:
      values - real values.
      Returns:
      the Lehmer mean.
    • lehmerMean

      public static double lehmerMean(ArrayList<Double> values)
      Computes the Lehmer mean for a set of real values.
      Parameters:
      values - real values.
      Returns:
      the Lehmer mean.
    • uniformIntegerDistinctRND

      public static int[] uniformIntegerDistinctRND(int i, int N, int L)
      Generates an array of N non-negative integer pseudorandom values in an interval [0, L) in Uniform distribution distinct among them and from a given integer value i.
      Parameters:
      i - given integer to be distinct from the ones generated.
      N - number of pseudorandom integer to be generated.
      L - maximum possible integer, not included.
      Returns:
      an array of pdeudoranfom integers distinct among them and from i.
    • uniformDistinctRND

      public static int[] uniformDistinctRND(int N, int L)
    • normalRND

      public static double normalRND(double mean, double stdev)
      Computes a pseudorandom real number in Normal distribution given the mean and statistic deviation parameters.
      Parameters:
      mean - mean of the Normal distribution.
      stdev - statistic deviation of the Normal distribution.
      Returns:
      pseudorandom real number in Normal distribution.
    • cauchyRND

      public static double cauchyRND(double location, double scale)
      Computes a pseudorandom real number in Cauchy distribution given the location and scale parameters.
      Parameters:
      location - location where Cauchy distribution is centered;
      scale - scale paremeter.
      Returns:
      pseudorandom real number in Cauchy distribution.