【问题标题】:Multi Goal Programming - CPLEX OPL - Minimize deviations多目标编程 - CPLEX OPL - 最小化偏差
【发布时间】: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];

}

【问题讨论】:

    标签: cplex opl


    【解决方案1】:

    如果您的 kpi 是 p1 和 p2,您可以使用 staticLex 并编写

    minimize staticLex(p1,p2);
    

    【讨论】:

    • 谢谢。但是在这种情况下,我需要使用CP,对吗?所以,dvar 必须是 int,对吧?你有一些这样的例子,我可以一步一步地阅读吗?我仍然对如何声明约束和 dvar 感到困惑。
    • staticLex 是 Lexicographic,我正在寻找一个按 weight 编程的目标,所有权重都将为零。抱歉,我的问题并不清楚这一点
    • 然后你可以使用流控制和主块。见ibm.com/developerworks/community/forums/html/…
    猜你喜欢
    • 1970-01-01
    • 2021-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多