### 3.7.14. Assigning and scheduling tasks that run in parallel

Given a set of tasks defined by a set of subtasks, where each subtask has the following attributes:

• A start telling when the subtask starts.

• A duration giving the duration of the subtask.

• A deadline requesting the subtask to finish no later than a given date.

• A person indicating which person performs the subtask.

Both the start and the person correspond to discrete decision variables, while the duration and the deadline are integers. Since all subtasks of a same task must run in parallel, their start, duration and deadline are identical. Since a person can perform at most one task at each timepoint, persons assigned to the subtasks of a same task must all be distinct. We also assume that a subtask cannot be preempted.

As an instance of this pattern, consider the problem of scheduling surgical operations in an hospital. Each surgery corresponds to a task that requires a number of persons with specific skills; these persons will all work together during the operation (e.g.,Β typically an anaesthetist, a surgeon and one or several nurses). Moreover, each person has its own calendar defining its unavailability. On the one hand, let us assume we have two anaesthetists, two surgeons and four nurses that are labelled from 1 to 8. Each of them has the following unavailability over the time horizon $\left[0,24\right]$:

• The first anaesthetist is not available during the time periods $\left[0,1\right]$, $\left[5,6\right]$, and $\left[12,16\right]$.

• The second anaesthetist is not available during the time periods $\left[0,2\right]$, $\left[6,6\right]$, $\left[15,15\right]$, and $\left[22,22\right]$.

• The first surgeon is not available during the time periods $\left[0,1\right]$, $\left[8,9\right]$, and $\left[13,14\right]$.

• The second surgeon is not available during the time periods $\left[5,5\right]$, and $\left[20,21\right]$.

• The four nurses are all not available during the time periods $\left[0,0\right]$, $\left[7,7\right]$, $\left[12,12\right]$, and $\left[22,22\right]$.

On the other hand, let us suppose we have to schedule five operation tasks, each of them requiring a specific team:

• Task ${t}_{1}$ needs one anaesthetist, one surgeon and two nurses during two consecutive time slots.

• Task ${t}_{2}$ needs one anaesthetist, one surgeon and one nurse during four consecutive time slots.

• Task ${t}_{3}$ needs one anaesthetist, two surgeons and two nurses during three consecutive time slots.

• Task ${t}_{4}$ needs one anaesthetist, one surgeon and three nurses during two consecutive time slots.

• Task ${t}_{5}$ needs one anaesthetist, one surgeon and one nurse during six consecutive time slots.

Moreover, tasks ${t}_{1}$, ${t}_{2}$, ${t}_{3}$, ${t}_{4}$ and ${t}_{5}$ must be respectively completed no later than 12, 15, 24, 24 and 24. The problem is modelled by using a two -dimensional $\mathrm{\pi \pi \pi \pi \pi }$ constraint, where the first and second dimensions respectively correspond to the time and resource axes. For each person required by a task we create a rectangle of length corresponding to the necessary duration and of height 1 (i.e.,Β 1 since it requires one person). The coordinates of the leftmost lower point of the rectangle correspond to the start of the corresponding task as well as to the person that will be assigned to the subtask (i.e.,Β a value between 1 and 2 for an anaesthetist, a value between 3 and 4 for a surgeon, and a value between 5 and 8 for a nurse). Both the start and the person correspond to a domain variable. Each unavailability period of an anaesthetist, a surgeon and a nurse is modelled by introducing a fixed rectangle (i.e.,Β its coordinates are set to the start of the unavailability period and to the person to which the unavailability belongs; its duration is set to the duration of the unavailability period) that prevent tasks overlapping the corresponding time period for a specific person. This leads to the following $\mathrm{\pi \pi \pi \pi \pi }$ constraint,

