Open Access
This article is
 freely available
 reusable
Algorithms 2019, 12(12), 250; https://doi.org/10.3390/a12120250
Article
Some Results on Shop Scheduling with SPrecedence Constraints among Job Tasks
^{1}
Dipartimento di Ingegneria dell’Informazione e Scienze Matematiche, Università di Siena, SI 53100 Siena, Italy
^{2}
Dipartimento di Ingegneria e Scienze dell’Informazione e Matematica, Università di L’Aquila, AQ 67100 L’Aquila, Italy
^{*}
Author to whom correspondence should be addressed.
Received: 9 October 2019 / Accepted: 18 November 2019 / Published: 25 November 2019
Abstract
:We address some special cases of job shop and flow shop scheduling problems with sprecedence constraints. Unlike the classical setting, in which precedence constraints among the tasks of a job are finish–start, here the task of a job cannot start before the task preceding it has started. We give polynomial exact algorithms for the following problems: a twomachine job shop with two jobs when recirculation is allowed (i.e., jobs can visit the same machine many times), a twomachine flow shop, and an mmachine flow shop with two jobs. We also point out some special cases whose complexity status is open.
Keywords:
job shop; flow shop; sprecedence constraints; exact algorithms; complexity1. Introduction
This paper addresses a variant of classical shop scheduling models. While, in classical job shop or flow shop (as well as in the large majority of scheduling problems with precedence constraints), the task of a job cannot start before the previous task of the same job has finished, we address a situation in which each task of a job cannot start before the previous task of the same job has started. These types of constraints are known in the literature as sprecedence constraints. Scheduling problems with sprecedence constraints have been introduced by Kim and Posner [1] in the case of parallel machines. They showed that makespan minimization is NPhard, and developed a heuristic procedure deriving tight worstcase bounds on the relative error. Kim, Sung, and Lee [2] performed a similar analysis when the objective was the minimization of total completion time of the tasks, while Kim [3] extended the analysis to uniform machines. Tamir [4] analyzed a parallelmachine problem in which traditional finish–start precedence constraints coexisted with sprecedence constraints (that she renamed selfish precedence constraints, giving an enjoyable dramatized motivation of the model), and established various worstcase bounds for classical dispatching rules which refer to specific structures of precedence constraints. Indeed, sprecedence constraints also arise in project management, called start–start precedence constraints (Demeulemeester and Herroelen [5]), as a result of the elaboration of a work breakdown structure (WBS) and of the coordination among different operational units. To our knowledge, none has addressed job shop and flow shop problems with sprecedence constraints so far.
The problem can be formally introduced as follows. We are given a set of n h${J}^{1},{J}^{2},\dots ,{J}^{n}$, to be processed on a shop with m machines denoted as ${M}_{1},\dots ,{M}_{m}$. Each job ${J}^{k}$ consists of a totally ordered set of tasks, ${J}^{k}=\{{O}_{1}^{k},{O}_{2}^{k},\dots ,{O}_{{n}_{k}}^{k}\}$, $k=1,\dots ,n$. Task ${O}_{i}^{k}$ requires processing time ${p}_{i}^{k}$ on a given machine $M\left({O}_{i}^{k}\right)$, $i=1,\dots ,{n}_{k}$. Tasks cannot be preempted. Task ${O}_{i}^{k}$ can only start after task ${O}_{i1}^{k}$ is started; i.e., there is an sprecedence constraint between tasks ${O}_{i1}^{k}$ and ${O}_{i}^{k}$, for all $k=1,\dots ,n$, $i=2,\dots ,{n}_{i}$. A schedule is an assignment of starting times to all tasks so that at any time each machine processes at most one task and all sprecedence constraints are satisfied. The problem is to find a feasible schedule that minimizes makespan.
We characterize the complexity of special cases of the problem, considering a fixed number of jobs and machines. Shop problems with few jobs occur when modeling synchronization and conflicts among processes share common resources. Examples of this situation include scheduling robot moves in flexible robotic cells (Agnetis et al. [6]), aircraft scheduling during taxiing at an airport so that no aircraft collides (Avella et al. [7]), or, in container terminals, the synchronization of crane gantry movements once transportation tasks have been assigned (Briskorn and Angeloudis [8]).
The structure of the paper is as follows. In Section 2 we consider the job shop scenario, and give a polynomial time algorithm for the problem in which $n=2$, $m=2$, and each job can visit the machines several times (that is, recirculation [9] is allowed). In Section 3 we focus on the flow shop scenario. We show that the twomachine flow shop can be solved in linear time and we give a polynomial time algorithm for the mmachine problem with two jobs. In Section 4 we briefly discuss cases with $n>2$ and point out open problems.
2. The Job Shop with Two Jobs and Two Machines
In this section we describe a polynomial algorithm for the job shop problem with two jobs and two machines; i.e., $J2n=2,sprec{C}_{max}$. For notation simplicity, in this section we denote the two jobs as A and B, consisting of the sequence of tasks, $A=\{{A}_{1},{A}_{2},\dots ,{A}_{{n}_{A}}\}$ and $B=\{{B}_{1},{B}_{2},\dots ,{B}_{{n}_{B}}\}$, respectively. Task ${A}_{i}$ (${B}_{h}$) requires processing time ${p}_{i}^{A}$ (${p}_{h}^{B}$) on machine $M\left({A}_{i}\right)$ ($M\left({B}_{h}\right)$).
Obviously, if two consecutive tasks of the same job, say, ${A}_{i}$ and ${A}_{i+1}$, require the same machine, then ${A}_{i+1}$ has to wait for the completion of ${A}_{i}$, but if the machines required by the two operations are different, i.e., $M\left({A}_{i+1}\right)\ne M\left({A}_{i}\right)$, then ${A}_{i+1}$ can start even if ${A}_{i}$ has not completed yet. So, unlike the classical job shop setting in which precedence relations are finishstart, in our model it may actually happen that ${A}_{i+1}$ even completes before ${A}_{i}$ (the same of course applies to job B).
Given a partial schedule, the first unscheduled tasks of the two jobs will be referred to as the available tasks. Suppose now that one of the two machines, say ${M}^{\prime}$, has just completed a task, while the other machine, say ${M}^{\u2033}$, is still busy. If both the available tasks require ${M}^{\u2033}$, we say that machine ${M}^{\prime}$ is blocked and this certainly results in idle time on ${M}^{\prime}$.
We let $A\left[i\right]$ and $B\left[h\right]$ denote the first i tasks of A and the first h tasks of B; i.e., $A\left[i\right]=\{{A}_{1},{A}_{2},\dots ,{A}_{i}\}$ and $B\left[h\right]=\{{B}_{1},{B}_{2},\dots ,{B}_{h}\}$.
Given A and B, consider any two task subsequences $X\subseteq A$ and $Y\subseteq B$. We want to characterize the schedules of $X\cup Y$ such that each task starts right after the previous task on the same machine has completed. More formally, a schedule of $X\cup Y$ is a noidle subschedule (NIS) if, across the span of such a subschedule, the only machine idle time occurs, on one machine, after all the tasks of $X\cup Y$ have started. When $X=A\left[i\right]$ and $Y=B\left[h\right]$, for some $1\le i\le {n}_{A}$ and $1\le h\le {n}_{B}$, then we say that the NIS is an initial noidle subschedule (INIS).
Consider Figure 1 and the task set $A\left[2\right]\cup B\left[2\right]$. The subschedule in Figure 1a is not an INIS for $A\left[2\right]\cup B\left[2\right]$, since on ${M}_{1}$ there is idle time before ${B}_{2}$ starts. On the contrary, in the case depicted in Figure 1b, the subschedule of $A\left[2\right]\cup B\left[2\right]$ is an INIS. Note that if we restrict our attention to the task set $A\left[2\right]\cup B\left[1\right]$, then the subschedule in Figure 1a is an INIS.
2.1. Generating Initial NoIdle Subschedules
We denote by $A[i,{M}_{j}]$ and $B[h,{M}_{j}]$, the subset of tasks of $A\left[i\right]$ and $B\left[h\right]$ respectively, requiring machine ${M}_{j}$, $j=1,2$; i.e.,
$$A[i,{M}_{j}]=\{{A}_{r}:r\le i,M\left({A}_{r}\right)={M}_{j}\}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}j=1,2,$$
$$B[h,{M}_{j}]=\{{B}_{q}:q\le h,M\left({B}_{q}\right)={M}_{j}\}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}\phantom{\rule{0.277778em}{0ex}}j=1,2.$$
We also let $P\left(A[i,{M}_{j}]\right)$ and $P\left(B[h,{M}_{j}]\right)$ indicate the total processing time of tasks in $A[i,{M}_{j}]$ and $B[h,{M}_{j}]$; i.e.,
$$P\left(A[i,{M}_{j}]\right)=\sum _{r\in A[i,{M}_{j}]}{p}_{r}^{A},$$
$$P\left(B[h,{M}_{j}]\right)=\sum _{q\in B[h,{M}_{j}]}{p}_{q}^{B}.$$
If an INIS of tasks $A\left[i\right]\cup B\left[h\right]$ exists, its makespan is given by
$$max\{P\left(A[i,{M}_{1}]\right)+P\left(B[h,{M}_{1}]\right),P\left(A[i,{M}_{2}]\right)+P\left(B[h,{M}_{2}]\right)\}.$$
Proposition 1.
In any optimal schedule, there are indices i and h such that the subschedule involving tasks $A\left[i\right]\cup B\left[h\right]$ is an INIS.
In fact, given an optimal schedule, consider the subschedule of the tasks scheduled on the two machines from time 0 to the end of the first idle interval of the schedule, assuming, e.g., that such an idle interval occurs on ${M}_{1}$. If the subschedule is not an INIS, we can iteratively remove the last task scheduled on ${M}_{2}$ in the subschedule, until the definition of INIS is met.
In view of Proposition 1, we are only interested in schedules in which the initial part is an INIS. However, not all initial noidle subschedules are candidates to be the initial part of an optimal schedule.
We first address the following question. Can we determine all operation pairs $(i,h)$ such that an INIS of $A\left[i\right]\cup B\left[h\right]$ exists? We show next that this question can be answered in polynomial time.
The idea is to build the noidle partial schedules from the beginning of the schedule onward. To this aim, let us define an unweighted graph G, which we call initial noidle graph. Nodes of G are denoted as $(i,h)$, representing a NIS of $A\left[i\right]\cup B\left[h\right]$ (for shortness, we use $(i,h)$ also to denote the corresponding INIS). If the schedule obtained appending ${B}_{h+1}$ to schedule $(i,h)$ is still an INIS, we insert node $(i,h+1)$ and an arc from $(i,h)$ to $(i,h+1)$ in G. Symmetrically, if the schedule obtained appending ${A}_{i+1}$ to $(i,h)$ is an INIS, we insert $(i+1,h)$ and an arc from $(i,h)$ to $(i+1,h)$ in G.
As illustrated later on (cases $\left(i\right)\left(iv\right)$ below), while building the graph G, we can also determine whether or not a certain INIS can be the initial part of an optimal schedule. If it can, we call it a target node.
Consider any node $(i,h)$ in G, and the machine completing soonest in the INIS. Ties can be broken arbitrarily, but to fix ideas, suppose that ${M}_{2}$ is still busy when ${M}_{1}$ completes. (Note that, since there is no idle time, ${M}_{1}$ completes at time $P\left(A[i,{M}_{1}]\right)+P\left(B[h,{M}_{1}]\right)$.) If $i<{n}_{A}$ and $h<{n}_{B}$, the two available tasks are ${A}_{i+1}$ and ${B}_{h+1}$, and four cases can occur.
 $\left(i\right)$
 $M\left({A}_{i+1}\right)=M\left({B}_{h+1}\right)={M}_{2}$. In this case, ${M}_{1}$ is necessarily idle until ${M}_{2}$ completes (Figure 2a). Hence, there is no way to continue an INIS, and therefore node $(i,h)$ has no outgoing arcs. In this case, $(i,h)$ is a target node.
 $\left(ii\right)$
 $M\left({A}_{i+1}\right)={M}_{1}$ and $M\left({B}_{h+1}\right)={M}_{2}$. In this case, when ${A}_{i}$ completes, the only way to continue an INIS is to start task ${A}_{i+1}$ on ${M}_{1}$ (Figure 2b). Thus we generate node $(i+1,h)$ and the arc from $(i,h)$ to $(i+1,h)$, which is the only outgoing arc of $(i,h)$. In this case as well, $(i,h)$ is a target node.
 $\left(iii\right)$
 $M\left({A}_{i+1}\right)={M}_{2}$ and $M\left({B}_{h+1}\right)={M}_{1}$. A symmetrical discussion to the previous case holds; i.e., the only way to continue an INIS is to start task ${B}_{h+1}$ on ${M}_{1}$ (Figure 2c), so we generate node $(i,h+1)$ and the arc from $(i,h)$ to $(i,h+1)$, which is the only outgoing arc of $(i,h)$. In this case also, $(i,h)$ is a target node.
 $\left(iv\right)$
 $M\left({A}_{i+1}\right)=M\left({B}_{h+1}\right)={M}_{1}$. In this case, the INIS can be continued in two possible ways; i.e., scheduling either ${A}_{i+1}$ or ${B}_{h+1}$ on ${M}_{1}$ (Figure 2b,c respectively). Therefore, $(i,h)$ has two outgoing arcs, pointing towards nodes $(i+1,h)$ and $(i,h+1)$, respectively. However, in this case $(i,h)$ is not a target node, since there is no point in keeping ${M}_{1}$ idle until the completion of ${M}_{2}$.
