My question is whether there is a trick to express the following as a linear constraint?
S_j=max{ a_j, S_i+t_ij }
where a_j and t_ij are constants
Many thanks in advance
My question is whether there is a trick to express the following as a linear constraint?
S_j=max{ a_j, S_i+t_ij }
where a_j and t_ij are constants
Many thanks in advance
Yes, you can do this by introducing a new binary variable y_j (0 or 1) and a couple of linear constraints.
We can rewrite your constraint as:
Sj = a if a > Si + T
Sj = Si + T if a < Si + T
Sj = a y_j + (Si + T) (1 - yj) .....(1)
Let's say that y_j = 0 if a is bigger
y_j = 1 if a is smaller than Si + T
M y_j + a - (Si + T) > 0 ....(2)
where M is a big number, much bigger than a or Si or T.
If y_j is 1, the constraint above is trivially satisfied, and Sj will be equal to a.
If y_j is 0, a has to be bigger for the constraints to be satisfied, and Sj = Si + T
In your formulation, just include (1) and (2) and you will have enforced the max
constraint.