Justin Shi
Justin Shi

Reputation: 21

how to set a four dimension variable in docplex with C#?

how to set a three or four-dimensional variable when calling cplex in C#?

using ILOG.Concert;
using ILOG.CPLEX;

The following is two -dimensional:

INumVar[][] EndTime = new INumVar[NumEMU][];
            for (int i = 0; i < NumEMU; i++)
                EndTime[i] = cplexMod1.NumVarArray(NumJob, 0, 1, NumVarType.Int);

Upvotes: 2

Views: 120

Answers (1)

Alex Fleischer
Alex Fleischer

Reputation: 10062

INumVar[][][] x = new INumVar[nb1][][];//creation of i
                for (int i = 0; i < nb2; i++)
                {
                    x[i] = new INumVar[nb2][];//creation of j
                    for (int j = 0; j < nb3; j++)
                    {
                        x[i][j] = new INumVar[nb3];//creation of v
                    }
                }// nb1,nb2,nb3 are integer parameters. 

Upvotes: 1

Related Questions