1

次のように、c++ を使用して cplex でいくつかの整数変数を使用しています。

  alpha = IloIntVarArray (env, numArcs,0 ,N);

alpha は、範囲が 0 ~ N の 1 次元配列です...

しかし、私の問題は、整数決定変数になる ax[N][M][K] を作成したいのですが、構文やこれらの変数を開始する方法がわかりません。

4

1 に答える 1

2

を次に示します。

typedef IloArray<IloNumVarArray> NumVarMatrix;
typedef IloArray<NumVarMatrix>   NumVar3Matrix;

/* define the num vars here for the 3-D matrix */
NumVar3Matrix accept(env,nbClients);
/* initialize this matrix */
for(i=0; i< nbClients; i++) {
  accept[i] = NumVarMatrix(env, nbLocations);
for(j=0; j< nbLocations; j++) {
            accept[i][j] = IloNumVarArray(env, nbRoutes);
  for(k=0; k<nbRoutes; k++) {
   accept[i][j][k] = IloNumVar(env, 0.0, 1.0, ILOINT);
   }
  }
 }
于 2016-06-01T06:49:27.033 に答える