【发布时间】:2020-02-24 12:18:05
【问题描述】:
我在 1:31 分钟停止,这是引擎日志输出:我正在使用 CP 制作模型以进行目标编程 - 字典。数据来自一个excel文件。 问题是:软件正在运行,正在运行....没有答案。 我可以看到它正在工作,因为时间在右下角过去。数据不是太大,我在 CPLEX 的其他分析中使用了相同的数据,效果很好。
Excel 文件: https://drive.google.com/open?id=1rOKhqlegKo-BHJnJj9cnnpKMdwpktYlX
1) 有人能看出什么问题吗? 2)只要确保,使用 CP 不可能将 dvar 作为 float+,对吗?
谢谢
.mod
using CP;
// variable decision
{string} Forest = ...;
{string} Products = ...;
{string} Destination = ...;
float Demand [Destination][Products]= ...; //volume in Kg
float Distance [Forest][Destination]= ...; //in Km
float Stock [Forest][Products]= ...; //volume in Kg
float Freshness [Forest][Products]=...; `
//Decision Variables
dvar int+ Delivered [Forest][Destination][Products];
//Expressoes
dexpr float Opt_Distance = sum (u in Forest, c in Destination, p in Products) Distance[u][c] * Delivered[u][c][p];
dexpr float Opt_Freshness = sum (u in Forest, c in Destination, p in Products) Freshness[u][p] * Delivered[u][c][p];
//Objective Function
minimize staticLex (Opt_Distance,Opt_Freshness);
//Constraint
subject to {
forall (p in Products)
forall (u in Forest)
sum (c in Destination)
Delivered[u][c][p] <= Stock [u][p];
forall (p in Products)
forall (c in Destination)
sum (u in Forest)
Delivered[u][c][p] >= Demand[c][p];
}
.dat
// variable decision
Forest = {"F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16","F17","F18","F19","F20","F21","F22","F23","F24","F25","F26","F27","F28","F29","F30","F31","F32","F33","F34","F35","F36","F37","F38","F39","F40","F41","F42","F43","F44","F45","F46","F47","F48","F49","F50"};
Products = {"P1","P2","P3","P4"};
Destination = {"D1","D2","D3","D4","D5","D6","D7","D8","D9","D10"};
SheetConnection sheet("...Data_test.xlsx");
Demand from SheetRead(sheet,"Demand");
Distance from SheetRead(sheet,"Distance");
Stock from SheetRead(sheet,"Stock");
Freshness from SheetRead(sheet,"Freshness");
【问题讨论】:
-
您至少应该将引擎日志输出添加到您的帖子中。否则无法判断可能发生的情况。如果您还可以添加 Excel 电子表格,我们可以尝试在此处运行您的模型。这可能会更清楚地说明正在发生的事情。
-
你能澄清一下到底是什么问题吗?从引擎输出我们可以看到求解器找到了许多可行的解决方案,然后手动中断。所以它确实找到了一些东西。它只是无法证明最优性。这可能需要任意时间(参见 Petr 的回答)。
标签: cplex opl lexicographic