I am still a begginer on IBM ILOG CPLEX Optimisation Studio.
I'm doing the modelisation of an hospital.
I have some decision variable that correspond to :
dvar alpha[Operations][Rooms] in 0..1;
alpha[o][r] is equal to 1 if the operation o is done in the room r.
I also have a lot of other decision variable that correspond to : in which order does the surgeon does his operations, what equipement does he use for that operation, ...
with all of that, i have enough information to compute the starting time of each operation and i want to have a deduction variable that correspond to the time at which each operation start.
This "time[Operations]" variable, has to be computed in a specific order (you have to compute the starting time of the first operation of a room before being able to compute the second one).
the formula that compute the time is way to complex to be written in one line of a dexpr and i don't know to make an "execute" bloc having to call itself each time it generate new values.
You could use logical constraints
range Operations=0..2;
range Rooms=1..4;
dvar int alpha[Operations][Rooms] in 0..1;
dvar int time[Operations];
subject to
{
forall(r in Rooms, ordered o1,o2 in Operations)
((alpha[o1][r]==1) && (alpha[o2][r]==1)) => time[o1]+10<=time[o2];
}
But you could also have a look at scheduling within CPLEX . Then you would use intervals and maybe the model could work much better