public class LineFunction extends java.lang.Object implements UnivariateFunction
Constructor and Description |
---|
LineFunction(MultivariateFunction func)
construct univariate function from multivariate function
|
Modifier and Type | Method and Description |
---|---|
int |
checkDirection(double[] p,
double[] dir)
check direction vector.
|
boolean |
checkPoint(double[] p)
check (and modify, if necessary) whether a point lies properly
within the predefined bounds
|
int |
checkVariables(double[] p,
double[] grad,
boolean[] active)
determine active variables at a point p and corresponding
gradient grad (if a component of p lies on a border and
the corresponding component of the gradient points
out of the border the variable is considered inactive)
|
double |
evaluate(double lambda)
evaluate f(start+lambda*dir)
|
double |
findMinimum()
find parameter lambda within the given bounds
that minimizes the univariate function
(due to numerical inaccuaries it may happen
that getPoint for the returned lambda produces
a point that lies
slightly out of bounds)
|
double |
getLowerBound()
get lower bound of argument
|
int |
getLowerBoundParameter()
get parameter that limits the lower bound
|
void |
getPoint(double lambda,
double[] p)
get point associated with the one-dimensional parameter
(bounds of of multivariate function are NOT checked)
|
double |
getUpperBound()
get upper bound of argument
|
int |
getUpperBoundParameter()
get parameter that limits the upper bound
|
void |
update(double[] start,
double[] dir)
update start point and direction
(bounds and search direction are NOT checked)
|
public LineFunction(MultivariateFunction func)
func
- multivariate functionstart
- start pointdir
- direction vectorpublic void update(double[] start, double[] dir)
start
- new start pointdir
- new direction vectorpublic void getPoint(double lambda, double[] p)
lambda
- argumentp
- array for coordinates of corresponding pointpublic double evaluate(double lambda)
evaluate
in interface UnivariateFunction
public double getLowerBound()
UnivariateFunction
getLowerBound
in interface UnivariateFunction
public double getUpperBound()
UnivariateFunction
getUpperBound
in interface UnivariateFunction
public double findMinimum()
public int getUpperBoundParameter()
public int getLowerBoundParameter()
public boolean checkPoint(double[] p)
p
- coordinates of pointpublic int checkVariables(double[] p, double[] grad, boolean[] active)
p
- coordinates of pointgrad
- gradient at that pointlist
- of active variables (on return)public int checkDirection(double[] p, double[] dir)
p
- coordinates of pointdir
- direction vector at that point