Originally posted by: SystemAdmin
>
> Hello all,
>
> I just started using CPLEX 11 on Java with Eclipse. I have defined my deterministic model but I don't know how to ensure that an IloNumVar has a specific Type, ie how to make sure it returns an integer rather a double.
>
> IloNumVar
][[] Build = new IloNumVar
nNodesnFactories[1];// Only at time = 0
> for (int i = 0; i < nNodes; i++) {
> for (int j = 0; j < nFactories; j++) {
> Build[i][j][0] = cplex.numVar(0, 1);
> }
> }
>
> That's how I define my variable Build, but at the moment I'm building .75 of a factory. In CPLEX you use "generals" if I'm not mistaken but I can't seem to figure out how it works in Java. So I was wondering how to enforce that it has to return an integer.
>
You can add a third argument to numVar() specifying the type (IloNumVarType.Int for general integer, IloNumVarType.Bool for 0/1; the default is IloNumVarType.Float).
/Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
#CPLEXOptimizers#DecisionOptimization