fmincon with nonlcon does not converge to optimum value
Show older comments
function [c ceq] = test_simple(x)
c=[];
ceq=x(1)*x(2);
end
clear;
clc;
fun = @(x) -x(1)^2-x(2)^2
lb = [0;0.2;];
ub = [0.5;0.8];
A = [];
b = [];
Aeq = [];
beq = [];
x0 = [0;0.1];
nonlcon=@test_simple;
options = optimset('MaxFunEvals',Inf,'MaxIter',5000,...
'Algorithm','interior-point','Display','iter');
[x1, fval1] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,optimset)
optimum value is 0 0.8 but, matlab execution value is
x1 =
0.0000
0.7153
how do i fix it?
1 Comment
Torsten
on 27 Sep 2017
You don't have to pass "optimset" to "fmincon", but "options":
[x1, fval1] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)
Best wishes
Torsten.
Accepted Answer
More Answers (1)
Walter Roberson
on 27 Sep 2017
0 votes
fmincon is not a global optimizer. You need one of the tools from the Global Optimization Toolbox, such as ga or particleswarm or bounded simulated annealing or patternsearch. (Note: none of those can promise to find the global minima either -- but fmincon doesn't even try.)
Categories
Find more on 솔버 선택하기 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!