Chapter 5: Job Shop Scheduling: Phan Nguyen Ky Phuc April 8, 2020
Chapter 5: Job Shop Scheduling: Phan Nguyen Ky Phuc April 8, 2020
April 8, 2020
Contents
1 Introduction 1
3.4.1 Iteration 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.4.2 Iteration 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.7.1 Iteration 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.7.2 Iteration 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.7.3 Iteration 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
3.7.4 Iteration 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.7.5 Iteration 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.7.6 Iteration 6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
4 Assigment 17
1 Introduction
• There are n jobs and each job visits a number of machines following a PREDETERMINED ROUTE
1
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
• In some models a job may visit any given machine at most once and in other models a job may visit
each machine more than once, i.e, recirculation.
• A generalization of the basic job shop is a so-called flexible job shop which consists of a collection of
workcenters and each workcenter consists of a number of identical machines in parallel.
• Each job follows a predetermined route visiting a number of workcenters; when a job visits a workcenter,
it may be processed on any one of the machines at that workcenter.
Single Machine
• Consider a single machine and n jobs. Job j has a processing time pj , a release date rj and a due date
dj . If rj = 0 and dj = ∞, then the processing of job j is basically unconstrained.
• The makespan Cm ax in a single machine environment does not depend on the schedule.
Pn
• If the objective is to minimize the total weighted completion time, i.e., j=1 wj Cj , and the processing
of the jobs is unconstrained, then the the optimal schedule is Weighted Shortest Processing Time
first WSPT rule, which schedules the jobs in decreasing order of wj /pj .
• If the objective is to minimize the maximum lateness Lmax and the jobs are all released at time 0,
then the optimal schedule is the Earliest Due Date first (EDD) rule, which schedules the jobs in
increasing order of dj
• WSPT rule and the EDD rule are static priority rules.
• When the release time is not known in advanced, if the objective is to minimize the maximum lateness
Lmax then the Minimum Slack first (MS) is adopted. If the machine becomes available at time t,
the job with the least slack,i.e., max(dj − pj − t, 0) is assigned to the machine.MS rule is a dynamic
priority rule, in which the priority of each job is changed regarding to time.
• If the objective is to minimize the total weighted tardiness , then the heuristic algorithm Apparent
Tardiness Cost first (ATC) rule is applied. If the machine is free at time t, according to ATC rule,
among the remaining jobs the job with the highest Ij (t) is selected
wj max (dj − pj − t, 0)
Ij (t) = exp −
pj K p̄
where K is a so-called scaling parameter and p̂ is the average of the processing times of the jobs that
remain to be scheduled.
Parallel Machines
• If the objective is minimize Cmax , a heuristic priority rule, namely the Longest Processing Time
first (LPT) rule is adopted. According to this rule, whenever one of the machines is freed, the longest
job among those waiting for processing is selected to go next. This rule guarantees a solution that is
within 33 % of the optimal
• If all n jobs are available at t = 0, then the nonpreemptive SPT rule minimizes the total completion
P
time j Cj ;the nonpreemptive SPT rule remains optimal when preemtions are allowed.
P
• Minimizing the total weighted completion time j wj Cj in a parallel machine setting when all jobs are
available at t = 0 is NP-Hard, the WSPT rule can guarantee a solution within 22 % of the optimal.
Consider a job shop with n jobs and m machines. Each job has to be processed by a number of machines in
a given order and there is no recirculation. The processing of job j on machine i is referred to as operation
(i, j), i.e., (machine, job) and its duration is pij . The objective is to minimize the makespan Cmax . The
problem can be presented a graph G
Graph G
• Graph G composes of a set of nodes N and set of conjuntive (solid) arcs A and and disjunctive (broken)
arcs B.
• The conjunctive (solid) arcs A represent the routes of the jobs. If arc (i, j) → (h, j) ∈ A, then job j
has to be processed on machine i before it is processed on machine h
• Two operations that belong to two different jobs and which have to be processed on the same machine
are connected to one another by two so-called disjunctive (broken) arcs going in opposite directions.
• All arcs emanating from a node, solid as well as broken, have as length the processing time of the
operation that is represented by that node. In addition there is a source U and a sink V , which are
dummy nodes.
• A feasible schedule corresponds to a selection of one broken arc from each pair. Such a selection
determines the sequence in which the operations are to be performed on that machine.
• The makespan of a feasible schedule is determined by the longest path in the feasible schedule from
the source U to the sink V .
Sets
M : set of machines
J: set of jobs
A : be the set of solid arcs
B : be the set of broken arcs
N : be the set of nodes
Parameters
pij be processing time of job j on machine i
Variables
yij : starting of job j on machine i
xijk : binary variable xijk = 1 if job j is processed before job k in machine i; otherwise xijk = 0
Cmax : the make span
max Cmax
subject to
In this example, the tuple approach is used to write the code. Remind the structure of the set.
1 t u p l e tupleName {
2 dataType a t t r i b u t e 1 ;
3 dataType a t t r i b u t e 2 ;
4 };
5 s e t o f ( tupleName ) t u p l e S e t = . . . ;
6 f l o a t ParameterA [ t u p l e S e t ] = . . . ;
7 dvar b o o l e a n X[ t u p l e S e t ] ;
File *.mod
1 i n t numJob = . . . ;
A B C
1 Machine Job ProTime
2 1 1 10
(a) Data in "Scalar Sheet" 3 2 1 8
4 3 1 4
A B
5 2 2 8
1 numJob 3
6 1 2 3
2 numMachine 4
7 4 2 5
8 3 2 6
9 1 3 4
10 2 3 7
11 4 3 3
(c) Data in "BrokenArc Sheet"
A B C
1 Machine PreJob SucJob
2 1 1 2
3 1 2 1 (d) Data in "SolidArc Sheet"
4 1 2 3
A B C
5 1 3 2
1 Job PreMachine SucMachine
6 1 1 3
2 1 1 2
7 1 3 1
3 1 2 3
8 2 1 2
4 2 2 1
9 2 2 1
5 2 1 4
10 2 2 3
6 2 4 3
11 2 3 2
7 3 1 2
12 2 1 3
8 3 2 4
13 2 3 1
14 3 1 2
15 3 2 1
16 4 2 3
17 4 3 2
2 i n t numMachine = . . . ;
3 t u p l e Node{
4 i n t Machine ;
5 i n t Job ;
6 }
7 tuple SolidArc {
8 i n t Job ;
9 i n t PreMachine ;
10 i n t SucMachine ;
11 }
12 t u p l e BrokenArc {
13 i n t Machine ;
14 i n t PreJob ;
15 i n t SucJob ;
16 }
17 r a n g e JobRange = 1 . . numJob ;
18 r a n g e MachineRange = 1 . . numMachine ;
19
20 s e t o f ( Node ) NodeSet = . . . ;
21 s e t o f ( SolidArc ) SolidArcSet = . . . ;
22 s e t o f ( BrokenArc ) BrokenArcSet = . . . ;
23 f l o a t BigM=10000;
24 f l o a t ProTime [ NodeSet ] = . . . ;
25 dvar f l o a t+ y [ NodeSet ] ;
26 dvar b o o l e a n x [ BrokenArcSet ] ;
27 dvar f l o a t+ Cmax ;
28
29 e x e c u t e PRE_PROCESSING{
30 c p l e x . epgap = 0 . 0 1 ;
31 c p l e x . t i l i m =60∗60;
32 }
33 m i n i m i z e Cmax ;
34 s u b j e c t to {
35 f o r a l l (< j , p , s> i n S o l i d A r c S e t ) {
36 y[< s , j >] >=y[<p , j >]+ProTime[<p , j > ] ;
37 }
38 f o r a l l (<m, j > i n NodeSet ) {
39 Cmax>=y[<m, j >]+ProTime[<m, j > ] ;
40 }
41 f o r a l l (<m, p , s> i n BrokenArcSet ) {
42 y[<m, s >]>=y[<m, p>]+ProTime[<m, p>]−BigM∗(1−x[<m, p , s >]) ;
43 x[<m, p , s >]+x[<m, s , p>]==1;
44 }
45 }
46 e x e c u t e WRITE{
47 v a r o f i l e =new I l o O p l O u t p u t F i l e ( " R e s u l t . t x t " ) ;
48 o f i l e . w r i t e l n ( "The o b j e c t i v e f u n c t i o n v a l u e : " , c p l e x . getObjValue ( ) ) ;
49 f o r ( v a r Node i n NodeSet ) {
50 o f i l e . w r i t e l n ( " Machine [ " , Node . Machine , " ] w i l l s t a r t Job [ " , Node . Job , " ] a t : " , y [ Node ] ) ;
51 o f i l e . w r i t e l n ( " P r o c e s s Time [ " , Node . Machine , Node . Job , " ] : " , ProTime [ Node ] ) ;
52 }
53 o f i l e . w r i t e l n ( "−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−" ) ;
54 o f i l e . close () ;
55 }
File *.dat
1 S h e e t C o n n e c t i o n MyData ( " JobShopTupleData . x l s x " ) ;
2 numJob from SheetRead ( MyData , " S c a l a r ! B1" ) ;
3 numMachine from SheetRead ( MyData , " S c a l a r ! B2" ) ;
4 NodeSet from SheetRead ( MyData , "Node ! A2 : B11" ) ;
5 S o l i d A r c S e t from SheetRead ( MyData , " S o l i d A r c ! A2 : C8" ) ;
6 BrokenArcSet from SheetRead ( MyData , " BrokenArc ! A2 : C17" ) ;
7 ProTime from SheetRead ( MyData , "Node ! C2 : C11" ) ;
One of the most successful procedures for minimizing the makespan in a job shop is the Shifting Bottleneck
heuristic.
In the following overview of the Shifting Bottleneck heuristic M denotes the set of all m machines. In the
heuristic algorithm it is assumed that in previous iterations a selection of disjunctive arcs (broken arcs) has
been fixed for a subset M0 of machines. So for each one of the machines in M0 a sequence of operations has
already been determined.
Consider the following example with 4 machines and 3 jobs. The route, i.e., the machine sequence, as well
as the processing times are presented in the Table 1 below.
3.4.1 Iteration 1
The graph with only solid arcs are contructed. In this graph Cmax = 22
Remind
• The release date of operation (i, j) is determined by the longest path in graph G from the source to
node (i, j)
• The due date of operation (i, j) can be computed by considering the longest path in graph G from
node (i, j) to the sink and subtracting pij
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 18 0 8 11 16 0 4 11
Due Date 10 18 22 8 11 16 22 12 19 22
Slack Time 0 0 0 0 0 0 0 8 8 8
For each machine, the Earliest Release Day First rule is applied:
• For machine 1, the sequence is (1, 1) → (1, 3) → (1, 2), Lmax (1) = 6
• For machine 2, the sequence is (2, 2) → (2, 3) → (2, 1), Lmax (2) = 5
Either machine 1 or machine 2 can be considered as bottle neck. Breaking the tie arbitrarily, machine 1 is
selected to be included in M0 .
3.4.2 Iteration 2
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 18 0 14 17 22 10 14 21
Due Date 10 24 28 14 17 22 28 14 25 28
Slack Time 0 6 6 6 0 0 0 0 4 4
For each machine, the Earliest Release Day First rule is applied:
• For machine 2, the sequence is (2, 2) → (2, 1) → (2, 3), Lmax (2) = 0
None of the machines constitutes a bottleneck in any way. The final schedule is
• Constraint Programming only tries to find a good solution that is feasible and satisfies all the given
constraints. The constraints may include release dates and due dates for the jobs.
• A algorithm has to produce a sequence for each machine so that the overall schedule has a makespan
¯
is less than or equal to a given deadline d.
• The earliest possible starting time and latest possible completion time for each operation on the machine
are found
• The time windows of two operations on a given machine are compared to check whether they overlap,
then the precedence constraints will be applied
0
• Sij denote the earliest possible starting time of operation (i, j)
0
• Cij denote the earliest possible completion time of operation (i, j)
00
• Sij denote the latest possible starting time of operation (i, j)
00
• Cij denote the latest possible completion time of operation (i, j)
0
• The earliest possible starting time of operation (i, j), i.e., Sij , may be regarded as a local release date
00
of the operation and denoted by rij , whereas the latest possible completion time, i.e., Cij , may be
considered a local due date denoted by dij
• The slack between the processing of operations (i, j) and (i, k) on machine i is defined as
00 0
σ(i,j)→(i,k) = Sik − Cij
00 0
= Cik − Sij − pij − pik
= dik − rij − pij − pik
• Case 3 If σ(i,j)→(i,k) < 0 and σ(i,k)→(i,j) < 0 then there is no schedule that satisfies the precedence
constraints.
• Case 4 If σ(i,j)→(i,k) ≥ 0 and σ(i,k)→(i,j) ≥ 0 then either ordering between the two operations is still
possible.
• If there is more than one pair of operations that satisfy the conditions of Case 4, then a selection
heuristic has to be applied. The pair with the lowest flexibility is selected.
q
φ0 ((i, j), (i, k)) =
min σ(i,j)→(i,k) , σ(i,k)→(i,j) × max σ(i,j)→(i,k) , σ(i,k)→(i,j)
• After the pair of operations with the least flexibility φ0 ((i, j)(i, k)) has been selected, the precedence
constraint that retains the most flexibility is imposed, i.e., if
σ(i,j)→(i,k) ≥ σ(i,k)→(i,j)
• In order to apply the constraint satisfaction procedure to a job shop problem with the makespan
objective, it has to be embedded in the following framework. First, an upper bound du and a lower
bound dl have to be found for the makespan.
Consider the following example with 4 machines and 3 jobs. The route, i.e., the machine sequence, as well
as the processing times are presented in the Table below. Consider a due date d = 32 when all jobs have to
be completed.
3.7.1 Iteration 1
The graph with only solid arcs is contructed. In this graph set the makespan equal to the due date d = 32
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 18 0 8 11 16 0 4 11
Due Date 20 28 32 18 21 26 32 22 29 32
• (2, 2) → (2, 1)
• (2, 2) → (2, 3)
3.7.2 Iteration 2
The updated graph and updated release date and due date are given as Based on the former precedent
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 18 0 10 13 18 0 8 15
Due Date 18 28 32 18 21 26 32 22 29 32
(a) Machine 1
(b) Machine 2
σR→C (1, 1) (1, 2) (1, 3)
σR→C (2, 1) (2, 3)
(1, 1) 8
(2, 1) 4
(1, 2) 5
(2, 3) 5
(1, 3) 4 14
(c) Machine 3 (d) Machine 4
No further precedence constraints are applied, for each pair σ(i,j)→(i,k) ≥ 0 and σ(i,k)→(i,j) ≥ 0 the
φ0 ((i, j)(i, k)) is computed The pair with least flexibility is (3, 1), (3, 2). Since the slack are such that
σ(3,2)→(3,1) = σ(3,1)→(3,2) = 4
either precedence constraint can be inserted. Assume that (3, 2) → (3, 1) is adopted.
3.7.3 Iteration 3
The updated graph and updated release date and due date are given as
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 24 0 10 13 18 0 8 15
Due Date 14 28 32 14 17 22 28 22 29 32
(a) Machine 1
(b) Machine 2
σR→C (1, 1) (1, 2) (1, 3)
σR→C (2, 1) (2, 3)
(1, 1) 8
(2, 1) 4
(1, 2) 5
(2, 3) 5
(1, 3) 10 3
(c) Machine 4
3.7.4 Iteration 4
The updated graph and updated release date and due date are given as
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 24 0 10 13 18 0 8 18
Due Date 14 28 32 14 17 22 28 22 29 32
(a) Machine 1
(b) Machine 2
σR→C (1, 1) (1, 2) (1, 3)
σR→C (2, 1) (2, 3)
(1, 1) 8
(2, 1) 4
(1, 2) 5
(2, 3) 5
(1, 3) 0 10
No further precedence constraints are applied, for each pair σ(i,j)→(i,k) ≥ 0 and σ(i,k)→(i,j) ≥ 0 the
φ0 ((i, j)(i, k)) is computed
The pair with the least flexibility is (1, 1)(1, 3) and the precedence constraint (1, 1) → (1, 3) is inserted.
3.7.5 Iteration 5
The updated graph and updated release date and due date are given as
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 24 0 10 13 18 10 14 21
Due Date 14 28 32 14 17 22 28 22 29 32
3.7.6 Iteration 6
The updated graph and updated release date and due date are given as
These two operations can be ordered in either way without violating any due dates. A feasible ordering is
(1, 3) → (1, 2)
Job (1,1) (2,1) (3,1) (2,2) (1,2) (4,2) (3,2) (1,3) (2,3) (4,3)
Processing time 10 8 4 8 3 5 6 4 7 3
Release Date 0 10 24 0 10 13 18 10 18 25
Due Date 14 28 32 14 17 22 28 22 29 32
(a) Machine 1
4 Assigment
Q.2 Consider an instance with two machines in parallel and the total weighted tardiness as objective to be
minimized. There are 5 jobs.
jobs 1 2 3 4 5
pj 13 9 13 10 8
dj 6 18 10 11 13
wj 2 4 2 5 4
(a) Apply the ATC heuristic on this instance with the look-ahead parameter K = 1.
(b) Apply the ATC heuristic on this instance with the look-ahead parameter K = 5.
Q.3. Consider 6 machines in parallel and 13 jobs. The processing times of the 13 jobs are tabulated below.
jobs 1 2 3 4 5 6 7 8 9 10 11 12 13
pj 6 6 6 7 7 8 8 9 9 10 10 11 11
Q.4 Consider the following instance of the job shop problem with no recirculation and the makespan as
objective. Give an integer programming formulation of this instance
Q.5 Given the data in Question 5. Apply the Shifting Bottleneck heuristic to the instance of Question 5 .
Q.6 Consider the following two machine job shop with 10 jobs. All jobs have to be processed first on machine
1 and then on machine 2. (This implies that the two machine job shop is actually a two machine flow shop).
jobs 1 2 3 4 5 6 7 8 9 10 11
p1j 3 6 4 3 4 2 7 5 5 6 12
p2j 4 5 5 2 3 3 6 6 4 7 2
(a) Construct now a schedule as follows. The jobs have to go through the second machine in the same
sequence as they go through the first machine. A job whose processing time on machine 1 is shorter
than its processing time on machine 2 must precede each job whose processing time on machine 1 is
longer than its processing time on machine 2. The jobs with a shorter processing time on machine
1 are sequenced in increasing order of their processing times on machine 1. The jobs with a shorter
processing time on machine 2 follow in decreasing order of their processing times on machine 2. (This
rule is usually referred to as Johnson’s Rule.)