Termination Conditions fmincon: Optimality
7 views (last 30 days)
Show older comments
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);
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Problem-Based Optimization Setup in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!