SlideShare a Scribd company logo
1 of 64
Download to read offline
One 
Problem, 
Two 
Structures, 
Six 
Solvers, 
and 
Ten 
Years 
of 
Personnel 
Scheduling 
1 
! 
Louis-­‐Mar@n 
Rousseau 
CIRRELT 
-­‐ 
École 
Polytechnique 
de 
Montréal 
!
ShiI 
Scheduling: 
Once 
upon 
a 
@me... 
• It 
all 
started 
in 
1950’s... 
2
Personnel 
scheduling: 
nowadays 
Clopening happens 
when one works 
both a closing and 
the following 
opening shift 
3
Outline 
• GOAL: 
illustrate 
that 
the 
right 
structures 
for 
a 
problem 
can 
be 
useful 
whatever 
the 
solu:on 
technology 
! 
• Using 
formal 
languages 
structures 
in: 
– CP, 
SAT 
and 
MIP 
– Hybrid 
CP-­‐MIP 
Branch 
and 
Bound 
– Dynamic 
Programming 
• with 
Large 
Neighborhood 
Search 
• with 
Column 
Genera@on 
! 
• Discuss 
two 
applica@ons 
using 
CP 
techniques 
4
! 
The 
mul@-­‐ac@vity 
ShiI 
Scheduling 
Problem 
5 
A very extensive surrey of the mono-activity version in: 
! 
• Ernst, A. T., Jiang, H., Krishnamoorthy, M., & Sier, D. (2004). Staff 
scheduling and rostering: A review of applications, methods and models. 
European journal of operational research, 153(1), 3-27.
Problem 
descrip@on 
• Ac@vi@es 
(what 
employees 
can 
do) 
• Time 
Periods 
(15 
minutes) 
• ShiIs 
• Star@ng 
period 
• End 
period 
• Work 
segments 
• Rest 
segments 
! 
• Assign 
Rest activities: 
shiIs 
to 
employees 
that 
meet 
– work 
regula@ons 
– their 
exper@se 
– their 
availabili@es 
! 
• Op@mize 
– Labor 
costs 
– divergence 
from 
desired 
number 
of 
employees 
Work activities: 
Shift 1: 
Shift 2: 
6 
5 
4 
3 
1 
0 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
A 
typical 
example 
1. If 
an 
employee 
is 
working, 
he 
must 
work 
between 
3 
hours 
and 
8 
hours 
2. If 
a 
working 
employee 
covers 
at 
least 
6 
hours 
of 
work 
ac@vi@es, 
he 
must 
have 
two 
15 
minute-­‐breaks 
and 
a 
lunch 
break 
of 
1 
hour. 
3. If 
a 
working 
employee 
covers 
less 
than 
6 
hours 
of 
work 
ac@vi@es, 
he 
must 
have 
a 
15 
minute 
break, 
but 
no 
lunch. 
4. If 
performed, 
the 
dura@on 
of 
any 
ac@vity 
a 
∈ 
W 
is 
at 
least 
1 
hour 
5. A 
break 
(or 
lunch) 
is 
necessary 
between 
two 
different 
work 
ac@vi@es. 
6. Work 
ac@vi@es 
must 
be 
inserted 
between 
breaks, 
lunch 
and 
rest 
stretches. 
7. Rest 
shiIs 
have 
to 
be 
assigned 
at 
the 
beginning 
and 
at 
the 
end 
of 
the 
day. 
8. Ac@vi@es 
a 
∈ 
Ft 
are 
not 
allowed 
to 
be 
performed 
at 
period 
t 
∈ 
T. 
Minimize labor costs as well as over and under covering costs
! 
Constraints 
based 
on 
Regular 
& 
Context-­‐free 
Grammar 
languages 
8 
• Pesant, G. (2004). A regular language membership constraint for finite sequences of variables. In Principles and 
Practice of Constraint Programming–CP 2004 (pp. 482-495). Springer Berlin Heidelberg. 
• Beldiceanu, N., Carlsson, M., & Petit, T. (2004). Deriving filtering algorithms from constraint checkers. In Principles 
and Practice of Constraint Programming–CP 2004 (pp. 107-122). Springer Berlin Heidelberg. 
• Sellmann, M. (2006). The theory of grammar constraints. In Principles and Practice of Constraint Programming-CP 
2006 (pp. 530-544). Springer Berlin Heidelberg. 
• Quimper, C. G., & Walsh, T. (2006). Global grammar constraints. In Principles and Practice of Constraint 
Programming-CP 2006 (pp. 751-755). Springer Berlin Heidelberg. 
• Quimper, C.G., & Walsh, T. (2007). Decomposing global grammar constraints. In Principles and Practice of 
Constraint Programming–CP 2007 (pp. 590-604). Springer Berlin Heidelberg. 
• Kadioglu, S., & Sellmann, M. (2010). Grammar constraints. Constraints, 15(1), 117-144. 
• Katsirelos, G., Narodytska, N., Walsh, T., (2011), The weighted grammar constraint, Annals of OR, 184:1,179-207 
• Gange, G., Stuckey, P. J., & Van Hentenryck, P. (2013). Explaining Propagators for Edge-Valued Decision 
Diagrams. In Principles and Practice of Constraint Programming (pp. 340-355).
A 
regular 
language 
constraint 
• Regular 
language 
membership 
constraint 
(CP) 
– X 
= 
<x1,..., 
xn>, 
be 
a 
finite 
sequence 
of 
variables 
– Π 
denote 
a 
DFA 
or 
NFA 
– L(Π) 
be 
the 
regular 
language 
recognized 
by 
Π 
– aabbaa 
and 
ccc 
are 
words 
of 
L(Π), 
acab 
is 
not. 
9
Building 
the 
correct 
DFA 
(or 
NFA) 
Sequence 
regula@ons Sequence 
length 
Λ
Filtering 
Regular 
in 
CP 
filtered domains! 
X1 ∈ {a,b,c,o}! 
X2 ∈ {o}! 
X3 ∈ {a,c,o}! 
X4 ∈ {a,o}! 
X5 ∈ {a} 
11 
a 
a 
A simple automaton for rostering 
1 
2 5 
b 
a 
b 
c 
o 
3 6 
b 
o 
b 
4 7 
c 
o 
c 
c 
a 
o 
a 
o 
o 
o 
a 
xxxxx2 3 4 5 
1 
1 
1 
1 
1 
2 
2 
2 
2 
2 
3 
3 
3 
3 
3 
4 
4 
4 
4 
4 
5 
5 
5 
5 
5 
6 
6 
6 
6 
6 
7 
7 
7 
7 
7 
NNNNN2 5 
2 5 
1 
1 
2 
2 
3 
3 
1 x2 x3 x4 x5 
1 
1 
2 
2 
3 
3 
4 
4 
1 1 
4 
4 
2 
2 
5 
5 
3 
3 
6 
6 
4 
4 
7 
5 
7 
5 
6 
6 
7 
7 
NNNNNN1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
b 
b 
c 
o 
3 6 
b 
o 
b 
4 7 
c 
o 
c 
c 
a 
o 
a 
o 
o 
o 
a 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
x1 x2 x3 x4 x5 
1 
2 
3 
4 
5 
6 
7 
N1 N2 N3 N4 N5 N6 
x1 x2 x3 x4 x5 
1 1 
1 1 
2 
2 
3 
3 
4 
4 
5 
5 
6 
6 
7 
7 
2 
2 
3 
3 
4 
4 
5 
5 
6 
6 
7 
7 
1 
1 
2 
2 
3 
3 
4 
4 
5 
5 
6 
6 
7 
7 
1 
1 
2 
2 
3 
3 
4 
4 
5 
5 
6 
6 
7 
7 
5 
5 
6 
6 
7 
7 
N1 N2 N3 N4 N5 N6 
Off 
a 
b 
c 
initial domains! 
X1 ∈ {a,b,c,o}! 
X2 ∈ {b,o}! 
X3 ∈ {a,c,o}! 
X4 ∈ {a,b,o}! 
X5 ∈ {a}! 
1 
b 
b 
c 
o 
3 6 
b 
o 
b 
4 7 
c 
o 
c 
c 
a 
o 
a 
o 
o 
o 
a 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
x1 x2 x3 x4 x5 
1 
2 
3 
4 
5 
6 
7 
N1 N2 N3 N4 N5 N6 
x1 x2 x3 x4 x5 
N1 N2 N3 N4 N5 N6 
Forward pass Backward Pass
Decomposing 
the 
Regular 
Constraint 
• It 
is 
not 
mandatory 
to 
introduce 
a 
new 
propagator, 
we 
can 
simply 
introduce 
new 
variables 
12 
1 
2 5 
b 
a 
b 
c 
o 
3 6 
b 
o 
b 
4 7 
c 
o 
c 
c 
a 
o 
a 
o 
o 
o 
a 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
TableConstraint(Si, Xi, Si+1, Π), i : 1..5 
a 
2 5 
Domain consistency of the table constraint will filter S such that! 
S1 ∈ {1}! 
∈ 1 
S2 {1,2,3,4}! 
2 
S3 ∈ {1,5,6,7}! 
3 
S4 ∈ {1,2,4,5,7}! 
4 
S5 ∈ 5 
{1,2,5,7}! 
S6 ∈ 6 
{2} 
7 
1 
2 
3 
4 
5 
6 
7 
x3 x4 x5 
N3 N4 N5 N6 
Let Si be the state of the system at transition i: 
Initially S1 ∈ {1} S{2..6} ∈ {1,2,3,4,5,6,7} 
Every transition in the DFA is given ! 
as a tuple t = < OriginState, Value, DestinationState > 
x1 x2 x3 x4 x5 
1 1 
2 
3 
4 
5 
6 
7 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
N1 N2 N3 N4 N5 N6 
b 
b 
c 
o 
3 6 
b 
o 
b 
4 7 
c 
o 
c 
c 
a 
o 
a 
o 
o 
o 
a 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
x1 x2 x3 x4 x5 
1 
2 
3 
4 
5 
6 
7 
N1 N2 N3 N4 N5 N6 
x1 x2 x3 x4 x5 
1 1 
2 
3 
4 
5 
6 
7 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
1 
2 
3 
4 
5 
6 
7 
N1 N2 N3 N4 N5 N6
On 
our 
example 
1. If 
an 
employee 
is 
working, 
he 
must 
work 
between 
3 
hours 
and 
8 
hours 
2. If 
a 
working 
employee 
covers 
at 
least 
6 
hours 
of 
work 
ac@vi@es, 
he 
must 
have 
two 
15 
minute-­‐breaks 
and 
a 
lunch 
break 
of 
1 
hour. 
3. If 
a 
working 
employee 
covers 
less 
than 
6 
hours 
of 
work 
ac@vi@es, 
he 
must 
have 
a 
15 
minute 
break, 
but 
no 
lunch. 
4. If 
performed, 
the 
dura@on 
of 
any 
ac@vity 
a 
∈ 
W 
is 
at 
least 
1 
hour 
5. A 
break 
(or 
lunch) 
is 
necessary 
between 
two 
different 
work 
ac@vi@es. 
6. Work 
ac@vi@es 
must 
be 
inserted 
between 
breaks, 
lunch 
and 
rest 
stretches. 
7. Rest 
shiIs 
have 
to 
be 
assigned 
at 
the 
beginning 
and 
at 
the 
end 
of 
the 
day. 
8. Ac@vi@es 
a 
∈ 
Ft 
are 
not 
allowed 
to 
be 
performed 
at 
period 
t 
∈ 
T. 
13
A 
Regular 
language 
for 
our 
example 
Replacing 
sequencing 
rules 
(4 
to 
8)
The 
Grammar 
Global 
Constraint 
• A 
context 
free 
grammar 
is 
defined 
by 
– Σ 
: 
alphabet 
or 
ac@vi@es 
(also 
called 
terminals) 
– N: 
a 
set 
of 
characters 
or 
work 
structures 
called 
non 
terminals 
– S 
∈ 
N: 
the 
star@ng 
character 
– P: 
a 
set 
of 
produc@ons 
in 
the 
form 
A 
-­‐> 
w 
where: 
• A 
is 
a 
non 
terminal 
• w 
is 
a 
sequence 
of 
terminal 
and 
non 
terminal 
! 
• Example: 
! 
! 
A 
sequence 
of 
length 
3 
can 
only 
be 
: 
aab 
or 
abb
CYK 
Algorithm 
S  AB 
A  AA 
B  BB 
A  a 
B  b 
FILTERING 
S 
B 
A S B A S 
B 
A B A B A B 
a b a b a b 
16 
A 
dom(Xi)
The 
Grammar 
Graph 
 
