SlideShare a Scribd company logo
1 of 26
Nurse Rostering Problem
(with Constraint Programming on CHOCO and IBM
ILOG OPL)
Chhaily Moun
(55-090238-6006-0)
A report submitted in partial fulfillment of the subject for
Optimization Method (970532)
Department of Software System Engineering
Thai-German Graduate School of Engineering (TGGS)
King Mongkut’s University of Technology North Bangkok
March 01 2013
  1	
  
Table of content
Table of content………………………………………………. 1
Table of figure…………………………………………………2
I. Introduction……………………………………………………3
a. Structure of report………………………………………….3
b. Motivation………………………………………………….3
c. Literature review……………………………………………4
d. Scope of study………………………………………………5
II. Solving approach………………………………………………6
a. Constraint Programming Model……………………………6
b. CHOCO NRP Implementation……………………………..7
c. IBM ILOG OPL NRP Implementation…………………….9
III. Experimental result and comparison...………………………..12
Experiment I…………………………………………………..12
Experiment II…………………………………………………13
Experiment III………………………………………………..15
Experiment IV………………………………………………..16
Discussion…………………………………………………….17
IV. Conclusion and future work….……………………………….19
References ……………………………………………………20
Appendix A…………………………………………………...21
Appendix B…………………………………………………...24
  2	
  
Table of figure
Figure 1 – Variables and domain variables in CHOCO ………………...7
Figure 2 – Constraint on number of nurses per shift in CHOCO. ………8
Figure 3 – Constraint on one day off every 5 working days in CHOCO..8
Figure 4 – Constraint on different working shift in CHOCO…………...8
Figure 5 – Constraint on number of holiday for each nurse in CHOCO..9
Figure 6 – Optimize the objective in CHOCO………………………….9
Figure 7 – Variables and domain variables in IBM ILOG………………9
Figure 8 – Constraint on number of nurses per shift in IBM ILOG…...10
Figure 9 – Constraint on one day off every 5 working days in IBM
ILOG.. …………………………………………………….10
Figure 10 – Constraint on different working shift in IBM ILOG……..10
Figure 11 - Constraint on number of holiday for each nurse in IBM
ILOG………………………………………………………11
Figure 12 – Optimize the objective in IBM ILOG…………………….11
Figure 13 – CHOCO result for experiment I………………………….12
Figure 14 – IBM ILOG result for experiment I……………………….13
Figure 15 – Experiment I………………………………………………13
Figure 16 – CHOCO result for experiment II…………………………14
Figure 17 – IBM ILOG result for experiment II………………………14
Figure 18 – Experiment II …………………………………………….14
Figure 19 - CHOCO result for experiment III…………………………15
Figure 20 – IBM ILOG result for experiment III………………………15
Figure 21 – Experiment III…………………………………………….16
Figure 22 – CHOCO result for experiment IV…………………………16
Figure 23 – IBM ILOG result for experiment IV……………………...17
Figure 24 – Experiment IV…………………………………………….17
Figure 25 – Comparison of all results…………………………………18
  3	
  
I. Introduction
a. Structure of report
This report is organized into four main parts as follows:
• First part is introduction where I introduce the structure of
the whole report followed by motivation of the problem. In
the motivation section, I introduce the important and
difficulty of the problem (Nurse Rostering Problem). Then I
raise some papers related to Nurse Rostering Problem
methodology to present in literature review section. I cover a
few techniques applied in different solvers. The last section
of the first part is scope of study. There I just limit the
problem that I will use for this investigation.
• In the second part, I start with mathematical model for the
problem with Constraint Programming. Then I have two
solving approaches for the mentioned model. First approach,
I use it on an open source solver. I choose Choco, developed
and distributed by BSD [1, 2]. And I choose another
commercial solver for the second approach. I choose IBM
ILOG CPLEX Optimization Studio, developed and
distributed by IBM [3], for the commercial one.
• In the third part of the report, I present some experiments on
both open source solver and commercial solver with their
corresponding results. And I will make comparison from the
results.
• The last part is about conclusion from the investigation and
the part I could not study on. I also introduce what to be
studied on Nurse Rostering Problem in the future.
b. Motivation
Scheduling nurse in small to medium size hospital is one of the
most important administration activities to run the hospital
efficiently and have all nurses worked equally. Besides its
  4	
  
importance, scheduling nurse is a very challenging task to do in
many hospitals since the number of nurses is quite large. Because
of its importance and complexity, this problem has been studied
extensively in both Operational Research and Artificial
Intelligence for more than 40 years (as cited in [4]). And this
problem is well known as Nurse Rostering Problem (NRP). The
problem is NP hard problem in most real world cases [4]. It is
really challenge as there are many different rules to be satisfied to
ensure high quality roster. And it is possible that the problem is
over-constrained when some rules come in conflict.
NRP is problem of generating rosters for all nurses in the hospital
where shifts, holiday, regulations, work practices and specific
nurse preferences are considered in a defined period. The problem
is usually categorized into two groups of constraint: hard and soft
constraint [4].
• Hard constraints refer to those to be satisfied in order
to obtain feasible rosters for use in practice.
• Soft constraints refer to those to be satisfied as much
as possible in order to have a more efficient roster.
To contribute to this problem, I will model the problem based on
Constraint Programming, apply on two different solvers and make
comparison.
c. Literature review
As mentioned in the previous section, NRP has been studied more
than 40 years ago in both OR and AI areas; so there are already a
wide range of techniques used.
Some techniques are based on meta-heuristics (as cited in [4])
which are effective for large scale and complicated problems. In
the meanwhile, meta-heuristics have their own drawback for they
neither produce optimal solutions nor reduce search space.
The others are based on Integer Programming [5]. In [5], the author
used Integer Programming Based Local Search technique applying
on a roster of 30 days with 25 staffs. The result is good somehow
despite the fact that it is not optimal.
  5	
  
AI techniques such as CP have also been used largely for NRP. As
cited in [4], it is quite good for solving small scale NRP only. But
it is interesting in [6] where the author applied column generation
scheme with CP and the result is quite good comparing to other
techniques. Anyway, it is expensive to solve too many constraints
using CP.
The others techniques which have been studied recently are
hybrids such as IP-hybrid, CP-hybrid. Once again they are
effective for many constraints with expensive cost.
d. Scope of study
To investigate on NRP for an effective solution requires much
effort since the problem is quite complex. And many studies have
been conducted and the results tend to be better from time to time
regardless of cost. On the one hand, small and medium size
hospitals are unlikely to pay for those high cost techniques and the
problems have fewer constraints. For this reason plus I have limit
time for this study; I choose to study this problem using Constraint
Programming. As mentioned in the previous section, CP can be
used to effectively schedule small scale problems. From the CP
model, I conduct some experiments using CHOCO and IBM ILOG
OPL solver. I also make comparison of the experiment results from
both solvers.
Here, I choose CHOCO solver because it is open source and
suitable for small and medium size hospital. Then I choose IBM
ILOG OPL solver, a commercial product, with expectation that
commercial product will perform better and to some distance we
may need to use commercial product in case it is better.
  6	
  
