Chapter 4
Chapter 4
1 Introduction
This chapter focuses on the planning and scheduling of jobs that are subject to precedence constraints.
Chapter 4: Project Planning and Scheduling The fact that the jobs are subject to precedence constraints implies that a job can start only when all its
predecessors have been completed.
The objective is to minimize the makespan while adhering to the precedence constraints.
Phan Nguyen Ky Phuc The representation of the precedence constraints as a graph may follow either one of two formats: "job-
on-arc" format and "job-on-node" format.
February 28, 2022 In the job-on-arc format, the arcs represent the jobs and the nodes represent the milestones or epochs
In the job-on-node format, the nodes represent the jobs, and the connecting arcs represents precedence
relationships between the jobs.
Contents Although in practice the first format is more widely used than the second, the second has a number of
advantages.
1 Introduction 2 A disadvantage of the job-on-arc format is a necessity for so-called dummy jobs that are needed to enforce
precedence constraints that otherwise would not have been enforcable.
2 Mathematical Model 2
6 Project Scheduling with Workforce Constraints 11 No. Job Description of Job Duration (in week) Immediate Predecessor(s)
1 Design production tooling 4 _
6.1 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 2 Prepare manufacturing drawings 6 _
6.2 Mathematical Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 3 Prepare production facility for new tools and parts 10 _
4 Procure tooling 12 1
6.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 5 Manual testing of software 10 2
6 Kit parts 2 3,4,5
6.3.1 File(*.xlsx). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 7 Orientation of new personnel 4 3,4
6.3.2 File(*.mod) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 8 System testing 2 6,7
Parameters
pi be the processing time of job i
Bij = 1 if job i is the immediate predecessor of job j, i.e. i is immediately before job j., otherwise; Bij = 0
9 s e t o f ( p r e ) B={ <1 ,4 > , <2 ,5 > , <3 ,6 > , <4 ,6 > , <5 ,6 > , <3 ,7 > , <4 ,7 > , <6 ,8 > , <7 ,8 >};
10 dvar f l o a t+ ES [ Nodes ] ;
11 dvar f l o a t+ EC[ Nodes ] ;
12 dvar f l o a t+ LS [ Nodes ] ;
13 dvar f l o a t+ LC [ Nodes ] ;
14 dvar f l o a t+ S l a [ Nodes ] ;
15 dvar f l o a t+ Cmax ;
16 dexpr f l o a t z1=Cmax ;
17 dexpr f l o a t z2=−sum ( i i n Nodes ) S l a [ i ] ;
18 m i n i m i z e s t a t i c L e x ( z1 , z2 ) ;
19 s u b j e c t to {
Figure 2: Example Precedence Graphs 20 f o r a l l ( i i n Nodes ) {
21 Cmax>=EC[ i ] ;
22 EC[ i ]==ES [ i ]+ Pro [ i ] ;
BigM a very big number 23 LC [ i ]==LS [ i ]+ Pro [ i ] ;
Decision Variables 24 S l a [ i ]==LS [ i ]−ES [ i ] ;
ESi be the earliest starting time of job i 25 }
26 f o r a l l (< i , j > i n B) {
ECi be the earliest completion time of job i
27 EC [ i ]<=ES [ j ] ;
LSi be the latest starting time of job i 28 LC [ i ]<=LS [ j ] ;
LCi be the latest completion time of job i 29 }
slai slack of job i 30 EC[8]==LC [ 8 ] ;
31 }
Cmax be the makespane of the whole project
Mathematical Model
min Cmax 3 Critical Path Method (CPM)
Constraints
The algorithm that yields a schedule with a minimum makespan is relatively simple and can be described
Cmax constraint:
in words as follows:
Cmax ≥ ECi , ∀i
• Start at time zero with the processing of all jobs that have no predecessors.
Processing time relation:
• Every time a job completes its processing, start processing those jobs of which all the predecessors
ECi = ESi + pi , ∀i
have been completed.
LCi = LSi + pi , ∀i
Let ECj denote the earliest possible completion time of job j
Precedence constraints:
Let ESj denote the earliest possible starting time of job j.
ECi ≤ ESj , ∀Bij = 1 Clearly,ECj = ESj + pj .
Let the set {all k → j} denote all jobs that are predecessors of job j. This implies that if job k is a predecessor
LCi ≤ LSj , ∀Bij = 1
of job j, job k has to be completed before job j can be started. [!ht] Let LCj denote the latest possible
Last job constraint:
Algorithm 1 Forward Procedure
LCf inalJob = ECf inalJob
Input:
Slack constraint: Given a precedence graph G of job
slai = LSi − ESi , ∀i Process:
1: Step 1
2: Set time t = 0
2.1 Cplex Code 3: Set ESj = 0 and ECj = pj for each job j has no predecessors
4: Step 2
1 i n t numNode=8;
5: Compute inductively for each job j: ESj = max ECk
2 r a n g e Nodes = 1 . . numNode ; all k→j
3 tuple pre { Compute: ECj = ESj + pj
6:
4 i n t node1 ; Step 3
7:
5 i n t node2 ; The makespan is Cmax = max (EC1 , EC2 , ...ECn )
8:
6 } STOP
7 i n t Pro [ Nodes ] = [ 4 , 6 , 1 0 , 1 2 , 1 0 , 2 , 4 , 2 ] ;
8 i n t BigM=10000; completion time of job j
Chapter 4: Project Planning and Scheduling Page 3 Chapter 4: Project Planning and Scheduling Page 4
Ho Chi Minh City International University Scheduling Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Let LSj denote the latest possible starting time of job j. Table 3: The latest completion time LCj of Example 2
Let the set {j → all k} denote all jobs that are successor of job j.
Job 1 2 3 4 5 6 7 8 9 10 11 12 13 14
LCj 5 12 14 24 30 26 34 36 36 43 43 51 51 56
Algorithm 2 Backward Procedure
Input: So the critical path is
Given a precedence graph G of job
1 → 3 → 6 → 9 → 11 → 12 → 14
Process:
1: Step 1
2: Set time t = Cmax
3: Set LCj = Cmax and LSj = Cmax − pj for each job j has no successors 4 Program Evaluation and Review Technique (PERT)
4: Step 2
5: Compute inductively for each job j: LCj = min LSk
j→all k In contrast to the setting in the previous section, the processing times of the n jobs are now random variables.
Compute: LSj = LCj − pj
6:
The mean µj and the variance σj2 of each of these random variables are either known or can be estimated.
Step 3
7:
Verify that min (LS1 , LS2 , ...LSn ) = 0
8: Three pieces of data with regard the processing time of each job are given as:
STOP
• paj = the optimistic processing time of job j,
• pm
j = the most likely processing time of job j,
Example 2
Using these three pieces of data the expected processing time of job j is typically estimated by setting
Consider 14 jobs. The processing times are given below.
paj + 4pm b
j + pj
µ̂j =
Table 1: Table Example 2 6
If Jcp denotes the set of jobs on a critical path, then an estimate for the expected makespan is
Job 1 2 3 4 5 6 7 8 9 10 11 12 13 14
pj 5 6 9 12 7 12 10 6 10 9 7 8 7 5 X
Ê(Cmax ) = µ̂j
j∈Jcp
To obtain some feeling for the distribution of the makespan in the original problem, one proceeds as follows.
Compute an estimate for the variance of the processing time of job j by taking
!2
pbj − paj
σ̂j2 =
6
the variance of the total processing time of all jobs on the critical path can be estimated by taking
X
V̂ (Cmax ) = σ̂j2
j∈Jcp
Figure 3: Precedence Graph of Example 2 5 Time Cost Trade Offs: Linear Costs
The corresponding ECj and LCj are given as:
5.1 Problem Statement
Table 2: The earliest completion time ECj of Example 2 There is a project which includes several activities and precedence constraints
There is an overhead cost associate with the makespane of the project. The overhead cost is calculated as
Job 1 2 3 4 5 6 7 8 9 10 11 12 13 14
c0 × Cmax , where c0 is the overhead cost per unit time. This cost can be interpreted as:
ECj 5 11 14 23 21 26 33 32 36 42 43 51 50 56
Chapter 4: Project Planning and Scheduling Page 5 Chapter 4: Project Planning and Scheduling Page 6
Ho Chi Minh City International University Scheduling Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Index
5.3 Cplex Code
j index of job j = 1...J 1 i n t numJob = . . . ;
Parameters 2 r a n g e j o b = 1 . . numJob ;
c0 overhead cost per unit time 3 i n t pre [ job ] [ job ] = . . . ;
4 i n t pmax [ j o b ] = . . . ;
αj marginal cost of reducing the processing time of job j by one time unit,
5 i n t pmin [ j o b ] = . . . ;
pmin
j minimum processing time of job j 6 i n t alpha [ job ] = . . . ;
pmax
j maximum processing time of job j 7 i n t c0 = . . . ;
caj cost of job j at pmax 8 dvar i n t+ Cmax ;
j
9 dvar i n t+ ES [ j o b ] ;
cbj cost of job j at pmin
j 10 dvar i n t+ EC[ j o b ] ;
Bij = 1 if job i is the immediate predecessor of job j, i.e. i is immediately before job j., otherwise; Bij = 0 11 dvar i n t+ LS [ j o b ] ;
BigM a very big number 12 dvar i n t+ LC [ j o b ] ;
13 dvar i n t+ s l a [ j o b ] ;
Decision Variables
14 dvar i n t+ p [ j o b ] ;
pj be the processing time of job j 15 m i n i m i z e c0 ∗Cmax+sum ( i i n j o b ) a l p h a [ i ] ∗ ( pmax [ i ]−p [ i ] ) ;
ESj be the earliest starting time of job j 16 s u b j e c t to {
ECj be the earliest completion time of job j 17 f o r a l l ( i in job ) {
18 Cmax>=EF [ i ] ;
LSj be the latest starting time of job j
19 }
LCj be the latest completion time of job i 20 f o r a l l ( i in job ) {
slaj slack of job j 21 EC [ i ]==EC[ i ]+p [ i ] ;
Cmax be the makespane of the whole project 22 LC [ i ]==LC [ i ]+p [ i ] ;
23 }
Z the total cost of whole project
24 f o r a l l ( i i n job , j i n j o b : B [ i ] [ j ]==1) {
Mathematical Model 25 ES [ j ]>=EC[ i ] ;
n
X
cbj + αj pmax
min Z = c0 Cmax + − pj 26 LS [ j ]>=LC [ i ] ;
j
j=1 27 }
28 f o r a l l ( i in job ) {
Cm ax constraint: 29 pmin [ i ]<=p [ i ] ;
Cmax ≥ ECi , ∀i 30 p [ i ]<=pmax [ i ] ;
31 }
Processing time relation: 32 f o r a l l ( i in job ) {
33 s l a [ i ]==LS [ i ]−ES [ i ] ;
ECi = ESi + pi , ∀i 34 }
35
LCi = LSi + pi , ∀i
36 LC [ numJob]==Cmax ;
37 }
Chapter 4: Project Planning and Scheduling Page 7 Chapter 4: Project Planning and Scheduling Page 8
Ho Chi Minh City International University Scheduling Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
PJ
In the 1st round, the code is run to find c0 Cmax + αj pmax
j=1 j − pj . Record the values of Cmax and pj
In the 2nd round, set Cmax and pi at the values found in the 1st round. After that change the objective
function as maximize the total slack to find, ES, EC, LS, EC and sla
Chapter 4: Project Planning and Scheduling Page 9 Chapter 4: Project Planning and Scheduling Page 10
Ho Chi Minh City International University Scheduling Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Workforce constraints
J
X
Rjt Wlj ≤ Nl ∀t, l
j=1
6.2 Mathematical Model Example Consider the following instance with five jobs and two types of operators. There are four of type
1 and eight of type 2. The processing times and workforce requirements, and the immediate Predecessors
Index are presented in the tables below.
j index of jobs j = 1...J Cplex Code
l index of operator types l = 1...L
PI (a) Processing Time and Operator Parameters
t index of time t = 0... i=1 pi (b) Immediate Predecessors
Job 1 2 3 4 5
Parameters
pj 8 4 6 4 4 Job Predecessor 1 2 3 4 5
Bij represent the precedence constraints between job i and j. W1j 2 1 3 1 2 Job _ _ _ 1 2,3
Bij = 1 if job i is the immediate predecessor of job j, i.e. i is immediately before job j., otherwise; Bij = 0 W2j 3 0 4 0 3
pj be the processing time of job i
BigM a very big number
Wlj denote the number of operators type l needs for job j.
Nl denote the number of operators type l 6.3.1 File(*.xlsx).
Decision Variables
Sj be the starting time of job j 6.3.2 File(*.mod)
Cj be the completion time of job j
1 i n t numJob = . . . ;
Cmax be the completion time of the whole project
2 i n t numType = . . . ;
Rjt be the binary variable, Rjt = 1 if Sj ≤ t ≤ Sj + pj − 1 ,otherwise Rjt = 0. 3 i n t numTime = . . . ;
Ujt be the binary variable, Ujt = 0 if t ≤ Sj − 1, otherwise, Ujt = 1 4 i n t BigM=10000;
r a n g e Job = 1 . . numJob ;
Vjt be the binary variable, Vjt = 0 if t ≥ Sj + pj , otherwise, Vjt = 1 5
6 r a n g e Time = 1 . . numTime ;
Mathematical Model 7 r a n g e Type = 1 . . numType ;
min Cmax 8 i n t B [ Job ] [ Job ] = . . . ;
9 i n t W[ Type ] [ Job ] = . . . ;
Chapter 4: Project Planning and Scheduling Page 11 Chapter 4: Project Planning and Scheduling Page 12
Ho Chi Minh City International University Scheduling Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Job 1 2 3 4 5 6 7 8 Job 1 2 3 4 5 6 7 8
10 i n t p [ Job ] = . . . ;
11 i n t N[ Type ] = . . . ;
Pi 4 6 10 12 10 2 4 2 Predecessor _ _ _ 1 2 3,4,5 3,4 6,7
12 dvar i n t+ S [ Job ] ;
13 dvar i n t+ C [ Job ] ; (b) Suppose that the duration of job 7 can be reduced by 3 weeks to 1 week. Compute the new makespan
14 dvar i n t+ Cmax ; and determine the new critical path(s).
15 dvar b o o l e a n Y[ Time ] [ Job ] ;
Q2. Consider a project with the information are described below.
16 dvar b o o l e a n U[ Time ] [ Job ] ;
17 dvar b o o l e a n V[ Time ] [ Job ] ;
Table 12: Data for Question 2.a
18 e x e c u t e PRE_PROCESS {
19 // c p l e x . epgap = 0 . 0 5 ; (a) Processing Time
20 cplex . t i l i m = 1200;
21 } Job 1 2 3 4 5 6 7 8 9 10 11
22 m i n i m i z e (Cmax) ; pi 8 5 6 3 2 5 2 4 7 4 9
23 s u b j e c t to { (b) Immediate Predecessors
24 f o r a l l ( j i n Job ) {
Job 1 2 3 4 5 6 7 8 9 10 11
25 Cmax >=C [ j ] ;
Predecessor _ 1 _ _ 3 4 4 5,6 5,6,1 2 7,8,9
26 C [ j ]==S [ j ]+p [ j ] ;
27 }
28 f o r a l l ( i i n Job , j i n Job : B [ i ] [ j ]==1) { (a) Compute the makespan and determine the critical path.
29 S [ j ]>=C [ i ] ; Suppose that each job can be shortened at a certain expense. The overhead cost is 6 per week (in tens of
30 }
thousands of dollars). The cost functions are linear. The minimum and maximum processing times as well
31 f o r a l l ( t i n Time , j i n Job ) {
32 t>=S [ j ]+p [ j ]−BigM∗V[ t ] [ j ] ;
as the marginal costs are tabulated below.
33 t<=S [ j ]+p [ j ]+BigM∗(1−V[ t ] [ j ] ) ;
34 }
35 f o r a l l ( t i n Time , j i n Job ) {
Table 13: Data for Question 2.b and 2.c
36 t<=S [ j ]−1+BigM∗U[ t ] [ j ] ;
Job 1 2 3 4 5 6 7 8 9 10 11
37 t>=S [ j ]−1−BigM∗(1−U[ t ] [ j ] ) ;
Pjmax 8 5 6 3 2 5 2 4 7 4 9
38 }
39 f o r a l l ( t i n Time , j i n Job ) {
Pjmin 5 3 4 2 2 3 2 3 5 3 7
40 Y[ t ] [ j ]<=U[ t ] [ j ] ; caj 30 25 20 15 30 40 35 25 30 20 30
41 Y[ t ] [ j ]<=V[ t ] [ j ] ; αj 7 2 2 1 2 3 4 4 4 5 4
42 Y[ t ] [ j ]>=U[ t ] [ j ]+V[ t ] [ j ] − 1 ;
43 }
(b) Apply Algorithm Time Cost Trade-off heuristic to this instance.
44 f o r a l l ( t i n Time , l i n Type ) {
45 sum ( j i n Job )Y[ t ] [ j ] ∗W[ l ] [ j ]<=N[ l ] ;
(c) Verify whether the solution obtained in (b) is optimal.
46 } Q3 Consider the project as table below. Suppose it is possible to add resources to the various jobs on the
47 } critical paths in order to reduce the makespan. The overhead cost co per unit time is 6. The costs are linear
and the marginal costs are tabulated below.
6.3.3 File *.dat
Chapter 4: Project Planning and Scheduling Page 13 Chapter 4: Project Planning and Scheduling Page 14
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
(a) Determine the processing times and the makespan of the solution with the total minimum cost. Is the
solution unique?
(b) Plot the relationship between the total cost of the project and the makespan.
(c) Using CPLEX solve the problem.
Q4. Consider the following PERT version of a given system.
(a) Rank the paths according to the means of their total processing time.
Job 1 2 3 4 5 6 7 8 9 10 11
Predecessor _ 1 _ _ 3 4 4 5,6 5,6,1 2 7,8,9
(b) Processing Times
Job 1 2 3 4 5 6 7 8 9 10 11
paj 2 1 5 2 1 4 1 1 6 1 8
pmj 8 5 6 3 2 5 2 4 7 4 9
pbj 14 9 7 4 3 6 3 7 7 10
(b) Rank the paths according to the variance in their total processing times. Which path has the highest
variance? Which path has the lowest variance?
(c) Compute the probability that the makespan is larger than 27 following the standard PERT procedure.
(d) Compute the probability that the makespan is larger than 27 by considering only the path with the
largest variance.
Q5 Formulate the following project scheduling problem with workforce constraints as an integer program
then solve it by CPLEX. Both workforce pools have four operators. The precedence constraints are specified
below.