64
One Problem, Two Structures, Six Solvers, and Ten Years of Personnel Scheduling 1 LouisMar@n Rousseau CIRRELT École Polytechnique de Montréal

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

Embed Size (px)

DESCRIPTION

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

Citation preview

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

One  Problem,  Two  Structures,  Six  Solvers,  and  Ten  Years  of  Personnel  Scheduling  

1

!

Louis-­‐Mar@n  Rousseau  CIRRELT  -­‐  École  Polytechnique  de  Montréal  !

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

ShiI  Scheduling:  Once  upon  a  @me...• It  all  started  in  1950’s...  

2

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

Personnel  scheduling:  nowadays  

3

Clopening happens when one works

both a closing and the following opening shift

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

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

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

!

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.

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

• Ac@vi@es  (what  employees  can  do)  • Time  Periods  (15  minutes)  • ShiIs  

• Star@ng  period  • End  period  • Work  segments  • Rest  segments  !

• Assign  shiIs  to  employees  that  meet  – work  regula@ons  – their  exper@se  – their  availabili@es  !

• Op@mize  – Labor  costs  – divergence  from  desired  number  of  employees

Problem  descrip@on

Work activities:

Shift 1:

Shift 2:

Rest activities:

6

0

1

3

4

5

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19

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

A  typical  example1. 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

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

!

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).

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

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

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

Building  the  correct  DFA  (or  NFA)

Sequence  regula@ons Sequence  length

Λ

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

Filtering  Regular  in  CP

11

1

b

b

c

ao

63b o

b

74c o

c

c

52a o

a

o

o

oa

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 x51

2

3

4

5

6

7

N1 N2 N3 N4 N5 N6

x1 x2 x3 x4 x5

N1 N2 N3 N4 N5 N6

2

3

4

5

6

7

11

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

2

3

4

5

6

7

11

2

3

4

5

1

2

3

4

5

6

7

1

2

3

4

5

6

7 7

6

7

1

2

3

4

5

6

7

1

2

3

4

5

6

N4 N5 N63

x1 x2 x3 x4 x5

N1 N2 N

A simple automaton for rostering

1

b

b

c

ao

63b o

b

74c o

c

c

52a o

a

o

o

oa

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 x51

2

3

4

5

6

7

N1 N2 N3 N4 N5 N6

x1 x2 x3 x4 x5

N1 N2 N3 N4 N5 N6

2

3

4

5

6

7

11

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

2

3

4

5

6

7

11

2

3

4

5

1

2

3

4

5

6

7

1

2

3

4

5

6

7 7

6

7

1

2

3

4

5

6

7

1

2

3

4

5

6

N4 N5 N63

x1 x2 x3 x4 x5

N1 N2 N

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

ao

63b o

b

74c o

c

c

52a o

a

o

o

oa

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 x51

2

3

4

5

6

7

N1 N2 N3 N4 N5 N6

x1 x2 x3 x4 x5

N1 N2 N3 N4 N5 N6

2

3

4

5

6

7

11

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

2

3

4

5

6

7

11

2

3

4

5

1

2

3

4

5

6

7

1

2

3

4

5

6

7 7

6

7

1

2

3

4

5

6

7

1

2

3

4

5

6

N4 N5 N63

x1 x2 x3 x4 x5

N1 N2 N

Forward pass Backward Pass

filtered domains!X1 ∈ {a,b,c,o}!X2 ∈ {o}!X3 ∈ {a,c,o}!X4 ∈ {a,o}!X5 ∈ {a}

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

Decomposing  the  Regular  Constraint• It  is  not  mandatory  to  introduce  a  new  propagator,  we  can  simply  introduce  new  variables

12

1

b

b

c

ao

63b o

b

74c o

c

c

52a o

a

o

o

oa

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 x51

2

3

4

5

6

7

N1 N2 N3 N4 N5 N6

x1 x2 x3 x4 x5

N1 N2 N3 N4 N5 N6

2

3

4

5

6

7

11

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

2

3

4

5

6

7

11

2

3

4

5

1

2

3

4

5

6

7

1

2

3

4

5

6

7 7

6

7

1

2

3

4

5

6

7

1

2

3

4

5

6

N4 N5 N63

x1 x2 x3 x4 x5

N1 N2 N

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 >

TableConstraint(Si, Xi, Si+1, Π), i : 1..5

Domain consistency of the table constraint will filter S such that!S1 ∈ {1}!S2 ∈ {1,2,3,4}!S3 ∈ {1,5,6,7}!S4 ∈ {1,2,4,5,7}!S5 ∈ {1,2,5,7}!S6 ∈ {2}

1

b

b

c

ao

63b o

b

74c o

c

c

52a o

a

o

o

oa

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 x51

2

3

4

5

6

7

N1 N2 N3 N4 N5 N6

x1 x2 x3 x4 x5

N1 N2 N3 N4 N5 N6