II. Solving approach
In this section, I introduce CP mathematical model for NRP. I then
implement it on CHOCO and IBM ILOG CPLEX optimization studio.
The NRP I have here is to assign a set of nurses to four shifts (i.e. Off,
Morning, Afternoon, Night) on a period of 30 days. All nurses need to
have equivalent working shifts and holiday. The schedule need 4 nurses,
2 nurses and 2 nurses for morning, afternoon and evening shifts
correspondingly. In the problem, we also take previous period holiday
into account in the current period so as to have balance working and
holiday for all nurses. Also each nurse cannot work on the same shift for
more than 2 days consecutively. Then the holiday for each nurse must
spread approximately equally during the period (i.e. around 6 holidays
per 30 days period with 10 nurses).
a. Constraint Programming Model
Different instances of the problem are defined as follows:
• N: set of nurses
• n: number of nurses
• S: set of shift type S = {0(off), 1(morning), 2(afternoon),
3(evening)}
• d: number of days during the period
• P: set of shift pattern per day P = {2(Off), 4(Morning),
2(Afternoon), 2(Night)} for 10 nurses rostering
• rij ∈ S: roster for day i and nurse j; i ∈ p; j ∈ n
• Offseti: the number of offset which is more or less than
average holiday for nurse I; i ∈ n
Variables:
R = {rij | i ∈ d, j ∈ n }
Domains of variable:
S(R) = {S(r11), …, S(rpn)}; rij ∈ S; i ∈ d; j ∈ n
Constraints:
§ Set number of nurses per shift
count(Ri, sj) = pj; ∀ i ∈ d, sj∈ S, pj ∈ P, j ∈ 3
  7	
  
§ Set approximately 1 day off in every 5 days
5 <= 𝒓𝒊𝒋
𝟓
𝒊!𝟏
𝒏
𝒋!𝟏 <=8
5 <= 𝒓𝒊𝒋
𝟏𝟎
𝒊!𝟔
𝒏
𝒋!𝟏 <=8
5 <= 𝒓𝒊𝒋
𝟏𝟓
𝒊!𝟏𝟏
𝒏
𝒋!𝟏 <=8
5 <= 𝒓𝒊𝒋
𝟐𝟎
𝒊!𝟏𝟔
𝒏
𝒋!𝟏 <=8
5 <= 𝒓𝒊𝒋
𝟐𝟓
𝒊!𝟐𝟏
𝒏
𝒋!𝟏 <=8
5 <= 𝒓𝒊𝒋
𝟑𝟎
𝒊!𝟐𝟔
𝒏
𝒋!𝟏 <=8
§ Each nurse cannot work on the same shift for more than 2
days consecutively
rij != r(i+1)j ,∀ i ∈ d%2; j ∈	
  n	
  
§ Balance number of holiday for each nurse per period by
taking previous month holiday into account
0 + Offseti <= count(𝑹𝒊
𝑻
, s0) <= 10 + Offseti
§ Minimize the difference between offset of each nurse
Minimize Max(Offset) – Min(Offset)
b. CHOCO NRP Implementation
Variables & domains of variable:
	
  
Figure	
  1	
  -­‐	
  Variables	
  and	
  domain	
  variables	
  in	
  CHOCO
  8	
  
Constraints:
§ Set number of nurses per shift
	
  
Figure	
  2	
  -­‐	
  Constraint	
  on	
  number	
  of	
  nurses	
  per	
  shift	
  in	
  CHOCO
§ Set approximately 1 day off in every 5 days
	
  
Figure	
  3	
  -­‐	
  Constraint	
  on	
  one	
  day	
  off	
  every	
  5	
  working	
  days	
  in	
  CHOCO	
  
§ Each nurse cannot work on the same shift for more than 2
days consecutively
	
  
Figure	
  4	
  -­‐	
  Constraint	
  on	
  different	
  working	
  shift	
  in	
  CHOCO
  9	
  
§ Balance number of holiday for each nurse per period by
taking previous month holiday into account
	
  
Figure	
  5	
  -­‐	
  Constraint	
  on	
  number	
  of	
  holiday	
  for	
  each	
  nurse	
  in	
  CHOCO
§ Minimize the difference between offset of each nurse
	
  
Figure	
  6	
  -­‐	
  Optimize	
  the	
  objective	
  in	
  CHOCO
For the whole runnable code, please go to appendix A.
c. IBM ILOG OPL NRP Implementation
Variables & domains of variable:
	
  
Figure	
  7	
  -­‐	
  Variables	
  and	
  domain	
  of	
  variables	
  in	
  IBM	
  ILOG
  10	
  
Constraints:
§ Set number of nurses per shift
	
  
Figure	
  8	
  -­‐	
  Constraint	
  on	
  number	
  of	
  nurses	
  per	
  shift	
  in	
  IBM	
  ILOG
§ Set approximately 1 day off in every 5 days
	
  
Figure	
  9	
  -­‐	
  Constraint	
  on	
  one	
  day	
  off	
  every	
  5	
  working	
  days	
  in	
  IBM	
  ILOG
§ Each nurse cannot work on the same shift for more than 2
days consecutively
	
  
Figure	
  10	
  -­‐	
  Constraint	
  on	
  different	
  working	
  shift	
  in	
  IBM	
  ILOG
  11	
  
§ Balance number of holiday for each nurse per period by
taking previous month holiday into account
	
  
Figure	
  11	
  -­‐	
  Constraint	
  on	
  number	
  of	
  holiday	
  for	
  each	
  nurse	
  in	
  IBM	
  ILOG
§ Minimize the difference between offset of each nurse
	
  
Figure	
  12	
  -­‐	
  Optimize	
  the	
  objective	
  in	
  IBM	
  ILOG
For the whole runnable code in IBM ILOG OPL, please go to
appendix B.
  12	
  
III. Experimental result and comparison
To evaluate the models above and make comparison between
commercial and free solver, I conduct four different experiments on
both CHOCO and IBM ILOG OPL implementations.
The results from each solver are displayed in grid; each row represents
roster for each nurse and each column represents roster for each day.
The intersection between row and column is the shift on the schedule
where ‘M’ denotes morning shift, ‘A’ denotes afternoon shift, ‘N’
denotes night shift and ‘O’ denotes off. The column next to the last
one shows the number of holiday offset for each nurse from the
previous month and the last column shows the holiday offset for the
current schedule.
Experiment I
In the first experiment, I choose the problem with 10 nurses to be
assigned on 30 days period and each nurse has 0 holiday offset from
previous month.
Following figures show the result from both CHOCO and IBM ILOG.
	
  
Figure	
  13	
  -­‐	
  CHOCO	
  results	
  for	
  experiment	
  I	
  
	
  
  13	
  
	
  
Figure	
  14	
  -­‐	
  IBM	
  ILOG	
  result	
  for	
  experiment	
  I	
  
	
  
Figure	
  15	
  -­‐	
  Experiment	
  I	
  
	
  
Experiment II
In the second experiment, I choose the problem with 10 nurses to be
assigned on 30 days period with the holiday offset vary from -4 to 4
for each nurse.
Following figures show the result from both CHOCO and IBM ILOG.
  14	
  
	
  
Figure	
  16	
  -­‐	
  CHOCO	
  result	
  for	
  experiment	
  II
	
  
Figure	
  17	
  -­‐	
  IBM	
  ILOG	
  result	
  for	
  experiment	
  II
	
  
Figure	
  18	
  -­‐	
  Experiment	
  II	
  
	
  
	
  
	
  
	
  
	
  
	
  
  15	
  