S 
 
A B 
  
A A B 
B 
    
a a b 17 
b 
• The 
grammar 
graph 
(Γ) 
encapsulates 
all 
feasible 
solutions 
• A 
tree 
in 
Γ 
represents 
one 
solu:on 
Solu@on 
aab 
Solu@on 
abb 
(Γ) is a DNNF 
(Γ) is hypergraph 
and a solution (tree) 
is an hyperpath
SbCPc 
Sc , 2,5,7} 
requirements about the length of the sequences they represent. Similarly, a production be restrained to be effective only at particular times of the day. We denote a literal Modeling 
SSP 
with 
a 
Grammar 
Constraint 
where P ⊆ N is the set of positions where A can occur in the and • We 
A with APS 
can 
enrich 
the 
grammar 
descrip@on 
to 
include 
in 
the 
descrip@on 
of 
a 
w→ 
S ⊆ N is the set of valid spans for the subsequence A. If the symbol omitted, produc@on 
we assume that the set of valid positions and valid spans is N. A weight also • Valid 
be set 
associated of 
periods 
with (P) 
a production. Each time a production is used in the an • Valid 
employee, interval 
for 
the the 
weight span 
of 
of sub 
the sequence 
production (S) 
is added to the weight of the parsing indicate • Cost 
of 
the choosing 
weight a 
producw of @a on 
production on the arrow as follows: A BC. One mention the weight whenever it is null. 
For instance, the production A[2,4] 
! 
! 
! 
• These 
8.9 → BC{2,5,7} 
can be applied only if the [1,3] obtained has a length between 2 and 4 characters, the span of the literal C is between 3, and the can 
subsequence be 
easily 
incorporated 
C appears in 
at the 
positions CYK 
algorithm. 
2, 5, or 7. The weight associated production is 8.9 and the literal B is unconstrained. 
These new restrictions on the productions are useful to model situations where must work a certain amount of time before changing activities or can have a only at lunch time. Weights on production can be used to encode preferences the case when extra salary must be given to an employee doing some over-time. 
Implementing these constraints only require minor modifications to the algorithm. line 16 in Algorithm 1, when processing the production APa 
• Here 
is 
the 
enriched 
grammar 
that 
captures 
all 
the 
rules 
(1..8) 
18 
7. An employee must have a break or a lunch before changing activities. 
8. Periods of rest are to be scheduled at the beginning or the end of the day. 
9. A part-time employee must work a minimum of 3 hours and fewer than 6 hours a day. 
10. A full-time employee must work a minimum of 6 hours and a maximum of 8 hours a 
day. 
11. At specific times of the day, when the business is closed, every employee must either 
rest, lunch, or be on a break. 
As an example, a full time employee could rest between midnight and 9am, then work 
on activity 1 from 9am to 10:30am, break, work on activity 2 from 10:45am to 12:00pm, 
lunch, work on activity 3 from 1:00pm to 2:30pm, break, work on activity 4 from 2:45pm 
to 5:00pm, and rest until midnight. 
We model the rules using the following context-free grammar. Identifiers between de-limiters 
⟨. . .⟩ are terminal symbols. 
R → ⟨rest⟩R | ⟨rest⟩ Ai → ⟨activityi⟩Bi Ai | ⟨activityi⟩Bi 
W[4,∞) → Ai for 1 ≤ i ≤m P→ W ⟨break⟩W 
F → PLP S → RP[13,24]R | RF[30,38]R 
L → ⟨lunch⟩ ⟨lunch⟩ ⟨lunch⟩ ⟨lunch⟩ 
Sa 
w→ 
BPb 
can be applied only if the sequence 
the span of the literal C is between 1 and 
5, or 7. The weight associated with this 
unconstrained. 
useful to model situations where a worker 
changing activities or can have a lunch break 
used to encode preferences or to model 
employee doing some over-time. 
minor modifications to the algorithm. On 
production APa 
Sa 
w→ 
BPb 
SbCPc 
Sc , we add the 
∈ Pc as well as j ∈ Sa, k ∈ Sb, and 
12, 23] 24, 40]
Filtering 
the 
Grammar 
Constraint 
• Filtering 
algorithm 
by 
Meinolf 
Sellmann 
in 
2006, 
Quimper 
 
Walsh 
2006 
• Decomposi@on 
by 
Quimper 
 
Walsh 
2007 
• Incremental 
filtering 
algorithm 
by 
Kadogliu 
 
Sellmann 
2010. 
! 
• A 
boolean 
representa@on 
of 
a 
parsing 
tree: 
– A 
leaf 
is 
true 
if 
its 
corresponding 
assignment 
is 
true 
– If 
a 
AND 
node 
is 
true, 
both 
its 
children 
must 
be 
true 
– If 
a 
OR 
node 
is 
true, 
one 
its 
children 
must 
be 
true 
– if 
a 
node 
is 
true 
(OR/AND) 
one 
of 
its 
parent 
must 
be 
true 
– The 
root 
is 
true: 
N(S,1,3) 
= 
1 
! 
• This 
model 
can 
be 
used 
in 
CP 
or 
SAT. 
19
SAT 
vs 
CP, 
Monoli@c 
vs 
Decomposi@ons 
20 
|A| # m GAC SAT SAT Mono Decomp 
sol time bt opt sol time bt opt sol bt sol bt 
1 2 4 26.0 2666 507215 p 26.0 1998 443546 p 26.75 28072 26.25 625683 
1 3 6 37.25 1128199 36.75 1953562 37.0 34788 37.0 4771577 
1 4 6 38.0 256 84999 p 38.0 287 91151 p - 15539 38.0 56488 
1 5 5 24.0 153 67376 p 24.0 60 40008 p 24.0 40163 24.0 7914413 
1 6 6 33.0 98 48638 p 33.0 70 40361 p - 11537 33.0 33405 
1 7 8 49.5 236066 49.5 682715 49.0 27635 49.0 2663721 
1 8 3 20.5 80 36348 p 20.5 44 25502 p 21.0 24343 20.5 635589 
1 10 9 54.0 202699 54.25 507749 - 9365 - 519446 
2 1 5 25.0 453 146234 25.0 301 103918 p 25.0 1180 25.0 3828461 
2 2 10 58.75 313644 59.0 151076 58.0 14887 58.0 2116602 
2 3 6 38.25 236850 38.25 214203 41.0 1419 41.0 214201 
2 4 11 71.25 230777 69.75 239519 - 9983 - 774942 
2 5 4 23.75 2945 644496 p 23.75 1876 522780 p 26.5 25573 26.25 117105 
2 6 5 26.75 4831 777572 p 27.25 2162816 26.75 10681 26.75 1054531 
2 8 5 31.5 244837 31.75 391858 32.0 218 31.5 3771831 
2 9 3 19.0 2283 701474 p 19.0 1227 481395 p 19.25 20473 19.0 45516 
2 10 8 55.0 372870 55.0 333520 - 9968 - 909857 
Table 1. Benchmark problems solved by MiniSat+. GAC SAT: results from MiniSat+ with all 
CNF clauses; SAT: results from MiniSat+ with all CNF clauses but clause (4); Mono: results 
from a CP solver using the monolithic propagator; Decomp: results from a CP solver using the
Using 
Lazy-­‐Clause 
Genera@on 
Table : Comparison of different methods on shift scheduling problems. 
21 
• ShiI 
constraints 
are 
described 
with 
a 
context-­‐free 
grammar, 
which 
is 
then 
Experimental Results - Shift Scheduling 
converted 
into 
an 
MDD. 
• Coverage 
constraints 
are 
implemented 
with 
a 
BDD 
decomposi@on. 
• Solved 
with 
LCG 
with 
explana@ons 
over 
MDD 
with 
costs 
Inst. decmdd mdd ev-mdd ev-mddI 
time fails time fails time fails time fails 
1,2,4 14.51 39700 3.49 21888 0.20 607 0.17 635 
1,3,6 11.25 40675 19.00 76348 0.87 4045 0.91 4156 
1,4,6 2.62 7582 0.69 3518 0.11 350 0.27 1077 
1,5,5 0.41 1585 0.52 3955 0.07 239 0.06 238 
1,6,6 0.40 1412 0.21 1161 0.08 249 0.11 413 
1,7,8 4.03 13149 2.43 12046 0.73 3838 0.83 4279 
1,8,3 0.85 5002 0.39 3606 State-­‐0.06 of-­‐the-­‐ 
219 0.07 262 
1,10,9 17.55 44222 19.77 68688 1.23 5046 1.31 7419 
2,1,5 0.14 691 0.24 1490 0.02 art 
78 0.01 45 
2,2,10 — — 131.29 286747 43.62 99583 49.05 100958 
2,3,6 188.77 187760 144.99 289568 2.39 for 
1-­‐2 
6443 5.94 13695 
2,4,11 — — 391.59 918438 42.38 111567 2,5,4 25.85 59635 12.18 50340 0.65 ac:vi:es 
92.89 220568 
1545 0.48 1541 
2,6,5 83.78 104911 30.27 80046 6.18 12100 7.63 16074 
2,8,5 90.28 153331 34.69 110917 4.99 15507 10.02 26565 
2,9,3 6.10 20472 9.17 42105 0.86 1898 0.47 1593 
2,10,8 349.88 303227 95.61 168720 8.85 26331 17.22 37356 
Total — — 896.53 2139581 113.29 289645 187.44 436874 
Mean — — 52.74 125857.71 6.66 17037.94 11.03 25698.47 
Geom. — — 7.92 31465.82 0.86 2667.65 1.03 3428.35
22 
! 
Solving 
SSP 
with 
Regular 
and 
Context-­‐free 
Grammar 
in 
Mixed 
Integer 
Programming 
• Côté, M. C., Gendron, B., Quimper, C. G.,  Rousseau, L. M. (2011). 
Formal languages for integer programming modeling of shift scheduling 
problems. Constraints, 16(1), 54-76. 
! 
• Côté, M. C., Gendron, B.,  Rousseau, L. M. (2011). Grammar-based 
integer programming models for multiactivity shift scheduling. Management 
Science, 57(1), 151-163.
Compact 
assignment 
formula@on
A 
Regular 
language 
for 
our 
example 
Replacing 
sequencing 
rules 
(4 
to 
8)
Deriving 
a 
network 
flow 
problem
Building 
a 
network 
flow 
problem 
Network 
flow 
formula@on 
Linking 
constraints 
Derived 
automa:cally 
from 
the 
automaton
Linearizing 
a 
context-­‐free 
grammar 
• The 
model 
should 
find 
a 
tree 
in 
the 
Γ 
graph 
• The 
lineariza@on 
of 
the 
CFG 
constraint 
is 
simply: 
27 
 