2

3

4

5

6

7

11

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

2

3

4

5

6

7

11

2

3

4

5

1

2

3

4

5

6

7

1

2

3

4

5

6

7 7

6

7

1

2

3

4

5

6

7

1

2

3

4

5

6

N4 N5 N63

x1 x2 x3 x4 x5

N1 N2 N

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

On  our  example1. 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

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

A  Regular  language  for  our  example

Replacing  sequencing  rules  (4  to  8)

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

• 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

The  Grammar  Global  Constraint

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

CYK  Algorithm

S � AB

A � AA

B � BB

A � a

B � b

S

a b a b a b

S B A SA

B

B

A A AB B B

16

A

FILTERING

dom(Xi)

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

The  Grammar  Graph

S

����

� �

BAA

A B

bbaa

B

17

• 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

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

• We  can  enrich  the  grammar  descrip@on  to  include  in  the  descrip@on  of  a  produc@on  • Valid  set  of  periods  (P)  • Valid  interval  for  the  span  of  sub  sequence  (S)  • Cost  of  choosing  a  produc@on    

!

!

!

• These  can  be  easily  incorporated  in  the  CYK  algorithm.  • Here  is  the  enriched  grammar  that  captures  all  the  rules  (1..8)

Modeling  SSP  with  a  Grammar  Constraint

18

14 C.-G. QUIMPER AND L.-M. ROUSSEAU

6. Experimental Results

6.1. Problem Description

We consider the following shift scheduling problem with n employees and m activities

over a period of time discretized into T = 96 time slots of 15 minutes each. During eachtime slot, an employee can either rest, be on a break, lunch, or work on a given activity.

The schedule of an employee must respect the following rules.

1. A break has a duration of 15 minutes.

2. A lunch has a duration of 1 hour.

3. A part-time employee can take one break during his shift.

4. A full-time employee is entitled to one break, one lunch, and another break in this

order.

5. When an employee starts working on an activity, he works for at least one hour on the

same activity.

6. Lunches and breaks are scheduled between two periods of work.

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⟩WF → PLP S → RP[13,24]R | RF[30,38]RL → ⟨lunch⟩ ⟨lunch⟩ ⟨lunch⟩ ⟨lunch⟩

12 C.-G. QUIMPER AND L.-M. ROUSSEAU

for every leaf nodeN(A, i, 1) do1

weight(N(A, i, 1)) ← min{cost(S[i] \ {sr[i]} ∪ {a}, i) | A → a ∈ G}33

for every inner node N(A, i, j) in post-order do4

weight(N(A, i, j)) ← min{weight(N(B, x, y)) + weight(N(C, w, z)) |66

⟨N(B, x, y), N(C, w, z)⟩ ∈7

Children(N(A, i, j))}8

return weight(N(S, 1, T ))9

Algorithm 2: Compute the cost of the best schedule obtained by replacing sr ∈ S by

another sequence.

The local search repeatedly chooses a sequence sr from S and replaces it by the sequenceN that minimizes the cost of the overall schedule. This process continues until it reaches

a local minimum. Notice that the grammar graph only needs to be constructed once. Only

the weights need to be recomputed at each iteration.

4.2. Enhancing Context-Free Languages

Following [29], one can enrich a context-free language by imposing some conditions on

the applicability of a productionA → BC. For instance, one can restrict A to represent a

sequence of a specific length. The non-terminals B and C might also have to meet some

requirements about the length of the sequences they represent. Similarly, a production can

be restrained to be effective only at particular times of the day. We denote a constrained

literal A with APS where P ⊆ N is the set of positions where A can occur in the sequence

and S ⊆ N is the set of valid spans for the subsequence A. If the symbol S or P are

omitted, we assume that the set of valid positions and valid spans is N. A weight w can

also be associated with a production. Each time a production is used in the schedule of

an employee, the weight of the production is added to the weight of the parsing tree. We

indicate the weight w of a production on the arrow as follows: Aw→ BC. One can omit to

mention the weight whenever it is null.

For instance, the production A[2,4]8.9→ BC{2,5,7}

[1,3] can be applied only if the sequence

obtained has a length between 2 and 4 characters, the span of the literalC is between 1 and

3, and the subsequence C appears at positions 2, 5, or 7. The weight associated with this

production is 8.9 and the literal B is unconstrained.

These new restrictions on the productions are useful to model situations where a worker

must work a certain amount of time before changing activities or can have a lunch break

only at lunch time. Weights on production can be used to encode preferences or to model

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. On

line 16 in Algorithm 1, when processing the production APa

Sa

w→ BPb

SbCPc

Sc, we add the

extra-conditions that i ∈ Pa, i ∈ Pb, and i + k ∈ Pc as well as j ∈ Sa, k ∈ Sb, and

j − k ∈ Sc.

12 C.-G. QUIMPER AND L.-M. ROUSSEAU