Experiment III
In the third experiment, I increase the problem size to 12 nurses to be
assigned on 30 days period and each nurse has 0 holiday offset from
previous month.
Following figures show the result from both CHOCO and IBM ILOG.
	
  
Figure	
  19	
  -­‐	
  CHOCO	
  result	
  for	
  experiment	
  III
	
  
Figure	
  20	
  -­‐	
  IBM	
  ILOG	
  result	
  for	
  experiment	
  III
  16	
  
	
  
Figure	
  21	
  -­‐	
  Experiment	
  III	
  
	
  
	
  
Experiment IV
In the fourth experiment, I choose the problem with 12 nurses to be
assigned on 30 days period and once again the holiday offset vary
from -4 to 4.
Following figures show the result from both CHOCO and IBM ILOG.
	
  
Figure	
  22	
  -­‐	
  CHOCO	
  result	
  for	
  experiment	
  IV	
  
	
  
  17	
  
	
  
Figure	
  23	
  -­‐	
  IBM	
  ILOG	
  result	
  for	
  experiment	
  IV
	
  
	
  
Figure	
  24	
  -­‐	
  Experiment	
  IV	
  
	
  
Discussion
From the four experiments, we can see that IBM ILOG performs
much better than CHOCO. IBM ILOG always find better solution and
spend shorter time to computer. We cannot get perfect results from
CHOCO because it always take long time to get the best results and I
will just set the time limit for a while until the result is better and
enough for comparison.
  18	
  
	
  
Figure	
  25	
  -­‐	
  Comparison	
  of	
  all	
  experiment
Comparing between experiment I and III, we can find out that smaller
problem could compute faster than a larger one with either free or
commercial solver.
Then if we take a look at experiment II and IV, we are surprised to see
that the larger problem computer faster than the smaller one since the
large problem allows more relaxation.
Another comparson should be made either between experiment I and
II or between experiment III and IV, the result shows that the problem
with offset equal to zero compute faster than the one with vary offset.
  19	
  
IV. Conclusion and future work
To conclude, the result is acceptable for small and medium size
hospital. It takes time for large data set, especially with CHOCO. I
believe that the model is not so efficient comparing to some recent
publications with newly found algorithms but I am satisfied with the
results produced since I lack both time and experience for this study.
By the end of this study, I could have some preliminary idea for more
works to be conducted. To continue working on this problem, I
might need to optimize the model to cope with large practical data.
The first idea that comes to my mind for optimizing the model is to
have it on Integer Programming and possibly hybrid CP-IP model.
  20	
  
References
[1] CHOCO, http://www.emn.fr/z-info/choco-solver/
[2] Berkeley Software Distribution [BSD], “CHOCO Documentation”,
Apr. 2010.
[3] International Business Machines Corporation [IBM], “IBM ILOG
OPL Language User’s Manual”, 2009.
[4] Rong Qu and Fang He, “A Hybrid Constraint Programming Approach
for Nurse Rostering Problems”, School of Computer Science,
University of Nottingham, UK.
[5] Seiya Hasegawa and Yukio Kosugi, “Solving Nurse Scheduling
Problem by Integer-Programming-Based Local Search”, IEEE
International Conference on Systesms, Man, and Cybernetics, pp.
1474-1480, October 2006. (In Taipei, Taiwan).
[6] Fang He and Rong Qu, “A Constraint Programming based Column
Generation Approach to Nurse Rostering Problems”, School of
Computer Science, University of Nottingham, UK.
  21	
  
