I am wondering exactly how MATLAB calculates first order optimality, especially in constrained optimization cases when it returns one of the bounds (no local minimum exists). What is the termination conditions for this case?
As a test case, I set up the code below. Obviously the first function has no local minimum. The second one does (-2.5).
With interior-point, 1st order optimality is 2e-8. With SQP it is 0. I don't understand, if 1st order optimality is max(\grad f(x)), why the 1st order optimality is not 1 (since the slope is 1 everywhere). I am also returning "grad", and it is not the same as 1st order optimality, even for the case where a local minimum does exist (although both are close to 0 obviously). Couldn't figure out what factor it was using to make a "relative" optimality, as is mentioned in the documentation.
Ultimately I want to be able to "check" which termination criterion was applied, and mimic them myself in an outer loop.
y = @(x) x+2;
y2 = @(x) x^2+5*x-4;
options.Algorithm = 'interior-point';
[optx, y, exitflag,output,lambda,grad,hessian] = fmincon(y,0,[],[],[],[],-5,5, [],options);
[opt2x,z2,exitflag2,output2,lambda2,grad2,hessian2] = fmincon(y2,0,[],[],[],[],-5,5, [],options);

 채택된 답변

Matt J
Matt J 2020년 10월 31일
편집: Matt J 2020년 10월 31일

0 개 추천

In the constrained case, the first order optimality metric, described here,
involves the gradients of both the objective and the constraints.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2020년 10월 30일

편집:

2020년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by