Clearly, if ${M}_{2}$ completes before ${M}_{1}$, in the four above cases the roles of ${M}_{1}$ and ${M}_{2}$ are exchanged. If either $i={n}_{A}$ or $h={n}_{B}$, the above cases simplify as follows, where we assume that $h={n}_{B}$; i.e., job B is finished. (A symmetric discussion holds in $i={n}_{A}$.)
 $\left(v\right)$
 $M\left({A}_{i+1}\right)={M}_{1}$. In this case, we can continue an INIS starting task ${A}_{i+1}$ on ${M}_{1}$. Thus we generate node $(i+1,h)$ and the arc from $(i,h)$ to $(i+1,h)$, which is the only outgoing arc of $(i,h)$. Node $(i,h)$ is a target node.
 $\left(vi\right)$
 $M\left({A}_{i+1}\right)={M}_{2}$. In this case, ${M}_{1}$ is necessarily idle until ${M}_{2}$ completes. Hence, there is no way to continue an INIS, and therefore node $(i,h)$ has no outgoing arcs. In this case, $(i,h)$ is a target node.
Again, the roles of the two machines are exchanged if ${M}_{2}$ frees up before ${M}_{1}$ in the partial schedule.
In conclusion, the question of whether a NIS exists for the task set $A\left[i\right]\cup B\left[h\right]$ is equivalent to asking whether node $(i,h)$ can be reached from the dummy initial node $(0,0)$ on G.
A few words on complexity. Clearly, G has $O\left({n}_{A}{n}_{B}\right)$ nodes, and each node has at most two outgoing arcs. The graph G can be built very efficiently. In fact, for each node $(i,h)$, it can be checked in constant time, which condition holds among $\left(i\right)$–$\left(iv\right)$ (or $\left(v\right)$–$\left(vi\right)$ when one of the jobs is over), and hence whether or not it is a target node.
2.2. Minimizing the Makespan
Now we can address the main question. How to schedule the tasks on the two machines so that the overall makespan is minimized. The key idea here is that any active schedule can be seen as the juxtaposition of noidle subschedules. In fact, suppose that after processing a certain task ${A}_{i}$, one machine stays idle until the other machine completes task ${B}_{h}$. It is important to observe that this may happen for one of two reasons:
 When a machine completes, it is blocked because both available tasks require the other machine;
 When a machine completes, there is one task the machine can process, but it might be profitable to wait for the other machine to free up another task.
