A heuristic approach for scheduling patient treatment in an emergency department based on bed blocking

Maximising the patient flows throughout the emergency care patient pathway is one of the most important objectives in the healthcare system. The emergency department (ED) is the critical point of this pathway in most hospitals, as the potential delays reduce the number of patients seen in the recommended time. One of the key delays in the ED is the waiting time of a patient prior to treatment, which can be reduced by optimising the patient treatment schedules with priorities. In this paper, a novel blocking patient flow (BPF) algorithm is developed and tested using the real data from a hospital in Brisbane, Australia. Initially, a simulation model of real- life ED operations is developed by characterising patient interarrival and treatment times according to different disease categories. Subsequently, a BPF heuristic algorithm is designed and benchmarked via computational experiments using two dominance rules: first come first served (FCFS) and shortest processing time (SPT). The computational results show that the proposed approach leads to a reduction of the total waiting time by more than 8 % in comparison to the current hospital practice, which implies that more patients will be served in a specified time window.


Introduction
The emergency department (ED) plays a vital role in the community as it provides appropriate and timely care 24/7 for the public. The number and growth rate of emergency visits have increased rapidly in the last two decades, and this has led to an imbalance between patients (demand side) and medical resources (supply side) (Carter et al., 2014). This stretching of resources has led to crowding in the ED, longer waiting times, and a reduction in patient privacy. In 2014-2015, approximately 7.4 million people visited an ED in Australia, of whom 73 % spent four hours or less in the ED and 29.73 % were admitted from the ED, with 47 % being admitted within four hours (Australian Institute of Health and Welfare, 2015).
Authors estimate that the rate of patients who leave without being seen (LWBS) can be above 6 % (Saghafian et al., 2015) due to long waiting times. According to Pines et al. (2011), reducing the ED processing time by one hour can reduce the number of patients who leave without being seen. Therefore, busy healthcare systems are creating new challenges for the healthcare industry and driving the desire for analytical solutions (Carter et al., 2014).
Recently, there have been many academic studies on scheduling approaches in healthcare management (Kim & Mehrotra, 2015); however, real-world cases are rarely found in the literature. Many studies have focused on the scheduling of staff. Wang et al. (2009) developed a discrete event simulation (DES) in the ED and examined various scenarios for improving the patient waiting time. Omar et al. (2015) minimised the number of waiting patients in the ED using a mixed integer linear program (MILP) to schedule personnel shifts. Azadeh et al. (2016) presented a detailed review of DES in the ED and developed an ED simulation that considered human error. This simulation was subsequently used to evaluate the impact of staff allocation and training changes. A decision support system was developed in Carmen et al. (2015), where DES was used to evaluate the impact of bed and staffing changes on patient length of stay (LOS). Feili (2013) utilised a simulation-optimisation approach to determine the staffing levels that maximise the patient flow under cost constraints. An agent-based simulation tool was developed by Jones and Evans (2008) to evaluate the impact of various physician schedules on patient waiting times in the ED. A mixed integer programming model was developed by Topaloglu and Ozkarahan (2011) to schedule residents' duty hours, considering the on-call night, day off, rest period, and total work hours. Gutjahr and Rauner (2007) proposed applying an ant colony optimisation approach to a nurse scheduling problem with a variety of constraints regarding nurses' qualifications, working date and time, nurses' and hospitals' preferences, working patterns, and costs.
A number of studies examined the scheduling of patients for procedures across the different units of the hospital. Many of these studies addressed the scheduling of patients for surgical procedures. A stochastic dynamic programming model was proposed by Min and Yih (2010) for scheduling patients in a surgical facility with limited capacity according to patients' priority. A heuristic algorithm was developed by Liu et al. (2011) to solve an operating room scheduling problem with an open scheduling strategy to minimise the overtime cost and maximise the operating room's efficiency. A new surgical case scheduling approach was developed by Pham and Klinkert (2008) using an extension of the job shop scheduling problem to allocate hospital resources to individual surgical cases and decide on the time to perform the surgeries. Chien et al. (2008) developed an evolutionary approach based on a genetic algorithm to solve the problem of rehabilitation patient scheduling and modelled it as a hybrid shop scheduling problem.
Other authors have examined patient scheduling in the ED. Azadeh et al. (2014) optimised the scheduling of ED laboratories using a MILP. A stochastic mixed integer programming model was proposed by Castaing et al. (2016) to minimise the total expected patient waiting times, where the sample average approximation approach was used as a solution technique. This approach considered three queues of patients: an assessment queue before and another after having ancillary examinations by physicians and a queue supervised by nurses for the treatment. Allihaibi et al. (2017) proposed a new ED optimisation model using a stochastic mathematical programming approach under limited budget and resource capacity to optimise the total patient waiting time. Moreover, some researchers focused on minimising the total patient tardiness or waiting time through the timelines of the system (Das et al., 2016). The constraint-based approach was used by Turkcan et al. (2011) to develop sequential appointment scheduling with service criteria and other criteria such as queue length and expectation and variance of patients' waiting times. A knowledge-based reactive scheduling system for EDs has been developed to minimise patient waiting times by determining the patients who have higher priorities initially according to arrival times, patients' priorities, flow time, and doctors' workload (Kiris et al., 2010). Luscombe and Kozan (2016) developed a dynamic scheduling framework for the ED to provide fast solutions that respond to unscheduled arrivals, competing priorities and heterogeneous patient care needs by scheduling patient-bed assignments and task-resource allocations. Fuzzy logic and an evolutionary algorithm were proposed to solve a stochastic optimisation problem with multiple objectives, such as minimising the total patient waiting time and the makespan (Othman & Hammadi, 2017).
Due to the random arrivals of patients, ED scheduling tends to be very dynamic. When a new patient arrives, the schedule should be re-optimised, which makes the implementation of complex optimisation approaches difficult. For this reason, several researchers have examined the use of scheduling rules from operations research, including prioritising shortest processing time, greatest waiting time ratio, earliest due date, and triage shortest processing time (Azadeh et al., 2014;Diefenbach & Kozan, 2010;Kiris et al., 2010;Luscombe & Kozan, 2016).
In this paper, the benefits of implementing scheduling heuristics in a real hospital are investigated. First, a simulation model of a real-world ED in Brisbane, Australia, is developed using real data and expert knowledge. Subsequently, a new blocking patient flow (BPF) scheduling heuristic is developed to schedule patients dynamically in a stochastic ED system to lead patients smoothly though the system. Using the simulation model, this is compared to both the current scheduling practice and a benchmark scheduling heuristic. The results show that the novel BPF heuristic significantly improves the total patient waiting time and on-time treatment performance compared to both benchmark approaches.
The rest of this paper is structured as follows. In Section 2, a simulation model for an Australian ED is developed. In Section 3, the BPF heuristic algorithm is proposed and integrated into the simulation process. The computational results and analysis are reported in Section 4. Finally, the conclusions are presented in Section 5.

