public class BracketingNthOrderBrentSolver extends AbstractUnivariateSolver implements BracketedUnivariateSolver<UnivariateFunction>
The changes with respect to the original Brent algorithm are:
AllowedSolution,The given interval must bracket the root.
BracketedUnivariateSolver.Interval| Constructor and Description |
|---|
BracketingNthOrderBrentSolver()
Construct a solver with default accuracy and maximal order (1e-6 and 5 respectively)
|
BracketingNthOrderBrentSolver(double relativeAccuracy,
double absoluteAccuracy,
double functionValueAccuracy,
int maximalOrder)
Construct a solver.
|
BracketingNthOrderBrentSolver(double relativeAccuracy,
double absoluteAccuracy,
int maximalOrder)
Construct a solver.
|
BracketingNthOrderBrentSolver(double absoluteAccuracy,
int maximalOrder)
Construct a solver.
|
| Modifier and Type | Method and Description |
|---|---|
protected double |
doSolve()
Method for implementing actual optimization algorithms in derived
classes.
|
protected BracketedUnivariateSolver.Interval |
doSolveInterval()
Find a root and return the containing interval.
|
int |
getMaximalOrder()
Get the maximal order.
|
double |
solve(int maxEval,
UnivariateFunction f,
double min,
double max,
AllowedSolution allowedSolution)
Solve for a zero in the given interval.
|
double |
solve(int maxEval,
UnivariateFunction f,
double min,
double max,
double startValue,
AllowedSolution allowedSolution)
Solve for a zero in the given interval, start at
startValue. |
BracketedUnivariateSolver.Interval |
solveInterval(int maxEval,
UnivariateFunction f,
double min,
double max,
double startValue)
Solve for a zero in the given interval and return a tolerance interval surrounding
the root.
|
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, getMaxEvaluations, getMin, getRelativeAccuracy, getStartValue, incrementEvaluationCount, isBracketing, isSequence, setup, solve, solve, solve, verifyBracketing, verifyInterval, verifySequenceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsolveIntervalgetAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMaxEvaluations, getRelativeAccuracy, solve, solve, solvepublic BracketingNthOrderBrentSolver()
public BracketingNthOrderBrentSolver(double absoluteAccuracy,
int maximalOrder)
throws MathIllegalArgumentException
absoluteAccuracy - Absolute accuracy.maximalOrder - maximal order.MathIllegalArgumentException - if maximal order is lower than 2public BracketingNthOrderBrentSolver(double relativeAccuracy,
double absoluteAccuracy,
int maximalOrder)
throws MathIllegalArgumentException
relativeAccuracy - Relative accuracy.absoluteAccuracy - Absolute accuracy.maximalOrder - maximal order.MathIllegalArgumentException - if maximal order is lower than 2public BracketingNthOrderBrentSolver(double relativeAccuracy,
double absoluteAccuracy,
double functionValueAccuracy,
int maximalOrder)
throws MathIllegalArgumentException
relativeAccuracy - Relative accuracy.absoluteAccuracy - Absolute accuracy.functionValueAccuracy - Function value accuracy.maximalOrder - maximal order.MathIllegalArgumentException - if maximal order is lower than 2public int getMaximalOrder()
protected double doSolve()
doSolve in class BaseAbstractUnivariateSolver<UnivariateFunction>protected BracketedUnivariateSolver.Interval doSolveInterval()
public double solve(int maxEval,
UnivariateFunction f,
double min,
double max,
AllowedSolution allowedSolution)
throws MathIllegalArgumentException,
MathIllegalStateException
solve in interface BracketedUnivariateSolver<UnivariateFunction>maxEval - Maximum number of evaluations.f - Function to solve.min - Lower bound for the interval.max - Upper bound for the interval.allowedSolution - The kind of solutions that the root-finding algorithm may
accept as solutions.MathIllegalArgumentException - if the arguments do not satisfy the requirements specified by the solver.MathIllegalStateException - if
the allowed number of evaluations is exceeded.public double solve(int maxEval,
UnivariateFunction f,
double min,
double max,
double startValue,
AllowedSolution allowedSolution)
throws MathIllegalArgumentException,
MathIllegalStateException
startValue.
A solver may require that the interval brackets a single zero root.
Solvers that do require bracketing should be able to handle the case
where one of the endpoints is itself a root.solve in interface BracketedUnivariateSolver<UnivariateFunction>maxEval - Maximum number of evaluations.f - Function to solve.min - Lower bound for the interval.max - Upper bound for the interval.startValue - Start value to use.allowedSolution - The kind of solutions that the root-finding algorithm may
accept as solutions.MathIllegalArgumentException - if the arguments do not satisfy the requirements specified by the solver.MathIllegalStateException - if
the allowed number of evaluations is exceeded.public BracketedUnivariateSolver.Interval solveInterval(int maxEval, UnivariateFunction f, double min, double max, double startValue) throws MathIllegalArgumentException, MathIllegalStateException
It is required that the starting interval brackets a root or that the function value at either end point is 0.0.
solveInterval in interface BracketedUnivariateSolver<UnivariateFunction>maxEval - Maximum number of evaluations.f - Function to solve.min - Lower bound for the interval.max - Upper bound for the interval. Must be greater than min.startValue - start value to use. Must be in the interval [min, max].absolute
accuracy + max(ta, tb) * relative accuracy) or (
max(|f(ta)|, |f(tb)|) <= BaseUnivariateSolver.getFunctionValueAccuracy()) or there are no
floating point numbers between ta and tb. The width of the interval (tb - ta) may
be zero.MathIllegalArgumentException - if the arguments do not satisfy the
requirements specified by the solver.MathIllegalStateException - if the allowed number of evaluations is
exceeded.Copyright © 2016-2021 CS GROUP. All rights reserved.