vc(u) 
av = 
 
vp(u) 
av ⇤u ⇥ Nor 
 
vc(R) 
av = 1 
av  0, ⇤v ⇥ Nand
2 162,9396 31,67 3040 4285 163,9210 66,26 
3 168,8223 41,62 3040 4285 170,5663 46,74 
4 131,6560 42,89 2459 3408 133,1414 98,00 
5 144,4182 52,52 2143 2956 145,2850 21,83 
6 133,0766 57,56 2143 2956 135,1286 1,56 
7 149,2739 44,03 2456 3405 REGULAR 
150,7675 53,82 
8 147,2002 47,63 3040 4285 148,0467 263,43 
9 142,4836 27,46 1957 2614 182,4833 12,91 
10 146,2410 37,19 2458 3408 147,6853 19,28 
Results 
on 
our 
examples 
28 
Results for the classical MIP model 
ASSIGNMENT 
MIP 
Time |C| |V | MIP Value MIP Time 
36,53 29871 4040 172,6670 2142,17 
104,73 56743 5104   
89,06 56743 5104   
32,95 45983 4704 152,2240 3610,00 
63,61 40447 4360 171,9930 3610,01 
36,65 40447 4360 137,5180 3616,57 
38,26 45887 4608   
90,49 56743 5104   
27,15 36175 4156 182,5370 3607,76 
36,89 45983 4704 149,1810 3611,72 
Table 4: Results for the complete MIP grammar model 
GRAMMAR 
LP MIP 
Id LP Value LP Time |C| |V | MIP Value MIP Time 
1  3612,35 2727 6356 172,6665 7,42 
2  3610,68 35419 190480   
3  3615,64 35419 190480   
4  3614,92 19163 84672 133,0630 1850,38 
5  3609,11 10387 41464 145,8830 322,57 
6  3618,18 10387 41464 134,8178 130,21 
7  3618,83 19163 84672 151,2082 1662,75 
8  3611,39 35419 190480   
9  3614,71 5503 21580 182,5370 1015,10 
10  3610,10 19163 84672 147,0870 1313,28
Removing 
Symmetries 
• In 
the 
original 
model 
of 
Dantzig 
the 
variables 
actually 
were 
defined 
to 
capture 
the 
number 
of 
employees 
working 
on 
each 
shiI 
! 
• Which 
removes 
symmetries 
in 
the 
case 
where 
employees 
are 
iden:cal 
! 
• Can 
we 
ask 
the 
same 
ques@on 
using 
formal 
language 
based 
MIP 
? 
29 
NO YES
Implicit 
Grammar 
in 
MIP 
• Every 
node 
in 
the 
three 
now 
generates 
general 
integers: 
– av 
– NS 
 
vc(u) 
= 
number 
= 
total 
av = 
of 
@me 
node 
number 
 
of 
employees 
needed 
vp(u) 
and 
is 
selected 
by 
an 
employee 
av ⇤u ⇥ Nor 
 
vc(R) 
av = 1 
av  Ns 
0, ⇤v ⇥ Nand 
This model was shown to have the Linear 
Relaxation as mono-activity models of ! 
! 
• Set Covering formulation of Dantzig! 
• Implicit models of Aykin, Bechtold  
Jacob, and Rekik.! 
•
Results 
on 
the 
full 
mul@-­‐ac@vity 
problem 
• From 
1 
to 
10 
ac@vi@es 
• number 
of 
shiI 
increases 
by 
a 
factor 
of 
10,000 
• number 
of 
contraints 
increases 
by 
a 
factor 
of 
10. 
– Grammar 
based 
model: 
• number 
of 
variables 
is 
less 
than 
doubled 
• number 
of 
constraint 
increases 
by 
about 
50% 
• All 
Cˆot´e, Gendron, and Rousseau: Grammar-Based Integer Programing Models for Multi-Activity Shift Scheduling 
problem 
solved 
to 
op:mality 
in 
less 
than 
10 
minutes 
Article submitted to Management Science; manuscript no. MS-0001-1922.65 Table 4 Multi-activity problems with the Implicit Grammar model 
31 
NbAct NbShifts |C| |V | Time Nopt(10) 
2 13404928 70143 18202 423,90 9 
3 67752783 73529 20144 337,14 9 
4 214010944 76915 22092 212,07 9 
5 522350575 80301 24046 182,02 10 
6 1082991744 83687 26002 179,51 10 
7 2006203423 87073 27970 317,31 10 
8 3422303488 90459 29899 274,66 10 
9 5481658719 93845 31821 296,37 10 
10 8354684800 97231 33799 518,02 10
! 
An 
Hybrid 
MIP 
and 
CP 
Approach 
32 
• Salvagnin, D.,  Walsh, T. (2012). A hybrid MIP/CP approach for multi-activity 
shift scheduling. In Principles and Practice of Constraint Programming (pp. 
633-646). Springer Berlin Heidelberg.
ShiI 
Scheduling 
Problems: 
Personalized 
Cases 
• Par@culari@es: 
– List 
of 
available 
employees 
– Each 
employee 
has 
individual 
caracteris@cs 
• Availability 
within 
the 
planning 
horizon 
• Mul@-­‐ac@vity 
case: 
skills 
to 
perform 
only 
a 
subset 
of 
the 
ac@vi@es 
• 
Problem: 
• Assign 
one 
shiI 
to 
each 
employee; 
• while 
taking 
into 
account 
the 
constraints 
on 
the 
composi@on 
of 
shiIs; 
• minimizing 
the 
overall 
cost. 
! 
• No 
longer 
possible 
to 
use 
implicit 
models… 
at 
least 
not 
solely 
! 
33
Orbital 
Shrinking 
• Given 
a 
model 
contains 
symmetries, 
all 
variables 
which 
are 
symmetric 
can 
be 
replace 
by 
a 
single 
variable 
which 
is 
equal 
to 
their 
sum. 
! 
! 
! 
! 
! 
! 
! 
! 
! 
• Thus 
if 
X1, 
X2, 
X3 
are 
totally 
equal 
(the 
represent 
iden@cal 
employee), 
we 
replace 
them 
by 
a 
single 
variable 
34 
variable orbits 
constraint orbits 
take averages! 
within orbits 
Y 3 
1 = 
X 
i:1..3 
Xi
Orbital 
Shrinking 
• This 
trick 
only 
works 
for 
convex 
op@miza@on 
! 
(not 
MIP 
in 
general) 
• Grammars 
and 
Regulars 
allow 
to 
define 
a 
convex 
space 
! 
! 
! 
! 
! 
! 
! 
! 
• In 
that 
sense, 
the 
Implicit 
Grammar 
Model 
was 
a 
case 
of 
Orbital 
Shrinking. 
! 
• Now 
if 
the 
employees 
are 
not 
all 
iden@cal, 
can 
we 
s@ll 
use 
this 
trick 
?!? 
35 
Exact Reformulation 
convex optimization 
assignment 
a 
a 
b b b 
a a a 
a a 
regular/grammar constraint only
Hybrid An 
Hybrid 
MIP/MIP/CP 
CP approach 
decomposition 
36 
MIP solver on the 
shrunken model 
CP solver to check if a shrunken solution can be disaggregated 
into a feasible solution of the original problem 
inner node 
pruned by bound 
infeasible integer 
solution 
feasible integer 
solution
Multi-phase approach 
A 
Mutliphase 
Hybrid 
MIP/CP 
Approach 
37 
1. 
solve aggregated model 
and collect solutions 
2. 
apply MIP heuristic 
to collected solutions 
3. 
final run with 
real hybrid decomposition 
✓ no callbacks! 
✓ dual reductions on! 
✓ very fast 
could stop here! 
if gap is small! 
✓ callbacks! 
✓ CP check! 
✓ dual reductions off 
Implicit 
Grammar 
MIP 
formula@on 
LNS 
+ 
Grammar 
DP 
Integrated 
CP/MIP 
Branch 
and 
Bound
Experimental 
Results 
38 
10 
8 
6 
4 
2 
0 
# solved 
1 2 3 4 5 6 7 8 9 10 
cpx-reg hybrid grammar 
average time 
10000 
1000 
100 
10 
1 
1 2 3 4 5 6 7 8 9 10 
cpx-reg hybrid grammar 
gap 
100.0% 
10.0% 
1.0% 
0.1% 
1 2 3 4 5 6 7 8 9 10 
cpx-reg hybrid
! 
Dynamic 
Programming 
1 
Large 
Neighborhood 
Searh 
39 
• Quimper, C. G.,  Rousseau, L. M. (2010). A large neighbourhood search 
approach to the multi-activity shift scheduling problem. Journal of Heuristics, 
16(3), 373-392.
A 
Simple 
Problem 
• Lets 
look 
at 
a 
smaller 
example: 
– There 
are 
no 
more 
than 
two 
consecu@ve 
work 
period. 
– The 
day 
starts 
and 
finishes 
with 
a 
work 
period. 
– Overstaffing 
and 
understaffing 
costs 
1 
unit 
40
Local 
Search 
41 
1 
0 
1 
0 
0 
1 
1 
0 
Marginal costs
Best 
replacement 
shiI 
using 
Regular 
42 
Schedule 
regula@ons Schedule 
length 
1 
0 
1 
1 
1 
1 
0 1 
Marginal costs
Best 
replacement 
shiI 
using 
Grammar 
OS 
14 
OX 
13 
OX 
OW 
12 5 
6 
5 
6 
12 OW 
1 
2 1 
5 32 
3 
2 5 3 
12 AWWW,1 
12 AWWW,1 
1 1 0 1 1 
11 OB 
21 OW 
OW 
2 0 21 3 OB 
OW 
OW 
31 31 2 41 
1 
Ow 
1 1 1 
2 0 3 0 2 1 
1 1 Ow 
21 0 0 1 
11 Ob 
31 AWw,1 
31 Ow 
21 Ob 
31 Ow 
41 
ASXW,1 
14 ASXW,2 
14 
AXWB,1 
13 
AXWB,1 
32 
AWw,1 
11 ABb,1 
21 AWw,1 
21 ABb,1 
31 AWw,1 
41 
2 
0 
0 3 2 1 
5 
w w b w 
43 
Marginal costs 
1 
0 0 
0 
1 
2 
2 
1 
1 
1 
2 
1 
3
Local 
Search 
44 
1 
0 
0 1
A 
simple 
large 
neighborhood 
search 
• Generate 
a 
random 
solu@on 
• Repeat 
– Select 
an 
employee 
and 
remove 
its 
schedule 
– Compute 
the 
over-­‐costs 
and 
under-­‐costs 
for 
every 
ac@vity 
– Find 
the 
best 
replacing 
solu@on 
by: 
• Solving 
shortest 
path 
in 
the 
automaton 
layered 
graph 
(DAG) 
• Finding 
the 
lightest 
tree 
in 
an 
AND/OR 
Graph 
– Insert 
the 
new 
schedule 
in 
the 
solu@on 
• Un@l 
a 
local 
minimum 
is 
reached 
• Restart 
45
Experimental 
Results 
1 
ac@vity, 
compared 
with 
MIP 
46
Experimental 
Results 
1 
to 
10 
ac@vi@es 
47 
Ind 
runs 
Ind 
runs 
1 
min 
runs 
1 
min 
runs 
Times 
in 
milliseconds 
to 
construct 
one 
shiI
48 
! 
Dynamic 
Programming 
2 
Column 
Genera@on 
• Demassey, S., Pesant, G.,  Rousseau, L. M. (2006). A cost-regular based 
hybrid column generation approach. Constraints, 11(4), 315-333. 
! 
• Côté, M. C., Gendron, B.,  Rousseau, L. M. (2013). Grammar-based 
column generation for personalized multi-activity shift scheduling. INFORMS 
Journal on Computing, 25(3), 461-474.
Column 
Genera@on 
Framework 
49 
Select 
among 
a 
subset 
of 
possible 
shiIs, 
those 
that 
together 
fit 
best 
the 
demand 
(using 
a 
LP 
set 
covering 
formula@on) 
Find 
the 
shiIs 
that 
we 
haven’t 
seen 
that 
would 
improve 
the 
current 
solute 
and so on… 
NEW 
SHIFTS 
DUAL 
VALUES 
How ?
Grammar-­‐based 
Column 
Genera@on 
Set 
covering 
model: 
Restricted 
master 
problem: 
Set 
of 
periods 
in 
the 
planning 
horizon 
Set 
of 
ac@vi@es 
Set 
of 
employees 
Set 
of 
allowed 
shiIs 
for 
employee 
e 
Set 
of 
allowed 
shiIs 
for 
employee 
e 
at 
column 
genera@on 
itera@on 
k 
Integrality 
constraints 
relaxed 
50 
dual 
values
12 AWWW,1 
12 AWWW,1 
31 AWw,1 
31 Ow 
1 
0 
1 
1 
1 
1 
0 1 
Grammar-­‐based 
Column 
Genera@on 
approach: 
Solving 
the 
subproblem 
OS 
14 
OX 
13 
OX 
OW 
12 12 OW 
32 
11 OB 
21 OW 
OW 
21 OB 
31 OW 
31 OW 
41 
Ow 
21 Ow 
11 Ob 
21 Ob 
31 Ow 
41 
ASXW,1 
14 ASXW,2 
14 
AXWB,1 
13 
AXWB,1 
32 
AWw,1 
11 ABb,1 
21 AWw,1 
21 ABb,1 
31 AWw,1 
41 
2 0 3 0 2 1 
51 
dual 
values
Computa@onal 
Results 
Tableau 6.2 Comparison with Demassey et al. (2006) approach 
Comparison with existing IP formulations based on formal languages. Implicit Root Node Branch and Price 
Grammar MIP 
2+ activities 
Table 5: Multi-activity problems with the Implicit Grammar model 
NbA Time(s) NbIts NbCols NbS(0.01%) Time(s) NbS(1%) 
Grammar-based CG 
NbAct NbShif ts |C| |V | Time(s) Nopt(10) 
2 13404928 18068 69893 409.07 10 
3 67752783 19945 73152 205.38 9 
4 214010944 21822 76417 300.47 10 
5 522350575 23699 79688 146.16 10 
6 1082991744 25576 82961 213.79 10 
7 2006203423 27453 86246 230.88 10 
8 3422303488 29330 89492 257.06 10 
9 5481658719 31207 92731 289.08 10 
10 8354684800 33084 96026 516.74 10 
1 0.1 10 257 5 62 10 
2 0.2 16 601 6 100 9 
3 0.6 20 975 6 2074 8 
4 1.1 25 1321 State-­‐5 of-­‐2096 the-­‐art 
9 
5 3.0 46 2321 for 
0 personalized 
 2h 10 
