Professional Documents
Culture Documents
Chapter 4: Project Planning and Scheduling: Phan Nguyen Ky Phuc April 20, 2019
Chapter 4: Project Planning and Scheduling: Phan Nguyen Ky Phuc April 20, 2019
Contents
1 Introduction 2
2 Mathematical Model 2
5.5 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3 Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
6.3.1 File(*.xlsx). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
6.3.2 File(*.mod) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
7 Assignment 14
1
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
1 Introduction
This chapter focuses on the planning and scheduling of jobs that are subject to precedence constraints.
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.
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.
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.
Although in practice the first format is more widely used than the second, the second has a number of
advantages.
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.
Example 1
Consider the problem of setting up a manufacturing facility for a new product. The project consists of eight
jobs. The job descriptions and the time requirements are as follows:
2 Mathematical Model
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
Constraints
Cmax constraint:
Cmax ≥ ECi , ∀i
ECi = ESi + pi , ∀i
LCi = LSi + pi , ∀i
Precedence constraints:
Slack constraint:
slai = LCi − ESi − pi , ∀i
1 i n t numJob = . . . ;
2 r a n g e j o b = 1 . . numJob ;
3 i n t B[ job ] [ job ] = . . . ;
4 i n t p [ job ] = . . . ;
5 dvar i n t+ Cmax ;
6 dvar i n t+ ES [ j o b ] ;
7 dvar i n t+ EC [ j o b ] ;
8 dvar i n t+ LS [ j o b ] ;
9 dvar i n t+ LC [ j o b ] ;
10 dvar i n t+ s l a [ j o b ] ;
11 m i n i m i z e Cmax ;
12 s u b j e c t to {
13 f o r a l l ( i in job ) {
14 Cmax>=EC[ i ] ;
15 }
16 f o r a l l ( i in job ) {
17 EC [ i ]==ES [ i ]+p [ i ] ;
18 LC [ i ]==LS [ i ]+p [ i ] ;
19 }
20 f o r a l l ( i i n job , j i n j o b : B [ i ] [ j ]==1) {
21 ES [ j ]>=EC [ i ] ;
22 LS [ i ]<=LS [ j ]−p [ i ] ;
23 }
24
25 f o r a l l ( i in job ) {
26 s l a [ i ]==LC [ i ]−ES [ i ]−p [ i ]
27 }
28
29 LF [ numJob]==Cmax ;
30 }
In the first round, the CPLEX CODE is run to find the Cmax . Let this value is V .
In the second round, objective function is changed and a constraint is added to find ES, EC, LS, LC and sla
The new objective function
1 maximize sum ( i i n j o b ) s l a [ i ]
The algorithm that yields a schedule with a minimum makespan is relatively simple and can be described
in words as follows:
• Start at time zero with the processing of all jobs that have no predecessors.
• Every time a job completes its processing, start processing those jobs of which all the predecessors
have been completed.
Process:
1: Step 1
2: Set time t = 0
3: Set ESj = 0 and ECj = pj for each job j has no predecessors
4: Step 2
5: Compute inductively for each job j: ESj = max ECk
all k→j
Compute: ECj = ESj + pj
6:
Step 3
7:
The makespan is Cmax = max (EC1 , EC2 , ...ECn )
8:
STOP
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: Step 2
5: Compute inductively for each job j: LCj = min LSk
j→all k
Compute: LSj = LCj − pj
6:
Step 3
7:
Verify that min (LS1 , LS2 , ...LSn ) = 0
8:
STOP
Example 2
Consider 14 jobs. The processing times are given below.
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
Job 1 2 3 4 5 6 7 8 9 10 11 12 13 14
ECj 5 11 14 23 21 26 33 32 36 42 43 51 50 56
In contrast to the setting in the previous section, the processing times of the n jobs are now random variables.
The mean µj and the variance σj2 of each of these random variables are either known or can be estimated.
Three pieces of data with regard the processing time of each job are given as:
• pm
j = the most likely processing time of job j,
Using these three pieces of data the expected processing time of job j is typically estimated by setting
paj + 4pm b
j + pj
µ̂j =
6
If Jcp denotes the set of jobs on a critical path, then an estimate for the expected makespan is
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
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
Each activity also has its own cost. By increasing the cost for an activity its processing time can be reduced.
The processing time pj of job j must vary in the range of [pmin
j ; pmax
j ]
At pmin
j the cost is caj , at pmax
j the cost is cbj . Clearly, caj ≥ cbj .
Let αj denote the marginal cost of reducing the processing time of job j by one time unit, i.e.,
cbj + αj pmax
j − pj
Index
j index of job j = 1...J
Parameters
c0 overhead cost per unit time
αj marginal cost of reducing the processing time of job j by one time unit,
pmin
j minimum processing time of job j
pmax
j maximum processing time of job j
caj cost of job j at pmax
j
cbj cost of job j at pmin
j
Bij = 1 if job i is the immediate predecessor of job j, i.e. i is immediately before job j., otherwise; Bij = 0
BigM a very big number
Decision Variables
pj be the processing time of job j
ESj be the earliest starting time of job j
ECj be the earliest completion time of job j
LSj be the latest starting time of job j
LCj be the latest completion time of job i
slaj slack of job j
Cmax be the makespane of the whole project
Z the total cost of whole project
Mathematical Model
n
X
cbj + αj pmax
min Z = c0 Cmax + j − pj
j=1
Cm ax constraint:
Cmax ≥ ECi , ∀i
ECi = ESi + pi , ∀i
LCi = LSi + pi , ∀i
Precedence constraints:
pmin
i ≤ pi , ∀i
pi ≤ pmax
i , ∀i
Slack constraint
slai = LCi − ESi − pi ∀i
Pn
In this model since j cbj is constant, this term can be eliminated from the objective function.
1 i n t numJob = . . . ;
2 r a n g e j o b = 1 . . numJob ;
3 i n t pre [ job ] [ job ] = . . . ;
4 i n t pmax [ j o b ] = . . . ;
5 i n t pmin [ j o b ] = . . . ;
6 i n t alpha [ job ] = . . . ;
7 i n t c0 = . . . ;
8 dvar i n t+ Cmax ;
9 dvar i n t+ ES [ j o b ] ;
10 dvar i n t+ EC [ j o b ] ;
11 dvar i n t+ LS [ j o b ] ;
12 dvar i n t+ LC [ j o b ] ;
13 dvar i n t+ s l a [ j o b ] ;
14 dvar i n t+ p [ j o b ] ;
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 ] ) ;
16 s u b j e c t to {
17 f o r a l l ( i in job ) {
18 Cmax>=EF [ i ] ;
19 }
20 f o r a l l ( i in job ) {
21 EC [ i ]==EC [ i ]+p [ i ] ;
22 LC [ i ]==LC [ i ]+p [ i ] ;
23 }
24 f o r a l l ( i i n job , j i n j o b : B [ i ] [ j ]==1) {
25 ES [ j ]>=EC [ i ] ;
26 LS [ i ]<=LS [ j ]−p [ i ] ;
27 }
28 f o r a l l ( i in job ) {
29 pmin [ i ]<=p [ i ];
30 p [ i ]<=pmax [ i ];
31 }
32 f o r a l l ( i in job ) {
33 s l a [ i ]==LC [ i ]−ES [ i ]−p [ i ] ;
34 }
35
36 LC [ numJob]==Cmax ;
37 }
PJ
In the 1st round, the code is run to find c0 Cmax + j=1 αj pmax
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
5.5 Example
Consider the following graph. The fixed overhead cost per unit time, co is 6. Other parameters are given as:
Step 1
Job 1 2 3 4 5 6 7 8 9 10 11 12 13 14
pmax
j 5 6 9 12 7 12 10 6 10 9 7 8 7 5
pmin
j 3 5 7 9 5 9 8 3 7 6 4 5 5 2
caj 20 25 20 15 30 40 35 25 30 20 25 35 20 10
αj 7 2 4 3 4 3 4 4 4 5 2 2 4 8
table.
Backtrack to calculate the latest starting times and their slacks at job maximum processing times
Job 1 2 3 4 5 6 7 8 9 10 11 12 13 14
pmax
j 5 6 9 12 7 12 10 6 10 9 7 8 7 5
ESj 0 5 5 11 14 14 23 26 26 33 36 43 43 51
ECj 5 11 14 23 21 26 33 32 36 42 43 51 51 56
Job on critical paths have slack time equal to zero.The critical path is 1 → 3 → 6 → 9 → 11 → 12 → 14
Job 1 2 3 4 5 6 7 8 9 10 11 12 13 14
ESj 0 5 5 11 14 14 23 26 26 33 36 43 43 51
LSj 0 6 5 12 19 14 24 30 26 34 36 43 44 51
Slackj 0 1 0 1 5 0 1 4 0 1 0 0 1 0
So the total project time, i.e., the makespan at the maximum processing times, is equal to 56. So the total
overhead cost over the maximal duration of the project is c0 × 6 = 336
Enumerate all minimal cut sets: {1},{3}, {6},{9},{11},{12},{14}. Among these sets find the best candidate:
11, 12.
Since reduce one processing time of 11 or 12 will incur a cost of 2 but saving a overhead cost of 6. This leads
to a total saving 4.
Assume that the job 11 is adopted and its processing time is reduce from 7 to 6 then the critical path is
updated as
Then there are two critical paths:
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 6 8 7 5
ECj 5 11 14 23 21 26 33 32 36 42 42 50 49 55
ESj 0 5 5 11 14 14 23 26 26 33 36 42 42 50
LSj 0 5 5 11 19 14 23 30 26 33 36 42 43 50
Slackj 0 0 0 0 5 0 0 4 0 0 0 0 1 0
1 → 2 → 4 → 7 → 10 → 12 → 14
1 → 3 → 6 → 9 → 11 → 12 → 14
Enumerate all minimal cut sets:{1}, {12},{14}, {2, 3},{2, 6}, {2, 9},{2, 11}, {4, 3},{4, 6}, {4, 9},{4, 9}, {4, 11},
{7, 3},{7, 6},{7, 9},{7, 11}, {10, 3},{10, 6},{10, 9},{10, 11}
Among these sets, choose the best candidate {12}. Since the cost for reducing one unit of time in this cut
set only 2. If the cut set for example {2, 6} is chosen, the cost for reducing one unit of time in this cut set
is 2 + 3 = 5
Assume that the processing time of job 12 is reduced by 1
The process will continue until it meets the STOP condition.
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 6 7 7 5
0
ECj 5 11 14 23 21 26 33 32 36 42 42 49 49 54
0
ESj 0 5 5 11 14 14 23 26 26 33 36 42 42 49
00
LSj 0 5 5 11 19 14 23 30 26 33 36 42 42 49
Slackj 0 0 0 0 5 0 0 4 0 0 0 0 0 0
Index
j index of jobs j = 1...J
l index of operator types l = 1...L
PI
t index of time t = 0... i=1 pi
Parameters
Bij represent the precedence constraints between job i and j.
Bij = 1 if job i is the immediate predecessor of job j, i.e. i is immediately before job j., otherwise; Bij = 0
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
Decision Variables
Constraints
Precedence and Processing Time Constraints
Cmax ≥ Ci , ∀i
Ci = Si + pi , ∀i
Ci ≤ Sj , ∀Bij = 1
Sj ≥ 0, ∀j
Workforce constraints
J
X
Yjt Wlj ≤ Nl ∀t, l
j=1
6.3 Example
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
are presented in the tables below.
Cplex Code
6.3.1 File(*.xlsx).
6.3.2 File(*.mod)
1 i n t numJob = . . . ;
2 i n t numType = . . . ;
3 i n t numTime = . . . ;
4 i n t BigM=10000;
5 r a n g e Job = 1 . . numJob ;
6 r a n g e Time = 1 . . numTime ;
7 r a n g e Type = 1 . . numType ;
8 i n t B [ Job ] [ Job ] = . . . ;
9 i n t W[ Type ] [ Job ] = . . . ;
10 i n t p [ Job ] = . . . ;
11 i n t N[ Type ] = . . . ;
12 dvar i n t+ S [ Job ] ;
13 dvar i n t+ C [ Job ] ;
14 dvar i n t+ Cmax ;
15 dvar b o o l e a n Y[ Time ] [ Job ] ;
16 dvar b o o l e a n U[ Time ] [ Job ] ;
17 dvar b o o l e a n V[ Time ] [ Job ] ;
18 e x e c u t e PRE_PROCESS {
19 // c p l e x . epgap = 0 . 0 5 ;
20 cplex . t i l i m = 1200;
21 }
22 m i n i m i z e (Cmax) ;
23 s u b j e c t to {
24 f o r a l l ( j i n Job ) {
25 Cmax >=C [ j ] ;
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) {
29 S [ j ]>=C [ i ] ;
30 }
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 ] ;
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 ) {
36 t<=S [ j ]−1+BigM∗U[ t ] [ j ] ;
37 t>=S [ j ]−1−BigM∗(1−U[ t ] [ j ] ) ;
38 }
39 f o r a l l ( t i n Time , j i n Job ) {
40 Y[ t ] [ j ]<=U[ t ] [ j ] ;
41 Y[ t ] [ j ]<=V[ t ] [ j ] ;
42 Y[ t ] [ j ]>=U[ t ] [ j ]+V[ t ] [ j ] − 1 ;
43 }
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 ] ;
46 }
47 }
7 Assignment
Q1 Consider the setup of the production facility. The durations of the 8 jobs are tabulated below.
(a) Compute the makespan and determine the critical path(s).
Job 1 2 3 4 5 6 7 8 Job 1 2 3 4 5 6 7 8
Pi 4 6 10 12 10 2 4 2 Predecessor _ _ _ 1 2 3,4,5 3,4 6,7
(b) Suppose that the duration of job 7 can be reduced by 3 weeks to 1 week. Compute the new makespan
and determine the new critical path(s).
Q2. Consider a project with the information are described below.
Job 1 2 3 4 5 6 7 8 9 10 11
pi 8 5 6 3 2 5 2 4 7 4 9
(b) Immediate Predecessors
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
Job 1 2 3 4 5 6 7 8 9 10 11
Pjmax 8 5 6 3 2 5 2 4 7 4 9
Pjmin 5 3 4 2 2 3 2 3 5 3 7
caj 30 25 20 15 30 40 35 25 30 20 30
αj 7 2 2 1 2 3 4 4 4 5 4
Q3 Consider the project as table below. Suppose it is possible to add resources to the various jobs on the
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.
(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.