Note that in both of these two cases $(i,h)$ is a target node of G. On the contrary, if a machine completes a task while the other machine is still busy, and both available tasks require that machine (i.e., $(i,h)$ is not a target node of G), with no loss of generality we can assume that the machine will immediately start one of them, since otherwise the schedule might turn out nonactive (there is no point in waiting for the other machine to complete its task).
If t denotes the makespan of an INIS, the schedule after t is completely independent from the schedule before t. In other words, the optimal solution from t onward is the optimal solution of a problem in which t is indeed time 0, and the two jobs are $A\backslash A\left[i\right]$ and $B\backslash B\left[h\right]$. Hence, to address the overall problem, the idea is to build another, higherlevel graph in which the arcs specify portions of the overall schedule.
Suppose that $(i,h)$ is a target node of graph G, and consider the task sets $A\backslash A\left[i\right]$ and $B\backslash B\left[h\right]$. We can build a new noidle graph on these sets, and call it $G(i,h)$. (Correspondingly, the graph previously denoted as G can be renamed $G(0,0)$.) Suppose that $(r,q)$ is a target node in graph $G(i,h)$. This means that the tasks of the set $\{{A}_{i+1},{A}_{i+2},\dots ,{A}_{r}\}\cup \{{B}_{h+1},{B}_{h+2},\dots ,{B}_{q}\}$ form a NIS, that we denote by $\left[\right(i+1,h+1)\to (r,q\left)\right]$. It is convenient to extend the previous notation, letting $A[i+1,r,{M}_{j}]$ denote the set of tasks of $A[i+1,r]$ that require machine ${M}_{j}$, and analogously we let $B[h+1,q,{M}_{j}]$ be the set of tasks of $B[h+1,q]$ that require ${M}_{j}$. Their total processing times are denoted as $P\left(A[i+1,r,{M}_{j}]\right)$ and $P\left(B[h+1,q,{M}_{j}]\right)$. (The set previously denoted as $A[i,{M}_{j}]$ should now be written $A[0,i,{M}_{j}]$.)
We next introduce the (weighted) graph $\mathcal{G}$ as follows. As in G, nodes denote task pairs $(i,h)$. There is an arc $\left[\right(i,h),(r,q\left)\right]$ if $(r,q)$ is a target node in the graph $G(i,h)$; i.e., if the NIS $\left[\right(i+1,h+1)\to (r,q\left)\right]$ exists. Such an arc $\left[\right(i,h),(r,q\left)\right]$ is weighted by the length of the corresponding NIS; i.e.,
$$max\{P\left(A[i+1,r,{M}_{1}]\right)+P\left(B[h+1,q,{M}_{1}]\right),P\left(A[i+1,r,{M}_{2}]\right)+P\left(B[h+1,q,{M}_{2}]\right)\}.$$
Moreover, $\mathcal{G}$ contains a (dummy) initial node $(0,0)$ while the final node is $({n}_{A},{n}_{B})$. At this point the reader should have no difficulty in figuring out that the following theorem holds.
Theorem 1.
Given an instance of $J2n=2,sprec{C}_{max}$, the optimal schedule corresponds to the shortest path from $(0,0)$ to $({n}_{A},{n}_{B})$ on $\mathcal{G}$, and its weight gives the minimum makespan.
Now, let us discuss complexity issues. The graph $\mathcal{G}$ can indeed be generated starting from $(0,0)$, and moving schedules forward. From each node $(i,h)$ of $\mathcal{G}$, we can generate the corresponding noidle graph $G(i,h)$, and add to $\mathcal{G}$ all target nodes of $G(i,h)$. We then connect node $(i,h)$ in $\mathcal{G}$ to each of these nodes, weighing the arc with the corresponding length of the NIS. If a target node was already present in $\mathcal{G}$, we only add the corresponding new arc. Complexity analysis is, therefore, quite simple. There are $O\left({n}_{A}{n}_{B}\right)$ nodes in $\mathcal{G}$. Each of these nodes has a number of outgoing arcs, whose weight can be computed in $O\left({n}_{A}{n}_{B}\right)$. Clearly, finding the shortest path on $\mathcal{G}$ is not the bottleneck step, and therefore, the following result holds.
Theorem 2.
$J2n=2,sprec{C}_{max}$ can be solved in $O\left({n}_{A}^{2}{n}_{B}^{2}\right)$.
Example 1.
Consider the following instance, in which job A has four tasks and job B two tasks.
$$\begin{array}{c}\mathit{job}\\ \mathit{ine}A\\ B\end{array}\Vert \begin{array}{c}1\\ 5,{M}_{1}\\ 4,{M}_{2}\end{array}\left\begin{array}{c}2\\ 1,{M}_{1}\\ 7,{M}_{2}\end{array}\right\begin{array}{c}3\\ 4,{M}_{2}\\ \end{array}\begin{array}{c}4\\ 6,{M}_{1}\\ \end{array}$$
Figure 3a depicts the graph $G(0,0)$, in which all nodes are target nodes. Figure 3b shows the INIS $\left[\right(0,0)\to (2,2\left)\right]$. At the end of this INIS, machine ${M}_{1}$ is blocked, since the next task of A requires ${M}_{2}$ and job B is already finished. Notice that $\left[\right(0,0)\to (2,2\left)\right]$ is the longest INIS which can be built, but the optimal solution does not contain it. Figure 4a shows the best schedule which can be attained when the INIS $\left[\right(0,0)\to (2,2\left)\right]$, having makespan 17. Figure 4b shows the optimal schedule, having makespan 16. The optimal schedule consists of two noidle subschedules; namely, the INIS $\left[\right(0,0)\to (1,1\left)\right]$ (containing tasks ${A}_{1}$ and ${B}_{1}$ and corresponding to arc $\left[\right(0,0),(1,1\left)\right]$ on $\mathcal{G}$), and the NIS $\left[\right(2,2)\to (4,2\left)\right]$ (containing tasks ${A}_{2},{A}_{3},{A}_{4}$ and ${B}_{2}$ and corresponding to arc $\left[\right(1,1),(4,2\left)\right]$ on $\mathcal{G}$). For illustrative purposes, Figure 5 shows the graph $G(1,1)$. Notice that in such a graph, (2,1) is not a target node.
3. Flow Shop
In this section we consider the flow shop problem, i.e., $Fsprec{C}_{max}$, in which the job set J contains n jobs, and job ${J}^{k}$ requires processing time ${p}_{j}^{k}$ on machine ${M}_{j}$ (here we use index j for both tasks and machines, as there is exactly one task per machine). While in the classical problem $F\left\right{C}_{max}$ a job cannot start on machine ${M}_{j}$ before it is completed on ${M}_{j1}$, in $Fmsprec{C}_{max}$, a job can start on machine ${M}_{j}$ as soon as it is started on ${M}_{j1}$.
3.1. TwoMachine Flow Shop ($F2sprec{C}_{max}$)
We next consider the twomachine flow shop problem, so ${p}_{1}^{k}$ and ${p}_{2}^{k}$ denote the processing times of job ${J}_{k}$ on ${M}_{1}$ and ${M}_{2}$ respectively, $k=1,\dots ,n$. Note that, as in the classical $F2\left\right{C}_{max}$, with no loss of generality we can assume that in any feasible schedule the machine ${M}_{1}$ processes all the jobs consecutively with no idle time between them. We next show that problem $F2sprec{C}_{max}$ can be solved in linear time.
Proposition 2.
Given an instance of $F2sprec{C}_{max}$, there always exists a schedule ${\sigma}^{*}$ having makespan $max\{{\sum}_{k=1}^{n}{p}_{1}^{k},{\sum}_{k=1}^{n}{p}_{2}^{k}\}$, which is therefore optimal.
Proof.
Given an instance of $F2sprec{C}_{max}$, partition the jobs into two sets, ${J}^{\prime}$ and ${J}^{\u2033}$, such that ${J}^{\prime}=\left\{{J}^{k}\right{p}_{1}^{k}\le {p}_{2}^{k}\}$ and ${J}^{\u2033}=J\backslash {J}^{\prime}$. Then, build ${\sigma}^{*}$ by scheduling, on both machines, first all jobs of ${J}^{\prime}$ in arbitrary order, and then all jobs of ${J}^{\u2033}$, also in arbitrary order. If we let $C\left(1\right)$ and $C\left(2\right)$ denote the completion time of the last job of ${J}^{\prime}$ on ${M}_{1}$ and ${M}_{2}$ respectively, one has $C\left(1\right)<C\left(2\right)$. From the definition of ${J}^{\prime}$, one gets that up to $C\left(2\right)$, no idle time occurs on ${M}_{2}$. From then on, all jobs of ${J}^{\u2033}$ are scheduled, and two cases may occur. $\left(i\right)$ No idle time ever occurs on ${M}_{2}$, in which case the makespan equals $max\{{\sum}_{k=1}^{n}{p}_{1}^{k},{\sum}_{k=1}^{n}{p}_{2}^{k}\}$. $\left(ii\right)$ Some idle time occurs on ${M}_{2}$. Consider the first time that ${M}_{2}$ is idle and ${M}_{1}$ is still processing a job ${J}_{k}$. Upon completion of ${J}_{k}$, the two machines will simultaneously start the next job, say, ${J}_{\overline{k}}$, but since ${J}_{\overline{k}}\in {J}^{\u2033}$, ${M}_{1}$ will still be processing it while ${M}_{2}$ returns idle. Since all remaining jobs belong to ${J}^{\u2033}$, this will happen for each job until the end of the schedule. In particular, when the last job is scheduled, again, ${M}_{2}$ completes first, so in conclusion, the makespan of ${\sigma}^{*}$ is ${\sum}_{k=1}^{n}{p}_{1}^{k}$. ☐
The above proof contains the solution algorithm. For each job ${J}^{k}$, put it into ${J}^{\prime}$ if ${p}_{1}^{k}\le {p}_{2}^{k}$ and in ${J}^{\u2033}$ otherwise. Then, schedule all jobs of ${J}^{\prime}$ followed by all jobs of ${J}^{\u2033}$ (in any order). Since establishing whether a job belongs to ${J}^{\prime}$ or ${J}^{\u2033}$ can be done in constant time, and since jobs can be sequenced in arbitrary order within each set, we can conclude with the following result.
Theorem 3.
$F2sprec{C}_{max}$ can be solved in $O\left(n\right)$.
While $F2sprec{C}_{max}$ appears even simpler than the classical $F2\left\right{C}_{max}$, one may wonder whether other simplifications occur for $m>2$. While the complexity status of $Fmsprec{C}_{max}$ is open, we point out a difference between $Fm\left\right{C}_{max}$ and $Fmsprec{C}_{max}$, which may suggest that the problem with sprecedence constraints is not necessarily easier than the classical counterpart.
It is well known [10] that in $Fm\left\right{C}_{max}$ there always exists an optimal schedule in which the job sequences on ${M}_{1}$ and ${M}_{2}$ are identical, and the same holds for machines ${M}_{m1}$ and ${M}_{m}$. (As a consequence, for $m\le 3$ the optimal schedule is a permutation schedule.) This is no more true in $Fmsprec{C}_{max}$, even with only two jobs.
Example 2.
Consider an instance with three machines and two jobs, A and B:
$$\begin{array}{c}j\\ \mathit{ine}A\\ B\\ \mathit{ine}\end{array}\Vert \begin{array}{c}\begin{array}{c}1\\ 4,{M}_{1}\\ 10,{M}_{1}\end{array}\left\begin{array}{c}2\\ 6,{M}_{2}\\ 4,{M}_{2}\end{array}\right\begin{array}{c}3\\ 1,{M}_{3}\\ 9,{M}_{3}\end{array}\\ \end{array}$$
Scheduling the jobs in the order AB on all three machines, one gets ${C}_{max}=15$, and the makespan is attained on machine ${M}_{3}$ (see Figure 6a). If they are scheduled in the order BA on all three machines, ${C}_{max}=16$, and in this case the value of the makespan is attained on ${M}_{2}$ (Figure 6b). If jobs are scheduled in the order AB on ${M}_{1}$ and BA on ${M}_{2}$ and ${M}_{3}$, then ${C}_{max}=14$ (all three machines complete at the same time, Figure 6c), and this is the optimal schedule.
3.2. Flow Shop with Two Jobs and m Machines ($Fmn=2,sprec{C}_{max}$)
In what follows we give an Algorithm 1 that solves $Fmn=2,sprec{C}_{max}$. Again we denote the two jobs with A and B, and by ${p}_{j}^{A}$ and ${p}_{j}^{B}$ the processing time of jobs A and B on machine ${M}_{j}$, $j=1,\dots ,m$, respectively. Notice that a schedule is fully specified by the order of the two jobs on each machine, either AB or BA. In what follows, for a given schedule and a given machine, we call leader the job scheduled first and follower the other job. So if, on a given machine, the jobs are sequenced in the order AB, then, on that machine, A is the leader and B is the follower.
Algorithm 1 For finding a schedule with ${C}_{max}\le K$ if it exists. 

