OPERATING ROOM ALLOCATION USING
MIXED INTEGER LINEAR PROGRAMMING (MILP)
PROJECT REPORT
Submitted by
SREENATH G V
SASTHA KRISHNAN V
SARAH MATHEW
KAILAS SREE CHANDRAN
To
The University of Kerala
In partial fulfilment of the requirements for the award of the degree
Of
Bachelor of Technology in Mechanical Stream - Industrial Engineering
DEPARTMENT OF MECHANICAL ENGINEERING
COLLEGE OF ENGINEERING, THIRUVANANTHAPURAM
April 2010
DEPARTMENT OF MECHANICAL ENGINEERING
COLLEGE OF ENGINEERING
THIRUVANANTHAPURAM
CERTIFICATE
This is to certify that the Project Report entitled “OPERATING ROOM
ALLOCATION USING MIXED INTEGER LINEAR PROGRAMMING
(MILP)” submitted by “Sreenath G V, Sastha Krishnan V, Sarah Mathew and
Kailas Sree Chandran” to the University of Kerala in partial fulfilment of the
requirements for the award of the Degree of Bachelor of Technology in Mechanical
Stream - Industrial Engineering, is a bonafide record of the work carried out by them
under my/our guidance and supervision. The contents of this work in full or in parts,
have not been submitted to any other institute or university for the award of any
degree or diploma.
SRI. K. SUNIL KUMAR PROF. E. ABDUL RASHEED
Lecturer Head of The Dept Of Mechanical Engineering
Dept. of Mechanical Engg; College of Engineering
(GUIDE) Thiruvananthapuram
ACKNOWLEDGEMENT
It is with great pleasure, we place on record our deep sense of gratitude and
indebtedness to our guide Sri. K. SUNIL KUMAR, Lecturer, Department of
Mechanical Engineering, College of Engineering, Thiruvananthapuram, for helping us
to carryout this work successfully.
We take this opportunity to express our most sincere thankfulness to Prof. E.
ABDUL RASHEED, Head of the Department, Department of Mechanical
Engineering, College of Engineering, Thiruvananthapuram, for his valuable
directions.
We are also thankful to Prof. P. VINCENT, Former Head of the Department,
Smt. MINI R.S., Lecturer and Staff Advisor, Department of Mechanical Engineering,
College of Engineering, Thiruvananthapuram for their direct and indirect helps for the
success of this project.
Last but not least, we are grateful to our parents, friends and classmates for
their help and co-operation for the successful completion of this project.
SREENATH G V
SASTHA KRISHNAN V
SARAH MATHEW
KAILAS SREE CHANDRAN
ABSTRACT
Public hospitals are non-profit organizations, and their prime operational objective is
to provide medical services to their patients at a reasonable cost. In such an
environment, a significant amount of time and resources are invested in operating
theatres.
In most hospitals, the waiting period for surgeries are high and efforts made in the
efficient utilization of resources can prove to be productive in long term. Our aim was
to optimally allocate the Operating Rooms of the hospital and to minimize the total
length of stay of patient. For that, a methodology for allocating operating room
capacity to specialties has been developed. It consists of a finite-horizon mixed
integer programming (MIP) model which determines a weekly operating room (OR)
allocation template that minimizes inpatients' cost measured as their length of stay. For the purpose, a hospital with a certain number of operating theatres and specialties
has been considered.
A basic model and two variants of it have been developed. A number of clinical
constraints (e.g. maximum number of hours allocated to each specialty, surgeon and
staff availability) are included in the formulation of the basic model. The first variant
of the model brings in the emergency situations that could arise for each specialty at
the hospital. The second variant considers the post-operative care for the patient at the
hospital. The model output gives optimized allocation of operating rooms to each
speciality for each day.
On a case example of a Pushpagiri Institute of Medical Sciences and Research Centre,
Thiruvalla, we show how the hospital length of stay pertaining to surgery can be
reduced.
CONTENTS
1. CHAPTER 1: Introduction
1.1 Introduction 01
1.2 Motivation for the Project 02
2. CHAPTER 2: Study
2.1 Study of Operating Theatres 03
2.2 Study of MATLAB 04
2.3 Study of IBM ILOG CPLEX 17
2.4 Study of Operating Theatre Scheduling 32
2.5 Study of MILP 35
3. CHAPTER 3: Modeling
3.1 Problem Identification 38
3.2 Problem Formulation 39
3.3 Objective Function 40
3.4 Constraints 41
3.5 Notation 41
3.6 Assumptions 43
3.7 Decision Variables 44
3.8 Models 45
4. CHAPTER 4: Case Study
4.1 Data Collection 51
4.2 Data analysis and Interpretation 51
4.3 Solving the Model 52
4.4 Results 54
5. CHAPTER 5: Conclusion and Future Works 56
APPENDICES
Appendix 1: Collected Data 57
Appendix 2: MATLAB code 59
Appendix 3: Screenshots of MATLAB 70
REFERENCE 71
LIST OF FIGURES
Figure 2.1 The desktop of MATLAB 07
Figure 4.1 Operating Rooms allocation for Speciality 1 55
Figure 4.2 Operating Rooms allocation for Speciality 2 55
Figure AP 3.1 MATLAB Programming Window 70
Figure AP 3.2 MATLAB Model running window 70
LIST OF TABLES
Table 2.1 Concert Technology Libraries 20
Table 2.2 Summary of Optimizers 22
Table: 4.1 Percentage of Surgery in each department 52
Table 4.2 Non-Emergency demand 53
Table 4.3 Emergency demand 53
Table 4.4 Results 54
Table AP 1.1 Average daily Out Patient Department attendance 57
Table AP 1.2 Number of surgeries for the year 2009 58
1
CHAPTER 1
1.1 INTRODUCTION
Surgery is an important activity in most hospitals and clinics since it is estimated to
generate around two thirds of hospital revenues. On the other hand, it accounts for
approximately 40% of hospital resource costs, including the costs of personnel
(surgeons, anesthetists, nurses, etc.) and facilities (operating rooms, intensive care
beds, etc.). Surgery takes place in a context of challenging trends such as heavy
expenditure on health care, increasing rates in health care costs, and rising surgery
demand due to aging populations and technological advances that have broadened the
scope of surgical interventions. In this context, hospital management is subject to ever
mounting pressures to control surgical costs while ensuring quality of care for surgical
patients in a timely manner. A successful cost containment strategy must integrate
decision-making at all levels: strategic, tactical, and operational. At the operational
level, one of the main problems is surgical case scheduling (SCS)[1].
In many hospitals, a large percentage of patients undergo some type of surgery when
admitted or during their stay in a hospital. To reduce a patient‘s length of stay and
also for The sake of the patient‘s health, it is ideal that a surgery is performed as soon
as it is requested or judged to be needed. However, it is common in a hospital that
patients have to wait in bed for their surgery for a couple of days or sometimes a
longer time (especially in public hospitals[2].
In a hospital environment, significant amount of time and resource is allocated for the
working of operating theatres. This is made more complicated by the demand being
2
uncertain. If optimum allocation strategies are devised, then worthy savings in time
and there by resources can be achieved. In the present project, an MILP model has
been formulated with the objective of reducing the length of stay of patient in the
hospital for treatment.
While trying to maximize the utilization of the OR, managers are confronted with the
complexity of the case mix and high costs for overtime of the OR staff. Typically, in
hospitals with a complex case mix with a high variability in the duration of surgical
cases, utilization rates are significantly lower than 100%. For example, 100%
utilization for a cancer medical centre is utopian, since a considerable number of the
surgical cases cannot be completed within the planned duration because of the
unpredictability of the disease. Typically in a cancer centre the duration of surgical
cases is unpredictable and they can last much longer than expected. This causes
frequent overtime in operating rooms of a cancer centre[3].
1.2 MOTIVATION FOR THE PROJECT
Public hospitals are non-profit organizations, and their prime operational objective is
to provide medical services to their patients at a reasonable cost. With better
utilization of available resources, treatment can be provided to more people. This is
significant in the sense that the government is constrained on resources and more
patients needs to be treated with the available resources.
Our work focuses on reducing the delay described above, or, in particular, minimizing
Patients' length of stay waiting for their surgery by developing a methodology for
allocating OR capacity to different medical specialties.
3
CHAPTER 2
2.1 STUDY OF OPERATION THEATRES
In many hospitals, patients are categorized into two types: emergency patients, non-
emergency patients, in their patient database and also when the hospital staff analyze
and discuss their operational processes (e.g., surgery planning and scheduling).
Another classification scheme of patients is by medical specialty, like Burns, Cardiac,
or Trauma patients. Some specialties have both types of patients undergoing surgery,
but others only have one or two[6].
Operating rooms can be considered of two types: emergency and non-emergency. A
hospital often has only a few emergency ORs and all the others as non-emergency
ORs. The emergency ORs are solely allocated to the emergency patients who need
surgery, and usually all specialties‘ surgeries can be performed in that room. The non-
emergency ORs are often allotted to different specialties. Though a non-emergency
OR assigned to a specialty is intended for its non-emergency surgeries (i.e., inpatient
and outpatient surgeries), the room can also accommodate for emergency surgeries of
that particular specialty. Indeed, many medical situations require that the emergency
patients be given a higher priority in accessing the non-emergency ORs than the non-
emergency patients[1].
Before each working day (usually one day in advance), the doctors determine which
inpatients in their specialty will have surgery performed on the following day. When
making these decisions, they usually first accommodate outpatient surgeries
scheduled for the next day because these have been previously scheduled many days
4
in advance. Also, they take into account the number of blocks/rooms allocated to their
specialty on that day, and the order and degree of urgency of all the active inpatients'
surgery requests. During a working day, surgeons try to finish as many scheduled
surgeries as possible, in a predetermined order. In addition, emergency surgery
demand arises almost every day, and surgeons try to operate upon these emergency
patients as soon as possible because of their critical condition. Usually, they are sent
into the emergency OR immediately, as long as it is available. If the emergency OR is
busy when needed, the emergency patient is operated in one of the non-emergency
rooms allotted to the particular specialty in which the patient or the needed surgery
belongs. As a result, some scheduled inpatient and outpatient surgeries may have to be
postponed to a later date or rescheduled. Also, surgeries scheduled for the afternoon
may not be performed because they are too much behind schedule, and they cannot be
completed within the staffed hours if started[8].
2.2 STUDY OF MATLAB
2.2.1 Introduction
MATLAB is a powerful computing system for handling the calculations involved in
scientific and engineering problems. The name MATLAB stands for
MATrixLABoratory, because the system was designed to make matrix computations
particularly easy. The MATLAB software package is used for computation in
engineering, science, and applied mathematics. It offers a powerful programming
language, excellent graphics, and a large standard library. The focus in MATLAB is
on computation, not mathematics: symbolic expressions and manipulations are not
possible, except through the optional Symbolic Toolbox. All variables must have
5
values, and all results are numerical and potentially inexact, thanks to the rounding
errors inherent in computer arithmetic. The emphasis on numerics is typical for most
work in scientific computation. Compared to other numerically oriented languages,
such as C++ and Fortran, MATLAB is usually found to be much easier to use.
However, its execution speed can be slower. This gap is not always as dramatic as
popular lore has it, and it can often be narrowed or closed with good MATLAB
programming. Moreover, one can link other types of code into MATLAB, or vice
versa, and MATLAB has some optional support for parallel computing. Still,
MATLAB is usually not the tool of choice for high-performance computing.
Whatever you think of these or other limitations of MATLAB, they have not held
back its popularity: a recent search for ―matlab‖ on the books section of Amazon.com
turned up 8,543results! Rapid code development and interaction with data often trump
execution speed, and the integrated graphics and expert routines that come with
MATLAB can be decisively helpful. Even for speed hungry users, MATLAB can be a
valuable environment in which to explore and fine-tune algorithms before creating
production code in another environment. Successful computing languages and
environments reflect a distinctive set of values. In MATLAB, those values include an
emphasis on experimentation and interaction with data and algorithms; syntax that is
compact, friendly, and interactive (rather than tightly constrained and verbose); a
kitchen-sink mentality for providing functionality; and a predilection for vectors,
matrices, and arrays[5].
2.2.2 History
MATLAB was created in the late 1970s by Cleve Moler, then chairman of the
computer science department at the University of New Mexico.He designed it to give
6
his students access to LINPACK and EISPACK without having to learn Fortran. It
soon spread to other universities and found a strong audience within the applied
mathematics community. Jack Little, an engineer, was exposed to it during a visit
Moler made to Stanford University in 1983. Recognizing its commercial potential, he
joined with Moler and Steve Bangert. They rewrote MATLAB in C and founded The
Math Works in 1984 to continue its development. These rewritten libraries were
known as JACKPAC. In 2000, MATLAB was rewritten to use a newer set of
libraries for matrix manipulation, LAPACK[16].
MATLAB was first adopted by control design engineers, Little's specialty, but
quickly spread to many other domains. It is now also used in education, in particular
the teaching of linear algebra and numerical analysis, and is popular amongst
scientists involved with image processing.
2.2.3 A Quick Tour
When you start MATLAB, you get a multi paneled desktop, as seen in Figure 2.1.
The layout and behavior of the desktop and its components are highly customizable.
The component that is the heart of MATLAB is called the Command Window,
located in the middle by default. Here you can give MATLAB commands typed at the
prompt, shown as >>. Unlike Fortran and other compiled computer languages,
MATLAB is an interpreted environment- you give a command, and MATLAB tries to
execute it right away, then awaits another. At the left you can see the Current
Directory window. In general MATLAB is aware only of files in the current directory
(folder) and on the list known as its path, which can be customized. Commands for
working with the directory and path include cd, what, which, add path, and edit path
7
(or you can choose Set path ... from the File menu).You can add files to a directory
on the path and thereby add commands to MATLAB[16].
Figure 2.1: The desktop of MATLAB
At the top right is the Workspace window. The Work space shows you what variable
names are currently defined and some information about their contents. At start-up it
is, naturally, empty. This represents another break from compiled environments:
variables created in the work space persist for you to examine and modify, even after
code execution stops. Below the Work space window is the Command History
window. As you enter commands, they are recorded here. This record persists across
different MATLAB sessions, and commands or blocks of commands can be copied
from here or saved to files. Thus the Command History is very useful if you realize
belatedly that you need to save some or all of what you have been doing interactively.
As you explore MATLAB, you may encounter some toolboxes. These are
8
individually packaged sets of capabilities that provide in-depth expertise on particular
subject areas. There is no need to issue a command to load them- once installed, they
appear on the path and are available automatically.
2.2.4 Graphical Versus Command-Line Usage
Originally, MATLAB was entirely a command-line environment, and it retains a bias
in that direction. But it is possible to access a great deal of the functionality from
graphical widgets such as menus, buttons, and soon. These interfaces are especially
useful to beginners, because they layout the available choices clearly. In particular,
take time to right-click (or Control-click on a Mac®) on various objects to see what
you might be able to do with them. As a rule, graphical interfaces can be more natural
for certain types of inter-active work, such as annotating a single graph, whereas
typed commands remain better for complex, precise, repeated, or reproducible tasks.
Much of the time, you can choose which ever mode of operation suits you. For
instance, you can write a function that customizes any figure‘s appearance, but you
can also save aspects of a current figure‘s style as a template just by pointing and
clicking. Moreover, you can create your own graphical interfaces and even distribute
them with your code as a package for non-MATLAB users. In the end, an advanced
MATLAB user should be able to exploit both modes of operation[5].
2.2.5 Help
MATLAB is huge. Nobody can tell you everything that you personally will need to
know; nor could you remember it all anyway. It is essential that you become familiar
with the online help. There are two levels of help:
9
• If you need quick help on the syntax of a command, type help in the
commandwindow. For example, help plot shows directly in the Command Window all
the ways in which you can use the plot command. Typing help by itself gives you a
list of categories that themselves yield lists of commands.
• Typing doc followed by a command name brings up more extensive help in a
separate window. For example, doc plot is better formatted and more informative than
help plot. In the left panel one sees a hierarchical, browsable display of all the online
documentation. Typing doc alone or selecting Help from the drop-down menus brings
up the window at a root homepage.
Starting in MATLAB7.7, the Command Window includes a function browser whose
icon is , sitting next to the prompt. Clicking on it yields a searchable, hierarchical
listing of available functions, with help available on one more click. Merely pausing
after typing the name of a function and its opening parenthesis brings up a context-
sensitive box with syntactic suggestions, as well. The Getting Started with MATLAB
manual is a good place to get a more leisurely and thorough introduction than the one
to follow here. Depending on your installation, the documentation may be available in
PDF form for printing and offline reading, or you can find it on the Web at:
www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/getstart.pdf
Complementary to the online help is MATLAB Central, found on the Web at
www.mathworks.com/matlabcentral. It includes a discussion forum and the File
Exchange, which consists of code contributions by MATLAB users and friends. It‘s a
good place to check when you suspect that you may be trying to reinvent the wheel.
10
2.2.6 Saving And Loading Work
If you enter save myfile, all defined variables will be saved to a file called myfile.mat
in the current directory. This file format is particular to MATLAB. You can also
select a subset of variables to be saved by typing their names after the file name. If
you later enter load myfile, the saved variables are returned to the workspace,
overwriting any presently defined values assigned to the same names. If you highlight
commands in the Command History window, right-click, and select Create M-File
you can save the typed commands to a text file. This can be very helpful for recreating
what you have done. Another way to save both input and output is to use the diary
command with a file name. This causes all subsequent commands and results to be
recorded in a text file on disk. MATLAB is also capable of loading and saving other
common file formats, such as formatted text files, spread sheet files, and common
graphics and video files. To load such a file, it‘s often easiest to double-click it in the
Current Directory window, and follow the resulting prompts[5].
MATLAB, the application, is built around the MATLAB language. The simplest way
to execute MATLAB code is to type it in at the prompt, >> , in the Command
Window, one of the elements of the MATLAB Desktop. In this way, MATLAB can
be used as an interactive mathematical shell. Sequences of commands can be saved in
a text file, typically using the MATLAB Editor, as a script or encapsulated into a
function, extending the commands available.
2.2.7 Variables
Variables are defined with the assignment operator, =. MATLAB is a weakly
dynamically typed programming language. It is a weakly typed language because
11
types are implicitly converted. It is a dynamically typed language because variables
can be assigned without declaring their type, except if they are to be treated as
symbolic objects, and that their type can change. Values can come from constants,
from computation involving values of other variables, or from the output of a
function.
MATLAB has several functions for rounding fractional values to integers:
round(X): round to nearest integer, trailing 5 rounds to the nearest integer
away from zero.
fix(X): round to nearest integer toward zero (truncate).
floor(X): round to the nearest integer toward minus infinity (round to the
nearest integer less than or equal to X).
ceil(X): round to the nearest integer toward positive infinity (round to the
nearest integer greater than or equal to X).
Vectors/Matrices
MATLAB is a "Matrix Laboratory", and as such it provides many convenient ways
for creating vectors, matrices, and multi-dimensional arrays. In the MATLAB
vernacular, a vector refers to a one dimensional (1×N or N×1) matrix, commonly
referred to as an array in other programming languages. A matrix generally refers to a
2-dimensional array, i.e. an m×n array where m and n are greater than or equal to 1.
Arrays with more than two dimensions are referred to as multidimensional arrays.
12
MATLAB provides a simple way to define simple arrays using the syntax:
init:increment:terminator. The increment value can actually be left out of this syntax
(along with one of the colons), to use a default value of 1. Indexing is one-based,
which is the usual convention for matrices in mathematics, although not for some
programming languages.
Matrices can be defined by separating the elements of a row with blank space or
comma and using a semicolon to terminate each row. The list of elements should be
surrounded by square brackets: []. Parentheses: () are used to access elements and
sub-arrays (they are also used to denote a function argument list).
A square identity matrix of size n can be generated using the function eye, and
matrices of any size with zeros or ones can be generated with the functions zeros and
ones, respectively.
Most MATLAB functions can accept matrices and will apply themselves to each
element. For example, mod(2*J,n) will multiply every element in "J" by 2, and then
reduce each element modulo "n". MATLAB does include standard "for" and "while"
loops, but using MATLAB's vectorized notation often produces code that is easier to
read and faster to execute.
Unlike many other languages, where the semicolon is used to terminate commands, in
MATLAB the semicolon serves to suppress the output of the line that it concludes (it
serves a similar purpose in Mathematica.)
Graphics
Function plot can be used to produce a graph from two vectors x and y.
13
Three-dimensional graphics can be produced using the functions surf, plot3 or mesh.
Structures
MATLAB supports structure data types. Since all variables in MATLAB are arrays, a
more adequate name is "structure array", where each element of the array has the
same field names. In addition, MATLAB supports dynamic field names (field look-
ups by name, field manipulations etc). Unfortunately, MATLAB JIT does not support
MATLAB structures, therefore just a simple bundling of various variables into a
structure will come at a cost.
2.2.8 Function Handles
MATLAB supports elements of lambda-calculus by introducing function handles, a
references to functions, which are implemented either in .m files or anonymous/nested
functions.
2.2.9 Classes
MATLAB supports classes, however the syntax and calling conventions are
significantly different than in other languagues, because MATLAB does not have
reference data types. For example, a call to a method object.method(); cannot
normally alter any variables of object variable. To create an impression that the
method alters the state of variable, MATLAB toolboxes use evalin() command, which
has its own restrictions.
Object-Oriented Programming
MATLAB's support for object-oriented programming includes classes, inheritance,
virtual dispatch, packages, pass-by-value semantics, and pass-by-reference semantics.
14
2.2.10 Interactions With Other Languages
MATLAB can call functions and subroutines written in the C programming language
or Fortran. A wrapper function is created allowing MATLAB data types to be passed
and returned. The dynamically loadable object files created by compiling such
functions are termed "MEX-files" (for MATLAB executable).
Libraries written in Java, ActiveX or .NET can be directly called from MATLAB and
many MATLAB libraries (for example XML or SQL support) are implemented as
wrappers around Java or ActiveX libraries. Calling MATLAB from Java is more
complicated, but can be done with MATLAB extension, which is sold separately by
MathWorks.
As alternatives to the MuPAD based Symbolic Math Toolbox available from
MathWorks, MATLAB can be connected to Maple or Mathematica.
2.2.11 Limitations
MATLAB is a proprietary product of The MathWorks, so users are subject to vendor
lock-in. Although MATLAB Builder can deploy MATLAB functions as library files
which can be used with .NET or Java application building environment, future
development will still be tied to the MATLAB language.
MATLAB, like Fortran, Visual Basic and Ada, uses parentheses, e.g. y = f(x), for
both indexing into an array and calling a function. Although this syntax can facilitate
a switch between a procedure and a lookup table, both of which correspond to
mathematical functions, a careful reading of the code may be required to establish the
intent.
15
Mathematical matrix functions generally accept an optional argument to specify a
direction, while others, like plot, do not, and so require additional checks. There are
other cases where MATLAB's interpretation of code may not be consistently what the
user intended (e.g. how spaces are handled inside brackets as separators where it
makes sense but not where it doesn't, or backslash escape sequences which are
interpreted by some functions like fprintf but not directly by the language parser
because it wouldn't be convenient for Windows directories). What might be
considered as a convenience for commands typed interactively where the user can
check that MATLAB does what the user wants may be less supportive of the need to
construct reusable code[20].
Array indexing is one-based which is the common convention for matrices in
mathematics, but does not accommodate any indexing convention of sequences that
have zero or negative indices. For instance, in MATLAB the DFT (or FFT) is defined
with the DC component at index 1 instead of index 0, which is not consistent with the
standard definition of the DFT in any literature. This one-based indexing convention
is hard coded into MATLAB, making it difficult for a user to define their own zero-
based or negative-indexed arrays to concisely model an idea having non-positive
indices. A workaround can be constructed to create an ancillary frequency labeling
array with element values equal to the index less 1 that would be used instead of the
index, or the MATLAB programmer can remember to subtract 1 from the index
obtained from functions that return an index such as find(), min(), max().
MATLAB built-in data types are always passed by value. Therefore, all input
parameters to a function are usually copied (later MATLAB releases introduced lazy
16
copy where if an input parameters are not being altered, a copy is not being made,
however this has certain restrictions). Instances of user-defined classes are also copied
and passed by value as the default, however user-defined classes can be made to
exhibit reference behavior by inheriting from the abstract handle class. Variables of
such classes store a reference to the instance. An alternative to using references is
global variables, however MATLAB JIT does not support globals, as well as
structures, therefore the code performance will degrade[4].
The MATLAB editor does not have code completion, references searches, or
refactoring. Since MATLAB is weakly typed, these tools would be hard, if not
impossible, to provide in future releases since it is unknown which methods of an
object can be called without knowing its type. Without code completion, there is a
tendency to use short cryptic names for variables, function and methods, making code
hard to read. Without code completion or reference searches it can take a long time to
text search for what functions and methods can be called in a given context. Without
refactoring, it is time consuming and error prone to change variable, method, or
function names, or to modify an API[4].
Productivity of a development team working on a large software project in MATLAB
will likely be several times slower and result in a higher defect rate than development
in a language and IDE with type checking, code completion, reference search,
refactoring tools, and unit testing support.
It is very difficult to employ agile programming practices, such as Extreme
Programming, in MATLAB due to the lack of refactoring tools.
17
MATLAB lacks any native support for GPU acceleration such as OpenCL,
Microsoft's DirectCompute, or nVidia's CUDA.
2.2.12 Alternatives
MATLAB has a number of competitors.
There are free open source alternatives to MATLAB, in particular GNU Octave,
FreeMat, and Scilab which are intended to be mostly compatible with the MATLAB
language (but not the MATLAB desktop environment). Among other languages that
treat arrays as basic entities (array programming languages) are APL and J, Fortran 95
and 2003, as well as the statistical language S (the main implementations of S are S-
PLUS and the popular open source language R).
There is one web / cloud based alternative - Monkey Analytics - which provides a
modern web interface on top of GNU Octave or Python (including matplotlib,
NumPy, SciPy and more).
There are also several libraries to add similar functionality to existing languages, such
as Perl Data Language for Perl and SciPy together with NumPy and Matplotlib for
Python.
2.3 STUDY OF IBM ILOG CPLEX
2.3.1 Introduction
IBM® ILOG® CPLEX® is a tool for solving linear optimization problems,
commonly referred to as Linear Programming (LP) problems, of the form:
Maximize (or Minimize) c 1 x 1 + c 2 x 2 +...+ c n x n
18
subject to a 11 x 1 + a 12 x 2 +...+ a 1n x n ~ b 1
a 21 x 1 + a 22 x 2 +...+ a 2n x n ~ b 2
...
a m1 x 1 + a m2 x 2 +...+ a mn x n ~ b m
with these bounds l 1 ≤ x 1
u1≥x1
...
l n ≤ x n
un≥xn
where ~ can be ≤, ≥, or =, and the upper bounds u i and lower bounds l i may be
positive infinity, negative infinity, or any real number.
The elements of data you provide as input for this LP are:
Objective function coefficients c 1 , c 2 , ... , c n
Constraint coefficients a 11 , a 21 , ... , a n1
...
a m1 , a m2 , ... , a mn
Right hand sides b 1 , b 2 , ... , b m
Upper and lower bounds u 1 , u 2 , ... , u n and l 1 , l 2 , ... , l n
19
The optimal solution that CPLEX® computes and returns is:
Variables x 1 , x 2 , ... , x n
CPLEX® also can solve several extensions to LP:
Network Flow problems, a special case of LP that CPLEX® can solve much faster by
exploiting the problem structure. In Quadratic Programming (QP) problems, the LP
objective function is expanded to include quadratic terms. Quadratically Constrained
Programming (QCP) problems include quadratic terms among the constraints. In fact,
CPLEX® can solve Second Order Cone Programming (SOCP) problems[7].
Mixed Integer Programming (MIP) problems, where any or all of the LP, QP, or QCP
variables are further restricted to take integer values in the optimal solution and where
MIP itself is extended to include constructs like Special Ordered Sets (SOS) and semi-
continuous variables.
2.3.2 CPLEX Components
CPLEX® comes in various forms to meet a wide range of users' needs:
The CPLEX Interactive Optimizer is an executable program that can read a
problem interactively or from files in certain standard formats, solve the
problem, and deliver the solution interactively or into text files. The program
consists of the file cplex.exe on Windows platforms or cplex on UNIX
platforms.
Concert Technology is a set of C++, Java, and .NET class libraries offering an API
that includes modeling facilities to allow the programmer to embed CPLEX®
20
optimizers in C++, Java, or .NET applications. Concert Technology libraries. lists the
files that contain the libraries.[11]
Table 2.1: Concert Technology Libraries
Microsoft Windows UNIX
C++
ilocplex.lib
concert.lib
libilocplex.a libconcert.a
Java cplex.jar cplex.jar
.NET
ILOG.CPLEX.dll
ILOG.Concert.dll
The Concert Technology libraries make use of the Callable Library .
The CPLEX Callable Library is a C library that allows the programmer to
embed CPLEX® optimizers in applications written in C, Visual Basic,
FORTRAN, or any other language that can call C functions. The library is
provided in files cplexXXX.lib and cplexXXX.dll on Windows platforms, and
in libcplex.a, libcplex.so, and libcplex.sl on UNIX platforms.
The Python API for CPLEX® a full-featured Python application programming
interface supporting all aspects of CPLEX® optimization.
The CPLEX connector for The MathWorks MATLAB enables a user to define
optimization problems and solve them within MATLAB using either the
MATLAB Toolbox or a CPLEX® class in the MATLAB language.
21
2.3.3 Compatible Platforms
CPLEX® is available on Windows, UNIX, and other platforms. The programming
interface works the same way and provides the same facilities on all platforms.
2.3.4 Optimizer Options
Default settings will result in a call to an optimizer that is appropriate to the class of
problem you are solving. However you may wish to choose a different optimizer for
special purposes. An LP or QP problem can be solved using any of the following
CPLEX® optimizers: Dual Simplex, Primal Simplex, Barrier, and perhaps also the
Network Optimizer (if the problem contains an extractable network substructure).
Pure network models are all solved by the Network Optimizer. QCP models,
including the special case of SOCP models, are all solved by the Barrier optimizer.
MIP models are all solved by the Mixed Integer Optimizer, which in turn may invoke
any of the LP or QP optimizers in the course of its computation. Optimizers
summarizes these possible choices[19].
The choice of optimizer or other parameter settings may have a very large effect on
the solution speed of your particular class of problem. The CPLEX User's Manual
describes the optimizers, provides suggestions for maximizing performance, and notes
the features and algorithmic parameters unique to each optimizer.
2.3.5 File Formats
BAS files are text files governed by Mathematical Programming System (MPS)
conventions (that is, they are not binary) for saving a problem basis. They are
documented in BAS file format: advanced basis.
22
Table 2.2 Summary of Optimizers
LP Network QP QCP MIP
Dual Optimizer yes yes
Primal Optimizer yes yes
Barrier Optimizer yes yes yes
Mixed Integer
Optimizer
yes
Network Optimizer Note 1 yes Note 1
Note 1: The problem must contain an extractable network substructure.
BZ2 is not a file format specific to CPLEX® . Rather, this file extension indicates that
a file (possibly in one of the formats that CPLEX® reads) has been compressed by
BZIP2. On most platforms, CPLEX® can automatically uncompress such a file and
then read data from the file in one of the formats briefly described here
CLP is the format CPLEX® uses to represent the conflicting constraints and bounds
(a subset of an infeasible model) that were found by the conflict refiner.
CSV files contain comma-separated values. Concert Technology offers facilities in
CPLEX® for reading and writing such files. See the CPLEX C++ API Reference
Manual for details, especially the classes IloCsvReader, IloCsvLine, and
IloCsvReader::Iterator.
23
DPE is the format CPLEX® uses to write a problem in a binary SAV file after the
objective function of the problem has been perturbed.
DUA format, governed by MPS conventions, writes the dual formulation of a problem
currently in memory so that the MPS file can later be read back in and the dual
formulation can then be optimized explicitly. This file format is largely obsolete now
since you can use the command set presolve dual in the Interactive Optimizer to tell
CPLEX® to solve the dual formulation of an LP automatically. (You no longer have
to tell CPLEX® to write the dual formulation to a DUA file and then tell CPLEX® to
read the file back in and solve it.)
EMB is the format CPLEX® uses to save an embedded network it extracts from a
problem. EMB files are written in MPS format.
FLT is the format CPLEX® uses to save filters for solution pools.
GZ is not a file format specific to CPLEX® . Rather, this file extension indicates that
a file (possibly in one of the formats that CPLEX® reads) has been compressed by
gzip , the GNU zip program. On most platforms, CPLEX® can automatically
uncompress a gzipped file and then read data from a file in one of the formats briefly
described here.
LP (Linear Programming)is a CPLEX® -specific file formatted for entering
problems in an algebraic, row-oriented form. In other words, LP format allows you to
enter problems in terms of their constraints. When you enter problems interactively in
the Interactive Optimizer, you are implicitly using LP format. CPLEX® also reads
24
files in LP format. The section LP file format: matrix models describes the
conventions and use of this format.
MIN format for representing minimum-cost network-flow problems was introduced
by DIMACS in 1991.
MPS is an industry-standard, ASCII-text file format for mathematical programming
problems. This file format is documented in MPS file format: industry standard.
Besides the industry conventions, CPLEX® also supports extensions to this format
for CPLEX® -specific cases, such as names of more than eight characters, blank
space as delimiters between columns, etc. The extensions are documented in Special
records in MPS files: CPLEX extensions.
MST is an XML format available with the CPLEX® MIP optimizer. It is a text
format CPLEX® uses to enter a starting solution for a MIP. MST file format: MIP
starts documents this file format.
NET is a CPLEX® -specific ASCII format for network-flow problems. It supports
named nodes and arcs. NET file format: network flow models offers a fuller
description of this file format.
ORD is a format available with the CPLEX® MIP optimizer. It is used to enter and to
save priority orders for branching. It may contain branching instructions for individual
variables. ORD file format: priorities and branching orders documents this file format.
PPE is the format CPLEX® uses to write a problem in a binary SAV file after the
righthand side has been perturbed.
25
PRE is the format CPLEX® uses to write a presolved, reduced problem formulation
to a binary SAV file. Since a presolved problem has been reduced, it does not
correspond to the original problem.
PRM is the format CPLEX® uses to read and write nondefault values of parameters
in a file. PRM file format: parameter settings documents the format and conventions
for reading and writing such files through the Callable Library.
REW is a format to write a problem in MPS format with disguised row and column
names. This format is simply an MPS file format with all variable (column) and
constraint (row) names converted to generic names. Variables are relabeled x1
through xn , and rows are renamed c1 through cm . This format may be useful, for
example, for problems that you consider highly proprietary.
RLP is the LP format using generic names in the Interactive Optimizer.
SAVis a CPLEX® -specific binary format for reading and writing problems and their
associated basis information. CPLEX® includes the basis in a SAV file only if the
problem currently in memory has been optimized and a basis exists. This format
offers the advantage of being numerically accurate (to the same degree as your
platform) in contrast to text file formats that may lose numerical accuracy. It also has
the additional benefit of being efficient with respect to read and write time. However,
since a SAV file is binary, you cannot read nor edit it with your favorite text editor.
SOL files are XML formatted files that contain solution information; they may also
provide an advanced start for an optimization.
26
XML as a file format is available to C++ users of Concert Technology to serialize
models and solutions (that is, instances of IloModel and IloSolution). XML file
format: serialized models and solutions explains more about this serialization API.
2.3.6 Using IBM ILOG CPLEX with MATLAB
IBM ILOG CPLEX for MATLAB® can also solve several extensions to LP:
Quadratic Programming (QP) problems, where the LP objective function is
expanded to include quadratic terms.
Quadratically Constrained Programming (QCP) problems that include
quadratic terms among the constraints. In fact, CPLEX can solve Second
Order Cone Programming (SOCP) problems.
Mixed Integer Programming (MIP) problems, where any or all of the LP, QP,
or QCP variables are further restricted to take integer values in the optimal
solution and where MIP itself is extended to include constructs like Special
Ordered Sets (SOS), semi-continuous variables, and indicator variables.
Least Squares (LSQ) problems, where the objective is to minimize a norm.
The problem can be constrained linearly or quadratically, and the variables
may be restricted to take integer values in the solution.
The standard MATLAB vector and matrix format is used for the elements of data that
you need to provide. For example, the IBM ILOG CPLEX for MATLAB Toolbox
function ‗cplexlp‘ solves the problem specified by
min f*x
st. Aineq*x <= bineq
27
Aeq*x = beq
lb <= x <= ub
where f, bineq, beq, lb, and ub are MATLAB vectors, and Aineq and Aeq are
MATLAB matrices.
The vector x returned by the function call
x = cplexlp(f,Aineq,beq,Aeq,beq,lb,ub)
contains the optimal solution to the specified linear programming problem.
Provided in IBM ILOG CPLEX for MATLAB is both a toolbox of functions and a
class API. The toolbox contains functions for solving optimization problems, where
the input matrices are provided to the function and results returned. With the class
API, objects can be created, and those objects carry a state[19].
The benefits of using the Cplex class API include the ability to:
build up a model by manipulating a Cplex object.
use computation methods such as Cplex.solve() and Cplex.refineConflict()
that modify the object so results can be queried as needed.
perform restarts after manipulation.
attach an output parser, a GUI with stop buttons, and other controls.
2.3.7 Overview of Toolbox
The toolbox provides the functions cplexlp, cplexqp and cplexbilp to solve linear
programming problems (LP), quadratic programming problems (QP) and binary
integer programming problems (BILP)[7].
28
The toolbox provides functions that support the solution of the basic problem types
handled by CPLEX® are:
cplexlp for linear programming problems (LP),
cplexqp for quadratic programming problems (QP) and
cplexbilp for binary integer programming problems (BILP).
Functions that support the solution of additional problem types handled by CPLEX
are provided. These functions are:
cplexqcp for quadratically constrained programming problems (QCP),
cplexmilp for mixed integer linear programming problems (MIP),
cplexmiqp for mixed integer quadratic programming problems (MIQP) and
cplexmiqcp for mixed integer quadtratically constrained mixed integer
programming problems (MIQCP).
The solution of least square problems is supported through the functions:
cplexlsqlin for linearly constrained least squares problems,
cplexlsqmilp for linearly constrained mixed integer least squares problems,
cplexlsqmiqcp for quadratically constrained mixed integer least squares
problems,
cplexlsqnonneglin for nonnegative least squares problems,
cplexlsqnonnegmilp for nonnegative mixed integer least squares problems
and
29
cplexlsqnonnegmiqcp for nonnegative quadratically constrained mixed
integer least squares problems.
Options, also called parameters, can be set to control the solution of problems. The
toolbox provides two types of options input. One type is the CPLEX parameters, and
the other type is the MATLAB® toolbox options. You can use either or both of these
types of options. If you use both, the CPLEX parameters will override the MATLAB
options.
You can set the options with the toolbox function cplexoptimset and access the
options with cplexoptimget.
The advantage of the toolbox design is that you can reuse your code where you had
used MATLAB Optimization Toolbox functions to solve linear programming,
quadratic programming, binary integer programming, linearly constrained least
squares, and nonnegative least squares problems.
2.3.8 CPLEX Class API
While the IBM® ILOG® CPLEX® for MATLAB® Toolbox functions provide the
ability to solve a multitude of mathematical programming problems, the toolbox
design does not support restart. To enable users to use decomposition algorithms, the
Cplex Class API is also provided in IBM ILOG CPLEX for MATLAB.
The Cplex class stores the model and provides methods for the solution, analysis,
manipulation and reading/writing of the model file. All of the data associated with the
problem is stored in the properties of a Cplex object. These class properties are
standard MATLAB data structures and can be manipulated directly within MATLAB.
30
However, modifying the problem using methods provided in the Cplex class enforces
consistency, such as ensuring that vectors are of the proper length[11].
The documentation of the Cplex class provides an introduction of properties and
methods of the Cplex class in more detail.
The properties of the Cplex class include:
Cplex.Model stores the data of the model
Cplex.Solution stores the solution of the model
Cplex.Param stores the parameters (options) of the model
Cplex.Start stores the start of the LP model
Cplex.MipStart stores the start of the MIP model
Cplex.InfoCallback pointer to an informational callback
Cplex.Conflict stores the conflict information of a conflicted model
Cplex.DisplayFunc pointer to a function which provides control of display of
output
The following informative methods are provided:
Cplex.getVersion returns the CPLEX version
Cplex.getProbType returns the problem type of the model
The following methods are provided for reading from and writing to files:
Cplex.readModel
31
Cplex.writeModel
Cplex.readBasis
Cplex.writeBasis
Cplex.readMipStart
Cplex.writeMipStart
Cplex.writeParam
Cplex.writeConflict
The following methods are provided to solve and analyze the model, solution and
mipstart:
Cplex.solve
Cplex.populate
Cplex.feasOpt
Cplex.refineMipStartConflict
Cplex.terminate
The following methods are provided to solve, set and query parameters:
Cplex.tuneParam
Cplex.setDefault
Cplex.getChgParam
32
2.4 STUDY OF OPERATING THEATRE SCHEDULING
2.4.1 Introduction
During the last decades, cost pressures on hospitals have increased dramatically. This
emphasis on cost containment has forced hospital executives to run their organizations
in a more business-like manner. The constant challenge is to provide high-quality
service at ever reduced costs. In order to achieve this purpose, inefficient use of
resources should be identified and actions should be taken to eliminate these sources
of waste. Operations research techniques are increasingly being used to assist in this
complicated task[22].
2.4.2 Block scheduling in hospitals
There are many ways to set up schedule in a hospital. A strict block schedule will
block all or most available time, which usually creates a lot of unused and, therefore,
non-productive operating room time. When using this method, the blocks may not be
released at all or are not released until the day before the surgery date. In another
method, the open schedule, cases are scheduled on a first come–first served basis.
Such schedules can frustrate surgeons, as they may not be able to schedule their cases
back-to-back if another surgeon schedules a case behind them. Therefore, surgeons
who can anticipate their schedules far in advance, such as ophthalmologists or plastic
surgeons, can live with this method far better than OB/GYN or general surgeons, who
often schedule within one to three days of surgery and cannot get a time that works
for them[18].
Modified block scheduling is the most widely used method and affords most centers
maximum flexibility. In this system, a physician, practice, or specialty may be granted
33
a block of time, which can range from two hours to an entire day, in which to use the
operating room. The center board of managers—usually delegated to the medical
executive committee— reviews block use and manage the blocks to maximize use of
operating room time. A center should strive to achieve 70% utilization of all operating
room time. Eighty-five percent is probably the maximum anyone can hope to achieve
in any surgery setting.
In a modified block scheduling format, the center reserves some of the available
surgery time for surgeons who can fill the block as required by your center‘s policies.
For example, you may require that a physician fill 60%–70% or more per quarter to
keep the block, depending on the maturity of the medical centre[17].
A new medical center will probably set the requirements a little lower, but it must
diligently review block time use and eventually push to achieve a higher percentage.
Unblocked times are called open blocks, which physicians use when they cannot fill a
block alone. OB/GYN surgeons or general surgeons, depending upon their practice,
may fit into this category. Blocktime should be released by the office as early as
possible, if the surgeon will not be using a block due to vacation, seminar, or another
reason. The medical centre releases the blocks according to its policies, usually 72
hours to one week in advance if the surgeon has not filled the block. Whatever part of
the assigned block is released becomes open time. The surgery scheduler can fill this
new open time with any cases that were added to the schedule close to the date of
surgery, as cases from OB/GYNs and general surgeons often are. This method allows
the surgery scheduler to accommodate the needs of more surgeons, maximize
operating room use, and make the staff more productive.
34
Most medical centers include a statement in their scheduling policies that prohibits
―ghost scheduling‖ or ―phantom scheduling,‖ which is when the office schedules
nonexistent cases to hold block time to prevent another physician from taking it[15].
2.4.3 Multi-Mode Blocking Job Shop (MMBJS)
In the MMBJS, n jobs are performed on m resources. Each job consists of a sequence
of operations. The execution of an operation requires a set of resources. Such a set of
resources is called a mode. The modes of any two consecutive operations of any job
have no common resources. There might be more than one mode available for each
operation, justifying the term multi-mode. Once a mode is chosen for an operation, its
processing entails a processing time during which the resources of the mode are
occupied simultaneously, and possibly a setup time and a cleanup time. All these
times can depend on the mode.
Resources are not always available all the time. Therefore, to each mode is attached a
time interval during which the mode is available. There is no buffer between
resources, so that if a job has finished an operation and the job‘s next operation cannot
be started, the resources of the finished operation remain blocked until the next
operation is started. Because of this blocking, one needs to distinguish between the
completion time of an operation, which equals the sum of its starting time and
processing time, and its departure time (the time the job leaves its current processing
stage to enter its next stage or leave the system). Scheduling with blocking is of
emergent research interest for its applicability in various shop environments, e.g. in
job shop or flow shop[13].
35
2.5 STUDY OF MIXED INTEGER LINEAR PROGRAMMING
(MILP)
MIXED-integer linear programming (MILP) methods have attracted attention because
of their modeling capability and because powerful solvers are available commercially.
The use of MILP for modeling and control problems have been used for cooperative
reconnaissance ,air traffic management, coordinated robot motion unmanned aerial
vehicle (UAV) path planning, and cooperative control[21].
We have seen that the max flow problem is a special case of the min cost flow
problem which is again a special case of linear programming. Thus, an LP solver
should be sufficient to tackle any of the problems we have seen so far. However, if we
use a general LP solver based on, say, the simplex method to solve max flow
instances or max flow instances rather than an implementation of the Ford-Fulkerson
method or Klein's algorithm, it seems that we may lose an important property of the
latter algorithms, namely the integrality property: If the Ford-Fulkerson algorithm or
Klein's algorithm are given integer-valued inputs, the solutions returned are also
guaranteed to be integer-valued. We saw previously that this integrality property is
often very important when modeling combinatorial optimization instances as max
flow or min cost flow instances[21].
A good example is the reduction of maximum cardinality matching to max flow:
There, we constructed a reduction r converting bipartite graphs G into max flow
instances r(G) with the property that any matching of size v in G leads to a flow of
value v in r(G) and any flow with an integer valued flow along every edge of value v
in r(G) leads to a matching of size v in G. This reduction enables us to use any max
36
flow Algorithm with the integrality property, such as Ford-Fulkerson, to find
maximum cardinality matchings. Suppose we now instead try to use the simplex
algorithm to find a maximum matching in a bipartite graph by expressing the
appropriate max flow instance as a linear program. The value of the solution found
will give us the cardinality of a maximum matching as desired, but it is not a priori
clear that we can use the solution to extract the matching itself.
Indeed, this only seems to be the case if we can prove an integrality theorem for the
simplex algorithm. Fortunately, it turns out that we can prove such an integrality
theorem for a special class of linear programs that include the linear programs that
express max flow and min cost flow instances. This is captured in the following
loosely formulated (in the sense that we are not being specific about which LP
formulations we have in mind) fact[19].
Fact 1 Max flow instances with integer-valued capacities and min cost flow instances
with integer-valued capacities and balances can be expressed as linear programs in
such a way that every basic feasible solution to the resulting linear program is integer-
valued. In particular, the optimal basic solution returned by the simplex algorithm is
integer-valued.
Of course, we might choose to solve our linear program by methods other than the
simplex algorithm. In particular, we might prefer an interior point algorithm. If we do,
we may conceivably have a solver that is guaranteed to return optimal solutions but
not necessarily basic optimal solutions. If this is the case, we can easily build a \shell"
around the solver that converts any non-basic optimal solution found to a basic
optimal solution and Fact 1 again applies. Fact 1 takes care of the integrality property
37
for the special class of linear programs corresponding to flow instances. However,
being able to impose integrality constraints on the solutions we seek is relevant for
many other optimization tasks that can be expressed using linear constraints and for
these, Fact 1 may not apply. Therefore, we shall look at a generalization of linear
programming that allows us to explicitly express such integrality constraints:
A Mixed Integer Linear Program (MILP) is an optimization instance of the following
kind: Find a point x 2 Rn maximizing (or minimzing) a linear form hc; xi so that a
given set of linear inequalities and/or equations and a given set of integrality
constraints xi 2 Z are satisfied. A point x satisfying the constraints is called a feasible
solution to the program[6].
Thus, the only addition to the LP formalism we make is the ability to require certain
components of the solution to be integer valued. We shall see, however, that this
seemingly modest added expressiveness in general makes the task of finding the
optimal solution painfully harder. In particular, all algorithms for solving MILPs have
exponential worst case complexity and unlike the case of the simplex algorithm which
is also exponential but only on artificially constructed instances, the exponential
running time of any of the MILP solvers we know (and shall describe later in this
course) is typical behavior which we have to live with[6].
Powerful software packages such as CPLEX can solve MILPs efficiently for problems
in which the number of binary variables is of reasonable size. However, a major
disadvantage of MILP is its computational complexity. Because MILP is NP-hard
,computational requirements can grow significantly as the number of binary variables
needed to model the problem increases.
38
CHAPTER 3
3. MODELING
3.1 PROBLEM IDENTIFICATION
The public health care sector is severely strained with the ever increasing population
.The hospitals are unable to cope up with the increasing demands of the teeming
millions as the resources and facilities available for satisfying the demand are limited
.This has resulted in long serpentine queues which cripples the health sector reforms
and initiatives. Operating rooms (OR) are considered among the most costly hospital
facilities and it often becomes a bottleneck in the hospital . The efficient management
of the operating theatres will therefore result in an improved performance of the
hospital as a whole as it is highly interrelated with the other facilities[6].
An unnecessarily long length of stay (LOS) for inpatients is one of the common issues
in the hospitals. A high LOS is due to inefficient scheduling procedures used in
surgical and ancillary services, since most inpatients require one or both of these
during their stay at the hospital. In most hospitals, a large percentage of inpatients
undergo some type of surgery during their stay in a hospital. To reduce inpatient
length of stay and also from the patient‟s health point of view, it is ideal that a surgery
is performed as soon as it is requested. However, in reality, inpatients may need to
wait in bed for their surgery for a day or two or even longer (especially in public
hospitals). Outpatients also may not always undergo their surgery on schedule,
although this is not directly counted in the hospital‟s expenditures. Thus, it is of great
interest to hospital administrators to reduce inpatients' LOS. There are many possible
reasons for delays. For example, a patient who is considered to need surgery
39
immediately might be given preference over another patient who has been waiting for
a week, and has a scheduled surgery. Or, a hospital may face a situation where a large
number of emergency patients needing surgery use up most of the available Operating
Room capacity. As a result, the delayed inpatients stay in the hospital longer,
incurring higher non-reimbursable costs for the hospital and the delayed outpatients
may remain in a long outpatient queue (often in the form of a waiting list) waiting for
surgery and also continue to “compete” for operating room capacity with inpatients,
affecting LOS indirectly[3]. Thus the unnecessarily long length of stay in the hospital
due to the inefficient scheduling procedure is the problem which needs immediate
attention .This can be solved by developing an efficient scheduling procedure using
the operations research technique.
3.2 PROBLEM FORMULATION
The mixed integer linear programming technique is used to solve the problem of
operating room scheduling. The model determines an allocation template and each
specialty‟s weekly OR time (uniquely determined by the template) based on the
objective of minimizing inpatients‟ length of stay in the hospital. Based on the study
conducted on the operating theatre systems the various constraints are also identified.
The mixed integer programming method is adopted as some of the decision variables
are constrained to take integer values[6].
Here we have developed a basic model without considering the emergency and has
improved this model to consider the case of emergency demand also. The following
represents the general description of the various aspects identified and represented in
the models(with improvements).
40
The decision variables identified to be analysed in the system includes
• Number of Operating Rooms of a particular type allocated to a specialty on any
day.
• Amount of Emergency OR‟s staffed hours allocated to a specialty on any day.
• A Specialty‟s postponed non-emergency demand from a day to another.
• A Specialty‟s unmet non-emergency demand on any day.
• Amount of idle time of the OR allocated to a specialty on a day.
• Total amount of idle time of all non-emergency OR‟s.
• Oversupply of OR hours to a specialty relative to its desired level.
• Undersupply of OR hours to a specialty relative to its desired level.
3.3 OBJECTIVE FUNCTION
The objective function aims at minimising the patient‟s length of stay in the hospital.
In order to represent the patient‟s length of stay in the hospital three penalty terms are
identified. The objective function of the formulation consists of three cost or penalty
terms. The first two represent the inpatients‟ length of stay caused by the delay in
meeting surgery demand within one cycle (or for up to 7 days) and by “unmet”
demand, respectively. The third term represents the total penalty caused by the
undersupply of OR hours to each specialty, relative to its desired level determined by
the percentage of total non-emergency surgery demand for each specialty. This
penalty term is less dominant, considering our practical objective of minimizing
inpatients‟ length of stay waiting for their surgery; yet inclusion of this term is useful
41
in determining, among solutions yielding the same or similar sum of the first two
terms or total length of stay, the one that leads to the most reasonable allocation of the
non-emergency OR idle time (in the sense that the larger non-emergency surgery
demand a specialty has, the more non-emergency OR idle time it tends to occupy) and
thus would perform the best when subject to actual demand and time uncertainty[6].
3.4 CONSTRAINTS
All the decision variables can take only positive values. The decision variable
representing the number of operating rooms can take only positive integral values.
The number of operating rooms available for each of the speciality for a particular day
(both emergency and non emergency operating rooms) represents the main
„resources‟ constraint. The amount of available OR hours and the total idle time are
the other resource constraint identified. Also the model should make sure that the
emergency demand for a day should be met whereas the non emergency demand can
be postponed or delayed indefinitely. In case of the final model, we have brought in
the constraint representing the number of post operative beds capacity as it has been
identified as one of the limited facilities. The various constraints are elaborated along
with each of the model.
3.5 NOTATION
I: set of room types.
J: set of medical specialties.
D: set of days.
42
i: index for room type. A room can be considered a different type due to its location
or special medical equipment.
j: index for medical specialty.
k, l: indices for days.
s: amount of staffed hours per day.
ai: number of operating rooms of type i.
ejk: emergency patients‟ surgery demand for specialty j on day k, measured in hours.
ojk: non-emergency patients‟ (including inpatients‟ and outpatients‟) surgery demand
for specialty j on day k, measured in hours.
cjk: the maximum number of operating rooms that specialty j can utilize on day k,
determined by the number of surgeons and the amount of equipment or any other
necessary medical resources that each specialty has.
ρkl: the number of days delayed if a surgery is postponed from day k to day l.
θ: the equivalent number of days delayed if some surgery demand is not met in the
model (or the penalty rate for “unmet” demand).
β: the penalty rate for undersupply of OR hours to a specialty, relative to a desired
level determined by the percentage of total non-emergency surgery demand for
each specialty. Inclusion of this penalty term in the objective function serves the
purpose of smoothing the OR capacity. The β value should be much smaller than
θ.
43
3.6 ASSUMPTIONS
1. The number of working days can be defined by the end user subject to the
maximum of a 7 workdays.
2. Staffed hours can also be given by the user. Overtime work is not modelled.
3. The demand pattern for a week is known before hand. The model does not
account for the uncertainty in the demand.
4. Only weekdays' surgery demand is considered in the model. However,
patients' stay in the hospital on Saturdays and Sundays does incur cost just like
on weekdays. Therefore,
Note that if k = l or k > l, day l represents a weekday following the week for
day k.
5. Emergency capacity for each day is user defined.
6. The surgery demand is measured by the amount of OR hours. For example, if
specialty j, on average, has 2 emergency patients who need surgery on
Wednesday and the average length of this specialty's emergency surgery is 1.6
hours, then the surgery demand of specialty j's emergency patients on
Wednesday or ej3 is 3.2 hours.
7. Inpatients' in-hospital cost is incurred by the delay in meeting surgery demand.
Because surgery demand is measured in OR hours, inpatients' in-hospital cost
or length of stay is measured by "OR hours×days". It is obtained by
44
multiplying the postponed demand volume (i.e. the amount of OR hours
postponed) by the number of days between the day that amount of demand
arises and the day it is met.
8. All emergency surgery demand must be met on the day it arises. Non-
emergency or inpatients' and outpatients' surgery demand can be delayed.
9. If some non-emergency patients' surgery demand cannot be met on the
requested day, it can be met on the remaining days of the current week, on any
day in the following week, or become unmet (equivalent to being met θ days
late).
10. Each specialty performs their non-emergency surgeries only in the non-
emergency OR(s) allocated to them.
11. Each specialty can perform their emergency surgeries either in the emergency
OR or in the non-emergency OR(s) allocated to them.
12. Specialty j is at most allocated cjk ORs on day k.
13. Post Operative Care capacity
3.7 DECISION VARIABLES
xijk: the number of operating rooms of type i allocated to specialty j on day k. The
entire set of xijk‟s determines the allocation template.
yjk: the amount of the emergency OR‟s staffed hours allocated to specialty j on day k.
zjkl: specialty j‟s non-emergency demand postponed from day k to day l.
ujk: specialty j‟s unmet non-emergency demand on day k.
45
bjk: the amount of idle time of the OR allocated to specialty j on day k.
h: the total amount of idle time of all non-emergency OR‟s.
pj: oversupply of OR hours to specialty j, relative to its desired level.
qj: undersupply of OR hours to specialty j, relative to its desired level.
3.8 MODELS
3.8.1 Basic Model
The objective function of the formulation consists of three cost or penalty terms. The
first two represent the inpatients‟ length of stay caused by the delay in meeting
surgery demand within one cycle (or for up to 7 days) and by “unmet” demand (or
equivalent to being postponed θ days, by our notation), respectively. The third term
represents the total penalty caused by the undersupply of OR hours to each specialty,
relative to its desired level determined by the percentage of total non-emergency
surgery demand for each specialty. This penalty term is less dominant, considering
our practical objective of minimizing inpatients‟ length of stay waiting for their
surgery; yet inclusion of this term is useful in determining, among solutions yielding
the same or similar sum of the first two terms or total length of stay, the one that
leads to the most reasonable allocation of the non-emergency OR idle time (in the
sense that the larger non-emergency surgery demand a specialty has, the more non-
emergency OR idle time it tends to occupy) and thus would perform the best when
subject to actual demand and time uncertainty[6].
46
Min ∑ ∑ (ρkl ∑ zjkl) + θ ∑ ∑ ujk + β∑qj
kϵD lϵD jϵJ jϵJ kϵD jϵJ
Subjected To
∑ xijk = ai For all i,k (1)
jϵJ
s ∑ xijk ≥ ∑ zilk For all j,k (2)
iϵI iϵI
s ∑ xijk – bjk + ujk = Ojk For all j,k (3)
iϵI
h = ∑ ∑ bjk (4)
jϵJ kϵD
h∑ ojk
kϵD
∑ ∑ ojk For all j (5)
jϵJ kϵD
∑ xijk ≤ cjk For all j,k (6)
iϵI
h, pj, qj, xijk, bjk, yjk, zjkl, ujk ≥ 0 For all I, j, k (7)
Xijk is an integer. (8)
Constraint (1) guarantees that all the operating rooms are allocated to some
specialty each day.
47
Constraint (2) ensures that on any day each specialty has at least the OR
capacity to meet the non-emergency demand decided to be postponed to that
day.
Constraint (3) states that specialty j's non-emergency surgery demand on day k
must be met either on that day, some remaining day in the current week, some
day in the next week, or unmet (that is, met θ days late).
Constraint (4) defines h as the sum of idle hours of all the non-emergency ORs
over one week.
Constraint (5) defines pj and qj, respectively, as the oversupply and
undersupply of non-emergency OR (idle) time to specialty j, relative to a
desired level determined by the percentage of total non-emergency surgery
demand for specialty j. More specifically, given the weekly total of non-
emergency OR idle hours, it is desired that each specialty occupies the amount
proportional to its share of the total non-emergency surgery demand; pj and qj
represent the difference between the actual allocation and the desired level for
specialty j.
Constraint (6) ensures that specialty j is at most allocated cjk ORs on day k.
Constraint (7) is the non-negativity constraint on all the decision variables.
Constraint (8) defines each xijk variable to be an integer.
3.8.2 Model 1 (including the emergency case)
Min ∑ ∑ (ρkl ∑ zjkl) + θ ∑ ∑ ujk + β∑qj
kϵD lϵD jϵJ jϵJ kϵD jϵJ
48
Subjected To
∑ xijk = ai For all i,k (1)
jϵJ
s ∑ xijk ≥ ejk – yjk + ∑ zilk For all j, (2)
iϵI iϵI
s∑xijk – (ejk – yjk+ ∑zjlk) – bjk + ∑zjkl + ujk= Ojk iϵI lϵD lϵD
For all j,k (3)
h = ∑ ∑ bjk (4)
jϵJ kϵD
h∑ ojk
kϵD
∑ ∑ ojk For all j (5)
jϵJ kϵD
∑yjk ≤ s For all k (6)
jϵJ
∑ xijk ≤ cjk For all j,k (7)
iϵI
yjk ≤ ejk For all j,k (8)
h, pj, qj, xijk, bjk, yjk, zjkl, ujk ≥ 0 For all i, j, k (9)
Xijk is an integer. (10)
49
Constraint (1) guarantees that all the operating rooms are allocated to some
specialty each day.
Constraint (2) ensures that on any day each specialty has at least the OR
capacity to meet
the sum of its emergency demand on that day and non-emergency demand
decided to be postponed to that day.
Constraint (3) states that specialty j's non-emergency surgery demand on day k
must be met either on that day, some remaining day in the current week, some
day in the next week, or unmet (that is, met θ days late).
Constraint (4) defines h as the sum of idle hours of all the non-emergency ORs
over one week.
Constraint (5) defines pj and qj, respectively, as the oversupply and
undersupply of non-emergency OR (idle) time to specialty j, relative to a
desired level determined by the percentage of total non-emergency surgery
demand for specialty j. More specifically, given the weekly total of non-
emergency OR idle hours, it is desired that each specialty occupies the amount
proportional to its share of the total non-emergency surgery demand; pj and qj
represent the difference between the actual allocation and the desired level for
specialty j.
Constraint (6) guarantees that at most s hours of emergency demand is met in
the emergency OR each day.
Constraint (7) ensures that specialty j is at most allocated cjk ORs on day k.
50
Constraint (8) guarantees that the daily emergency OR capacity allocated to
each specialty does not exceed their emergency demand.
Constraint (9) is the nonnegativity constraint on all the decision variables.
Constraint (10) defines each xijk variable to be an integer.
3.8.3 Model 2 (introducing the post operative care beds capacity constraint)
Min ∑ ∑ (ρkl ∑ zjkl) + θ ∑ ∑ ujk + β∑qj
kϵD lϵD jϵJ jϵJ kϵD jϵJ
Subjected To
ojk + ∑ zijk – ujk ≤ POC hours For all j,k (11)
iϵI
The constraints (1)-(10) remain unaltered for this variant of the basic model.
However a new constraint taking into consideration the number of beds available in
post operative care has been introduced. The constraint (11) states that the sum of the
total non-emergency demand and the demand that has been postponed to day k from l
minus the non emergency demand that has been postponed from day k for a specialty j
must be less than or equal to the number of hours available on post-operative care.
51
CHAPTER 4
4. CASESTUDY
A case study has conducted to demonstrate the modeling approaches.
4.1 DATA COLLECTION
The data for the model was collected from Pushpagiri Institute of Medical Sciences
and Research Centre, Thiruvalla.
The collected data contained basic statistical information about the hospital such as
the number of operating theatres, number of staffed hours of the theatre, etc.,
information about the average daily out patient attendance in various departments of
the hospital and the total number of surgeries performed in 2008.
The data collected has been summarized in the appendix.
4.2 DATA ANALYSIS AND INTERPRETATION
The hospital has separate intensive care units and post-operative rooms. However, for
convenience, both of these can be clubbed together and termed as Post-Operative Care
(POC).
As part of the analysis, it is necessary to find the number of people each day who are
sent in for surgery. In order to find this approximate percentage 2 and 3 have been
used. This method of calculation is better explained with the help of an example.
Taking the case of the General Surgery Department;
Total number of surgeries performed in the year : 2326 + 2781 = 5107
Total average daily OPD attendance = 111
52
Total daily OPD attendance for a year = 111 * 365 = 40515
Percentage of patients going in for surgery = 5107 / 40515 * 100 = 12.6
Hence it can be seen that approximately 13% of the total number of patients coming
in per day at the general surgery department would undergo surgical treatment.
This analysis was carried out for all the four departments and the results have been
tabulated below:
Table 4.1 Percentage of Surgery in each department
Department Approx. Percentage for Surgery
GS including paediatric
surgery 13
Orthopaedics 5
Oto-Rhino-Laryngology 2
Ophthalmology 1
4.3 SOLVING THE MODEL
Based on the data collected a set of sample data was drawn for input to the model.
This input data considers the General Surgery and Orthopedics department of the
hospital and is as given below:
Number of operating theatre types : 2
Number of staffed hours : 8 hours
Delay for unmet demand : 1 day
Number of operating days : 5
Number of Specialties : 2
Penalty rate for undersupply : 0.1
Maximum number of operating rooms for Specialty 1 : 3
Maximum number of operating rooms for Specialty 2 : 3
53
Number of operating rooms of type 1 : 3
Number of operating rooms of type 2 : 2
The input data for non-emergency demand for the operating day is tabulated below:
Table 4.2 Non-Emergency demand
Day Specialty 1 Specialty 2
Monday 20 10
Tuesday 18 11
Wednesday 22 9
Thursday 19 12
Friday 21 13
The input data for the emergency demand for the operating days is tabulated below:
Table 4.3 Emergency demand
Day Specialty 1 Specialty 2
Monday 3 2
Tuesday 6 3
Wednesday 2 3
Thursday 3 1
Friday 2 2
The MILP model was solved on computer with the following configuration:
Intel Core 2 Duo 2.0 GHz CPU
3GB RAM
250GB Hard Disk
The softwares used to code and optimize the model were:
1. MATLAB Version R2008b for coding.
2. CPLEX 9.0 with default settings for optimization.
54
4.4 RESULTS
The results of the MATLAB model give the minimized length of stay of the patient in
the hospital and also gives the optimal allocation of operating rooms to each specialty
for every operating day.
Optimized Length of stay is 208 hours.
Table 4.4 Results
DAY SPECIALITY 1 SPECIALITY 2
Type 1 Type 2 Type 1 Type 3
Monday 2 2 1 0
Tuesday 1 0 3 1
Wednesday 3 1 0 1
Thursday 0 1 2 2
Friday 2 2 1 1
Two graphs are plotted based on the allocation template for Speciality 1 and
Speciality 2. From the graphs, we can find that for specialty 1,two operating rooms
are each allocated for each of the two types of operating rooms available on Monday.
For Tuesday and Thursday we find that no operating rooms are scheduled for one of
the types which are due to lack of demand on those days. The graphs for the second
specialty also can be interpreted in the same manner.
55
Figure 4.1 Operating Rooms allocation for Speciality 1
Figure 4.2 Operating Rooms allocation for Speciality 2
Monday Tuesday Wednesday Thursday Friday
SPECIALITY 1 Type 1 2 1 3 0 2
SPECIALITY 1 Type 2 2 0 1 1 2
0
0.5
1
1.5
2
2.5
3
3.5O
R R
oo
ms
Allocation for Speciality 1
Monday Tuesday Wednesday Thursday Friday
SPECIALITY 2 Type 1 1 3 0 2 1
SPECIALITY 2 Type 3 0 1 1 2 1
0
0.5
1
1.5
2
2.5
3
3.5
OR
Ro
om
s
Allocation for Speciality 2
56
CHAPTER 5
5. CONCLUSION AND FUTURE WORKS
Usually we find that researches done in medical fields are focused on developing
advanced technologies in equipment arena and in developing cures for diseases.
Scheduling and optimal allocation of available resources is an area which deserves a
look in especially considering the paucity of resources seen nowadays.
A mixed integer programming model was developed to determine optimal operating
room allocation to each specialty. The methodology was illustrated on a case example
of Pushpagiri Institute of Medical Sciences and Research Centre, Thiruvalla, and the
analysis showed that the average inpatient waiting time for surgery could be reduced
with an efficient allocation of operating rooms.
The templates generated by the optimization model could perform poorly in practice
when there are high variances associated with surgery length and volatile patient
arrival patterns since the optimization model does not account for uncertainty in the
problem parameters. Therefore, future research can focus on incorporating uncertainty
into the analytical model. Also, since the problem sizes were relatively small the MIP
could be solved to optimality or near-optimality in the scenarios performed in this
study. However, for larger problem sizes specialized algorithms or heuristics may be
necessary in order to solve the model.
Some of the areas where there is considerable scope for improvement is in
incorporating other commonly seen constraints like Staff shifts, taking a detailed view
of the various equipments needed in all the specialties.
57
APPENDICES
APPENDIX 1: Data Collected from Pushpagiri Institute of Medical
Sciences and Research Centre, Thiruvalla.
Basic Information:
No. of Operating Theatres: 10
No. of Post-Operative Rooms: 4
No. of Pre-Anesthesia Rooms: 1 hall
Capacity of Each POR: 7 with required equipment
No. of beds in the Surgical ICU: 12
No. of beds in the Septic ICU: 4
No. of beds in the Burns ICU: 4
No. of Operations performed at a time in one OT: 1
No. of surgeons on GS: 25; divided into 4 units
Time for elective surgeries in a day: 8:30 AM - 3:30 PM
Emergency slots: 1 theatre Round the clock
Duration Range for an operation: Variable; 1-3 hours, up to 14 for transplants
Shifts of Doctors & nurses: 4 shifts; 8:30 AM - 3:30 PM; 1 - 9 PM; 3:30 - 11:30 PM;
11:30 PM - 7:30 AM
Table AP 1.1 Average daily Out Patient Department attendance
GS Ortho OR
Laryn Ophthalmology
Old 84 61 37 11
New 27 17 11 2
Total 111 78 48 13
58
Table AP 1.2 Number of surgeries for the year 2009
Department Major Minor
GS including Pediatric
Surgery 2326 2781
Orthopaedics 732 747
Oto-Rhino-Laryngology 219 157
Ophthalmology 30 20
59
APPENDIX 2: MATLAB code for MILP Model 2
function projcpy()
try
%DEFINE DATA
no_of_types_of_theatres = input('Enter the number of operating theatres types:');
no_of_staffed_hours = input('Enter the number of staffed hours:');
delay_for_unmet_demand = input('Enter the delay for unmet demand:');
no_of_operating_days = input('Enter the number of operating days:');
no_of_specialities = input('Enter the number of specialities:');
penalty_rate = input('Enter the penalty rate:');
no_of_beds_in_POC = input('Enter the number of bed in post-operative care:');
total_hours_in_POC = no_of_beds_in_POC*168;
%For the multiplication factor delay
for k = 1:no_of_operating_days,
for l = 1:no_of_operating_days,
if k==l,
delay(k,l) = 7,
end
if k<l,
delay(k,l) = l-k,
end
if k>l,
delay(k,l) = 7-k+l,
end
end
end
%For the total non emergency demand (o)
for j= 1:no_of_specialities
for k = 1:no_of_operating_days
display(sprintf('enter the total non emergency demand for the day %d for specialty
%g',k,j));
o(j,k) = input(':');
end
end
%For the maximum number operating rooms (c)
for j=1:no_of_specialities
for k=1:no_of_operating_days
display(sprintf('enter the maximum no. of operating rooms for the day %d for
specialty %g',k,j));
c(j,k) = input(':');
end
60
end
%For the number of operating rooms of type i (f)
for i = 1:no_of_types_of_theatres
display(sprintf('enter the number of operating rooms of type %d',i));
f(i) = input(':');
end
%For the emergency demand (em)
for j=1:no_of_specialities
for k=1:no_of_operating_days
display(sprintf('enter the emergency demand for the day %d for specialty
%g',k,j));
em(j,k) = input(':');
end
end
%Build Model
cplex = Cplex('proj');
cplex.Model.sense = 'minimize';
%OBJECTIVE FUNCTION
%For the demand that has been postponed from the previous week
a = 1;
for j = 1:no_of_specialities,
for k = 1:no_of_operating_days,
for l = 1:no_of_operating_days,
obj(a) = delay(k,l);
ctype(a) = char('C');
a = a+1;
end
end
end
%For the unmet non emergency demand
for j = 1:no_of_specialities,
for k = 1:no_of_operating_days,
obj(a) = delay_for_unmet_demand;
ctype(a) = char('C');
a = a+1;
end
end
%For the undersupply
for j = 1:no_of_specialities,
61
obj(a) = penalty_rate;
ctype(a) = char('C');
a = a+1;
end
%For the oversupply
for j = 1:no_of_specialities,
obj(a) = 0;
ctype(a) = char('C');
a = a+1;
end
%For the amount of idle time
for j = 1:no_of_specialities,
for k = 1:no_of_operating_days,
obj(a) = 0;
ctype(a) = char('C');
a = a+1;
end
end
%For the number of operating rooms engaged in a day
for i = 1:no_of_types_of_theatres,
for j = 1:no_of_specialities,
for k = 1:no_of_operating_days,
obj(a) = 0;
ctype(a) = char('I');
a = a+1;
end
end
end
%For the total idle time
obj(a) = 0;
ctype(a) = char('C');
a=a+1;
%For the emergency ORs staffed hours
for j = 1:no_of_specialities,
for k = 1:no_of_operating_days,
obj(a) = 0;
ctype(a) = char('C');
a = a+1;
end
end
a=a-1;
62
%Constraints formulation
rows
=((no_of_types_of_theatres*no_of_operating_days)+5*(no_of_specialities*no_of_op
erating_days)+1+no_of_operating_days);
A = zeros(rows,a);
%Number of operating rooms constraint
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days));
for i = 1:no_of_types_of_theatres
for k = 1:no_of_operating_days
for j = 1:no_of_specialities
A(((i-1)*no_of_operating_days)+k,d+((k-1)*no_of_specialities)+((i-
1)*no_of_operating_days*no_of_specialities)+j)= 1;
end
end
end
%Amount of idle time constraint
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities)));
e=((no_of_types_of_theatres*no_of_operating_days)+(2*(no_of_specialities*no_of_
operating_days)));
for j= 1:no_of_specialities
for k= 1:no_of_operating_days
A(e+1,d+k+((no_of_operating_days)*(j-1)))=1;
end
end
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days)+(no_of_types_of_theatres*no_of_specialities*no_of_operating_days));
A(e+1,d+1)=-1;
%Max number of operating rooms for a speciality constraint
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days));
e=((no_of_types_of_theatres*no_of_operating_days)+(2*(no_of_specialities*no_of_
operating_days)+1+no_of_operating_days)+no_of_specialities);
for i= 1:no_of_types_of_theatres
for j = 1:no_of_specialities
for k = 1:no_of_operating_days
A(e+((j-1)*no_of_operating_days)+k,d+((j-1)*no_of_operating_days)+((i-
1)*no_of_specialities*no_of_operating_days)+k)=1;
63
end
end
end
%OR capacity constraint for each speciality
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days));
for j=1:no_of_specialities
for k=1:no_of_operating_days
for i=1:no_of_types_of_theatres
A(((no_of_types_of_theatres*no_of_operating_days)+(j-
1)*no_of_operating_days)+k,d+((j-
1)*no_of_operating_days*no_of_types_of_theatres)+...
((k-1)*no_of_types_of_theatres)+i)=no_of_staffed_hours;
end
for l=1:no_of_operating_days
A(((no_of_types_of_theatres*no_of_operating_days)+(j-
1)*no_of_operating_days)+k,((j-
1)*no_of_operating_days*no_of_types_of_theatres)+...
((k-1)*no_of_types_of_theatres)+l)=-1;
end
end
end
%Total non-emergency demand for a specialty constraint
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days));
e=((no_of_types_of_theatres*no_of_operating_days)+(no_of_specialities*no_of_oper
ating_days));
for j=1:no_of_specialities
for k=1:no_of_operating_days
for i=1:no_of_types_of_theatres
A(e+(j-1)*no_of_operating_days+k,d+((j-
1)*no_of_operating_days*no_of_types_of_theatres)+((k-
1)*no_of_types_of_theatres)+i)= no_of_staffed_hours;
end
end
end
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities)));
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+((j-1)*no_of_operating_days)+k,d+((j-1)*no_of_operating_days)+k)=-1;
end
64
end
d=((no_of_operating_days*no_of_operating_days*no_of_specialities));
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k) = 1;
end
end
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days)+(no_of_types_of_theatres*no_of_specialities*no_of_operating_days)+
1);
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k) = 1;
end
end
%For the emergency hours equal staffed hours
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days)+(no_of_types_of_theatres*no_of_specialities*no_of_operating_days)+
1);
e=((no_of_types_of_theatres*no_of_operating_days)+(2*(no_of_specialities*no_of_
operating_days)+1)+no_of_specialities);
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k) = 1;
end
end
%For the emergency OR hours allocated
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_op
erating_days)+(no_of_types_of_theatres*no_of_specialities*no_of_operating_days)+
1);
e=((no_of_types_of_theatres*no_of_operating_days)+(3*(no_of_specialities*no_of_
operating_days)+1+no_of_operating_days)+no_of_specialities);
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k) = 1;
end
end
65
%For the POC constraint
e=((no_of_types_of_theatres*no_of_operating_days)+(4*(no_of_specialities*no_of_
operating_days)+1+no_of_operating_days)+no_of_specialities);
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k) = 1;
end
end
d=((no_of_operating_days*no_of_operating_days*no_of_specialities));
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k) = -1;
end
end
%Under supply constraint
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_specia
lities*no_of_operating_days)+(2*(no_of_specialities)));
e=(no_of_types_of_theatres*no_of_operating_days)+2*(no_of_specialities*no_of_op
erating_days)+1;
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k)=1;
end
end
d=(no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_special
ities*no_of_operating_days);
e=(no_of_types_of_theatres*no_of_operating_days)+2*(no_of_specialities*no_of_op
erating_days)+1;
for j=no_of_specialities
A(e+j,d+1)=1;
end
d=(no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_special
ities*no_of_operating_days)+no_of_specialities;
e=(no_of_types_of_theatres*no_of_operating_days)+2*(no_of_specialities*no_of_op
erating_days)+1;
for j=no_of_specialities
A(e+j,d+1)=1;
end
sum=0;
for j=1:no_of_specialities
for k=1:no_of_operating_days
66
sum= sum+o(j,k);
end
end
for j=1:no_of_specialities
g(j)=0;
for k=1:no_of_operating_days
g(j)=g(j)+o(j,k) ;
end
end
d=((no_of_operating_days*no_of_operating_days*no_of_specialities)+2*(no_of_spe
cialities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_types_of_theatres*
no_of_operating_days*no_of_specialities));
for j=1:no_of_specialities
for k=1:no_of_operating_days
A(e+(j-1)*no_of_operating_days+k,d+((j-1)*no_of_operating_days)+k)=-
(g(j)/sum);
end
end
%Constraint bounndary
rs=(no_of_types_of_theatres*no_of_operating_days)+(5*(no_of_specialities*no_of_o
perating_days))+1+no_of_operating_days+no_of_specialities;
left_hand=zeros(rs,1);
right_hand=zeros(rs,1);
%Boundary for operating room constraint
for i=1:no_of_types_of_theatres
for k=1:no_of_operating_days
right_hand(((i-1)*no_of_operating_days)+k,1)= f(i);
left_hand(((i-1)*no_of_operating_days)+k,1)= f(i);
end
end
%Boundary for amount of idle time constraint
row=(no_of_types_of_theatres*no_of_operating_days)+2*(no_of_specialities*no_of_
operating_days);
right_hand(row+1,1)=0;
left_hand(row+1,1)=0;
%Boundary for max number of operating room for a speciality constraint
rows =
((no_of_types_of_theatres*no_of_operating_days)+(2*(no_of_specialities*no_of_ope
rating_days)+1+no_of_operating_days)+no_of_specialities);
67
for j=1:no_of_specialities
for k=1:no_of_operating_days
right_hand(((rows+((j-1)*no_of_operating_days)+k)),1)=c(j,k);
left_hand(((rows+((j-1)*no_of_operating_days)+k)),1)=0;
end
end
%Boundary for OR capacity
for j=1:no_of_specialities
for k=1:no_of_operating_days
right_hand((no_of_types_of_theatres*no_of_operating_days)+((j-
1)*no_of_operating_days)+k,1)=0;
left_hand((no_of_types_of_theatres*no_of_operating_days)+((j-
1)*no_of_operating_days)+k,1)=0;
end
end
%Boundary for non-emergency demand
rows=((no_of_types_of_theatres*no_of_operating_days)+(no_of_specialities*no_of_
operating_days));
for j=1:no_of_specialities,
for k=1:no_of_operating_days
left_hand(((rows+((j-1)*no_of_operating_days)+k)),1)= o(j,k)+em(j,k);
right_hand((rows+(((j-1)*no_of_operating_days)+k)),1)= o(j,k)+em(j,k);
end
end
%Boundary for emergency OR hours and staffed hours
rows=((no_of_types_of_theatres*no_of_operating_days)+(2*(no_of_specialities*no_
of_operating_days)+1)+no_of_specialities);
for j=1:no_of_specialities,
for k=1:no_of_operating_days
left_hand(((rows+((j-1)*no_of_operating_days)+k)),1)= 0;
right_hand((rows+(((j-1)*no_of_operating_days)+k)),1)= no_of_staffed_hours;
end
end
%Boundary for allocated OR hours constraint
rows=((no_of_types_of_theatres*no_of_operating_days)+(3*(no_of_specialities*no_
of_operating_days)+1+no_of_operating_days)+no_of_specialities);
for j=1:no_of_specialities,
for k=1:no_of_operating_days
left_hand(((rows+((j-1)*no_of_operating_days)+k)),1)= 0;
right_hand((rows+(((j-1)*no_of_operating_days)+k)),1)= em(j,k);
end
end
68
%Boundary for POC
rows=((no_of_types_of_theatres*no_of_operating_days)+(4*(no_of_specialities*no_
of_operating_days)+1+no_of_operating_days)+no_of_specialities);
for j=1:no_of_specialities,
for k=1:no_of_operating_days
left_hand(((rows+((j-1)*no_of_operating_days)+k)),1)= 0;
right_hand((rows+(((j-1)*no_of_operating_days)+k)),1)= total_hours_in_POC-
o(j,k);
end
end
%Boundary for under supply constraint
rows=(no_of_types_of_theatres*no_of_operating_days)+2*(no_of_specialities*no_of
_operating_days)+1;
for j=1:no_of_specialities
for k=1:no_of_operating_days
left_hand(((rows+((j-1)*no_of_operating_days)+k)),1)= 0;
right_hand((rows+(((j-1)*no_of_operating_days)+k)),1)=0;
end
end
%Specifying the upper and lower boundary for the variables(optional)
lb=zeros(length(obj),1);
ub=ones(length(obj),1)*Inf;
% Solving using Cplex
cplex.Model.obj = obj';
cplex.Model.ctype = ctype;
cplex.Model.A = A;
cplex.Model.lb = lb;
cplex.Model.ub = ub;
cplex.Model.lhs = left_hand;
cplex.Model.rhs = right_hand;
cplex.solve();
cplex.writeModel('projcpy.lp');
%Display
display(cplex.Solution.status);
solf=cplex.Solution.x;
fprintf ('\nMinimum Time: %f \n', cplex.Solution.objval);
f=((no_of_operating_days*no_of_operating_days*no_of_specialities)+(no_of_special
ities*no_of_operating_days)+(2*(no_of_specialities))+(no_of_specialities*no_of_ope
rating_days))+1;
69
%Solution matrix
for i = 1:no_of_types_of_theatres,
for j = 1:no_of_specialities,
for k = 1:no_of_operating_days,
B(i,j,k)=solf(f);
f=f+1;
end
end
end
display(B);
catch m
disp (m.message);
end
end
70
APPENDIX 3: Screenshots of MATLAB
Figure AP 3.1 MATLAB Programming Window
Figure AP 3.2 MATLAB Model running window
71
REFERENCE
[1] Aida Jebali, Atidel B. Hadj, Alouane,Pierre Ladet “Operating Rooms Scheduling”,
Int. J. Production Economics 99(2006), pp 52-62.
[2] Blake, J. T., F. Dexter, and J. Donald, “Operating Room Managers, Use of Integer
Programming for Assigning Block Time to Surgical Groups: A Case Study”,
Anesthesia and Analgesia, Vol. 94, pp. 143-148, 2002.
[3] Brecht Cardoen, Erik Demeulemeester, “Optimizing A Multiple Objective
Surgical Case Sequencing Problem”, Int. J. Production Economics 119 (2009), pp
354-366.
[4] Brian D Hahn, “Essential MATLAB for Scientists and Engineers”, Elsevier, 2006.
[5] Brian R Hunt, “A Guide to MATLAB - For Beginners and Experienced Users”,
Cambridge University Press, 2006.
[6] Bo Zhang, PavanKumar Murali, Maged Dessouky, and David Belson. “A Mixed
Integer Programming Approach For Allocating Operating Room Capacity”, Daniel J.
Epstein Department of Industrial and Systems Engineering, University of Southern
California,2006.
[7] David J Anto, “A guide to Optimization using CPLEX”, Dave guide series, 2008.
[8] Dinh-Nguyen Pham, Andreas Klinkert “Surgical Case Scheduling As Generalized
Job Shop Scheduling Problem”, European Journal of operation Research 185 (2008),
pp1011-1025.
72
[9] Dexter, F., A. Macario, and R. D. Traub, “Which Algorithm for Scheduling Add-
on Elective Cases Maximizes Operating Room Utilization?”, Anesthesiology, Vol.
91, Issue 5, pp. 1491-1500, 1999.
[10] Dexter, F., and R. D. Traub, “How to Schedule Elective Surgical Cases into
Specific Operating Rooms to Maximize the Efficiency of Use of Operating Room
Time”, Anesthesia and Analgesia, Vol. 94, pp. 933-942, 2002.
[11] Documentation for IBM ILOG CPLEX, High-performance mathematical
programming engine.
[12] H.Fei, N.Meskens, “A Planning And Scheduling Problem For An Operating
Theatre Using An Open Scheduling Strategy”, Computers & Industrial Engineering
78(2009), pp 144-54.
[13] Jill H. Iser,Brian, T. Denton, Russell E. King ”Heuristics For Balancing
Operating Room And Post-Anesthesia Resources Under Uncertainty” Proceedings of
the 2008 Winter Simulation Conference.
[14] Mark Van Houdenhoven & Erwin W. Hans & Jan Klein & Gerhard Wullink &
Geert Kazemier ,“A Norm Utilisation for Scarce Hospital Resources: Evidence from
Operating Rooms in a Dutch University Hospital” J Med Syst (2007) 31:231–236.
[15] Marshall, A., C. Vasilakis, and E. El-Darzi, “Length of Stay-Based Patient Flow
Models: Recent Developments and Future Directions”, Health Care Management
Science, Vol. 8, pp. 213-220, 2005.
[16] MATLAB® 7 Programming Fundamentals by The MathWorks.
73
[17] May, J. H., D. P. Strum, and L. G. Vargas, “Fitting the Lognormal Distribution to
Surgical Procedure Times”, Decision Sciences, Vol. 31, pp. 129–148, 2000.
[18] Peter Heign, “Hospital Maganement IS” Greeter Publications, 2009.
[19] Scribd, The document sharing website. Scribd.com
[20] Tobin A. Driscoll (2009). Learning MATLAB. Society for Industrial and
Applied Mathematics.
[21] Vante Gash, “Approach to Mixed Integer Linear Programming”, MathJoke Press,
2007.
[22] Vincent Augusto, Xiaolan Xie, “Operating Theatre Scheduling With Patient
Recovery In Both Operating Rooms And Recovery Beds.”, Computers & Industrial
Engineering, 45 (2009), pp 112-124.
Top Related