$\mathrm{\pi \pi \pi \pi \pi }$$\left(2,$

 Β Β Β Β Β  $\beta ©\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{1},{a}_{1}\beta ͺ,$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{1},{s}_{1}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{1},{n}_{11}\beta ͺ,$ $\mathrm{\pi \pi \pi }-4$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{1},{n}_{12}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-5$ $\mathrm{\pi \pi \pi }-4$ $\mathrm{\pi ‘}-\beta ©{o}_{2},{a}_{2}\beta ͺ,$ $\mathrm{\pi \pi \pi }-6$ $\mathrm{\pi \pi \pi }-4$ $\mathrm{\pi ‘}-\beta ©{o}_{2},{s}_{2}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-7$ $\mathrm{\pi \pi \pi }-4$ $\mathrm{\pi ‘}-\beta ©{o}_{2},{n}_{2}\beta ͺ,$ $\mathrm{\pi \pi \pi }-8$ $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi ‘}-\beta ©{o}_{3},{a}_{3}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-9$ $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi ‘}-\beta ©{o}_{3},{s}_{31}\beta ͺ,$ $\mathrm{\pi \pi \pi }-10$ $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi ‘}-\beta ©{o}_{3},{s}_{32}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-11$ $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi ‘}-\beta ©{o}_{3},{n}_{31}\beta ͺ,$ $\mathrm{\pi \pi \pi }-12$ $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi ‘}-\beta ©{o}_{3},{n}_{32}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-13$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{4},{a}_{4}\beta ͺ,$ $\mathrm{\pi \pi \pi }-14$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{4},{s}_{4}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-15$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{4},{n}_{41}\beta ͺ,$ $\mathrm{\pi \pi \pi }-16$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{4},{n}_{42}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-17$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©{o}_{4},{n}_{43}\beta ͺ,$ $\mathrm{\pi \pi \pi }-18$ $\mathrm{\pi \pi \pi }-6$ $\mathrm{\pi ‘}-\beta ©{o}_{5},{a}_{5}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-19$ $\mathrm{\pi \pi \pi }-6$ $\mathrm{\pi ‘}-\beta ©{o}_{5},{s}_{5}\beta ͺ,$ $\mathrm{\pi \pi \pi }-20$ $\mathrm{\pi \pi \pi }-6$ $\mathrm{\pi ‘}-\beta ©{o}_{5},{n}_{5}\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-21$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©0,1\beta ͺ,$ $\mathrm{\pi \pi \pi }-22$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©5,1\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-23$ $\mathrm{\pi \pi \pi }-5$ $\mathrm{\pi ‘}-\beta ©12,1\beta ͺ,$ $\mathrm{\pi \pi \pi }-24$ $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi ‘}-\beta ©0,2\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-25$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©6,2\beta ͺ,$ $\mathrm{\pi \pi \pi }-26$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©15,2\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-27$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©22,2\beta ͺ,$ $\mathrm{\pi \pi \pi }-28$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©0,3\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-29$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©8,3\beta ͺ,$ $\mathrm{\pi \pi \pi }-30$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©13,3\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-31$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©5,4\beta ͺ,$ $\mathrm{\pi \pi \pi }-32$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi ‘}-\beta ©20,4\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-33$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©0,5\beta ͺ,$ $\mathrm{\pi \pi \pi }-34$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©7,5\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-35$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©12,5\beta ͺ,$ $\mathrm{\pi \pi \pi }-36$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©22,5\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-37$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©0,6\beta ͺ,$ $\mathrm{\pi \pi \pi }-38$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©7,6\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-39$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©12,6\beta ͺ,$ $\mathrm{\pi \pi \pi }-40$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©22,6\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-41$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©0,7\beta ͺ,$ $\mathrm{\pi \pi \pi }-42$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©7,7\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-43$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©12,7\beta ͺ,$ $\mathrm{\pi \pi \pi }-44$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©22,7\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-45$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©0,8\beta ͺ,$ $\mathrm{\pi \pi \pi }-46$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©7,8\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-47$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©12,8\beta ͺ,$ $\mathrm{\pi \pi \pi }-48$ $\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi ‘}-\beta ©22,8\beta ͺ\beta ͺ,$ Β Β Β Β Β  $\beta ©\mathrm{\pi \pi \pi }-1$ $\mathrm{\pi }-\beta ©0,0\beta ͺ$ $\mathrm{\pi }-\beta ©1,1\beta ͺ,$ $\mathrm{\pi \pi \pi }-2$ $\mathrm{\pi }-\beta ©0,0\beta ͺ$ $\mathrm{\pi }-\beta ©2,1\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-3$ $\mathrm{\pi }-\beta ©0,0\beta ͺ$ $\mathrm{\pi }-\beta ©3,1\beta ͺ,$ $\mathrm{\pi \pi \pi }-4$ $\mathrm{\pi }-\beta ©0,0\beta ͺ$ $\mathrm{\pi }-\beta ©4,1\beta ͺ,$ Β Β Β Β Β Β  $\mathrm{\pi \pi \pi }-5$ $\mathrm{\pi }-\beta ©0,0\beta ͺ$ $\mathrm{\pi }-\beta ©5,1\beta ͺ,$ $\mathrm{\pi \pi \pi }-6$ $\mathrm{\pi }-\beta ©0,0\beta ͺ$ $\mathrm{\pi }-\beta ©6,1\beta ͺ\beta ͺ\right)$.

A deadline constraint for an operation starting at $o$ and of duration $d$ is modelled by a precedence constraint of the form $o+d\beta €\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi }$. This leads to the five constraints ${o}_{1}+2\beta €12$, ${o}_{2}+4\beta €15$, ${o}_{3}+3\beta €24$, ${o}_{4}+2\beta €24$, and ${o}_{5}+6\beta €24$. Finally, we break symmetry on the assignment variables corresponding to a group of similar persons. In the example, the four nurses are similar since (1)Β they all have exactly the same unavailability periods, and since (2)Β no task requires a specific nurse. For each task using more than one nurse (i.e.,Β tasks ${t}_{1}$, ${t}_{3}$, and ${t}_{4}$) this leads to a chain of strict inequalities, i.e.,Β ${n}_{11}<{n}_{12}$, ${n}_{31}<{n}_{32}$, and ${n}_{41}<{n}_{42}<{n}_{43}$. FigureΒ 3.7.1 depicts a solution to the problem corresponding to the assignment ${o}_{1}=10$, ${a}_{1}=1$, ${s}_{1}=3$, ${n}_{11}=5$, ${n}_{12}=6$, ${o}_{2}=8$, ${a}_{2}=2$, ${s}_{2}=4$, ${n}_{2}=7$, ${o}_{3}=2$, ${a}_{3}=1$, ${s}_{31}=3$, ${s}_{32}=4$, ${n}_{31}=5$, ${n}_{32}=6$, ${o}_{4}=17$, ${a}_{4}=1$, ${s}_{4}=4$, ${n}_{41}=5$, ${n}_{42}=6$, ${n}_{43}=7$, ${o}_{5}=16$, ${a}_{5}=2$, ${s}_{5}=3$, ${n}_{5}=8$.

The entry corresponding to the keyword relaxation dimension shows how to express relaxation in the context of over -constrained problems where we have too many operations to schedule with respect to the number of anaesthetists, surgeons and nurses and to their unavailability periods.