Given any feasible schedule, we can associate with it a decomposition of the m machines into blocks, each consisting of a maximal set of consecutive machines in which the two jobs are scheduled in the same order. We denote the block consisting of machines ${M}_{u},{M}_{u+1},\dots ,{M}_{v}$ as $<{M}_{u},{M}_{v}>$ (see Figure 7). In a block, due to the sprecedence constraints, all the tasks of the leader job start at the same time. Given a block $<{M}_{u},{M}_{v}>$, we can compute a number of quantities. (Assume for the moment that $v<m$.) If, in $<{M}_{u},{M}_{v}>$, A is the leader, then we call leader span the length of the longest Atask in the block, and denote it with ${L}_{A}(u,v)$:
and similarly, if B is the leader, the leader span is given by:
$${L}_{A}(u,v)=\underset{u\le j\le v}{max}\left\{{p}_{j}^{A}\right\},$$
$${L}_{B}(u,v)=\underset{u\le j\le v}{max}\left\{{p}_{j}^{B}\right\}.$$
Notice that, due to the definition of block, in the block that follows $<{M}_{u},{M}_{v}>$, the roles of leader and follower are exchanged. Hence, the time at which the leader completes its longest task in $<{M}_{u},{M}_{v}>$ is also the start time of the other job’s tasks in the next block.
Given a block $<{M}_{u},{M}_{v}>$, suppose again that A is the leader. We let ${S}_{A}(u,v)$ indicate the span of block $<{M}_{u},{M}_{v}>$; i.e., the difference between the maximum completion time of a Btask and the start time of all Atasks in $<{M}_{u},{M}_{v}>$. This is given by:
and exchanging the roles of leader and follower in $<{M}_{u},{M}_{v}>$, we get
$${S}_{A}(u,v)=\underset{u\le j\le v}{max}\{\underset{u\le h\le j}{max}\left\{{p}_{h}^{A}\right\}+{p}_{j}^{B}\},$$
$${S}_{B}(u,v)=\underset{u\le j\le v}{max}\{\underset{u\le h\le j}{max}\{{p}_{h}^{B}\}+{p}_{j}^{A}\}.$$
Notice that trivial lower and upper bounds for the minimum makespan are given by
and
respectively. In what follows we address the problem of determining a schedule having a makespan not larger than K, or prove that it does not exist. Assuming that all processing time values are integers, a binary search over the interval $[LB,UB]$ allows one to establish the value of the minimum makespan.
$$LB=max\{\underset{1\le j\le m}{max}\{{p}_{j}^{A}\},\underset{1\le j\le m}{max}\{{p}_{j}^{B}\}\}$$
$$UB=\underset{1\le j\le m}{max}\{{p}_{j}^{A}\}+\underset{1\le j\le m}{max}\{{p}_{j}^{B}\}$$
As we already observed, a relevant difference between $Fm\left\right{C}_{max}$ and $Fmsprec{C}_{max}$ is that, in a feasible schedule for $Fmsprec{C}_{max}$, the value of ${C}_{max}$ may not be attained on the last machine, but rather on any machine. This fact requires carefully handling by the algorithm.
Let ${F}_{A}\left(v\right)$ be the minimum sum of leader spans of all blocks from ${M}_{1}$ to ${M}_{v}$, when A is the leader of the last block (i.e., the block including ${M}_{v}$). Similarly, ${F}_{B}\left(v\right)$ is the same when B is the leader of the last block. In order to write a functional equation for ${F}_{A}\left(v\right)$ and ${F}_{B}\left(v\right)$, we introduce the notation $\delta \left(x\right)=0$ if $x\le 0$ and $\delta \left(x\right)=+\infty $ if $x>0$.
Hence, we write
The first terms accounts for the fact that in the previous block the leader is B, while the rightmost term ($\delta (\xb7)$) rules out solutions in which the sum of the start time of the last block and the span of the block itself exceeds K. Symmetrically, one has:
$${F}_{A}\left(v\right)=\underset{0\le u\le v}{min}\{{F}_{B}\left(u\right)+{L}_{A}(u+1,v)+\delta ({F}_{B}\left(u\right)+{S}_{A}(u+1,v)K)\}.$$
$${F}_{B}\left(v\right)=\underset{0\le u\le v}{min}\{{F}_{A}\left(u\right)+{L}_{B}(u+1,v)+\delta ({F}_{A}\left(u\right)+{S}_{B}(u+1,v)K)\}.$$
Expressions (5) and (6) are computed for $v=1,\dots ,m$. If at least one of the values ${F}_{A}\left(m\right)$ and ${F}_{B}\left(m\right)$ has a finite value, a schedule of makespan not exceeding K exists. The values of machine index for which each minimum in (5) and (6) is attained define the blocks of the schedule, which can, therefore, be easily backtracked.
Equations (5) and (6) must be initialized, simply letting ${F}_{A}\left(0\right)={F}_{B}\left(0\right)=0$.
Notice that in general one cannot infer the value of the minimum makespan schedule directly from this procedure. If the minimum in the computation of ${F}_{A}\left(m\right)$ has been attained for, say, machine ${M}_{u}$, it does not imply that ${F}_{B}\left(u\right)+{S}_{A}(u+1,m)$ is indeed the minimum makespan. This is because the overall makespan may be due to a previous machine, and the algorithm has no control on this aspect. For instance, in the sample schedule of Figure 7 the makespan is attained on machine ${M}_{6}$. However, its actual value has no relevance, so long as it does not exceed K, since it does not affect the values ${F}_{A}\left(v\right)$ and ${F}_{B}\left(v\right)$ subsequently computed.
Concerning complexity, each computation of (5) and (6) requires $O\left(m\right)$ comparisons. Since the whole procedure is repeated at each step of a binary search over $[LB,UB]$, the following result holds.
Theorem 4.
Problem $Fmn=2,sprec{C}_{max}$ can be solved in $O\left({m}^{2}log(UBLB)\right)$.
4. Further Research
In this paper we established some preliminary complexity results for perhaps the most basic cases of shop problems with sprecedence constraints. Here, we briefly elaborate on possible research directions.
 Job shop problem with three jobs. The job shop problem with more than two jobs is NPhard. This is a direct consequence of the fact that $Jsprec{C}_{max}$ can be viewed as a generalization of $J\left\right{C}_{max}$, which is NPhard with three jobs [11].
