cplex 中多周期多产品聚合生产计划问题建模

问题描述 投票:0回答:1

这是我尝试输入 cplex 的模型 Model

这些是描述上述模型的描述

Sets:
P: set of all products
K: set of all work centres
L: set of all operations
L(k): set of operations l processed on work centres k in K

Indices:
t: period index
p: product index
k: work centre index
l: operation index

Parameters:
alpha{pl}: Processing time of operation l of product p
C{k}: Maximum capacity of work centre k in units of products
LT_{l}: Lead time of operation l in L
D_{pt}: Demand of product p at the end of period t
h_{pt}: Unit inventory cost of product p at the end of period t
b_{ps}: Unit backlogging cost of product p at the end of period t
w_{pl}: Unit work in progress cost of product p at the end of operation l

Decision variables:
X_{plt}: Quantity of product p released in period t to operation l
X_{p1t}=Xin{pt}: Quantity of product p released into first station in the line at period t 
Y_{plt}: Quantity of product p completing its operation l at period t
Y_{pLt}=Yout{pt}: Output quantity of product p at period t
W_{plt}: Work in progress of product p, at operation l at the end of period t
I_{pt}: Inventory level of product p at the end of period t
B_{pt}: Backlogging level of product p at the end of period t

dat 文件

Products = {P1 P2 P3};
Workshops = {W1 W2 W3 W4 W5 W6 W7 W8 W9 W10};
NbOperations = 10;
NbPeriods = 3;
L = [{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}];
ProcessingTime = [[2, 8, 3, 4, 2, 1, 0, 0, 0, 0],
                  [2, 8, 3, 4, 2, 2, 7, 6, 5, 4],
                  [2, 8, 3, 4, 5, 2, 7, 6, 0, 0]];
Capacity = [4,2,2,1,1,1,1,3,1,5];
LeadTime = [1,1,3,5,0,0,3,0,0,0];
Demand = [[450 150 140]
          [500 300 300]
          [400 500 500]];
InventoryCost = [[60 60 60]
                 [60 60 60]
                 [60 60 60]];
BackloggingCost = [[50 50 50]
                    [50 50 50]
                    [50 50 50]];
WorkInProgressCost = [[10 10 10 10 10 10 10 10 10 10]
                      [10 10 10 10 10 10 10 10 10 10]
                      [10 10 10 10 10 10 10 10 10 10]];
Inventory = [0 0 0];
Backlog = [0 0 0];
WorkInProgress = [0 0 0];

模组文件

//Indices
{string} Products = ...;
{string} Workshops = ...;
int NbOperations = ...; range Operations = 1..NbOperations;
int NbPeriods = ...; range Periods = 1..NbPeriods;
int LeadTime[Operations]= ...;

//Parameters and Data
float ProcessingTime[Products][Operations] = ...;
float Capacity[Workshops] = ...;
{int} L[Workshops] = ...;
float Demand[Products][Periods] = ...;
float InventoryCost[Products][Periods] = ...;
float BackloggingCost[Products][Periods] = ...;
float WorkInProgressCost[Products][Operations] = ...;
float Inventory[Products] = ...;
float Backlog[Products] = ...;
float WorkInProgress[Products] = ...;

//Desicion Variables
dvar int+ X[Products][Operations][Periods];
dvar int+ Y[Products][0..NbOperations][Periods];
dvar int+ Xin[Products][1..NbPeriods];
dvar int+ Yout[Products][Periods];
dvar float+ WIP[Products][Operations][0..NbPeriods];
dvar float+ InventoryLevel[Products][0..NbPeriods];
dvar float+ BackloggingLevel[Products][0..NbPeriods];

//Objective Function
minimize (sum(p in Products,l in Operations,t in Periods) (WorkInProgressCost[p][l]*WIP[p][l][t]) + sum(p in Products,t in Periods) (InventoryCost[p][t]*InventoryLevel[p][t]+BackloggingCost[p][t]*BackloggingLevel[p][t]));

subject to
{
  forall(p in Products,l in Operations,t in Periods)
  ct1:
    X[p][l][t] == Y[p][l-1][t];
    
  forall(p in Products,l in Operations,t in Periods)
  ct2:
    WIP[p][l][t] == WIP[p][l][t-1] + X[p][l][t] - Y[p][l][t];
  
  forall(p in Products,l in Operations,t in Periods: (t-LeadTime[l]) in 1..NbPeriods)
  ct3:
    Xin[p][t-LeadTime[l]] == Y[p][l][t];
  
  forall(p in Products,t in Periods)
  ct4:  
    Yout[p][t] + InventoryLevel[p][t-1] - BackloggingLevel[p][t-1] - InventoryLevel[p][t] + BackloggingLevel[p][t] == Demand[p][t];
  
  forall(t in Periods,k in Workshops)
  ct5:
    sum(p in Products,l in Operations:l in L[k]) (ProcessingTime[p][l]*Y[p][l][t]) <= Capacity[k];
  
  forall(p in Products)
  ctInventory:
    InventoryLevel[p][0] == Inventory[p];
    
  forall(p in Products)
  ctBacklog:
    BackloggingLevel[p][0] == Backlog[p];
    
  forall(p in Products,l in Operations)
  ctWIP:
    WIP[p][l][0] == WorkInProgress[p];
}

我尝试将所有 obj 函数和约束插入到所示的 cplex 中。我使用的数据集只是随机的小数据来检查和验证。我更改了几种类型的数据,最佳结果始终为 0。池解决方案有其他结果,但我发现它有点奇怪。看来不对。谁能告诉我我的代码有什么问题,或者我只是误解或遗漏了有关建模的一些内容??

linear-programming cplex production
1个回答
0
投票

如果您更改 .dat 以获得更多容量

Capacity = [40,20,20,10,10,10,10,30,10,50];

你设置了一些WIP

WorkInProgress = [10 0 0];

然后你会得到一个具有非空目标的解决方案,可以帮助你调试

© www.soinside.com 2019 - 2024. All rights reserved.