如何在CPLEX OPL中输入3索引参数的数据?

时间:2017-07-15 11:08:56

标签: cplex

我的问题中有一个变量X [i] [j] [k]。如何在CPLEX中的.dat文件中输入此数据?

假设i = 2,j = 2,k = 3

供应商1(i)组件1(j)20 30 40                组件2 50 20 10 供应商2组件1(j)20 80 40                组件2 10 20 10

1 个答案:

答案 0 :(得分:0)

您可以查看示例

CPLEX_Studio127\opl\examples\opl\models\YieldStochastic

您将在.mod

中看到
{string} classes = {"First", "Business", "Economy"};
int capacity[classes] = [37, 38, 47];

// Planned periods 
range periods = 1..3;

// 3 scenarios are studied with their corresponding probability
range scenarios = 1..3;
float probaScenarios[scenarios] = [0.1, 0.7, 0.2];

// 3 pricing options for each class and period
range options = 1..3;
int priceOptions[periods][classes][options] = ...;

然后在.dat

priceOptions = 
  [[[1200,1000,950],
    [900,800,600],
    [500,300,200]],
   [[1400,1300,1150],
    [1100,900,750],
    [700,400,350]],
   [[1500,900,850],
    [820,800,500],
    [480,470,450]]];

问候