fmincon nonconstraints are not meet but the relative maximum constraint violation is less than options.TolCon = 1.000000e-006.

3 views (last 30 days)
i'm using fmincon to do optimization now my problem is that nonlinear constraints at optimal point is
c =
219.2334 -0.8317 -0.0004
which doesn't satisfy c<=0 but the stop details say Optimization stopped because the relative changes in all elements of x are less than options.TolX = 1.000000e-006, and the relative maximum constraint violation, 0.000000e+000, is less than options.TolCon = 1.000000e-006.
my nonlinear constraints are expressed as follows;
[CLtot,CDtot,CDff,machDD,wingmass,vtank] = textread('iter_midres.dat','%f%f%f%f%f%f');
c(1)= (wingmass-con.nmwing*con.mw0); wing mass should be under initial value
c(2)= (-vtank+con.nvtank*con.vt0); % tank volume should be greater
c(3)= (-machDD+con.machd*0.995;
ceq=[];
the start point is a feasible point which gives constraints like :
c =
-208.0625 -0.0286 -0.0007
option set is ptions=optimset('OutputFcn',@outfun,'Diagnostics','on','LargeScale','off','Display','iter',...
'GradObj','off','Algorithm','sqp',...
'TolFun',1e-6,'FinDiffType','forward','Tolcon',1e-6,'TolX',1e-6);
where should the problem be ? options, constraints writing or other problem ?

Answers (1)

Matt J
Matt J on 18 Jul 2014
Maybe you are accidentally passing a different nonlcon function to fmincon than what you think.
Naturally, I assume you copy/pasted the fragment of nonlinear constraint code for us rather than typing it out by hand. But that code could never run without an error message. The expression for c(3) is missing a parenthesis. The expression for c(1) is missing a '%' to separate it from the comments.

Community Treasure Hunt

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

Start Hunting!