You are on page 1of 103

Department of Business Administration Chair for Quantitative Business Administration

Solving a Large Scale Integer Program with Open-Source-Software

Master thesis
Submitted at the University of Zurich Faculty of Economics, Business Administration and IT Degree program Master of Arts in Business Administration

Author:

Bernhard Aeschbacher Blumenaustrasse 35 8645 Jona 01-122-407

Examiner:

Prof. Dr. K. Schmedders Chair for Quantitative Business Administration

Zurich, August 23, 2012

Executive summary
Large linear and integer programs with thousands of variables and constraints are usually solved by algebraic model languages. OpenSolver is newly available open-source-software. It is an add-in in Microsoft Excel and promises to solve large scale linear and (mixed) integer programs. In order to verify the practical suitability of OpenSolver, a large mixed integer program is implemented in Excel and solved with OpenSolver. The model is about scheduling five physicians at an emergency department in a hospital. It contains approximately 1,900 variables and 5,700 constraints. OpenSolver is able to solve the model and provides an optimal solution in less than five minutes. The open-source applet even provides optimal results for a model expansion for up to eight physicians. OpenSolver is perfectly suited for problems with several hundred decision variables and constraints. For larger problems, the spreadsheet is getting complex, since every single variable and constraint is represented by a cell. Optimization problems in practice often contain tens of thousands variables and constraints. For these models, an algebraic model language like GAMS is clearly advantageous compared to OpenSolver. Building schedules in hospitals is still made manually, which leads to suboptimal schedules. It is not yet common to use integer programming for scheduling staff. Future work could entail a newly built tool that enables schedule planners to integrate integer programming in their daily business.

Keywords: Mixed integer programming, staff scheduling, OpenSolver.

Task formulation
Aufgabenstellung: Lineare und ganzzahlige Optimierungsprobleme mit tausenden von Variablen und Nebenbedingungen knnen blicherweise nur mit algebraischen Modellsprachen wie AMPL oder GAMS gelst werden. Die Algorithmen des Excel "Solver" knnen solche grossen Probleme nicht lsen. Nun verspricht die Open-Source Software "OpenSolver" ebenfalls grosse Probleme in Excel lsen zu knnen. Im Rahmen dieser Arbeit soll diese Behauptung anhand eines grossen Anwendungsproblems untersucht werden. Die verschiedenen Lsungsmethoden in unterschiedlichen Softwaresystemen sollen betrachtet und Vor- und Nachteile kritisch diskutiert werden. Ein grosses Optimierungsproblem soll detailliert vorgestellt und mit verschiedener Software gelst werden. Darber hinaus soll eine umfangreiche Sensitivittsanalyse vorgenommen werden. Eine Betrachtung, ob die Open-Source Software fr Excel die Versprechungen hlt, soll die Arbeit abschliessen.

II

Table of content
Executive summary ..................................................................................................................... I Task formulation ....................................................................................................................... II Table of content ........................................................................................................................ III List of figures ........................................................................................................................... VI List of tables ............................................................................................................................VII List of acronyms .................................................................................................................... VIII 1 2 Introduction: Scheduling staff as a mixed integer linear program ..................................... 1 Literature on scheduling staff ............................................................................................. 2 2.1 2.2 2.3 3 Constraint classification .............................................................................................. 2 Schedule types ............................................................................................................. 3 Solution approaches for scheduling problems ............................................................. 4

An overview of mixed integer programming ..................................................................... 7 3.1 3.2 3.3 3.4 3.5 A short clean-up of optimization terms ....................................................................... 7 The crux of mixed integer programming ..................................................................... 8 Branch and bound algorithm ..................................................................................... 11 Cutting planes method ............................................................................................... 14 Sensitivity analysis .................................................................................................... 15 Changing the objective function coefficients ..................................................... 15 Changing the right hand side of a constraint ...................................................... 16 Sensitivity analysis in mixed integer programming ........................................... 18

3.5.1 3.5.2 3.5.3 4

The scheduling model ...................................................................................................... 19 4.1 Introduction to the scheduling model ........................................................................ 19 Compulsory rules ............................................................................................... 19 Flexible rules ...................................................................................................... 19

4.1.1 4.1.2

III

4.2

Model formulation ..................................................................................................... 20 Sets ..................................................................................................................... 20 Variables............................................................................................................. 20 Objective function .............................................................................................. 22 Constraints .......................................................................................................... 22

4.2.1 4.2.2 4.2.3 4.2.4 4.3

Reformulations .......................................................................................................... 31 Fusing equations ................................................................................................. 31 Reformulation of equations (29) to (44) and (46) to (50) by avoiding the

4.3.1 4.3.2

auxiliary variables ............................................................................................................ 32 4.3.3 4.3.4 4.4 4.5 5 Missing constraints in the original model .......................................................... 36 Avoiding the proportion parameters in equation (11) ........................................ 38

Model expansion for up to eight physicians .............................................................. 39 Symmetry................................................................................................................... 41

Tools used to solve the scheduling problem .................................................................... 42 5.1 5.2 Excel and OpenSolver ............................................................................................... 42 GAMS and NEOS Server .......................................................................................... 42

Results .............................................................................................................................. 44 6.1 6.2 6.3 6.4 LP relaxation.............................................................................................................. 44 Excel and OpenSolver ............................................................................................... 44 GAMS code and NEOS Server ................................................................................. 45 Sensitivity analysis .................................................................................................... 46 Changing the objective function coefficients ..................................................... 47 Changing the right hand side of a constraint ...................................................... 47

6.4.1 6.4.2 6.5 6.6 6.7 7

Model expansion for up to eight physicians .............................................................. 50 A comparison of OpenSolver and GAMS ................................................................. 51 The auxiliary variables are not helpful ...................................................................... 52

Conclusion: OpenSolver perfectly fits for medium-sized integer programs.................... 54

IV

Outlook: A broader dissemination of mixed integer programming for scheduling ......... 55

List of References..................................................................................................................... 56 Appendix .................................................................................................................................. 58 GAMS code .......................................................................................................................... 58 Original formulation ......................................................................................................... 58 Reformulation................................................................................................................... 62 Expansion up to eight physicians ..................................................................................... 65 Schedules calculated with GAMS and NEOS Server for up to eight physicians ............ 67 Excel spreadsheet (excerpt) .................................................................................................. 68 Original formulation ......................................................................................................... 68 Reformulation................................................................................................................... 73 Expansion for up to eight physicians ............................................................................... 77 Using NEOS Server ............................................................................................................. 81 Installation hints for OpenSolver ......................................................................................... 84 Using OpenSolver ................................................................................................................ 85 E-Mail exchange with Yann Ferrand ................................................................................... 88 Avoided constraints due to reformulation ............................................................................ 92 Statutory declaration ................................................................................................................ 93

List of figures
Figure 1: LP feasible region, objective function and corner point solution ............................. 10 Figure 2: LP feasible region and optimal IP solution............................................................... 11 Figure 3: Branch and bound algorithm (source: Pochet & Wolsey, 2006, p. 87). ................... 12 Figure 4: Cutting plane (source: Trick, 1998). ......................................................................... 15 Figure 5: Changing an objective function coefficient (source: Bisschop, 2011). .................... 16 Figure 6: Relaxing the right hand side of a constraint (source: Bisschop, 2011). ................... 17 Figure 7: Illustration of the allowable range for a constraint's RHS. ....................................... 17 Figure 8: Screenshot of NEOS Server with solvers available for IP and MILP. ..................... 81 Figure 9: The input page on NEOS server. .............................................................................. 82 Figure 10: Solver screen of NEOS with job-number and password for a query. ..................... 82 Figure 11: Main screen of NEOS Server with the query option. ............................................. 83 Figure 12: Query screen on NEOS. .......................................................................................... 83 Figure 13: The Open solver module in the data tab (left) and solve options. .......................... 85 Figure 14: Model dialog box. ................................................................................................... 86 Figure 15: OpenSolver emphasizes in color the model............................................................ 86 Figure 16: OpenSolver menu with Quick Solve. ..................................................................... 87

VI

List of tables
Table 1: Input parameters for the workload and lower and upper bound on the number of shifts (source: Ferrand et al., 2011). ......................................................................................... 24 Table 2: Variable analysis for equations (29) to (31)............................................................... 27 Table 3: Variable analysis for equations (33) to (36)............................................................... 28 Table 4: Variable analysis for equations (37) to (39)............................................................... 29 Table 5: Variable analysis for equation (40). ........................................................................... 29 Table 6: Possible variable combinations in equation (44). ...................................................... 30 Table 7: Variable analysis and corresponding LHS for equation (15r). .................................. 32 Table 8: Variable analysis and resulting LHS for equation (29r). ........................................... 33 Table 9: Variable analysis and resulting LHS for equation (33r). ........................................... 34 Table 10: Variable analysis and LHS for equation (37r). ........................................................ 34 Table 11: Variable Analysis and resulting LHS for equation (46r). ........................................ 36 Table 12: Simplified model for the expansion for up to eight physicians ............................... 40 Table 13: Schedule with the original model............................................................................. 44 Table 14: Schedule with the modified formulation. ................................................................. 45 Table 15: Schedule with the original model calculated with GAMS and NEOS Server. ........ 46 Table 16: Schedule with the reformulated model calculated with GAMS and NEOS Server. 46 Table 17: Sensitivity analysis of the workload (source: own research). .................................. 48 Table 18: Sensitivity analysis of the proportion of shifts (source: own research). .................. 49 Table 19: Schedule calculated with OpenSolver for six physicians. ....................................... 50 Table 20: Schedule calculated with OpenSolver for seven physicians. ................................... 51 Table 21: Schedule calculated with OpenSolver for eight physicians. .................................... 51 Table 22: Schedule for six physicians. ..................................................................................... 67 Table 23: Schedule for seven physicians. ................................................................................ 67 Table 24: Schedule for eight physicians. ................................................................................. 67 Table 25: Number of constraints in the original and modified version. .................................. 92

VII

List of acronyms
AMPL CBC CP COIN-OR GAMS GDX IP LHS LP MILP MIP NEOS OFC OR/MS RHS A Mathematical Programming Language COIN Branch and Cut Constraint Programming COmputational INfrastructure for Operations Research General Algebraic Modeling System Gams Data Exchange Integer Program Left Hand Side (of an equation) Linear Program Mixed Integer Linear Program Mixed Integer Program Network-Enabled Optimization System Objective Function Coefficient Operations Research and Management Science Right Hand Side (of an equation)

VIII

1 Introduction: Scheduling staff as a mixed integer linear program


Large linear and integer programs with thousands of variables and constraints are usually solved by algebraic model languages such as AMPL (A Mathematical Programming Language) or GAMS (General Algebraic Modeling System). The standard solver in Microsoft Excel is unable to solve problems of this dimension since it is limited to 200 variables.1 In 2011, the open-source-software OpenSolver was published.2 It promises to solve large scale linear and integer programs. One main objective of the present thesis is to test whether OpenSolver is useful for practical applications. For this purpose, a staff scheduling model with approximately 1,900 variables and 5,700 constraints is implemented in an Excel spreadsheet and solved with OpenSolver. In order to verify the results obtained with OpenSolver, the schedule is implemented in a conventional GAMS-model. The scheduling model used in this thesis is described in an article by Ferrand et al. (2011). The article was published in Interfaces, a journal on operations research and management science (OR/MS) focusing on practical applications to decisions and policies in organizations and industries. The model is about scheduling physicians in a newly opened emergency department of the Cincinnati Children's Hospital Medical Center. In the past, schedules were built around the requests for time off. The schedule planner used a web-based scheduling tool3 which provides a simple framework, but is unable to account for regulatory constraints. Hence the planner had to verify all constraints manually. The human brain is unable to consider a large bunch of rules simultaneously. The optimization approach in operations research shall help the planner to overcome these limitations by computing power. The reminder of this thesis is as follows: Section 2 provides an overview of the literature on scheduling staff. Chapter 3 gives an introduction to mixed integer programming (MIP) and section 4 presents the scheduling model. Section 5 introduces the two software tools used, namely OpenSolver and GAMS. The resulting schedules are presented in section 6. The thesis closes with a conclusion in chapter 7 and an outlook in chapter 8.

1 2

For further information about Frontline Solver for Excel see http://www.solver.com/excel2010/solverhelp.htm. Unfortunately, OpenSolver does not run with OpenOffice Calc, which is the open-source alternative to Microsoft Excel. For further information on OpenSolver see http://opensolver.org/. 3 More information about the scheduling tool on www.peakesoftware.com.

2 Literature on scheduling staff


Scheduling staff is a widely spread issue, especially in businesses with shift work, such as in hospitals, public transport or security. There are much more publications on nurse scheduling than on physician scheduling in the literature about hospital scheduling. The reason for this imbalance is that nurses usually work under a collective agreement, while physicians' schedules consider also their individual satisfaction (Gendreau et al., 2007). The latter requires more manual work and is therefore less suitable for scientific debates. Developing a schedule manually is hard work: When a planner wants to assign a particular shift, it may happens that none of the physicians available can be assigned without violating compulsory rules. The planner has to backtrack over previous assignments. He is possibly satisfied with a suboptimal solution, even though it violates some flexible rules (Beaulieu et al., 2000). Scheduling literature supports the planners to build attractive schedules.

2.1 Constraint classification


In many schedules, there are compulsory (or hard) and flexible (or soft) rules which are occasionally in conflict with each other (Gendreau et al., 2007). Flexible rules are constraints that are desirable to be fulfilled. Due to the occasional conflicting nature of these rules, some of the soft rules are violated in order to build a feasible schedule. In contrast, compulsory constraints must be fulfilled, otherwise the schedule becomes infeasible. It is important for the schedule planner to create an attractive schedule. In consequence, job satisfaction and productivity increase and absences may reduce (Brunner, 2010). An attractive schedule is tantamount to violate as little flexible rules as possible. Gendreau et al. (2007) distinguish four types of constraints in scheduling models: 1. Supply and demand constraints 2. Workload constraints 3. Fairness constraints 4. Ergonomic constraints The supply is given by the availability of the hired physicians. On the other hand, there is a demand for physicians. The demand is either uniform, where the required number of staff is the same for every shift, or non-uniform, where the required number of physicians differs, e.g. on weekends. The scheduling model in chapter 4 does not deal with demand modeling, since the demand in the emergency department is exactly one physician per shift. Moreover, if a

