Class Optimizer
java.lang.Object
com.irurueta.numerical.optimization.Optimizer
- Direct Known Subclasses:
MultiOptimizer
,SingleOptimizer
Abstract class to find function minima. Implementations will take into account whether the function is single or
multi-dimension, and will use different algorithms to find minima.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected OnIterationCompletedListener
Listener to handle minimization events.protected boolean
Boolean indicating whether this instance is locked because computations are being done. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets listener to handle minimization events.boolean
isLocked()
Returns boolean indicating whether this instance is locked.boolean
isReady()
Returns boolean indicating whether this instance is ready.void
minimize()
This function estimates a function minimum.void
setOnIterationCompletedListener
(OnIterationCompletedListener iterationCompletedListener) Sets listener to handle minimization events.
-
Field Details
-
locked
protected boolean lockedBoolean indicating whether this instance is locked because computations are being done. -
iterationCompletedListener
Listener to handle minimization events.
-
-
Constructor Details
-
Optimizer
protected Optimizer()Empty constructor.
-
-
Method Details
-
getOnIterationCompletedListener
Gets listener to handle minimization events.- Returns:
- listener to handle minimization events.
-
setOnIterationCompletedListener
public void setOnIterationCompletedListener(OnIterationCompletedListener iterationCompletedListener) throws LockedException Sets listener to handle minimization events.- Parameters:
iterationCompletedListener
- listener to handle minimization events.- Throws:
LockedException
- Raised if this instance is locked, because estimation is being computed.
-
isLocked
public boolean isLocked()Returns boolean indicating whether this instance is locked. This instance will be locked while computations are being done. Attempting to change any parameter while this instance is locked will raise a LockedException.- Returns:
- True if this instance is locked, false otherwise.
-
minimize
This function estimates a function minimum. Implementations of this class will usually search a local minimum within a bracket of input values. Because this is an abstract class, this method is meant to be overridden, otherwise a NotReadyException will always be thrown.- Throws:
LockedException
- Raised if this instance is locked, because estimation is being computed.NotReadyException
- Raised if this instance is not ready, usually because listener has not yet been provided.OptimizationException
- Raised if the algorithm failed because of lack of convergence or because function couldn't be evaluated.
-
isReady
public boolean isReady()Returns boolean indicating whether this instance is ready. Usually an instance will be ready once its listener has been provided. Because this is an abstract class, it will always return false;- Returns:
- True if this instance is ready, false otherwise.
-