Package org.opt4j.core.optimizer
Class Control
java.lang.Object
org.opt4j.core.optimizer.Control
The Control
allows to pause, stop, and terminate, the optimization
process.
The Optimizer
calls the methods
TerminationException
) or stopped (by the StopException
). By
definition, a StopException
might get thrown only between iterations,
a TerminationException
also within an iteration of the optimization
algorithm. In this context, the optimization algorithm calls
checkpointStop()
between the iterations and checkpoint()
within the iteration.
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ControlListener listener) Adds aControlListener
.void
A checkpoint that checks for termination.void
A checkpoint that checks for termination and stop.void
doPause()
Pauses the optimization.void
doStart()
Starts the optimization.void
doStop()
Stops the optimization.void
Terminates the optimization.getState()
Returns the state.boolean
isPaused()
Returnstrue
if the optimization is paused.boolean
Returnstrue
if the optimization is running.boolean
Returnstrue
if the optimization is stopped.boolean
Returnstrue
if the optimization is terminated.void
removeListener
(ControlListener listener) Removes aControlListener
.protected void
setState
(Control.State state) Sets the state and invokes listeners if the state has changed.
-
Field Details
-
state
-
listeners
-
-
Constructor Details
-
Control
public Control()
-
-
Method Details
-
doStart
public void doStart()Starts the optimization. -
doPause
public void doPause()Pauses the optimization. -
doStop
public void doStop()Stops the optimization. -
doTerminate
public void doTerminate()Terminates the optimization. -
isRunning
public boolean isRunning()Returnstrue
if the optimization is running.- Returns:
true
if the optimization is running
-
isPaused
public boolean isPaused()Returnstrue
if the optimization is paused.- Returns:
true
if the optimization is paused
-
isStopped
public boolean isStopped()Returnstrue
if the optimization is stopped.- Returns:
true
if the optimization is stopped
-
isTerminated
public boolean isTerminated()Returnstrue
if the optimization is terminated.- Returns:
true
if the optimization is terminated
-
checkpoint
A checkpoint that checks for termination.- Throws:
TerminationException
- if the optimization is terminated
-
checkpointStop
A checkpoint that checks for termination and stop.- Throws:
TerminationException
- if the optimization is terminatedStopException
- if the optimization is stopped
-
getState
Returns the state.- Returns:
- the state
-
setState
Sets the state and invokes listeners if the state has changed.- Parameters:
state
- the desired state
-
addListener
Adds aControlListener
.- Parameters:
listener
- the listener to add- See Also:
-
removeListener
Removes aControlListener
.- Parameters:
listener
- the listener to remove- See Also:
-