Error return from fmincon with Matlab 2019a
이전 댓글 표시
I am using the example in matlab documentation for fmincon. When I run this example I get the following error return. I also get this on my own problems.
fun = @(x)100*(x(2)-x(1)^2)^2 + (1-x(1))^2;
x0 = [-1,2];
A = [1,2];
b = 1;
x = fmincon(fun,x0,A,b)
Warning: Large-scale (trust region) method does not currently solve this type of problem,
switching to medium-scale (line search).
> In fmincon (line 213)
Reference to non-existent field 'OutputFcn'.
Error in optimget>optimgetfast (line 120)
if (isstring(defaultopt.(name)))
Error in optimget (line 31)
o = optimgetfast(options,name,default);
Error in nlconst (line 17)
outputfcn = optimget(OPTIONS,'OutputFcn',defaultopt,'fast');
Error in fmincon (line 459)
nlconst(funfcn,X,l,u,full(A),B,full(Aeq),Beq,confcn,options,defaultopt, ...
댓글 수: 5
Walter Roberson
2019년 10월 6일
You could probably work around the problem by providing an options structure, but I do not know at the moment why the problem is happening.
Thomas Harris
2019년 10월 6일
Walter Roberson
2019년 10월 6일
opts = optimset('fmincon', 'OutputFcn', {});
Aeq = []; beq = []; lb = []; ub = []; nlincon = [];
x = fmincon(fun, x0, A, b, Aeq, beq, lb, ub, nlincon, opts);
Sulaymon Eshkabilov
2019년 10월 7일
Your code works in MATLAB 2017a and 2018b without any hassle. Maybe you'd need to restart your matlab. Good luck.
Matt J
2019년 10월 7일
I've tested it in R2019a and also found that it runs without hassle.
I vaguely suspect that your are not running the code that you think you are. The error messages show that a nonlinear constraint function is being called, but your posted code does not pass a nonlinear constraint handle to fmincon.
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!