for every leaf nodeN(A, i, 1) do1

weight(N(A, i, 1)) ← min{cost(S[i] \ {sr[i]} ∪ {a}, i) | A → a ∈ G}33

for every inner node N(A, i, j) in post-order do4

weight(N(A, i, j)) ← min{weight(N(B, x, y)) + weight(N(C, w, z)) |66

⟨N(B, x, y), N(C, w, z)⟩ ∈7

Children(N(A, i, j))}8

return weight(N(S, 1, T ))9

Algorithm 2: Compute the cost of the best schedule obtained by replacing sr ∈ S by

another sequence.

The local search repeatedly chooses a sequence sr from S and replaces it by the sequenceN that minimizes the cost of the overall schedule. This process continues until it reaches

a local minimum. Notice that the grammar graph only needs to be constructed once. Only

the weights need to be recomputed at each iteration.

4.2. Enhancing Context-Free Languages

Following [29], one can enrich a context-free language by imposing some conditions on

the applicability of a productionA → BC. For instance, one can restrict A to represent a

sequence of a specific length. The non-terminals B and C might also have to meet some

requirements about the length of the sequences they represent. Similarly, a production can

be restrained to be effective only at particular times of the day. We denote a constrained

literal A with APS where P ⊆ N is the set of positions where A can occur in the sequence

and S ⊆ N is the set of valid spans for the subsequence A. If the symbol S or P are

omitted, we assume that the set of valid positions and valid spans is N. A weight w can

also be associated with a production. Each time a production is used in the schedule of

an employee, the weight of the production is added to the weight of the parsing tree. We

indicate the weight w of a production on the arrow as follows: Aw→ BC. One can omit to

mention the weight whenever it is null.

For instance, the production A[2,4]8.9→ BC{2,5,7}

[1,3] can be applied only if the sequence

obtained has a length between 2 and 4 characters, the span of the literalC is between 1 and

3, and the subsequence C appears at positions 2, 5, or 7. The weight associated with this

production is 8.9 and the literal B is unconstrained.

These new restrictions on the productions are useful to model situations where a worker

must work a certain amount of time before changing activities or can have a lunch break

only at lunch time. Weights on production can be used to encode preferences or to model

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. On

line 16 in Algorithm 1, when processing the production APa

Sa

w→ BPb

SbCPc

Sc, we add the

extra-conditions that i ∈ Pa, i ∈ Pb, and i + k ∈ Pc as well as j ∈ Sa, k ∈ Sb, and

j − k ∈ Sc.

24, 40]12, 23]

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

• 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.

Filtering  the  Grammar  Constraint

19

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

SAT  vs  CP,  Monoli@c  vs  Decomposi@ons

20

|A| # m GAC SAT SAT Mono Decompsol time bt opt sol time bt opt sol bt sol bt

1 2 4 26.0 2666 507215p

26.0 1998 443546p26.75 28072 26.25 625683

1 3 6 37.25 1128199 36.75 1953562 37.0 34788 37.0 47715771 4 6 38.0 256 84999

p38.0 287 91151

p- 15539 38.0 56488

1 5 5 24.0 153 67376p

24.0 60 40008p

24.0 40163 24.0 79144131 6 6 33.0 98 48638

p33.0 70 40361

p- 11537 33.0 33405

1 7 8 49.5 236066 49.5 682715 49.0 27635 49.0 26637211 8 3 20.5 80 36348

p20.5 44 25502

p21.0 24343 20.5 635589

1 10 9 54.0 202699 54.25 507749 - 9365 - 5194462 1 5 25.0 453 146234 25.0 301 103918

p25.0 1180 25.0 3828461

2 2 10 58.75 313644 59.0 151076 58.0 14887 58.0 21166022 3 6 38.25 236850 38.25 214203 41.0 1419 41.0 2142012 4 11 71.25 230777 69.75 239519 - 9983 - 7749422 5 4 23.75 2945 644496

p23.75 1876 522780

p26.5 25573 26.25 117105

2 6 5 26.75 4831 777572p27.25 2162816 26.75 10681 26.75 1054531

2 8 5 31.5 244837 31.75 391858 32.0 218 31.5 37718312 9 3 19.0 2283 701474

p19.0 1227 481395

p19.25 20473 19.0 45516

2 10 8 55.0 372870 55.0 333520 - 9968 - 909857Table 1. Benchmark problems solved by MiniSat+. GAC SAT: results from MiniSat+ with allCNF clauses; SAT: results from MiniSat+ with all CNF clauses but clause (4); Mono: resultsfrom a CP solver using the monolithic propagator; Decomp: results from a CP solver using thedecomposition; |A|: number of activities; #: problem number; m: number of employees; sol:number of worked hours (boldfonted if best solution found amongst the different methods); time(s): CPU time in seconds. Times are omitted when the search is suspended by a lack of memory;bt: number of backtracks (boldfonted if least backtracks amongst methods that prove optimality);opt: solution was proved optimal. ILog solver did not prove any problems optimal within onehour of computation.

