You should do the following steps in order to apply parallel evaluation to your optimization algorithm:
- Download the
optimization.jar
file, which is in the folder lib. - Add the previous file to your project libraries.
- Substitute
Solution.evaluate((Vector)pop, function);
withSolution.paralelEvaluate((Vector)pop, function, numberOfThreads);
in the line where the first population is being evaluated. - Add the line
transformation.activateParalelEvaluation(numberOfThreads);
after the Transformation class have been defined, for example:Transformation transformation = new HAEA(haeaOperators, grow, selection);
.
Finally, if you did these four steps, your algorithm ought to be evaliating the fitness function in parallel form.