I have a set of tasks $I$ with processing times $p_i, \forall i \in I$. There exists a set of machines $M$ and each machine has availability time ranges in a given time horizon.
For instance, given a machine $m$ and a time horizon $100$ hours, $m$ might be available between $a_{m1} =[0,10]$, $a_{m2} =[20,40]$ and $a_{m3} =[75,95]$. Let $A_{m}$ represents the set of time slots for machine $m$. I'll use $+$ and $-$ for the upper and lower limit for each range. Note that another machine could have a completely different time slot availability.
The goal is to capture the precedence relationship for the tasks where no multiple task is processed on the same machine at the same time. Let us define three variables:
$t_i$ : the start time of processing part $i$
$\delta_{ij}$ : whether part $i$ precedes part $j$
$u_{ima}$ : whether part $i$ is processed on machine $m$ during shift $a$
Here are the constraints that I come up with so far.
$t_i \geq t_j + p_j - M (2-u_{ima} -u_{jma} + \delta_{ij})$
$t_j \geq t_i + p_i - M (2-u_{ima} -u_{jma} + 1- \delta_{ij})$
These constraints above state that if $i$ precedes $j$ on the same machine, then the start time of $j$ must be greater than the completion time of $i$. The confusing part is the availability range here. I don't think that it captures what I'd like. I was wondering if there's an easy fix or if I'm on the right track. Should I sum over $a$ each variable $u_{ima}$? Please note that I do not want to consider each time slot as an individual machine. Even though it would resolve the issue, I have other set of constraints that I do not share here.
To make sure that lower and upper bound of each availability time range is met, I have the following constraints.
$t_i + p_i \leq a^+ u_{ima} + M(1-u_{ima} ) \quad \forall i \in I, m \in M, a \in A_{m}$
$t_i \geq a^- u_{ima} + M(1-u_{ima} ) \quad \forall i \in I, m \in M, a \in A_{m}$
I can also add another constriant to ensure that each part is assigned to one machine.
$\sum_{m \in M} \sum_{a \in A{m}}u_{ima} =1, \quad \forall i \in I$