为什么我在 ILOG CPLEX 中的工作没有解决方案?

Why my work in ILOG CPLEX have no solution?

本文关键字:工作 解决方案 ILOG CPLEX 为什么      更新时间:2023-10-16

我正在研究ILOG CPLEX中的生产混合问题。但是也会出现一些问题。我的工作是关于锯木厂的生产组合(从原木转换的木材产品的生产计划(。我试图使用 2 个文件.dat来解决我的问题,一个使用虚拟数据,一个使用真实数据。

使用虚拟数据处理显示了解决方案,但是当我使用真实数据时,结果显示没有解决方案。因此,我尝试使用真实数据更改每个虚拟数据(逐个查看导致问题的数据(。事实证明,数据是"LumberRecFac"和"DemandMaks"。然后,我尝试用几个随机数更改这两个数据。它显示"LumberRecFac"的最大数据为0.5,"DemandMaks"的最大数据为10.9。

我的 .mod 和 .dat 中有什么遗漏/错误的地方吗?因为我必须使用我的真实数据运行我的 ILOG CPLEX .mod。

这是我的 .mod

//product mix
//i= (RST)
//d,l (Log)
//p (Cutting_Pattern)
int i=...;
int d=...;
int l=...;
int p=...;
range RST= 1..i; //Lumber Product(Raw Sawn Timber)
range Diameter_Log=1..d; //Diameter Log
range Panjang_Log=1..l; //Length log
range Cutting_Pattern=1..p; //Cutting Pattern
//set tuple
tuple DMdl{ //diameter and length
int d;
int l;
}
tuple DMdlp{ //diameter, length, and cutting pattern
int d;
int l;
int p;
}
tuple Cdpi{ //conversion factor (from log to lumber products)
int d;
int p;
int i;
}
//set
setof (DMdl) Log={<d,l> | d in Diameter_Log, l in Panjang_Log};
setof (DMdlp) Log_LCR={<d,l,p> | d in Diameter_Log, l in Panjang_Log, p in Cutting_Pattern};
setof (Cdpi) KonversiLog_LCR={<d,p,i> | d in Diameter_Log, p in Cutting_Pattern, i in RST};
//import data
int HargaJual[RST]=...; //Selling price of RST
int BiayaLogBaru[Log]=...; //Cost of new log
int BiayaLogLama[Log]=...; //Cost of old log
int BiayaProduksiLog=...; //Production cost
int BiayaSetup=...; //Setup cost
float LumberRecFac[KonversiLog_LCR]=...; //Conversion Factor (Lumber Recovery Ratio)
float DemandMaks[RST]=...; //Demand
int BM=...; //Big Constant (Big M)
int Tmax=...; //Max Production Time
int ProcessTime[Cutting_Pattern]=...; //Process time for one log
float SetupTime[Cutting_Pattern]=...; //Setup time
float TotalLogLamaSimpan[Log]=...; //Quantity of old log
//decision variable
dvar float+ Pi[RST]; //Quantity of lumber products
dvar float+ VF[RST]; //Quantity of selling lumber products
dvar boolean CPp[Cutting_Pattern]; 
dvar float TotalLogBaruBeli[Log]; //Quantity of new lod that have to buy
dvar float+ LogProduksi[Log_LCR]; //Total quantity of log to produce
dvar float+ LogBaruDipakai[Log]; //Total quantity of new log that processed
dvar float+ LogLamaDipakai[Log]; //Total quantity of old log that processed
dvar float+ TotalLogSimpan[Log]; //Total inventor of new log 
//objective function
dexpr float sales=sum(i in RST) VF[i]*HargaJual[i];
dexpr float purchased=sum(d in Diameter_Log, l in Panjang_Log) (TotalLogBaruBeli[<d,l>]*BiayaLogBaru[<d,l>])+(LogLamaDipakai[<d,l>]*BiayaLogLama[<d,l>]);
dexpr float production=sum(d in Diameter_Log, l in Panjang_Log) LogProduksi[<d,l,p>]*BiayaProduksiLog;
dexpr float setup=sum(p in Cutting_Pattern) BiayaSetup*CPp[p];
maximize sales-(purchased+production+setup);
//constraint
subject to{
//constraint 1 : raw material inventory
forall (d in Diameter_Log, l in Panjang_Log)
TotalLogBaruBeli[<d,l>]==LogBaruDipakai[<d,l>]+TotalLogSimpan[<d,l>];
forall (d in Diameter_Log, l in Panjang_Log)
TotalLogLamaSimpan[<d,l>]>=LogLamaDipakai[<d,l>];
//constraint 2 : log processing
forall (l in Panjang_Log, i in RST) 
sum(d in Diameter_Log, p in Cutting_Pattern) LogProduksi[<d,l,p>]*LumberRecFac[<d,p,i>]==Pi[i];
forall (d in Diameter_Log, l in Panjang_Log)
sum(p in Cutting_Pattern )LogProduksi[<d,l,p>]==LogLamaDipakai[<d,l>]+LogBaruDipakai[<d,l>];
forall (p in Cutting_Pattern)
sum(d in Diameter_Log, l in Panjang_Log) LogProduksi[<d,l,p>]<=BM*CPp[p];
forall (p in Cutting_Pattern)
sum(d in Diameter_Log, l in Panjang_Log) (LogProduksi[<d,l,p>]*ProcessTime[p])+(SetupTime[p]*CPp[p])<=Tmax;
//constraint 3 : production management and demand satisfaction
forall (i in RST)
Pi[i]>=VF[i];
forall (i in RST)
VF[i]==DemandMaks[i];
}

这是我的虚拟数据

i = 3;
d = 2;
l = 2;
p = 1;
HargaJual= [1500 1400 1600];
BiayaLogLama=[100 250 
200 400];
BiayaLogBaru=[150 250 
300 450];
BiayaProduksiLog= 400;
BiayaSetup= 5;
LumberRecFac= [0.5  0.5 0.5
0.5  0.5    0.5];
DemandMaks= [9.8 10.9 10.8];
BM= 10000;
Tmax= 48;
ProcessTime= [1];
SetupTime= [0.1];
TotalLogLamaSimpan=[2   1
1   2];

这是我的真实数据

i = 10;
d = 2;
l = 5;
p = 1;
HargaJual= [3114984 
43347890 
22956482 
7775850 
15380010 
16984110
8703344 
3500008 
3288741 
2525224 
];
BiayaLogLama=[2328042 2834346 3035619 3044953 3199186
4446927 4872151 4924974 6006590 6637329];
BiayaLogBaru=[2360389   3291645 3212665 3231400 3453636
4456572 4884165 5057298 6261820 6733965];
BiayaProduksiLog=  17435453;
BiayaSetup= 5;
LumberRecFac= [0.0127 0.0145 0.0982 0.1353 0.4127 0.0001 0.2800 0.0107 0.1348 0.0166 
0.6842 0.2105 0.0643 0.2359 0.4730 0.0497 0.3728 0.0187 0.2393 0.0434];
DemandMaks= [188.110
75.259
121.711
253.759
1206.444
5.248
180.735
0
164.510
0];
BM= 1000000;
Tmax= 480;
ProcessTime= [1];
SetupTime= [0.1];
TotalLogLamaSimpan=[0.030   2.770
3.776   5.530
2.993   3.880
1.678   2.970
1.588   0.140];

你的模型是不可行的。如果您标记约束,则 CPLEX 将为您提供一些放松和冲突,以帮助您理解原因。

例如:

forall (d in Diameter_Log, l in Panjang_Log)
ct1:TotalLogLamaSimpan[<d,l>]>=LogLamaDipakai[<d,l>];
//constraint 2 : log processing
forall (l in Panjang_Log, i in RST) 
ct2:sum(d in Diameter_Log, p in Cutting_Pattern) LogProduksi[<d,l,p>]*LumberRecFac[<d,p,i>]==Pi[i];

将显示与CT2的冲突,如果将其删除,则会得到可行的解决方案