趣味新聞網記者特別報導 : 小弟我需要幫忙,請各位LINGO高手求助幫忙檢查為何以下程式碼無法運作我已經翻瞭很多書籍,就是解不掉。MODEL:SETS: Time /1..5/; Vendor /1..2/; Facility .....
小弟我需要幫忙,請各位LINGO高手求助
幫忙檢查為何以下程式碼無法運作
我已經翻瞭很多書籍,就是解不掉。
MODEL:
SETS:
Time /1..5/;
Vendor /1..2/;
Facility /1..2/;
Warehouse /1..2/;
Customer /1..3/;
Part /1..3/;
Goods /1..1/;
TVP( Time, Vendor, Part):
Ltvp, Mcost, Ltvp_UpBound;
TVFP( Time, Vendor, Facility, Part):
Rtvfp, VF_Tcost;
TFP( Time, Facility, Part):
Ltfp, FM_Icost;
GP( Goods, Part):
BOM;
TFG( Time, Facility, Goods):
Rtfg, Pcost,
Rtfg_UpBound,
Ltfg, FG_Icost;
TFWG( Time, Facility, Warehouse, Goods):
Rtfwg, FW_Tcost;
TWG( Time, Warehouse, Goods):
Ltwg, W_Icost,
Ltwg_UpBound;
TWCG( Time, Warehouse, Customer, Goods):
Rtwcg, WC_Tcost;
TCG( Time, Customer, Goods):
Ltcg;
FG( Facility, Goods): Tbomfg;
VF( Vendor, Facility): Tvf;
FW( Facility, Warehouse): Tfw;
WC( Warehouse, Customer): Twc;
ENDSETS
!----------------------------------------------------------------------------;
DATA:
Mcost = 10.5 6.5 8.5 20.5 7.5 7.5
10.4 6.4 8.4 20.4 7.4 7.4
10.3 6.3 8.3 20.3 7.3 7.3
10.2 6.2 8.2 20.2 7.2 7.2
10.1 6.1 8.1 20.1 7.1 7.1;
Pcost = 0.4 0.45
0.4 0.45
0.4 0.45
0.4 0.45
0.4 0.45;
VF_Tcost = 0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01
0.01 0.01 0.01 0.01 0.01 0.01;
FW_Tcost = 0.2 0.3 0.5 0.1
0.2 0.3 0.5 0.1
0.2 0.3 0.5 0.1
0.2 0.3 0.5 0.1
0.2 0.3 0.5 0.1;
WC_Tcost = 0.6 0.4 0.3 0.3 0.5 0.4
0.6 0.4 0.3 0.3 0.5 0.4
0.6 0.4 0.3 0.3 0.5 0.4
0.6 0.4 0.3 0.3 0.5 0.4
0.6 0.4 0.3 0.3 0.5 0.4;
FM_Icost = 0.02 0.02 0.02 0.01 0.01 0.01
0.02 0.02 0.02 0.01 0.01 0.01
0.02 0.02 0.02 0.01 0.01 0.01
0.02 0.02 0.02 0.01 0.01 0.01
0.02 0.02 0.02 0.01 0.01 0.01;
FG_Icost = 0.1 0.09
0.1 0.09
0.1 0.09
0.1 0.09
0.1 0.09;
W_Icost = 0.07 0.05
0.07 0.05
0.07 0.05
0.07 0.05
0.07 0.05;
Ltvp_UpBound = 500 500 500 500 500 500
500 500 500 500 500 500
500 500 500 500 500 500
500 500 500 500 500 500
500 500 500 500 500 500;
Rtfg_UpBound = 70 35
70 35
70 35
70 35
70 35;
Ltwg_UpBound = 400 500
400 500
400 500
400 500
400 500;
BOM = 1 2 3;
Ltcg = 0 0 0
0 0 0
0 0 0
30 20 10
55 40 50;
Tbomfg = 1 1;
Tvf = 1 1
1 1;
Tfw = 1 1
1 1;
Twc = 1 1 1
1 1 1;
ENDDATA
!--------------------------------------------------------;
MIN = @SUM( TVP(t,v,p):
Ltvp(t,v,p) * Mcost(t,v,p) ) +
@SUM( TVFP(t,v,f,p):
Rtvfp(t,v,f,p) * VF_Tcost(t,v,f,p) ) +
@SUM( TFP(t,f,p):
Ltfp(t,f,p) * FM_Icost(t,f,p) ) +
@SUM( TFG(t,f,g):
Rtfg(t,f,g) * Pcost(t,f,g) ) +
@SUM( TFG(t,f,g):
Ltfg(t,f,g) * FG_Icost(t,f,g) ) +
@SUM( TFWG(t,f,w,g):
Rtfwg(t,f,w,g) * FW_Tcost(t,f,w,g) ) +
@SUM( TWG(t,w,g):
Ltwg(t,w,g) * W_Icost(t,w,g) ) +
@SUM( TWCG(t,w,c,g):
Rtwcg(t,w,c,g) * WC_Tcost(t,w,c,g) );
NP = @Size(Time);
@FOR( TFG: @GIN(Rtfg) );
@FOR( TVFP: @GIN(Rtcfp) );
@FOR( TFWG: @GIN(Rtfwg) );
@FOR( TWCG: @GIN(Rtwcg) );
@FOR( TVP: @GIN(Ltvp) );
@FOR( TFP: @GIN(Ltfp) );
@FOR( TFG: @GIN(Ltfg) );
@FOR( TWG: @GIN(Ltwg) );
Ltfp(1,1,1)=200;
Ltfp(1,1,2)=300;
Ltfp(1,1,3)=300;
Ltfp(1,2,1)=100;
Ltfp(1,2,2)=100;
Ltfp(1,1,3)=100;
Ltfg(1,1,1)=0;
Ltfg(1,2,1)=0;
Ltwg(1,1,1)=0;
Ltwg(1,2,1)=0;
@FOR( TVP: Ltvp <= Ltvp_UpBound);
@FOR( TFG: Rtfg <= Rtfg_UpBound);
@FOR( TWG: Ltwg <= Ltwg_UpBound);
@FOR( TVP(t,v,p): @SUM( Facility(f) : Rtvfp(t,v,f,p) )
= Ltvp(t,v,p) );
@FOR( TFP(t,f,p)|t #LE# Tvf(v,f) : Ltfp(t,f,p)
- @SUM(GP(g,p): BOM(g,p) * Rtfg(t,f,g)) = Ltfp(t+1,f,p) );
@FOR( TFP(t,f,p)|
(t #LT# NP) #AND# (t #GT# Tvf(v,f)): Ltfp(t,f,p)
+ @SUM(Vendor(v)|t #GT# Tvf(v,f) : Rtvfp(t-Tvf(v,f),v,f,p))
- @SUM(GP(g,p): BOM(g,p) * Rtfg(t,f,g)) = Ltfp(t+1,f,p) );
@FOR( TFG(t,f,g)|t #LE# Tbomfg(f,g) : Ltfg(t,f,g)
- @SUM(Warehouse(w): Rtfwg(t,f,w,g)) = Ltfg(t+1,f,g) );
@FOR( TFG(t,f,g)|
(t #LT# NP) #AND# (t #GT# Tbomfg(f,g)) : Ltfg(t,f,g)
+ Rtfg(t-Tbomfg(f,g),f,g)
- @SUM(Warehouse(w): Rtfwg(t,f,w,g)) = Ltfg(t+1,f,g) );
@FOR( TWG(t,w,g)|t #LE# Tfw(f,w) : Ltwg(t,w,g)
- @SUM(Customer(c): Rtwcg(t,w,c,g)) = Ltwg(t+1,w,g) );
@FOR( TWG(t,w,g)|
(t #LT# NP) #AND# (t #GT# Tfw(f,w)) : Ltwg(t,w,g)
+ @SUM(Facility(f)|t #GT# Tfw(f,w) : Rtfwg(t-Tfw(f,w),f,w,g))
- @SUM(Customer(c): Rtwcg(t,w,c,g)) = Ltwg(t+1,w,g) );
@FOR( TCG(t,c,g)|t #GT# Twc(w,c) :
@SUM(Warehouse(w)|t #GT# Twc(w,c) : Rtwcg(t-Twc(w,c),w,c,g))
=Ltcg(t,c,g) );
END
|
分享鏈接