Minimizing the expected waiting time of emergency jobs

We consider a scheduling problem where a set of known jobs needs to be assigned to a set of given parallel resources such that the expected waiting time for a set of uncertain emergency jobs is kept as small as possible. On the basis of structural insights from queuing theory, we develop deterministic scheduling policies that reserve resource capacity in order to increase the likelihood of resource availability whenever an emergency job arrives. Applications of this particular scheduling problem are, for instance, found in the field of surgical operations scheduling in hospitals, where high-priority but uncertain emergencies compete for scarce operating room capacity with elective surgeries of lower priority. We compare our approaches with other policies from the literature in a comprehensive simulation study of a surgical operations unit.


Introduction
In typical scheduling problems, a set of jobs I has to be scheduled on a set of given resources O such that some (often time-oriented) objective is optimized. In many planning environments, not all jobs or their characteristics are known at the time of a scheduling decision, so that there is considerable uncertainty about future demand for resources and thus about ideal resource utilization. At the heart of many scheduling problems therefore lies a form of risk management that needs to trade off the consequences of scheduling a known job on some resource against future demand induced by uncertain jobs. The importance of the scheduling decision is exacerbated if jobs cannot be interrupted once started and in particular whenever the uncertain jobs foreseeably have an emergency character, so that the success of the total system crucially depends on whether emergency jobs can be served in a timely fashion.
In this work, we study the decision problem of scheduling a known set of non-pre-emptive jobs on homogeneous resources in such a way that the waiting time of a set of uncertain emergency jobs which will be released to the system at  Cardoen et al., 2010), where all surgeries that are carried out can typically be split up into a subset of known elective surgeries, which can be planned upfront on a daily or weekly basis, and a subset of non-elective surgeries, which most often constitute emergency surgeries that are uncertain with respect to the points in time of their occurrence and resource utilization. Due to the nature of emergencies, these latter non-elective surgeries often need to be serviced as fast as possible, so that a successful scheduling policy of elective surgeries should leave sufficient free capacity to service emergencies. Related problems have also been studied in the field of machine scheduling and maintenance in order to accommodate rush orders or maintenance operations (see Sect. 2).
While it is possible to estimate the effects of stochastic resource demand and incorporate the estimates in a stochastic optimization model, in scheduling practice often simpler policies dominate that reserve a certain set of resources or a share of their productive time to the uncertain emergency jobs. In operating room scheduling, for instance, a standard practice is to reserve one or more operating rooms exclusively for emergency surgeries in order to always have available capacity for the emergency surgeries (provided that these resources have not already been seized by another emergency). This also reduces disruptions of the planned schedule comprised of known jobs, since they are effectively not com-peting for the same resources. However, this will typically come at the expense of a lower resource utilization whenever no or only few emergencies need to be processed and might be too inflexible whenever several emergencies occur one after the other. In this work, we will investigate deterministic scheduling policies that try to schedule known jobs in such a way that the expected waiting time of uncertain emergency jobs is reduced without directly having to anticipate future demand in the analysis.
For this purpose, the paper is structured as follows: in Sect. 2, we provide a literature overview with a focus on operating room scheduling. In Sect. 3, the problem setting is described. We also analyse a simplified queueing model in order to derive theoretical insights into the problem structure (Sect. 3.1) and motivate a deterministic scheduling policy that arranges jobs without emergencies in a particular fashion (Sect. 3.2). We then develop two scheduling approaches in Sects. 4 (mixed-integer programme) and 5 (heuristic), which are tested in a computational study in Sect. 6. The paper closes with a conclusion in Sect. 7.

