STD exception when running a Simulink Design Optimization in a "parfor" loop

I am developing a workflow for optimizing controller parameters through a Simulink model and I use Simulink Design Optimization.
I do this operation for different operating points of the system. So, I use the "parfor" loop to accelerate the optimization time. However, I encounter the following error:
Error using sdo.optimize
 The function handle passed to the optimize command encountered an error when evaluated with a parameter vector.
Error in utilities.tools.optimization.Model/compute (line 59)
 [Optimized_DesignVars, Info] = sdo.optimize (optimfcn, DesignVars, Options);
Error in utilities.tools.optimization.Model/runOptimizationInParallel detailed (line 44) [Optimized_DesignVars, Info] = obj.compute_();
Error in utilities.tools.optimization.Model/runThrough ParameterToVary (line 33) parfor ix = 1 : height(listOfParametersTable)
 Caused by:
 Error using sdo.SimulationTest/sim
 STD exception 'class std::invalid_argument': 'invalid stoi argument' was caught. 
Could you please help me understand what this error is about?
Do you have any recommendations to workaround this issue?

 Respuesta aceptada

This issue is related to the information transferred to the parallel workers during the "parfor" implementation. This could explain why the workers cannot either run the model or evaluate the cost function.
You can workaround this issue by using the "Simulink.SimulationManager" infrastructure. However, this might need additional changes to the parallel execution of the model.
 
For more information on "Simulation Manager", you please refer to the following documentation:
 

Más respuestas (0)

Productos

Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by