【发布时间】:2019-10-29 11:23:11
【问题描述】:
我是 CPLEX 的初学者,如果这个问题很愚蠢,我很抱歉。 我想在 CPLEX (OPL) 的目标编程中最小化偏差。 我看到了一个与我的 (Goal Programming in Cplex) 非常相似的问题,但我还不清楚。
让我们假设以下情况:
首先,我们要优化商店与客户之间的距离,同时考虑所需的需求和库存。我们做到了,最好的解决方案是 602
其次,我们要优化另一件事,同时考虑库存和需求,解决方案是 251.4
然后,我们想制定一个目标编程来实现这两个目标。
这是一个想法(没用):
有什么建议吗? 非常感谢你
// decision variable
{string} Store = {"A","B","C","D","E"};
{string} Products = {"P1","P2"};
{string} Client = {"D1" , "D2"};
float Demand [Client][Products]= [[3,1],[4,5]]; //volume in Kg
float Freshness [Store][Products]=[[140,0],[0,100],[0,90],[50,0],[10,0]]; //Lower numbers must have priority
float Stock [Store][Products]= [[0.94,0],[0,8.62],[0,1.21],[2.6,0],[8.77,0]]; //volume in Kg
float Distance [Store][Client]=[[21,52],[42,12],[25,15],[52,31],[9,42]]; //in Km
//Decision Variables
dvar float+ Delivered [Store][Client][Products];
//Função Objetivo
minimize (p1 + n1+ p2+ n2);
//Restricoes
subject to {
sum (u in Store, c in Client, p in Products)
Distance[u][c] * Delivered[u][c][p] - p1 + n1 <= 657.9;
sum (u in Store, c in Client, p in Products)
Freshness[u][p] * Delivered[u][c][p] - p2 + n2 <= 251.4;
forall (p in Products)
forall (u in Store)
sum (c in Client)
Delivered[u][c][p] <= Stock [u][p];
forall (p in Products)
forall (c in Client)
sum (u in Store)
Delivered[u][c][p] >= Demand[c][p];
}
【问题讨论】: