The Doctor Rostering Problem - Asser Fahrenholz

The Doctor Rostering Problem - Asser Fahrenholz The Doctor Rostering Problem - Asser Fahrenholz

asser.fahrenholz.dk
from asser.fahrenholz.dk More from this publisher
27.07.2013 Views

Chapter 4. Solving the DRP 27 Figure 4.6: The implementation of the schedule tests of the heuristics which should provide an indication of the performance of the heuristics. 4.4 Heuristic implementations In this section, I will briefly cover the implementation of the heuristics described in this chapter, but before doing so, it is necessary to describe the data structure of the implementation. 4.4.1 The data structure The language chosen to implement the heuristics is Java. It contains specific JDK 1.6 implementations, meaning that the runtime environment required to run the program is Java JRE 1.6, which can be downloaded from Sun.com. The fact that one goal of this project was to deliver a program allowing the end user to produce schedules and that I had no previous experience with other environments than Java, made this decision easy. The approach chosen to design the program is one where user friendliness is prioritised. It was accepted from the beginning that neither I nor the end user would appreciate a low level language implementation, such as one in C, containing no graphical user interface. The implementation is done in an object oriented approach, meaning that every schedule, shift and day is instantiated as objects. This approach is chosen due to simplicity when modeling the problem. A downside to this is that the amount of object allocations can rise quickly when testing several problem instances. The schedule is modeled as a list (a Vector) of days and days are modeled as a list (an ArrayList) of shifts. Due to constraint H4, all days contains four shifts, while certain days contains five or six. The implementation is pictured in figure 4.6.

Chapter 4. Solving the DRP 28 This model, where only a variable for each day and shift is available, is different from what is done in an optimal solver, i.e. GAMS. The difference lies in the approach of solving the problem. In my implementation, each shift object is assigned a doctor object, is chosen. In the GAMS model, a binary variable for every day, shift and doctor exists. The schedule, being the main object of the implementation also contains the methods for selecting the best doctor for a given shift or day. These two methods are included in appendix A.5. In the following sections, I describe the implementation of the construction heuristic and the metaheuristics chosen in this project. It is important to note that the implemen- tations share several methods and therefore are extending the same basic class. This allows the classes to take advantage of Javas extend, allowing the heuristics to inherit methods that they share from so called parent classes. This is depicted in figure 4.7. 4.4.2 A partial enumeration Figure 4.7: Heuristics inheritance In the construction heuristic, the option of enumerating the assignments of a whole day of shifts, as opposed to only assigning one shift at a time, is available. The enumeration algorithm produces all permutations of size k chosen from N elements and is adopted from Sedgewick and Wayne [21] (which no longer seems to be available as of the time of writing). Sedgewick and Wayne [21] originally created the class for use with characters only. I adopted it into a version permuting a list of doctor objects instead. This permutation class can be found in appendix A.5.2.

Chapter 4. Solving the DRP 28<br />

This model, where only a variable for each day and shift is available, is different from<br />

what is done in an optimal solver, i.e. GAMS. <strong>The</strong> difference lies in the approach of<br />

solving the problem. In my implementation, each shift object is assigned a doctor object,<br />

is chosen. In the GAMS model, a binary variable for every day, shift and doctor exists.<br />

<strong>The</strong> schedule, being the main object of the implementation also contains the methods<br />

for selecting the best doctor for a given shift or day. <strong>The</strong>se two methods are included in<br />

appendix A.5.<br />

In the following sections, I describe the implementation of the construction heuristic and<br />

the metaheuristics chosen in this project. It is important to note that the implemen-<br />

tations share several methods and therefore are extending the same basic class. This<br />

allows the classes to take advantage of Javas extend, allowing the heuristics to inherit<br />

methods that they share from so called parent classes. This is depicted in figure 4.7.<br />

4.4.2 A partial enumeration<br />

Figure 4.7: Heuristics inheritance<br />

In the construction heuristic, the option of enumerating the assignments of a whole day<br />

of shifts, as opposed to only assigning one shift at a time, is available. <strong>The</strong> enumeration<br />

algorithm produces all permutations of size k chosen from N elements and is adopted<br />

from Sedgewick and Wayne [21] (which no longer seems to be available as of the time of<br />

writing). Sedgewick and Wayne [21] originally created the class for use with characters<br />

only. I adopted it into a version permuting a list of doctor objects instead. This<br />

permutation class can be found in appendix A.5.2.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!