shift is not covered, a physician of another department steps into the breach. In the case of two physicians assigned for one shift, one of them renders his service in another hospital department. Constraints about workload ensure that every physician is assigned to the right number of shifts within a specific interval, also considering part-time employment. Fairness constraints ensure a fair distribution of different types of shifts among physicians with the same experience. Senior physicians may have more freedom and benefits regarding the schedule. They often work fewer weekends and night shifts than younger physicians. Last but not least, there are the ergonomic constraints considering the physicians' health. One example is an upper limit for consecutive overnight shifts. Too short intervals between two shifts should be avoided as well. There is at least 16 hours of rest time between two shifts. In addition, physiological research has shown that it is easier for the human body to cope with a clockwise rotation of the shifts (forward rotation) rather than with a counterclockwise change (Whitehead, Thomas & Slapper, 1992): Day shifts should be followed by evening shifts, and evening shifts by night shifts. It would be best for the circadian rhythm not to change the shifts at all.

2.2 Schedule types


Most schedules imply three different shifts, particularly day, evening and night shifts. Some schedules even use flexible starting times and shift lengths (e.g. in Brunner, 2010), which complicates the process of building a satisfying schedule. The succession of shifts is cyclic or acyclic. Carter and Lapierre (2001) distinguish between acyclic schedules, cyclic schedules with rotation and without rotation. An acyclic schedule has no repeating patterns and is built from scratch for every period. Therefore, it is easy for the schedule planner to consider specific requirements such as the physicians' vacation and requests for days off. A cyclic schedule with rotation consists of a several weeks lasting pattern of shifts. Every physician works the same succession of shifts, each starting at a different day of the schedule, usually with seven days in between. Also the cycle duration has to be divisible by seven in regarding to specific weekend assignments. Once a physician reaches the end of the cycle; he starts at the beginning again. A drawback of a cyclic schedule is that it cannot take into account personal preferences. But it is fair in the way that all physicians work the same sequences.

A cyclic schedule without rotation deals with personal preferences, since each physician repeats his individual cycle. The scheduling model in chapter 4 is a cyclic schedule without rotation, because not all physicians work the same number of shifts. Also the shift patterns differ among the physicians. Exceptional impacts such as holidays and day off requests cause manual adjustments, even in automatically generated schedules. A vacation can easily be inserted by adding an additional constraint, which assures that during the vacation all decision variables of the corresponding physician remain zero. As a consequence, the total number of shifts per cycle must be reduced, according to the physician's workload. Further adjustments may be required; for example a reduction of the number of weekend shifts per cycle.

2.3 Solution approaches for scheduling problems


Gendreau et al. (2007) list the four most widely used solution approaches for scheduling problems: 1. Mathematical programming 2. Column generation 3. Tabu search 4. Constraint programming The mathematical programming includes mixed integer linear programming (MILP). It is the optimization of an objective function subject to constraints. The objective of a scheduling problem is to minimize the sum of penalties caused by violated soft constraints, also known as deviation variables. Unfortunately, solving a large MILP can be highly time-consuming, even with actual solvers and computers (see chapter 3.2). The scheduling model in chapter 4 is a MILP. A very similar problem is described in Beaulieu et al. (2000): Working rules are translated into constraints. These constraints are all linear equalities or inequalities. The objective function contains a weighted sum of all deviations from the soft constraints. The goal is to minimize this sum. An important issue in the model is the large dimension with 40,000 variables and 75,000 constraints, which seems to be impractically large. To overcome this problem, the authors solve six four-week schedules instead of the six month schedule at once. Every four-week model is not independently solved, but it takes into consideration the schedules in the previous months. Even with this diminishment, they are not able to find a feasible solution due to the conflicting nature of some constraints.

Hence, they introduce heuristic approaches by identifying constraints that are in conflict with each other. These constraints are removed from the model. If a feasible solution is obtained without the conflicting constraints, they are reintroduced with a less restrictive formulation: The constraints are relaxed by changing its right hand side (RHS). At the end of the day, the authors in Beaulieu et al. (2000) are able to construct better schedules compared to the manual work of the planner. This example shows that some ingenuity is necessary to solve large MILP models. Another solution technique to overcome problems of solving large MILP is the column generation method: A large, complex problem is approached by a simpler and smaller auxiliary problem, also known as the master problem. This master problem only contains a few variables and/or constraints. After solving the master problem, it is analyzed which of the variables not yet included in the master problem improve the result most. These variables are added to the problem and so forth. The process is repeated until a satisfactory solution is found. The tabu search, a technique for solving hard combinatorial problems, is a local search technique. It starts from an initial feasible solution, which is found by an appropriate heuristic or randomly. The algorithm is searching for better solutions in the neighborhood of the initial solution. There are at least two stumbling blocks about local search algorithms like tabu search: Cycling around some feasible solutions has to be prevented. This is easily achieved by keeping a tabu list with the previous solutions. These solutions are no longer valid for future iterations. And the algorithm must not stop at an optimal solution which is only locally optimal. Constraint programming (CP) has emerged from artificial intelligence research. CP comprises variables and constraints, exactly like mathematical programming. The constraints restrict the values that the variables can take simultaneously. The goal of CP is to find a feasible variable combination that satisfies all constraints (Tsang, 2006). CP provides some very useful and unique tools. One of them is the "alldifferent"-constraint: Every variable involved must take a different value. This property is also achievable with mathematical programming, but the implementation is more complex. The main focus in CP is on the feasibility of a solution, namely all constraints must be met. In contrast, mathematical programming goes one step further: The goal is not only a feasible, but rather an optimal or almost optimal solution. CP is usually faster in finding a feasible solution

compared to mathematical programming, but it is not very efficient in finding an optimal solution. For a more detailed overview about the different solution approaches for scheduling, Ernst et al. (2004a and 2004b) composed an extensive bibliography containing reviews of more than 700 articles on computational methods of rostering and personnel scheduling, including schedules for nurses and physicians.

3 An overview of mixed integer programming


This chapter employs an overview on solution strategies used by popular solvers for mixed integer programming (MIP), namely the branch and bound algorithm and the cutting plane method. The chapter also provides an introduction in the sensitivity analysis. Before focusing on solving strategies for MIP, a short clean-up of the terms in optimization may be useful.

3.1 A short clean-up of optimization terms


MIP is a subtype of linear programming (LP or linear optimization). The most important attribute of a LP is that all equations are linear. Conversely, non-linear optimization (NLP) includes also non-linear equations and is harder to solve. A LP has the following standard form:

Or in an explicit form:

A LP may diverge from the standard form above. The scheduling model in chapter 4 describes a minimization problem instead of maximization problem. Some constraints may be defined with larger or equal () or with equality (=). Or the variables are permitted to take a negative value. The LP above maximizes the value of the objective function, also known as z-value. Assuming a company wants to optimize its profit, then the objective function represents the company's profit function. The vector x contains the variables x1, x2, xn. Every variable xi stands for a different product. Vectors b and c consist of known parameters. The constraints repre-

sent the different production divisions j. Parameter bj is an upper budgetary (or time or another scarce resource) bound of division j. Coefficient ci in the objective function stands for the revenue per product xi produced. The coefficients in matrix A are the production costs per item produced in the production divisions. The produced items times production costs must be lower or equal to the budget for each division. The coefficients are exogenously given and are not changed during the optimization. This is the task of the sensitivity analysis. The only changeable numbers for the optimization process are the decision variables in vector x. It is impossible to produce a negative quantity, hence the variables xi are usually constrained to be non-negative, all xi are larger or equal to zero. Moreover, it is usually not practical to produce a fraction of a product (e.g. half a ship). To overcome this problem in case the optimal solution delivers fractional values, the variables xi can be constrained to be integer ( ). The resulting problem is an integer program (IP) or integer linear program (ILP).

The solution space of an IP is non-convex and therefore much more difficult to solve compared to a convex LP. In some problems, all decision variables xi are either 0 or 1. This is a binary integer program (BIP), which is a sub-category of IP. Finally, there is the case where some of the variables are constrained to be integers, others may accept real numbers. This combination is a mixed integer program (MIP) or mixed integer linear program (MILP). MIP is a sub-category of IP. Solvers struggle with the same difficulties in both MIP and IP; hence both acronyms are subsequently used as synonyms. The scheduling model in chapter 4 is a MIP, including both binary and real variables.

3.2 The crux of mixed integer programming


The basic idea of the scheduling model in chapter 4 is to introduce a binary variable for every shift: There are three shifts (namely day, evening and overnight shifts) times 56 days in the eight week cycle times five physicians, which is a total of 840 binary variables. A variable with value 1 means that the particular shift is serviced by the correspondent physician. A value 0 means that the physician does not work the particular shift. At first sight, it seems to be an easy task to set a bulk of binary variable to either 0 or 1. Furthermore, an IP is always a subproblem with a finite number of feasible solutions of its corresponding LP with infinitely many solutions. For this reason, it should be easy to solve such a problem. But the sheer number of alternatives to set 840 binary variables is causing a serious headache: There are

(this is a 7 followed by 252 zeros!) different alternatives with 840 binary variables. A lot of these alternatives are not feasible solutions because they do not fulfill all constraints, but this must be verified first. The task of solving an IP is getting even more complicated if the decision variables are pure integers and may take a value other than 0 or 1. There are different approaches to solve an IP. One approach is the complete enumeration, where the objective function values for all feasible alternatives are calculated are compared with each other. In the end, the best alternative is chosen. The complete enumeration is not very promising considering the large number of alternatives. It is smarter to solve the LP relaxation of an IP first. The LP relaxation is the IP without the integer constraint for the decision variables. Even for fairly large LPs with several thousand variables and constraints, current solvers are able to find an optimal solution for the LP relaxation within seconds. If there is only one optimal solution for the relaxation, LP theory shows that it must be a corner point solution. A corner point is the intersection of two or more constraints. If there are multiple optimal solutions, then at least two are adjacent corner points, connected by an edge representing a constraint. Figure 1 is a maximization problem and indicates why the optimal point is always a corner point solution: The feasible region is within the grey area and formed by the following constraints:

The three parallel lines represent the objective function with different z-values. The higher the line, the higher is the z-value. Hence the optimal solution is the corner point (2, 6). If the objective function was parallel to a constraint (e.g. between the two corner points (2, 6) and (4, 3) would be optimal. ), then all points on the line

Figure 1: LP feasible region,4 objective function and corner point solution (source: Hillier & Lieberman, 2001, p. 29).

The simplex method, presented by Dantzig in 1947 (Dantzig, 1954) takes advantage of this property and starts at a feasible corner point, if possible at the origin (e.g. all decision variables equal to 0; but the origin is not always a part of the feasible region). Then it moves to the adjacent corner point feasible solution with the best z-value. The simplex method ends with the optimality test: A corner point feasible solution is optimal, if no better adjacent corner point is found (Hillier & Lieberman, 2001). With some luck, the LP relaxation delivers an integer solution which is at the same time optimal for the IP. Therefore, a solver always solves the LP relaxation first, before starting the drudgery of solving an IP. Normally, the solution obtained by the LP relaxation contains fractional variables. The simplest idea to receive an integer solution is to round the fractional variables. Unfortunately, one may quit the feasible region by rounding the variables. It is also possible that the optimal IP

All illustrations in this thesis are two dimensional with only two decision variables. The feasible region is a plane. This is a simplification of practical n-dimensional linear programs with a polyhedral feasible region. Furthermore, it is rather clumsy that all illustrations show maximization problems while the thesis is about a minimization problem.

10

solution is not in the neighborhood of the optimal solution of the LP relaxation. This is another bad scenario that shows that rounding is not always expedient. Figure 2 illustrates the latter scenario.

Figure 2: LP feasible region and optimal IP solution (source: Hillier & Lieberman, 2001, p. 603).

Two more promising approaches are the branch and bound algorithm and the cutting planes method. Today's solvers work with a combination of these algorithms in order to solve an IP. The above mentioned LP relaxation is the starting point for both approaches. The solution of the LP relaxation (often denoted as x*) provides a lower bound in a minimization problem (or an upper bound in a maximization problem) for the IP. The IP solution cannot take a better value than its LP relaxation.

3.3 Branch and bound algorithm


The feasible points of an IP form a subset of the feasible region of its LP relaxation. Therefore, the optimal z-value of the LP relaxation provides a lower bound for the optimal z-value of the IP in a minimization problem.5 If a LP relaxation is either infeasible or unbounded, consistently the corresponding IP is infeasible or unbounded (Atamtrk & Savelsbergh, 2005). The branch and bound algorithm is a decision tree, where the nodes of the tree represent subproblems. The top node (or root node) is the LP relaxation of the original IP. The branch-and5

The subsequent reasoning about the lower and upper bound is about a minimization problem. In maximization, the lower and upper bound are swapped.

11

bound algorithm iteratively divides the solution space into subproblems, referred to as children nodes. The subproblems have the same complexity as the original IP, but the solution space is getting smaller. Two children nodes are created by rounding a variable xi with a fractional, non-integer value in the LP relaxation. In order to split the problem, new constraints are introduced: For the first subproblem variable xi is smaller or equal to the rounded down integer, while for the second subproblem variable xi is larger or equal to the next rounded up integer. For instance, if a variable xi takes a value of 3.4 in the LP relaxation, then the LP relaxation is divided into two subproblems by adding a new constraint to each subproblem: The next lower integer value is 3, the next higher is 4. To one subproblem the constraint xi 3 is added, to the other xi 4. In case of binary variables (1 or 0), one can simply introduce the new constraints in the form xi = 0 and xi = 1, respectively. The resulting two subproblems are again solved as a LP relaxation. If the solver does not find an integer solution, the subproblems are further branched, as long as an integer solution is found.

Figure 3: Branch and bound algorithm (source: Pochet & Wolsey, 2006, p. 87).

Figure 3 is a visualization of the division of the LP relaxation feasible region in subproblems. The LP relaxation (green area) has its optimum at point a, which is not an integer solution. The picture shows a branching on variable x1. The LP relaxation of the two subproblems P1

12

and P2 do not deliver integer solutions (points b and c). Hence further branching on variable x2 is required. Once the first feasible integer solution is found, its z-value is the first incumbent and an upper bound of the IP. This is not necessarily the optimal solution. Thus the algorithm further explores nodes, until an optimal or a near optimal solution is found. For this purpose, the user defines a stop criterion in the solver's settings. The branching mechanism has two important decisions at every step: Which fractional variable is chosen next for further branching and which node is examined first. The effectiveness of the branch and bound depends strongly on how quickly the upper and lower bound converge (Atamtrk and Savelsbergh, 2005). Therefore, one would like to choose the variable for branching that limits these bounds as fast as possible. One strategy is to branch the most fractional variable, in other words the variable whose fraction is closest to . However, Achterberg, Koch and Martin (2005) show that this strategy performs even worse than the random choice of a branching variable. More promising, but also more laborious, is the strong branching technique: A branching is made on a trial basis on every fractional variable. The most promising variable is chosen for the further branching. Because strong branching implies a lot of calculation, it is not efficient to perform it at every node. A third strategy to find the most promising variable for further branching is the pseudo cost branching: For each fractional variable, an estimate is provided for the decrease of the objective function value if the variable is rounded down and rounded up (Lodi, 2010). The pseudo cost is defined as: and Parameter represents the pseudo costs at rounding down variable xi, is the change of

