词典模型问题 - CPLEX OPL - 模型永远 运行,没有答案

Problem with lexicographic model - CPLEX OPL - Model is running forever with no answer

我在 1:31min 处停了下来,这是引擎日志输出:我正在制作一个 model 使用 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");

您似乎没有设置任何时间限制。在这种情况下,引擎会搜索最佳解决方案,直到它可以证明当前解决方案是最优的。一般来说,不能保证搜索会在合理的时间内结束(问题可能是NP)。

如日志所示,您在 88 秒后手动停止了搜索 ("by abort"),同时找到了 86 个解决方案。每次找到解决方案时,日志中都会有一行以星号开头。当前最佳 objective 值也打印在日志中(第一列)。

所以我建议在您的模型中添加一些时间限制(或其他类型的限制)。可以这样做:

execute {
  cp.param.timelimit = 120; // In seconds 
}

是的,在 CP 模型中不可能有浮点变量。