Originally posted by: Dortmunder
Hi everyone,
I have a beginners question about for loops in CPLEX.
For my program I need to check at which time step my binary matrix has the last "1" for each unit and use it on one of my constraints.
If I write my code in CPLEX according to the help documentation it should look like this (NbTimeSteps is the TimeSteps arrays range):
forall (u in Units)
for (t in TimeSteps == NbTimeSteps; t>1; t--)
{ if (BinaryMatrix[u][t] == 1)
( Matrix[u][t] == Array[u] break ) }
Apparently the syntax is very different and I figured that at least the for-loop should look more like this:
for (t in TimeSteps == NbTimeSteps, t>=2, t-1)
Still, the if-condition cannot be operated in the for-loop. Is it a generally disallowed operation or is my syntax simply wrong?
Would the break operator work if my if-condition worked?
Grateful for any help I can get! Thanks in advance!
#DecisionOptimization#OPLusingCPLEXOptimizer