ED Simulation Model
The ED system under investigation includes the following main processes and activities: patients' arrival, triage, physician assessment, treatment planning, decision to discharge or admit, and access to inpatient beds. These activities occur in a predefined sequence, and any delays in the operations of the patient flow in the ED can have an impact on patient throughput and may cause bottlenecking (Kozan & Diefenbach, 2008). The operation of the current ED is as follows. Fig. 1 shows the general treatment workflow along the ED treatment pathways. After arrival and triage, the patient is assigned a severity and subsequently assigned to one of the pathways. Fig. 2 shows the three types of pathway: one for patients with highcomplex problems (Resuscitation), one for patients with medium-complex problems (Acute), and one for patients with less-complex problems (Fast Track). The patients in the Acute and Fast Track pathways proceed to waiting rooms where they (potentially) await a bed. Conversely, patients on the Resuscitation pathway are immediately provided with a bed. If a bed is available, then the patient is assigned a bed and awaits an available doctor and treatment commences. As can be seen in Fig. 1, the time between arrival and the initial treatment is classified as the waiting time, which includes the time spent in triage and bed assigned. Treatment time starts with doctor assigned and continues to the ready for departure time. Once the treatment has been completed, the patient is either ready for discharge or is ready to receive an inpatient review for admission. If a patient is admitted, additional waiting time, called the post-treatment waiting time, may be incurred while the patient awaits a specialist consultation and a bed in the admitting unit. Post-treatment waiting time starts with the inpatient review and continues to the departure from the ED, including a bed request. Fig. 1 describes the patient LOS in the ED (LOSED), where the LOSED of each patient includes three main stages: waiting time, treatment time, and post-treatment waiting time, in other words, LOSED = ED departure time -ED arrival time.

