Originally posted by: TracyLLL
Hi There~
I am new to CPLEX studio and have a 3D array, say VtS[1..4][1..2][1..3], which I initialize as follows:
VtS=[
[ [0.0981,0.3415],
[0.0781,0.2733],
[0.1088,0.3191],
[0.0869,0.3222] ],
[ [0.0981,0.3415],
[0.0688,0.2391],
[0.1088,0.1088],
[0.0762,0.1128] ],
[ [0.0981,0.3415],
[0.0781,0.2733],
[0.1088,0.3191],
[0.0869,0.3222] ]
];
But I kept getting the following error and warnings:
error info:
"Exception from IBM ILOG Concert: IloIntRangeI::getValue(IloInt index): index is out of bound."
Warnings:
Array "VtS[1][1]" partially initialized, expecting 3 items, found 2.
Array "VtS[1][2]" partially initialized, expecting 3 items, found 2.
According to the Langurage Reference Manual pp40:
/* .mod file */
int a[1..2][1..3] = ...;
/* .dat file */
a = [
[10, 20, 30],
[40, 50, 60]
];
initializes a two-dimensional array by giving initializations for the one-dimensional arrays
of its first dimension.
I am not sure if I understand the last sentence correctly: the 1st dimension is for row, 2nd for colume,
and so on.
I know one solution is to reduce the dimension to 2D and initialize them separatly, but it's kinda
cumbersome for my modeling.
Any input is appreciated. Thanks a lot!
Tracy
#ConstraintProgramming-General#DecisionOptimization