Even though Algorithm 1 can produce a graph with up to O(n3|G|) nodes, wenoticed that in practice many nodes are never created. The size of the resulting DAGis much smaller in practice than the theoretical bound of O(n3|G|). For instance, thegrammar G for problems with one activity can be written in Chomsky normal form in15 productions. The upper bound on the number of and-nodes in the DAG is 15 963

2 =6635520 nodes whilst there were 71796 nodes on average with these instances.

We also tried modelled the schedule of an employee using an automaton. Due tothe constraints on the number of hours a full-time and a part-time employee must work,many states in the automaton needed to be duplicated resulting in an automaton withseveral thousands of states. Moreover, patterns such as those produced by the non-terminals P andW cannot be reused in an automaton without further duplicating states.The DAG based on the regular language ended up much larger than the one producedby the context-free grammar.

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

Using  Lazy-­‐Clause  Genera@on

21

• ShiI  constraints  are  described  with  a  context-­‐free  grammar,  which  is  then  converted  into  an  MDD.  

• Coverage  constraints  are  implemented  with  a  BDD  decomposi@on.  • Solved  with  LCG  with  explana@ons  over  MDD  with  costs

21

Experimental Results - Shift Scheduling

Table : Comparison of different methods on shift scheduling problems.

Inst. dec

mdd

mdd ev-mdd ev-mdd

I

time fails time fails time fails time fails1,2,4 14.51 39700 3.49 21888 0.20 607 0.17 6351,3,6 11.25 40675 19.00 76348 0.87 4045 0.91 41561,4,6 2.62 7582 0.69 3518 0.11 350 0.27 10771,5,5 0.41 1585 0.52 3955 0.07 239 0.06 2381,6,6 0.40 1412 0.21 1161 0.08 249 0.11 4131,7,8 4.03 13149 2.43 12046 0.73 3838 0.83 42791,8,3 0.85 5002 0.39 3606 0.06 219 0.07 2621,10,9 17.55 44222 19.77 68688 1.23 5046 1.31 74192,1,5 0.14 691 0.24 1490 0.02 78 0.01 452,2,10 — — 131.29 286747 43.62 99583 49.05 1009582,3,6 188.77 187760 144.99 289568 2.39 6443 5.94 136952,4,11 — — 391.59 918438 42.38 111567 92.89 2205682,5,4 25.85 59635 12.18 50340 0.65 1545 0.48 15412,6,5 83.78 104911 30.27 80046 6.18 12100 7.63 160742,8,5 90.28 153331 34.69 110917 4.99 15507 10.02 265652,9,3 6.10 20472 9.17 42105 0.86 1898 0.47 15932,10,8 349.88 303227 95.61 168720 8.85 26331 17.22 37356Total — — 896.53 2139581 113.29 289645 187.44 436874Mean — — 52.74 125857.71 6.66 17037.94 11.03 25698.47Geom. — — 7.92 31465.82 0.86 2667.65 1.03 3428.35

Results for COST-MDD decomposition are omitted; they were awful.Peter J. Stuckey EV-MDDs September 25, 2013 38 / 41

State-­‐of-­‐the-­‐art  

for  1-­‐2  ac:vi:es

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

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.

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

Compact  assignment  formula@on

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

A  Regular  language  for  our  example

Replacing  sequencing  rules  (4  to  8)

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

Deriving  a  network  flow  problem  

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

Building  a  network  flow  problem

Network  flow  formula@on

Linking  constraints

Derived  automa:cally    from  the  automaton

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

• The  model  should  find  a  tree  in  the  Γ  graph  • The  lineariza@on  of  the  CFG  constraint  is  simply:

Linearizing  a  context-­‐free  grammar

27

v�c(u)

av =�

v�p(u)

av ⇤u ⇥ Nor

v�c(R)

av = 1

av � 0, ⇤v ⇥ Nand

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

REGULAR

Results  on  our  examples

28

Table 1: Results for the classical MIP model

LP MIPId LP Value LP Time |C| |V | MIP Value MIP Time

1 138,8952 36,53 29871 4040 172,6670 2142,172 162,9396 104,73 56743 5104 > >3 168,8223 89,06 56743 5104 > >4 131,6560 32,95 45983 4704 152,2240 3610,005 143,7443 63,61 40447 4360 171,9930 3610,016 129,0947 36,65 40447 4360 137,5180 3616,577 148,4681 38,26 45887 4608 > >8 147,2002 90,49 56743 5104 > >9 142,4836 27,15 36175 4156 182,5370 3607,7610 145,9563 36,89 45983 4704 149,1810 3611,72

Table 2: Results for the MIP regular model

LP MIPId LP Value LP Time |C| |V | MIP Value MIP Time