Blocking Patient Flow (BPF) Heuristic Algorithm
In this section, a blocking patient flow (BPF) heuristic algorithm is developed to improve the simulation solution. The bed blocking time is the expected time for a patient to complete the proposed treatment and post-treatment waiting time. Many hospitals have tackled the blocking issue by using buffer areas that can handle the waiting patients, whereas the proposed approach solves this problem operationally by optimising patients' schedule based on three main steps: 1) Produce the ED's stochastic variables, such as patient interarrival and treatment times, using statistical distributions. Patient interarrival times are classified into four shifts: day, afternoon, evening, and night, while treatment times are distributed statistically according to 26 types of disease and each disease is distributed to five categories of patients. 2) Obtain the solution of the ED simulation model (the performance regarding the objectives) using ExtendSim software. 3) Apply a novel BPF heuristic algorithm to the simulation process using the stochastic variables produced in Step 1 and then compare the result of the ED simulation model with the obtained result in Step 2.
The stochastic variables in Step 1, such as patient interarrival per shift for each disease, treatment time per disease, and each disease, are distributed to the five categories of the Australasian triage scale (ATS) by specific ratios that are produced. The ATS is a clinical tool used to establish the maximum waiting time for medical assessment and treatment of a patient, and to describe clinical urgency. The ATS categories split into five categories, where category 1 is an immediately life-threatening condition that requires immediate treatment and category 2 is an imminently life-threatening condition which can be treated within 10 minutes. Additionally, category 3 is a potentially life-threatening condition which can be treated within 30 minutes, category 4 is a potentially serious condition which can be treated within 60 minutes, and finally, category 5 is a minor condition which can be treated within 120 minutes (Australasian College for Emergency Medicine, 2005).
A BPF algorithm is developed to arrange the priority of bed assignment for the patients arriving at the ED to be assigned to beds in the ED. This algorithm aims to minimise the total waiting time and to increase the number of patients that will be seen in the recommended times by increasing the bed utilisation. is the number of patients and is the number of beds. denotes the ED arrival time for each patient , where the patients with indices = 1,2, … , .
represents the expected treatment time for each patient , and represents the expected finish time for each patient . Eq. (1) calculates : The available beds in the ED are divided into a number of queues that can accept all ATS categories of patients, i.e. each bed queue has a type, and each type has beds. ∈ = 1,2,3,4,5 denotes the ATS category of patient , and ⊆ denotes the categories of patients that are admissible for bed type .
In the hospital used in this case study, there are three types of beds ∈ , , . The first type is Resuscitation (type ) beds which only accept critical patients, i.e. those with = 1,2,3,4,5, and thus = 1,2,3,4,5 . Secondly, the Acute (type ) beds can accept all patients that have ATS categories 1-5, ∈ = 1,2,3,4,5 , and finally the Fast Track (type ) beds can have ∈ = 1,2,3,4,5 . denotes the queue for the beds of type , as shown in Eq. (2): Furthermore, where , ∈ is the patient index with priority or position in queue , ≜ | ∈ is the set of patients that may be assigned to bed type , and = | | is the number of patients in type .
⊆ are the patients of type that are currently assigned a bed and is the expected available time for bed , as shown in Eq. (3): Before explaining the details of the BPF algorithm, let look at the simple example to understand the advantages of the algorithm. A simple example has one bed and two patients, where patient is already in the queue waiting for an ED bed, so the PBF algorithm works as follows (as shown in Fig. 3). Fig. 3 shows that when patient arrived at the queue, then the algorithm computes the first waiting time for each patient would have if is in front of or is in front of (the two possible ordering of the queue). Next, the algorithm calculates the second waiting time based on the different arrival time of patient and and the expected available time of bed for each patient. Then the algorithm sums these two waiting times and chooses the queue ordering that has minimum waiting time.
If patient has been setting for a long time, the expected available time for bed minus the arrival time is going to be very long for patient because patient arrived a long time ago. His or her waiting time has already lengthened, so that the preference is to take , ordering. On the other hand, if and arrived close to the same time, their waiting times will be determined by the ordering. The first term is the waiting time that is already occurring because a bed is occupied, and the second term is the waiting time that is determined by ordering in the queue. So, the total waiting time is the sum of these two factors: the waiting time until a bed is available plus the waiting time that is determined by how the queue is ordered. The BPF algorithm is ordering these patients by minimising the total of those two factors. , contains two terms: the first term is calculated by the waiting time to the different arrival time of patient and , and the bed availability, which means that this term sorts patients based on different arrival times. Then the second term is calculated by the waiting time that responsible on the different treatment time of patient and . The BPF algorithm considers both terms and sorts patients by looking for the minimum waiting time of these two terms. This idea extends to a large number of patients by using this pairwise comparison to every patient in the queue. When a new patient arrives at the existing queue, we then count the pairwise ordering for every patient in the queue. Algorithm 1 below illustrates the steps of the BPF heuristic algorithm, and these steps will be repeated whenever a patient arrives at the queue.  Then Swap the position place of the patient , 1 in the queue Swapped = True

