org.omegahat.Numerics.Optimizers
Class IterationEvent
java.lang.Object
|
+--java.util.EventObject
|
+--org.omegahat.Numerics.Optimizers.IterationEvent
- All Implemented Interfaces:
- java.io.Serializable
- public class IterationEvent
- extends java.util.EventObject
An event that signals that something potentially of
interest to others has happened in the iteration of an optimization.
This class is included in the Optimzers package because it is used,
for example, by the Optimizer class.
The usual event in that case is that another step in the refinement of the optimization has
taken place.
The source object for the event (that is, the object returned by the
getSource() method call) is the optimizer.
In addition, the getParameters method returns the current
model point with parameters, value, and optional derivatives available.
Listeners for this event may need to be careful not to swamp the computation with
their actions; for example, to do little or nothing on most events.
- See Also:
- Serialized Form
| Fields inherited from class java.util.EventObject |
source |
| Methods inherited from class java.util.EventObject |
getSource, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
state
protected int state
- The state of the iteration.
This is a convenience property to allow listeners to break out of the optimizer.
Setting this state to one of the constants in OptimizerIterator
other than CONTINUE will cause the optimizer to exit with that state.
The event has the optimizer as its source object, so in fact the event has all the
flexibility of the optimizer available. The present property is an easy alternative
way to control the iteration.
parameters
protected ModelPoint parameters
type
protected int type
IterationEvent
public IterationEvent(java.lang.Object source)
IterationEvent
public IterationEvent(OptimizerIterator source,
int type)
IterationEvent
public IterationEvent(OptimizerIterator iterator,
ModelPoint p,
int type)
getState
public int getState()
- Accessor for
state field
setState
public int setState(int value)
- Accessor for setting
state field
getType
public int getType()
- Get the type of an event.
See the symbolic constants in class NotifyingOptimizer.
getParameters
public ModelPoint getParameters()
- Get the optimization parameters associated with this event.
setParameters
public ModelPoint setParameters(ModelPoint p)
- Set the parameters in the event object.
Do you really want to do this? Remember that the parameters
set in the event object may or may not alter the parameters in the optimization.