the z-value in the objective function by rounding down the variable and fi is the fraction of the variable (e.g. if the variable xi has a value of 7.3, its corresponding fraction fi is 0.3). The algorithm chooses the variable with the maximum decrease of the z-value by rounding up or down. After having chosen the variable for further branching, the second upcoming decision is the node selection. There are two different strategies: Choosing the most promising node, which

13

is the node with the smallest upper bound (in a minimization problem). This is known as best bound or best first search. The second strategy is the depth first or diving search. This is where all children nodes of a subproblem are examined. One only backtracks if a node is fathomed and further branching on this node becomes impossible or needless. This occurs if the problem becomes infeasible or its bound is inferior to the current incumbent. The best first strategy explores fewer nodes but needs more memory, because there are more active subproblems which need to be elicited. In addition, the subproblems have only a weak resemblance to each other, which leads to longer calculation. On the other hand, the depth first search explores more and sometimes useless nodes. But the changes from one subproblem to the next are small, since only one bound of a variable changes. This allows the solver to calculate the new subproblem in a shorter time. Most solvers use hybrid techniques, mixing best first and depth first search. At the beginning, it is most promising to concentrate on depth first search in order to find a good solution quickly. In a later stage of the search, the emphasis is more on the best first search in order to improve the global bound (Atamtrk & Savelsbergh, 2005). The lower bound (in a minimization problem) is the best possible solution of a current node and its descendants. The incumbent is the best integer feasible solution found so far. Pruning a node is the term for eliminating a node. This happens if a node's bounding function is worse than the actual incumbent or if a node does not contain a feasible solution, namely when a constraint cannot be satisfied. The branch and bound algorithm stops if the incumbent z-value is equal to the value of the initial LP relaxation, or if all nodes are pruned, hence the incumbent is the best possible solution.

3.4 Cutting planes method


The cutting planes method cuts down the solution space at its periphery, as opposed to branch and bound that severs the solution space into two halves. The method was first described by Ralph E. Gomory in 1958 (Gomory, 1958). Additional constraints are added to the LP relaxation. These constraints are referred to as cutting planes or cuts. They cut away a part of the LP feasible region without losing any integer feasible points. Figure 4 shows a cutting plane (dotted line) that does not cut away any integer solution from the feasible region. It is even possible to add cuts that remove a part of the MIP feasible region, as long as the integer optimal solution remains in the solution space.

14

Figure 4: Cutting plane (source: Trick, 1998).

A combination of the cutting planes method with the branch and bound algorithm is called branch and cut algorithm.

3.5 Sensitivity analysis


The coefficients for an optimization problem are often just estimates and not set in stone. Once the solver found an optimal solution, one may wonder what would happen if one or several coefficients would slightly change. The sensitivity analysis examines the robustness of an optimal solution, both for changes of the right hand side (RHS) of the constraints and the coefficients in the objective function (Chinneck, 2010; Winston & Albright, 2012). Does a change of a parameter give a different outcome, or does it stay the same? 3.5.1 Changing the objective function coefficients
The objective function on page 7 has the following form:

The parameters c1, c2, cn are also referred to as objective function coefficients (OFC). In the above maximization of the objective function, the OFC describe the contribution of product xi to the firm's revenue. If an OFC is changed, there is no change in the feasible region (grey plane in Figure 5). But the slope of the iso-objective line changes (dotted lines in Figure 5). This may lead to another corner-point becoming the optimal solution. There is a range for each OFC where the current

15

optimal point stays the best solution. This range is specified with an allowable increase and an allowable decrease of the coefficient. Nevertheless, the z-value changes, except the corresponding decision variable is zero. For this case a solver's sensitivity report specifies how much higher the coefficient (in a maximization problem) must be before the corresponding variable becomes positive, also known as "reduced cost".

Figure 5: Changing an objective function coefficient (source: Bisschop, 2011).

In Figure 5, the optimal point for objective function 1 is point a on the horizontal axis. The objective function 3 has its optimal corner point b. There are multiple optimal solutions for objective function 2 all along the line between a and b including both corner points. This is because the iso-objective line is parallel to the constraint connecting the two points a and b. 3.5.2 Changing the right hand side of a constraint The RHS of a constraint (b1 in the equation below) represents an upper bound of a scarce resource in a production process.

An increase of the RHS in a smaller or equal-constraint means that the constraint is relaxed. The shadow price of a constraint's RHS quantifies the change in the objective function value by changing the RHS by one unit. If a constraint is nonbinding, its shadow price is zero. A change in the RHS of a binding constraint also changes the feasible region of the optimization problem. The slope of the constraint line does not change, but its position is higher or

16

lower, as the arrow in Figure 6 indicates. If the moving constraint belongs to the optimal corner point solution, then this affects also the optimal solution as the dotted lines in Figure 6 show.

Figure 6: Relaxing the right hand side of a constraint (source: Bisschop, 2011).

Figure 7: Illustration of the allowable range for a constraint's RHS (source: Bisschop, 2011).

A sensitivity report also indicates how much the RHS is allowed to change, before another corner point becomes optimal. Figure 7 illustrates the allowable range of the RHS. The three parallel lines represent the same constraint with various RHS. In the original problem, corner point a is the optimal solution. A tightening of the RHS moves the constraint downwards, or rather to the left. The optimal solution is still the same corner point, but it moves to the left towards point b. A further moving to the left would also change the optimal corner point, 17

since another constraint is becoming active (or binding): The green constraint gets inactive and the blue gets active. The same is true for a relaxing of the RHS towards the optimal point c. If the constraint is moving further to the right, it becomes nonbinding. 3.5.3 Sensitivity analysis in mixed integer programming The above contemplation does not take into account the integer restrictions of an IP, but is rather based on LP. IP optimal solutions are usually interior points of its LP relaxation feasible region. Hence the statements of a sensitivity analysis must be interpreted with caution. Sensitivity analysis for IP is still at an early stage. Existing concepts make use of the duality theory (e.g. Wolsey, 1981 and Guzelsoy & Ralphs, 2011). There is no implementation of sensitivity analysis for IP in solvers, which is also true for the standard solver for Excel. Hence the sensitivity analysis executed in section 6.4 is rather of qualitative than quantitative nature: In a first step, modifiable variables are detected. Afterwards, its values are changed manually and the impact on the problem is evaluated. OpenSolver provides a Quick Solve feature which should accelerate this hand-knitted analysis. According to Mason (2012), they are able to reduce the run time for their scheduling problem from one hour to one minute. Unfortunately, Quick Solve does not accelerate the calculation time in the present MIP, the reason for this phenomenon is unknown.

18

4 The scheduling model


4.1 Introduction to the scheduling model
Ferrand et al. (2011) developed a schedule for the five physicians of a recently opened emergency department at the Cincinnati Children's Hospital Medical Center by formulating a MIP. In cooperation with the physicians, they defined a set of compulsory and flexible rules for the schedule. 4.1.1 Compulsory rules A particular schedule is only feasible if all compulsory rules are met: The total number of shifts assigned to each physician is fixed. The proportion for each type of shifts is as close as possible to one-third. At least 20% of the AM shifts must be assigned on Friday. The total number of shifts worked on a Friday and weekends is fixed. The physicians have their preferences: Weekend shifts should be batched together. They never work more than two weekends in a row. At most four shifts are assigned in any given week. There are no single workdays; at least two workdays are batched together. If the last worked day is an overnight shift, the physician has at least two days off. If the last shift worked is a PM shift, the break should be at least one day off followed by either a PM or overnight shift, or two days if the next assigned shift is an AM shift. If the last worked day is an AM shift, then the break can be only one day. 4.1.2 Flexible rules There are three flexible rules which are nice to have, but must not be fulfilled, in contrast to the compulsory rules. If a flexible rule is violated, a penalty kicks in in the objective function. The goal of the optimization is to minimize these penalties due to violations of the soft constraints. Unlike the standard form of an objective function presented in chapter 3.1, the objective function does not have the form of a sum-product ( deviations. The three flexible rules are the following: 1. Only one physician is assigned to work a shift. 2. If a weekend is off, then also the previous Friday or the following Monday should be off. ), but is rather a weighted sum of

19

3. Not more than two consecutive overnight shifts should be assigned in a Monday to Thursday time slot. One physician works only overnight, hence the last rule does not apply to him.

4.2 Model formulation


In this section the model is presented as in the original formulation of Ferrand et al. (2011). Section 4.3 reflects on how the model can be simplified, both for a better comprehensibility and an easier implementation in Excel or GAMS. Contrary to the reasoning in the paper of Ferrand et al. (2011), the simplified is not significantly slower (see section 6.7). 4.2.1 Sets I J 1,2,3 1,, 56 1,, 8 set of shifts, 1 AM, 2 PM, 3 overnight shift set of days within the eight-week cycle set of physicians in the team set of weeks within the eight-week cycle

K 1,, 5 L

4.2.2 Variables The decision variables define each physician's work schedule. There is one variable for

each shift at each day and each physician, altogether 840 binary variables (3 shifts times 56 days times 5 physicians). 1 if physician k works shift i on day j, 0 otherwise A second group of variables measures the deviation from three flexible rules introduced above. The deviation variables are nonnegative and continuous variables. Elsewise the solver would tend to give these variables a negative value, since the objective function is a weighted sum of the deviation variables and its z-value is minimized. This would provoke an unwished deviation from the desired goals and lead to a negative and meaningless z-value in the objective function. It is not necessary and even counterproductive to define these deviation-variables (or dvariables) as binary variables, even though they all take a value of 1 or 0. All d-variables are defined in combination with the binary x-variables. They automatically adopt a binary value. Nonetheless it is helpful to define the d-variables as continuous variables: The fewer binary variables
in a model, the faster the calculation is.

20

deviation from the goal of ensuring that only one physician is assigned to work shift i on day j deviations from the goal that if weekend l is off, also the adjacent Friday or Monday is a day off for physician k deviation from the goal of physician k working two or fewer overnights in a row from Monday to Thursday

There are 168

variables, 40

variables and between 32 and 96

variables, depending

on the exact problem definition (see section 0 0). Finally, there is a group of auxiliary variables (or s-variables) concerning the successive working days and days off. These variables are continuous. As before the d-variables, also the s-variables are defined in combination with the binary x-variables and only take binary values. 1 if physician k does not work on day (j-1) but works on day j, 0 otherwise 1 if physician k works on day (j-1) but not on day j, 0 otherwise 1 if physician k does not work on Saturday j, 0 otherwise, for j = 6,13,,55 1 if physician k does not work on Sunday j, 0 otherwise, for j = 7,14,,56 1 if physician k does not work overnight on day j, 0 otherwise

There are 280

and as many

variables, 40

and

variables and 128

variables.

To sum up, only the

-variables are defined as binary variables, although all variables take a bina-

ry value. The model in its original design contains 840 binary, 304 positive and 768 continuous variables thus a total of 1,912 variables.

The model can be formulated in a way that all s-variables can be omitted. In the modified version, the number of variables is reduced to 840 binary, 240 positive and 0 continuous variables thus a total of 1080 variables!

21

4.2.3 Objective function The objective function aims to minimize the deviation from the soft constraints. There is more weight on the deviation of the goal that only one physician is assigned per shift ( the prioritized goal. ), which is

4.2.4 Constraints a) Constraints regarding breaks between two shifts If physician k works in the afternoon on day j, then he does not work in the morning on either day (j+1) or (j+2). In other words, if then
( )

is 1 (this variable represents the afternoon shift of physician k at day j),


( )

and

(thus the AM shift the next and the next but one day of physician k is 0, the other variables

at day j) have to be 0 in order to meet equations (2) and (3). If can either be 0 or 1.
Equations (2) to (7) apply for j, k.
( ( ) )

(2) (3)

If physician k works overnight on day j, then he does not work the AM and PM shift of the next two days (j+1) and (j+2).
( ( ( ( ) ) ) )

(4) (5) (6) (7)

b) Constraints on the demand There are two physicians assigned per shift at most, or even better only one physician. If there are two physicians assigned to the same shift, then one of them should be physician 3 or 5, since these two physicians are required to work a fraction of their workload at another hospital department. 22

Equations (8) and (9) apply for i, j. (8a) (8b) (9)

Equation (8a) defines the deviation variable shift,

: In case two physicians are assigned for one is 0. Equation (8b)

is 1. If there is no or only one physician assigned for a shift,

assures that at most two physicians are assigned. If there were three, equation (8a) would be violated. Eventually, equation (9) guarantees that if two physicians are assigned (accordingly is one), at least one of both variables c) Constraint on the supply The physicians work a certain amount of shifts per eight-week cycle. Parameter represents and is also one.

the workload of physician k per cycle. This parameter is exogenously given (see Table 1 below). (10)

d) Constraints regarding a fair distribution of shifts The proportion of AM, PM and overnight shifts for each physician is limited as close as possible to one third for each type of shifts. This constraint does not apply for physician 1, because he only works overnight. (11)

Parameter aik is the lower and bik the upper bound on the number of shifts of type i for physician k per cycle. These parameters should be as close as possible to one third of the workload . Also the fractions are also exogenously given:

23

k 1 2 3 4 5

Lk 24 24 19 26 26

aik 8 6 8 8

bik 8 7 9 9

Table 1: Input parameters for the workload and lower and upper bound on the number of shifts (source: Ferrand et al., 2011).

At least 20% of the AM shifts have to be assigned on Friday. The workload

per physician

per cycle is between 19 and 26 shifts, about one third of them are AM shifts, which are between 6 and 9 AM shifts (see Table 1 above). Consequently, two or more shifts have to be assigned on Friday morning, except for physician 1 (he works overnight only).
( )

(12)

The summand j in equation (12) requires a short explanation: It sums up all AM shifts (i = 1) assigned on Fridays . Friday is the fifth day of the week; the index j for Friday in the first week is j = 5, in the second week j = 12, and so on. This sum can easily be attained by summing up all j = 5+(l-1)*7 over all weeks l = 1,2 8. The same approach is used for the other days of the week, e.g. Saturday is the sixth day of the week and defined as j = 6+(l-1)*7. e) Weekend constraints There are several weekend assignments. In general, the number of weekends worked should be minimized. Therefore, weekend shifts are always clustered together. Once per cycle, every physician works the AM shift (i=1) on Saturday and Sunday consecutively (except physician 1):
( ) ( ) ( ( ) )

(13) (14)

Equation (13) batches the AM weekend shifts. Either a physician works Saturday and Sunday AM consecutively or he does not work any AM shift at this weekend. If a physician works Saturday morning (i.e.
( )

= 1), then he or she must work on Sunday morning (i.e.

24

= 1) in order to fulfill equation (13). The physicians work AM shifts at exactly

