How to use the Parallel Computing Toolbox of MATLAB to optimize the parameters of a Simulink model with genetic algorithm?

조회 수: 7 (최근 30일)
Hello,
I am using the genetic algorithm function "ga()" in MATLAB to optimize operating parameters of a Simulink model.
The decision variables are several parameters of the Simulink model. The output of the fitness function is calculated by the Simulink model (The function "sim ()" is applied in the fitness function to simulate the model, and then the fitness function choose the output value of the model as the output for fitness evaluation).
Here is the fitness function:
And here is the Simulink model:
However, the optimization process will be very time-consuming as the model simulation of each individual in a generation is in serial. I wonder if it is possible to accelerate the process by simulating the model of each individual in parallel by the Parallel Computing Toolbox?
I am very grateful if you can answer my question or give me some suggestions!

답변 (1개)

Abdolkarim Mohammadi
Abdolkarim Mohammadi 2020년 9월 17일
편집: Abdolkarim Mohammadi 2020년 9월 17일
You should set ga() to pass all of the generation members at once using UseVectorized option. Then you set the objective function to be calculated for all of the members in parallel using parsim() and SimulationInput object. The general framework is to create an array of SimulationInput object, which has one such object in each element. Each element contains the variables set from the corresponding rows of the generation passed by ga(). The objective function receives a PopulationSize-by-nvars array and returns a PopulationSize-by-1 array. https://www.mathworks.com/help/simulink/slref/parsim.html
You can also benefit from options of parsim to run even faster, including fast restart, rapid accelerator, etc.

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by