public class ParallelIndividualCompleter extends SequentialIndividualCompleter implements OptimizerStateListener
ParallelIndividualCompleter
completes Individual
s with
multiple threads.Modifier and Type | Class and Description |
---|---|
protected class |
ParallelIndividualCompleter.Complete
The
ParallelIndividualCompleter.Complete class completes a single Individual . |
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ExecutorService |
executor |
control, decoder, evaluator
Constructor and Description |
---|
ParallelIndividualCompleter(Control control,
Decoder<Genotype,java.lang.Object> decoder,
Evaluator<java.lang.Object> evaluator,
int maxThreads)
Constructs a
ParallelIndividualCompleter with a specified maximal
number of concurrent threads. |
Modifier and Type | Method and Description |
---|---|
void |
complete(java.lang.Iterable<? extends Individual> iterable)
Decodes and evaluates all
Individual s in the Iterable if
they are not already evaluated. |
protected void |
finalize() |
void |
optimizationStarted(Optimizer optimizer)
Invoked if the
Optimizer starts the optimization process. |
void |
optimizationStopped(Optimizer optimizer)
Invoked if the
Optimizer stops the optimization process. |
protected void |
shutdownExecutorService()
Shutdown the
ExecutorService . |
complete, decode, evaluate
@Inject public ParallelIndividualCompleter(Control control, Decoder<Genotype,java.lang.Object> decoder, Evaluator<java.lang.Object> evaluator, int maxThreads)
ParallelIndividualCompleter
with a specified maximal
number of concurrent threads.control
- the controldecoder
- the decoderevaluator
- the evaluatormaxThreads
- the maximal number of parallel threads (using namespace
ParallelIndividualCompleter
)public void complete(java.lang.Iterable<? extends Individual> iterable) throws TerminationException
IndividualCompleter
Individual
s in the Iterable
if
they are not already evaluated.complete
in interface IndividualCompleter
complete
in class SequentialIndividualCompleter
iterable
- the set of individuals to be completedTerminationException
- if the optimization is terminatedprotected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected void shutdownExecutorService()
ExecutorService
.public void optimizationStarted(Optimizer optimizer)
OptimizerStateListener
Optimizer
starts the optimization process.optimizationStarted
in interface OptimizerStateListener
optimizer
- the optimizerpublic void optimizationStopped(Optimizer optimizer)
OptimizerStateListener
Optimizer
stops the optimization process.optimizationStopped
in interface OptimizerStateListener
optimizer
- the optimizer