Literature review
Although the investigated problem can be found in different areas of application in principle (e.g. production and maintenance scheduling), the presented literature review focuses on operating room scheduling since it is in this field of enquiry that the trade-offs between the interests of elective and non-elective patients have been studied most intensely (cf. Cardoen et al., 2010 andSamudra et al., 2016). Furthermore, we will contrast our policy with two approaches that have been developed explicitly in the context of operating room scheduling van Essen et al., 2012). Nevertheless, we give some brief references to other areas of application at the end of this section.
Operating room scheduling needs to consider a fundamental conflict between elective surgeries (jobs of normal priority), whose characteristics are known at the time of the scheduling decision, and non-elective surgeries, which typically arrive as emergency surgeries and thus have a very high priority, but are otherwise uncertain with respect to their characteristics and times of arrival (see van Riet and Demeulemeester 2015 for an in-depth discussion of the conflict of interest between elective and non-elective patients). Although non-elective surgeries are divided into urgent surgeries, which need care within a fixed time horizon of a couple of hours, and emergencies, which need care immediately, we focus only on emergencies in this paper. Both types of surgeries, electives and emergencies, have to be scheduled in a given number of operating rooms (OR) with a fixed time capacity. In order to accommodate emergency surgeries, two scheduling strategies are possible. In the first, a single or more ORs are exclusively reserved for emergencies and elective surgeries are scheduled only in the remaining ORs. In the second, both patient groups use all ORs. In the literature, different results are found for the question whether electives and emergencies should use the same ORs or not. While Heng and Wright (2013) found out in a simulation study that ORs exclusively used by emergencies reduce the waiting time, Ferrand et al. (2014) demonstrated that emergency waiting times can be reduced significantly when both patient groups can use all ORs. To allow the shared use of the same resources by elective and emergency surgeries, a reaction plan needs to be devised that determines under what circumstances an emergency surgery that enters the system can make use of an OR that might have been assigned to an elective surgery by the scheduling procedure. Since it is typically not possible to interrupt an ongoing surgery, reaction plans often define the so-called break-in-moments (BIM), which arise whenever an elective surgery ends, and allow any waiting emergency surgery to utilize the respective operating room even if that means that an elective surgery needs to be postponed or cancelled. Wullink et al. (2007) showed that emergency waiting time will be reduced considerably whenever emergencies are operated in the OR as soon as the next surgery finishes, while maintaining a buffer at the end of the surgery day for any postponed surgery. Another approach by van der Lans et al. (2006) contains a model which distributes BIMs evenly over the surgery day. A similar approach was chosen by van Essen et al. (2012), albeit without considering buffer time.
We focus on scheduling policies minimizing the sum of emergency waiting times in this paper. Nonetheless, hospitals have to include further criteria like costs, idle time, overtime, utilization, cancellations, and lengths of stay of the patients after surgery inside the hospital in their scheduling process (cf. Beliën et al., 2009, van Veen-Berkx et al., 2016, Jung et al., 2019, Vandenberghe et al. 2020. In contrast to the sum of waiting times, Vandenberghe et al. (2019) minimized the expected maximum waiting time of emergent patients. Vandenberghe et al. (2020) minimized amongst others the risk for emergencies to suffer an excessively long waiting time. Xiao and Yoogalingam (2021) introduced a set of standby patients, who are assigned to unused capacity if a lower than expected number of emergencies arrived. Bovim et al. (2020) scheduled flexible operating room slots for emergency patients in a master surgery schedule.
Moreover, we omit further resources used by the emergency patients. In reality, further resources like surgeons, nurses, anaesthesiologists, instruments, imaging equipment (Latorre-Núñez et al., 2016) and prior and later stages, as the preoperative holding unit and the post-anaesthesia care unit, are required (Wang et al., 2015). Besides, we consider deterministic durations of elective surgeries and stochastic durations of emergencies. Amongst others, Kroer et al. (2018) consider stochastic elective durations. time BIM + ex. BIM breaks Figure 1 presents the three scheduling policies considered in this paper and their relation to the literature. The example shows seven elective surgeries which have to be scheduled in three ORs. The points in time where emergency patients can enter an OR are marked by thick solid lines and boxes, respectively. The left approach is an adapted version of the one proposed in van Essen et al. (2012). All surgeries are scheduled in the first two ORs such that the break-in-intervals (BII), i.e. the time between two consecutive BIMs, are minimal and no buffer is included. To make the comparison fair, we added an OR which is exclusively used by emergencies. Due to this extra OR, all three approaches have the same free OR time.
The second schedule in the middle is the one  aim at. They also schedule all elective surgeries without any buffer between but in all ORs such that the free OR time is distributed over all ORs at the end of the planning horizon. Emergency patients can enter the schedule at the end of any elective surgery. We distributed the BIIs as evenly as possible in the second approach (cf. Theorem 2) although this is not stated explicitly in Wullink et al. (2007). Furthermore, we do not consider staff requirements but assume that a surgery team is available when the surgery start is scheduled and assume that each surgery, elective and emergency, can be performed in each OR. van Essen et al. (2012) and  consider fixed assignments of elective patients to ORs or specialities with several assigned ORs, respectively. As further restrictions would deteriorate the approximation of the three schedules in Fig. 1, we omit them and allow each surgery to be scheduled in each OR.
The right part of Fig. 1 shows the proposed scheduling policy of this paper. We will not only introduce BIMs at the end of any scheduled job, which can be used by emergencies to access resource capacity, but further consider the scheduling of breaks, i.e. unreserved capacity between any two jobs on the same resource, as a possible time interval for emergencies that seek to enter the schedule.
We deviated the first two scheduling policies in Fig. 1 from the literature and established the third policy in this section. The three goals of the remaining parts of the paper are to show that these policies distribute BIMs and, in case of the third policy, also breaks appropriately over the planning horizon such that the waiting time of emergencies is as low as possible (1). Moreover, we develop scheduling approaches for the newly introduced policy (2) and evaluate all three policies in a comprehensive computational study (3). The developed approach is sufficiently general such that it can also be employed in other areas of interest. For instance, there are a variety of approaches that seek to execute rush orders that arrive at a random point in time as fast as possible (see, for instance, the rescheduling approach of Vin and Ierapetritou (2000) for batch production). A further application with similar characteristics lies in the field of planned maintenance where machine downtimes have to be scheduled in such a way as not to disrupt the production rate of the machine resources (e.g. see the review of Wang 2002). Wang et al. (2020) optimized makespan and total completion time on identical parallel machines while assuring a maximum waiting time for an emergency job.

Analysis of problem setting
We schedule a set I of non-pre-emptive jobs with known processing times p i ≥ 0 for every job i on a set O of homogeneous resources over a finite planning horizon with length T . We are interested in finding a deterministic scheduling policy that assigns appointments to all known non-pre-emptive jobs, while indirectly considering the risk of overlong waiting times for uncertain emergency jobs that enter the system at random points in time and require immediate attention.
One important application of this problem setting is found in operating room scheduling, where a number of different scheduling approaches have been developed and studied (see Cardoen et al., 2010 for a general survey of the topic). Figure 2 presents an example for a schedule with two resources and four jobs. We define any planned downtime on a resource as a break in the schedule, which includes any time interval between the end of a job and the beginning of the next job on the same resource as well as the time between the start (end) of the planning horizon and the start (end) of the first (last) job on each resource. Any end of a job-independent whether there is a break with a positive length or length zero (e.g. when a job starts immediately after the prior job on the same resource ended)-is referred to as a break-in-moment (BIM). Emergency jobs are allowed to enter the schedule and seize a resource only during breaks.
The remainder of this section is organized as follows. In Sect. 3.1, we use queueing theory to determine quality characteristics of good schedules regarding the expected waiting time of emergency jobs. Afterwards, we deduce our objectives from the theoretical results (Sect. 3.2).

A queueing model for distributing breaks in emergency scheduling
In order to derive basic theoretical insights into the problem structure, we will first analyse a queueing model that serves as an ideal proxy for more practice-oriented planning environments. We will then extend the results of the queueing model to identify characteristics of promising scheduling policies.
The main goal of this model is to find theoretical support for two basic intuitions with respect to the availability of resources, namely that: (1) the number of reserved resources for emergency jobs should be the same at each point in time and (2) BIMs should be distributed as evenly as possible over the time horizon. For the purpose of our analysis in this subsection, we assume that • the time between two emergency job arrivals is exponentially distributed with parameter λ, i.e. the expected time between two arrivals is 1 λ . • the processing time of emergency jobs is exponentially distributed with parameter μ, i.e. the expected processing time is 1 μ . • arrivals and processing times are independent from each other and amongst themselves. • emergency jobs can enter the resources whenever there are breaks according to a FCFS policy.
With these assumptions, we can formulate a straightforward multi-server queueing system that will be the starting point of the analysis. The proof of Theorem 1 is given in Appendix A. Our next theorem states that BIMs should be distributed as evenly as possible over the time horizon. The theorem confirms the findings by van Essen et al. (2012). As we want to investigate how a schedule should be designed beforehand, we assume in the theorem that emergency jobs lead to no disruptions. Thus, we assume emergency jobs to be finished until the next BIM on the same resource. Further, no new BIM is created if an emergency job ends before the next scheduled BIM on the resource, i.e. emergencies are allowed to enter an OR only at scheduled BIMs.
Theorem 2 Let λ > D > 0 be the mean time between two BIMs. Then, the expected waiting time of emergency jobs isindependent of the number of resources-minimal if the time between two consecutive BIMs is exactly D. If an equidistant distribution of the BIMs is not possible, waiting time of emergency jobs is minimal if the variance of the times between two successive BIMs is minimal.
The proof of Theorem 2 is presented in Appendix B.

Scheduling policy
In this subsection, we derive our four objectives: (a) reserve at each point in time |O|·T − i∈I p i T resources for emergencies or deviate as little as possible from it (compare Theorem 1). (b) distribute the extent of breaks evenly over the time horizon (compare Theorem 2). (c) distribute the lengths of breaks, i.e. the time between the end of a job and the beginning of its successor on the same resource, evenly between any two consecutive jobs. (d) utilize as many other resources as possible between the scheduling of any two jobs on the same resource, i.e. as many other resources as possible have breaks between two consecutive breaks on one resource. We name the sequence of resources that specifies where the next break is changing pattern. This leads also to an even distribution of breaks over all resources.
The analytical results of the queueing model are subject to several simplifying assumptions that are not typical for practical planning environments. Still it can be instructive to build up on these insights when considering more practicerelevant settings. As long as the arrival pattern of stochastic emergency jobs follows a stationary Poisson distribution, for instance, expected waiting times will tend to be low whenever the reserved capacity for emergency jobs is at each point in time as close to its mean as possible (objective (a)) and breaks are distributed evenly over the time horizon (objective (b)). This follows intuitively since uneven distributions of breaks over resources and/or time can give rise to bottlenecks that will lead to an increased waiting time for any emergency job that enters the system.
If we consider furthermore the situation where an emergency job is already worked on, breaks on that resource are occupied for further emergency jobs. Hence, it is advantageous if breaks have the same length (objective (c)), as no break should be particularly long, and as many other resources as possible have a break between two consecutive breaks on the same resource (objective (d)), i.e. breaks should ideally rotate always in the same sequence over all resources.
In a setting with a finite planning environment and a set of homogeneous jobs, the analytic results suggest the realization of a deterministic scheduling policy as illustrated in Fig. 3. In the depicted example, 30 homogeneous jobs are assigned to ten resources in such a way that-with exception of the beginning and the end of the schedule-three resources are always available for a break-in of any arriving emergency (objective (a)). Furthermore, the schedule satisfies further characteristics that seem beneficial: all breaks time resources 1 2 3 4 5 6 7 8 9 10

Fig. 3
Example for a schedule with homogeneous jobs and a finite planning horizon between any two consecutive jobs on a resource start after the same time lag to the previous break (objective (b)), are identical in length (objective (c)), and whenever a job finishes, the same resource is only considered for another job once jobs have been assigned to all other available resources (objective (d)). Overall, this makes it less likely that an emergency job that enters a resource completely disrupts the prior schedule and reduces the risk that two consecutive emergencies will block each other on the same resource. By consecutively changing resources between breaks and extending the lengths of breaks after any job as much as possible, it is more likely that any emergency job will only interact with the least amount of scheduled jobs possible in a setting where electives and emergencies share all resources. Notice that whenever jobs are inhomogeneous (i.e. differ with respect to their processing times), it can become considerably more challenging to approximate a schedule structure as given above. On the other hand, diverging processing times open up possibilities to improve the beginning and the end of the schedule on a finite planning horizon by appropriately filling in the gaps in the schedule. Finding appropriate schedules for inhomogeneous jobs is the subject of the next two sections.

A mixed-integer programming formulation for the scheduling problem
The mixed-integer programming (M I P) model takes a set of elective jobs I with varying processing times p i that are to be scheduled on a set of homogeneous resources O. It seeks to find a feasible elective schedule that assigns all jobs to a resource and to a point in time while observing the four objectives stated above. sets parameters and scalars with the constraints br eak length The objective function optimizes our four goals stated in Sect. 3.2. The letters in brackets refer to the letters of the optimization goals. In particular, the objective minimizes the overlap between jobs (11)-(12); compare objective (a)) and the deviation between the longest and shortest breakin-interval (13)-(19); compare objective (b)). Moreover, we maximize the shortest break length on each resource (8)-(10); compare objective (c)) and optimize the rotation of jobs amongst resources (changing pattern; (20)-(25); compare objective (d)).
(2) makes sure that each job is scheduled on exactly one resource. Because of (3) it is not possible that the sum of processing times on one resource is bigger than the available time T . Constraints (4)-(7) determine the job sequence. Due to (4), x i j = 1 if job j starts after job i. (5) makes sure that there is a unique sequence even if more than one job starts at the same point in time. Thanks to Constraints (7) z i j = 1 if job i is finished before job j starts. Due to ε, the small positive number, z i j = 1 even if job i is finished at the point in time job j starts. Constraints (6) make sure that z i j is zero if job i is not finished when job j starts.
Constraints (8)-(10) determine the shortest break length on all resources. As the objective tries to maximize d o , (8) makes sure that d o equals the smallest break on resource o, i.e. the smallest time between the end of a job i (s i + p i ) and the start of the following job j. Due to (3−x i j −y io −y jo )· M, only the following jobs on the same resource are taken into account. Constraints (9) and (10) are only necessary if only one job is assigned to resource o. As in this case d o is not bounded by (8), (10) fixes it to zero.
The next block of constraints determines the overlapvariables ov i j , which indicate the amount of time jobs i and j run parallel. Constraints (11) compute the overlap if job j is a successor of job i, and job i ends before j does (w i j = 0). If job j ended before job i, (11) would lead to a wrong overlap. Therefore, w i j is introduced and the case in which job i starts before and ends after job j is considered in Constraints (12). Note that an overlap of more jobs is worse than of fewer. If there is an overlap of two jobs, (11) and (12) count the duration when the second job starts. If there is an overlap of three jobs, the overlap between the first two will be counted when the second job starts. Furthermore, the overlap between the third and the first, and the third and the second job is counted when the third job starts. So the overlap between all three of them is counted three times.
Break-in-intervals are considered in Constraints (13)-(19). Constraints (13) and (14) fix the BII, i.e. the time between the end time of job j and the end time of the job i which starts next to b j , for all jobs which have a successor. Constraints (15) and (16) do the same for the last job on each resource. In this case, the break-in-interval is the time until the end of the planning horizon T , as we assume that emergency jobs can enter any resource at the end of the planning horizon. Constraints (17) and (18) determine the maximal and minimal break-in-intervals b and b. For the computation of b only one job which starts at the beginning of the planning horizon is counted (c i = 1 for all other jobs starting at the beginning of the planning horizon due to (19)), as b would be zero otherwise.
In the following, the changing pattern is defined. For this, we introduce v i jo in Constraints (20)-(22) which is 1 if job j starts before job i and job j is assigned to resource o. We need v i jo for the big M in Constraints (23) and (24), in which the number of jobs which started between the start of the latest preceding job on resource o and the start of job i is counted (u io ). The big M part with v i jo makes sure that this last preceding job on resource o is considered. Constraints (25) make sure that the last job i is assigned to the resource for which u io is maximal, i.e. for which the last preceding job is the longest time ago. The factor 1/2 is important, as i is also counted in the sum of the third part of the objective (changing pattern). Without the factor, the model has no pressure to assign i to the desired resource.
We need O dummy jobs, one at time zero on each resource to initialize the changing pattern. Constraints (6), (7), and (18) do not apply for them. Constraints (19) make sure that Constraints (18) are not binding in this case. Furthermore, we cannot count any of them in Constraints (8). Otherwise we would have a break at time zero on each resource (see Theorem 1). Finally, Constraints (26)-(31) are the non-negativity and binary constraints.

