1

我目前正在根据在 cplex 中实施的多容量批量大小问题在买方和供应商之间建立谈判。在一个小场景中,买方生产项目 1-4,而供应商负责供应项目 5-7。

我想做的是创建三组:

{int} buyeroperations

{int} supplieroperations

{int} operations = buyerops union supplierops

我现在的问题是,因为我对 cplex/opl 还很陌生,所以如何用相应的项目初始化集合,以便在我的模型中使用它们。我想我可以通过以下方式在内部初始化它们:

{int} buyeroperations = asSet(1..4) 

{int} supplieroperations = asSet(5..7) 

{int} operations = buyeroperations union supplieroperations

我对么?但是,我可以通过脚本和 for 循环以不同的方式初始化集合吗?

如前所述,最终我想要三组,前四项分配给买方操作,第 5-7 项分配给供应商操作,然后是关于所有这些的一组操作。

感谢您提前提供任何帮助。

4

1 回答 1

1

我会将模型和数据文件分开以使事情变得更容易。在模型文件中,我将拥有:

{int} buyeroperations = ...;
{int} supplieroperations = ...;
{int} operations = buyeroperations union supplieroperations;

在数据文件中,我将拥有:

buyeroperations = [1,2,3,4] // same as [1..4]
supplieroperations = [5,6,7] // same as [5..7]

如果有很多数据,初始化集合的最佳方法是使用数据库。您展示的内容也应该有效。

于 2013-07-20T19:26:34.793 回答