one weekend per cycle; which is induced by equation (14). Once per cycle, physicians 2, 3 and 5 work the PM shift (i=2) Friday, Saturday and Sunday consecutively:
( ( ) ) ( ) ( ( ) ) (

(15) (16) ) (17)

Equations (15) and (16) batch the PM shifts from Friday, Saturday and Sunday, while equation (17) effectuates that PM shifts are scheduled at exactly one weekend. Physician 4 is required to work three Fridays PM or overnight shifts per cycle. Therefore, two Friday PM shifts and one Friday overnight shift are assigned on in equations (20) and (21). Equation (18) allows in combination with equation (19) that physician 4 works Friday PM but not Saturday PM at the same weekend. To sum up, physician 4 works one weekend PM shifts consecutively, another weekend overnight shifts consecutively (besides, this is redundant with equations (23) to (25)) and an additional PM shift on a Friday with the following weekend off. This explains the RHS value of 7 (4 PM + 3 overnight shifts) in equation (22), which sums up all PM and overnight shifts (i=2,3) from Friday to Sunday over the eight week cycle.
( ( ) ) ( ( ( ) ) )

(18) (19) (20) (21) (22)

25

Physicians 2 to 5 once work Friday, Saturday and Sunday overnight consecutively, physician 1 three times:
( ( ) ) ( ) ( ( ) ) ( )

) {

(23) (24) (25)

Equations (23) and (24) batch the weekend overnight shifts. Equation (25) causes one weekend with overnight shifts for physicians 2 to 5 and three weekends with overnight shifts for physician 1. No physician works more than two weekends (Saturday and Sunday) in a row. The sum of all weekend shifts per physician at three consecutive weekends is less or equal to 4: [ ] (26)

f) Constraints concerning weekly workload and succession of shifts The physicians work at most four shifts in any given week: (27)

There is a maximum of three consecutive working days, except for physician 1, who works at most four consecutive days (see equation (45)). [ ] (28)

The next four sets of constraints can be achieved with a simpler formulation with fewer inequalities by avoiding auxiliary variables. Ferrand et al. (2011) claims that the solver performs better with the auxiliary variables, because each constraint comprises fewer binary variables. According to the authors, this is especially important if the model is expanded to a longer cycle or to more physicians. Despite these concerns in Ferrand et al. (2011), a simpler model

26

formulation by avoiding the s-variables is proposed in section 0. For a critical acclaim of this issue see section 6.7. The working days are batched to at least two consecutive days (except for physician 1 who works at least three consecutive days, see equations (46) to (50)). Equations (29) to (31) define the variable . Equation (32) ensures that if a physician is not working on day (j-1) but . (29) (30) (31) (32)

on day j, then he must work also on day (j+1). Equations (29) to (32) apply for

1 1 1 1 0 0 0 0

1 1 0 0 1 1 0 0

1 0 0 1 1 0 1 0

conflicting equations 30 29 29, 30 31 -

Table 2: Variable analysis for equations (29) to (31).

Table 2 above shows that

is 1 if and only if a physician is working on day j but not workis 0. If is 1, then a physician has to be assigned for a

ing on day (j-1). In all other cases,

shift on day (j+1), which is ensured with equation (32). Between groups of overnight shifts, the physicians have at least two days off. Equations (33) to (35) define , and equation (36) ensures that if a physician is working overnight on day (j-

1) but not on day j, then he cannot be assigned to work overnight on day (j+1). Equations (33) to (36) apply for .

27

(33) (34)

) ( )

(35) (36)

1 1 1 1 0 0 0 0

1 0 0 1 1 0 1 0

1 1 0 0 1 1 0 0

conflicting equations 34 33, 34 33 35 -

Table 3: Variable analysis for equations (33) to (36).

Variable

is 1, if and only if a physician is working overnight on day (j-1), but not working

overnight on day j. If so, the physician cannot be assigned for an overnight shift on day (j+1), as defined in equation (36). In all other cases is 0.

Equation (36) only considers the overnight shift of day (j+1). There is no statement about the AM and PM shift. This is not necessary because it is impossible to assign an AM or PM shift on day (j+1) due to equations (6) and (7). The next two groups of constraints are about the soft rules. If these constraints are not fulfilled, a penalty comes into play. If the physician has a weekend off, also the adjacent Friday or Monday is a day off. Equations (37) to (39) define to (40) apply for and . Equation (40) ensures that if a physician has a weekend off,

then either Monday or Friday is off too; otherwise, a penalty comes into play. Equations (37) .
( )

(37) (38)

28

(39)6 (40)

( )

If a physician works on Saturday, then for Sunday shifts and

has to be 0 due to equation (37). The same is true

in equation (38). Weekend shifts are always batched (due to equa( )

tions (13), (16), (19) and (24)); in other words both sums

and and

are either 0 or 1. If a weekend is off (which is equivalent to both sums are 0),

are

both 1 in order to fulfill equation (39). As a consequence, only the following two combinations are possible: ( ) 1 1 0 0 0 1 Table 4: Variable analysis for equations (37) to (39).
( )

0 1

The following table shows all possible combinations with regard to equation (40). Only if the weekend (Saturday and Sunday) is off and the physician works at both Friday and Monday, the penalty kicks in. 1 1 1 1 0 1 1 1 1 0 1 1 0 0 0 or 1 0 0 0 0 1 0 0 0 0 1 1 0 1 0 0 or 1 1 0 0 0 0

Table 5: Variable analysis for equation (40).

For physicians 2 to 5, it would be more intelligible to formulate equation (40) as follows:


( )

But this formulation is invalid for physician 1: Because he works up to four consecutive shifts, it is also possible that he works from Friday to Monday in a row. The above formulation would charge a penalty in that case, which is incorrect. In order to eliminate this error, both s-variables are multiplied by 2 and the RHS is adjusted to 5.
6

This equation could be formulated more precisely with equality instead of larger or equal.

29

At most two overnight shifts are assigned in a row from Monday to Thursday (except for physician 1). Equations (41) to (43) define variable . Equation (44) ensures that if a physician

is working overnight on day (j-1) and on day j, then he is not assigned to work overnight on day (j+1), otherwise the penalty [ ( ) ( ) ]
( )

kicks in. Equations (41) to (44) apply for .7


( )

(41) (42)

( (

) )

) ( )

(43) 8 (44)

1 1 0 0 0

1 0 1 0 0

0 0 1 1 1

0 1 0 1 1

0 or 1 0 or 1 09 0 1

0 0 0 0 1

Table 6: Possible variable combinations in equation (44).

The last group of constraints only affect physician 1, who works overnight shifts only. He works at most 4 (equation (45)) and at least 3 (defined in equations (46) to (50)) consecutive days. [ ] (45)

Equation (45) guarantees that there are at most 4 consecutive worked days. It sums up the shifts of five consecutive days, this sum must be lower or equal to 4. Equations (46) to (50) limit the lower bound of three days and apply for . (46)
( )

(47)

[ ( ) ( ) ] is suffiThis is the range for j in the original formulation. Actually, a range cient, as shown in section 4.3.2. 8 The formulation would be more precise with an equality sign, because the s-variable is always the opposite of the corresponding x-variable. 9 This variable must be 0 due to the rule that there are at least two days off between groups of overnight shifts in equations (33) to (36).
7

30

( ( ( ) )

(48) (49) (50)

Equations (46) to (49) are similar to equations (29) to (32), except that physician 1 works overnight shifts only. Equation (50) intends that at least three consecutive worked days are batched. Variable is one, if physician 1 works on day j, but not on day (j-1). In this situa-

tion, he must work on days (j+1) - this is achieved in equation (49) - and also on day (j+2) in order to fulfill equation (50).

4.3 Reformulations
During the implementation of the original model, it became evident that some equations can be fused together, dropped or formulated in a simpler way. Other equations are missing in the original formulation. Thanks to the reformulation effort, the number of constraints is reduced from 5,777 in the original formulation to 3,336 in the modified formulation. 4.3.1 Fusing equations Equations (4) and (5) as well as (6) and (7) can be fused together: If a physician works overnight, he cannot be assigned for both the AM and PM shift of the next two days, so these variables are all 0. Even if there is no overnight shift, a physician works at most one shift the following day. Hence the sum of the variables for the AM and PM shift the next day does not exceed 1.
( ( ) ) ( ( ) )

(4r)10 (6r)

Also equations (15) and (16) can be fused together by summing up both equations. Table 7 below shows that also the new equation batches the PM weekend shifts (Friday to Sunday).
( ) ( ) ( )

(15r)

10

The r stands for reformulated.

31

1 0 1 0 0 1 1 0

1 0 0 1 0 1 0 1

1 0 0 0 1 0 1 1

LHS11 feasible 0 yes 0 yes 2 no -1 no -1 no 1 no 1 no -2 no

Table 7: Variable analysis and corresponding LHS for equation (15r).

Equations (21) and (22) about the weekend assignments for physician 4 are rather confusing, since they unnecessarily mix PM and overnight shifts. It is easier to consider these two types of shifts independently, because equations (23) to (25) exclusively deal with the overnight shifts at weekends for all physicians. Equation (21) is redundant to equations (23) and (25) and can be left out. Equation (22) is reformulated ignoring the overnight shifts of physician 4. The RHS is 4 because physician 4 works once Friday to Sunday PM shifts consecutively plus an additional Friday PM shift followed by a weekend off. (
( ) ( ) ( )

(22r)

Equations (23) and (24) can be merged together, as equations (15) and (16).
( ) ( ) ( )

(23r)

4.3.2 Reformulation of equations (29) to (44) and (46) to (50) by avoiding the auxiliary variables These 20 equations representing 2,840 constraints can be replaced by only five new equations, resulting in 688 constraints. The reformulation avoids 2,152 constraints and all 768 s-variables!12 The authors justify their formulation with a tighter problem formulation for the branch and bound algorithm. Their reasoning: Every equation only includes few variables, which accelerates the calculation time. Fewer variables per equation imply less recalculation of each equation in the branch and bound algorithm. But the quantity of equations and variables, although discrete, is much higher, which results in more calculation. The authors believe

11 12

LHS stands for left-hand side. A listing of these numbers is done in the appendix.

32

that their tighter equation formulation outweighs the enhanced number of equations, especially for a larger problem with more than five physicians.13 a) Equations (29) to (32): Physician k works at least two consecutive days The four equations can be replaced by the equation (29r): (
( ) ( )

(29r)

case i ii iii iv v vi vii viii

1 0 1 0 0 1 1 0

1 0 0 1 0 1 0 1

1 0 0 0 1 0 1 1

1 1

LHS 1 0 1 -1 1 0 2 0

Table 8: Variable analysis and resulting LHS for equation (29r).

The table above shows all possible combinations. Basically, only case iv) is not allowed, because a working day is surrounded by two days off. There is also a single workday in case iii). This is only allowed if the physician works also on day (j-1). Otherwise, the above constraint is not fulfilled for day (j-1). The same is true for case v), which is only feasible if the physician is working on day (j+3), and case vii), where the physician has to work on either day (j1) and (j+3). b) Equations (33) to (36): Give at least two days off between groups of overnight shifts Since an overnight shift is never followed by an AM or PM shift at the next and the next but one day (this is ensured by equations (4) to (7)), equation (33r) only comprises the overnight shifts.
( ) ( )

(33r)

13

See e-mail correspondence with Yann Ferrand in the appendix.

33

i ii iii iv v vi vii viii

1 0 1 0 0 1 1 0

1 0 0 1 0 1 0 1

1 0 0 0 1 0 1 1

LHS 1 0 1 -1 1 0 2 0

Table 9: Variable analysis and resulting LHS for equation (33r).

The only infeasible combination is case vii), because there is only one day off between two overnight shifts. Note that combinations iv), vi) and viii) are basically feasible in this narrow observation, but no overnight shift on day (j-1) and/or (j+3) is allowed. c) Equations (37) to (40): If a weekend is off, then also the previous Friday or the following Monday is off ( ) (37r)

Or, the same formulation with index l: (


( ) ( ) ( ) ( )

(37r)

If Saturday and Sunday are off and the adjacent Friday and Monday are both working days, a penalty kicks in. i ii iii iv v14 vi vii viii 1 1 0 0 1 1 0 0 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 1 0 1 0 1 0 1 0 0 0 0 0 0 0 LHS 1 1 1 0 0 -1 -1 -2

Table 10: Variable analysis and LHS for equation (37r).

14

Only physician 1 is allowed to work four consecutive days (equation (45)).

34

d) Equations (41) to (44): Assign at most two overnight shifts in a row from Monday to Thursday
( ) ( )

(41r) ) ( ) ]

This reformulation uses a narrower range for j than the original formulation. It is assumed that a succession of overnight shifts on Wednesday, Thursday and Friday does not cause a penalty. A more detailed consideration demonstrates that this succession is not even possible at all! Equations (23) to (25) batch Friday overnight shifts with weekend overnight shifts. If a physician works Friday night, he works also Saturday and Sunday night, which are three consecutive workdays. Since the physicians work at most three consecutive days, it is impossible that a physician works Thursday and Friday night consecutively. Therefore, it is sufficient to check only for the time slot from Monday to Thursday. If there are three consecutive overnight shifts from Monday to Thursday, the penalty kicks in.

Physicians 2 to 5 work at most three shifts in a row. If the last shift is an overnight shift, there are at least two days off, as defined in equations (33) to (36) or (33r) respectively. With this fact in mind, it is even sufficient to check if there are more than two overnight shifts assigned in a Monday to Thursday time slot. If so, the penalty single constraint remains per week and physician: ( ) (41rr) kicks in. As a consequence, only a

e) Equations (46) to (50): Physician 1 works at least three consecutive days This issue can be achieved in two steps: In the first step equation (29r) becomes also valid for physician 1, which ensures that at least two consecutive days are grouped. (
( ) ( )

(29r)

After ensuring that physician 1 is assigned to at least two consecutive days, a third or fourth workday is attached due to equation (46r).

35

(46r)

The following table does not list all combinations, but only combinations that fulfill equation (29r). i ii iii iv v vi vii viii 1 1 0 1 1 0 0 0
( )

1 1 1 0 1 1 0 0

1 1 1 0 0 1 1 0

1 0 1 0 0 0 1 1

LHS 0 1 1 -1 0 2 0 -1

Table 11: Variable Analysis and resulting LHS for equation (46r).

Cases i) to iii) conform to both equations and to the rule that physician 1 works at least 3 consecutive days. Case vi) does not satisfy equation (46r), because only two worked days are batched. The other cases fulfill equation (46r), but need an expanded consideration of the neighboring days (j-2), (j-1), (j+4) and (j+5). 4.3.3 Missing constraints in the original model There are three issues missing in the original problem formulation. f) Physician 1 only works overnight There is no constraint that physician 1 only works overnight. Therefore, an additional constraint is proposed: (51)

