Class LineMultiOptimizer
java.lang.Object
com.irurueta.numerical.optimization.Optimizer
com.irurueta.numerical.optimization.MultiOptimizer
com.irurueta.numerical.optimization.LineMultiOptimizer
- Direct Known Subclasses:
ConjugateGradientMultiOptimizer
,PowellMultiOptimizer
Abstract class to search for a local minimum on a multidimensional function
along a given line of input parameters.
Line minimization implementations exist such as Powell's method or conjugate
gradients. Among those, usually conjugate gradients provide faster
convergence because search directions during the estimation don't need to be
perpendicular.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate BrentSingleOptimizer
Internal optimizer to find a minimum of a function along a line of input values.private DirectionalEvaluator
Class in charge of evaluating a function through a given line.private int
Number of dimensions on function being evaluated.protected double[]
n-dimensional point containing a minimum in a given line.protected double[]
Direction to make the search.Fields inherited from class com.irurueta.numerical.optimization.MultiOptimizer
fmin, listener, resultAvailable, xmin
Fields inherited from class com.irurueta.numerical.optimization.Optimizer
iterationCompletedListener, locked
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Empty constructor.protected
Constructor.protected
LineMultiOptimizer
(MultiDimensionFunctionEvaluatorListener listener, double[] point, double[] direction) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
Returns direction to start looking for a minimum.double[]
Returns start point where algorithm will be started.private void
internalSetStartPointAndDirection
(double[] point, double[] direction) Internal method to set start point and direction to start the search for a local minimum.boolean
Returns boolean indicating whether direction has already been provided and is ready for retrieval.boolean
isReady()
Returns boolean indicating whether this instance is considered to be ready to start the estimation of a minimum.boolean
Returns boolean indicating whether start point has already been provided and is ready for retrieval.protected double
linmin()
Searches for a minimum along a given line of input values.void
setStartPointAndDirection
(double[] point, double[] direction) Internal method to set start point and direction to start the search for a local minimum.Methods inherited from class com.irurueta.numerical.optimization.MultiOptimizer
getEvaluationAtResult, getListener, getResult, isListenerAvailable, isResultAvailable, setListener
Methods inherited from class com.irurueta.numerical.optimization.Optimizer
getOnIterationCompletedListener, isLocked, minimize, setOnIterationCompletedListener
-
Field Details
-
p
protected double[] pn-dimensional point containing a minimum in a given line. -
xi
protected double[] xiDirection to make the search. -
n
private int nNumber of dimensions on function being evaluated. -
evaluator
Class in charge of evaluating a function through a given line. -
brent
Internal optimizer to find a minimum of a function along a line of input values. Hence, input is converted to a single dimension using a DirectionalEvaluator.
-
-
Constructor Details
-
LineMultiOptimizer
protected LineMultiOptimizer()Empty constructor. -
LineMultiOptimizer
Constructor.- Parameters:
listener
- Listener to evaluate a multi-dimension function.
-
LineMultiOptimizer
protected LineMultiOptimizer(MultiDimensionFunctionEvaluatorListener listener, double[] point, double[] direction) Constructor.- Parameters:
listener
- Listener to evaluate a multi-dimension function.point
- Start point where algorithm will be started. Start point should be close to the local minimum to be found. Provided array must have a length equal to the number of dimensions of the function being evaluated, otherwise and exception will be raised when searching for the minimum.direction
- Direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.- Throws:
IllegalArgumentException
- Raised if provided point and direction don't have the same length.
-
-
Method Details
-
isStartPointAvailable
public boolean isStartPointAvailable()Returns boolean indicating whether start point has already been provided and is ready for retrieval.- Returns:
- True if available, false otherwise.
-
getStartPoint
Returns start point where algorithm will be started. Start point should be close to the local minimum to be found.- Returns:
- Start point where algorithm will be started.
- Throws:
NotAvailableException
- Raised if start point has not yet been provided and is not available.
-
isDirectionAvailable
public boolean isDirectionAvailable()Returns boolean indicating whether direction has already been provided and is ready for retrieval.- Returns:
- True if available, false otherwise.
-
getDirection
Returns direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.- Returns:
- Direction to start looking for a minimum.
- Throws:
NotAvailableException
- Raised if direction has not yet been provided and is not available.
-
setStartPointAndDirection
Internal method to set start point and direction to start the search for a local minimum.- Parameters:
point
- Start point where algorithm will be started. Start point should be close to the local minimum to be found. Provided array must have a length equal to the number of dimensions of the function being evaluated, otherwise and exception will be raised when searching for the minimum.direction
- Direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.- Throws:
LockedException
- Raised if this instance is locked.IllegalArgumentException
- Raised if provided point and direction don't have the same length.
-
isReady
public boolean isReady()Returns boolean indicating whether this instance is considered to be ready to start the estimation of a minimum. This instance is considered to be ready once a listener, start point and direction are provided.- Overrides:
isReady
in classMultiOptimizer
- Returns:
- True if this instance is ready, false otherwise.
-
linmin
protected double linmin()Searches for a minimum along a given line of input values. The line being searched is obtained by using a start point and direction.- Returns:
- Returns function evaluation at minimum that has been found.
-
internalSetStartPointAndDirection
private void internalSetStartPointAndDirection(double[] point, double[] direction) Internal method to set start point and direction to start the search for a local minimum. This method does not check whether this instance is locked.- Parameters:
point
- Start point where algorithm will be started. Start point should be close to the local minimum to be found. Provided array must have a length equal to the number of dimensions of the function being evaluated, otherwise and exception will be raised when searching for the minimum.direction
- Direction to start looking for a minimum. Provided array must have the same length as the number of dimensions of the function being evaluated. Provided direction is considered as a vector pointing to the minimum to be found.- Throws:
IllegalArgumentException
- Raised if provided point and direction don't have the same length.
-