Hi I want to calculate minimum of this function but when I using nonlinear constrain, i have this error
x=fmincon(fx,[1,1],[],[],[],[],[1 0.99],[1 1.1],@confun)
No feasible solution found.
fmincon stopped because the size of the current step is less than the default value of the step size tolerance but constraints are not satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
x =
1.000000000000000 1.099999986802130

댓글 수: 5

Walter Roberson
Walter Roberson 2015년 6월 17일
We are going to need to see your confun. fx might help as well.
You realize that you set the lower bound and upper bound to the first element to both be 1, so the first element will always be exactly 1?
Mohammad
Mohammad 2015년 6월 17일
편집: Mohammad 2015년 6월 17일
yes I want the first element be 1. my function is :
f=@(G,r)abs((G*r)/4 + ((G^2*r^2)/16 + (G*r)/4 - 1/4)^(1/2) + 1/2) + abs((2004*G + 200*G*r + 1001*G^2*r + 200)/(6006*G + 600) - ((1003*G + 200*G*r + G^2*r)/(6006*G + 600) - (2004*G + 200*G*r + 1001*G^2*r + 200)^2/(9*(2002*G + 200)^2))/(((G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^2 + ((1003*G + 200*G*r + G^2*r)/(6006*G + 600) - (2004*G + 200*G*r + 1001*G^2*r + 200)^2/(9*(2002*G + 200)^2))^3)^(1/2) + G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^(1/3) + (((G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^2 + ((1003*G + 200*G*r + G^2*r)/(6006*G + 600) - (2004*G + 200*G*r + 1001*G^2*r + 200)^2/(9*(2002*G + 200)^2))^3)^(1/2) + G/(4004*G + 400) + (2004*G + 200*G*r + 1001*G^2*r + 200)^3/(27*(2002*G + 200)^3) - ((1003*G + 200*G*r + G^2*r)*(2004*G + 200*G*r + 1001*G^2*r + 200))/(6*(2002*G + 200)^2))^(1/3));
>> fx=@(x)f(x(1),x(2));
Also my Confun, which saves as mfile is:
function [c, ceq] = confun(x)
% Nonlinear inequality constraints
c = [(x(1)*x(2))-1];
% Nonlinear equality constraints
ceq = [];
this constrain says that G<(1/r) but when I say the answer which give me matlab, these constrain have been ignored.
Since you already know that x(1)=1, what happens when you run as follows:
fx=@(z)f(1,z);
nonlcon=@(z) confun([1,z])
x=fmincon(fx,1,[],[],[],[], 0.99,1.1,nonlcon);
Mohammad
Mohammad 2015년 6월 17일
for simplification the problem i said this actually G and r is not constant
Matt J
Matt J 2015년 6월 17일
But what happens when you do it?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

태그

질문:

2015년 6월 16일

댓글:

2015년 6월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by