Error using optimoptions (line 124)

22 visualizzazioni (ultimi 30 giorni)
Vishakha Ranade
Vishakha Ranade il 4 Nov 2020
Commentato: Bruno Luong il 5 Nov 2020
I am getting the error message mentioned in the title while executing following line
opts = optimoptions('fmincon','Algorithm','interior-point');
I tried setting the default path through
restoredefaultpath
savepath
rehash toolboxcache
Still getting the same error. Can someone help?
Thanks
  8 Commenti
Mario Malic
Mario Malic il 5 Nov 2020
Get the code from link and try it.
Vishakha Ranade
Vishakha Ranade il 5 Nov 2020
I tried following code as you suggested
options = optimoptions('fmincon','Display','iter','Algorithm','sqp');
fun = @(x)100*(x(2)-x(1)^2)^2 + (1-x(1))^2;
A = [];
b = [];
Aeq = [];
beq = [];
lb = [];
ub = [];
nonlcon = @unitdisk;
x0 = [0,0];
x = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
with the unitdisk defined in other file with same name as
function [c,ceq] = unitdisk(x)
c = x(1)^2 + x(2)^2 - 1;
ceq = [];
Getting the following error
Error using optimoptions (line 124)
Empty keys are not allowed in this container.
Error in problem (line 1)
options = optimoptions('fmincon','Display','iter','Algorithm','sqp');
Can you figure out what must be going wrong?
Thanks for spending your time on my problem

Accedi per commentare.

Risposta accettata

VBBV
VBBV il 5 Nov 2020
Modificato: VBBV il 5 Nov 2020
%if true
% code
% end
opts = optimoptions(@fmincon,'Algorithm','interior-point');
Try function handle for passing solver name
  11 Commenti
Vishakha Ranade
Vishakha Ranade il 5 Nov 2020
MATLAB R2020a
Vishakha Ranade
Vishakha Ranade il 5 Nov 2020
I referred to the link you have sent.
Looks like my problem would be solved. Thanks a lot

Accedi per commentare.

Più risposte (1)

Bruno Luong
Bruno Luong il 5 Nov 2020
Modificato: Ameer Hamza il 5 Nov 2020
Make sure you have optimization toolbox installed
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.9.0.1495850 (R2020b) Update 1
MATLAB License Number: xxxxxx
Operating System: Microsoft Windows 10 Home Version 10.0 (Build 19042)
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.9 (R2020b)
MATLAB Compiler Version 8.1 (R2020b)
Optimization Toolbox Version 9.0 (R2020b)
Signal Processing Toolbox Version 8.5 (R2020b)
  7 Commenti
Vishakha Ranade
Vishakha Ranade il 5 Nov 2020
Thanks a lot. My problem is solved by reinstalling global optimization toolbox. I had already installed the optimization toolbox previously.
Somehow global optimization solved the problem.
Bruno Luong
Bruno Luong il 5 Nov 2020
Odd I don't own global optimization toolbox and it works for me.

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by