Originally posted by: SystemAdmin
I write some code to model an optimization problem:
//create two dimensions NxN array
IloIntArray2Dimensions y(env);
for(int i=0;i<nbNodes;i++)
{
y.add(IloIntVarArray(env,nbNodes));
}
//assign name to variables
IloIntArray2Dimensions y(env);
for(int i=0;i<nbNodes;i++)
{
y.add(IloIntVarArray(env,nbNodes));
}
for(int i=0;i<nbNodes;i++)
for(int j=0;j<nbNodes;j++)
{
y[i][j]=IloIntVar(env,0,1);
sprintf(name,"y_%d.%d",i,j);
y[i][j].setName(name);
}
//define objective function
IloExpr exprobjective(env);
for(int i=0;i<nbNodes;i++)
for(int j=0;j<nbNodes;j++)
if (capacity[i][j] > 0)
{
exprobjective+=fixedcost[i][j]*y[i][j];
}
//add objective function
model.add(IloMinimize(env,exprobjective));
exprobjective.end();
and I export the model to a .lp file:
\Problem name: IloCplex
Minimize
obj: 3173 y_0.3 + ... + 5242 y_9.7 + id103
Bounds
0 <= y_0.3 <= 1
....
0 <= y_9.7 <= 1
id103 = 0
Binaries
y_0.3 ... y_9.7
End
My problem is that : I do not know where the constraint (variable) id103 = 0 comes from. I only have some integer variables; an objective function and I already assigned a name to these integer variables. If I remove the objective function, nothing appears in .lp file.
Thanks for your suggestion.
#CPLEXOptimizers#DecisionOptimization