public class BracketFinder
extends java.lang.Object
optimize.py
v0.5).Modifier and Type | Field and Description |
---|---|
private static double |
EPS_MIN
Tolerance to avoid division by zero.
|
private Incrementor |
evaluations
Counter for function evaluations.
|
private double |
fHi
Function value at
hi . |
private double |
fLo
Function value at
lo . |
private double |
fMid
Function value at
mid . |
private static double |
GOLD
Golden section.
|
private double |
growLimit
Factor for expanding the interval.
|
private double |
hi
Higher bound of the bracket.
|
private double |
lo
Lower bound of the bracket.
|
private double |
mid
Point inside the bracket.
|
Constructor and Description |
---|
BracketFinder()
Constructor with default values
100, 50 (see the
other constructor ). |
BracketFinder(double growLimit,
int maxEvaluations)
Create a bracketing interval finder.
|
Modifier and Type | Method and Description |
---|---|
private double |
eval(UnivariateFunction f,
double x) |
int |
getEvaluations() |
double |
getFHi()
Get function value at
getHi() . |
double |
getFLo()
Get function value at
getLo() . |
double |
getFMid()
Get function value at
getMid() . |
double |
getHi() |
double |
getLo() |
int |
getMaxEvaluations() |
double |
getMid() |
void |
search(UnivariateFunction func,
GoalType goal,
double xA,
double xB)
Search new points that bracket a local optimum of the function.
|
private static final double EPS_MIN
private static final double GOLD
private final double growLimit
private final Incrementor evaluations
private double lo
private double hi
private double mid
private double fLo
lo
.private double fHi
hi
.private double fMid
mid
.public BracketFinder()
100, 50
(see the
other constructor
).public BracketFinder(double growLimit, int maxEvaluations)
growLimit
- Expanding factor.maxEvaluations
- Maximum number of evaluations allowed for finding
a bracketing interval.public void search(UnivariateFunction func, GoalType goal, double xA, double xB)
func
- Function whose optimum should be bracketed.goal
- Goal type
.xA
- Initial point.xB
- Initial point.TooManyEvaluationsException
- if the maximum number of evaluations
is exceeded.public int getMaxEvaluations()
public int getEvaluations()
public double getLo()
getFLo()
public double getHi()
getFHi()
public double getMid()
getFMid()
private double eval(UnivariateFunction f, double x)
f
- Function.x
- Argument.f(x)
TooManyEvaluationsException
- if the maximal number of evaluations is
exceeded.Copyright (c) 2003-2014 Apache Software Foundation