Traditional Culture Encyclopedia - Traditional stories - How to realize parallel algorithm of genetic algorithm

How to realize parallel algorithm of genetic algorithm

It is very simple to realize parallelism in Matlab, just change for to parfor.

First, you need to start the parallel robot. If the computer has several CPUs, you can start several. If the number of CPU cores is exceeded, it will report an error.

matlabpool? Local? Remember to turn it off at last.

matlabpool? Close needs to pay attention to the use of parfor. There can be no iteration in the middle of the loop, but only simple calculations, such as calculating the objective function value.