作业帮 > 英语 > 作业

lingo运行时出现improper use of set name!

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:英语作业 时间:2024/05/05 10:03:56
lingo运行时出现improper use of set name!
MODEL:
建立集合;
SETS:
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:G;
GLINK(PRODUCT,DISTCTR,CUSTOMER):G;
ENDSETS
DATA:
Shipping costs,plant to DC;
C=3,3.5,Product A;
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;
ENDDATA
----------------------------------- ;
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));
Five customers;
FXCOST=@SUM(DISTCTR:F*X);
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
FXCOST=@SUM(DISTCTR:F*X); 这一句显示是F出现错误,
lingo运行时出现improper use of set name!
MODEL:
!建立集合;
SETS:
!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: G;
GLINK(PRODUCT,DISTCTR,CUSTOMER):G;
ENDSETS
DATA:
!Shipping costs,plant to DC;
C=3,3.5, !Product A;
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;
ENDDATA
!----------------------------------- ;
!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));
!Five customers;
FXCOST=@SUM(CLINK(I,J):F(J)*X(I,J));
!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