Equation (51) is mandatory for a correct solution, otherwise physician 1 is also assigned for AM and PM shifts. g) The cyclic nature of the schedule All calculations in this thesis control if all constraints remain valid over the end of one cycle to the beginning of the next cycle. This issue is not considered in the above formulations. In order to do so, the sets for days and weeks are extended to 70 days and 10 weeks. This represents the first two weeks of the subsequent cycle. In addition, a new constraint is added:

36

(52)

Thanks to equation (52), all variables

of the subsequent cycle (j=56, , 70) are recur-

rent. Some equations need to be slightly adapted. The adaption is demonstrated for equation (26): The physicians never work more than two weekends in a row, which is ensured by equation (26): [ ] (26)

In order to control for the cyclic nature of the schedule, equation (26) must apply for [ ]

Without this adaption, it would be allowed to work in the last week of the cycle and the first two weeks of the subsequent cycle. Furthermore, many equations include variables of the following days, e.g. sequent cycle.15 h) A physician works not more than one shift per day It is not allowed to work two shifts consecutively and more than one shift per day, but there is no such constraint in the model. Therefore, equation (53) is proposed: (53)
( )

. For j = 56,

these equations only provide meaningful results if they interact with the variables of the sub-

Even if this constraint is missing, it is implicitly integrated in the system of constraints, albeit hidden: In the original formulation, equation (30) assures that only one shift is assigned on day (j-1) for each physician:
( )

(30)

15

In the Excel spreadsheet, the equations interacting with the subsequent cycle are highlighted in yellow.

37

If

is 0, then the sum of all shifts on day (j-1) is less or equal to 1 for each physician, so that is 1, then the physician does not work on day

the left-hand side is less or equal to 1. And if (j-1) by definition of the

-variable. Equation (30) is not valid for physician 1, but this is not

problematic since he does only work overnight shifts (see equation (51) above). This appreciative side-effect of equation (30) gets lost in the reformulation of equations (29) to (32). But fortunately, the reformulation of equations (4) and (5) has the same effect:
( ) ( )

(4r)

If

is 1, then the AM and PM shift of the following day are both 0. On the other hand, if is 0, then only one of the two variables
( )

and

can be 1, otherwise the

constraint is not fulfilled. Equation (53) is therefore redundant and can be dropped. Nevertheless, the calculation time with OpenSolver was significantly shorter when equation (53) was included in the model. 4.3.4 Avoiding the proportion parameters in equation (11) Equation (11) provides an upper and lower bound for the number of shifts of type i, the bounds are as close as possible to a third. The static proportion parameters are too inflexible for the sensitivity analysis. A modification of equation (11) dispense with these parameters: ( ) ( ) (11r)

Parameter If

is the workload per physician, represents a tiny number.

is a fractional number, the above formula ensures that the range for the integer sum is between the rounded down and up integers. In case is equal to . is already an integer, the

ensures that the integer sum

The above suggestion is a more relaxed formulation than the original equation (11) with the parameters and . If Lk is 24, then each type of shifts is assigned 8 times. Assuming that

is 0.01, the range in equation (11r) is an interval [7.01, 8.99], while in the original formulation the proportion is fixed to 8 shifts. The relaxed formulation may lead to a lengthening of the branch and bound algorithm.

38

4.4 Model expansion for up to eight physicians


Ferrand et al. (2011) want to expand the model by adding up to three physicians in order to run the emergency department independently from external physicians. In this thesis, a first successful attempt is made: Section 6.5 demonstrates optimal solutions for a simplified scheduling model with six, seven and eight physicians. It is not known what individual agreements the new physicians wish to have or if the existing agreements endure. Instead of assuming any imaginative agreements for the newly added physicians, the scheduling model is fundamentally simplified and standardized for all physicians. The present scheduling model is a cyclic schedule without rotation. It allows individual agreements for each physician. If there are no individual agreements in a standardized model, a cyclic schedule with rotation would be the best approach to solve the problem. Nevertheless, the expanded model is formulated as a cyclic schedule without rotation. This allows the schedule planner to insert individual agreements in the model. The standardized model contains the following constraints: Each physician is working 24 shifts during the eight week cycle and is assigned to all types of shifts (in particular also physician 1 works AM and PM shifts). All constraints about individual agreements are dropped. The weekend shifts remain batched and every physician works exactly three weekends, one weekend for each type of shifts. All other constraints remain unaltered. The following table gives an overview of the standardized model's constraints: Issue After a PM shift, there are no AM shifts assigned the next two days. Equation No. (2), (3)

After an overnight shift, a physician does not work AM and PM the next (4r), (6r) two days. There are at most two physicians assigned per shift. If more than one phy- (8a), (8b) sician is assigned, a penalty kicks in.

39

Every physician works 24 shifts per cycle. The physicians work exactly eight shifts of each type. ( ) (11e) (10e)16

Every physician works three weekends (Saturday and Sunday) per cycle, one weekend for each type of shifts.
( ) ( )

(13e) (14e)

They never work more than two weekends in a row. They work at most four shifts per week. Assign at most three consecutive working days and at least two consecutive days. There are at least two days off between groups of overnight shifts.

(26) (27) (28) (29r) (33r)

If a weekend is off, also the adjacent Friday or Monday is of, otherwise a (37r) penalty kicks in. They do not work more than two overnight shifts in a Monday to Thursday (41rr) time window, otherwise a penalty is charged. They work at most one shift per day. At least one physician is assigned per each shift (only in the model with eight physicians). (54e) (52)

Table 12: Simplified model for the expansion for up to eight physicians (source: own research).

Equation (54e) only applies for the model with eight physicians. It ensures that for every shift at least one physician is assigned, which is a condition for autonomy. The solver covers every
16

Equations accompanied by an e (for expansion) are introduced for the expanded model. Equations with an r are the reformulated equations from section 0.

40

shift anyway, even if equation (54e) is dropped. A deserted shift would lead to a double occupancy for another shift, causing an unnecessary deviation.

4.5 Symmetry
Symmetry occurs, if variables are permuted without changing the structure of an IP (Margot, 2010). Symmetry causes additional calculation tasks in the branch and bound algorithm, since there are several identical solutions. Because of the cyclic nature of the present schedule, the beginning of a cycle could be in any week. To avoid this aspect of symmetry, a succession of workdays which occurs only once per cycle can be fixed in the first week. For instance, there is the exactly one weekend where physician 2 works Friday to Sunday PM shifts consecutively. Fixing this weekend in the first week is preventing the solver of seven symmetric solutions. The schedule for all physicians is generated around this fixed weekend. There is much more symmetry in the scheduling model occurring, but according to Margot (2010) it is difficult to identify symmetry and, as a consequence, making predictions how many symmetrical solutions exist. There are other strategies than fixing variables in order to avoid symmetry: Margot (2010) supposes, amongst others, additional strategies: A perturbation in the objective function, for example by adding a small random perturbation to the objective function coefficients. Adding symmetry breaking inequalities, which remove equivalent subproblems in the branch and bound algorithm. The perturbation strategy is helpful for the scheduling model: The deviation variables and

in the objective function do have the same weight. As a consequence, a solution with one penalty is ceteris paribus equivalent to a solution with one penalty. In order to avoid

this type of symmetry, the deviation variables in the objective function are all valued with a different weight:

Now, a higher.

-deviation is preferred to a

-deviation, since the penalty of the latter weights

41

5 Tools used to solve the scheduling problem


The scheduling model was implemented with two different tools, one is an Excel spreadsheet in combination with the OpenSolver, on the other is a GAMS code in combination with NEOS Server.

5.1 Excel and OpenSolver


The scheduling model with its approximately 1,900 variables and 5,700 constraints in its original formulation is set up in an ordinary Excel file. A cell is reserved for every variable. The left hand side of every constraint is calculated in a separate cell. Consequently, the spreadsheet with the original problem formulation includes 1,900 cells for the variables and approximately 4,700 formulas representing the major part of the constraints. Not every constraint requires a formula, since some constraints only compare different values. Equation (8b) for example ensures that the -variables are lower or equal to 1.

The standard solver in Excel is restricted to 200 variables and constraints. It is therefore unemployable for this large-scale problem. OpenSolver overcomes this barrier and has no size limitations. OpenSolver uses the CBC Solver,17 which is another open-source project of the Operations Research community.

5.2 GAMS and NEOS Server


GAMS is an algebraic modeling language (General algebraic modeling system) and available as a free demo version.18 The demo version has its limitation at 300 variables and constraints, which is not sufficient for the scheduling model. Instead of purchasing a costly license for an unconstrained GAMS version, NEOS (Networkenabled optimization system) Server is a free alternative to solve large problems.19 NEOS is an environment provided by the University of Wisconsin-Madison, which allows users to solve large optimization problems over the internet. It provides solvers for many different kinds of optimization, among others linear programs, integer programs, mixed integer linear programs or nonlinearly constrained optimization. The user chooses a solver and uploads a specification of the problem, for example as an AMPL or GAMS code.20

17

CBC stands for COIN Branch and Cut, COIN in turn is the COmputational INfrastructure for Operations Research, which is an open-source platform for the Operations Research community. 18 The free demo version of GAMS is available on http://www.gams.com/download/. 19 The NEOS Server is retrievable on http://www.neos-server.org/neos/. 20 There is a manual for the NEOS Server is in the appendix.

42

NEOS Server normally sends a solution back in only a few minutes. The results are displayed directly in the browser window and can be downloaded as a GDX-file (GAMS data exchange). The GDXviewer, a tool that is also included in the GAMS demo version, organizes the results and allows to export the results in an Excel file or in another database format.

43

6 Results
6.1 LP relaxation
The LP relaxation of the scheduling problem provides a lower bound with a z-value of 15. This is the best possible z-value for any feasible integer solution. Consequently, it is impossible to formulate a schedule without any deviation. Indeed, exactly one overnight shift is assigned to two physicians. This is inevitable due to equation (25): Each physician is assigned to work overnight shifts at one weekend (three weekends for physician 1). This implies that only seven (3 + 4*1) weekends are covered with overnight shifts. At least 54 overnight shifts have to be assigned, in particular 24 shifts for physician 1, six shifts for physician 3 and eight shifts for all others. These numbers are in accordance with the lower bounds in equation (11). However, only 53 overnight shifts can be assigned due to equation (25) (56 3 days, because one weekend is not covered). The term "optimal solution" stands for the best solution achievable with the deviation illustrated above, since it is not possible to obtain a schedule without any deviation. Different proposals to avoid the deviation are made in the sensitivity analysis in section 6.4.

6.2 Excel and OpenSolver


The OpenSolver in Excel achieves an optimal solution with a z-value of 15 in only 4.5 minutes by applying the original model formulation.21 The solution time for the modified formulation is 9 minutes. Ferrand et al. (2011) work with similar computer power, but they need about six hours to obtain an optimal solution with an AMPL code in combination with the CPLEX solver. OpenSolver is up to 80 times faster to solve the same problem!
i j

1 2

2 5 30 5 4 3

1 2 3
i j

3 4 5 6 7 8 9 4 4 4 3 3 - - - 2 2 2 3 4 5 1 1 1 1 5 5 31 4 3 32 5 4 33 5 2 34 2 35 2 36 37 - 3 5 1 1+3

10 2 4 38 5 1

11 3 2 4 39 2 5 1

12 3 40 2 4

13 5 41 4

14 5 42 4

15 5 4 43 3 1

16 2 4 44 3 1

17 2 45 2 4 1

18 3 2 46 2 4 1

19 3 5 1 47 2 4 5

20 4 5 1 48 5

21 4 5 1 49 5

22 4 2 1 50 1

23 5 2 51 2 1

24 4 5 2 52 5 2 1

25 4 5 53 5 1

26 4 3 1 54 5 4 3

27 3 1 55 2 4 3

28 3 1 56 2 4 3

1 2 3

29 5 1

Table 13: Schedule with the original model. 22

21 22

The laptop is a 64 bit Windows 7 notebook with an Intel Core i7 2.7 GHz processor and 4 GB RAM. A print of the Excel spreadsheet is published in the appendix.

44

1 2 3
i j

1 2 3 4 5 6 7 8 9 - - 3 5 5 - - - 5 - - 3 2 2 2 - 2 1 1 1 1 4 4 4 1 1 29 4 1 30 5 4 2 31 5 2 32 4 5 33 3 4 1 34 3 1 35 3 1 36 1

10 4 2 1

11 4 2 1 39 3 2 5

12 4 3 5 40 3 -

13 3 5 41 4 -

14 3 5 42 4 -

15 1 43 5 4 2

16 3 1 44 5 3 2

17 4 3 1 45 3

18 4 1 46 5 1

19 4 5 2 47 5 4 1

20 5 2 48 2 4 1

21 5 2 49 2 4 1

22 3 50 2

23 4 5 3 51 5

24 2 5 4 52 4 5

25 2 5 4 53 2 4

26 2 1 54 2 3

27 1 55 5 3

28 1 56 5 3

1 2 3

37 38 2 5 2 4 4+5

Table 14: Schedule with the modified formulation.

The Excel spreadsheet translates the 840 decision variables xijk in a schedule. Table 13 shows the schedule with the original problem formulation. Table 14 is the solution of the modified problem formulation. Both have an optimal z-value of 15, but the work patterns differ. This is due to the symmetry in the formulation. Some symmetry issues are defused, e.g. the PM weekend shifts for physician 2 are fixed for the first week in both models (red frame) and also the objective function coefficient do all have a different weight (which is not visible in the schedule). The five physicians do not have the capacity to cover all shifts: 50 out of the 168 shifts remain vacant and are covered with physicians from other departments. Holiday assignments are not included; they ought to be added manually. Ferrand et al. (2011) describe more precisely how to implement these assignments, as well as the occurring anomalies due to legal holidays. By comparison, the solution presented in the paper of Ferrand et al. (2011) has a z-value of 60: Four night shifts are assigned to two physicians. Yann Ferrand explains that they stopped the solver before achieving an optimal solution. 23 Moreover, the physicians are happy with the solution proposed so that there is no need to propose a schedule with a better (lower) zvalue. There is no disadvantage arising if a shift is assigned twice, because one of the physicians will work in another department.

6.3 GAMS code and NEOS Server


NEOS Server returns a feasible solution within two to five minutes (with both formulations). But the attempts to obtain an optimal solution with a z-value of 15 failed. NEOS Server provides various solvers, but all solvers only achieve a z-value of 16: In addition to the inevitable deviation of one double assignment, there is an unexpected -deviation. One physician is

