Package org.opt4j.common.completer
Class ParallelIndividualCompleter
java.lang.Object
org.opt4j.common.completer.SequentialIndividualCompleter
org.opt4j.common.completer.ParallelIndividualCompleter
- All Implemented Interfaces:
IndividualCompleter
,OptimizerStateListener
public class ParallelIndividualCompleter
extends SequentialIndividualCompleter
implements OptimizerStateListener
The
ParallelIndividualCompleter
completes Individual
s with
multiple threads.-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
TheParallelIndividualCompleter.Complete
class completes a singleIndividual
. -
Field Summary
Fields inherited from class org.opt4j.common.completer.SequentialIndividualCompleter
control, decoder, evaluator
-
Constructor Summary
ConstructorDescriptionParallelIndividualCompleter
(Control control, Decoder decoder, Evaluator evaluator, int maxThreads) Constructs aParallelIndividualCompleter
with a specified maximal number of concurrent threads. -
Method Summary
Modifier and TypeMethodDescriptionvoid
complete
(Iterable<? extends Individual> iterable) Decodes and evaluates allIndividual
s in theIterable
if they are not already evaluated.protected void
finalize()
void
optimizationStarted
(Optimizer optimizer) Invoked if theOptimizer
starts the optimization process.void
optimizationStopped
(Optimizer optimizer) Invoked if theOptimizer
stops the optimization process.protected void
Shutdown theExecutorService
.Methods inherited from class org.opt4j.common.completer.SequentialIndividualCompleter
complete, decode, evaluate
-
Field Details
-
executor
-
-
Constructor Details
-
ParallelIndividualCompleter
@Inject public ParallelIndividualCompleter(Control control, Decoder decoder, Evaluator evaluator, int maxThreads) Constructs aParallelIndividualCompleter
with a specified maximal number of concurrent threads.- Parameters:
control
- the controldecoder
- the decoderevaluator
- the evaluatormaxThreads
- the maximal number of parallel threads (using namespaceParallelIndividualCompleter
)
-
-
Method Details
-
complete
Description copied from interface:IndividualCompleter
Decodes and evaluates allIndividual
s in theIterable
if they are not already evaluated.- Specified by:
complete
in interfaceIndividualCompleter
- Overrides:
complete
in classSequentialIndividualCompleter
- Parameters:
iterable
- the set of individuals to be completed- Throws:
TerminationException
- if the optimization is terminated
-
finalize
-
shutdownExecutorService
protected void shutdownExecutorService()Shutdown theExecutorService
. -
optimizationStarted
Description copied from interface:OptimizerStateListener
Invoked if theOptimizer
starts the optimization process.- Specified by:
optimizationStarted
in interfaceOptimizerStateListener
- Parameters:
optimizer
- the optimizer
-
optimizationStopped
Description copied from interface:OptimizerStateListener
Invoked if theOptimizer
stops the optimization process.- Specified by:
optimizationStopped
in interfaceOptimizerStateListener
- Parameters:
optimizer
- the optimizer
-