Originally posted by: Ximenes
Dear friends, I want to know how to define a 3-dimension matrix variable. Could you help me ?
Here is my definition, pasted as follows(it seems have some problem).
typedef IloArray<IloNumVarArray> NumVarMatrix; typedef IloArray<BoolVarMatrix> BoolVar3Matrix;
and
IloModel model(env); BoolVar3Matrix z(env,N);
for(
int i=0;i<N;i++)
{ z[i]=BoolVarMatrix(env,n[i]);
for(
int j=0;j<n[i];j++)
{ z[i][j]=IloBoolVarArray(env,total);
}
}
The program shows no problem in compiling. But when I run it, it shows
0x0019a144 处有未经处理的异常: 0xC0000005: 读取位置 0xbaadf011 时发生访问冲突 In addition, when I move the pointer on "
i" in
z[i][j]=IloBoolVarArray(env,total);
it said "0" as wished, but it is not the case with "
j", it said a large number "11941832".
I just don't know how to deal with it. Can you figure it out for me? Thank you very much.
#CPLEXOptimizers#DecisionOptimization