assigned to three overnight shifts in the Monday to Thursday time window. This is inexplica-

23

See the e-mail exchange in the appendix.

45

ble, because the default stopping criterion for the absolute gap is 0,24 which implies that the solver should not stop before finding the optimal IP solution. Nevertheless, an optimal schedule is achieved by forcing the objective function to take a zvalue of 15. Table 15 and 16 show the schedules generated with GAMS in combination with NEOS Server for both formulations.25 The shift patterns are again different to the solutions calculated with OpenSolver. Repeating the calculation with the same GAMS code and solver always returns an identical schedule. If a different formulation or solver is used, also the schedule varies.
i j

1 2 3
i j

1 2 1

2 4 2

3 5 4

4 5 4

5 5 3

6 2 3

7 2 3

8 2 4 1

9 4 1

10 3 4 1

11 12 13 14 15 16 17 2 2 - - - - 3 - - - - - 5 1 5 5 5 1 1 1

18 2 5 1

19 20 21 22 23 2 - - 5 5 3 3 3 - 3 4 4 4 1 1 48 4 5 1

24 4 3 1

25 5 4 1

26 27 28 5 - 4 - 2 2 2 54 3 4 1 55 3 4 1 56 3 4 1

1 2 3

29 30 31 32 33 34 35 36 37 38 - - 4 4 4 - - - 3 4 - 5 - - 2 2 2 5 2 3 3 5 5 1 1 1 1 5 2+3

39 40 41 42 43 44 45 46 47 4 4 5 5 - - - 3 3 - - - - 2 2 2 - 5 2 - - - 5 4 4 1 1

49 50 51 52 53 4 2 - - 5 - 5 5 1 4 2 2 5

Table 15: Schedule with the original model calculated with GAMS and NEOS Server.
i j

1 2 3
i j

1 5 1 29 2 5 1

2 5 1

3 2 1

4 5 2 1

5 5 3 4

6 3 4

7 3 4

8 2 1

9 2 1

10 4 3 1

11 12 13 14 15 4 4 2 2 3 5 5 5 3 1 - - - 2 41 4 2 5

16 17 18 19 20 21 22 4 - 2 2 3 3 5 5 5 - - - 3 4 4 1 1 1 1+5

23 2 5

24 3 4 2

25 3 4 2

26 27 28 3 - 4 - 1 1 1

1 2 3

30 31 32 33 34 35 36 37 38 39 40 2 - 2 2 5 5 - - - 3 3 4 - - - - - 5 4 4 - 2 5 4 4 3 3 3 1 1 1 1 5

42 43 44 45 46 4 - - 5 5 2 - - - 5 4 2 2 1

47 48 49 50 51 52 53 54 55 56 5 - - - - 4 4 4 - 4 4 4 - 5 - - - - 1 1 1 3 3 5 5 2 2 2

Table 16: Schedule with the reformulated model calculated with GAMS and NEOS Server.

6.4 Sensitivity analysis


The scheduling model differs from an input-output optimization. The latter maximizes profit or minimizes costs by optimizing the production mix, whereas the scheduling model minimizes the deviation from a desired condition by arranging the shifts. Therefore it is not possible to implement a classical sensitivity analysis. Nonetheless, some parameters and equations are interesting for a closer consideration.

24

For further information on the stopping criterion: http://support.gams.com/doku.php?id=solver:what_is_optca_optcr 25 The GAMS code is attached in the Appendix.

46

6.4.1 Changing the objective function coefficients Changes in the objective function coefficients (OFC) may change the z-value, but do not affect the optimal solution. Since only a -deviation occurs, a different weight for the OFC

does not change the schedule. However, it is plausible that the branch and bound algorithm follows another solution path with a different weight of the OFCs. Therefore, the OFCs become relevant if also a near optimal feasible solution is satisfactory for a schedule planner. The coefficients for and are both one and thus have the same weight. Increasing one of

the coefficients would define a preference between these two deviation variables. Thanks to the different weight of the deviation variables, the solution time for the original formulation with OpenSolver could be reduced from 45 minutes to only 4.5 minutes! 6.4.2 Changing the right hand side of a constraint Relaxing a right hand side (RHS) of a constraint normally improves (reduces) the z-value and vice versa. In the scheduling model, not all constraints allow to change its RHS: There is no possibility to change constraints on regulatory issues. Equations concerning logical implications are unsuitable for a sensitivity analysis, including equations that pool shifts together or the equations that define the auxiliary variables (only in the original formulation). Changes in constraints about weekend assignments are delicate, supposing the particular importance for the physicians' social life. Three equations are interesting for a closer consideration: - The workload of each physician (equation (10)). - The proportion of shifts (equation (11)). - The maximum number of shifts per week (equation (27)) and successive shifts (equation (28)). a) Changing the workload Changes in the workload of each physician are very limited due to the fixed upper and lower bounds for each type of shifts in equation (11). The proportion parameters aik and bik are determined statically. In order to execute a meaningful analysis of changes in the workload, the proportion parameters need to be adjusted. This is done either manually or dynamically by using the modified equation (11r) in section 4.3.4, which allows flexible bounds. Table 17 shows the impact of a change in the workload on the objective function z-value.

47

Physician Initial Lk 1 24

Impact on z-value Increase of Lk: Every additional shift increases the z-value by 15, because this causes an additional overnight shift which is assigned to two physicians. Decrease: A decrease to 23 shifts results in a z-value of 0. Further decrease of the workload has no impact on the z-value.

24

Increase: An increase to 25 or 26 shifts does not affect the zvalue, since the additional shifts are AM and PM shifts. The thresholds to 27 and 30 increase the z-value by 15, because an additional overnight shift is assigned due to the proportion guidelines. An upper bound for feasibility is 32, since it is not possible to assign more than four shifts per week (4 shifts times 8 weeks). Decrease: 23 shifts decrease the z-value to 0, because one overnight shift of physician 2 may be canceled.

19

Increase: An increase to 20 shifts does no impact the z-value, the additional shift is an AM or PM shift. Only the thresholds to 21 and 24 shifts increase the z-value by 15. Decrease: A decrease to 18 shifts does not affect the z-value. If the workload is decreased to 17 shifts, one overnight shift is canceled and the z-value becomes 0.

4 and 5

26

Increase: The increase to 27 and 30 shifts each increases the zvalue by 15. Decrease: It is only the thresholds from 24 to 23 shifts that has an impact on the z-value.

Table 17: Sensitivity analysis of the workload (source: own research).

48

b) Changing the proportion of shifts Changes in equation (11) are only possible in one direction: It is only possible to relax the bounds, since the bounds are as tight as possible yet in the original formulation. The upper bound may be increased, the lower bound decreased. As a consequence, the only possible impact on the z-value by changing the bounds is an improvement towards a value of 0. In the original formulation, an overnight shift is assigned to two physicians. If the lower bound for the number of overnight shifts is relaxed, a decrease of the z-value to 0 is possible. Physician Initial
aik and bik

Impact on z-value

1 2

NA both 8

Physician 1 only works overnight shifts. If only the lower bound for overnight shifts is decreased to 7, the upper bounds hinder a better z-value. Physician 2 is still assigned to 8 AM, PM and overnight shifts. A simultaneous decrease of the lower bound for overnight shifts and increase of the upper bound for AM and/or PM shifts to 9 enables a z-value of 0.

6 and 7

Decreasing the lower bound for overnight shifts to 5 leads to a zvalue of 0. Physician 3 works 5 overnight and 7 AM and PM shifts.

4 and 5

8 and 9

The situation for physicians 4 and 5 is the same as for physician 2: Only a simultaneous increase of the AM or PM upper bound and a decrease of the PM lower bound reduce the z-value to 0.

Table 18: Sensitivity analysis of the proportion of shifts (source: own research).

c) Changing in the maximum number of shifts A change in the RHS of equation (28) also implies an adjustment on the left hand side, which is basically not provided in sensitivity analysis. In addition, both equations (27) and (28) enable recovery phases which are important for the physician's health and working motivation. If the planner considers relaxing these constraints, it should be made only together with an introduction of a new deviation variable. More than four shifts in one week or more than three successive shifts should remain an exception.

49

In short, the reason for the deviation in the scheduling model is that the supply for overnight shifts is one higher than the demand. A change in the weekly workload or a higher maximum of consecutive working days does not solve the problem. If a physician is instead motivated to work an additional weekend overnight shift, the z-value can be reduced to 0.

6.5 Model expansion for up to eight physicians


For the sake of a better understanding, the model expansion is executed with the simplified model in section 4.4. If the emergency department engages six or seven physicians, some shifts still remain vacant. With a team of eight physicians, the supply is 192 shifts (8 physicians times 24 shifts) is larger than the demand of 168 shifts (56 days times 3 shifts). It should be possible to run the emergency department autonomically with eight physicians, apart from holiday proxies, absences due to illness, etc. With six physicians, the supply is 144 shifts in contrast to the demand of 168 shifts. There are 24 unoccupied shifts. The optimal z-value is 0, because all soft constraints are satisfied without penalty.
i j

1 2 3
i j

1 5 6 2

2 5 3 2

3 1 3 4

4 6 1 4

5 6 1 4

6 5

7 5 35 2 1 6

8 2 3 5 36 3 1 5

9 1 2 3 37 4 3 5

10 1 4 6 38 4 2 5

11 12 13 14 15 1 5 5 5 4 - 2 2 2 6 6 - - 3 39 6 2 4

16 4 6 3

17 5 4 6 45 2 1 4

18 5 2 6

19 1 5 2

20 1 4 3

21 22 23 1 6 6 4 - 5 3 3 2 51 2 6 5

24 4 5 2

25 26 27 6 - 3 4 6 5 1 1 2

28 3 5 2

1 2 3

29 30 31 - 3 3 - 1 5 - - 1

32 33 34 4 2 2 5 4 1 3 - 6

40 41 42 43 44 1 - - 5 2 2 3 3 3 5 6 1 1 - 4

46 47 48 49 50 3 - 4 4 2 1 6 6 6 4 2 3 - - 5

52 53 54 55 56 3 3 4 6 6 6 - 3 - 1 1 1 4 4

Table 19: Schedule calculated with OpenSolver for six physicians.26

Table 19 shows a schedule for six physicians. Half of the 24 abandoned shifts are at the weekend, because every physician only works at three weekends. With seven physicians, the supply is 168 shifts, which is exactly the same as the demand. Nonetheless the supply is not enough in order to run the department autonomous, because the constraints are too restrictive (e.g. the weekend constraints) and because physicians are occasionally absent due to holidays etc.

26

The schedules calculated with GAMS are listed in the appendix.

50

1 2 3
i j

1 2 3 4 5 6 7 8 9 10 11 6 4 1 1 1 3 3 3 6 6 7 7 6 4 4 2 2 2 4 1+2 1+2 5 5 7 6 5 5 7 7 7 4 3 1+3 29 7 4 2 30 6 4 2 31 5 6 1 32 3 5 1 33 3 5 1 34 7 2 35 7 2 36 4 7 2 37 5 6 4 38 5 3 6 39 2 7 3

12 7 5 3 40 2 1 7

13 6 4 41 5 1 4

14 6 4 42 5 1 4

15 16 2 5 1 3 6 1+2 43 3 7 4

17 4 3 5

18 4 7 5 46 1 2 3

19 6 7 4 47 6 2 3

20 2 6 1 48 4 6

21 2 6 1 49 4 6

22 7 3 1 50 7 5 4

23 4 3 7 51 7 2 5

24 2 4 6

25 2 1 6

26 5 1 6 54 1 6 4

27 7 3 5 55 1 5 3

28 7 3 5 56 1 5 3

1 2 3

44 45 5 1+2 3 5 7 7

52 53 3 3+4 6 6 2 2

Table 20: Schedule calculated with OpenSolver for seven physicians.

Six weekend shifts (each two AM, PM and overnight shifts) remain vacant, because the seven physicians work three weekends each. On the other hand, six shifts in the week are doublecrewed. The optimal z-value for seven physicians is 90 (6 shifts times 15, the latter number is the level of the weight coefficient for ).

The supply with eight physicians is 192 shifts (8 physicians times 24 shifts) and stand opposite a demand of 168 shifts. There are 24 shifts with double assignments. The z-value is 360 (24 shifts times 15, the weight coefficient). The weekend shifts are assigned by only one physician without exception, because the demand for weekend shifts meets the supply.
i j

1 2 3
i j

1 2 3 4 5 6 7 8 9 8 5 5 4 4+7 3 3 3+6 1 6 1 6 6 2 2 2 5 5 4 8 1 5 6 7 7 8 6+8

10 11 12 3 7 7 1 3+5 5 4 4 3+4

13 1 8 2

14 1 8 2

15 16 17 18 6 1+4 1 2+8 8 6+7 4+7 6 2 3 3 1

19 2 8 6

20 7 4 5

21 22 23 7 3 3 4 8 2 5 1+7 1+8

24 5 2 1

25 5 3 2

26 6 7 3

27 5 7 6

28 5 7 6

1 2 3

29 30 31 32 33 8 1+2 1+7 5+7 6+7 4 4 2+3 1+3 5 5 8 8 4 4

34 2 6 3

35 2 6 3

36 37 38 39 1 5 4 2 8 1+8 5 4 2 6 6+7 3+7

40 2 4 3

41 8 5 1

42 8 5 1

43 44 45 8 4 4 7 7 6 1 2+5 2+5

46 3 7 6

47 3 8 7

48 4 1 8

49 4 1 8

50 51 2 6 4 2+3 7 7

52 53 6 8 3 1+2 5 5

54 8 1 2

55 6 3 4

56 6 3 4

Table 21: Schedule calculated with OpenSolver for eight physicians.

6.6 A comparison of OpenSolver and GAMS


In Excel, every variable and every constraint (or more precisely every calculation for the left hand side of a constraint) has its own cell. The Excel spreadsheet for the original formulation contains approximately 4,700 formulas. This results in some drawbacks: The spreadsheet is getting large and it is hard to keep track of things. Consequently, the formulation becomes prone to error. If a left hand side of a constraint is adapted, every associated constraint must be changed. This quickly results in hundreds of changes. Even if copy-and-paste reduces the workload, there is still a lot of work. A possible troubleshooting is like finding a needle in a haystack. The expansion of the scheduling model to more physicians makes the spreadsheet larger, because the number of variables and constraints grows. Cells for the new variables have to be

51

