Two-Machine Job-Shop Scheduling with Equal Processing Times on Each Machine

In this paper, we consider a two-machine job-shop scheduling problem of minimizing total completion time subject to n jobs with two operations and equal processing times on each machine. This problem occurs e.g., as a single-track railway scheduling problem with three stations and constant travel times between any two adjacent stations. We present a polynomial dynamic programming algorithm of the complexity O(n5) and a heuristic procedure of the complexity O(n3). This settles the complexity status of the problem under consideration which was open before and extends earlier work for the two-station single-track railway scheduling problem. We also present computational results of the comparison of both algorithms. For the 30,000 instances with up to 30 jobs considered, the average relative error of the heuristic is less than 1%. In our tests, the practical running time of the dynamic programming algorithm was even bounded by O(n4).


Introduction
We consider a two-machine job-shop scheduling problem.Each job j ∈ N = {1, 2, . . ., n} consists of two operations, i.e., we have n j = 2 according to [1].The operation O j,a is processed on the machine M a and its processing time is equal to a.The operation O j,b is processed on the machine M b and its processing time is equal to b, where a, b ∈ Z + and a < b.For simplicity of the subsequent consideration, we use both notations a and M a , where a is a descriptor in M a and a is the processing time of any job on this machine.
Let N ab be the subset of jobs j, for which operation O j,a precedes operation O j,b and let N ba be the subset of jobs j, for which operation O j,b precedes operation O j,a .Moreover, denote n ab = |N ab | and n ba = |N ba |.Thus, we have n = n ab + n ba .Please note that the parameter n j is different from n ab and n ba .The parameter n j is often used in publications on job-shop scheduling to denote the number of operations of job j, and we use n ab , n ba to denote the numbers of jobs with the two possible technological routes.A schedule Π is uniquely determined by two permutations π M a and π M b of the operations of the set N ab N ba .Let C j,x (Π) be the completion time of operation O j,x and S j,x (Π) = C j,x (Π) − x, x ∈ {a, b} be the starting time of the operation in the schedule Π.
For the two-machine job-shop scheduling problem of minimizing total completion time subject to given processing times, the objective is to find an optimal schedule Π * that minimizes the total completion time, i.e., ∑ j∈N ab C j,b + ∑ j∈N ba C j,a . ( We denote this problem by J2|n j = 2, p j1 = a, p j2 = b| ∑ C j according to the traditional three-field notation α|β|γ for scheduling problems proposed by Graham et al. [2], where α describes the machine environment, β gives the job characteristics and further constraints, and γ describes the objective function.Please note that, without loss of generality, we can restrict to the case a < b since the case a = b can be trivially solved in constant time.
Our motivation to deal with this problem with an open complexity status is as follows: • it has a theoretical significance as a special case of the classical job-shop scheduling problem with two machines with another objective function than the makespan considered by Jackson in the well-known paper from 1956 [3]; it has also practical significance as a particular sub-problem e.g., arising in railway scheduling.
Namely, the following single-track railway scheduling problem (STRSP) can be reduced to this problem.In the STRSP, there is a single track between the stations A and C and a middle station B between stations A and C. Trains go in both directions.Each of the sub-tracks AB and BC can process only one train at a time.At the station B, a train can pass other trains, and at all stations there are enough parallel tracks to deposit trains.A single-track network can be seen as a bottleneck portion for any type of railway network topology.Furthermore, almost all national railway networks have sections, where there is a single-track between some stations.For some countries (e.g., USA, Australia), a significant part of the network is single-track.For multi-track networks such a single-track segment can be considered as a bottleneck, in which the traffic capacity is restricted.
In this paper, we present a new polynomially solvable case for the two-machine job-shop problem with minimizing total completion time based on dynamic programming [4].At the same time, this extends an existing polynomial algorithm for the two-station single-track railway scheduling problem from [5] to the case of three stations.In addition, we present a fast polynomial heuristic of lower complexity which is able to construct near-optimal solutions.The rest of this paper is organized as follows.A brief literature review is given in Section 2. In Section 3, some properties of the problem are presented which are the base for the dynamic programming algorithm.Polynomial exact and heuristic solution procedures for this problem are presented in Section 4. Some results of numerical experiments are presented in Section 5. Finally, concluding remarks are given in Section 6.

Literature Overview
The problem J2|n j = 2, p j1 = a, p j2 = b|C max of minimizing the makespan (maximal completion time) can be solved in constant time by Jackson's algorithm [3].In an optimal schedule, on the machine M a , first all operations O i,a , i ∈ N ab , are processed and then all operations O j,a , j ∈ N ba .On the machine M b , first all operations O j,b , j ∈ N ba , are processed and then all operations O i,b , i ∈ N ab .However, the problem J2||C max without the restriction to at most two operations per job and arbitrary processing times is already NP-hard [1].
Moreover, when minimizing total completion time, only very special unit-time problems can be polynomially solved (see e.g., [1]).Even the two-machine unit-time problems J2|p jk = 1, r j ≥ 0| ∑ C j with release dates r j , J2|p jk = 1| ∑ w j C j with job weights w j or the three-machine problem J3|p jk = 1| ∑ C j are already NP-hard (see [1]).Two-machine job shop scheduling problems with unit processing times and n j > 2 operations per job, where the even operations are processed on one machine and the odd operations on the other one are considered in [6,7].The scheduling problem to minimize total completion time is considered in [8].
Some results on parallel machine and single machine scheduling problems with unit and equal processing times of the jobs are presented in [9,10].Single machine problems are equivalent to the special case of a two-machine job shop scheduling problem with n j = 2, p j1 = a, p j2 = b, where a is sufficiently small so that it can be disregarded.These problems without precedence relations are known to be polynomially solvable, except the problem 1|r j ≥ 0, p j = p| ∑ w j T j the complexity status of which is open.An additional motivation of our research is the search for an NP-hard job scheduling problem with equal processing times which is most close to single machine job scheduling problems with equal processing times without precedence relations and preemptions.
As previously mentioned, the problem under consideration is closely related to a particular single-track railway scheduling problem.Often such problems are considered in the case of maintenance of one track of a double-track line.For example, the French railway company SNCF develops such models to produce a new transport schedule in the event of an incident on one of the double-track line sections [11].The work on single-track railway scheduling problems (STRSP) goes back to the 1970s, with the initial publication [12].A recent literature review on the single-track railway scheduling problem can be found, e.g., in [13].A short survey on the STRSP with several stations, where trains are able to pass each other, is presented in [14].In [5], a single-track railway scheduling problem with two stations and several segments of the track is considered.In [15], train scheduling problems are modeled as job-shop scheduling problems with blocking constraints.Four MIP formulations are developed for the problem of minimizing total tardiness, and a computational study is made on hard instances with up to 20 jobs (trains) and 11 machines (tracks or track sections).Blocking constraints make the job-shop scheduling problem very hard from a practical point of view.In [16], a complex neighborhood for the job-shop scheduling problem with blocking and total tardiness minimization has been developed and tested on benchmark instances from the literature.Further algorithms for general railway scheduling problems have been given for instance in [17][18][19] and for job-shop scheduling problems with blocking in [20,21].The blocking job-shop with rail-bound transportation has also been discussed in [22].Please note that for a small railway network with only a few stations and enough parallel tracks at each station, the blocking constraint can be skipped as in our three-station case.
In this paper, we deal with an exact dynamic programming approach.For some further recent general approaches for the solution of different types of single and multiple criteria scheduling problems, the interested reader is referred to [23][24][25][26][27][28][29] which highlight the importance of developing advanced scheduling approaches.This concerns both the identification of new polynomially solvable problems as well as new MILP models and metaheuristic or hybrid algorithms.

Properties of the Problem J2|n
In this section, we present and prove in Lemmas 1-3 some basic properties of the problem.While Lemma 1 characterizes the structure of partial solutions, Lemmas 2 and 3 are used in the proof of the subsequent Theorem 1 which is the foundation of the dynamic programming algorithm given in Section 4.
Without loss of optimality, we can restrict to schedules, where the operations O j,a are processed in the same order as the operations O j,b , j ∈ N ab (N ba ).Then we can schedule the jobs from each subset according to increasing numbers.To distinguish the jobs from the sets N ab and N ba , the jobs from the set N ba are overlined, i.e., we have N ab = {1, 2, . . ., n ab } and N ba = {1, 2, . . ., n ba }.
In an active schedule, a job cannot be started earlier without violating the feasibility.Without loss of optimality, we consider active schedules only.
It is obvious that there is only a single case when an idle time on the machine M b arises.It can be immediately before time C i,a = S i,b , i ∈ N ab , i.e., when for the job i ∈ N ab , the completion time of the short operation (with processing time a) is equal to the starting time of the long one (with processing time b).The same holds for an idle time on the machine M a .An idle time can be immediately before time C j,b = S j,a , j ∈ N ba .Lemma 1.In any active schedule, the starting times of the operations belong to the set Θ = {xa + yb|x, y ∈ Z, x, y < n ab + n ba }. ( Proof.We consider the possible starting time S i,a of operation O i,a in an active schedule.Let in the interval [t 1 , S i,a ), x 1 operations be processed on the machine M a without idle time and let there be an idle time immediately before t 1 .Then there is a job j 1 for which C j 1 ,b = S j 1 ,a = t 1 .Let in the interval [t 2 , C j 1 ,b ], y 1 operations be processed on the machine M b without an idle time and let there be an idle time immediately before t 2 .Then there is a job i 1 for which C i 1 ,a = S i 1 ,b = t 2 .For an illustration, see Figure 1.By continuing this consideration, we have Lemma 2. In any optimal schedule, we have S 1,a = S 1,b = 0, i.e., the starting times of the first operations of the first job from each subset are equal to 0.
Proof.It is obvious that in each active schedule S 1,a = 0 for O 1,a ∈ N ab .
Next, we show that the lemma holds for the first job 1 ∈ N ba .Let in a schedule Π, this does not hold.The operation sequence for machine M a is (O i 1 ,a , O i 2 ,a , π 1 , O 1,a , π 2 ), where in the partial sequence π 1 there are k 1 operations and i 1 , i 2 ∈ N ab .The operation sequence for machine M b is (π 3 , O 1,b , π 4 ), where in the partial sequence π 3 there are k 2 ≥ 1 operations (see Figure 2).
Let C i 2 ,a = 2a > b, then the completion times of the operations from π 2 and π 4 are not increased.Thus, the total completion time is decreased on a value greater than or equal to An analogous proof can be presented for the case 2a ≤ b.The lemma is true for the first job from the set N ba .
Lemma 3. In any active schedule Π at each time t, where an operation O i,a , i ∈ N ab , is such that t ≤ C i,a (Π), the number of short operations completed is greater than or equal to the number of long operations completed.
Proof.The proof is done by induction.We consider the completion times t of the first, . . ., (k − 1)-th and k-th operations processed on the machine M b .The lemma holds for t equal to the completion time of the first operation processed on the machine M b , i.e., t = C 1,b = b.
Let the lemma hold for t equal to the completion time of the (k − 1)-th operation processed on the machine M b .Moreover, there are l, l ≥ k − 1, operations completed on the machine M a before t.Let τ, τ ≤ t, be the completion time of the last operation completed on the machine M a before time t.
Let t , t ≥ t + b, be the completion time of the k-th operation processed on the machine M b .Then, in the interval [τ, t ], at least one operation can be processed on the machine M a and thus, at time t , the number of short operations completed is greater than or equal to the number of long operations completed.
Theorem 1.In any optimal schedule, there is no idle time on the machine M b before the last operation from the set N , i.e., before the time S n ba ,a .
Proof.The proof is done by induction.First, we show that the theorem holds for the first job from the set N ba and then for the next jobs j ∈ N ba .If for an operation O j,b , j ∈ N ba , in a schedule Π, there is an idle time before the time S j,b (Π) on the machine M b , then we construct a modified schedule Π , where the operations O j,a and O j,b are shifted to an earlier time so that the idle time is vanished and total completion time decreases.
If a ≤ 1 2 b, then in any active schedule, there is no idle time on the machine M b , since for any operation O i,a , i ∈ N ab , i > 1, we have C i,a < S i,b .Next, we consider the only remaining case a > 1 2 b.According to Lemma 2, the theorem holds for the first job 1 ∈ N ba .Let the theorem hold for the job j − 1 ∈ N ba , and we consider the next job j ∈ N ba .Let there exist an idle time before the time S j,a in a schedule Π.We prove that this idle time is before the time S j,b as well.We do this by contradiction.Let there exist a schedule Π with C j,b < C i,a = S i,b and there is an idle time on the machine M b in the interval (t, S i,b ).We have C j,b ≤ t and S j,a ≥ S i,b (see Figure 3).In this case, at time t, the number (i − 1 + j) of long operations completed is greater than the number (i − 1 + j − 1) of short operations completed which is a contradiction to Lemma 3. So, assume that we have a schedule Π, where the operation sequences are: (see Figure 3).In the schedule Π, the last operation completed before the idle time is O i−1,b ∈ N ab according to the assumption made above that there is no idle time before operation O j−1,a .Operation O j−1,a is processed immediately before operation O i,a since S i,a > S i−1,b .
Assume that there are k 1 short operations processed between the operations O i,a and O j,a in Π and k 2 long operations processed between the times S i,b and S j,b .It is easy to show that there is no idle time between the times S i,b and S j,b .
Denote 1).We have 2a i.e., 2a ≥ a + b and a ≥ b, which is false.As a consequence, we get Let us consider a schedule Π , where the operation sequences are (see Figure 1).
If in the schedule Π , there is an idle time ∆ 3 between the times C i,b and S i+1,b , then It is easy to show that there is no idle time on the machine M b between the time C i+1,b and the first operation in π 5 in the schedule Π .Then for all operations in the sequences π 3 and π 6 , the completion times are not increased.Now, we increase the completion time: We decrease the completion time of the operation O j,a on the value Thus, we decreased the total completion time on a value greater than or equal to So, the theorem holds for job j.

Solution Algorithms for the Problems
In this section, we first present a fast polynomial heuristic and then a polynomial dynamic programming algorithm which is based on Theorem 1.The problem under consideration can be solved approximately by the following polynomial heuristic, which includes 3 major steps.
Construct a schedule Π according to Jackson's algorithm.

2.
Consider one by one the operations O j,a for j = 1, 2, . . ., n ba .Shift the operation O j,a to the earliest position in the sequence, where the total completion time is not increased in comparison to the currently best schedule obtained.

3.
Consider one by one the operations O i,b for i = 1, 2, . . ., n ab .Shift the operation O i,b to the earliest position in the sequence, where the total completion time is not increased in comparison to the currently best schedule obtained.
Each of the steps 2 and 3 needs O(n 3 ) operations since for each operation, we consider O(n) positions and O(n) operations are needed to compute the total completion time of the modified schedule.So, the running rime of the algorithm is O(n 3 ).
Next, we present an idea of an exact dynamic programming algorithm (DP).In the first step of Algorithm DP, we construct an active schedule that contains only jobs from the set N ab .Then, in each stage j = 1, 2, . . ., n ba , we compute all possible states t = (i a , i b , C j,b , C j,a ), where

•
operation O j,a , j ∈ N ba , is processed between the operations O i a ,a and O i a +1,a , i a , i a + 1 ∈ N ab and after all operations O j , < j ∈ N ba , after all operations O j ,b , j < j, j ∈ N ba .
For each state t, the total completion time TCT t of the operations O i,b , i ∈ {1, 2, . . ., i b }, and the operations O j ,a , j ∈ {1, 2, . . ., j}, is saved.If for two states t = (i a , i b , C j,b , C j,a ) and t = (i a , i b , Cj,b , Cj,a ), we have then the state t can be excluded from the further considerations.
According to Theorem 1, we have C j,b = (i b + j)b.Thus, the state is uniquely defined by the vector (i a , i b , C j,a ).Please note that only states with i a ≥ i b are considered.The states obtained at stage j are used to compute the states in the next stage.After the last stage, for each state t = (i a , i b , C j,a ), we schedule the remaining operations O i,a , i = i a + 1, . . ., n ab , and O i,b , i = i b + 1, . . ., n ab , and add to the value TCT t the value ∑ n ab i=i b +1 C i,b .Then we choose the best solution.The value C j,a and TCT t can be computed in constant time.For that, in the previous stage j − 1, for a state t = ( îa , îb , Ĉj−1,a ), we saved the value Ĉî b +1,a .Let us compute the state t = (i a , i b , C j,a ) from the state t.For the state t, the values C îa +1,a and C i a ,a are computed in constant time.Then the value Proof.According to Lemma 1, there are no more than O(n 2 ) possible values C j,a .Then there are no more than O(n 4 ) possible states t = (i a , i b , C j,a ) at the stage j, and each state is computed in constant time.Since there are O(n) stages, the running time of Algorithm DP is O(n 5 ).

Computational Results
In this section, we present some results of a numerical experiment, where we investigate the relative error of the heuristic algorithm H and the number of states considered in Algorithm DP.We generated the instances as follows.For each n ∈ {5, 10, 15, 20, 25, 30}, we generated 5000 instances with b ∈ [3, 50], a ∈ [1, b − 1], yielding in total 30000 instances.For each instance, both the exact and the heuristic algorithms were used.
In Table 1, we present the results for 30 randomly selected instances, namely five for each value n ∈ {5, 10, 15, 20, 25, 30}, where the main goal is to report the relative error of the heuristic presented in this paper.In columns 1-4, we present the job numbers n ab and n ba as well as the processing times a and b.In column 5, we give the optimal total completion time value TCT-DP obtained by Algorithm DP.In column 6, we present the maximal number MN of states remaining in the list at a stage.In column 7, we present the number DIF = n ab n ba (n ab + n ba ) − MN, which is given to show that the maximal number of states remaining in the list is less than n 3 .In column 8, we give the total completion time value TCT-H obtained by the heuristic.Finally, column 9 displays the percentage deviation PD of the heuristic from the optimal function value.In Table 2, we present some results for all 30,000 considered instances.In column 1, we give the number n of jobs.In columns 2 and 3, we present the average values MN and DIF, respectively, for Algorithm DP.For Heuristic H, we present in column 4 the average values PD and column 5 displays the percentage of instances PO solved by the heuristic optimally.We also emphasize that the average relative error over all 30,000 instances is 0.85%.Moreover, we can state that the maximal relative error of Heuristic H among all 30,000 instances is 6.9% which has been obtained for an instance with n ab = 3, n ba = 2, a = 17, b = 23.For this instance, the optimal objective function value is 384 and the total completion time computed by the heuristic is 401.Moreover, the maximal number of states saved to the state list in a stage is 32,811 which has been obtained for an instance with n ab = 20, n ba = 10, a = 47, b = 49.In addition, if a state t = (i a , i b , C j,a ) has been written to the list and later a state t = (i a , i b , C j,a ) is computed, where C j,a ≤ C j,a and TCT t ≤ TCT t , then the state t is deleted from the list.The maximal number of states in the list left after considering all states is 1743.So, there is a large difference between the number of states considered and the number of states remaining in the list.
According to the previous results, we can also present the following conjecture.
Conjecture 1.There are only O(n 3 ) states that have to be considered at each stage.
As a consequence of the above conjecture, the running time of an advanced DP algorithm could be reduced to O(n 4 ).

Figure 1 .
Figure 1.Illustration for the proof of Lemma 1.

Figure 2 .
Figure 2. Illustration for the proof of Lemma 2.Then for the schedule Π with the operation sequence(O i 1 ,a , O i 2 ,a , O 1,b , π 1 , π 2 ) for machineM a and the operation sequence (O 1,b , π 3 , π 4 ) for machine M b , we increase the completion times for the operations O i,b ∈ π 3 on the value (b − a), and we decrease the completion time of the operation O 1,a on the value

Figure 3 .
Figure 3. Illustration for the proof of Theorem 1.

Theorem 2 .
b can be computed in constant time according to the values Ĉj−1,a and Ĉî b +1,a .There can be only an idle time on the machine M b before operation O îb +1,b but such a state can be excluded from consideration according to Theorem 1.Then, according to C i b ,b , the value C j,b can be computed in constant time.Finally, the value C j,a according to the times C j,b and C i a ,a and the value C i b +1,a can be computed in constant time.The problem J2|n j = 2, p j1 = a, p j2 = b| ∑ C j can be solved by Algorithm DP in O(n 5 ) time.

Table 1 .
Detailed results with Algorithm DP and Heuristic H for 30 randomly selected instances.

Table 2 .
Average results with Algorithm DP and Heuristic H for the 30,000 instances.