Appendix A
The following is code that I implement in CHOCO for Nurse Rostering
Problem I modeled in Constraint Programming.
/******************************************************************
* CHOCO
* Constraint Programming Model for NRP
* Author: Chhaily Moun, MSc candidate, Software Systems Engineering
* Creation Date: Feb 15, 2013
*******************************************************************/
import choco.Choco;
import choco.Options;
import choco.cp.model.CPModel;
import choco.cp.solver.CPSolver;
import choco.kernel.model.Model;
import choco.kernel.model.variables.integer.IntegerExpressionVariable;
import choco.kernel.model.variables.integer.IntegerVariable;
import choco.kernel.solver.Solver;
public class NRPSolution {
public NRPSolution(){
int period = 30;
int numNurse = 10;
final int MShift = 1;
final int AShift = 2;
final int NShift = 3;
int []pattern = {4,4,2,2};//Off Morning Afternoon Evening
int off[]={4,-4,4,4,4,-4,4,-4,-4,-4};//{0,0,0,0,0,0,0,0,0,0};
//Variable declaration
String shift[] = {"O","M","A","N"};
int numShifts = shift.length-1;
//Decision variable
IntegerVariable[][] roster = Choco.makeIntVarArray("roster",
period,numNurse, 0, numShifts);
IntegerExpressionVariable [][]T =
Choco.makeIntVarArray("transpose", numNurse, period);
Model m = new CPModel();
  22	
  
// Set number of nurses per shift
for(int i = 0; i < period; i++){
IntegerVariable Mocc = Choco.makeIntVar("Morning" + i,
pattern[1],pattern[1]);
m.addConstraint(Choco.occurrence(Mocc,(IntegerVariable[])roster[i],MSh
ift));
IntegerVariable Aocc = Choco.makeIntVar("Afternoon" + i, pattern[2],
pattern[2]);
m.addConstraint(Choco.occurrence(Aocc,(IntegerVariable[])roster[i],NSh
ift));
IntegerVariable Nocc = Choco.makeIntVar("Night" + i,
pattern[3],pattern[3]);
m.addConstraint(Choco.occurrence(Nocc,(IntegerVariable[])roster[i],ASh
ift));
}
//Constraint for changing pattern
for(int i = 0; i < numNurse; i++){
IntegerVariable total = Choco.makeIntVar("shift_" +
(i+1), 5, 8);
m.addConstraint(Choco.eq(total,Choco.sum(roster[1][i],roster[2][i],ros
ter[3][i],roster[4][i],roster[0][i])));
m.addConstraint(Choco.eq(total,Choco.sum(roster[6][i],roster[7][i],ros
ter[8][i],roster[9][i],roster[5][i])));
m.addConstraint(Choco.eq(total,Choco.sum(roster[11][i],roster[12][i],r
oster[13][i],roster[14][i],roster[10][i])));
m.addConstraint(Choco.eq(total,Choco.sum(roster[15][i],roster[16][i],r
oster[17][i],roster[18][i],roster[19][i])));
m.addConstraint(Choco.eq(total,Choco.sum(roster[20][i],roster[21][i],r
oster[22][i],roster[23][i],roster[24][i])));
m.addConstraint(Choco.eq(total,Choco.sum(roster[25][i],roster[26][i],r
oster[27][i],roster[28][i],roster[29][i])));
//Make each nurse has shift changes
for(int j = 0; j < period-1; j+=2){
m.addConstraint(Choco.allDifferent(roster[j][i],roster[j+1][i]));
}
  23	
  
}
for(int i = 0; i < period; i++)
for(int j = 0; j < numNurse; j++){
T[j][i] = roster[i][j];
}
IntegerVariable Offset[] = new IntegerVariable[numNurse];
for(int i = 0; i < numNurse; i++){
//Constraint on off days per months
Offset[i] = Choco.makeIntVar("OFF",5 + off[i], 10 + off[i] );
m.addConstraint(Choco.occurrence(Offset[i],(IntegerVariable[])T[i],0);
}
IntegerVariable obj =
Choco.makeIntVar("Obj",Options.V_OBJECTIVE);
m.addVariable(obj);
m.addConstraint(Choco.eq(obj,
Choco.minus(Choco.max(Offset),Choco.min(Offset))));
//Create solver s
Solver s = new CPSolver();
s.setTimeLimit(5040000);
s.read(m);
s.minimize(s.getVar(obj),true);
int []cHoliday = new int[numNurse];
System.out.println("Time taken: " + s.getTimeCount());
System.out.println("Number of nurses: " + numNurse);
System.out.println("Length of schedule: " + period);
System.out.println("Nurse roster:");
for(int j = 0; j < numNurse; j++){
System.out.print("Nurse " + (j+1) + ": ");
for(int i = 0; i < period; i++){
if(s.getVar(roster[i][j]).getVal() == 0){
cHoliday[j]+=1;
}
System.out.print(shift[s.getVar(roster[i][j]).getVal()]+" ");
}
System.out.println("t" + off[j] + "t" + (cHoliday[j] - 6 +
off[j]));
}
}
public static void main(String[]arg){
new NRPSolution();
}
  24	
  
}	
  
Appendix B
The following is code that I implement in IBM ILOG OPL for Nurse
Rostering Problem I modeled in Constraint Programming.
/*********************************************
* OPL 12.4 Model
* Constraint Programming Model for NRP
* Author: CHHAILY
* Creation Date: Feb 22, 2013 at 9:46:18 AM
*********************************************/
using CP;
range sRange = 0..3;
string shift [sRange] = ["O", "M", "A", "N"];
int OShift = 0;
int MShift = 1;
int AShift = 2;
int NShift = 3;
int cHoliday = 0;
int period = 30;
int numNurse = 10;
int pattern [sRange]=[4,4,2,2];
range days = 1..period;
range nurses = 1..numNurse;
int off[nurses]=[4,-4,4,4,4,-4,4,-4,-4,-4];//[0,0,0,0,0,0,0,0,0,0];
dvar int roster[days][nurses] in sRange;
dvar int offset[nurses] in 0..30;
dvar int obj;
execute{
var p = cp.param;
p.timeLimit = 1000;
}
minimize obj;
subject to{
//Assign number of nurses per shift
forall(i in days){
count(all(n in nurses) roster[i][n],MShift) == pattern[1];
count(all(n in nurses) roster[i][n],AShift) == pattern[2];
count(all(n in nurses) roster[i][n],NShift) == pattern[3];
}
forall(n in nurses){
4 <= sum(d in 1..5) roster[d][n] <= 8;
4 <= sum(d in 6..10) roster[d][n] <= 8;
4 <= sum(d in 11..15) roster[d][n] <= 8;
4 <= sum(d in 16..20) roster[d][n] <= 8;
4 <= sum(d in 21..25) roster[d][n] <= 8;
  25	
  
4 <= sum(d in 26..30) roster[d][n] <= 8;
forall(d in 1..29)
if(d%2 == 0)
roster[d][n] != roster[d+1][n];
5 + off[n] <= offset[n] <= 10 + off[n];
offset[n] == count(all(d in days) roster[d][n],0);
}
obj == max(n in nurses) offset[n] - min(n in nurses)offset[n];
}
execute{
writeln("Number of resources: " + numNurse);
writeln("Length of schedule: " + period);
writeln("Nurse roster:");
for(n in nurses){
write("Nurse " + n + ": ");
if(n<=9)
write(" ");
for(d in days){
write(shift[roster[d][n]] + " ");
if(roster[d][n] == 0) cHoliday +=1;
}
writeln("t" + off[n] + "t" + (6 - cHoliday + off[n]));
cHoliday = 0;
}
} 	
  

More Related Content

Viewers also liked

The Doctor Rostering Problem
The Doctor Rostering ProblemThe Doctor Rostering Problem
The Doctor Rostering ProblemSunseth
 
Total Workforce Management 2013: Rostering
Total Workforce Management 2013: RosteringTotal Workforce Management 2013: Rostering
Total Workforce Management 2013: RosteringADP Marketing
 
AV28 - Rostering Shiftwork for Aviation
AV28 - Rostering  Shiftwork for AviationAV28 - Rostering  Shiftwork for Aviation
AV28 - Rostering Shiftwork for AviationCorin Tan
 
5 EMR/HIS Migration Secrets All Department Leaders Must Know
5 EMR/HIS Migration Secrets All Department Leaders Must Know5 EMR/HIS Migration Secrets All Department Leaders Must Know
5 EMR/HIS Migration Secrets All Department Leaders Must KnowBoston Software Systems
 
OPCrew - Rail Crew Scheduling Rostering and Management
OPCrew - Rail Crew Scheduling Rostering and ManagementOPCrew - Rail Crew Scheduling Rostering and Management
OPCrew - Rail Crew Scheduling Rostering and ManagementMatthew Parkinson
 
Microsoft dynamics crm 2011 service scheduling- moving beyond rostering
Microsoft dynamics crm 2011   service scheduling- moving beyond rosteringMicrosoft dynamics crm 2011   service scheduling- moving beyond rostering
Microsoft dynamics crm 2011 service scheduling- moving beyond rosteringSyed Arh
 
Comparing Roster Data Models: SIF Xpress, IMS Global, CEDS, and More
Comparing Roster Data Models:  SIF Xpress, IMS Global, CEDS, and MoreComparing Roster Data Models:  SIF Xpress, IMS Global, CEDS, and More
Comparing Roster Data Models: SIF Xpress, IMS Global, CEDS, and Morejulielapolito
 
Hospital Management
Hospital ManagementHospital Management
Hospital Managementzahid32
 
2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use cases2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use casesGeoffrey De Smet
 
Reasoning with Conditional Time-intervals
Reasoning with Conditional Time-intervalsReasoning with Conditional Time-intervals
Reasoning with Conditional Time-intervalsPhilippe Laborie
 
Pro Tms Commute -Automation for employee Transportation
Pro Tms Commute -Automation for employee TransportationPro Tms Commute -Automation for employee Transportation
Pro Tms Commute -Automation for employee Transportationshashidharjoshi
 
Duty rosters lec.2
Duty rosters lec.2Duty rosters lec.2
Duty rosters lec.2cora-li
 
Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...
Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...
Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...Philippe Laborie
 
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three ProblemsIBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three ProblemsPhilippe Laborie
 
Modeling and Solving Scheduling Problems with CP Optimizer
Modeling and Solving Scheduling Problems with CP OptimizerModeling and Solving Scheduling Problems with CP Optimizer
Modeling and Solving Scheduling Problems with CP OptimizerPhilippe Laborie
 

Viewers also liked (20)

Nurse Rostering
Nurse RosteringNurse Rostering
Nurse Rostering
 
The Doctor Rostering Problem
The Doctor Rostering ProblemThe Doctor Rostering Problem
The Doctor Rostering Problem
 
Total Workforce Management 2013: Rostering
Total Workforce Management 2013: RosteringTotal Workforce Management 2013: Rostering
Total Workforce Management 2013: Rostering
 
AV28 - Rostering Shiftwork for Aviation
AV28 - Rostering  Shiftwork for AviationAV28 - Rostering  Shiftwork for Aviation
AV28 - Rostering Shiftwork for Aviation
 
5 EMR/HIS Migration Secrets All Department Leaders Must Know
5 EMR/HIS Migration Secrets All Department Leaders Must Know5 EMR/HIS Migration Secrets All Department Leaders Must Know
5 EMR/HIS Migration Secrets All Department Leaders Must Know
 
OPCrew - Rail Crew Scheduling Rostering and Management
OPCrew - Rail Crew Scheduling Rostering and ManagementOPCrew - Rail Crew Scheduling Rostering and Management
OPCrew - Rail Crew Scheduling Rostering and Management
 
Microsoft dynamics crm 2011 service scheduling- moving beyond rostering
Microsoft dynamics crm 2011   service scheduling- moving beyond rosteringMicrosoft dynamics crm 2011   service scheduling- moving beyond rostering
Microsoft dynamics crm 2011 service scheduling- moving beyond rostering
 
Comparing Roster Data Models: SIF Xpress, IMS Global, CEDS, and More
Comparing Roster Data Models:  SIF Xpress, IMS Global, CEDS, and MoreComparing Roster Data Models:  SIF Xpress, IMS Global, CEDS, and More
Comparing Roster Data Models: SIF Xpress, IMS Global, CEDS, and More
 
Sabal_ChrisT_Summit2015_edit
Sabal_ChrisT_Summit2015_editSabal_ChrisT_Summit2015_edit
Sabal_ChrisT_Summit2015_edit
 
E-Roster Project
E-Roster ProjectE-Roster Project
E-Roster Project
 
Hospital Management
Hospital ManagementHospital Management
Hospital Management
 
2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use cases2010 04-20 san diego bootcamp - drools planner - use cases
2010 04-20 san diego bootcamp - drools planner - use cases
 
Fatigue risk associated with shift work in ICU nurses
Fatigue risk associated with shift work in ICU nursesFatigue risk associated with shift work in ICU nurses
Fatigue risk associated with shift work in ICU nurses
 
Reasoning with Conditional Time-intervals
Reasoning with Conditional Time-intervalsReasoning with Conditional Time-intervals
Reasoning with Conditional Time-intervals
 
Pro Tms Commute -Automation for employee Transportation
Pro Tms Commute -Automation for employee TransportationPro Tms Commute -Automation for employee Transportation
Pro Tms Commute -Automation for employee Transportation
 
A refreshing, modern approach to rostering
A refreshing, modern approach to rosteringA refreshing, modern approach to rostering
A refreshing, modern approach to rostering
 
Duty rosters lec.2
Duty rosters lec.2Duty rosters lec.2
Duty rosters lec.2
 
Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...
Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...
Modeling and Solving Resource-Constrained Project Scheduling Problems with IB...
 
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three ProblemsIBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
IBM ILOG CP Optimizer for Detailed Scheduling Illustrated on Three Problems
 
Modeling and Solving Scheduling Problems with CP Optimizer
Modeling and Solving Scheduling Problems with CP OptimizerModeling and Solving Scheduling Problems with CP Optimizer
Modeling and Solving Scheduling Problems with CP Optimizer
 

Similar to Nurse Rostering Problem - A comparison between Constraint Programming on CHOCO and IBM ILOG

Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Production & Operation Management Chapter33[1]
Production & Operation Management Chapter33[1]Production & Operation Management Chapter33[1]
Production & Operation Management Chapter33[1]Hariharan Ponnusamy
 
Quantitative management
Quantitative managementQuantitative management
Quantitative managementsmumbahelp
 
Operation research history and overview application limitation
Operation research history and overview application limitationOperation research history and overview application limitation
Operation research history and overview application limitationBalaji P
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Chapter 6-Scheduling in Industrial of Engineering
Chapter 6-Scheduling in Industrial of EngineeringChapter 6-Scheduling in Industrial of Engineering
Chapter 6-Scheduling in Industrial of EngineeringFaizAzmy2
 
Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...
Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...
Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...CSCJournals
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
Lpp through graphical analysis
Lpp through graphical analysis Lpp through graphical analysis
Lpp through graphical analysis YuktaBansal1
 
Linear programming
Linear programmingLinear programming
Linear programmingKrantee More
 
UNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptx
UNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptxUNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptx
UNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptxMinilikDerseh1
 
Fdp session rtu session 1
Fdp session rtu session 1Fdp session rtu session 1
Fdp session rtu session 1sprsingh1
 

Similar to Nurse Rostering Problem - A comparison between Constraint Programming on CHOCO and IBM ILOG (20)

Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Production & Operation Management Chapter33[1]
Production & Operation Management Chapter33[1]Production & Operation Management Chapter33[1]
Production & Operation Management Chapter33[1]
 
Quantitative management
Quantitative managementQuantitative management
Quantitative management
 
cs1538.ppt
cs1538.pptcs1538.ppt
cs1538.ppt
 
Operation research history and overview application limitation
Operation research history and overview application limitationOperation research history and overview application limitation
Operation research history and overview application limitation
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Chapter 6-Scheduling in Industrial of Engineering
Chapter 6-Scheduling in Industrial of EngineeringChapter 6-Scheduling in Industrial of Engineering
Chapter 6-Scheduling in Industrial of Engineering
 
Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...
Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...
Design and Implementation of a Multi-Agent System for the Job Shop Scheduling...
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
Lpp through graphical analysis
Lpp through graphical analysis Lpp through graphical analysis
Lpp through graphical analysis
 
Linear programming
Linear programmingLinear programming
Linear programming
 
report
reportreport
report
 
UNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptx
UNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptxUNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptx
UNIT-2 Quantitaitive Anlaysis for Mgt Decisions.pptx
 
Fdp session rtu session 1
Fdp session rtu session 1Fdp session rtu session 1
Fdp session rtu session 1
 

Recently uploaded

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 

Recently uploaded (20)

Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 

Nurse Rostering Problem - A comparison between Constraint Programming on CHOCO and IBM ILOG

