Originally posted by: Petr Vilím
Hello,
what Alex meant is that decision variables cannot be used in the sum condition (they are not bound at the time the sum expression is created). If you want to exclude some operands from the sum depending on the values of decision variables then you have to modify the operand to be 0 when necessary.
In your case only condition i != f does not depend on decision variables so it could be used as an argument to the sum. So your expression will start by:
dexpr int wieoftgleichzeitig[s in 1..S][g in 1..G]= sum(i in 1..N,f in 1..N: i!=f)
All the remaining conditions must be moved into the sum operands. You can use boolean expressions as 0/1 expressions. And using multiplication the result will be 0 whenever the codition is false. So the rest of the expression:
((endOf(station[i][s][g])==endOf(station[f][s][g]) && overload[i][s][g]>0 && overload[f][s][g]>0) * binaerueberlast[i][s][g])
Note that in general long expressions like this do not propagate very well though.
Petr
#DecisionOptimization#OPLusingCPOptimizer