Package org.opt4j.core.optimizer
Class AbstractOptimizer
java.lang.Object
org.opt4j.core.optimizer.AbstractOptimizer
- All Implemented Interfaces:
Optimizer
- Direct Known Subclasses:
OptimizationMediator
The
AbstractOptimizer
is an abstract implementation of a
population-based Optimizer
. It provides the necessary coupling to the
framework by informing all OptimizerStateListener
s and
OptimizerIterationListener
s, calling the IndividualCompleter
to decode and evaluate new Individual
s 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.-
Constructor Summary
ConstructorDescriptionAbstractOptimizer
(Population population, Archive archive, IndividualCompleter completer, Control control, Iteration iteration) Constructs anAbstractOptimizer
with aPopulation
, anArchive
, anIndividualFactory
, and aIndividualCompleter
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds anOptimizerIterationListener
to this optimizer.void
Adds anOptimizerStateListener
to this optimizer.int
Return the current iteration.boolean
Returnstrue
if theOptimizer
is running.void
Removes anOptimizerIterationListener
from this optimizer.void
Removes anOptimizerStateListener
from this optimizer.void
This method is called to start the optimization process.void
This method is called once the optimization process has stopped.
-
Constructor Details
-
AbstractOptimizer
public AbstractOptimizer(Population population, Archive archive, IndividualCompleter completer, Control control, Iteration iteration) Constructs anAbstractOptimizer
with aPopulation
, anArchive
, anIndividualFactory
, and aIndividualCompleter
.- Parameters:
population
- the specified populationarchive
- the specified archivecompleter
- the specified completercontrol
- the controliteration
- the iteration counter
-
-
Method Details
-
getIteration
Description copied from interface:Optimizer
Return the current iteration.- Specified by:
getIteration
in interfaceOptimizer
- Returns:
- the current iteration
-
isRunning
Description copied from interface:Optimizer
Returnstrue
if theOptimizer
is running. -
startOptimization
Description copied from interface:Optimizer
This method is called to start the optimization process.- Specified by:
startOptimization
in interfaceOptimizer
-
stopOptimization
Description copied from interface:Optimizer
This method is called once the optimization process has stopped.- Specified by:
stopOptimization
in interfaceOptimizer
-
addOptimizerIterationListener
Description copied from interface:Optimizer
Adds anOptimizerIterationListener
to this optimizer.- Specified by:
addOptimizerIterationListener
in interfaceOptimizer
- Parameters:
listener
- the OptimizerIterationListener to add- See Also:
-
addOptimizerStateListener
Description copied from interface:Optimizer
Adds anOptimizerStateListener
to this optimizer.- Specified by:
addOptimizerStateListener
in interfaceOptimizer
- Parameters:
listener
- the OptimizerStateListener to add- See Also:
-
removeOptimizerIterationListener
Description copied from interface:Optimizer
Removes anOptimizerIterationListener
from this optimizer.- Specified by:
removeOptimizerIterationListener
in interfaceOptimizer
- Parameters:
listener
- the OptimizerIterationListener to remove- See Also:
-
removeOptimizerStateListener
Description copied from interface:Optimizer
Removes anOptimizerStateListener
from this optimizer.- Specified by:
removeOptimizerStateListener
in interfaceOptimizer
- Parameters:
listener
- the OptimizerStateListener to remove- See Also:
-