Package planner.utils
Class MathTools
java.lang.Object
planner.utils.MathTools
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublearithmeticMean(double[] values) Computes the arithmetic mean for an array of real values.static doublearithmeticMean(ArrayList<Double> values) Computes the arithmetic mean for a set of real values.static doublecauchyRND(double location, double scale) Computes a pseudorandom real number in Cauchy distribution given the location and scale parameters.static doublelehmerMean(double[] values) Computes the Lehmer mean for sn array of real values.static doublelehmerMean(ArrayList<Double> values) Computes the Lehmer mean for a set of real values.static doublemax(double... s) Computes the maximum given a set of real values.static doublemin(double... s) Computes the maximum given a set of real values.static doublenormalRND(double mean, double stdev) Computes a pseudorandom real number in Normal distribution given the mean and statistic deviation parameters.static voidsetRandomSeed(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.
-
Field Details
-
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
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
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.
-