End If End For End While Return
The goal of the scheduling problem is to place the patients with indices = 1,2, … , into appropriate triage queues in the order that minimises the total waiting time. Fig. 4(a) and Fig. 4(b) below show that 10 patients have been assigned to seven beds according to first come first served (FCFS) and BPF respectively. The patient waiting time and bed blocking times are detailed in the Figures, where the patient waiting time is dots and a box filling with up light diagonal lines and the bed blocking time is a solid coloured box. BPF has improved the patient waiting time accordingly by using an efficient patient. The total waiting time and average LOS for 10 patients have been reduced from 308.92 minutes to 45.46 minutes and from 130.06 minutes to 103.71 minutes respectively by using FCFS and BPF respectively, as shown in Fig. 4(a) and Fig. 4(b).

Case study using real hospital data
In this section, the methods developed in this paper are applied using data that was collected from the Royal Brisbane and Women's Hospital (RBWH). In this paper, the ED operations are formulated as a simulation model. A simulation is a useful technique that assists the healthcare decision makers to reconfigure the existing system to improve service performance and reduce operating costs. The simulation model for the ED was developed to evaluate the effects of the newly proposed heuristic in the following manner. Generally, the arrival and treatment times of patients depend on the classification and severity of their disease. In the proposed simulation model, the arrival characteristics and treatment times are modelled for each of the 26 classifications of the World Health Organisation's International Classification of Diseases (ICD-10). The severity of the patient's condition is specified using the five categories of ATS.
Stat::Fit (Benneyan, 1998) was used to fit distributions to the data for each disease. The distributions for treatment times per disease and interarrival times per shift for each disease fit the data much better with the use of the new 26 categories than previous studies, which mainly used triage categories or the option to use broad presenting conditions. The patient interarrival times per shift for each disease and the treatment times for each disease are established using the real data collected from the RBWH, where each disease is distributed to the different ATS categories by specific ratios, as shown in Appendix A. Furthermore, the simulation model, interarrival times and treatment times are not deterministic. Statistical distributions are constructed depending on disease type and whether this distribution is appropriate for that type of disease by using Stat::Fit Distribution Fitting Software, as shown in Appendix B. Fig. 5 shows the probability of each type of bed in the ED for each ATS category. The patient's service priority depends on the patient type and the availability of medical resources, such as beds and doctors. Patients are discharged from the ED or admitted into hospital to receive more treatment. In the Resuscitation pathway, all categories will be sorted from 1 to 3, which means from the highest priority to be served without waiting time to the lowest priority. In the Acute and Fast Track pathways, all categories are sorted as FCFS, and the waiting room is used if there is no bed or doctor available.    6 depicts the main ED-ExtendSim model that includes the patient arrival model, ED processes, EDLOS, and patient discharge. Fig. 7 displays the ED pathways according to the ATS category, and Fig.  8 illustrations the ED processes in detail for each pathway, where the processes in the ED are detailed using ExtendSim software. The ED simulation model was coded by using ExtendSim software based on multiple objectives and several realistic constraints. The aim was to minimise the patient's total waiting time, minimise the patient's LOS, and improve the utilisation of resources. The constraints are developed according to real-life case studies that include the upper and lower bounds of patient arrival times, patient treatment times, personnel (doctors), and daily shifts. The arrival characteristics of patients are modelled as follows. Patients are classified into 26 types of diseases. The interarrival times and probability of a particular triage category are modelled individually for each disease category and shift (day, afternoon, evening, and night). The interarrival time of each patient during a particular shift follows a statistical distribution which is found by fitting a distribution to the real interarrival times (as described in Section 2). The patient interarrival time distributions are shown in Appendix B. Triage categories in Australia are adopted according to the Australian College of Emergency Medicine (Australasian College for Emergency Medicine (ACEM), 2013), as shown in Table  2 below. According to the data, the triage percentages for each ATS category are shown in Fig. 9. Most of the patients are in category 3 (42 %) and category 4 (33 %), while category 2 and category 5 include 13 % and 11 % of the patients respectively. The lowest number of patients is in the most severe category (category 1) with 1 %.  Table 3 shows the percentage of patients who arrive during the four shifts: day shift from 8am to 1pm, afternoon shift from 1pm to 6pm, evening shift from 6pm to 11pm, and night shift from 11pm to 8am. It can be seen in Table 3 that most of the patients arrived during the day shift. To test the effectiveness of the proposed BPF heuristic algorithm, several benchmark algorithms were also implemented. The first is a FCFS policy, in which patients are treated in the order of their arrival. The second benchmark is the shortest processing time (SPT) algorithm, where patients with the shortest (estimated) treatment time are scheduled first. The SPT and BPF algorithms use the treatment time in scheduling patients. In this study, two cases are considered: 1) the perfect knowledge case, where the actual treatment time of the patient is known at scheduling time; and 2) where the historical mean treatment time of the disease category is used for scheduling. The first case gives an indication of the maximum possible improvement for each method, while the second case simulates the more realistic scenario that the real treatment time is unknown during scheduling. Table 4 presents a comparative study using the simulation model with different heuristic algorithms. BPFATT denotes the BPF heuristic algorithm using the actual treatment times for each patient, while BPFMTT denotes the case where BPF is used with the mean historical treatment times for patients in the identified disease category. Similarly, the SPT algorithm, using mean processing times, is denoted as SPTMTT. Each heuristic algorithm was run using 50 simulations over three months of operation of the hospital with the same resources (beds, doctors, etc.  As shown in Table 4, waiting time performance, bed utilisation and doctor utilisation improved by using the BPFATT, BPFMTT and SPTMTT algorithms, where three bed types and three doctor types per shift day were assessed according to their utilisation. Generally, BPFATT gave better results using several performance criteria, compared with other techniques, and BPFATT has a significant improvement compared with FCFS. Based on the ATS categories, the main improvements occurred in category 4 and category 5, with more than 14 % and 25 % respectively, by using the BPFATT algorithm to optimise waiting time performance. There was a slight improvement in categories 1, 2 and 3. Conversely, based on the bed type and doctor type for each shift, the improvement in utilisation was less than 1 %. By comparing the algorithms of BPFATT and BPFMTT values, the improvement was significant if the BPFMTT value was close to the BPFATT. Table 4 also shows that the total waiting time for all patients in the system improved by 83194.55 minutes when using the BPFATT algorithm during the three-month time window (up to 12.02 % on efficiency improvement). However, when using the BPFMTT and SPTMTT algorithms, the total waiting time for all patients in the system improved by 64651.02 minutes and 58675.1 minutes respectively, during the three-month time window (up to 9.34 % and 8.48 % respectively on efficiency improvement). Table 4 shows that the average LOS in the system improved by 4.48 minutes when using the BPFATT algorithm during the three-month time window (up to 2.69 % on efficiency improvement). However, when using the BPFMTT and SPTMTT algorithms, the average LOS in the system improved by 3.59 minutes and 3.1 minutes respectively during the three-month time window (up to 2.16 % and 1.86 % respectively on efficiency improvement). All statistical analyses were set at a significance level of p < 0.05 by using Welch's two sample t-test. These results show that there is a significant difference in calculating the mean for each algorithm. Fig. 10(a) and Fig. 10 . 10(a). Patient scheduling using FCFS Fig. 10(b). Patient scheduling using BPF

Conclusion
This paper has developed a new BPF heuristic algorithm to improve the overall efficiency and effectiveness of the ED under limited budget and resource capacity. A simulation approach is developed to deal with the uncertainties by defining stochastic variables, such as patient interarrival times and treatment times in the ED system. Based on the real-world data collected from the RBWH, extensive computational experiments show that the proposed approach results in an average improvement in the total waiting time performance of 12.02 % by using BPFATT, 9.34 % by using BPFMTT, and 8.48 % by using SPTMTT. Furthermore, the proposed approach results in an average improvement in the average LOS in the system performance of 2.69 % by using BPFATT, 2.16 % by using BPFMTT, and 1.86 % by using SPTMTT. By using the proposed BPF heuristic algorithm for a real-world case study, the patient queue length can be significantly reduced during the three-month time window. Three bed types are investigated in this paper, and their improvement rates are calculated and compared using the FCFS, BPFATT, BPFMTT and SPTMTT algorithm. The improvement rate for the utilisation of the three types of bed is 0.65 % on average by using BPFATT, 0.48 % on average by using BPFMTT, and 0.19 % on average by using SPTMTT. In summary, the proposed BPF heuristic algorithm is promising for real-world application to improve efficiency in the ED.