When I run fmincon with SQP algorithm, I get no problems. However, when I switch to 'active-set' or 'interior-point', I get the error:
OPTIMOPTIONS property 'Algorithm' must be one of the following values for fmincon:
'sqp', 'sqp-legacy'
I'm trying to use a different algorithm because the documentation says that interior-point can run faster for sparse problems, so I want to test that.

댓글 수: 4

Steven Lord
Steven Lord 2021년 6월 23일
Can you post a small section of the code showing how you call optimoptions and call fmincon or solve?
Sure, here is a snippet of how these are called
myopts = optimoptions('fmincon');
myopts.Algorithm = 'active-set'; % So far, only works with sqp
[z,fval,exitflag,output] = fmincon(fcn,z0,[],[],G0eq,E1eq*x,lb,ub,[],myopts);
Swatantra Mahato
Swatantra Mahato 2021년 6월 29일
Hi
Looking at the error message, I am assuming that you are using the funciton 'fmincon' with code generation, in which case 'sqp' and 'sqp-legacy' are indeed the only algorithms fmincon supports. This is mentioned in the documentation
If this is not the case, can you let me know the version of MATLAB and Operating system you are using, and if possible, share the code you are getting the error with so I can replicate the issue on my end?
Thanks
SEEmULATER
SEEmULATER 2021년 6월 29일
Hi
I am not using code generation. I am using MATLAB 2020b on Ubuntu 20.04. Thank you for looking at this! The files are attached. Run the Sim_Working.m script.

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

 채택된 답변

Swatantra Mahato
Swatantra Mahato 2021년 6월 30일

0 개 추천

Hi,
It looks like the error shows up in the MATLAB Funciton Block. Kindly refer the following documentation link on how MATLAB Function Blocks work
In particular, note that "C/C++ code generation limitations for MATLAB Coder also apply to MATLAB Function blocks.". To use a different algorithm for your simulation you can use "coder.extrinsic" and refactor your code as mentioned in the below link
Hope this helps

댓글 수: 1

SEEmULATER
SEEmULATER 2021년 6월 30일
This helps tremendously, thank you so much!!

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

추가 답변 (0개)

제품

릴리스

R2020b

질문:

2021년 6월 23일

댓글:

2021년 6월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by