model: sets: gch/1..7/:p,s; gd/1..15/:A,y,z; links(gch,gd):x,c; endsets data: p = 160 155 155 160 155 150 160; s = 800 800 1000 2000 2000 2000 3000; c = 170.7 160.3 140.2 98.6 38 20.5 3.1 21.2 64.2 92 96 106 121.2 128 142 215.7 205.3 190.2 171.6 111 95.5 86 71.2 114.2 142 146 156 171.2 178 192 230.7 220.3 200.2 181.6 121 105.5 96 86.2 48.2 82 86 96 111.2 118 132 260.7 250.3 235.2 216.6 156 140.5 131 116.2 84.2 62 51 61 76.2 83 97 255.7 245.3 225.2 206.6 146 130.5 121 111.2 79.2 57 33 51 71.2 73 87 265.7 255.3 235.2 216.6 156 140.5 131 121.2 84.2 62 51 45 26.2 11 28 275.7 265.3 245.2 226.6 166 150.5 141 131.2 99.2 76 66 56 38.2 26 2; enddata min = W + Q + T; W = @sum(links(i,j):p(i)*x(i,j)); Q = @sum(links(i,j):c(i,j)*x(i,j)); T = @sum(gd(j):(1+y(j))*y(j)+(1+z(j))*z(j))*0.05; z(1)+y(2)=104 ; z(2)+y(3)=301 ; z(3)+y(4)=750 ; z(4)+y(5)=606 ; z(5)+y(6)=194 ; z(6)+y(7)=205; z(7)+y(8)=201; z(8)+y(9)=680; z(9)+y(10)=480; z(10)+y(11)=300; z(11)+y(12)=220; z(12)+y(13)=210; z(13)+y(14)=420; z(14)+y(15)=500; y(1)+z(1) = @sum(gch(i):x(i,1)); y(2)+z(2) = @sum(gch(i):x(i,2)); y(3)+z(3) = @sum(gch(i):x(i,3)); y(4)+z(4) = @sum(gch(i):x(i,4)); y(5)+z(5) = @sum(gch(i):x(i,5)); y(6)+z(6) = @sum(gch(i):x(i,6)); y(7)+z(7) = @sum(gch(i):x(i,7)); y(8)+z(8) = @sum(gch(i):x(i,8)); y(9)+z(9) = @sum(gch(i):x(i,9)); y(10)+z(10) = @sum(gch(i):x(i,10)); y(11)+z(11) = @sum(gch(i):x(i,11)); y(12)+z(12) = @sum(gch(i):x(i,12)); y(13)+z(13) = @sum(gch(i):x(i,13)); y(14)+z(14) = @sum(gch(i):x(i,14)); y(15)+z(15) = @sum(gch(i):x(i,15)); @for(gch(i):@sum(gd(j):x(i,j))<=s(i)); end 请将上述Lingo编程转换为GAMS语言
时间: 2023-10-28 19:05:52 浏览: 91
Libgcc_s_dw2-1.h.gch
以下是将Lingo代码转换为GAMS语言的代码:
```
SETS
gch /1*7/
gd /1*15/;
PARAMETERS
p(gch)
s(gch)
c(gch, gd);
VARIABLES
x(gch, gd)
y(gd)
z(gd)
W
Q
T;
MINIMIZE
W + Q + T;
W.EQUATION
W = SUM((gch, gd), p(gch) * x(gch, gd));
Q.EQUATION
Q = SUM((gch, gd), c(gch, gd) * x(gch, gd));
T.EQUATION
T = SUM(gd, ((1 + y(gd)) * y(gd) + (1 + z(gd)) * z(gd)) * 0.05);
z('1') + y('2') = 104;
z('2') + y('3') = 301;
z('3') + y('4') = 750;
z('4') + y('5') = 606;
z('5') + y('6') = 194;
z('6') + y('7') = 205;
z('7') + y('8') = 201;
z('8') + y('9') = 680;
z('9') + y('10') = 480;
z('10') + y('11') = 300;
z('11') + y('12') = 220;
z('12') + y('13') = 210;
z('13') + y('14') = 420;
z('14') + y('15') = 500;
y('1') + z('1') = SUM(gch, x(gch, '1'));
y('2') + z('2') = SUM(gch, x(gch, '2'));
y('3') + z('3') = SUM(gch, x(gch, '3'));
y('4') + z('4') = SUM(gch, x(gch, '4'));
y('5') + z('5') = SUM(gch, x(gch, '5'));
y('6') + z('6') = SUM(gch, x(gch, '6'));
y('7') + z('7') = SUM(gch, x(gch, '7'));
y('8') + z('8') = SUM(gch, x(gch, '8'));
y('9') + z('9') = SUM(gch, x(gch, '9'));
y('10') + z('10') = SUM(gch, x(gch, '10'));
y('11') + z('11') = SUM(gch, x(gch, '11'));
y('12') + z('12') = SUM(gch, x(gch, '12'));
y('13') + z('13') = SUM(gch, x(gch, '13'));
y('14') + z('14') = SUM(gch, x(gch, '14'));
y('15') + z('15') = SUM(gch, x(gch, '15'));
SUBJECT TO
capacity(gch)..
SUM(gd, x(gch, gd)) <= s(gch);
MODEL transportation /ALL/;
SOLVE transportation USING LP MINIMIZING W;
```
阅读全文