Chapter 13
Chapter 13
Contents
1 Introduction 1
1 Introduction
Workforce allocation and personnel scheduling deal with the arrangement of work schedules
and the assignment of personnel to shifts in order to cover the demand for resources that
vary over time.
Common constraints for Workforce Scheduling
• The demand per day, nj , j = 1, ..., 7,( n1 is Sunday and n7 is Saturday) is met.
Math Model
Index
Parameters
1
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Requirement:
Decision Variables
Objective Function
I
X
min Yi
i=1
Constraints
Demand constraint for each day
I
X
Xid ≥ Nd , ∀d
i=1
t=6
X
Xi,d+t ≤ 6, ∀i, d = 1...D − 6
t=0
t=6
X
Xi,d+t = 5Yi , ∀i, d = 1, 8, 15, 22, ..
t=0
Yi ≥ Xid , ∀i, d
D
X
Yi ≤ Xid , ∀i
d=1
Assumption
Chapter 13 Page 2
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Index
Parameters
Decision Variables
• XDid Binary variable XDid = 1 if nurse i is assigned to day shift d, otherwise XDid = 0
Objective function:
I
X
min Yi
i=1
Constraints
Demand constraints
I
X
XDid ≥ Dd , ∀d
i=1
XI
XNid ≥ Nd , ∀d
i=1
t=6
X
XRi,d+t ≥ 1, ∀i, d = 1...D − 6
t=0
Chapter 13 Page 3
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
t=6
X t=6
X
XDi,d+t + XNi,d+t ≤ 5, ∀i, d = 1, 8, 15, 22, ..
t=0 t=0
Yi ≥ XDid , ∀i, d
Yi ≥ XNid , ∀i, d
D
X D
X
Yi ≤ XDid + XNid , ∀i
d=1 d=1
1 /∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗
2 ∗ OPL 1 2 . 9 . 0 . 0 Model
3 ∗ Author : kyphuc
4 ∗ C r e a t i o n Date : May 2 7 , 2020 a t 2 : 0 7 : 5 3 PM
5 ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗/
6 i n t numDay=28;
7 i n t numEm=40;
8 r a n g e Day = 1 . .numDay ;
9 r a n g e Em= 1 . .numEm;
10 { i n t }Monday = { 1 , 8 , 1 5 , 2 2 } ;
11 i n t D[ Day ] = [ 5 , 5 , 5 , 5 , 5 , 5 , 5 ,
12 6 ,6 ,6 ,6 ,6 ,6 ,6 ,
13 7 ,7 ,7 ,7 ,7 ,7 ,7 ,
14 8 ,8 ,8 ,8 ,8 ,8 ,8];
15 i n t N[ Day ] = [ 5 , 5 , 5 , 5 , 5 , 5 , 5 ,
16 6 ,6 ,6 ,6 ,6 ,6 ,6 ,
17 7 ,7 ,7 ,7 ,7 ,7 ,7 ,
18 8 ,8 ,8 ,8 ,8 ,8 ,8];
19 dvar b o o l e a n XD[Em ] [ Day ] ;
20 dvar b o o l e a n XN[Em ] [ Day ] ;
21 dvar b o o l e a n XR[Em ] [ Day ] ;
22 dvar b o o l e a n Y[Em ] ;
23 e x e c u t e SETTING{
24 c p l e x . t i l i m =120;
25 }
26 minimize sum ( i i n Em)Y[ i ] ;
27 s u b j e c t to
28 {
29 f o r a l l ( d i n Day ) {
30 sum ( i i n Em)XD[ i ] [ d]>=D[ d ] ;
31 sum ( i i n Em)XN[ i ] [ d]>=N[ d ] ;
32 }
33 f o r a l l ( d i n Day , i i n Em) {
Chapter 13 Page 4
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Consider a set of m jobs, e.g., flight legs. A flight leg is characterized by a point of departure
and a point of arrival, as well as an approximate time interval during which the flight has
to take place. There is a set of n feasible and permissible combinations of flight legs that
one crew can handle, e.g., round trips or tours (the number n usually is very large). A
round trip may consist of several flight legs. Any given flight leg may be part of many round
trips. Round trip j, j = 1, ..., n, has a cost cj . Setting up a crew schedule is equivalent to
determining which round trips should be selected and which ones not. The objective is to
choose a set of round trips with a minimum total cost in such a way that each flight leg is
covered exactly once by one and only one round trip.
Annotation
• i: index of leg
• j: index of route
Objective function
X
min j = 1J (1)
Chapter 13 Page 5
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
Constraints
J
X
aij xj = 1, ∀i (2)
j=1
1 i n t numDay=28;
2 i n t numEm=40;
3 r a n g e Day = 1 . .numDay ;
4 r a n g e Em= 1 . .numEm;
5 { i n t }Monday = { 1 , 8 , 1 5 , 2 2 } ;
6 { i n t } Sunday = { 7 , 1 4 , 2 1 , 2 8 } ;
7 { i n t } Saturday = { 6 , 1 3 , 2 0 , 2 7 } ;
8 i n t D[ Day ] = [ 5 , 5 , 5 , 5 , 5 , 0 , 0 ,
9 6 ,6 ,6 ,6 ,6 ,0 ,0 ,
10 7 ,7 ,7 ,7 ,7 ,0 ,0 ,
11 8 ,8 ,8 ,8 ,8 ,0 ,0];
12 i n t N[ Day ] = [ 5 , 5 , 5 , 5 , 5 , 0 , 0 ,
13 6 ,6 ,6 ,6 ,6 ,0 ,0 ,
14 7 ,7 ,7 ,7 ,7 ,0 ,0 ,
15 8 ,8 ,8 ,8 ,8 ,0 ,0];
16 dvar b o o l e a n XD[Em ] [ Day ] ;
17 dvar b o o l e a n XN[Em ] [ Day ] ;
18 dvar b o o l e a n XR[Em ] [ Day ] ;
19 dvar b o o l e a n Y[Em ] ;
20 dvar b o o l e a n Z [Em ] [ Monday ] ;
21 dvar b o o l e a n V[Em ] [ Monday ] ;
22 e x e c u t e SETTING{
23 c p l e x . t i l i m =120;
24 }
25 minimize sum ( i i n Em)Y[ i ] ;
Chapter 13 Page 6
Ho Chi Minh City International University Scheduling
Industrial Systems Engineering Department Lecturer: Phan Nguyen Ky Phuc
26 s u b j e c t to
27 {
28 f o r a l l ( d i n Day ) {
29 sum ( i i n Em)XD[ i ] [ d]>=D[ d ] ;
30 sum ( i i n Em)XN[ i ] [ d]>=N[ d ] ;
31 }
32 f o r a l l ( d i n Day , i i n Em) {
33 XD[ i ] [ d]+XN[ i ] [ d]+XR[ i ] [ d]==1;
34 }
35 f o r a l l ( d i n 1 . . numDay−1, i i n Em) {
36 XN[ i ] [ d]+XD[ i ] [ d+1]<=1;
37 }
38 f o r a l l ( d i n 1 . . numDay−6, i i n Em) {
39 sum ( t i n 0 . . 6 )XR[ i ] [ d+t ] >=1;
40 }
41 f o r a l l ( d i n Monday , i i n Em) {
42 sum ( t i n 0 . . 6 )XD[ i ] [ d+t ]+sum ( t i n 0 . . 6 )XN[ i ] [ d+t ] <=5;
43 }
44 f o r a l l ( d i n Day , i i n Em) {
45 Y[ i ]>=XD[ i ] [ d ] ;
46 Y[ i ]>=XN[ i ] [ d ] ;
47 }
48 f o r a l l ( i i n Em) {
49 Y[ i ]<=sum ( d i n Day )XD[ i ] [ d]+sum ( d i n Day )XN[ i ] [ d ] ;
50 }
51 f o r a l l ( i i n Em, d i n Sunday ) {
52 XR[ i ] [ d]==1;
53 }
54 f o r a l l ( i i n Em, d i n Saturday ) {
55 XR[ i ] [ d]==1;
56 }
57 f o r a l l ( i i n Em, d i n Monday ) {
58 f o r a l l ( t in 0 . . 6 ) {
59 Z [ i ] [ d]>=XD[ i ] [ d+t ] ;
60 }
61 Z [ i ] [ d]<=sum ( t i n 0 . . 6 )XD[ i ] [ d+t ] ;
62 f o r a l l ( t in 0 . . 6 ) {
63 V[ i ] [ d]>=XN[ i ] [ d+t ] ;
64 }
65 V[ i ] [ d]<=sum ( t i n 0 . . 6 )XN[ i ] [ d+t ] ;
66 Z [ i ] [ d]+V[ i ] [ d]==Y[ i ] ;
67 }
68 }
Chapter 13 Page 7