|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.omegahat.Numerics.Optimizers.OptimizerBasic
The basic iterative optimizer, using an OptimizerAlgorithm for iteration and a ModelObjective to define the particular model to optmize.
The eval method performs the basic iteration by calling the algorithm to refine the current model estimate.
Although this class is not technically abstract, it must either have an algorithm that sets the state of the optimizer when convergence takes place or the actual optimizer must itself come from a class that puts some limits on the iteration, since the continueIteration method of this class does nothing but check the state.
| Field Summary | |
protected OptimizerAlgorithm |
algorithm
The numerical method used to refine the model, by improving the value computed by theobjective. |
protected ModelPoint |
current
The current model estimate. |
protected ModelObjective |
objective
|
protected int |
state
|
| Fields inherited from interface org.omegahat.Numerics.Optimizers.OptimizerIterator |
CONTINUE, CONVERGED, EXCEPTION, NUMERIC_PROBLEM, TOO_MANY_STEPS |
| Constructor Summary | |
OptimizerBasic(OptimizerAlgorithm algorithm)
Create an optimizer with a given algorithm, but initially no specific model to fit. |
|
OptimizerBasic(OptimizerAlgorithm algorithm,
ModelObjective model,
double[] start)
Define the model separately from parameters and objective. |
|
OptimizerBasic(OptimizerAlgorithm algorithm,
ModelPoint start)
Create a complete optimizer with an algorithm and initialize it with a starting point (including the model objective). |
|
| Method Summary | |
boolean |
continueIteration(OptimizerAlgorithm opt,
ModelPoint values)
Called after each iteration to test whether to continue. |
ModelPoint |
eval()
The basic optimization loop, which iterates to compute the next set of parameter values, by repeatedly invoking the refine method of the fitter. |
ModelPoint |
eval(ModelPoint initialValue)
Evaluate the optimization, using the argument as the initial values. |
OptimizerAlgorithm |
getAlgorithm()
Accessor for algorithm field |
ModelPoint |
getCurrent()
Accessor for current field |
ModelObjective |
getObjective()
Accessor for objective field |
int |
getState()
Accessor for state field |
ModelPoint |
initialize(ModelPoint initialValue)
Initialize the iteration. |
OptimizerAlgorithm |
setAlgorithm(OptimizerAlgorithm value)
Accessor for setting algorithm field |
ModelPoint |
setCurrent(ModelPoint value)
Accessor for setting current field |
ModelObjective |
setObjective(ModelObjective value)
Accessor for setting objective field |
int |
setState(int value)
Accessor for setting state field |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected OptimizerAlgorithm algorithm
This defines, following the OptimizerAlgorithm interface, a method
refine which will be called iteratively by the eval method of
the optimizer object.
protected ModelObjective objective
protected int state
protected ModelPoint current
| Constructor Detail |
public OptimizerBasic(OptimizerAlgorithm algorithm)
public OptimizerBasic(OptimizerAlgorithm algorithm,
ModelPoint start)
The model definition in start will be used throughout the iteration.
public OptimizerBasic(OptimizerAlgorithm algorithm,
ModelObjective model,
double[] start)
| Method Detail |
public OptimizerAlgorithm getAlgorithm()
algorithm fieldpublic OptimizerAlgorithm setAlgorithm(OptimizerAlgorithm value)
algorithm fieldpublic ModelObjective getObjective()
objective fieldpublic ModelObjective setObjective(ModelObjective value)
objective fieldpublic int getState()
state fieldgetState in interface OptimizerIteratorpublic int setState(int value)
state fieldsetState in interface OptimizerIteratorpublic ModelPoint getCurrent()
current fieldpublic ModelPoint setCurrent(ModelPoint value)
current fieldpublic ModelPoint initialize(ModelPoint initialValue)
Evaluates the model for the supplied initial values (and may throw an exception doing so), then calls the fitting algorithm's initialize method.
public ModelPoint eval()
throws java.lang.Exception
An exception may be thrown by the refine method, causing an exception from eval().
public ModelPoint eval(ModelPoint initialValue)
throws java.lang.Exception
public boolean continueIteration(OptimizerAlgorithm opt,
ModelPoint values)
The basic method only checks the state of the optimizer, which must have been set by some other computation. In the subclass OptimizerNotifier the corresponding method calls all the iteration listeners. By default these include a counter that exits when too many iterations have taken place. The algorithm will likely add listener(s) of its own, to detect successful convergence.
continueIteration in interface OptimizerIterator
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||