Search code examples
cplexopl

Reading a simple 1D array declared inside tuple from excel in CPLEX


When I'm trying to read a 1D array which has been declared inside array of tuples, the error "IBM ILOG Concert: excel: range width does not fit the arity of the tuple" is popping up. What am I doing wrong here?

*.mod file is:

 int a=5;
 range r=1..a;
 
 tuple new{
    int b;
    int c;
    int d;
    int e[1..4]; 
 }
 
 new test[r]=...;

*.dat file is:

SheetConnection sheet("test_sheet.xlsx");
 
test from SheetRead(sheet,"data");

"data" (5 rows and 7 columns) defined in test_excel.xlsx file:

b   c   d   e[1]    e[2]    e[3]    e[4]
10  9   6    5       4       6       4
4   8   7    5       10      5       5
8   9   5    1       2       4       9
8   2   1    1       4       7       3
5   4   9    5       7       8       5

Solution

  • I would read a tuple set with 7 components that I would then convert into the right structure.

    See example at

    https://www.ibm.com/developerworks/community/forums/html/topic?id=cc929555-fab5-4895-a33c-9522e43148f6&ps=25