# A Bayesian Optimisation Algorithm for the Nurse Scheduling Problem

Abstract: A Bayesian optimization algorithm for the nurse scheduling problem is presented, which involves choosing a suitable scheduling rule from a set for each nurse’s assignment. Unlike our previous work that used GAs to implement implicit learning, the learning in the proposed algorithm is explicit, i.e. eventually, we will be able to identify and mix building blocks directly. The Bayesian optimization algorithm is applied to implement such explicit learning by building a Bayesian network of the joint distribution of solutions. The conditional probability of each variable in the network is computed according to an initial set of promising solutions. Subsequently, each new instance for each variable is generated by using the corresponding conditional probabilities, until all variables have been generated, i.e. in our case, a new rule string has been obtained. Another set of rule strings will be generated in this way, some of which will replace previous strings based on fitness selection. If stopping conditions are not met, the conditional probabilities for all nodes in the Bayesian network are updated again using the current set of promising rule strings. Computational results from 52 real data instances demonstrate the success of this approach. It is also suggested that the learning mechanism in the proposed approach might be suitable for other scheduling problems.

## Summary (3 min read)

### 1 Introduction

- After much practice, the scheduler gradually masters the knowledge of which solution parts go well with others.
- As a model of the selected strings, a Bayesian network (Pearl 1998) is used in the proposed Bayesian optimization algorithm to solve the nurse scheduling problem.
- The conditional probabilities are computed according to an initial set of promising solutions.
- Subsequently, each new instance for each node is generated by using the corresponding conditional probabilities, until values for all nodes have been generated, i.e. a new rule string has been generated.

### 2.1 General Problem

- These schedules have to satisfy working contracts and meet the demand for a given number of nurses of different grades on each shift, while being seen to be fair by the staff concerned.
- Thus scheduling the different grades independently is not possible.
- Furthermore, the problem has a special day-night structure as most of the nurses are contracted to work either days or nights in one week but not both.
- The latter two characteristics make this problem challenging for any local search algorithm, because finding and maintaining feasible solutions is extremely difficult.
- For each nurse i and each shift pattern j all the information concerning the desirability of the pattern for this nurse is captured in a single numeric preference cost pij.

### 2.2 Integer Programming

- Note that the definition of qis is such that higher graded nurses can substitute those at lower grades if necessary.
- Thus, the Integer Programming formulation has about 12000 binary variables and 100 constraints.
- Some problem cases remain unsolved after overnight computation using professional software.

### 3 Graphical Models and Bayesian Networks

- The authors introduce concepts from graphical models in general and Bayesian networks in particular.
- They provide a natural tool for dealing with uncertainty and complexity that occur throughout applied mathematics and engineering.
- There are two main kinds of graphical models: undirected and directed.
- The number of such events is exponential.
- To achieve compactness, Bayesian networks factor the joint distribution into local conditional distributions for each variable given its parents.

### 4.1 The Construction of a Bayesian Network

- In their nurse scheduling problem, the number of the nurse is fixed (up to 30), and the target is to create a weekly schedule by assigning each nurse one shift pattern in the most efficient way.
- Due to human limitations, these rules are typically simple.
- Nevertheless, human generated schedules are of high quality due to the ability of the scheduler to switch between the rules, based on the state of the current solution.
- The authors envisage the Bayesian optimisation algorithm to perform this role.
- In their particular implementation, an edge denotes a construction unit (or rule sub-string) for nurse i where the previous rule is j and the current rule is j’.

### 4.2 Learning based on the Bayesian Network

- According to whether the structure of the model is known or unknown, and whether all variables are fully observed or some of them are hidden, there are four kinds of learning (Heckerman 1998).
- In the proposed approach, learning amounts to counting and hence the authors use the symbol ‘#’ meaning ‘the number of’ in the following equations.
- Since the first rule in a solution has no parents, it will be chosen from nodes N1j according to their probabilities.
- Since all the probability values are normalized, the roulette-wheel method is good strategy for rule selection.
- Because pure low-cost or random allocation produces low quality solutions, either rule 1 is used for the first 2-3 nurses and rule 2 on remainder or vice versa.

### 4.3 A Bayesian Optimization Algorithm

- Based on the estimation of conditional probabilities, this section introduces a Bayesian optimization algorithm for the nurse scheduling problem.
- It uses techniques from the field of modelling data by Bayesian networks to estimate the joint distribution of promising solutions.
- New rule strings are generated by using these conditional probability values, and are added into the old population, replacing some of the old rule strings.
- If the termination conditions are not met (the authors use 2000 generations), go to step 2.

### 4.4 Four Building Rules

- As far as the domain knowledge of nurse scheduling is concerned, the following four ru les are currently investigated.
- Due to the nature of this approach, nurses’ preference costs pij are not taken into account by this rule.
- The fourth rule, called ‘Contribution’ rule, is biased towards solution quality but includes some aspects of feasibility by computing an overall score for each feasible pattern for the nurse currently being scheduled.
- This is achieved by going through the entire set of feasible shift patterns for a nurse and assigning each one a score.
- The one with the highest (i.e. best) score is chosen.

### 4.5 Fitness Function

- Independent of the rules used, the fitness of completed solutions has to be calculated.
- Therefore, the authors still need a penalty function approach.
- Since the chosen encoding automatically satisfies constraint set (3) of the integer programming formulation, the authors can use the following formula, where wdemand is the penalty weight, to calculate the fitness of solutions.
- Note that the penalty is proportional to the number of uncovered shifts. (9).

### 5 Computational Results

- The authors present the results of extensive computer experiments and compare them to results of the same data instances found previously by other algorithms.
- Table 1 lists the full and detailed computational results of 20 runs with different random seeds, where N/A indicates no feasible solution was found.
- Figures 2 summarises this information, Figure 3 shows a single typical run and finally Figure 4 gives an overall comparison between various algorithms.

### 5.1 Details of Algorithms

- The value of three units was chosen as it corresponds to the penalty cost of violating the least important level of requests in the original formulation.
- Thus, these solutions are still acceptable to the hospital.
- The executing time of the algorithm is approx.
- At this stage, there are based on their experience and intuition.
- When computing the mean a censored cost value of 255 has been used when an algorithm failed to find a feasible solution (N/A).

### 5.2 Analysis of Results

- Comparing the computational results on various test instances , one can see that using the random rule alone does not yield a single feasible solution.
- This underlines the difficulty of this problem.
- In addition, without learning the conditional probabilities, the results are much weaker, as the CP column shows.
- Thus, it is not simply enough to use the four rules to build solutions.
- Overall, the Bayesian results found rival those found by the complex multi-population GA.

### 6 Conclusions

- The approach is novel because it is the first time that Bayesian networks have been applied to the field of personnel scheduling.
- An effective method is proposed to solve the problem about how to implement explicit learning from past solutions.
- Unlike most existing approaches, the new approach has the ability to build schedules by using flexible, rather than fixed rules.
- Experimental results from real-world nurse scheduling problems have demonstrated the strength of the proposed Bayesian optimization algorithm.
- The proposed approach mimics human behaviour much more strongly than a standard GA based scheduling system.

Did you find this useful? Give us your feedback

...read more

##### Citations

165 citations

107 citations

77 citations

71 citations

65 citations

##### References

15,149 citations

1,867 citations