Theorem 5.
$Jn=3,sprec{C}_{max}$ is NPhard.
Proof.
Consider an instance I of $Jn=3{C}_{max}$, in which ${O}_{i}^{k}$ denotes the ith task of job ${J}^{k}$ in I, having processing time ${p}_{i}^{k}$ on machine $M\left({O}_{i}^{k}\right)$.
We can define an instance ${I}^{\prime}$ of $Jn=3,sprec{C}_{max}$ with the same number of machines. The three jobs of ${I}^{\prime}$ are obtained replacing each task ${O}_{i}^{k}$ of I with a sequence of two tasks ${O}_{{i}^{\prime}}^{k}$ and ${O}_{{i}^{\u2033}}^{k}$, in which ${O}_{{i}^{\prime}}^{k}$ precedes ${O}_{{i}^{\u2033}}^{k}$, ${O}_{{i}^{\prime}}^{k}$ has length ${p}_{i}^{k}$ and requires machine $M\left({O}_{i}^{k}\right)$, while ${O}_{{i}^{\u2033}}^{k}$ has sufficiently small length $\u03f5>0$ and also requires machine $M\left({O}_{i}^{k}\right)$. As a consequence, in $Jsprec{C}_{max}$, the task ${O}_{i+{1}^{\prime}}^{k}$ cannot start before ${O}_{{i}^{\prime}}^{k}$ is started, but since $M\left({O}_{{i}^{\prime}}^{k}\right)=M\left({O}_{{i}^{\u2033}}^{k}\right)=M\left({O}_{i}^{k}\right)$, this can only occur after ${O}_{{i}^{\prime}}^{k}$ is finished. So, for sufficiently small $\u03f5$, a feasible schedule for ${I}^{\prime}$ having makespan $\le K+m\u03f5$ exists if and only if a feasible schedule for I exists having makespan $\le K$. ☐
Notice that the above reduction cannot be applied to $Fn=3,sprec{C}_{max}$, since in the flow shop each job visits all machines exactly once. In fact, the complexity of $Fmsprec{C}_{max}$ is open, even for fixed $m\ge 3$ or fixed $n\ge 3$.
 Open problems with two jobs. The approach in Section 2 for $J2n=2,sprec{C}_{max}$ cannot be trivially extended to more than two machines. The complexity of this case is open. Additionally, an open issue is whether a more efficient algorithm can be devised for $J2n=2,sprec{C}_{max}$, and a strongly polynomial algorithm for $Fmn=2,sprec{C}_{max}$.
