public abstract class MultiThreadRunner extends Runner
GeneticAlgorithm
Modifier and Type | Field and Description |
---|---|
protected int |
nthreads |
protected java.util.concurrent.ExecutorService |
threadGroup
Instance of the thread pool
|
Constructor and Description |
---|
MultiThreadRunner()
Default constructor.
|
MultiThreadRunner(int nthreads)
This will instantiate a MultiThreadRunner enviroinment with a fixed thread
pool sized as defined by argument
|
Modifier and Type | Method and Description |
---|---|
int |
getNthreads()
Get the number of threads currently setted for this enviroinment
|
void |
start(boolean reset)
Call-back invoked by
GeneticAlgorithm.start(boolean) |
void |
stop()
Call-back called soon after
GeneticAlgorithm.onStop(long) |
evaluateIndividual, execute, execute, execute, getGeneticAlgorithm, onEvaluationBegin, onEvaluationEnd, onInit, setAlgorithm
protected int nthreads
protected java.util.concurrent.ExecutorService threadGroup
public MultiThreadRunner()
MultiThreadRunner(int)
,
Runtime.availableProcessors()
public MultiThreadRunner(int nthreads)
nthreads
- the number of threads to use to parallelize algorithm executionpublic int getNthreads()
public void start(boolean reset)
Runner
GeneticAlgorithm.start(boolean)
public void stop()
Runner
GeneticAlgorithm.onStop(long)