Heuristic scheduling approach
The developed M I P model contains a significant number of binary variables and will likely be restricted to solving instances of small size only. Thus, we develop a construction heuristic in this section that aims to approximate an ideal schedule structure based on the insights of Sect. 3.
Consider the schedule in Fig. 4. Here, 7 jobs have been scheduled on three resources such that all of the four objectives described above are satisfied ideally, i.e. breaks are evenly distributed over time ((b)) and resources ((a)), the lengths of breaks between any two consecutive jobs are identical ((c)), and the jobs rotate from one resource to the next in the sequence (2, 3, 1) ((d)). We will use the structure of the above schedule as a blueprint to construct approximate schedules of similar quality. For this purpose, we will interpret the ideally distributed capacity utilization in the schedule of Fig. 4 as slots, to which a set of jobs of a given problem instance needs to be assigned. Of course, it will typically not be possible to assign jobs perfectly to the start and end times of the slots, but in getting as close as possible, we will produce schedules that maintain much of its favourable structure. In what follows, we will assume w.l.o.g. that there are at least as many jobs as resources, since any excess resource will not need to be considered for a job assignment.
We will first characterize the distribution of slots in the ideal schedule and then explain how jobs of a given planning instance are assigned to slots. At the core of the schedule, there is a set B of slots of the same length which are successively assigned to resources rotating from one to the next (jobs 3-5 in Fig. 4). The exact number of slots in B depends on the number of complete rotations R (here a single rotation) and the number of resources (|B| = R · O). In addition to that, there is an incomplete rotation at the beginning of the schedule of slots in A with |A| ≤ O that have varying lengths and make use of any underutilized resources at the beginning of the schedule (here jobs 1 and 2) and another incomplete rotation at the end of the schedule of slots in C with |C| ≤ O that also have different lengths which utilize the remaining capacity at the end of the planning horizon T (here jobs 6 and 7).
The construction heuristic works in three phases. In the first phase, we determine the ideal structure of the schedule, that is we determine the number and start and end times of slots on each resource. In the second phase, jobs are assigned to the sets of slots, and in the third phase the actual start times of jobs on resources are determined. We begin by determining the cardinality of each of the slot sets. Given that each resource has T units of productive time, an even distribution of breaks over resources seeks to keep approximately O − i p i T resources free at any point in time. It follows that set A of the first incomplete rotation should ideally contain slots, where · rounds to the nearest integer. As a consequence, the number of complete rotations over all resources equals and thus |B| = R · O. Any remaining slots are assigned to set C as the final incomplete rotation |C| := |I | − |A| − |B|.
There are several possible ways to determine lengths and start times of slots which utilize a resource in an ideal schedule which can be characterized by a divisor D that denotes the number of slots over which utilized and idle times are to be distributed. Once D is determined, the lengths of the slots sl = i p i D and breaks bl = O·T − i p i D are determined by evenly distributing the utilized and idle time over all slots. Finally, the slots should be evenly distributed over the time horizon, so we set the according rate sr to T D . One natural way of choosing D is to count the number of breaks that are to be scheduled on all resources as D = (R + 1) · O, one initial break on each resource and an additional one after each slot in a rotation. This is the case in the example Fig. 4, where D = (1 + 1) · 3 = 6 and thus sl = 12 6 = 2, bl = 6 6 = 1 and sr = 6 6 = 1. However, whenever the actual job lengths deviate from the lengths of the ideal slots, better approximations might be generated by varying D.
With the help of these three concepts, we can determine the ideal start times s * j and end times e * j of the slots. Assuming that slots are numbered in ascending order, the first |A| slots all have start times of s * j = 0 for j = 1, . . . , |A|. The start times of the next |B| + |C| slots are spaced over time by the ideal rate such that they result to s * |A|+ j = sr · j for j = 1, . . . , |B| + |C|. Ideal end times of the first |A| slots depend on the start times of the next slot on the same resource and the ideal length of the break between any two slots. It thus follows that e * j = sr ·(O−|A|+ j)−bl for j = 1, . . . , |A|. End times for the remaining slots depend on the ideal slot length and the end of the planning horizon e * |A|+ j = min{s * |A|+ j +sl, T } for j = 1, . . . , |B| + |C|.
In the next phase, the jobs of the planning instance are grouped into subsets according to the slots they are later assigned to. Let I A , I B , and I C refer to the job sets assigned to the corresponding sets of slots. Since the slots in A and C will typically be shorter, jobs with the lowest processing times are interchangeably assigned to sets I A and I C , respectively. The remaining jobs are assigned to I B as described by the following pseudocode: Add i * to I C 9: end if 10: end for 11: I B = I Consider the example again with 7 jobs with p 1 = p 7 = 1 and p i = 2∀i ∈ {2, . . . , 6} in Fig. 4. Since i p i = 12, two jobs are assigned to the two incomplete rotations at the beginning and the end (|A| = |C| = 2). So, we have two runs trough the 'for'-loop (lines 1-10). In the first, one of jobs 1 and 7 is assigned to I A and the other to I C . As all remaining jobs have the same length, one of them is assigned to I A and one to I C in the second run of the 'for'-loop. The remaining jobs are assigned to I B (line 11).
Finally, for each job i the start time s i and the assignment variables y io of job i to resource o are determined. Generally speaking, we seek to start jobs at the ideal start time of the slot they are assigned to. However, the schedule is adapted whenever some prior job either fell below or exceeded their respective slot in order to compensate for the additional or reduced length of the break in the schedule. Notice in Fig. 4 that if job 1 were to finish prior to the end of its slot, this could be compensated by letting job 3 start earlier by the same amount. In particular, if job 3 were itself longer than its ideal slot length, it might just finish right with the end of its slot and the rest of the schedule would be unaffected. We will make use of this insight by tracking for any resource o the deviation dev o which its last assigned job had from the ideal end date and then adjusting the next job that is assigned  6-7). The procedure then moves to schedule the jobs in I B . First, the start time of the job s is set to the ideal start time of its slot (line 13) adjusted by the deviation incurred by the job that was scheduled |A| resources before (line 12) or to end o in case resource o is not free (lines 14-16). Then, the job in I B that best fits within the adjusted slot length is identified and scheduled on the current resource (lines 17-21). Finally, the jobs in I C are scheduled in the same fashion (lines 24-34). However, since the slots in C will get shorter and shorter, the jobs in I C are scheduled in descending order of their processing times (line 30), rather than on a best fit basis.
In this example, all jobs fit perfectly to their corresponding slots, so no adjustments to start or end times were necessary. In order to see how start and end times are adapted, consider the variation of the example with p 2 = 1 and p 4 = 3 in Fig. 5. There, job 2 would also be assigned to I A ; however, its scheduling on resource 3 would lead to a deviation of dev 3 = −1, since it would end too early for its slot. This is considered when computing the starting time of job 4 (lines 11-13). With j = ( j − 1) · O + o = (1 − 1) · 3 + 2 = 2, o = 1+(o+O−|A|−1) mod O = 1+(2+3−2−1) mod 3 = 3 and s = s * |A|+ j + dev o = s 4 + dev 3 = 1. In this way, the starting time of job 4 (s 4 ) is corrected by the amount of time job 2 finishes too early and the planned breaking interval is in effect shifted from resource 2 to resource 3, in order to account for the different job lengths.
Notice that the construction heuristic cannot guarantee that all jobs which are assigned to slots in this way end before T on all resources. This is not surprising, since ensuring feasibility would require the solution of a bin packing problem, which is well known to be NP-hard in the strong sense. In the case that a job exceeds T on a resource, we thus use the following simple repair strategy: Beginning with the last job on the resource, reschedule all jobs successively to an earlier point in time until the time horizon is met (lines 35-39). This repair strategy will tend to lead to an overutilization of resources at the end of the planning horizon, the more elective surgeries have to be pushed back in this manner. It might thus make sense to choose a higher divisor D to motivate a more dense assignment of jobs at the beginning of the planning horizon and thus potentially avoiding repair operations. Preliminary computational experiments have indicated that D = |I | offers a good compromise between these two effects and is thus chosen for the following experimental evaluation.