added. Every constraint in relation with the added physician(s) needs to be newly built or adapted. Compared to this, an expansion in a GAMS code is unsurpassed easy: One only need to adapt the upper bound of the set of physicians to the new number.27 It is in general easier to change the model in a GAMS code, because not every single constraint is written out: Constraints applying for several shifts, days, physicians or weeks are defined in one equation. Furthermore, the calculation time with NEOS Server is impressively fast: Results are available within minutes and the server is quite reliable. However, if there are many other jobs running on the server, it happens that the process is canceled and no result is returned. Also the forwarding from the processing screen to the result screen not always works properly. In that case, the results can be fetched by a query on the server's website.28 Both Excel with OpenSolver and GAMS with NEOS Server provide high quality results in a very short time. OpenSolver provided optimal solutions for every model, while NEOS Server often retuned a suboptimal solution near the optimum. NEOS Server is faster than OpenSolver, which is not surprising since the computing power of NEOS Server is superior to the one of a personal computer. At the end of the day it is more appropriate to solve large-scale programs with an algebraic modeling system such as AMPL or GAMS, even if writing a code requires some specific knowledge.

6.7 The auxiliary variables are not helpful


The major simplification of the model shown in chapter 0 provokes the question, whether it is really efficient to include the auxiliary variables (s-variables) with all the additional constraints in the model. The reformulation of equations (29) to (44) and (46) to (50) reduces a set of 21 equations to only five equations. Simultaneously, more than 2,100 constraints are eliminated! Ferrand et al. (2011) argue that they present "[] a tighter problem formulation because each constraint comprises fewer binary variables, allowing the solver to reach the solution faster when branching from the LP relaxation" (Ferrand et al., 2011, p. 531). By adding more physicians, the number of nodes in the branch and bound algorithm grows exponentially, not linearly. In prevision of an extension of the model and in order to receive a satisfying result in a
27

Only the upper bound of the physicians' set, which is on line 8 in the GAMS code, must be adapted for a model expansion to more physicians. The GAMS code is published in the appendix. 28 There is an instruction in the appendix.

52

practical time, Ferrand et al. (2011) try to keep the number of nodes in the branch and bound algorithm as low as possible by accepting a more complicated model. The question is whether the constraints really comprise fewer binary variables in the original model compared to the modified model. Indeed, the equations in the original model comprise up to three binary variables less compared to the modification, only the modified equation (37r) contains as many binary variables as its original formulation. There is no evidence why the use of auxiliary variables fastens the branch and bound algorithm. The formulation with the s-variables performs better with regard to the number of nodes passed in the branch and bound algorithm. OpenSolver passes 914 nodes in 4.5 minutes in the formulation with s-variables, compared to 6,444 nodes in 9 minutes with the modified model. Because the reformulation contains fewer constraints; the solver calculates every node faster. Yann Ferrand claims that the formulation with the s-variables prevents some x-variables from taking a value of .29 More fractional values lead to more branching. There is no evidence for this issue in the first LP relaxation. OpenSolver does not reveal its insights about the further development of the LP relaxations in the branch and bound algorithm. But the fact that the original formulation only passes a fractional amount of nodes gives strong evidence to Yann Ferrand's statement. The gain of time due to the auxiliary variables is relatively small as against the complexity of the original model. Instead, the computing time is severely reduced by a simple change in the weight of the objective function coefficients. Consequently, there are better ways to make the scheduling model more efficient than utilizing the s-variables.

29

See the e-mail exchange in the appendix.

53

7 Conclusion: OpenSolver perfectly fits for medium-sized integer programs


Both approaches, GAMS in combination with NEOS Server and Open Solver with Excel, provide optimal or close to optimal solutions. The suggested solutions are better and calculated in a shorter time than in the original implementation in Ferrand et al. (2011). The fact that OpenSolver provides a solution in less than five minutes, compared to the six hours in Ferrand et al. (2011) is an overwhelming result. It is an important recognition that the calculation time of an MIP reacts extremely sensitive, sometimes even to minor changes in the model. Consequently, dealing with MIP requires a constant curiosity and the courage to try new paths. Despite the difficulty of solving large MIP models, this thesis shows that it is possible to expand the scheduling model for up to eight physicians. Even for eight physicians, an optimal solution is found in a reasonable time. With eight physicians, the emergency department can be operated independently without support from physicians of other departments. OpenSolver is perfectly suited for MIP with several hundred decision variables and constraints. Even if there are no restrictions about the model size, it is rather the practical implementation that limits the use of OpenSolver: Every single variable and constraint is represented by a cell in the spreadsheet. It is inconceivable to keep the overview in a model with tens of thousands variables and constraints. Practical problems often exhibit a large size with thousands or millions of variables and constraints, as a brief glance in the description of practical applications in the journal Interfaces demonstrates. For large problems, an algebraic model language like GAMS offers clear advantages. OpenSolver is a functional tool for small problems, although such problems are basically solvable with Excel's standard solver. Nevertheless, OpenSolver is much faster in solving MIPs thanks to the assistance of the open-source CBC-solver. A drawback of OpenSolver compared to the standard solver is the poor sensitivity analysis. It is only possible to display the right hand side (RHS) shadow prizes. Information about allowable increase and decrease of variables and RHS as well as reduced costs in the objective function remain unknown. At the end of the day, OpenSolver fulfills the promise of solving large LP and MIP models in Excel.

54

8 Outlook: A broader dissemination of mixed integer programming for scheduling


This thesis shows that the scheduling model can be improved. This process is not yet at the end, as the following impulse shows: It is noticeable that all solutions in this thesis suffer from only one deviation, namely the double occupancy of shifts. The other deviation variables are no issue at all. A further development of the scheduling model may adapt the objective function to this fact: The unproblematic flexible rules, namely the maximum number of overnight shifts and the extended free weekends, may become mandatory. Other deviation variables for new flexible rules can be implemented in the objective function instead. One main issue is the difficulty to handle large MIPs with many variables and constraints. Considering the dizzying speed of development of solvers and hardware in the last decade, future solvers will be able to solve even larger problems in a decent time. Refined formulations with reduced symmetry accelerate the branch and bound algorithm and consequently the solution process. Unfortunately, exceptional impacts on a schedule must still be integrated in the program code manually, such as individual agreements or holiday assignments. This embarrasses an extensive application of MIP for scheduling for planners without programming knowledge. It is desirable to develop user-friendly software which adapts all necessary changes in the MIP for these exceptional impacts. This software should also provide an interface in order to modify all parameters, including the number of physicians, workload per physician, distribution of shifts, cycle length etc. After configuring all parameters, the software would generate the MIP code and transmit it to the solver.

55

List of References
Achterberg, T., Koch, T., & Martin, A. (2005). Branching rules revisited. Operations Research Letters, 33, pp. 42-54. Atamtrk, A., & Savelsbergh, M. W. (2005). Integer-Programming Software Systems. Annals of Operations Research, pp. 67-124. Beaulieu, H., Ferland, J. A., Gendron, B., & Michelon, P. (2000). A mathematical programming approach for scheduling physicians in the emergency room. Health care management science, 3 (3), pp. 193-200. Bisschop, J. (2011). AIMMS Optimizaiton Modeling. Haarlem: Paragon Decision Technology. Brunner, J. O. (2010). Flexible Shift Planning in the Service Industry. The Case of Physicians in Hospitals. Berlin: Springer Verlag. Carter, M. W., & Lapierre, S. D. (2001). Scheduling Emergency Room Physicians. Health Care Management Science, 4, pp. 347-360. Chinneck, J. W. (2010). Practical Optimization: A Gentle Introduction. Retrieved May 5, 2012, from www.sce.carleton.ca/faculty/chinneck/po.html Czyzyk, J., Mesnier, M. P., & Mor, J. J. (1998). The NEOS Server. IEEE Computational Science & Engineering, 5, pp. 68-75. Dantzig, G. B. (1954). A comment on Edie's traffic delay at toll boths. Operations Research, 2, pp. 339-341. Ernst, A. T., Jiang, H., Krishnamoorthy, M., & Sier, D. (2004b). Staff scheduling and rostering: A review of applications, methods and models. European Journal of Operational Research, 153, pp. 3-27. Ernst, A. T., Jiang, M., Krishnamoorthy, M., Owens, B., & Sier, D. (2004a). An Annotated Bibliography of Personnel Scheduling and Rostering. Annals of Operations Research, 127, pp. 21-144. Ferrand, Y., Magazine, M., Rao, U., & Glass, T. F. (2011). Building Cyclic Schedules for Emergency Department Physicians. Interfaces, 41(6), pp. 521-533. Gendreau, M., Ferland, J., Gendron, B., Hail, N., Jaumard, B., Lapierre, S., et al. (2007). Physician Scheduling in Emergency Rooms. In E. K. Burke, & H. Rudov, Practice and Theory of Automated Timetabling VI (pp. 53-67). Berlin: Springer Verlag. Gomory, R. E. (1958). Outline of an Algorithm for Integer Solutions to Linear Programs. Bulletin of the American Mathematical Society, 64, pp. 275-278.

56

Guzelsoy, M., & Ralphs, T. K. (2011). Integer Programming Duality. Wiley Encyclopedia of Operations Research and Management Science. Hillier, F. S., & Lieberman, G. J. (2001). Introduction to Operations Research (7th ed.). New York: McGraw-Hill. Lodi, A. (2010). Mixed Integer Programming Computation. In M. Jnger, T. M. Liebling, D. Naddef, G. L. Nemhauser, W. R. Pulleyblank, G. Reinelt, et al. (Eds.), 50 Years of Integer Programming 1958-2008: From the Early Years to the State-Of-The-Art (pp. 619-645). Berlin: Srpinger. Margot, F. (2010). Symmetry in Integer Linear Programming. In M. Jnger, T. M. Liebling, D. Naddef, G. L. Nemhauser, W. R. Pulleyblank, G. Reinelt, et al. (Eds.), 50 Years of Integer Programming 1958-2008 (pp. 647-686). Berlin: Springer. Mason, A. J. (2012). OpenSolver - An Open Source Add-in to Solve Linear and Integer Programmes in Excel. In D. Klatte, H.-J. Lthi, & K. Schmedders, Operations Research Proceedings 2011. Selected Papers of the International Conference on Operations Research (OR 2011), August 30 - September 2, 2011, Zurich, Switzerland. (pp. 407-412). Berlin: Springer. Pochet, Y., & Wolsey, L. A. (2006). Production Planning by Mixed Integer Programming. New York: Springer. Trick, M. A. (1997). Retrieved July 5, 2012, from A Tutorial on Integer Programming: http://mat.gsia.cmu.edu/orclass/integer/integer.html Tsang, E. (1993). Foundations of Constraint Satisfaction. London: Academic Press. Whitehead, D. C., Thomas, H., & Slapper, D. R. (1992). A rational approach to shift work in emergency medicine. Annals of Emergency Medicine, 21 (10), pp. 1250-1258. Winston, W. L., & Albright, S. C. (2012). Practical Management Science (4th ed.). Mason, Ohio: Cengage Learning. Wolsey, L. A. (1981). Integer Programming Duality: Price Functions and Sensitivity Analysis. Mathematical Programming, 20, pp. 173-195.

57

Appendix
GAMS code
Original formulation

58

59

60

61

Reformulation

62

63

64

Expansion up to eight physicians

65

66

Schedules calculated with GAMS and NEOS Server for up to eight physicians

1 2 3
i j

1 5 6 2

2 5 3 2

3 1 3 4

4 6 1 4

5 6 1 4

6 5

7 5 35 2 1 6

8 2 3 5 36 3 1 5

9 1 2 3 37 4 3 5

10 1 4 6 38 4 2 5

11 12 13 14 15 1 5 5 5 4 - 2 2 2 6 6 - - 3 39 6 2 4

16 4 6 3

17 5 4 6 45 2 1 4

18 5 2 6

19 1 5 2

20 1 4 3

21 22 23 1 6 6 4 - 5 3 3 2 51 2 6 5

24 4 5 2

25 26 27 6 - 3 4 6 5 1 1 2

28 3 5 2

1 2 3

29 30 31 - 3 3 - 1 5 - - 1

32 33 34 4 2 2 5 4 1 3 - 6

40 41 42 43 44 1 - - 5 2 2 3 3 3 5 6 1 1 - 4

46 47 48 49 50 3 - 4 4 2 1 6 6 6 4 2 3 - - 5

52 53 54 55 56 3 3 4 6 6 6 - 3 - 1 1 1 4 4

Table 22: Schedule for six physicians.


i j

1 2 3
i j

1 5 7 4 29 7 5 1

2 5 2 7 30 4 5 7

3 3 6 2 31 6 2 4

4 4 3 6 32 6 2 3

5 1 4 3 33 1 2 3

6 1 7 5 34 7 5 1

7 1 7 5 35 7 5 1

8 6 7 2 36 6 7 5

9 1 6 2 37 3 2 6

10 1 4 6 38 1 3 2+6

11 7 4 1 39 5 4 1

12 3 4 7 40 5 7 1+4

13 5 2 3 41 2 3 7

14 5 2 3 42 2 3 7

15 1 6 2 43 2 6 3

16 4 6 1 44 4 5 6

17 5 7 4

18 2 5 7

19 20 21 3 3 3 5 - 2 4 4 47 48 49 2 4 4 1 6 6 3 - -

22 6 7 4 50 7 4 6

23 5+6 1 7 51 7 3 5

24 3 1 5 52 7 3 5

25 4 3 5 53 2 1+3 5

26 4 2 3

27 6 1 2

28 6 1 2

1 2 3

45 46 7 2+3 1+5 1 4 7

54 55 56 2 - 6 4 4 1 6 6

Table 23: Schedule for seven physicians.


i j

1 2 3
i j

1 2 4 3 7 6 1 4+7 29 1 3 2

3 4 5 8 2+8 5 6 1 2 3 6 1 33 5 7 2

6 5 4 3 34 6 3 7

7 5 4 3 35 6 3 7

8 9 10 11 6 6 2+3 3 4 5 1 1 8 7+8 5+7 2+7 36 8 4 6 37 1 4 8 38 39 2+3 2+6 7 3+7 1 1

12 4 1 2 40 6 5 7

13 4 8 6 41 2 5 4

14 4 8 6 42 2 5 4

15 16 5 5+7 3+8 2 6 3 43 1 3 4

17 7 8 2

18 4 5 7+8

19 1 4 5 47 8 6 4

20 1 6 2 48 8 7 1

21 1 6 2 49 8 7 1

22 3 8 6 50 2 5 1

23 7 8 3 51 3 2 5

24 1 7 3

25 26 4 4 6+8 6+8 1 5 54 8 2 6

27 7 2 5 55 3 1 8

28 7 2 5 56 3 1 8

1 2 3

30 31 32 1+8 5 5 3 1 2 4 4+8 4+8

44 45 46 2 6+7 6 1+5 5 4+7 3 2+3 5

52 53 4+7 7 3+6 2+4 5 6

Table 24: Schedule for eight physicians.

67

Schedule s3/s4/s5 3 4 5

Objective function
i
Bi nary

Decision variables x ijk 2 1 1

