2017-07-15 34 views
0

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

允许假设我= 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

回答

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]]]; 

问候