Parallel Gradient Based Optimizer, Objective Function Uses Simulink

조회 수: 2 (최근 30일)
Sadi
Sadi 2024년 11월 14일
댓글: Sadi 2024년 11월 18일
Hello,
I am working on an optimization problem. I currently have a simulink model what I would like to do is to find the right parameters in the Simulink model so that the results it gives matches the test data.
I have managed to use ga, with UseVectorized=true to parallelize it, my objective function calls simulink model to calculate the error between test data and simulation results. What I would like to do is the same but I want to use a gradient based optimizer like fmincon, but I could not make it work. Can anyone explain how to do this with fmincon, there is no UseVectorized option. Any other gradient based optimizer can also work.
Kind Regards

채택된 답변

Sadi
Sadi 2024년 11월 14일
Hi Ayush,
Thank you for your answer. I have tried what you have said and encountered some problems. For the objective function I am using a Simulink model not a matlab function. I have constructed the simulink model of the example you have given and it works fine. However, my original simulink model is a bit complex when I try to run it, some constants and fromworkspace blocks seems to be not getting the data from the matlab workspace, do you have any workarounds for this ?
Kind Regards
  댓글 수: 1
Sadi
Sadi 2024년 11월 18일
Hello,
I have found the solution by passing the workspace variables in objective function. Use set_params function in the objective function to define the required workspace variables in simulink.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Ayush Aniket
Ayush Aniket 2024년 11월 14일
편집: Ayush Aniket 2024년 11월 14일
Hi Sadi,
I understand that your objective is to use gradient based optimization function like fmincon with parallel computing options. You can use the UseParallel argument of the optimoptions funtion and then supply it to the fmincon function. Refer to the following documentation link that shows an example for the same: https://www.mathworks.com/help/optim/ug/minimizing-an-expensive-optimization-problem-using-parallel-computing-toolbox.html#d126e83518

카테고리

Help CenterFile Exchange에서 Control Design in Simulink에 대해 자세히 알아보기

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by