Topic
• Latest Post - ‏2012-08-08T17:47:17Z by hllsen
Ximenes
22 Posts

# Pinned topic how to define a 6-dimmensional array in CPLEX with c++

‏2012-08-06T13:15:54Z |
Hi, everyone, I strongly suspect that my definition of 6-dimmensional array is not perfectly right.
I pasted the related code bellow hoping that somebody can give me some suggestions.
``````
typedef IloArray<IloBoolVarArray> BoolVarMatrix; typedef IloArray<IloNumVarArray> NumVarMatrix; typedef IloArray<BoolVarMatrix> BoolVar3Matrix; typedef IloArray<BoolVar3Matrix> BoolVar4Matrix; typedef IloArray<BoolVar4Matrix> BoolVar5Matrix; typedef IloArray<BoolVar5Matrix> BoolVar6Matrix;```
```

and
``````
BoolVar6Matrix a(env,N);
//定义a   【a(i,k,m,j,l,h)=z(i,k,m)*z(j,l,h)】

for(

int i=0;i<N;i++)
{ a[i]=BoolVar5Matrix(env,n[i]);

for(

int k=0;k<n[i];k++)
{ a[i][k]=BoolVar4Matrix(env,total);

for(

int m=0;m<total;m++)
{ a[i][k][m]=BoolVar3Matrix(env,N);

for(

int j=0;j<N;j++)
{ a[i][k][m][j]=BoolVarMatrix(env,n[j]);

for(

int l=0;l<n[l];l++) a[i][k][m][j][l]=IloBoolVarArray(env,total);
}
}
}
}```
```

Thank you.
Updated on 2012-08-08T17:47:17Z at 2012-08-08T17:47:17Z by hllsen
• hllsen
76 Posts

#### Re: how to define a 6-dimmensional array in CPLEX with c++

‏2012-08-08T17:47:17Z
I'm not sure whether your definition is correct or wrong but I'm using the definition below:

```BoolVar6Matrix a(env);  //定义a 【a(i,k,m,j,l,h)=z(i,k,m)*z(j,l,h)】
for(int i=0;i<N;i++){
for(int k=0;k<n[i];k++){
for(int m=0;m<total;m++){