1 138,8952 15,95 1491 1856 172,6670 1,032 162,9396 13,32 2719 3976 164,1370 40,093 168,8223 15,70 2719 3976 169,0120 64,644 131,6560 19,15 2183 3144 133,3830 46,395 144,4182 30,81 1915 2728 145,4640 14,036 133,0766 12,34 1915 2728 135,2180 3,287 149,2739 26,55 2183 3144 150,6810 5,998 147,2002 12,81 2719 3976 148,0470 131,779 142,4836 11,84 1759 2416 182,5370 16,1410 146,2410 23,66 2183 3144 147,5030 20,22

22

ASSIGNMENT

Table 3: Results for the partial MIP grammar model

LP MIPId LP Value LP Time |C| |V | MIP Value MIP Time

1 138,8952 34,63 1683 2060 172,6665 1,162 162,9396 31,67 3040 4285 163,9210 66,263 168,8223 41,62 3040 4285 170,5663 46,744 131,6560 42,89 2459 3408 133,1414 98,005 144,4182 52,52 2143 2956 145,2850 21,836 133,0766 57,56 2143 2956 135,1286 1,567 149,2739 44,03 2456 3405 150,7675 53,828 147,2002 47,63 3040 4285 148,0467 263,439 142,4836 27,46 1957 2614 182,4833 12,9110 146,2410 37,19 2458 3408 147,6853 19,28

Table 4: Results for the complete MIP grammar model

LP MIPId LP Value LP Time |C| |V | MIP Value MIP Time

1 > 3612,35 2727 6356 172,6665 7,422 > 3610,68 35419 190480 > >3 > 3615,64 35419 190480 > >4 > 3614,92 19163 84672 133,0630 1850,385 > 3609,11 10387 41464 145,8830 322,576 > 3618,18 10387 41464 134,8178 130,217 > 3618,83 19163 84672 151,2082 1662,758 > 3611,39 35419 190480 > >9 > 3614,71 5503 21580 182,5370 1015,1010 > 3610,10 19163 84672 147,0870 1313,28

23

GRAMMAR

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

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

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

v�c(u)

av =�

v�p(u)

av ⇤u ⇥ Nor

v�c(R)

av = 1

av � 0, ⇤v ⇥ Nand

Implicit  Grammar  in  MIP• Every  node  in  the  three  now  generates  general  integers:  

– av  =  number  of  @me  node  and  is  selected  by  an  employee  

– NS  =  total  number  of  employees  needed

Ns

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.!•

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

• 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  problem  solved  to  op:mality  in  less  than  10  minutes

Results  on  the  full  mul@-­‐ac@vity  problem

31

Cote, Gendron, and Rousseau: Grammar-Based Integer Programing Models for Multi-Activity Shift Scheduling

Article submitted to Management Science; manuscript no. MS-0001-1922.65 23

Table 4 Multi-activity problems with the Implicit Grammar model

NbAct NbShifts |C| |V | Time Nopt(10)

2 13404928 70143 18202 423,90 93 67752783 73529 20144 337,14 94 214010944 76915 22092 212,07 95 522350575 80301 24046 182,02 106 1082991744 83687 26002 179,51 107 2006203423 87073 27970 317,31 108 3422303488 90459 29899 274,66 109 5481658719 93845 31821 296,37 1010 8354684800 97231 33799 518,02 10

tion approach for these problems. Their method does not succeed in finding optimal solution for

the single-activity and multi-activity problems. As for our modeling approach, the multi-activity

problems can easily be handled by adding a small group of productions to the one-activity problem

grammar and results show that they can rapidly be solved on almost all the problems available.

Note that the growth of constraints and variables when augmenting the number of work-activities

is much slower than the increase in the number of allowed shifts.

6. Conclusions

In this paper, we present an IP model for optimal shift scheduling problems that di�ers from

the other models in the literature. Our modeling approach uses context-free grammars to model

problem restrictions in the generation of shifts and converts it into an IP model. This model succeed

in finding the optimal explicit solution and leads to the same integrality gap as Dantzig (1954) set

covering model and other well-known models in the literature for the same problem (see Bechtolds

and Jacobs (1990), Aykin (1996) and Rekik et al. (2004)).

The experimentations show that solving times for our model is comparable with solving times

for Aykin (1996) model on classical shift scheduling problems. Moreover, we tested our model in

comparison with an extension of Aykin (1996) suggested by Rekik et al. (2004) on a problem

allowing a large set of shifts. We also show that our model can be solved to optimality e⇥ciently

on the latter problem when up to ten work-activities have labor requirements. To our knowledge,

no implicit model in the literature can solve the multi-activity problems that e⇥ciently.

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

!

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.

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

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

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

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

cons

trai

nt o

rbits

take averages!within orbits

Y 31 =

X

i:1..3

Xi

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

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

b b b

a

a a a

a a

regular/grammar constraint only

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