6 4.0 47 2457 9 915 10 
7 6.6 47 3117 5 employees 
2426 9 
8 8.3 62 3459 7 2163 10 
9 9.6 62 3626 5 1886 7 
10 9.9 43 3405 6 3754 8 
Demassey et al. (2006) CG 
1 0.4 19 889 8 144  2 3.7 48 2340 8 394  3 2.0 52 2550 4 1592  4 12.5 103 5063 0  2h  5 6.2 86 4288 0  2h  6 13.8 130 6493 0  2h  7 18.4 137 6839 0  2h  8 25.4 155 7736 0  2h  9 25.9 155 7741 0  2h  10 42.0 179 8974 0  2h  
State-­‐of-­‐the-­‐art 
for 
Iden:cal 
Employess 
52 
Regular-based CG 
approach, the multi-activity problems can easily be handled with a few more productions 
than in the one-activity case, and results show that they can rapidly be solved on almost available instances. Note Used 
that the week 
growth form 
in the number of constraints and variables increasing the number of work of 
activities branching 
is much slower than the increase in the number feasible shifts.
! 
Retail 
Scheduling 
for 
Profit… 
when 
the 
objec@ve 
is 
non 
linear 
• Chapados, N., Joliveau, M., L’Ecuyer, P.,  Rousseau, L. M. Retail Store 
Scheduling for Profit. European Journal of Operations Research, Forthcoming.
Mo@va@on 
• How 
useful 
are 
salespersons 
in 
retail… 
54
Fundamental 
Accoun@ng 
Equa@on 
Profit 
Sales 
x 
Margin 
Salaries 
Goal: maximize this
Sales 
Decomposi@on 
per 
Period 
Sales Traffic Conversion 
Rate Average 
Basket 
Nb of shoppers 
entering the store 
Fraction of shoppers 
that become buyers Amount bought, 
knowing that something 
was bought
Salary 
Decomposi@on 
Salary Hours 
Worked 
Hourly 
Wage 
Commission
A 
Constraint 
Programming 
model 
• Given 
the 
sets 
:of 
@me 
periods 
T, 
of 
employee 
E 
and 
ac@vi@es 
A 
• inputs 
– Rn 
t 
the 
revenues 
generated 
if 
n 
people 
are 
working 
at 
@me 
t. 
– Ct 
a 
the 
payroll 
cost 
of 
an 
employee 
working 
at 
@me 
t 
• variables 
– xt 
e 
∈ 
A 
specifies 
the 
ac@vity 
performed 
by 
employee 
e 
at 
@me 
t. 
– yt 
a 
∈ 
{1..|E|} 
specifies 
the 
number 
of 
employees 
performing 
a 
at 
@me 
t 
Tue 
Mon 
Sun 
09:00 09:30 10:00 10:30 11:00 11:30 12:00 12:30 13:00 13:30 14:00 14:30 15:00 15:30 16:00 16:30 17:00 17:30 18:00 18:30 19:00 19:30 20:00 20:30 
Fig. 2. Average revenue increase by day-of-week and time-of-day across all stores covered case study. 
e( 
max 
Ca 
ya 
t t s.t. Regular(, xX 
tT 
Rty 
w 
t  
X 
aA 
all tT)) ⇤e ⇥ E GCC(x(all eE) 
t , A, y(all aA) 
t ) ⇤t ⇥ T ya 
t ⇥ {0, . . . , |E|} ⇤a ⇥ A, t ⇥ T xet 
⇥ A ⇤e ⇥ E, t ⇥ T The model is based on two sets of variables: xet 
specifies the activity (among
MIP 
model 
• Given 
the 
sets 
:of 
@me 
periods 
T, 
of 
employee 
E 
and 
ac@vi@es 
A 
• inputs 
– Rn 
t 
the 
revenues 
generated 
if 
n 
people 
are 
working 
at 
@me 
t 
– Ct 
a 
the 
payroll 
cost 
of 
an 
employee 
working 
at 
@me 
t 
• variables 
– xa 
et 
∈ 
{0,1} 
1 
if 
ac@vity 
a 
is 
performed 
by 
employee 
e 
at 
@me 
t. 
– ya 
kt 
∈ 
{0,1} 
1 
if 
exactly 
k 
employees 
are 
performing 
a 
at 
@me 
t
Scheduling 
over 
a 
day 
Table 7: Estimated relative profit increase p and relative gap  to the best upper bound, for the 
solutions obtained by solving the proposed CP model after 30 seconds and the MIP and CP models after 
300 seconds of CPU time. 
60 
CP after 30 sec. CP and MIP after 300 sec. 
Instances description p (%)  (%) p (%)  (%) 
Store #Days #Periods #Empl. CP CP MIP CP MIP CP 
1 408 33.8 6 3.4 0.3 3.5 3.5 0.2 0.2 
2 326 32.4 5 2.8 0.2 2.6 2.6 0.1 0.1 
3 372 40.6 5 2.6 0.2 2.6 2.6 0.1 0.1 
4 377 36.7 5 2.9 0.2 3.0 3.0 0.1 0.1 
5 309 40.4 5 2.6 0.2 2.7 2.7 0.1 0.1 
6 204 32.0 6 4.0 0.2 3.4 4.2 0.8 0.0 
7 399 37.5 5 2.7 0.2 2.8 2.8 0.1 0.1 
8 384 41.7 6 3.0 0.3 2.0 3.2 1.4 0.2 
9 241 33.0 5 2.9 0.2 3.0 3.1 0.1 0.0 
10 401 33.4 4 1.3 0.0 1.3 1.3 0.0 0.0 
11 369 42.0 5 2.1 0.2 2.2 2.2 0.2 0.2 
12 381 40.3 5 2.2 0.1 2.2 2.2 0.1 0.0 
13 366 41.4 5 2.2 0.1 2.1 2.3 0.2 0.1 
14 368 42.6 8 2.9 0.5 2.8 3.2 0.6 0.2 
15 184 42.1 9 2.7 0.8 2.4 3.2 1.1 0.3 
Average 339.3 38.0 5.6 2.7 0.2 2.6 2.8 0.3 0.1 
and 
yw 
d,t ! 2 8d 2 D, t 2 Td, (51)
Scheduling 
over 
a 
week 
61 
Table 8: Evolution of the relative gap  for the solutions identified by CP when building schedules over 
a week with two hours of CPU time, in comparison with the best upper bound obtained after 24 hours. 
Instances description Relative gap bound  (in %) 
Store #Weeks #Periods #Empl. after 30 min after 60 min after 120 min 
1 37 236 6 2.2 2.0 1.6 
2 23 224 5 1.9 1.7 1.5 
3 21 282 5 3.8 3.6 3.4 
4 34 256 5 2.5 2.3 2.1 
5 17 280 5 4.4 4.0 3.6 
6 15 232 6 2.8 2.5 2.4 
7 38 262 5 3.1 2.7 2.5 
8 38 288 6 3.4 3.3 3.1 
9 14 230 5 2.0 1.8 1.6 
10 36 234 4 2.0 1.9 1.7 
11 22 294 5 3.4 3.3 3.2 
12 23 282 5 2.9 2.7 2.6 
13 22 288 5 3.0 2.8 2.7 
14 18 296 8 1.9 1.7 1.7 
15 12 292 9 8.3 7.2 6.9 
Average 24.7 265.1 5.6 3.2 2.9 2.7 
generate less profit than the solutions of the full MIP while using the same amount of 
CPU time to construct feasible schedules, we always used the full MIP (no PLA) in this 
section. For many instances, the MIP failed to return a feasible solution after 30 seconds; 
for this reason we do not report the MIP results for 30 seconds. The solutions returned
! 
An 
Applica@on 
to 
Hydro-­‐Québec 
Call-­‐Center 
Scheduling 
62 
• Pelleau M, Rousseau L-M, L’Écuyer P, Zegal W, Delorme L. (2014), 
Scheduling of Agents from Forecasted Future Call Arrivals at Hydro-Québec’s 
Call Centers, In Principles and Practice of Constraint Programming. Springer 
Berlin Heidelberg. 
I HOPE YOU HAVE SEEN IT ON TUESDAY !
Experimental 
Results 
63 
Results 
tool 
Objective Value with HQ’s tool 
b. Phone First 
eDrseitloérdmeeMontréSaclh2e. dPuolilnytgecohf nAigqeunetsMontréal3. Institut deMraeych7e, r2c0h1e4d’Hyd1ro5-/Q1u7ébec) 
10 % 
20 % 
30 % 
Improvement in agent 
staffing levels met
QUESTIONS 
? 
64

