Given the bilinear NLP below:
min f = x1 - x2 - y1 -x1y1 + x1y2 + x2y1 -x2y2
st. x1 + 4x2 ≤ 8
4x1 + x2 ≤ 12
3x1 + 4x2 ≤ 12
2y1 + y2 ≤ 8
y1 + 2y2 ≤ 8
y1 + y2 ≤ 5
0 ≤ x1, x2, y1, y2 ≤ 10
Gams Programi ile cozum kodlari asagidadir.
Ve programi indirme linki de -- https://hotfile.com/dl/189462700/7fa60ac/a)bilinearnlp.rar.html
sets
i iterations/1*10/ ;
variables
x1,x2,y1,y2,func;
parameters
objfun(i)
x1par
x2par
y1par
y2par;
equations
eq,q1,q2,q3,q4,q5,q6;
eq.. func=e=x1-x2-y1-x1*y1+x1*y2+x2*y1-x2*y2;
q1.. x1+4*x2=l=8;
q2.. 4*x1+x2=l=12;
q3.. 3*x1+4*x2=l=12;
q4.. 2*y1+y2=l=8;
q5.. y1+2*y2=l=8;
q6.. y1+y2=l=5;
x1.lo=0;
x2.lo=0;
y1.lo=0;
y2.lo=0;
y2.up=10;
y1.up=10;
x2.up=10;
x1.up=10;
*starting point
*x1.l=0;
*x2.l=0;
*y1.l=0;
*y2.l=0;
*model Exercise /all/;
model bilinear/all/;
loop (i,
x1.l=uniform(0,10);
x1par(i)=x1.l;
x2.l=uniform(0,10);
x2par(i)=x2.l;
y1.l=uniform(0,10);
y1par(i)=y1.l;
y2.l=uniform(0,10);
y2par(i)=y2.l;
*solve the problem
solve bilinear minimizing func using NLP;
*store the value
);
display x1par,x2par,y1par,y2par;
*solve Exercise minimizing func using nlp;
sonuclar:
Hiç yorum yok:
Yorum Gönder