An  Hybrid  MIP/CP  approach

36

MIP solver on the shrunken model

Hybrid MIP/CP decomposition

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

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

A  Mutliphase  Hybrid  MIP/CP  Approach

37

Multi-phase approach1.

solve aggregated modeland 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

LNS  +  Grammar  DP

Implicit  Grammar  MIP  formula@on

Integrated  CP/MIP  Branch  and  Bound

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

Experimental  Results

38

0

2

4

6

8

10

1 2 3 4 5 6 7 8 9 10

# solved

cpx-reg hybrid grammar

average time

1

10

100

1000

10000

1 2 3 4 5 6 7 8 9 10

cpx-reg hybrid grammar

gap

0.1%

1.0%

10.0%

100.0%

1 2 3 4 5 6 7 8 9 10

cpx-reg hybrid

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

!

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.

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

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

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

Local  Search

41

1

0

1

0

0

1

1

0

Marginal costs

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

Best  replacement  shiI  using  Regular

42

Schedule  regula@ons Schedule  length

1

0

1

1

0 1

1

1

Marginal costs

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

Best  replacement  shiI  using  Grammar

OS14

OX13

OW12OX

12 OW32

OW11 OB

21 OW21 OB

31 OW31 OW

41

Ow11 Ob

21 Ow21 Ob

31 Ow31 Ow

41

AS�XW,114 AS�XW,2

14

AX�WB,113

AX�WB,112 AW�WW,1

12 AW�WW,132

AW�w,111 AB�b,1

21 AW�w,121 AB�b,1

31 AW�w,131 AW�w,1

41

�2

0

0 �3 �20 �1

�2 0 �3 0 �2 �1

�2 0 �3 �2 �1

�2 �5 �3

�5 �3�2

�5

�5

�6

�6

�5

w w wb

43

Marginal costs

1 10 01

1 1 1

1

00

0

1

1 1011

2

2

1

1

1

1

2

1

1

3

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

Local  Search

44

1

0

0 1

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

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

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

Experimental  Results  1  ac@vity,  compared  with  MIP

46

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

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

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

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.

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

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 ?

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

Grammar-­‐based  Column  Genera@on

Set  covering  model:

Restricted  master  problem:

Set  of  ac@vi@es

Set  of  periods  in  the  planning  horizon

Set  of  allowed  shiIs  for  employee  e

Set  of  employees

Set  of    allowed  shiIs  for  employee  e  at  column  genera@on  itera@on  k

Integrality  constraints  relaxed50

dual  values

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

1

0

1

1

0 1

1

1

Grammar-­‐based  Column  Genera@on  approach: Solving  the  subproblem

OS14

OX13

OW12OX

12 OW32

OW11 OB

21 OW21 OB

31 OW31 OW

41

Ow11 Ob

21 Ow21 Ob

31 Ow31 Ow

41

AS�XW,114 AS�XW,2

14

AX�WB,113

AX�WB,112 AW�WW,1

12 AW�WW,132

AW�w,111 AB�b,1

21 AW�w,121 AB�b,1

31 AW�w,131 AW�w,1

41

�2 0 �3 �1�20

51

dual  values

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

116

Tableau 6.2 Comparison with Demassey et al. (2006) approach

Root Node Branch and Price

NbA Time(s) NbIts NbCols NbS(0.01%) Time(s) NbS(1%)

Grammar-based CG

1 0.1 10 257 5 62 102 0.2 16 601 6 100 93 0.6 20 975 6 2074 84 1.1 25 1321 5 2096 95 3.0 46 2321 0 > 2h 106 4.0 47 2457 9 915 107 6.6 47 3117 5 2426 98 8.3 62 3459 7 2163 109 9.6 62 3626 5 1886 710 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 �

Computa@onal  Results

52

Regular-based CG

Table 5: Multi-activity problems with the Implicit Grammar model

NbAct NbShifts |C| |V | Time(s) Nopt(10)

2 13404928 18068 69893 409.07 103 67752783 19945 73152 205.38 94 214010944 21822 76417 300.47 105 522350575 23699 79688 146.16 106 1082991744 25576 82961 213.79 107 2006203423 27453 86246 230.88 108 3422303488 29330 89492 257.06 109 5481658719 31207 92731 289.08 1010 8354684800 33084 96026 516.74 10

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 all

available instances. Note that the growth in the number of constraints and variables when

increasing the number of work activities is much slower than the increase in the number of

feasible shifts.

Comparison with existing IP formulations based on formal languages. Table 6

presents the times reported by Cote et al. (2009) to solve the one and two work-activities

instances with two employee-based explicit formulations, the IP Regular model, based on a

finite automaton, and the IP Grammar model, based on a context-free grammar. In both

cases, 0-1 assignment variables for each employee are used, instead of the general integer

variables used in model Q. These experiments were run on a 2.4 GHz Dual AMD Opteron