More Related Content

Similar to One Problem, Two Structures, Six Solvers and Ten Years of Personnel Scheduling Louis-Martin Rousseau

ACL読み会2014@PFI "Less Grammar, More Features"
ACL読み会2014@PFI "Less Grammar, More Features"ACL読み会2014@PFI "Less Grammar, More Features"
ACL読み会2014@PFI "Less Grammar, More Features"
nozyh
 
Statitical consulting project report
Statitical consulting project reportStatitical consulting project report
Statitical consulting project report
Zhaoqiu Luo
 
Skiena algorithm 2007 lecture17 edit distance
Skiena algorithm 2007 lecture17 edit distanceSkiena algorithm 2007 lecture17 edit distance
Skiena algorithm 2007 lecture17 edit distance
zukun
 
Effective Test Execution for SPLs
Effective Test Execution for SPLsEffective Test Execution for SPLs
Effective Test Execution for SPLs
Sabrina Souto
 

Similar to One Problem, Two Structures, Six Solvers and Ten Years of Personnel Scheduling Louis-Martin Rousseau (20)

Ch06 alignment
Ch06 alignmentCh06 alignment
Ch06 alignment
 
Topological sort
Topological sortTopological sort
Topological sort
 
ACL読み会2014@PFI "Less Grammar, More Features"
ACL読み会2014@PFI "Less Grammar, More Features"ACL読み会2014@PFI "Less Grammar, More Features"
ACL読み会2014@PFI "Less Grammar, More Features"
 
MT Study SCFG
MT Study SCFGMT Study SCFG
MT Study SCFG
 
0620 19
0620 190620 19
0620 19
 
Statitical consulting project report
Statitical consulting project reportStatitical consulting project report
Statitical consulting project report
 
An optimal and progressive algorithm for skyline queries slide
An optimal and progressive algorithm for skyline queries slideAn optimal and progressive algorithm for skyline queries slide
An optimal and progressive algorithm for skyline queries slide
 
Design and analysis of algorithms question paper 2015 tutorialsduniya.com
Design and analysis of algorithms  question paper 2015   tutorialsduniya.comDesign and analysis of algorithms  question paper 2015   tutorialsduniya.com
Design and analysis of algorithms question paper 2015 tutorialsduniya.com
 
The Needleman-Wunsch Algorithm for Sequence Alignment
The Needleman-Wunsch Algorithm for Sequence Alignment The Needleman-Wunsch Algorithm for Sequence Alignment
The Needleman-Wunsch Algorithm for Sequence Alignment
 
Staff Scheduling
Staff SchedulingStaff Scheduling
Staff Scheduling
 
Complex analysis book by iit
Complex analysis book by iitComplex analysis book by iit
Complex analysis book by iit
 
Fast updating GG.pptx
Fast updating GG.pptxFast updating GG.pptx
Fast updating GG.pptx
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Skiena algorithm 2007 lecture17 edit distance
Skiena algorithm 2007 lecture17 edit distanceSkiena algorithm 2007 lecture17 edit distance
Skiena algorithm 2007 lecture17 edit distance
 
Paper Study - Incremental Data-Flow Analysis Algorithms by Ryder et al
Paper Study - Incremental Data-Flow Analysis Algorithms by Ryder et alPaper Study - Incremental Data-Flow Analysis Algorithms by Ryder et al
Paper Study - Incremental Data-Flow Analysis Algorithms by Ryder et al
 
Asymptotic Notations.pptx
Asymptotic Notations.pptxAsymptotic Notations.pptx
Asymptotic Notations.pptx
 
Blast fasta 4
Blast fasta 4Blast fasta 4
Blast fasta 4
 
Algorithm Assignment Help
Algorithm Assignment HelpAlgorithm Assignment Help
Algorithm Assignment Help
 
The Queue Length of a GI M 1 Queue with Set Up Period and Bernoulli Working V...
The Queue Length of a GI M 1 Queue with Set Up Period and Bernoulli Working V...The Queue Length of a GI M 1 Queue with Set Up Period and Bernoulli Working V...
The Queue Length of a GI M 1 Queue with Set Up Period and Bernoulli Working V...
 
Effective Test Execution for SPLs
Effective Test Execution for SPLsEffective Test Execution for SPLs
Effective Test Execution for SPLs
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 

Recently uploaded (20)

Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

