lingo代码错误,不能运行,麻烦帮我纠正!Three products;PRODUCT/A,B,C/;Two distctrs;DISTCTR/DCl,DC2/:F;Five customers;CUSTOMER/C1,C2,C3,C4,C5/;D=Demand for a product by a customer.;DEMLINK(PRODUCT,CUSTOMER):D;Each
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 13:26:52
lingo代码错误,不能运行,麻烦帮我纠正!Three products;PRODUCT/A,B,C/;Two distctrs;DISTCTR/DCl,DC2/:F;Five customers;CUSTOMER/C1,C2,C3,C4,C5/;D=Demand for a product by a customer.;DEMLINK(PRODUCT,CUSTOMER):D;Each
lingo代码错误,不能运行,麻烦帮我纠正!
Three products;
PRODUCT/A,B,C/;
Two distctrs;
DISTCTR/DCl,DC2/:F;
Five customers;
CUSTOMER/C1,C2,C3,C4,C5/;
D=Demand for a product by a customer.;
DEMLINK(PRODUCT,CUSTOMER):D;
Each customer is served by one DC,
indicated by Z.;
ZLINK(PRODUCT,DISTCTR,CUSTOMER):Z;
C=Cost/ton of a product to a DC,
X=tons shipped.
CLINK(PRODUCT,DISTCTR):C,X;
G=Cost/ton of a product from a DC to a customer.;
GLINK(PRODUCT,DISTCTR,CUSTOMER):G;
ENDSETS
DATA:
Shipping costs,plant to DC;
C=3,3.5,ProductA;
3.5,3,Product B;
3.5,3; Product C
DC fixed costs;
F=30000,35000;
Shipping costs,DC to customer;
G=22,30,33,30,26,Product A;
25,33,36,30,28,
27,30,33,29,26,Product B:
25,32,35,29,26,
25,30,33,29,26,Product C:
25,32,33,29,28;
Customer Demands;
D=80,100,100,200,100,
240,160,280,150,150,
280,100,200,170,240;
ENDDATE
--------------------------------------
Objective function minimizes costs.
[OBJ]MIN=SHIPDC+SHIPCUST+FXCOST.
SHIPDC=@SUM(CLINK:C*X);
SHIPCUST=
@SUM(GLINK(I,H,J):
G(I,H,J)*D(I,J)*Z(I,H,J));.
FXCOST=@SUM(DISTCTR:F*Y);
DC balance constraints;
@FOR(PRODUCT(I):
@FOR(DISTCTR(H):
X(I,H)=
@sum(CUSTOMER(J):D(I,J)*Z(I,H,J)))
);
Demands;
@FOR(PRODUCT(I):
@FOR(CUSTOMER(J):
@SUM(DISTCTR(H):Z(I,H,J))=1)
);
Z binary;
@FOR(PRODUCT(I):
@FOR(DISTCTR(H):
@FOR(CUSTOMER(J):@BIN(Z(I,H,J))))
);
END
我这方面不太清楚,我把那程序显示的最优结果给出一部分吧,
lingo代码错误,不能运行,麻烦帮我纠正!Three products;PRODUCT/A,B,C/;Two distctrs;DISTCTR/DCl,DC2/:F;Five customers;CUSTOMER/C1,C2,C3,C4,C5/;D=Demand for a product by a customer.;DEMLINK(PRODUCT,CUSTOMER):D;Each
model:
SETS:
JIZU/1..8/:P;
CHULI/1..12/;
T(CHULI,JIZU):B,O,Q;
Di/1..8/:M;
Vi/1..8/:N;
XIANZHI/1..8/:E,F;
ENDSETS
DATA:
Q=
70 70 87 120 120 120 150 150 150 150 153 190
30 30 50 58 58 73 79 81 81 81 88 89
110 110 132 150 150 180 180 200 228 240 240 280
55 60 60.5 70 80 90 99.5 100 115 115 115 116
75 80 95 95 98 110 125 125 135 145 152 155
95 95 95 105 125 125 140 150 155 170 170 180
50 60.1 65 70 85 95 102.1 105 110 120 123 125
63 70 70 90 90 110 110 117 130 140 155 160
;
B=
-505 0 124 124 168 210 252 312 330 363 489 489
-560 0 182 203 203 245 300 320 360 410 495 495
-610 0 152 152 189 233 258 308 356 356 415 500
500 150 170 170 200 255 302 302 325 380 435 800
-590 0 116 146 188 188 215 250 310 396 510 510
-607 -607 0 159 173 205 252 305 380 380 405 520
-500 120 120 180 251 260 306 306 315 335 348 548
-800 -800 153 183 233 253 283 303 303 318 400 800
;
M=120 73 180 80 125 125 81.1 90;
N=2.2 1 3.2 1.3 1.8 2 1.4 1.8;
ENDDATA
@FOR(T(I,J):@BIN(O(I,J)));
@FOR(JIZU(J):@SUM(T(I,J):O(I,J))=1);
@FOR(XIANZHI(I):E(I)=M(I)+15*N(I));
@FOR(XIANZHI(I):F(I)=M(I)-15*N(I));
@FOR(JIZU(J):P(J)=@SUM(jizu(I):O(I,J)*Q(I,J)));
@for(JIZU(i):p(i)>=f(i);P(i)<=e(i););
@SUM(T(I,J):B(I,J)*O(I,J))>=982.4;
[OBJ]MIN=@SMAX(P(1),P(2),P(3),P(4),P(5),P(6),P(7),P(8));
END
(982.4的那行应该是B(I,J)*O(I,J)吧?)
结果如下:
Global optimal solution found.
Objective value: 132.0000
Objective bound: 132.0000
Infeasibilities: 0.000000
Extended solver steps: 1
Total solver iterations: 1507