Processor 250 with 3 GB of RAM, using the MIP solver CPLEX 10.0 and a time limit of

3600 seconds. In this experiment, we also used CPLEX 10.0 to solve our implicit

grammar models to make a more fair comparison. The table reports the time in

seconds to obtain an integer solution with a relative IP gap smaller or equal than 1%. The

symbol “>” represents an instance for which that gap could not be reached within the time

limit. The Implicit Grammar column shows the time needed by the implicit grammar

model to reach the 1% relative IP gap limit.

Table 6 illustrates that the two employee-based explicit formulations su⌃er from scal-

23

Implicit Grammar MIP 2+ activities

State-­‐of-­‐the-­‐art  for  Iden:cal  Employess

State-­‐of-­‐the-­‐art  for  personalized  

employees

Used  week  form    of  branching

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

!

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.

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

Mo@va@on• How  useful  are  salespersons  in  retail…

54

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

Fundamental  Accoun@ng  Equa@on

ProfitSales x

MarginSalaries

Goal: maximize this

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

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

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

Salary  Decomposi@on

Salary Hours  Worked

Hourly  Wage

Commission

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

• Given  the  sets  :of  @me  periods  T,  of  employee  E  and  ac@vi@es  A  • inputs    

– Rnt       the  revenues  generated  if  n  people  are  working  at  @me  t.  – Cta         the  payroll  cost  of  an  employee  working  at  @me  t  

• variables  – xte  ∈  A     specifies  the  ac@vity  performed  by  employee  e  at  @me  t.  – yta  ∈  {1..|E|}     specifies  the  number  of  employees  performing  a  at  @me  t

A  Constraint  Programming  model

Retail Store Workforce Scheduling 5Revenue Increase (%)

Sun

Mon

Tue

Wed

Thu

Fri

Sat

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

−4

−2

0

2

4

6

8

10

Fig. 2. Average revenue increase by day-of-week and time-of-day across all stores covered by thecase study.

maxX

t�T

Rtywt�

X

a�A

Cat y

at (4)

s.t. Regular(�, xe(all t�T )) ⇤e ⇥ E (5)

GCC(x(all e�E)t , A, y(all a�A)

t ) ⇤t ⇥ T (6)yat ⇥ {0, . . . , |E|} ⇤a ⇥ A, t ⇥ T (7)

xet ⇥ A ⇤e ⇥ E, t ⇥ T (8)

The model is based on two sets of variables: xet specifies the activity (among those

in A) performed by employee e at time t, and yat represents the number of employeesperforming each activity a at time t. The objective function (4) maximizes the revenueforecasted at each time period given the chosen number of working employees (thoseforecasted values are stored in table R) minus the salary expenses associated to eachtype of activity (provided in table C). The values in table R are obtained from thestatistical forecasting model (cf. eq. (2)) for working employees; we can assume thatthe revenue associated with other activities is zero. Constaints (5) enforce that each em-ployee’s schedules follows a certain number of regulations, which are captured in � (asproposed in [4] and [10]), constaints (6) link the x and y variables, while constraints (7)–(8) define the domain of all variables. We plan to implement this straighforward modelin the coming weeks in order to present detailed results during the conference.

6 Conclusion

We have proposed a new methodology to forecast to expected revenue function asso-ciated to the presence of a given number of employees in a retail store. The use of aConstraint Program, as opposed to an Integer Program for instance, allows to easilyincorporate this non-linear function into a shift scheduling model. The overall approachwill thus allow to build schedules where employees are considered as a source a revenuerather than a sole expense.

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

• Given  the  sets  :of  @me  periods  T,  of  employee  E  and  ac@vi@es  A  • inputs    

– Rnt             the  revenues  generated  if  n  people  are  working  at  @me  t  – Cta             the  payroll  cost  of  an  employee  working  at  @me  t  

• variables  – xaet  ∈  {0,1}     1  if  ac@vity  a  is  performed  by  employee  e  at  @me  t.  – yakt  ∈  {0,1}       1  if  exactly  k  employees  are  performing  a  at  @me  t

MIP  model

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

Scheduling  over  a  day

60

Table 7: Estimated relative profit increase �p and relative gap � to the best upper bound, for thesolutions obtained by solving the proposed CP model after 30 seconds and the MIP and CP models after300 seconds of CPU time.

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.22 326 32.4 5 2.8 0.2 2.6 2.6 0.1 0.13 372 40.6 5 2.6 0.2 2.6 2.6 0.1 0.14 377 36.7 5 2.9 0.2 3.0 3.0 0.1 0.15 309 40.4 5 2.6 0.2 2.7 2.7 0.1 0.16 204 32.0 6 4.0 0.2 3.4 4.2 0.8 0.07 399 37.5 5 2.7 0.2 2.8 2.8 0.1 0.18 384 41.7 6 3.0 0.3 2.0 3.2 1.4 0.29 241 33.0 5 2.9 0.2 3.0 3.1 0.1 0.010 401 33.4 4 1.3 0.0 1.3 1.3 0.0 0.011 369 42.0 5 2.1 0.2 2.2 2.2 0.2 0.212 381 40.3 5 2.2 0.1 2.2 2.2 0.1 0.013 366 41.4 5 2.2 0.1 2.1 2.3 0.2 0.114 368 42.6 8 2.9 0.5 2.8 3.2 0.6 0.215 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