  • 1. Nurse Rostering Problem (with Constraint Programming on CHOCO and IBM ILOG OPL) Chhaily Moun (55-090238-6006-0) A report submitted in partial fulfillment of the subject for Optimization Method (970532) Department of Software System Engineering Thai-German Graduate School of Engineering (TGGS) King Mongkut’s University of Technology North Bangkok March 01 2013
  • 2.   1   Table of content Table of content………………………………………………. 1 Table of figure…………………………………………………2 I. Introduction……………………………………………………3 a. Structure of report………………………………………….3 b. Motivation………………………………………………….3 c. Literature review……………………………………………4 d. Scope of study………………………………………………5 II. Solving approach………………………………………………6 a. Constraint Programming Model……………………………6 b. CHOCO NRP Implementation……………………………..7 c. IBM ILOG OPL NRP Implementation…………………….9 III. Experimental result and comparison...………………………..12 Experiment I…………………………………………………..12 Experiment II…………………………………………………13 Experiment III………………………………………………..15 Experiment IV………………………………………………..16 Discussion…………………………………………………….17 IV. Conclusion and future work….……………………………….19 References ……………………………………………………20 Appendix A…………………………………………………...21 Appendix B…………………………………………………...24
  • 3.   2   Table of figure Figure 1 – Variables and domain variables in CHOCO ………………...7 Figure 2 – Constraint on number of nurses per shift in CHOCO. ………8 Figure 3 – Constraint on one day off every 5 working days in CHOCO..8 Figure 4 – Constraint on different working shift in CHOCO…………...8 Figure 5 – Constraint on number of holiday for each nurse in CHOCO..9 Figure 6 – Optimize the objective in CHOCO………………………….9 Figure 7 – Variables and domain variables in IBM ILOG………………9 Figure 8 – Constraint on number of nurses per shift in IBM ILOG…...10 Figure 9 – Constraint on one day off every 5 working days in IBM ILOG.. …………………………………………………….10 Figure 10 – Constraint on different working shift in IBM ILOG……..10 Figure 11 - Constraint on number of holiday for each nurse in IBM ILOG………………………………………………………11 Figure 12 – Optimize the objective in IBM ILOG…………………….11 Figure 13 – CHOCO result for experiment I………………………….12 Figure 14 – IBM ILOG result for experiment I……………………….13 Figure 15 – Experiment I………………………………………………13 Figure 16 – CHOCO result for experiment II…………………………14 Figure 17 – IBM ILOG result for experiment II………………………14 Figure 18 – Experiment II …………………………………………….14 Figure 19 - CHOCO result for experiment III…………………………15 Figure 20 – IBM ILOG result for experiment III………………………15 Figure 21 – Experiment III…………………………………………….16 Figure 22 – CHOCO result for experiment IV…………………………16 Figure 23 – IBM ILOG result for experiment IV……………………...17 Figure 24 – Experiment IV…………………………………………….17 Figure 25 – Comparison of all results…………………………………18
  • 4.   3   I. Introduction a. Structure of report This report is organized into four main parts as follows: • First part is introduction where I introduce the structure of the whole report followed by motivation of the problem. In the motivation section, I introduce the important and difficulty of the problem (Nurse Rostering Problem). Then I raise some papers related to Nurse Rostering Problem methodology to present in literature review section. I cover a few techniques applied in different solvers. The last section of the first part is scope of study. There I just limit the problem that I will use for this investigation. • In the second part, I start with mathematical model for the problem with Constraint Programming. Then I have two solving approaches for the mentioned model. First approach, I use it on an open source solver. I choose Choco, developed and distributed by BSD [1, 2]. And I choose another commercial solver for the second approach. I choose IBM ILOG CPLEX Optimization Studio, developed and distributed by IBM [3], for the commercial one. • In the third part of the report, I present some experiments on both open source solver and commercial solver with their corresponding results. And I will make comparison from the results. • The last part is about conclusion from the investigation and the part I could not study on. I also introduce what to be studied on Nurse Rostering Problem in the future. b. Motivation Scheduling nurse in small to medium size hospital is one of the most important administration activities to run the hospital efficiently and have all nurses worked equally. Besides its
  • 5.   4   importance, scheduling nurse is a very challenging task to do in many hospitals since the number of nurses is quite large. Because of its importance and complexity, this problem has been studied extensively in both Operational Research and Artificial Intelligence for more than 40 years (as cited in [4]). And this problem is well known as Nurse Rostering Problem (NRP). The problem is NP hard problem in most real world cases [4]. It is really challenge as there are many different rules to be satisfied to ensure high quality roster. And it is possible that the problem is over-constrained when some rules come in conflict. NRP is problem of generating rosters for all nurses in the hospital where shifts, holiday, regulations, work practices and specific nurse preferences are considered in a defined period. The problem is usually categorized into two groups of constraint: hard and soft constraint [4]. • Hard constraints refer to those to be satisfied in order to obtain feasible rosters for use in practice. • Soft constraints refer to those to be satisfied as much as possible in order to have a more efficient roster. To contribute to this problem, I will model the problem based on Constraint Programming, apply on two different solvers and make comparison. c. Literature review As mentioned in the previous section, NRP has been studied more than 40 years ago in both OR and AI areas; so there are already a wide range of techniques used. Some techniques are based on meta-heuristics (as cited in [4]) which are effective for large scale and complicated problems. In the meanwhile, meta-heuristics have their own drawback for they neither produce optimal solutions nor reduce search space. The others are based on Integer Programming [5]. In [5], the author used Integer Programming Based Local Search technique applying on a roster of 30 days with 25 staffs. The result is good somehow despite the fact that it is not optimal.
  • 6.   5   AI techniques such as CP have also been used largely for NRP. As cited in [4], it is quite good for solving small scale NRP only. But it is interesting in [6] where the author applied column generation scheme with CP and the result is quite good comparing to other techniques. Anyway, it is expensive to solve too many constraints using CP. The others techniques which have been studied recently are hybrids such as IP-hybrid, CP-hybrid. Once again they are effective for many constraints with expensive cost. d. Scope of study To investigate on NRP for an effective solution requires much effort since the problem is quite complex. And many studies have been conducted and the results tend to be better from time to time regardless of cost. On the one hand, small and medium size hospitals are unlikely to pay for those high cost techniques and the problems have fewer constraints. For this reason plus I have limit time for this study; I choose to study this problem using Constraint Programming. As mentioned in the previous section, CP can be used to effectively schedule small scale problems. From the CP model, I conduct some experiments using CHOCO and IBM ILOG OPL solver. I also make comparison of the experiment results from both solvers. Here, I choose CHOCO solver because it is open source and suitable for small and medium size hospital. Then I choose IBM ILOG OPL solver, a commercial product, with expectation that commercial product will perform better and to some distance we may need to use commercial product in case it is better.
  • 7.   6   II. Solving approach In this section, I introduce CP mathematical model for NRP. I then implement it on CHOCO and IBM ILOG CPLEX optimization studio. The NRP I have here is to assign a set of nurses to four shifts (i.e. Off, Morning, Afternoon, Night) on a period of 30 days. All nurses need to have equivalent working shifts and holiday. The schedule need 4 nurses, 2 nurses and 2 nurses for morning, afternoon and evening shifts correspondingly. In the problem, we also take previous period holiday into account in the current period so as to have balance working and holiday for all nurses. Also each nurse cannot work on the same shift for more than 2 days consecutively. Then the holiday for each nurse must spread approximately equally during the period (i.e. around 6 holidays per 30 days period with 10 nurses). a. Constraint Programming Model Different instances of the problem are defined as follows: • N: set of nurses • n: number of nurses • S: set of shift type S = {0(off), 1(morning), 2(afternoon), 3(evening)} • d: number of days during the period • P: set of shift pattern per day P = {2(Off), 4(Morning), 2(Afternoon), 2(Night)} for 10 nurses rostering • rij ∈ S: roster for day i and nurse j; i ∈ p; j ∈ n • Offseti: the number of offset which is more or less than average holiday for nurse I; i ∈ n Variables: R = {rij | i ∈ d, j ∈ n } Domains of variable: S(R) = {S(r11), …, S(rpn)}; rij ∈ S; i ∈ d; j ∈ n Constraints: § Set number of nurses per shift count(Ri, sj) = pj; ∀ i ∈ d, sj∈ S, pj ∈ P, j ∈ 3
  • 8.   7   § Set approximately 1 day off in every 5 days 5 <= 𝒓𝒊𝒋 𝟓 𝒊!𝟏 𝒏 𝒋!𝟏 <=8 5 <= 𝒓𝒊𝒋 𝟏𝟎 𝒊!𝟔 𝒏 𝒋!𝟏 <=8 5 <= 𝒓𝒊𝒋 𝟏𝟓 𝒊!𝟏𝟏 𝒏 𝒋!𝟏 <=8 5 <= 𝒓𝒊𝒋 𝟐𝟎 𝒊!𝟏𝟔 𝒏 𝒋!𝟏 <=8 5 <= 𝒓𝒊𝒋 𝟐𝟓 𝒊!𝟐𝟏 𝒏 𝒋!𝟏 <=8 5 <= 𝒓𝒊𝒋 𝟑𝟎 𝒊!𝟐𝟔 𝒏 𝒋!𝟏 <=8 § Each nurse cannot work on the same shift for more than 2 days consecutively rij != r(i+1)j ,∀ i ∈ d%2; j ∈  n   § Balance number of holiday for each nurse per period by taking previous month holiday into account 0 + Offseti <= count(𝑹𝒊 𝑻 , s0) <= 10 + Offseti § Minimize the difference between offset of each nurse Minimize Max(Offset) – Min(Offset) b. CHOCO NRP Implementation Variables & domains of variable:   Figure  1  -­‐  Variables  and  domain  variables  in  CHOCO
  • 9.   8   Constraints: § Set number of nurses per shift   Figure  2  -­‐  Constraint  on  number  of  nurses  per  shift  in  CHOCO § Set approximately 1 day off in every 5 days   Figure  3  -­‐  Constraint  on  one  day  off  every  5  working  days  in  CHOCO   § Each nurse cannot work on the same shift for more than 2 days consecutively   Figure  4  -­‐  Constraint  on  different  working  shift  in  CHOCO
  • 10.   9   § Balance number of holiday for each nurse per period by taking previous month holiday into account   Figure  5  -­‐  Constraint  on  number  of  holiday  for  each  nurse  in  CHOCO § Minimize the difference between offset of each nurse   Figure  6  -­‐  Optimize  the  objective  in  CHOCO For the whole runnable code, please go to appendix A. c. IBM ILOG OPL NRP Implementation Variables & domains of variable:   Figure  7  -­‐  Variables  and  domain  of  variables  in  IBM  ILOG
  • 11.   10   Constraints: § Set number of nurses per shift   Figure  8  -­‐  Constraint  on  number  of  nurses  per  shift  in  IBM  ILOG § Set approximately 1 day off in every 5 days   Figure  9  -­‐  Constraint  on  one  day  off  every  5  working  days  in  IBM  ILOG § Each nurse cannot work on the same shift for more than 2 days consecutively   Figure  10  -­‐  Constraint  on  different  working  shift  in  IBM  ILOG
  • 12.   11   § Balance number of holiday for each nurse per period by taking previous month holiday into account   Figure  11  -­‐  Constraint  on  number  of  holiday  for  each  nurse  in  IBM  ILOG § Minimize the difference between offset of each nurse   Figure  12  -­‐  Optimize  the  objective  in  IBM  ILOG For the whole runnable code in IBM ILOG OPL, please go to appendix B.
  • 13.   12   III. Experimental result and comparison To evaluate the models above and make comparison between commercial and free solver, I conduct four different experiments on both CHOCO and IBM ILOG OPL implementations. The results from each solver are displayed in grid; each row represents roster for each nurse and each column represents roster for each day. The intersection between row and column is the shift on the schedule where ‘M’ denotes morning shift, ‘A’ denotes afternoon shift, ‘N’ denotes night shift and ‘O’ denotes off. The column next to the last one shows the number of holiday offset for each nurse from the previous month and the last column shows the holiday offset for the current schedule. Experiment I In the first experiment, I choose the problem with 10 nurses to be assigned on 30 days period and each nurse has 0 holiday offset from previous month. Following figures show the result from both CHOCO and IBM ILOG.   Figure  13  -­‐  CHOCO  results  for  experiment  I    
  • 14.   13     Figure  14  -­‐  IBM  ILOG  result  for  experiment  I     Figure  15  -­‐  Experiment  I     Experiment II In the second experiment, I choose the problem with 10 nurses to be assigned on 30 days period with the holiday offset vary from -4 to 4 for each nurse. Following figures show the result from both CHOCO and IBM ILOG.
  • 15.   14     Figure  16  -­‐  CHOCO  result  for  experiment  II   Figure  17  -­‐  IBM  ILOG  result  for  experiment  II   Figure  18  -­‐  Experiment  II              
  • 16.   15   Experiment III In the third experiment, I increase the problem size to 12 nurses to be assigned on 30 days period and each nurse has 0 holiday offset from previous month. Following figures show the result from both CHOCO and IBM ILOG.   Figure  19  -­‐  CHOCO  result  for  experiment  III   Figure  20  -­‐  IBM  ILOG  result  for  experiment  III
  • 17.   16     Figure  21  -­‐  Experiment  III       Experiment IV In the fourth experiment, I choose the problem with 12 nurses to be assigned on 30 days period and once again the holiday offset vary from -4 to 4. Following figures show the result from both CHOCO and IBM ILOG.   Figure  22  -­‐  CHOCO  result  for  experiment  IV    
  • 18.   17     Figure  23  -­‐  IBM  ILOG  result  for  experiment  IV     Figure  24  -­‐  Experiment  IV     Discussion From the four experiments, we can see that IBM ILOG performs much better than CHOCO. IBM ILOG always find better solution and spend shorter time to computer. We cannot get perfect results from CHOCO because it always take long time to get the best results and I will just set the time limit for a while until the result is better and enough for comparison.
  • 19.   18     Figure  25  -­‐  Comparison  of  all  experiment Comparing between experiment I and III, we can find out that smaller problem could compute faster than a larger one with either free or commercial solver. Then if we take a look at experiment II and IV, we are surprised to see that the larger problem computer faster than the smaller one since the large problem allows more relaxation. Another comparson should be made either between experiment I and II or between experiment III and IV, the result shows that the problem with offset equal to zero compute faster than the one with vary offset.
  • 20.   19   IV. Conclusion and future work To conclude, the result is acceptable for small and medium size hospital. It takes time for large data set, especially with CHOCO. I believe that the model is not so efficient comparing to some recent publications with newly found algorithms but I am satisfied with the results produced since I lack both time and experience for this study. By the end of this study, I could have some preliminary idea for more works to be conducted. To continue working on this problem, I might need to optimize the model to cope with large practical data. The first idea that comes to my mind for optimizing the model is to have it on Integer Programming and possibly hybrid CP-IP model.
  • 21.   20   References [1] CHOCO, http://www.emn.fr/z-info/choco-solver/ [2] Berkeley Software Distribution [BSD], “CHOCO Documentation”, Apr. 2010. [3] International Business Machines Corporation [IBM], “IBM ILOG OPL Language User’s Manual”, 2009. [4] Rong Qu and Fang He, “A Hybrid Constraint Programming Approach for Nurse Rostering Problems”, School of Computer Science, University of Nottingham, UK. [5] Seiya Hasegawa and Yukio Kosugi, “Solving Nurse Scheduling Problem by Integer-Programming-Based Local Search”, IEEE International Conference on Systesms, Man, and Cybernetics, pp. 1474-1480, October 2006. (In Taipei, Taiwan). [6] Fang He and Rong Qu, “A Constraint Programming based Column Generation Approach to Nurse Rostering Problems”, School of Computer Science, University of Nottingham, UK.
  • 22.   21   Appendix A The following is code that I implement in CHOCO for Nurse Rostering Problem I modeled in Constraint Programming. /****************************************************************** * CHOCO * Constraint Programming Model for NRP * Author: Chhaily Moun, MSc candidate, Software Systems Engineering * Creation Date: Feb 15, 2013 *******************************************************************/ import choco.Choco; import choco.Options; import choco.cp.model.CPModel; import choco.cp.solver.CPSolver; import choco.kernel.model.Model; import choco.kernel.model.variables.integer.IntegerExpressionVariable; import choco.kernel.model.variables.integer.IntegerVariable; import choco.kernel.solver.Solver; public class NRPSolution { public NRPSolution(){ int period = 30; int numNurse = 10; final int MShift = 1; final int AShift = 2; final int NShift = 3; int []pattern = {4,4,2,2};//Off Morning Afternoon Evening int off[]={4,-4,4,4,4,-4,4,-4,-4,-4};//{0,0,0,0,0,0,0,0,0,0}; //Variable declaration String shift[] = {"O","M","A","N"}; int numShifts = shift.length-1; //Decision variable IntegerVariable[][] roster = Choco.makeIntVarArray("roster", period,numNurse, 0, numShifts); IntegerExpressionVariable [][]T = Choco.makeIntVarArray("transpose", numNurse, period); Model m = new CPModel();
  • 23.   22   // Set number of nurses per shift for(int i = 0; i < period; i++){ IntegerVariable Mocc = Choco.makeIntVar("Morning" + i, pattern[1],pattern[1]); m.addConstraint(Choco.occurrence(Mocc,(IntegerVariable[])roster[i],MSh ift)); IntegerVariable Aocc = Choco.makeIntVar("Afternoon" + i, pattern[2], pattern[2]); m.addConstraint(Choco.occurrence(Aocc,(IntegerVariable[])roster[i],NSh ift)); IntegerVariable Nocc = Choco.makeIntVar("Night" + i, pattern[3],pattern[3]); m.addConstraint(Choco.occurrence(Nocc,(IntegerVariable[])roster[i],ASh ift)); } //Constraint for changing pattern for(int i = 0; i < numNurse; i++){ IntegerVariable total = Choco.makeIntVar("shift_" + (i+1), 5, 8); m.addConstraint(Choco.eq(total,Choco.sum(roster[1][i],roster[2][i],ros ter[3][i],roster[4][i],roster[0][i]))); m.addConstraint(Choco.eq(total,Choco.sum(roster[6][i],roster[7][i],ros ter[8][i],roster[9][i],roster[5][i]))); m.addConstraint(Choco.eq(total,Choco.sum(roster[11][i],roster[12][i],r oster[13][i],roster[14][i],roster[10][i]))); m.addConstraint(Choco.eq(total,Choco.sum(roster[15][i],roster[16][i],r oster[17][i],roster[18][i],roster[19][i]))); m.addConstraint(Choco.eq(total,Choco.sum(roster[20][i],roster[21][i],r oster[22][i],roster[23][i],roster[24][i]))); m.addConstraint(Choco.eq(total,Choco.sum(roster[25][i],roster[26][i],r oster[27][i],roster[28][i],roster[29][i]))); //Make each nurse has shift changes for(int j = 0; j < period-1; j+=2){ m.addConstraint(Choco.allDifferent(roster[j][i],roster[j+1][i])); }
  • 24.   23   } for(int i = 0; i < period; i++) for(int j = 0; j < numNurse; j++){ T[j][i] = roster[i][j]; } IntegerVariable Offset[] = new IntegerVariable[numNurse]; for(int i = 0; i < numNurse; i++){ //Constraint on off days per months Offset[i] = Choco.makeIntVar("OFF",5 + off[i], 10 + off[i] ); m.addConstraint(Choco.occurrence(Offset[i],(IntegerVariable[])T[i],0); } IntegerVariable obj = Choco.makeIntVar("Obj",Options.V_OBJECTIVE); m.addVariable(obj); m.addConstraint(Choco.eq(obj, Choco.minus(Choco.max(Offset),Choco.min(Offset)))); //Create solver s Solver s = new CPSolver(); s.setTimeLimit(5040000); s.read(m); s.minimize(s.getVar(obj),true); int []cHoliday = new int[numNurse]; System.out.println("Time taken: " + s.getTimeCount()); System.out.println("Number of nurses: " + numNurse); System.out.println("Length of schedule: " + period); System.out.println("Nurse roster:"); for(int j = 0; j < numNurse; j++){ System.out.print("Nurse " + (j+1) + ": "); for(int i = 0; i < period; i++){ if(s.getVar(roster[i][j]).getVal() == 0){ cHoliday[j]+=1; } System.out.print(shift[s.getVar(roster[i][j]).getVal()]+" "); } System.out.println("t" + off[j] + "t" + (cHoliday[j] - 6 + off[j])); } } public static void main(String[]arg){ new NRPSolution(); }
  • 25.   24   }   Appendix B The following is code that I implement in IBM ILOG OPL for Nurse Rostering Problem I modeled in Constraint Programming. /********************************************* * OPL 12.4 Model * Constraint Programming Model for NRP * Author: CHHAILY * Creation Date: Feb 22, 2013 at 9:46:18 AM *********************************************/ using CP; range sRange = 0..3; string shift [sRange] = ["O", "M", "A", "N"]; int OShift = 0; int MShift = 1; int AShift = 2; int NShift = 3; int cHoliday = 0; int period = 30; int numNurse = 10; int pattern [sRange]=[4,4,2,2]; range days = 1..period; range nurses = 1..numNurse; int off[nurses]=[4,-4,4,4,4,-4,4,-4,-4,-4];//[0,0,0,0,0,0,0,0,0,0]; dvar int roster[days][nurses] in sRange; dvar int offset[nurses] in 0..30; dvar int obj; execute{ var p = cp.param; p.timeLimit = 1000; } minimize obj; subject to{ //Assign number of nurses per shift forall(i in days){ count(all(n in nurses) roster[i][n],MShift) == pattern[1]; count(all(n in nurses) roster[i][n],AShift) == pattern[2]; count(all(n in nurses) roster[i][n],NShift) == pattern[3]; } forall(n in nurses){ 4 <= sum(d in 1..5) roster[d][n] <= 8; 4 <= sum(d in 6..10) roster[d][n] <= 8; 4 <= sum(d in 11..15) roster[d][n] <= 8; 4 <= sum(d in 16..20) roster[d][n] <= 8; 4 <= sum(d in 21..25) roster[d][n] <= 8;
  • 26.   25   4 <= sum(d in 26..30) roster[d][n] <= 8; forall(d in 1..29) if(d%2 == 0) roster[d][n] != roster[d+1][n]; 5 + off[n] <= offset[n] <= 10 + off[n]; offset[n] == count(all(d in days) roster[d][n],0); } obj == max(n in nurses) offset[n] - min(n in nurses)offset[n]; } execute{ writeln("Number of resources: " + numNurse); writeln("Length of schedule: " + period); writeln("Nurse roster:"); for(n in nurses){ write("Nurse " + n + ": "); if(n<=9) write(" "); for(d in days){ write(shift[roster[d][n]] + " "); if(roster[d][n] == 0) cHoliday +=1; } writeln("t" + off[n] + "t" + (6 - cHoliday + off[n])); cHoliday = 0; } }