I would like to go and model this constraint but I don’t know how to write it on gams.

the variable considered is a binary variable X (j, d, h) which is equal to one if the machinery j on day d and at hour h is active. I would like to model a constraint that tells me that if X (j, d, h) = 1 this variable is equal to 1 also in the following 5 periods.

i speculated to write it like this but i don’t know how to implement it on gams.

summation on t, with t going from h … (h + 5-1) of X (j, d, t)>= 5 * X (j, d, h).

the constraint must be written for every d and every h that goes from 1 … (| h | -5 + 1).

I would like an answer both if this constraint fits my problem and how I can implement these conditions on gams anyway.

thanks in advance for the reply.