One Problem, Two Structures, Six Solvers and Ten Years of Personnel Scheduling Louis-Martin Rousseau

  • 1. One Problem, Two Structures, Six Solvers, and Ten Years of Personnel Scheduling 1 ! Louis-­‐Mar@n Rousseau CIRRELT -­‐ École Polytechnique de Montréal !
  • 2. ShiI Scheduling: Once upon a @me... • It all started in 1950’s... 2
  • 3. Personnel scheduling: nowadays Clopening happens when one works both a closing and the following opening shift 3
  • 4. Outline • GOAL: illustrate that the right structures for a problem can be useful whatever the solu:on technology ! • Using formal languages structures in: – CP, SAT and MIP – Hybrid CP-­‐MIP Branch and Bound – Dynamic Programming • with Large Neighborhood Search • with Column Genera@on ! • Discuss two applica@ons using CP techniques 4
  • 5. ! The mul@-­‐ac@vity ShiI Scheduling Problem 5 A very extensive surrey of the mono-activity version in: ! • Ernst, A. T., Jiang, H., Krishnamoorthy, M., & Sier, D. (2004). Staff scheduling and rostering: A review of applications, methods and models. European journal of operational research, 153(1), 3-27.
  • 6. Problem descrip@on • Ac@vi@es (what employees can do) • Time Periods (15 minutes) • ShiIs • Star@ng period • End period • Work segments • Rest segments ! • Assign Rest activities: shiIs to employees that meet – work regula@ons – their exper@se – their availabili@es ! • Op@mize – Labor costs – divergence from desired number of employees Work activities: Shift 1: Shift 2: 6 5 4 3 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
  • 7. A typical example 1. If an employee is working, he must work between 3 hours and 8 hours 2. If a working employee covers at least 6 hours of work ac@vi@es, he must have two 15 minute-­‐breaks and a lunch break of 1 hour. 3. If a working employee covers less than 6 hours of work ac@vi@es, he must have a 15 minute break, but no lunch. 4. If performed, the dura@on of any ac@vity a ∈ W is at least 1 hour 5. A break (or lunch) is necessary between two different work ac@vi@es. 6. Work ac@vi@es must be inserted between breaks, lunch and rest stretches. 7. Rest shiIs have to be assigned at the beginning and at the end of the day. 8. Ac@vi@es a ∈ Ft are not allowed to be performed at period t ∈ T. Minimize labor costs as well as over and under covering costs
  • 8. ! Constraints based on Regular & Context-­‐free Grammar languages 8 • Pesant, G. (2004). A regular language membership constraint for finite sequences of variables. In Principles and Practice of Constraint Programming–CP 2004 (pp. 482-495). Springer Berlin Heidelberg. • Beldiceanu, N., Carlsson, M., & Petit, T. (2004). Deriving filtering algorithms from constraint checkers. In Principles and Practice of Constraint Programming–CP 2004 (pp. 107-122). Springer Berlin Heidelberg. • Sellmann, M. (2006). The theory of grammar constraints. In Principles and Practice of Constraint Programming-CP 2006 (pp. 530-544). Springer Berlin Heidelberg. • Quimper, C. G., & Walsh, T. (2006). Global grammar constraints. In Principles and Practice of Constraint Programming-CP 2006 (pp. 751-755). Springer Berlin Heidelberg. • Quimper, C.G., & Walsh, T. (2007). Decomposing global grammar constraints. In Principles and Practice of Constraint Programming–CP 2007 (pp. 590-604). Springer Berlin Heidelberg. • Kadioglu, S., & Sellmann, M. (2010). Grammar constraints. Constraints, 15(1), 117-144. • Katsirelos, G., Narodytska, N., Walsh, T., (2011), The weighted grammar constraint, Annals of OR, 184:1,179-207 • Gange, G., Stuckey, P. J., & Van Hentenryck, P. (2013). Explaining Propagators for Edge-Valued Decision Diagrams. In Principles and Practice of Constraint Programming (pp. 340-355).
  • 9. A regular language constraint • Regular language membership constraint (CP) – X = <x1,..., xn>, be a finite sequence of variables – Π denote a DFA or NFA – L(Π) be the regular language recognized by Π – aabbaa and ccc are words of L(Π), acab is not. 9
  • 10. Building the correct DFA (or NFA) Sequence regula@ons Sequence length Λ
  • 11. Filtering Regular in CP filtered domains! X1 ∈ {a,b,c,o}! X2 ∈ {o}! X3 ∈ {a,c,o}! X4 ∈ {a,o}! X5 ∈ {a} 11 a a A simple automaton for rostering 1 2 5 b a b c o 3 6 b o b 4 7 c o c c a o a o o o a xxxxx2 3 4 5 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 NNNNN2 5 2 5 1 1 2 2 3 3 1 x2 x3 x4 x5 1 1 2 2 3 3 4 4 1 1 4 4 2 2 5 5 3 3 6 6 4 4 7 5 7 5 6 6 7 7 NNNNNN1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 b b c o 3 6 b o b 4 7 c o c c a o a o o o a 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 x1 x2 x3 x4 x5 1 2 3 4 5 6 7 N1 N2 N3 N4 N5 N6 x1 x2 x3 x4 x5 1 1 1 1 2 2 3 3 4 4 5 5 6 6 7 7 2 2 3 3 4 4 5 5 6 6 7 7 1 1 2 2 3 3 4 4 5 5 6 6 7 7 1 1 2 2 3 3 4 4 5 5 6 6 7 7 5 5 6 6 7 7 N1 N2 N3 N4 N5 N6 Off a b c initial domains! X1 ∈ {a,b,c,o}! X2 ∈ {b,o}! X3 ∈ {a,c,o}! X4 ∈ {a,b,o}! X5 ∈ {a}! 1 b b c o 3 6 b o b 4 7 c o c c a o a o o o a 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 x1 x2 x3 x4 x5 1 2 3 4 5 6 7 N1 N2 N3 N4 N5 N6 x1 x2 x3 x4 x5 N1 N2 N3 N4 N5 N6 Forward pass Backward Pass
  • 12. Decomposing the Regular Constraint • It is not mandatory to introduce a new propagator, we can simply introduce new variables 12 1 2 5 b a b c o 3 6 b o b 4 7 c o c c a o a o o o a 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 TableConstraint(Si, Xi, Si+1, Π), i : 1..5 a 2 5 Domain consistency of the table constraint will filter S such that! S1 ∈ {1}! ∈ 1 S2 {1,2,3,4}! 2 S3 ∈ {1,5,6,7}! 3 S4 ∈ {1,2,4,5,7}! 4 S5 ∈ 5 {1,2,5,7}! S6 ∈ 6 {2} 7 1 2 3 4 5 6 7 x3 x4 x5 N3 N4 N5 N6 Let Si be the state of the system at transition i: Initially S1 ∈ {1} S{2..6} ∈ {1,2,3,4,5,6,7} Every transition in the DFA is given ! as a tuple t = < OriginState, Value, DestinationState > x1 x2 x3 x4 x5 1 1 2 3 4 5 6 7 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 N1 N2 N3 N4 N5 N6 b b c o 3 6 b o b 4 7 c o c c a o a o o o a 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 x1 x2 x3 x4 x5 1 2 3 4 5 6 7 N1 N2 N3 N4 N5 N6 x1 x2 x3 x4 x5 1 1 2 3 4 5 6 7 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 N1 N2 N3 N4 N5 N6
  • 13. On our example 1. If an employee is working, he must work between 3 hours and 8 hours 2. If a working employee covers at least 6 hours of work ac@vi@es, he must have two 15 minute-­‐breaks and a lunch break of 1 hour. 3. If a working employee covers less than 6 hours of work ac@vi@es, he must have a 15 minute break, but no lunch. 4. If performed, the dura@on of any ac@vity a ∈ W is at least 1 hour 5. A break (or lunch) is necessary between two different work ac@vi@es. 6. Work ac@vi@es must be inserted between breaks, lunch and rest stretches. 7. Rest shiIs have to be assigned at the beginning and at the end of the day. 8. Ac@vi@es a ∈ Ft are not allowed to be performed at period t ∈ T. 13
  • 14. A Regular language for our example Replacing sequencing rules (4 to 8)
  • 15. The Grammar Global Constraint • A context free grammar is defined by – Σ : alphabet or ac@vi@es (also called terminals) – N: a set of characters or work structures called non terminals – S ∈ N: the star@ng character – P: a set of produc@ons in the form A -­‐> w where: • A is a non terminal • w is a sequence of terminal and non terminal ! • Example: ! ! A sequence of length 3 can only be : aab or abb
  • 16. CYK Algorithm S AB A AA B BB A a B b FILTERING S B A S B A S B A B A B A B a b a b a b 16 A dom(Xi)
  • 17. The Grammar Graph S A B A A B B a a b 17 b • The grammar graph (Γ) encapsulates all feasible solutions • A tree in Γ represents one solu:on Solu@on aab Solu@on abb (Γ) is a DNNF (Γ) is hypergraph and a solution (tree) is an hyperpath
  • 18. SbCPc Sc , 2,5,7} requirements about the length of the sequences they represent. Similarly, a production be restrained to be effective only at particular times of the day. We denote a literal Modeling SSP with a Grammar Constraint where P ⊆ N is the set of positions where A can occur in the and • We A with APS can enrich the grammar descrip@on to include in the descrip@on of a w→ S ⊆ N is the set of valid spans for the subsequence A. If the symbol omitted, produc@on we assume that the set of valid positions and valid spans is N. A weight also • Valid be set associated of periods with (P) a production. Each time a production is used in the an • Valid employee, interval for the the weight span of of sub the sequence production (S) is added to the weight of the parsing indicate • Cost of the choosing weight a producw of @a on production on the arrow as follows: A BC. One mention the weight whenever it is null. For instance, the production A[2,4] ! ! ! • These 8.9 → BC{2,5,7} can be applied only if the [1,3] obtained has a length between 2 and 4 characters, the span of the literal C is between 3, and the can subsequence be easily incorporated C appears in at the positions CYK algorithm. 2, 5, or 7. The weight associated production is 8.9 and the literal B is unconstrained. These new restrictions on the productions are useful to model situations where must work a certain amount of time before changing activities or can have a only at lunch time. Weights on production can be used to encode preferences the case when extra salary must be given to an employee doing some over-time. Implementing these constraints only require minor modifications to the algorithm. line 16 in Algorithm 1, when processing the production APa • Here is the enriched grammar that captures all the rules (1..8) 18 7. An employee must have a break or a lunch before changing activities. 8. Periods of rest are to be scheduled at the beginning or the end of the day. 9. A part-time employee must work a minimum of 3 hours and fewer than 6 hours a day. 10. A full-time employee must work a minimum of 6 hours and a maximum of 8 hours a day. 11. At specific times of the day, when the business is closed, every employee must either rest, lunch, or be on a break. As an example, a full time employee could rest between midnight and 9am, then work on activity 1 from 9am to 10:30am, break, work on activity 2 from 10:45am to 12:00pm, lunch, work on activity 3 from 1:00pm to 2:30pm, break, work on activity 4 from 2:45pm to 5:00pm, and rest until midnight. We model the rules using the following context-free grammar. Identifiers between de-limiters ⟨. . .⟩ are terminal symbols. R → ⟨rest⟩R | ⟨rest⟩ Ai → ⟨activityi⟩Bi Ai | ⟨activityi⟩Bi W[4,∞) → Ai for 1 ≤ i ≤m P→ W ⟨break⟩W F → PLP S → RP[13,24]R | RF[30,38]R L → ⟨lunch⟩ ⟨lunch⟩ ⟨lunch⟩ ⟨lunch⟩ Sa w→ BPb can be applied only if the sequence the span of the literal C is between 1 and 5, or 7. The weight associated with this unconstrained. useful to model situations where a worker changing activities or can have a lunch break used to encode preferences or to model employee doing some over-time. minor modifications to the algorithm. On production APa Sa w→ BPb SbCPc Sc , we add the ∈ Pc as well as j ∈ Sa, k ∈ Sb, and 12, 23] 24, 40]
  • 19. Filtering the Grammar Constraint • Filtering algorithm by Meinolf Sellmann in 2006, Quimper Walsh 2006 • Decomposi@on by Quimper Walsh 2007 • Incremental filtering algorithm by Kadogliu Sellmann 2010. ! • A boolean representa@on of a parsing tree: – A leaf is true if its corresponding assignment is true – If a AND node is true, both its children must be true – If a OR node is true, one its children must be true – if a node is true (OR/AND) one of its parent must be true – The root is true: N(S,1,3) = 1 ! • This model can be used in CP or SAT. 19
  • 20. SAT vs CP, Monoli@c vs Decomposi@ons 20 |A| # m GAC SAT SAT Mono Decomp sol time bt opt sol time bt opt sol bt sol bt 1 2 4 26.0 2666 507215 p 26.0 1998 443546 p 26.75 28072 26.25 625683 1 3 6 37.25 1128199 36.75 1953562 37.0 34788 37.0 4771577 1 4 6 38.0 256 84999 p 38.0 287 91151 p - 15539 38.0 56488 1 5 5 24.0 153 67376 p 24.0 60 40008 p 24.0 40163 24.0 7914413 1 6 6 33.0 98 48638 p 33.0 70 40361 p - 11537 33.0 33405 1 7 8 49.5 236066 49.5 682715 49.0 27635 49.0 2663721 1 8 3 20.5 80 36348 p 20.5 44 25502 p 21.0 24343 20.5 635589 1 10 9 54.0 202699 54.25 507749 - 9365 - 519446 2 1 5 25.0 453 146234 25.0 301 103918 p 25.0 1180 25.0 3828461 2 2 10 58.75 313644 59.0 151076 58.0 14887 58.0 2116602 2 3 6 38.25 236850 38.25 214203 41.0 1419 41.0 214201 2 4 11 71.25 230777 69.75 239519 - 9983 - 774942 2 5 4 23.75 2945 644496 p 23.75 1876 522780 p 26.5 25573 26.25 117105 2 6 5 26.75 4831 777572 p 27.25 2162816 26.75 10681 26.75 1054531 2 8 5 31.5 244837 31.75 391858 32.0 218 31.5 3771831 2 9 3 19.0 2283 701474 p 19.0 1227 481395 p 19.25 20473 19.0 45516 2 10 8 55.0 372870 55.0 333520 - 9968 - 909857 Table 1. Benchmark problems solved by MiniSat+. GAC SAT: results from MiniSat+ with all CNF clauses; SAT: results from MiniSat+ with all CNF clauses but clause (4); Mono: results from a CP solver using the monolithic propagator; Decomp: results from a CP solver using the
  • 21. Using Lazy-­‐Clause Genera@on Table : Comparison of different methods on shift scheduling problems. 21 • ShiI constraints are described with a context-­‐free grammar, which is then Experimental Results - Shift Scheduling converted into an MDD. • Coverage constraints are implemented with a BDD decomposi@on. • Solved with LCG with explana@ons over MDD with costs Inst. decmdd mdd ev-mdd ev-mddI time fails time fails time fails time fails 1,2,4 14.51 39700 3.49 21888 0.20 607 0.17 635 1,3,6 11.25 40675 19.00 76348 0.87 4045 0.91 4156 1,4,6 2.62 7582 0.69 3518 0.11 350 0.27 1077 1,5,5 0.41 1585 0.52 3955 0.07 239 0.06 238 1,6,6 0.40 1412 0.21 1161 0.08 249 0.11 413 1,7,8 4.03 13149 2.43 12046 0.73 3838 0.83 4279 1,8,3 0.85 5002 0.39 3606 State-­‐0.06 of-­‐the-­‐ 219 0.07 262 1,10,9 17.55 44222 19.77 68688 1.23 5046 1.31 7419 2,1,5 0.14 691 0.24 1490 0.02 art 78 0.01 45 2,2,10 — — 131.29 286747 43.62 99583 49.05 100958 2,3,6 188.77 187760 144.99 289568 2.39 for 1-­‐2 6443 5.94 13695 2,4,11 — — 391.59 918438 42.38 111567 2,5,4 25.85 59635 12.18 50340 0.65 ac:vi:es 92.89 220568 1545 0.48 1541 2,6,5 83.78 104911 30.27 80046 6.18 12100 7.63 16074 2,8,5 90.28 153331 34.69 110917 4.99 15507 10.02 26565 2,9,3 6.10 20472 9.17 42105 0.86 1898 0.47 1593 2,10,8 349.88 303227 95.61 168720 8.85 26331 17.22 37356 Total — — 896.53 2139581 113.29 289645 187.44 436874 Mean — — 52.74 125857.71 6.66 17037.94 11.03 25698.47 Geom. — — 7.92 31465.82 0.86 2667.65 1.03 3428.35
  • 22. 22 ! Solving SSP with Regular and Context-­‐free Grammar in Mixed Integer Programming • Côté, M. C., Gendron, B., Quimper, C. G., Rousseau, L. M. (2011). Formal languages for integer programming modeling of shift scheduling problems. Constraints, 16(1), 54-76. ! • Côté, M. C., Gendron, B., Rousseau, L. M. (2011). Grammar-based integer programming models for multiactivity shift scheduling. Management Science, 57(1), 151-163.
  • 24. A Regular language for our example Replacing sequencing rules (4 to 8)
  • 25. Deriving a network flow problem
  • 26. Building a network flow problem Network flow formula@on Linking constraints Derived automa:cally from the automaton
  • 27. Linearizing a context-­‐free grammar • The model should find a tree in the Γ graph • The lineariza@on of the CFG constraint is simply: 27 vc(u) av = vp(u) av ⇤u ⇥ Nor vc(R) av = 1 av 0, ⇤v ⇥ Nand
  • 28. 2 162,9396 31,67 3040 4285 163,9210 66,26 3 168,8223 41,62 3040 4285 170,5663 46,74 4 131,6560 42,89 2459 3408 133,1414 98,00 5 144,4182 52,52 2143 2956 145,2850 21,83 6 133,0766 57,56 2143 2956 135,1286 1,56 7 149,2739 44,03 2456 3405 REGULAR 150,7675 53,82 8 147,2002 47,63 3040 4285 148,0467 263,43 9 142,4836 27,46 1957 2614 182,4833 12,91 10 146,2410 37,19 2458 3408 147,6853 19,28 Results on our examples 28 Results for the classical MIP model ASSIGNMENT MIP Time |C| |V | MIP Value MIP Time 36,53 29871 4040 172,6670 2142,17 104,73 56743 5104 89,06 56743 5104 32,95 45983 4704 152,2240 3610,00 63,61 40447 4360 171,9930 3610,01 36,65 40447 4360 137,5180 3616,57 38,26 45887 4608 90,49 56743 5104 27,15 36175 4156 182,5370 3607,76 36,89 45983 4704 149,1810 3611,72 Table 4: Results for the complete MIP grammar model GRAMMAR LP MIP Id LP Value LP Time |C| |V | MIP Value MIP Time 1 3612,35 2727 6356 172,6665 7,42 2 3610,68 35419 190480 3 3615,64 35419 190480 4 3614,92 19163 84672 133,0630 1850,38 5 3609,11 10387 41464 145,8830 322,57 6 3618,18 10387 41464 134,8178 130,21 7 3618,83 19163 84672 151,2082 1662,75 8 3611,39 35419 190480 9 3614,71 5503 21580 182,5370 1015,10 10 3610,10 19163 84672 147,0870 1313,28
  • 29. Removing Symmetries • In the original model of Dantzig the variables actually were defined to capture the number of employees working on each shiI ! • Which removes symmetries in the case where employees are iden:cal ! • Can we ask the same ques@on using formal language based MIP ? 29 NO YES
  • 30. Implicit Grammar in MIP • Every node in the three now generates general integers: – av – NS vc(u) = number = total av = of @me node number of employees needed vp(u) and is selected by an employee av ⇤u ⇥ Nor vc(R) av = 1 av Ns 0, ⇤v ⇥ Nand This model was shown to have the Linear Relaxation as mono-activity models of ! ! • Set Covering formulation of Dantzig! • Implicit models of Aykin, Bechtold Jacob, and Rekik.! •
  • 31. Results on the full mul@-­‐ac@vity problem • From 1 to 10 ac@vi@es • number of shiI increases by a factor of 10,000 • number of contraints increases by a factor of 10. – Grammar based model: • number of variables is less than doubled • number of constraint increases by about 50% • All Cˆot´e, Gendron, and Rousseau: Grammar-Based Integer Programing Models for Multi-Activity Shift Scheduling problem solved to op:mality in less than 10 minutes Article submitted to Management Science; manuscript no. MS-0001-1922.65 Table 4 Multi-activity problems with the Implicit Grammar model 31 NbAct NbShifts |C| |V | Time Nopt(10) 2 13404928 70143 18202 423,90 9 3 67752783 73529 20144 337,14 9 4 214010944 76915 22092 212,07 9 5 522350575 80301 24046 182,02 10 6 1082991744 83687 26002 179,51 10 7 2006203423 87073 27970 317,31 10 8 3422303488 90459 29899 274,66 10 9 5481658719 93845 31821 296,37 10 10 8354684800 97231 33799 518,02 10
  • 32. ! An Hybrid MIP and CP Approach 32 • Salvagnin, D., Walsh, T. (2012). A hybrid MIP/CP approach for multi-activity shift scheduling. In Principles and Practice of Constraint Programming (pp. 633-646). Springer Berlin Heidelberg.
  • 33. ShiI Scheduling Problems: Personalized Cases • Par@culari@es: – List of available employees – Each employee has individual caracteris@cs • Availability within the planning horizon • Mul@-­‐ac@vity case: skills to perform only a subset of the ac@vi@es • Problem: • Assign one shiI to each employee; • while taking into account the constraints on the composi@on of shiIs; • minimizing the overall cost. ! • No longer possible to use implicit models… at least not solely ! 33
  • 34. Orbital Shrinking • Given a model contains symmetries, all variables which are symmetric can be replace by a single variable which is equal to their sum. ! ! ! ! ! ! ! ! ! • Thus if X1, X2, X3 are totally equal (the represent iden@cal employee), we replace them by a single variable 34 variable orbits constraint orbits take averages! within orbits Y 3 1 = X i:1..3 Xi
  • 35. Orbital Shrinking • This trick only works for convex op@miza@on ! (not MIP in general) • Grammars and Regulars allow to define a convex space ! ! ! ! ! ! ! ! • In that sense, the Implicit Grammar Model was a case of Orbital Shrinking. ! • Now if the employees are not all iden@cal, can we s@ll use this trick ?!? 35 Exact Reformulation convex optimization assignment a a b b b a a a a a regular/grammar constraint only
  • 36. Hybrid An Hybrid MIP/MIP/CP CP approach decomposition 36 MIP solver on the shrunken model CP solver to check if a shrunken solution can be disaggregated into a feasible solution of the original problem inner node pruned by bound infeasible integer solution feasible integer solution
  • 37. Multi-phase approach A Mutliphase Hybrid MIP/CP Approach 37 1. solve aggregated model and collect solutions 2. apply MIP heuristic to collected solutions 3. final run with real hybrid decomposition ✓ no callbacks! ✓ dual reductions on! ✓ very fast could stop here! if gap is small! ✓ callbacks! ✓ CP check! ✓ dual reductions off Implicit Grammar MIP formula@on LNS + Grammar DP Integrated CP/MIP Branch and Bound
  • 38. Experimental Results 38 10 8 6 4 2 0 # solved 1 2 3 4 5 6 7 8 9 10 cpx-reg hybrid grammar average time 10000 1000 100 10 1 1 2 3 4 5 6 7 8 9 10 cpx-reg hybrid grammar gap 100.0% 10.0% 1.0% 0.1% 1 2 3 4 5 6 7 8 9 10 cpx-reg hybrid
  • 39. ! Dynamic Programming 1 Large Neighborhood Searh 39 • Quimper, C. G., Rousseau, L. M. (2010). A large neighbourhood search approach to the multi-activity shift scheduling problem. Journal of Heuristics, 16(3), 373-392.
  • 40. A Simple Problem • Lets look at a smaller example: – There are no more than two consecu@ve work period. – The day starts and finishes with a work period. – Overstaffing and understaffing costs 1 unit 40
  • 41. Local Search 41 1 0 1 0 0 1 1 0 Marginal costs
  • 42. Best replacement shiI using Regular 42 Schedule regula@ons Schedule length 1 0 1 1 1 1 0 1 Marginal costs
  • 43. Best replacement shiI using Grammar OS 14 OX 13 OX OW 12 5 6 5 6 12 OW 1 2 1 5 32 3 2 5 3 12 AWWW,1 12 AWWW,1 1 1 0 1 1 11 OB 21 OW OW 2 0 21 3 OB OW OW 31 31 2 41 1 Ow 1 1 1 2 0 3 0 2 1 1 1 Ow 21 0 0 1 11 Ob 31 AWw,1 31 Ow 21 Ob 31 Ow 41 ASXW,1 14 ASXW,2 14 AXWB,1 13 AXWB,1 32 AWw,1 11 ABb,1 21 AWw,1 21 ABb,1 31 AWw,1 41 2 0 0 3 2 1 5 w w b w 43 Marginal costs 1 0 0 0 1 2 2 1 1 1 2 1 3
  • 44. Local Search 44 1 0 0 1
  • 45. A simple large neighborhood search • Generate a random solu@on • Repeat – Select an employee and remove its schedule – Compute the over-­‐costs and under-­‐costs for every ac@vity – Find the best replacing solu@on by: • Solving shortest path in the automaton layered graph (DAG) • Finding the lightest tree in an AND/OR Graph – Insert the new schedule in the solu@on • Un@l a local minimum is reached • Restart 45
  • 46. Experimental Results 1 ac@vity, compared with MIP 46
  • 47. Experimental Results 1 to 10 ac@vi@es 47 Ind runs Ind runs 1 min runs 1 min runs Times in milliseconds to construct one shiI
  • 48. 48 ! Dynamic Programming 2 Column Genera@on • Demassey, S., Pesant, G., Rousseau, L. M. (2006). A cost-regular based hybrid column generation approach. Constraints, 11(4), 315-333. ! • Côté, M. C., Gendron, B., Rousseau, L. M. (2013). Grammar-based column generation for personalized multi-activity shift scheduling. INFORMS Journal on Computing, 25(3), 461-474.
  • 49. Column Genera@on Framework 49 Select among a subset of possible shiIs, those that together fit best the demand (using a LP set covering formula@on) Find the shiIs that we haven’t seen that would improve the current solute and so on… NEW SHIFTS DUAL VALUES How ?
  • 50. Grammar-­‐based Column Genera@on Set covering model: Restricted master problem: Set of periods in the planning horizon Set of ac@vi@es Set of employees Set of allowed shiIs for employee e Set of allowed shiIs for employee e at column genera@on itera@on k Integrality constraints relaxed 50 dual values
  • 51. 12 AWWW,1 12 AWWW,1 31 AWw,1 31 Ow 1 0 1 1 1 1 0 1 Grammar-­‐based Column Genera@on approach: Solving the subproblem OS 14 OX 13 OX OW 12 12 OW 32 11 OB 21 OW OW 21 OB 31 OW 31 OW 41 Ow 21 Ow 11 Ob 21 Ob 31 Ow 41 ASXW,1 14 ASXW,2 14 AXWB,1 13 AXWB,1 32 AWw,1 11 ABb,1 21 AWw,1 21 ABb,1 31 AWw,1 41 2 0 3 0 2 1 51 dual values
  • 52. Computa@onal Results Tableau 6.2 Comparison with Demassey et al. (2006) approach Comparison with existing IP formulations based on formal languages. Implicit Root Node Branch and Price Grammar MIP 2+ activities Table 5: Multi-activity problems with the Implicit Grammar model NbA Time(s) NbIts NbCols NbS(0.01%) Time(s) NbS(1%) Grammar-based CG NbAct NbShif ts |C| |V | Time(s) Nopt(10) 2 13404928 18068 69893 409.07 10 3 67752783 19945 73152 205.38 9 4 214010944 21822 76417 300.47 10 5 522350575 23699 79688 146.16 10 6 1082991744 25576 82961 213.79 10 7 2006203423 27453 86246 230.88 10 8 3422303488 29330 89492 257.06 10 9 5481658719 31207 92731 289.08 10 10 8354684800 33084 96026 516.74 10 1 0.1 10 257 5 62 10 2 0.2 16 601 6 100 9 3 0.6 20 975 6 2074 8 4 1.1 25 1321 State-­‐5 of-­‐2096 the-­‐art 9 5 3.0 46 2321 for 0 personalized 2h 10 6 4.0 47 2457 9 915 10 7 6.6 47 3117 5 employees 2426 9 8 8.3 62 3459 7 2163 10 9 9.6 62 3626 5 1886 7 10 9.9 43 3405 6 3754 8 Demassey et al. (2006) CG 1 0.4 19 889 8 144 2 3.7 48 2340 8 394 3 2.0 52 2550 4 1592 4 12.5 103 5063 0 2h 5 6.2 86 4288 0 2h 6 13.8 130 6493 0 2h 7 18.4 137 6839 0 2h 8 25.4 155 7736 0 2h 9 25.9 155 7741 0 2h 10 42.0 179 8974 0 2h State-­‐of-­‐the-­‐art for Iden:cal Employess 52 Regular-based CG approach, the multi-activity problems can easily be handled with a few more productions than in the one-activity case, and results show that they can rapidly be solved on almost available instances. Note Used that the week growth form in the number of constraints and variables increasing the number of work of activities branching is much slower than the increase in the number feasible shifts.
  • 53. ! Retail Scheduling for Profit… when the objec@ve is non linear • Chapados, N., Joliveau, M., L’Ecuyer, P., Rousseau, L. M. Retail Store Scheduling for Profit. European Journal of Operations Research, Forthcoming.
  • 54. Mo@va@on • How useful are salespersons in retail… 54
  • 55. Fundamental Accoun@ng Equa@on Profit Sales x Margin Salaries Goal: maximize this
  • 56. Sales Decomposi@on per Period Sales Traffic Conversion Rate Average Basket Nb of shoppers entering the store Fraction of shoppers that become buyers Amount bought, knowing that something was bought
  • 57. Salary Decomposi@on Salary Hours Worked Hourly Wage Commission
  • 58. A Constraint Programming model • Given the sets :of @me periods T, of employee E and ac@vi@es A • inputs – Rn t the revenues generated if n people are working at @me t. – Ct a the payroll cost of an employee working at @me t • variables – xt e ∈ A specifies the ac@vity performed by employee e at @me t. – yt a ∈ {1..|E|} specifies the number of employees performing a at @me t Tue Mon Sun 09:00 09:30 10:00 10:30 11:00 11:30 12:00 12:30 13:00 13:30 14:00 14:30 15:00 15:30 16:00 16:30 17:00 17:30 18:00 18:30 19:00 19:30 20:00 20:30 Fig. 2. Average revenue increase by day-of-week and time-of-day across all stores covered case study. e( max Ca ya t t s.t. Regular(, xX tT Rty w t X aA all tT)) ⇤e ⇥ E GCC(x(all eE) t , A, y(all aA) t ) ⇤t ⇥ T ya t ⇥ {0, . . . , |E|} ⇤a ⇥ A, t ⇥ T xet ⇥ A ⇤e ⇥ E, t ⇥ T The model is based on two sets of variables: xet specifies the activity (among
  • 59. MIP model • Given the sets :of @me periods T, of employee E and ac@vi@es A • inputs – Rn t the revenues generated if n people are working at @me t – Ct a the payroll cost of an employee working at @me t • variables – xa et ∈ {0,1} 1 if ac@vity a is performed by employee e at @me t. – ya kt ∈ {0,1} 1 if exactly k employees are performing a at @me t
  • 60. Scheduling over a day Table 7: Estimated relative profit increase p and relative gap to the best upper bound, for the solutions obtained by solving the proposed CP model after 30 seconds and the MIP and CP models after 300 seconds of CPU time. 60 CP after 30 sec. CP and MIP after 300 sec. Instances description p (%) (%) p (%) (%) Store #Days #Periods #Empl. CP CP MIP CP MIP CP 1 408 33.8 6 3.4 0.3 3.5 3.5 0.2 0.2 2 326 32.4 5 2.8 0.2 2.6 2.6 0.1 0.1 3 372 40.6 5 2.6 0.2 2.6 2.6 0.1 0.1 4 377 36.7 5 2.9 0.2 3.0 3.0 0.1 0.1 5 309 40.4 5 2.6 0.2 2.7 2.7 0.1 0.1 6 204 32.0 6 4.0 0.2 3.4 4.2 0.8 0.0 7 399 37.5 5 2.7 0.2 2.8 2.8 0.1 0.1 8 384 41.7 6 3.0 0.3 2.0 3.2 1.4 0.2 9 241 33.0 5 2.9 0.2 3.0 3.1 0.1 0.0 10 401 33.4 4 1.3 0.0 1.3 1.3 0.0 0.0 11 369 42.0 5 2.1 0.2 2.2 2.2 0.2 0.2 12 381 40.3 5 2.2 0.1 2.2 2.2 0.1 0.0 13 366 41.4 5 2.2 0.1 2.1 2.3 0.2 0.1 14 368 42.6 8 2.9 0.5 2.8 3.2 0.6 0.2 15 184 42.1 9 2.7 0.8 2.4 3.2 1.1 0.3 Average 339.3 38.0 5.6 2.7 0.2 2.6 2.8 0.3 0.1 and yw d,t ! 2 8d 2 D, t 2 Td, (51)
  • 61. Scheduling over a week 61 Table 8: Evolution of the relative gap for the solutions identified by CP when building schedules over a week with two hours of CPU time, in comparison with the best upper bound obtained after 24 hours. Instances description Relative gap bound (in %) Store #Weeks #Periods #Empl. after 30 min after 60 min after 120 min 1 37 236 6 2.2 2.0 1.6 2 23 224 5 1.9 1.7 1.5 3 21 282 5 3.8 3.6 3.4 4 34 256 5 2.5 2.3 2.1 5 17 280 5 4.4 4.0 3.6 6 15 232 6 2.8 2.5 2.4 7 38 262 5 3.1 2.7 2.5 8 38 288 6 3.4 3.3 3.1 9 14 230 5 2.0 1.8 1.6 10 36 234 4 2.0 1.9 1.7 11 22 294 5 3.4 3.3 3.2 12 23 282 5 2.9 2.7 2.6 13 22 288 5 3.0 2.8 2.7 14 18 296 8 1.9 1.7 1.7 15 12 292 9 8.3 7.2 6.9 Average 24.7 265.1 5.6 3.2 2.9 2.7 generate less profit than the solutions of the full MIP while using the same amount of CPU time to construct feasible schedules, we always used the full MIP (no PLA) in this section. For many instances, the MIP failed to return a feasible solution after 30 seconds; for this reason we do not report the MIP results for 30 seconds. The solutions returned
  • 62. ! An Applica@on to Hydro-­‐Québec Call-­‐Center Scheduling 62 • Pelleau M, Rousseau L-M, L’Écuyer P, Zegal W, Delorme L. (2014), Scheduling of Agents from Forecasted Future Call Arrivals at Hydro-Québec’s Call Centers, In Principles and Practice of Constraint Programming. Springer Berlin Heidelberg. I HOPE YOU HAVE SEEN IT ON TUESDAY !
  • 63. Experimental Results 63 Results tool Objective Value with HQ’s tool b. Phone First eDrseitloérdmeeMontréSaclh2e. dPuolilnytgecohf nAigqeunetsMontréal3. Institut deMraeych7e, r2c0h1e4d’Hyd1ro5-/Q1u7ébec) 10 % 20 % 30 % Improvement in agent staffing levels met