Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Nurse Rostering

The Nurse Rostering sample is based on the benchmark information as well as public data sets referred to here. The sample defines an atom array where rows correspond to nurses, columns are days, and atom states are shift types. There are numerous constraints and objectives, all described in the aforementioned benchmark paper. Thus, it is recommended the paper be used as a guide to understanding the sample.

In the samples directory:

  • nurseDB contains five instances of raw CSV data files that describe the number of nurses, days, etc. These would be generated by an upstream HR system, for example.
  • nurseProb contains the problem definition (nurse.json) and a subdirectory called dyndata which contains the CSV data converted into arrays that are referred to by the problem definition.
  • In the Python sample tester (azopytest), the nurse directory contains the python code for converting the raw data files into the arrays.

Next is a sample run via azopytest.

Python sample tester (azopytest) command line parameters:

--run release --itest nurse --tc 1536 --ss 607 --st 60 --nurseinst 3

Output:

** Problem Results **
---------------------
A:   DDD  DDD  DD
B:  DDDD  DL  LLL
C: L  EL  EED  LL
D:  EL  EEL  LL  
E: EEE  EEE  EE  
F:  DDDD  EEE  ED
G: LLL  DL  EEE  
H: E  EELL  LLL  
I:   EDL   EL  ED
J: DD  DDDD  DD  
K:  EDD   DDDDDD 
L:  LLL    DDDDDD
M:   EE    EEDLLL
N: DDDLLL   DD   
O: LL   DDDLL    
P:     DDD  L    
Q:     L  L    DD
R: D    ED  E    
S:     EEEE      
T:    E   DD   D 

** Solver Results **
--------------------

Score  : 	1442.0
Stop   : 	2
Time   : 	60.975

R Count: 	20
T Count: 	14
S Count: 	4

Atoms: 
[ 
	[0, 0, 2, 2, 2, 0, 0, 2, 2, 2, 0, 0, 2, 2],
	[0, 2, 2, 2, 2, 0, 0, 2, 3, 0, 0, 3, 3, 3],
	[3, 0, 0, 1, 3, 0, 0, 1, 1, 2, 0, 0, 3, 3],
	[0, 1, 3, 0, 0, 1, 1, 3, 0, 0, 3, 3, 0, 0],
	[1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 0],
	[0, 2, 2, 2, 2, 0, 0, 1, 1, 1, 0, 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