Originally posted by: FANS_Nader_Al_Theeb
Hello
I have an unrestricted variables with bounds (-400,400) defined as following
IloNumVarArray3 dev_aot(env,nbComm);
for( a = 0; a < nbComm; a++)
{ dev_aot[a] = IloNumVarArray2 (env, nbDNodes);
for( o=0; o<nbDNodes; o++)
{ dev_aot[a][o] = IloNumVarArray (env, nbTimes, -400, 400);
}
}
And I have constraint as in the following
model.add(dev_aot[a][o][t] == daot[a][o][t] - ZD - dev_aot[a][o][t-1]);
but I need to use the
dev_aot[a][o][t-1]
only if it is negative
In CPLEX, we can't use if statement with variable conditions like the following
if (dev_aot[a][o][t-1] <=0 )
{model.add(dev_aot[a][o][t] == daot[a][o][t] - ZD - dev_aot[a][o][t-1]);
}
if (dev_aot[a][o][t-1] >=0 )
{model.add(dev_aot[a][o][t] == daot[a][o][t] - ZD );
}
So, is there any other method to use the variable only when its value is negative
Thanks
#CPLEXOptimizers#DecisionOptimization