A Hybrid Constraint Programming Approach to Nurse ...pszrq/files/AI08presentation.pdf · A Hybrid...
Transcript of A Hybrid Constraint Programming Approach to Nurse ...pszrq/files/AI08presentation.pdf · A Hybrid...
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
A Hybrid Constraint ProgrammingApproach to Nurse Rostering Problem
Dr. Rong Qu, Fang He
ASAP research groupSchool of Computer Science
University of Nottingham
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Outline
1 IntroductionConstraint ProgrammingThe Nurse Rostering Problems
2 The FormulationVariablesConstraintsModels
3 The Hybrid ApproachConstruction StageImprovement Stage
4 Computational Experiment Results
5 Conclusions
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Outline
1 IntroductionConstraint ProgrammingThe Nurse Rostering Problems
2 The FormulationVariablesConstraintsModels
3 The Hybrid ApproachConstruction StageImprovement Stage
4 Computational Experiment Results
5 Conclusions
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Constraint Programming
Constraint Programming Paradigm
Emerged from a number of research areas:Artificial IntelligenceProgramming LanguageSymbolic Computing and Computing Logic
Constraint Satisfaction arose from the research in AtificialIntelligence,applied to:
Computer Graphics (Sutherland 1963, Borning 1981)Scene labelling (Waltz 1972)Combinatorial problem (Lassez, Jaffar 1987,Aggoun,Beldiceanu 1993)
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Constraint Programming
Constraint Programming Paradigm
1 Declarative description of problem withVariables which range within their domains,finite set ofvaluesConstraints over subsets of variables which restrict possiblevalue combinations,eg: x>yA solution is a value assignment which satisfies allconstraints
2 Constraint filtering/propagationfiltering: removing the value from its domain that is not inthe solution of this constraint,eg: x<y andD(x)=[10,20],D(y )=[5,15],after filtering:D(x)=[10,14],D(y )=[11,15]Constraint can propagate due to one domain reduction canlead to new domain reduction
3 Searchassign values to variablesstrategies define which variable and value will be chooseneach step triggers constraint propagation
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
The Nurse Rostering Problems
Nurse Rostering Problems (Typical)
In hospitals, nurses work in shift systemEach nurse works at most one shift per dayThe demand on each day for each shift type is varying, butknownConstraints are defined by regulations,working practiceand preferences of nursesA roster(solution): an assignment of each nurse on eachday to a shift which satisfies all constraintsIn reality,the constraints usually put into two groups: hardconstraints and soft constraints
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
The Nurse Rostering Problems
Objectives
Find a feasible solution which satifsies all the hardconstraintsAs well as:
Balance work load of nursesSatisfy as many preferences as possible. . .
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
The Nurse Rostering Problems
List of constraints
All demand shifts should be coveredIn the scheduling period, the nurse is not allowed toexceed his/her maximum work loadThe maximum number of night shift is 3 per period of 5consecutive weeksAn early shift after a day shift should be aviodedAvoid sequence of shifts with length of 1. . .
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Outline
1 IntroductionConstraint ProgrammingThe Nurse Rostering Problems
2 The FormulationVariablesConstraintsModels
3 The Hybrid ApproachConstruction StageImprovement Stage
4 Computational Experiment Results
5 Conclusions
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Variables
The Formulation
VariablesConstraints2 models(CSP Model,WCSP Model)
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Variables
Variables
sij , the shift type assigned to nurse i on day jdomain:
0 Off1 Early2 Day3 Late4 Night
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Constraints
How to express the constraints?
Simplistic constraintse.g: Nobody is allowed to work 3 consecutive night shiftsif sij == Night && sij+1 == Night ,then sij+2 6= Night
ProblemsVery limited propagation, no global viewMassive number of simplistic constraints
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Constraints
Global Constraint
Work on sets of variablesGlobal point of view
Building blocksVery strong propagationAs general as possibleUsable with other constraintsDictionary of constraints(Hooker,2007)
Global constraints(in NRPs)Cardinality(or Distribute)Stretch(or Sequence )
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Constraints
Cardinality(ILOG Solver)
Cardinality(x /v ,l ,u)Bound how many times a variable can take a value(in itsdomain)variable x can take value v at least l and at most u timesSo, the maximum number of night shift constraint can beexpressed as Cardinality(sij ,night,0,3)the demand coverage constraint can be expressed asCardinality(sij ,K ,Djk ,Djk ). . .
Also can be used inproduction sequencingtimetabling. . .
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Constraints
Stretch(ILOG Solver)
Stretch(x /v ,l ,u,P)a stretch is consecutive variables that take the same value.it restricts the length of stretch within the range of [l ,u]P is set of patterns, which restrict a stretch of value vj canimmediately precedes a stretch of value v ′
jThus the stretch constraint puts bounds on how manyconsecutive days the nurse can work each shift, and whichshifts can immediately follow another.So the constraint ‘following a series of at least 2 night shifts,2 days off is required’ can be defined as follows: Stretch(sij ,Night, 2, 3, P), P = (Night, Off)
Also can be used inpersonnel assignmenttimetabling. . .
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Constraints
Problems
Which global constraint to choose?Balance between
expressiveness of the structure of the problempropagation powerimplementation effort
How to implement them?Use solver package
CHIP, ILOG SolverRoll your own
see (Bourdais,2003) for algorithms
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Models
Model
H1: Cardinality(sij , K , Djk , Djk ), ∨i ∈ I, j ∈ JH5: Cardinality(sij , Night, 0, n1), ∨i ∈ I, j ∈ JH7: Stretch(sij , Night, 2, 3, P), P = (Night, Off), ∨i ∈ I, j ∈ JH8: Stretch(sij , Night, 0, n1, P), P = (Night, Off),∨i ∈ I, j ∈ JS9: this constraint can be expressed using a booleanimplication constraint, which reflects a boolean logicalrelation between two variables as follows:
sij=Day⇒sij+1 6= Early ,∨i ∈ I, j ∈ Jsij=Late⇒sij+1 6= Early ,∨i ∈ I, j ∈ Jsij=Late⇒sij+1 6= Day ,∨i ∈ I, j ∈ J
. . .
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Outline
1 IntroductionConstraint ProgrammingThe Nurse Rostering Problems
2 The FormulationVariablesConstraintsModels
3 The Hybrid ApproachConstruction StageImprovement Stage
4 Computational Experiment Results
5 Conclusions
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
The Hybrid Approach
Basic CP search method’s limitaiton: exponential searchspaceWe need more intelligence search procedureThe idea of the approach is based on the observation thathigh quality nurse rosters consist of high quality shiftsequences(Brucker et al,2008).
Example
Mon Tue Wed Thu Fri Sat Sun CostO O D D N N N 0N N O O O E E 0E E E O O L L 0D D L L L O O 0
. . .
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
The Hybrid Approach
Basic CP search method’s limitaiton: exponential searchspaceWe need more intelligence search procedureThe idea of the approach is based on the observation thathigh quality nurse rosters consist of high quality shiftsequences(Brucker et al,2008).
Example
Mon Tue Wed Thu Fri Sat Sun CostO O D D N N N 0N N O O O E E 0E E E O O L L 0D D L L L O O 0
. . .
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Outline
Construction stage: Shift sequence generation anditerative forward searchImprovment stage: Variable Neighbourhood Search tomake further improvement
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Construction Stage
Shift Sequence Generation
By decomposeing the problem into solvable sub-problemfor CP, then using iterative forward search to extend thepartial solutin to complete solution.Use Constraint Satisfaction Problem(CSP) model togenerate these high quality shift sequences
Variable: sij , the shift type assigned to nurse i on day jConstraint:shift sequence related constraintsbuilding block for next step
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Construction Stage
Iterative Forward Search
Based on the high quality shift sequencesWeighted CSP model
Variable:siw , one week length shift sequence assigned tonurse i in week wConstraints(soft constraints) have associated costs, whichdepends on the assignment of the variables.The goal is to minimize the sum of costs:Minimize
∑wiP(xi)
Used to the complete problem to find optimal(near optimal)solution which satisfy all the hard constraint, at the sametime, satisfy as much soft constraint as possible
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Construction Stage
Iterative Forward Search
Figure: Transverse momentum distributions
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Construction Stage
Iterative Forward Search
Variable& Value selection rulesRandomly selectedSelected by heuristic
Vairable: first-fail principle, heavier work-load nurse isselected firstValue: night shift sequence first
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Improvement Stage
Variable Neighbourhood Search
Two neighborhoods defined:re-assign a shift to a different nurse working on the samedayswap the shifts assigned to two nurses on the same day
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Outline
1 IntroductionConstraint ProgrammingThe Nurse Rostering Problems
2 The FormulationVariablesConstraintsModels
3 The Hybrid ApproachConstruction StageImprovement Stage
4 Computational Experiment Results
5 Conclusions
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Pure CP without decomposition VS hybrid
Table: Pure CP VS hybrid
Data No of Variables No of Constraints Pure CP HybridA 722 2109 8 8B 3460 4600 0 0
GPOST 7897 5866 2 2ORTEC1 6672 22380 – 616ORTEC2 8208 28562 – 786ORTEC3 8624 29108 – 650ORTEC4 8720 29234 – 616
–indicates no feasible solutions can be obtained within 24hours’ running
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Variable & Value Selection Rule
Table: Variable Value Selection Rule
Problem Random Selection Heurictic SelectionORTEC1 1686 616ORTEC2 1035 786ORTEC3 635 650ORTEC4 705 616
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Table: Hybrid compared to other approaches
Problem instances Hybird GA Hybrid VNS Hybrid CPJan 775 735 616Feb 1791 1866 1736Mar 2030 2010 2766Apr 612 457 956May 2296 2161 1786Jun 9466 9291 8700Jul 781 481 650Aug 4850 4880 5171Sep 615 647 1300Oct 736 665 616Nov 2126 2030 2120Dec 625 5220 496
within 1/2 hour running,VNS restrict in 10 minutesaverage of 370 seconds to generate shift sequences
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Outline
1 IntroductionConstraint ProgrammingThe Nurse Rostering Problems
2 The FormulationVariablesConstraintsModels
3 The Hybrid ApproachConstruction StageImprovement Stage
4 Computational Experiment Results
5 Conclusions
Introduction The Formulation The Hybrid Approach Computational Experiment Results Conclusions
Conclusions
CP is a general technique, can encapsulate a lot of workCP allows the use of symbolic representationThe performence of search depends on the searchstrategiesHybrid CP supperior to pure CP for large problems
Appendix
Conatraint Solvers
SICStus Prologwww.sics.se/sicstusa powerful Prolog system with libraries for solvingconstraints (FD, Boolean, Real)
CHIPwww.cosytec.coma constraint solver in C with Prolog as a host language, alsoavailable as C and C++ librariespopularized the concept of global constraintsit is hard to go beyond the existing constraints
ILOGwww.ilog.com/productsthe largest family of optimisation products as C++(Java)librariesILOG Solver provides basic constraint satisfactionfunctionality
Appendix
Some of References
P. Brucker, R. Qu, E. K. Burke and G. Post. Adecomposition, construction and post-processingapproach for a specific nurse rostering problem, MISTA’05,397-406. New York, USA, Jul 2005L. Hellsten, G. Pesant, and P. van Beek. A domainconsistency algorithm for the stretch constraint. Principlesand Practice of Constraint Programming - CP 2004,Lecture Notes in Computer Science, Vol. 3258, 290-304,2004, Springer, BerlinJ. Hooke., Integrated Methods for Optimization, Springer,420-450, 2006J. C. Regin. Generalized arc consistency for globalcardinality constraint. National Conference on ArtificialIntelligence (AAAI 1996), AAAI Press, 209-215, 1996
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A
Thank You!Q & A