y

wd,t

� 2 8d 2 D, t 2 T

d

, (51)

respectively. The constraints (38) and (47) guarantee that there is at least one full-timeemployee working at any time. Constraints (39) and (48) ensure that an employee cannotwork more than five shifts (days) over a week. The days o↵ are managed di↵erently inthe MIP and CP; the MIP requires the introduction of new variables. For the MIP, con-straints (40) and (41) are added to link the new variables ve

d

and z

e to the variables se,d,tq,a,q

0 ,respectively, so the constraints (42) can guarantee that an employee has two consecutivedays o↵ during the week or one weekend day o↵. Constraints (43) and (44) must alsobe added to define the domain of variables ve

d

and z

e. For CP, only the constraints (49)must be added, as they directly ensure that an employee has two consecutive days o↵ ina week or one weekend day o↵.

5.3. Scheduling over a day

By taking the set D as a single element, the proposed models can be used to constructwork schedules over a day. In this context, the weekly regulations are ignored.

Table 7 compares the expected profit increases provided by solving our models, overthe scheduling solutions used by the retailer, over a single day. These numbers areaverages over the 5089 days of our data. The table gives two types of informations:(i) the estimated relative increase �

p

in expected profit with the schedules constructedby MIP after 300 seconds of CPU time, and by CP after 30 seconds and 300 seconds ofCPU time, compared with the schedules used by the retailer; and (ii) the relative gap� between those MIP and CP solutions and the best upper bound extracted from theMIP solution after 300 seconds. As the solutions provided by solving the MIP with PLA

30

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

Scheduling  over  a  week

61

Table 8: Evolution of the relative gap � for the solutions identified by CP when building schedules overa 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.62 23 224 5 1.9 1.7 1.53 21 282 5 3.8 3.6 3.44 34 256 5 2.5 2.3 2.15 17 280 5 4.4 4.0 3.66 15 232 6 2.8 2.5 2.47 38 262 5 3.1 2.7 2.58 38 288 6 3.4 3.3 3.19 14 230 5 2.0 1.8 1.610 36 234 4 2.0 1.9 1.711 22 294 5 3.4 3.3 3.212 23 282 5 2.9 2.7 2.613 22 288 5 3.0 2.8 2.714 18 296 8 1.9 1.7 1.715 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 ofCPU time to construct feasible schedules, we always used the full MIP (no PLA) in thissection. 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 returnedby either MIP or CP after 300 seconds are very accurate. They are nearly optimal witha respective average gap � of only 0.3% and 0.1%, and correspond to estimated profitincreases �

p

of 2.6% and 2.8%, respectively. CP seems to provide a slightly larger profitgrowth than MIP, and also provides good solutions already after 30 seconds. On the otherhand, CP does not provide an upper bound on the optimal value during the resolution.In practice, the CP approach seems to be the most e�cient method overall.

5.4. Scheduling over a week

For the scheduling problem over a week, CP was able to construct feasible weeklyschedules consistently in less than two hours of CPU time, whereas for the MIP, even thecombination with PLA with a single linear piece (MIP-PLA

1

) failed to provide feasiblesolutions for over 30% of the weeks. Table 8 shows the evolution of the gap � betweenthe solutions identified by solving the CP model after 30 minutes, 60 minutes, and 120minutes of CPU time, and the best upper bound extracted after 24 hours of CPU timewith the MIP model. Given that the weekly schedules used historically in the stores donot satisfy the new rules imposed by the retailer, we cannot make a fair comparison withour solutions. This is why we only compare with an upper bound. The quality of theschedules constructed by CP is demonstrated by the small average relative gap (less than� ⇡ 3% after 60 minutes) between the value of these solutions and the correspondingupper bounds (which are likely to be larger than the optimal values).

31

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

!

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 !

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

Experimental  Results

63

Experimental Results

Experimental Results

a. Impact Based Search

Objective Value with HQ’s tool

Obj

ectiv

eVa

lue

with

CP

b. Phone First

Objective Value with HQ’s tool

M. Pelleau, L-M. Rousseau, P. L’Ecuyer, W. (1. Université de Montréal2. Polytechnique Montréal3. Institut de recherche d’Hydro-Québec)Zegal, L. Delorme Scheduling of Agents May 7, 2014 15 / 17

10 %

20 %

30 %

Improvement in agent staffing levels met

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

QUESTIONS  ?

64