Using Simulink Fast Restart in a parallel computed optimization problem

7 Ansichten (letzte 30 Tage)
Hi, I have a Simulink Model which works perfect when i turn on fast restart. I can change the Values of my parameters A1, A2 and i by hand and it does not need to recompile.
Now i want to use this model in a parameter optimization problem using parallel computing AND fast restart. It would save a lot of time to cut out the recompiling time. The Problem is parallel computing works great but the model compiles for every iteration.
I set up the optzimization like this
% Simulator set up with experiment data, multiple experiments
Simulator = createSimulator(Exp(1));
Simulator = fastRestart(Simulator,'On'); %Fast Restart ON??
% estimation function handle, sdo requires function with just one input
% argument
estFcn = @(param) ObjectiveFun(param,Simulator,Exp);
% optimization options
parpool
opt = sdo.OptimizeOptions;
opt.Method = 'surrogateopt';
opt.UseParallel = true;
opt.OptimizedModel = 'Model';
opt.ParallelFileDependencies = files;
opt.MethodOptions.PlotFcn = 'surrogateoptplot';
opt.MethodOptions.MaxFunctionEvaluations = Iterations;
% Optimization
vOpt = sdo.optimize(estFcn,param,opt);
I just tried running the same code without parallel computing (opt.UseParallel = false) and fast restart works.. but not with parallel computing

Akzeptierte Antwort

S.L.
S.L. am 29 Mär. 2022
Just if someone faces the same problem as me.
The problem was that my Simulink model was inside a Matlab Project. A part of the startup function of this project was to open the simulink model.
open('Test.slx')
When starting the optimization the startup function is called, which opens the model without fast restart, which the optimization function does not override..
I got arround adding those lines to the startup function:
open('Test.slx')
sim_obj = sdo.SimulationTest('Test');
sim_obj = fastRestart(sim_obj,'On');

Weitere Antworten (0)

Kategorien

Mehr zu Parameter Estimation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by