|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.omegahat.Numerics.Optimizers.IterationCounter
A basic, class for counter listeners.
This implements the count and the maximum value. Its continueIteration method adds one to the count and sets the state of the optimizer iterator to OptimizerIterator.TOO_MANY_STEPS if the maximum is exceeded.
Objects from this class provide standard control for optimizers. Extensions of the class can modify continueIteration, either to count something different (e.g., to use the number of function calls, recorded by the evaluator), or to do something different on overflow, such as modifying some part of the optimizer's strategy.
| Field Summary | |
protected int |
count
The current count. |
protected int |
max
The maximum count. |
| Constructor Summary | |
IterationCounter()
Create a counter with a default maximum (1000). |
|
IterationCounter(int max)
Create a counter with a chosen maximum. |
|
| Method Summary | |
boolean |
continueIteration(IterationEvent ev)
The method called after each step in the iteration is peformed. |
int |
getCount()
Accessor for count field |
int |
getMax()
Accessor for max field |
int |
setCount(int value)
Accessor for setting count field. |
int |
setMax(int value)
Accessor for setting max field |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int max
protected int count
| Constructor Detail |
public IterationCounter(int max)
public IterationCounter()
| Method Detail |
public int getMax()
max fieldgetMax in interface CounterListenerpublic int setMax(int value)
max fieldsetMax in interface CounterListenerpublic int getCount()
count fieldgetCount in interface CounterListenerpublic int setCount(int value)
count field.Note that this does not throw an exception, even if the value exceeds the current max.
setCount in interface CounterListenerpublic boolean continueIteration(IterationEvent ev)
Increments the count, and sets the optimizer's state to OptimizerIterator.TOO_MANY_STEPS if the max is not negative and count exceeds the max.
continueIteration in interface IterationListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||