|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opt4j.core.optimizer.AbstractOptimizer
public abstract class AbstractOptimizer
The AbstractOptimizer is an abstract implementation of a
population-based Optimizer. It provides the necessary coupling to the
framework by informing all OptimizerStateListeners and
OptimizerIterationListeners, calling the IndividualCompleter
to decode and evaluate new Individuals and adding them
to the Archive. The Control is checked regularly to allow
user interaction.
To implement an iteration-based Optimizer, the
IterativeOptimizer interface is available.
| Field Summary | |
|---|---|
protected Archive |
archive
|
protected IndividualCompleter |
completer
|
protected Control |
control
|
protected Iteration |
iteration
|
protected java.util.Set<OptimizerIterationListener> |
iterationListeners
|
protected boolean |
optimizing
|
protected Population |
population
|
protected java.util.Set<OptimizerStateListener> |
stateListeners
|
| Constructor Summary | |
|---|---|
AbstractOptimizer(Population population,
Archive archive,
IndividualCompleter completer,
Control control,
Iteration iteration)
Constructs an AbstractOptimizer with a Population, an
Archive, an IndividualFactory, and a
IndividualCompleter. |
|
| Method Summary | |
|---|---|
void |
addOptimizerIterationListener(OptimizerIterationListener listener)
Adds an OptimizerIterationListener to this optimizer. |
void |
addOptimizerStateListener(OptimizerStateListener listener)
Adds an OptimizerStateListener to this optimizer. |
int |
getIteration()
Return the current iteration. |
protected void |
injectListeners(java.util.Set<OptimizerStateListener> stateListeners,
java.util.Set<OptimizerIterationListener> iterationListeners)
|
boolean |
isRunning()
Returns true if the Optimizer is running. |
protected void |
nextIteration()
Call this method if a new iteration started. |
void |
removeOptimizerIterationListener(OptimizerIterationListener listener)
Removes an OptimizerIterationListener from this optimizer. |
void |
removeOptimizerStateListener(OptimizerStateListener listener)
Removes an OptimizerStateListener from this optimizer. |
void |
startOptimization()
This method is called to start the optimization process. |
void |
stopOptimization()
This method is called once the optimization process has stopped. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.opt4j.core.optimizer.Optimizer |
|---|
optimize |
| Field Detail |
|---|
protected final Iteration iteration
protected final Population population
protected final Archive archive
protected final IndividualCompleter completer
protected final Control control
protected final java.util.Set<OptimizerStateListener> stateListeners
protected final java.util.Set<OptimizerIterationListener> iterationListeners
protected boolean optimizing
| Constructor Detail |
|---|
public AbstractOptimizer(Population population,
Archive archive,
IndividualCompleter completer,
Control control,
Iteration iteration)
AbstractOptimizer with a Population, an
Archive, an IndividualFactory, and a
IndividualCompleter.
population - the specified populationarchive - the specified archivecompleter - the specified completercontrol - the controliteration - the iteration counter| Method Detail |
|---|
@Inject
protected void injectListeners(java.util.Set<OptimizerStateListener> stateListeners,
java.util.Set<OptimizerIterationListener> iterationListeners)
public int getIteration()
Optimizer
getIteration in interface Optimizerpublic boolean isRunning()
Optimizertrue if the Optimizer is running.
isRunning in interface Optimizertrue if the optimizer is running
protected void nextIteration()
throws TerminationException,
StopException
StopException - if the optimization is stopped
TerminationException - if the optimization is terminatedpublic void startOptimization()
Optimizer
startOptimization in interface Optimizerpublic void stopOptimization()
Optimizer
stopOptimization in interface Optimizerpublic void addOptimizerIterationListener(OptimizerIterationListener listener)
OptimizerOptimizerIterationListener to this optimizer.
addOptimizerIterationListener in interface Optimizerlistener - the OptimizerIterationListener to addOptimizer.removeOptimizerIterationListener(org.opt4j.core.optimizer.OptimizerIterationListener)public void addOptimizerStateListener(OptimizerStateListener listener)
OptimizerOptimizerStateListener to this optimizer.
addOptimizerStateListener in interface Optimizerlistener - the OptimizerStateListener to addOptimizer.removeOptimizerStateListener(org.opt4j.core.optimizer.OptimizerStateListener)public void removeOptimizerIterationListener(OptimizerIterationListener listener)
OptimizerOptimizerIterationListener from this optimizer.
removeOptimizerIterationListener in interface Optimizerlistener - the OptimizerIterationListener to removeOptimizer.addOptimizerIterationListener(org.opt4j.core.optimizer.OptimizerIterationListener)public void removeOptimizerStateListener(OptimizerStateListener listener)
OptimizerOptimizerStateListener from this optimizer.
removeOptimizerStateListener in interface Optimizerlistener - the OptimizerStateListener to removeOptimizer.addOptimizerStateListener(org.opt4j.core.optimizer.OptimizerStateListener)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||