Package pal.math
Class BoundsCheckedFunction
java.lang.Object
pal.math.BoundsCheckedFunction
- All Implemented Interfaces:
MultivariateFunction
returns a very large number instead of the function value
if arguments are out of bound (useful for minimization with
minimizers that don't check argument boundaries)
- Author:
- Korbinian Strimmer
-
Constructor Summary
ConstructorsConstructorDescriptionconstruct bound-checked multivariate function (a large number will be returned on function evaluation if argument is out of bounds; default is 1000000)BoundsCheckedFunction(MultivariateFunction func, double largeNumber) construct constrained multivariate function -
Method Summary
Modifier and TypeMethodDescriptiondoubleevaluate(double[] x) computes function value, taking into account the constraints on the argumentdoublegetLowerBound(int n) get lower bound of argument nintget number of argumentsdoublegetUpperBound(int n) get upper bound of argument n
-
Constructor Details
-
BoundsCheckedFunction
construct bound-checked multivariate function (a large number will be returned on function evaluation if argument is out of bounds; default is 1000000)- Parameters:
func- unconstrained multivariate functionminArg- lower constraintmaxArg- upper constraint
-
BoundsCheckedFunction
construct constrained multivariate function- Parameters:
func- unconstrained multivariate functionlargeNumber- value returned on function evaluation if argument is out of bounds
-
-
Method Details
-
evaluate
public double evaluate(double[] x) computes function value, taking into account the constraints on the argument- Specified by:
evaluatein interfaceMultivariateFunction- Parameters:
x- function argument- Returns:
- function value (if argument is not in the predefined constrained area a very large number is returned instead of the true function value)
-
getNumArguments
public int getNumArguments()Description copied from interface:MultivariateFunctionget number of arguments- Specified by:
getNumArgumentsin interfaceMultivariateFunction- Returns:
- number of arguments
-
getLowerBound
public double getLowerBound(int n) Description copied from interface:MultivariateFunctionget lower bound of argument n- Specified by:
getLowerBoundin interfaceMultivariateFunction- Parameters:
n- argument number- Returns:
- lower bound
-
getUpperBound
public double getUpperBound(int n) Description copied from interface:MultivariateFunctionget upper bound of argument n- Specified by:
getUpperBoundin interfaceMultivariateFunction- Parameters:
n- argument number- Returns:
- upper bound
-
getOrthogonalHints
- Specified by:
getOrthogonalHintsin interfaceMultivariateFunction- Returns:
- null
-