Skip to content

Multithreading

Diego Giacomelli edited this page Sep 17, 2018 · 2 revisions

Multithreading can be configured on GeneticSharp using the ParallelTaskExecutor. This ITaskExecutor's implementation allows you to define how many threads will be used to run the fitness function in parallel.

GeneticSharp use the LinearTaskExecutor by default. Use the code below to configure it to multithreading:

var taskExecutor = new ParallelTaskExecutor();
taskExecutor.MinThreads = 100;
taskExecutor.MaxThreads = 100;

var ga = new GeneticAlgorithm(...);
ga.TaskExecutor = taskExecutor;
You can’t perform that action at this time.