Computational study
In this section, we employ the deterministic scheduling approaches on an example case from the field of operating room scheduling and compare the results to other scheduling policies from the literature. We will first give a brief introduction to the planning environment. Figure 6 shows a typical set-up of a surgical operations centre. Elective patients arrive either from outside the hospital as ambulatory patients just for their surgery or they come from a nursing unit, but typically every scheduled patient arrives at a fixed appointment in the surgical centre. In the first case, the incoming patient registers in the ambulatory surgical unit (ASU) and then moves into the preoperative holding unit (PHU), where the patient is prepared for the surgery. Inpatients are brought directly into the PHU. From there all patients enter the OR, where the surgery takes place. As soon as the surgery is finished, the patient is either brought to the post-anaesthesia care unit (PACU), where the patient recovers from anaesthesia, or to the intensive care unit (ICU) if the status of the patient is critical. Inpatients are brought back to their nursing unit after finishing in PACU, while outpatients either return to ASU and leave the hospital or are moved to a nursing unit for post-operative care.

Description of planning environment
In the following, we will focus on the perioperative area and consider the scheduling of elective surgeries to operating rooms. We assume that all elective surgeries have already been assigned to a given day in a prior planning step and thus restrict our analysis to the short-term scheduling of daily surgeries to operating rooms. In order to test the performance of our approaches, of the M I P model and the construction heuristic (referred to as br eaks), we compare them with alternative proposals from the literature. A standard policy is to reserve an OR for emergencies exclusively and use only the remaining ORs for elective scheduling. We will refer to this policy as exclusive in the following (see van Essen et al., 2012) and use it as a benchmark for calculating capacity utilization. Wullink et al. (2007) propose to schedule all elective surgeries in the first part of the day using all ORs and keep the remainder of their capacity reserved for emergencies. In order to allow for break-ins during the first part, they set BIMs between elective surgeries but do not consider breaks. van Essen et al. (2012) develop several formal methods to evenly distribute start times of surgeries. We implemented their fixed goal value heuristic which demonstrated some of the strongest performances in order to schedule break-inmoments. Since the heuristic requires a prior assignment of surgeries to ORs, jobs are first ordered in descending order of their processing time and then successively assigned to the OR with the current lowest sum of surgery times. We refer to this approach as B I M. Finally, we also test a combina-tion of the two alternative proposals by reserving an OR for emergencies, but allowing break-ins into the elective schedule at evenly distributed BIMs whenever the exclusive OR is occupied (B I M + ex).

