Class BracketSearchMinimizer.Solution
- java.lang.Object
-
- dev.nm.root.univariate.bracketsearch.BracketSearchMinimizer.Solution
-
- All Implemented Interfaces:
UnivariateMinimizer.Solution,MinimizationSolution<Double>
- Direct Known Subclasses:
BrentMinimizer.Solution,FibonaccMinimizer.Solution,GoldenMinimizer.Solution
- Enclosing class:
- BracketSearchMinimizer
protected abstract class BracketSearchMinimizer.Solution extends Object implements UnivariateMinimizer.Solution
-
-
Field Summary
Fields Modifier and Type Field Description protected UnivariateRealFunctionfprotected doublefminthe best minimum found so farprotected doublefnextthe next guess of the minimumprotected intiterthe current iteration countprotected doublexlthe lower bound of the bracketing intervalprotected doublexminthe best minimizer found so farprotected doublexnextthe next best guess of the minimizerprotected doublexuthe upper bound of the bracketing interval
-
Constructor Summary
Constructors Modifier Constructor Description protectedSolution(UnivariateRealFunction f)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidinit(double xmin, double fmin)Initializes the algorithm states with initial \(x_{min}\) and \(f_{min}\) before iterations.protected booleanisBracketing(double xl, double x, double xu)Check whether [xl, xu] is bracketing x.protected abstract booleanisMinFound()the convergence criterionDoubleminimizer()Get the minimizer (solution) to the minimization problem.doubleminimum()Get the (approximate) minimum found.doublesearch(double lower, double initial, double upper)Search for a minimum within the interval [lower, upper].protected voidupdateStates()Update the bracketing interval and the best min found so far.protected abstract doublexnext()Compute the next best estimate within the bracketing interval.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dev.nm.root.univariate.UnivariateMinimizer.Solution
search
-
-
-
-
Field Detail
-
f
protected UnivariateRealFunction f
-
fmin
protected double fmin
the best minimum found so far
-
fnext
protected double fnext
the next guess of the minimum
-
xl
protected double xl
the lower bound of the bracketing interval
-
xu
protected double xu
the upper bound of the bracketing interval
-
xmin
protected double xmin
the best minimizer found so far
-
xnext
protected double xnext
the next best guess of the minimizer
-
iter
protected int iter
the current iteration count
-
-
Constructor Detail
-
Solution
protected Solution(UnivariateRealFunction f)
-
-
Method Detail
-
init
protected void init(double xmin, double fmin)Initializes the algorithm states with initial \(x_{min}\) and \(f_{min}\) before iterations. The function value of the initial minimum point is evaluated in this class. If the subclass algorithm needs the computed function value, it can override this method to avoid an unnecessary evaluation. By default, the implementation is empty. If the subclass algorithm does not need to initialize states from the function value, no overriding is needed.- Parameters:
xmin- the initial minimum pointfmin- the function value of the initial minimum point
-
isMinFound
protected abstract boolean isMinFound()
the convergence criterion- Returns:
trueif the current min value is considered to have converged within a threshold
-
xnext
protected abstract double xnext()
Compute the next best estimate within the bracketing interval. A particular univariate minimization algorithm implements the logic in this method.- Returns:
- the next best guess of the minimizer
-
search
public double search(double lower, double initial, double upper)Description copied from interface:UnivariateMinimizer.SolutionSearch for a minimum within the interval [lower, upper].- Specified by:
searchin interfaceUnivariateMinimizer.Solution- Parameters:
lower- the lower bound for the bracketing interval which contains a minimuminitial- an initial guessupper- the upper bound for the bracketing interval which contains a minimum- Returns:
- an approximate minimizer
-
updateStates
protected void updateStates()
Update the bracketing interval and the best min found so far.
-
isBracketing
protected boolean isBracketing(double xl, double x, double xu)Check whether [xl, xu] is bracketing x.- Parameters:
xl- the lower bound of the bracketing intervalx- a guess of the minimizerxu- the upper bound of the bracketing interval- Returns:
trueif fx < fl && fx < fu
-
minimum
public double minimum()
Description copied from interface:MinimizationSolutionGet the (approximate) minimum found.- Specified by:
minimumin interfaceMinimizationSolution<Double>- Returns:
- the (approximate) minimum found
-
minimizer
public Double minimizer()
Description copied from interface:MinimizationSolutionGet the minimizer (solution) to the minimization problem.- Specified by:
minimizerin interfaceMinimizationSolution<Double>- Returns:
- the minimizer
-
-