Deviation variables Auxiliary variables d1/d2 s2 s1 d0

Original formulation

mi n

15

Excel spreadsheet (excerpt)

Sum d-variables 1 d0 0 d1 0 d2

l 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 1

l 1 Mo Tu We Th Fr Sa Su 2 Mo Tu We Th Fr Sa Su 3 Mo Tu We Th Fr Sa Su 4 Mo Tu We Th Fr Sa Su 5 Mo Tu We Th Fr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0= 0 0 0 0 0

1 4 4 4 3 3 3 3 5 5 3 3 4 4 4 4 4 4 5 5 5 5

2 2 2 2 3 4 2 2 5 2 5 5 5 2 5 5 3 3 3 4 4 -

3 2 5 5 1 1 1 1 5 5 4 4 4 4 2 2 1 1 1 1 2 2 5 1 1 1 1 3 3 4 2

2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 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0 0 0 0 0 1

41 1

42 1

43 2

44 0

45 4

46 0

47 1

48 0

49 0

50 0 0 -1 -1 0 -1 0 0 0 0 0 0 0 0 0 0 0 -1 -1 0 -1 0 0 0 -1 -1 0 -1 0 0> 0 0 0 0 0

72

Objective function 3 4 5 3 1
i
Bi nary

Decision variables x ijk 2 1


j

Deviation var. d1/d2 d0

Constraints Eq. No. 2 1 RHS

Reformulation

mi n

15

Sum d-variables 1 d0 0 d1 0 d2

l 1 Mo Tu We Th Fr Sa Su 2 Mo Tu We Th Fr Sa Su 3 Mo Tu We Th Fr Sa Su 4 Mo Tu We Th Fr Sa Su 5 Mo Tu We Th Fr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

1 3 5 5 4 4 4 4 4 4 4 2 2 2 5 3

2 5 3 2 2 2 2 2 2 3 3 3 3 3 5 5 5 5 5 5 4 4 5 4 4

3 1 1 1 1 4 4 4 1 1 1 1 5 5 5 1 1 1 1 2 2 2 3 3 4 4 1 1 1 1 2 2 5 1

1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0= 0 0 0 0 0

2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

3 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 1

1 2 0 0 0 0 0 0 0 0 0 1 1 0 1= 0 1 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0

1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 1> 0 1 1 0 0 3 0 0 1 1 0 0 0 0 0 0 0 1 1 1 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 1 4 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 0 1 1

41rr 2

45 4

46r 1

52 5 1 0 0 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 1 1 1 0 0 0 0 1 1 1 0

76

Objective function 3 4 5 6 7 8
i
Bi nary

Decision variables x ijk 2 1


j

Deviation var. d1/d2 d0

mi n

360

Expansion for up to eight physicians

Sum d-variables 24 d0 0 d1 0 d2

l 1 Mo Tu We Th Fr Sa Su 2 Mo Tu We Th Fr Sa Su 3 Mo Tu We Th Fr Sa Su 4 Mo Tu We Th Fr Sa Su 5 Mo Tu 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

1 8 5 5 4 4+7 3 3 3+6 1 3 7 7 1 1 6 1+4 1 2+8 2 7 7 3 3 5 5 6 5 5 8 1+2

2 6 1 6 6 2 2 2 5 5 1 3+5 5 8 8 8 6+7 4+7 6 8 4 4 8 2 2 3 7 7 7 4 4

3 4 8 1 5 6 7 7 8 6+8 4 4 3+4 2 2 2 3 3 1 6 5 5 1+7 1+8 1 2 3 6 6 5 8

1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1

2 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

3 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0

1 2 0 0 0 0 0 0 0 0 0 1 1 0 1= 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 1 0

3 0 0 0 0 0 0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0 0 0 0 0 0 0 1 1 5 0 1 1 1 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 1 1 0 0 1 1 0 1 1 1 0 6 1 0 1 1 1 0 0 1 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 1 0 0 7 0 0 0 0 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 1 1 1 0 0 0 1 1 1 0 0

52 1

53 1 8 1 1 0 0 0 0 0 1 1 0 0 0 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 1 1

80

Using NEOS Server


NEOS Server is available at www.neos-server.org. In order to submit an optimization problem, proceed as follows: Click on the NEOS solver icon and choose an appropriate solver which processes GAMS codes in the section for mixed integer linear programming (e.g. CBC, Gurobi or XpressMP).

Figure 8: Screenshot of NEOS Server with solvers available for IP and MILP.

(1) Select the gams file (*.gms) from the hard disk (see Figure 9). (2) Select the GDX output option. This returns the results in a *.gdx-file which can be edited with the GDXViewer. (3) The log file informs about the procedure.

(4) Select the option "Put in priority queue". This option may lead to an unwished termination of the job. If this does happen, try to run the job without this option.

(5) Insert your e-mail address, if you wish to receive the results per e-mail. (6) Submit the job to NEOS Server.

81

Figure 9: The input page on NEOS server.

Sometimes, NEOS does not automatically forward from the solving screen to the result screen. In this case, the results for the job can be fetched by a query: Note the job number and password (see Figure 10). Go to the initial Homepage of NEOS and click on "view current job queues" (see Figure 11). Insert the job number and password and select "View Job Results" (see Figure 12).

Figure 10: Solver screen of NEOS with job-number and password for a query.

82

Figure 11: Main screen of NEOS Server with the query option.

Figure 12: Query screen on NEOS.

83

Installation hints for OpenSolver


OpenSolver is downloaded as a .zip file on http://opensolver.org/installing-opensolver. After extracting the .zip file on the hard disk, double-click on the add-in OpenSolver.xlam. Excel is opened and OpenSolver shows up in the data toolbar. Make sure to activate the macros when asked to do so. In order to activate the OpenSolver add-in permanently, open the options in the file tab and choose the add-ins category. At the bottom of the dialog box, make sure that Excel add-ins is selected in the Manage box and click "Go". Select "Browse" and choose the OpenSolver add-in. At the next start of Excel, OpenSolver shows up automatically.30

30

The installation hints are for Microsoft Excel 2010. Add-in settings may differ in other versions.

84

Using OpenSolver
The following user advices require basic knowledge in linear programming and Excel's standard solver from Frontline. OpenSolver provides some options (see Figure 13): The calculation time can be limited, either with the maximum solution time in seconds or with the branch and bound tolerance in percent. With a tolerance of 100%, OpenSolver stops at the first found feasible integer solution. A tolerance of 50% means that OpenSolver terminates the branch and bound algorithm as soon as the optimal LP relaxation value is within the range of the best solution found so far (the incumbent) plus/minus 50%. In a setting with an optimal value of 15 and a tolerance of 50%, the solver stops as soon as the incumbent is 30 or lower. If the tolerance is only 20%, the solver does not stop before the incumbent is 18 or lower. The Quick AutoModel was not tested in the present thesis, since the scheduling model is too comprehensive for this tool.

Figure 13: The Open solver module in the data tab (left) and solve options.

A handicap of OpenSolver is illustrated in Figure 14: Compared to the Excel's standard solver, OpenSolver does not support range names. Although new constraints can be added by using range names, but the names are not displayed in the constraint overview. On the other hand, the constraints can be highlighted graphically in the spreadsheet (see Figure 15). This feature is activated by the option "Show model after saving" in the model dialog box or by the icon "Show/Hide Model" in the OpenSolver toolbar. When the model is set up, you can click on the icon "Solve" in the toolbar and OpenSolver starts the calculation.

85

Figure 14: Model dialog box.

Figure 15: OpenSolver emphasizes in color the model.

86

Figure 16: OpenSolver menu with Quick Solve.

The OpenSolver icon in the toolbar allows to solve the LP relaxation of an IP or to use Quick Solve. Quick Solve is useful tool if a model is repeatedly solved with some parameters changing. After choosing the modifiable parameters and initializing Quick Solve, OpenSolver should provide the solution with the changed parameters in a short time. Unfortunately, Quick Solve did not accelerate the computation time of the scheduling model. .

87

E-Mail exchange with Yann Ferrand


Mail to Yann Ferrand on April 29, 2012: Dear Mister Ferrand I am writing my master thesis at the chair of Karl Schmedders, Professor of Quantitative Business Administration at the University of Zurich. One goal of my thesis is to find out whether the open-source-software OpenSolver for Excel is able to solve large Integer Programs IP. In search of an appropriate problem in academic literature I found your paper and modeled it in Excel. To my surprise, OpenSolver found a solution with a z-value (objective function) of 0 in less than two hours. Additionally, I modeled your IP with GAMS and solved it on the NEOS-Server. NEOSServer calculates the solution within seconds! The distribution of the shifts is different to the solution in OpenSolver. However, the z-value of the objective function is 0 again. Both solutions account the fact that the end of one cycle is connected to the beginning of the subsequent cycle. I wonder why I get a different solution compared to yours; and have two possible explanations: (1) I made wrong assumptions or (2) there are additional constraints not mentioned in the paper. May you have an idea for the different results? These are basically the assumptions made: - I merged equations 4 and 5 to x3jk + x1(j+1)k + x2(j+1)k 1 If physician k works overnight, he or she does not work AM and PM the next day. And if he does not work overnight, he or she works one shift at most the next day. Therefore, the sum of the three variables is always less or equal 1. - Equations 6 and 7 are merged in the same way. - Equation 10: Physicians 1 and 2 work 24 shifts per cycle, physician 3 works 19 shifts and physicians 4 and 5 work 26 shifts (I counted the number of shifts in Table 1 in your paper). - Equation 11: The upper bound is 9 (except for physician 3: 7). Both my solutions (with OpenSolver and GAMS) are attached.

88

I would be glad if my thesis could support your enhancement of the cyclic schedule, as you describe in the conclusion-section, and hope to receive a favorable answer.

Answer from Yann Ferrand on May 5, 2012: Thank you very much for your email, I am thrilled that you are interested in this problem. Regarding your assumptions: 1) I don't suspect merging equations 4 and 5, and 6 and 7 is a problem. 2) For equation 10, you are correct: the right hand side (RHS) is respectively for physicians 1 through 5: 24, 24, 19, 26 and 26. 3) For equation 11, I think this is where you have an issue: there is both upper and lower bound. Physician 1 is mentioned in the article (all 24 shifts are night shifts), for physician 2 the bounds are 8 and 8; for physician 3 they are 6 and 7; and physicians 4 and 5 they are 8 and 9. For all but physician 1, these same bounds apply for day/evening/night shifts. Now, in your GAMS file solution (edits attached), I see that physician 2 is working 6 night shifts, and physician 3 is working 5 night shifts. This is not enough. Right now I cannot recall the exact reason why, but I remember that it was impossible to avoid assigning 2 physicians to some of the night shifts, the reason has to do with the number of night slots available, and the minimum requirements for night shifts for all the physicians. I would rerun your formulation with those lower bounds for the number of shifts of each type, and see what you get. Another precision: in several instances I tried I could get a feasible solution in a few hours by terminating the search (my objective would not be 0, and the solver would keep searching). I look forward to hearing from you about your progress.

Mail to Yann Ferrand on May 7, 2012: Thank you so much for your helpful answer. I really forgot about equation 11 and did not check the lower bound of the distribution of the different shifts. I guess that after implementing the lower bounds, the new optimal z-value should be 15, which means that exactly one overnight shift is assigned to 2 physicians. The reason for this is in equation 25: each physi-

89

cian is assigned to work overnight shifts at exactly one weekend (3 weekends for physician 1); hence 7 (3 + 4*1) weekends are covered with overnight shifts. In total, there are at least 54 overnight shifts to be assigned (24 + 8 + 6 + 8 + 8, in accordance with the lower bounds) but only 53 overnight shifts can be assigned due to equation 25 (56 3; one weekend is not covered). As soon as my new solution is beyond the shadow of a doubt Ill send you the new results. Another issue: I am reformulating equations 29 to 44 and 46 to 50 eliminating the s-variables (and ignoring your hint of a tight problem formulation). Please find attached a file with a possible reformulation.

Answer from Yann Ferrand on May 8, 2012: You are correct on your reasoning about the number of night shifts and the weekend night shifts assignments, that's what I was trying to remember the other day. Now, the reason we went with the solution in the paper as opposed to one where there is only 1 shift with double assignments is that the physicians liked this particular solution we proposed. Also, the tight problem formulation may not be a big issue in this instance with 5 physicians, but with 6 physicians it helps. Also, with 7 and 8 physicians I could not get solutions with this formulation. Let me know what kind of solutions you get once you have them, it would be great if you were able to generate good solutions with the open solver!

Mail to Yann Ferrand on July 18, 2012: I got stuck a bit at the theory section of my thesis. One point remains unclear to me: OpenSolver indeed passes through much fewer nodes (9,030 nodes) with your formulation with the s-variables, compared to the formulation without the s-variables (39,000 nodes!). Anyway, the solution time with OpenSolver is similar with both approaches: the optimal solution of 15 is obtained within 45 minutes with the s-variables and within 52 minutes without the svariables. As a goodie in my thesis I formulated the problem with 6 and 7 physicians and received an optimal solution using NEOS-server (with a GAMS input).

90

Ill gladly send you a copy of the thesis by end of August.

Answer from Yann Ferrand on July 19, 2012: Thank you for the update. This is good news that you found a solution for bigger size problems. The formulation with the s-variables prevents some x-variables from taking a value of , which then lead to more branching.

91

Avoided constraints due to reformulation


Section 0 claims that 2,152 constraints can be eliminated by the formulation without svariables. The following table gives an explanation of this number:

group of equations 29-32 33-36 37-40 41-44 46-50

# of constraints in original problem

# of constraints in reformulation

4eq * 4ph * 56d 4eq * 5ph * 56d 4eq * 5ph * 8w

= 896 = 1,120 = 160

1eq * 4ph * 56d 1eq * 5ph * 56d 1eq * 5ph * 8w 1eq * 4ph * 8w 2eq * 1ph * 56d
31

= 224 = 280 = 40 = 32 = 112 688

4eq * 4ph * 3d * 8w = 384 5eq * 1ph * 56d = 280 2,840

Table 25: Number of constraints in the original and modified version.32

The original formulation contains 2,152 constraints more than the reformulation.

31

It is only one new equation (56 constraints). But this equation requires that equation (29r) must hold also for physician 1. Therefore, the reformulation of equations (46) to (50) results in 112 constraints. 32 The abbreviations stand for: eq: equations, ph: physicians, d: days, w: weeks

92

Statutory declaration
I herewith declare that I have completed the present thesis independently making use only of the specified literature and aids. Sentences or parts of sentences quoted literally are marked as quotations; identification of other references with regard to the statement and scope of the work is quoted. The thesis in this form or in any other form has not been submitted to an examination body and has not been published.

Date: _______________________

Signature: ______________________

93

You might also like