Parameters of the simulation environment
We simulate two sets of instances, a small test set and a large test set with varying numbers of ORs and elective surgeries. In the small test set, either two or three ORs are considered, one of which is reserved for emergencies in the benchmark policy. Elective surgeries are varied between 4 and 16 (4, 6, and 8 per non-reserved OR) as given in Table 1.
The length of the surgery day was set to eight hours (480 minutes) and the total sum of all surgery durations fixed at (O − 1) · 480, so that capacity utilization of non-reserved ORs is set to 100%. Processing times of elective surgeries are determined by a log-normal distribution (compare Strum et al., 2000 andvan Essen et al., 2012) with a shifting mean set to the remaining surgery time divided by the remaining number of surgeries with a standard deviation of 10.
In the large test set, up to 15 ORs are scheduled with 4, 6, and 8 elective surgeries for any non-reserved OR as given in Table 2. Capacity utilization of non-reserved ORs was further varied in steps of 80%, 90%, and 100% to account for situations when the capacity of non-reserved ORs is not fully utilized by elective surgeries.
For each combination of parameters, 60 scheduling instances are created and solved by the scheduling policies. The small set was solved by all approaches, including the M I P model which was implemented in GAMS and solved by CPLEX with a time limit of 3600s (= 1 hour). The large set was solved by the other four policies only, which were implemented in V B.net. After the instances were solved, each solution was evaluated in 500 simulation runs to compute waiting times. For the simulation, arrival times of emergencies followed a Poisson process with an expected value of 4/480, so that four emergency patients per day are expected. Emergency surgery times were set by a log-normal distri-bution (compare Wullink et al., 2007, de Bruin et al., 2010 with a mean of 90 minutes and a standard deviation of 10. The simulation then proceeds as follows: Whenever an emergency enters the system, the next possible break-in point in the elective schedule is determined (i.e. the next point in time an OR is free) and the emergency is assigned to this OR. If the assigned emergency interferes with one or more scheduled elective surgeries, then these electives are marked as postponed. In practice, there are several ways to react to such an interference. For instance, the elective surgery could simply be postponed until the OR is free again or assigned to another OR in the meantime. Alternatively, the elective could be moved to an overtime period at the end of the shift or be cancelled completely for the day and be rescheduled at a later date. In order not to rule out particular reaction schemes and still test the performance of the schedule structures created by the scheduling procedures, we simply count postponed electives, but do not allow further emergencies to make use of any additional free time which might result from a cancellation. This way it is also ensured that the capacity utilization remains constant over all procedures, which seems a prerequisite for a fair comparison.

Results of the simulation
Preliminary tests showed that M I P could only solve instances up to three ORs reliably, so that the performance of the approach is investigated for the small test set only. We set α = β = γ = δ = 1. Hence, all parts of the objective have the same weight. Table 3 shows the average waiting times over all instances with two and three ORs and over all instances with the given number of surgeries.
As can be seen, the benchmark policy exclusive leads to the highest average waiting time of over 45 minutes. Since the exclusive reservation decouples elective and emergencies, the results are further independent of the number of ORs and elective surgeries. In line with the results of Wullink et al. (2007), waiting times can be reduced significantly by making use of all ORs and evenly distributing BIMs over the surgery day (B I M). Yet, the combination of both approaches B I M +    ex, where a room is exclusively reserved and yet break-ins are allowed in the elective schedule, considerably improves performance even further, since the free capacity is more evenly distributed over time in this case. The two scheduling policies developed in this work lead to a further decrease in waiting times of about 2 minutes compared to B I M + ex on average over all considered instances. However, they perform worse than B I M + ex for the smallest instance sets with two ORs and 4 to 6 electives, but significantly better once the number of ORs and elective surgeries is increased. This is to be expected, since few surgeries allow only few break-inmoments, so that an exclusive OR for emergencies only will have a bigger advantage. Both M I P and br eaks perform similarly and dominate B I M. Interestingly, M I P is even slightly beaten by the simple construction heuristic because M I P could not solve all instances to optimality and might not be parameterized optimally.
In order to get a better insight into the performance, all approaches, except for M I P, have further been tested on the large test set. Table 4 gives an overview over all results reporting the average waiting time of emergencies and the maximum waiting times per simulation run averaged over all runs. Furthermore, it displays the average number of elective surgeries that have to be postponed due to a break-in of emergencies. Over all instances, br eaks clearly outperforms the benchmark policy and B I M at least with respect to average and maximum waiting times. The exclusive reservation has the advantage that the elective schedule is never disrupted, while break-ins regularly lead to a postponement of electives in the other cases. When comparing br eaks with B I M, we can see that the latter is dominated in terms of waiting times and number of postponed electives. The combination of an exclusively reserved OR with additional break-ins on average performs worse with respect to waiting times when compared to br eaks, yet the performance trade-off is much more complex, also because the lower average waiting times generated by br eaks will be weighed again the lower number of postponed electives in the case for B I M + ex. On average over all instances, br eaks gains approximately 1.5 minutes in lower waiting times at the cost of an additional elective surgery having to be postponed. Yet, the performance differences vary considerably with respect to capacity utilization, number of ORs and electives.
In tendency, the lower the number of elective surgeries and the higher the capacity utilization the better the results of B I M +ex when compared to br eaks. This makes intuitive sense, since br eaks is designed to spread out the idle time of ORs and thus the more idle time there is to work with, the better it will perform in comparison. Likewise, a low number of elective surgeries will only allow few degrees of freedom for break-ins and thus the exclusive OR provides more availability. For the same reason, the performance of all approaches (except exclusive) tends to improve with an increasing number of elective surgeries per OR. Interestingly, while the two BIM approaches also benefit from an increased number of ORs, the performance of br eaks is improving at first, but then in some instances gets worse for further increasing numbers of ORs, in particular in the lower utilization scenario with few electives. A possible explanation for this phenomenon could be that a large number of ORs with few electives makes an approximation to the ideal plan of Figure 4 more difficult and thus deteriorates performance. Nevertheless, with the exception of the instances with the lowest number of ORs, average waiting times for emergencies are within 15 minutes for the br eaks heuristic, which in practice should typically be sufficient for facilitating an immediate service, given that the hospital is informed ahead of time of the emergency. In order to investigate this further, Table 5 shows the percentage of emergencies that can be served within 15 and 30 minutes, respectively, for all procedures.
As can be seen, br eaks leads to a significantly higher percentage of served emergencies within 15 minutes even when compared to B I M + ex and the improvement only slightly decreases with higher utilization. The higher the utilization rate, the lower the percentages of serviced emergencies for all procedures, yet br eaks still manages to guarantee a ser-   vice within 30 minutes for about nine out of ten emergencies and more than four out of five emergencies can be serviced within 15 minutes. This is a relevant difference since a service within 15 minutes will typically be sufficient for accepting an emergency. In order to test the sensitivity of the experimental results against the background of a dynamic and uncertain environment, we also studied the performance of the approaches under the assumption of uncertain surgery times of elective surgeries. For this purpose we introduced a normally distributed error term with a mean of 0 and a standard deviation of 10 and 20 minutes, respectively. Schedules were planned under the assumption of deterministic surgery times, which is typical for practical settings, but the actual surgery lengths of electives were then adjusted by the error term during the simulation, which means that some elective surgeries might have to start later than planned if the OR is not free on time. Tables 6 and 7 display average waiting times for these experiments for br eaks, B I M and B I M +ex, since the exclusive policy is not affected by changes in elective surgery times. Additionally, the tables report the average unplanned overtime of each OR in minutes (overtime Over), which results from elective surgeries exceeding the limit of the time horizon of 480 minutes, and the percentage of electives that were actually executed on time (Ontime).
The performance measured in average waiting times tends to improve for the B I M and B I M + ex heuristics with a higher standard deviation of elective surgeries. This is explained by the increased overtime whenever uncharacteristically long surgeries are carried out towards the end of the planning horizon, such that this effectively reduces capacity utilization within the planning horizon. The performance of br eaks deteriorates slightly with a higher variance, because unplanned extensions in the duration of elective surgeries strongly interact with the even distribution of breaks over time which overcompensates for the lower capacity utilization, especially in the high variance case.
One can further see that the more even distribution of electives over all ORs and time in br eaks has the additional benefit of facilitating punctual starts of elective surgeries in the majority of cases. Over all tested medium variance scenarios, 68% of electives start on time, compared to only around 40% for the other procedures. Even in the high variance case, 59% of electives start on time. As a consequence, elective schedules determined by br eaks will tend to be much more robust not only with respect to the start times of emergencies, but also with respect to unplanned interferences with the start times of elective surgeries.

Conclusion
In this work, we investigate deterministic scheduling policies that allow a timely service of uncertain emergencies. We showed that evenly distributing non-utilized capacity in the form of breaks over the planning horizon and all resources can significantly reduce waiting times for emergency jobs. Our computational results show that a simple construction heuristic can significantly reduce waiting times in comparison to approaches from the literature. An interesting aspect was furthermore that expected waiting times for emergency jobs are strongly dependent on the combination of number of resources, number of jobs per resource, and utilization. This might lead to strategies for job mix and scheduling which lead at least for special time intervals or a subset of resources to a good schedule from the point of view of highpriority emergency jobs (this might be useful especially in OR scheduling). Moreover, improvement heuristics such as metaheuristics might improve the results.
In the context of OR scheduling, we have not considered the pre-and post-operative area. However, our policy schedules surgery starts as evenly as possible over the surgery day. If we assume preparation times to be independent of kind and duration of the surgery, then the preoperative workload is smoothened simultaneously. Although surgeries have different durations, we want to have breaks with the same length. So we also smooth the time between two surgery ends and therefore indirectly post-operative area's workload (compare also Calegari et al., 2020). Dexter et al. (2005) and Marcon and Dexter (2006) considered surgery scheduling's influence on the post-operative area, especially the PACU. Furthermore, we assumed the interarrival time of emergency patients as constant. In real applications, the interarrival time might be longer in the night hours than in the daytime. This yields to a further question for future research. The transitions from a higher amount of reserved time to a lower and vice versa might be investigated theoretically or in simulation studies. Hans et al. (2008) scheduled electives with random durations to surgery days. Furthermore, we have not considered how much time should be reserved for emergencies. Approaches according to this are based on historic data (see Lamiri et al., 2008 andvan Houdenhoven et al., 2007) or queueing theory (see Zonderland et al., 2010). Both are interesting aspects to include into our setting in future research.
Funding Open Access funding enabled and organized by Projekt DEAL.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecomm ons.org/licenses/by/4.0/. and Let p j ≥ 0, j = 0, . . . , O, such that and O j=0 p j = 1 hold, i.e. p j is the probability, or rather the share of time, that j resources are reserved for emergencies (such a sequence exists, since o is the mean number of resources reserved for emergencies). If the probabilities p j are positive for any number of resources less than o or higher than o , the expected waiting time can be reduced by the following procedure: (a) Set j = arg min k: o =k = o ∧ p k >0 p k . If j < o, go to (b), else to (c). (b) For any k with p k > 0, and k > o, set p j+1 := p j+1 + p j , p k := p k − p j , p k−1 := p k−1 + p j (such a k exists due to (37) and the choice of j), and p j := 0. Then, (37) and (38) are still fulfilled and because of (36) this reduces the expected waiting time. Go back to (a) if any o = k = o with p k > 0 exists. (c) For any k with p k > 0, and k < o, set p j−1 := p j−1 + p j , p k := p k − p j , p k+1 := p k+1 + p j (such a k exists due to (37) and the choice of j), and p j := 0. Then,

B Proof of Theorem 2
We use the mean queue length of an M/G/1 system to compute the expected waiting time and show that it is minimal if the service time's variance is minimal. Let w.l.o.g. a unit of time be scaled such that λ = 1. Let G be the distribution of the beforehand scheduled BIIs, i.e. the time between two successive BIMs, and D the average length of a BII.