I have a Mixed Integer Linear Problem where I want to schedule the production of different products (P).
Each product can be produced once at a time, and between each product, there is a certain time that has to be scheduled for cleaning the production line. The time depends on which product was produced before, and which product will be produced after. E.g: if I produce green apple juice and then red apple juice, the cleaning time is set to 20 minutes. However, if grapes juice is produced after green apple juice the time increases to 35 minutes.
I am modeling the production considering the following variables:
X_{p, d, h} is a binary variable that equals to 1 if the product p is produced in the day d at the hour h, and 0 otherwise.
c_{d, h} is a binary variable that equals to 1 if the line is being cleaned in the day d at the hour h, and 0 otherwise.
y_{d, h} is a binary variable that equals to 1 if the line not being used (no production nor cleaning) in the day d at the hour h, and 0 otherwise.
I also have a matrix C that has the cleaning times between each pair of products.
I want to create the constraints for the cleaning part. If any product is produced, then cleaning must happen (without stops) for the time specified in matrix C, which depends on which product was produced before, and which product was produced after.
I got to formulate the mandatory start of cleaning by adding these constraints:
c_{d,h} >= x_{p,d,h-1} - x_{p,d,h}
x_{p,d,h} + c_{d,h} + y{d,h} = 1
However, this just makes one block of cleaning, and there have to be as many blocks as refered to matrix C, which depends on which product was produced before and which product is produced after. Any ideas on how to tackle this?