Author Contributions
Conceptualization, A.A. F.R. and S.S.; methodology, A.A. F.R. and S.S.; validation, A.A. F.R. and S.S.; formal analysis, A.A. F.R. and S.S.; investigation, A.A. F.R. and S.S.; resources, A.A. F.R. and S.S.; writing–original draft preparation, A.A. F.R. and S.S.; writing–review and editing, A.A. F.R. and S.S.; visualization, A.A. F.R. and S.S.; supervision, A.A. F.R. and S.S.
Funding
This research received no external funding.
Conflicts of Interest
The authors declare no conflict of interest.
References
 Kim, E.S.; Posner, M.E. Parallel machine scheduling with sprecedence constraints. IIE Trans. 2010, 42, 525–537. [Google Scholar] [CrossRef]
 Kim, E.S.; Sung, C.S.; Lee, I.S. Scheduling of parallel machines to minimize total completion time subject to sprecedence constraints. Comput. Oper. Res. 2009, 36, 698–710. [Google Scholar] [CrossRef]
 Kim, E.S. Scheduling of uniform parallel machines with sprecedence constraints. Math. Comput. Model. 2011, 54, 576–583. [Google Scholar] [CrossRef]
 Tamir, T. Scheduling with Bully Selfish Jobs. Theory Comput. Syst. 2012, 50, 124–146. [Google Scholar] [CrossRef]
 Demeulemeester, E.L.; Herroelen, W.S. Project Scheduling, a Research Handbook; Springer Science & Business Media: Berlin, Germany, 2006. [Google Scholar]
 Agnetis, A.; Lucertini, M.; Nicolò, F. Flow Management in Flexible Manufacturing Cells with Pipeline Operations. Manag. Sci. 1993, 39, 294–306. [Google Scholar] [CrossRef]
 Avella, P.; Boccia, M.; Mannino, C.; Vasilev, I. Timeindexed formulations for the runway scheduling problem. Transp. Sci. 2017, 51, 1031–1386. [Google Scholar] [CrossRef]
 Briskorn, D.; Angeloudis, P. Scheduling cooperating stacking cranes with predetermined container sequences. Discret. Appl. Math. 2016, 201, 70–85. [Google Scholar] [CrossRef]
 Bertel, S.; Billaut, J.C. A genetic algorithm for an industrial multiprocessor flow shop scheduling problem with recirculation. Eur. J. Oper. Res. 2004, 159, 651–662. [Google Scholar] [CrossRef]
 Pinedo, M. Scheduling, Theory, Algorithms and Systems; Springer: Cham, Switzerland, 2018. [Google Scholar]
 Brucker, P.; Sotskov, Y.N.; Werner, F. Complexity of shop scheduling problems with fixed number of jobs: A survey. Math. Methods Oper. Res. 2007, 65, 461–481. [Google Scholar] [CrossRef]
Figure 1.
In instance (a), the set $A\left[2\right]\cup B\left[2\right]$ does not form an INIS (initial noidle subschedule); in instance (b) it does.
Figure 2.
Possible scenarios when ${M}_{1}$ completes before ${M}_{2}$: (a) The INIS $(i,h)$ cannot be continued, (b) it can only be continued scheduling ${A}_{i+1}$, and (c) it can only be continued scheduling ${B}_{h+1}$.
Figure 3.
(a) The graph $G(0,0)$ in the example. (b) The INIS $\left[\right(0,0)\to (2,2\left)\right]$.
Figure 4.
(a) The best schedule starting with the INIS $\left[\right(0,0)\to (2,2\left)\right]$, and (b) the optimal schedule in the example.
© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).