从 OPL CPLEX 中的工作表初始化二维元组数组

Initializing 2D array of tuples from Sheets in OPL CPLEX

我在 OPL CPLEX 中创建了一个二维元组数组。我可以直接从 .dat 文件初始化数组,但是当我从 excel sheet 初始化数组时,出现错误“N:int,a:float with 2 dimensions not supported sheets”弹出。从 sheet 初始化二维元组数组的功能似乎不存在。是这种情况还是我犯了一些错误?另外,还有其他方法可以解决这个问题吗? 我附上了下面的代码片段。

 /*mod file*/
 int M=...;
 range m=1..M;
 int B=...;
 range b=1..B;
 int T=...;
 range t=1..T;

 tuple data{
    int N;
    float a;
 }

 data d[m][b]=...;

 dvar boolean x[b][m][t];


/*dat file for direct initialization*/
 M=2;
 B=3;
 T=2;

 d=[[<1,1.5>,<2,1>,<7,5.6>],
    [<8,2.7>,<0,5.9>,<9,9.2>]];



 /*dat file for initialization from excel*/
 M=2;
 B=3;
 T=2;

 SheetConnection sheet("B2.xlsx");

 d from SheetRead(sheet,"d");


/*Excel sheet*/

Named Range of d in excel
1   1.5
2   1
7   5.6
8   2.7
0   5.9
9   9.2

如果 d 是 2D 结构,但它是 3D,因为你有 2 个索引 mb 以及一个元组中的 2 个元素。

所以我推荐 IBM 技术说明 Reading a 3-dimensional array from an Excel spreadsheet