fmincon does not satisfy one of the constraints

1 visualización (últimos 30 días)
Fevzi
Fevzi el 31 de Mayo de 2012
Hello,
I want to solve a nonlinear constrained optimization problem. I prepared 3 m-files which are for constraints, objective function and calling optimization toolbox.
M-File to call the optimization toolbox is following:
lb = [12.5;0.000460;0.005]; ub = [75;0.000786;0.160]; A =[]; Aeq= []; b = []; beq = []; x0= [32;0.00058;0.1]; [x,fval,exitflag,output] = fmincon(@microobj,x0,A,b,Aeq,beq,lb,ub,@microcons) [c,ceq] = microcons(x)
M-File for constraints is following:
function [c,ceq] = microcons(x)
b1 = -152.103; b2 = 2.16514; b3 = 1113.81; b4 = 204245; b5 = -0.0179843; b6 = -3391.78; b7 = -248075399; b8 = -7.60179; b9 = 1242.21; b10 = -45237.6; w = 0.500; n = w/x(3); D = 0.4; N = (x(1)*1000)/(pi*D); vL = 12.5; vU = 75; fzL = 0.000460; fzU = 0.000786; DocL = 0.005; DocU = 0.160; TlL = 0; TlU = 20.5; nL = 10000; nU = 60000;
Tl = b1+x(1)*b2+x(3)*b3+x(2)*b4+(x(1)^2)*b5+(x(3)^2)*b6+(x(2)^2)*b7+x(1)*x(3)*b8+x(1)*x(2)*b9+x(2)*x(3)*b10;
c = [vL-x(1);x(1)-vU;fzL-x(2);x(2)-fzU;DocL-x(3);x(3)-DocU;TlL-Tl;Tl-TlU;nL-N;N-nU];
ceq = [(n*x(3))-w];
M-File for objective function is following:
function f = microobj(x)
b1 = -152.103; b2 = 2.16514; b3 = 1113.81; b4 = 204245; b5 = -0.0179843; b6 = -3391.78; b7 = -248075399; b8 = -7.60179; b9 = 1242.21; b10 = -45237.6;
ae = 0.7; D = 0.4; A = 3.2; k = (A-D)/(2*ae*D); L = ((4*k*(k+1)*ae*D) + (2*ae*D)); dL = (k-1)*sqrt(2)*ae*D; Lc = L + dL; Lr = (sqrt(2)*(A-D))/2; w = 0.500; n = w/x(3); N = (x(1)*1000)/(pi*D); z = 2;
frCut = x(2)*z*N;
Tl = b1+x(1)*b2+x(3)*b3+x(2)*b4+(x(1)^2)*b5+(x(3)^2)*b6+(x(2)^2)*b7+x(1)*x(3)*b8+x(1)*x(2)*b9+x(2)*x(3)*b10;
Tm = (Lc/frCut)*n;
c0 = 1; CM = c0* Tm;
Ts = 3; CS = c0*Ts;
Tc = 3; CR = c0*Tc*(ceil(Tm/Tl));
tC = 50; CT = tC*(ceil(Tm/Tl));
f = CM + CS + CR + CT;
However, the tool box ignores "TlL = 0; TlU = 20.5;" limits and finds a negative Tl value. (When the solution is found, the value of 7th row in c vector is positive instead of negative. When I calculated Tl value using x1, x2, x3 and b1 to b10 values, Tl value is sufficiently large negative number). Then I wrote "TlL = 0.0000000001;" (1*10^-10) instead of "TlL = 0;", toolbox finds a reasonable result. Finally I increased the decimals to test whether toolbox always consider the TlL limit or not. When I tested the program for "TlL = 0.0000000000000001;" (1*10^-16), the program again gives a problematic result. I couldn't understand the reason of this problem. If it was a problem with # of decimal digits, it should not give a reasonable results for 1*(10^(-15)) or 1*(10^(-13))
Best Regards,

Respuestas (0)

Categorías

Más información sobre Problem-Based Optimization Setup en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by