1. Introduction
Endoscopy units are essential components of modern healthcare systems, providing minimally invasive procedures for the diagnosis and treatment of gastrointestinal and other internal organ diseases. Digestive endoscopy includes techniques such as esophagogastroduodenoscopy (EGD), colonoscopy, endoscopic retrograde cholangiopancreatography (ERCP), and endoscopic ultrasound (EUS), all of which play a key role in the early detection and management of gastrointestinal conditions [
1,
2]. Over recent decades, the incidence of these disorders has increased substantially, driven largely by population ageing and lifestyle-related factors, resulting in a sustained rise in demand for endoscopic procedures [
2,
3,
4,
5]. This growing demand has intensified pressure on hospital resources and has highlighted the need for more efficient use of space, staff, and equipment to ensure timely and equitable access to care. Healthcare systems increasingly face the challenge of accommodating rising demand under strict constraints on infrastructure, workforce, and funding. These limitations often lead to staff overload, reduced productivity, and prolonged patient waiting times [
6,
7,
8]. Within this context, optimising organisational processes and scheduling strategies in endoscopy departments has become a critical area of research, aimed at improving both efficiency and long-term sustainability of care delivery. However, despite ongoing technological and procedural advances, most endoscopy departments continue to experience operational inefficiencies that prevent optimal use of available resources. Long waiting lists, limited room availability, and scheduling overlaps are common, creating a mismatch between current performance and desired service levels. These limitations highlight the need for data-driven approaches capable of translating empirical evidence into actionable strategies for workflow optimisation. In particular, there is a growing need to integrate quantitative methods into hospital management practices to support objective decision-making and promote equitable access to care [
9]. To address this gap, the authors conducted a comprehensive study in the Endoscopy Department of Hospital del Mar (Barcelona, Spain) planning.
The Digestive Endoscopy Unit of Hospital del Mar is a highly specialised service within a reference tertiary hospital, characterised by a complex organisational structure and high procedural demand. The unit comprises five fully equipped endoscopy rooms, four located within the main unit and one in a high-complexity area with advanced technology and anaesthesia capabilities. These facilities allow the performance of a wide range of diagnostic and therapeutic procedures, including gastroscopy, colonoscopy, ERCP, and EUS.
The workforce is multidisciplinary and includes 10 specialised gastroenterologists, 30 trained endoscopy nurses, and 5 anaesthetists, supported by technical, administrative, and cleaning staff. Staffing is organised to ensure operational continuity, with one physician assigned per room and a stable nursing allocation throughout each shift. Typically, two nurses are present per room: one responsible for sedation and patient monitoring, and the other assisting the endoscopist during the procedure. Additional circulating nurses and a dedicated recovery-area team provide further operational flexibility and enhance patient safety. A specialised nursing team is also responsible for endoscope cleaning and disinfection, ensuring compliance with strict hygiene standards.
From an operational perspective, the unit follows a structured weekly schedule, operating from Monday to Thursday with morning and afternoon shifts, and a single morning shift on Fridays, resulting in a total theoretical capacity of 50 operating hours per room per week (see
Table 1). Despite this clearly defined scheduling framework, the unit faces persistent challenges, including long waiting lists, limited flexibility to accommodate additional procedures, and frequent rescheduling. These issues indicate a mismatch between demand and effective capacity and suggest inefficiencies in agenda design and workflow organisation rather than absolute resource shortages.
Overall, the unit represents a highly specialised and well-resourced clinical setting that nevertheless experiences persistent structural and organisational pressures. This context provides an appropriate case study to examine how data-driven workflow optimisation strategies can improve efficiency, reduce waiting times, and maximise the effective use of existing resources without increasing physical or human capacity.
To address these challenges, the authors applied a methodology that combines descriptive statistical analysis with optimisation models based on Mixed-Integer Linear Programming (MILP) to reorganise both spatial and temporal resources. The landscape of quantitative optimisation methods is broad, ranging from heuristics and metaheuristics—such as genetic algorithms, simulated annealing, and tabu search [
10]—to nonlinear programming approaches. Despite this diversity, MILP remains a dominant and robust framework for addressing complex integrated decision-making problems [
11,
12]. While metaheuristics are often employed to navigate large-scale combinatorial search spaces in facility layout and planning [
13], they typically yield sub-optimal solutions and lack the guarantee of global optimality provided by exact mathematical programming. Conversely, although Mixed-Integer Nonlinear Programming (MINLP) captures complex non-linear physical phenomena [
14], it often presents significant challenges regarding computational tractability and solver convergence compared to linear formulations. Consequently, MILP is frequently selected as the state-of-the-art method due to its balance of modelling precision and computational efficiency, allowing for the rigorous formulation of discrete tactical and operational constraints—such as resource allocation and logical dependencies—while ensuring convergence to a global optimum [
15,
16]. Furthermore, the applicability of MILP in industrial and healthcare contexts has been substantially enhanced by the development of advanced solvers like IBM ILOG CPLEX and Gurobi, which leverage sophisticated algorithms such as branch-and-cut to tackle multi-objective scheduling and planning problems effectively.
Efficiency and quality in endoscopic practice are compatible objectives but require continuous quality improvement programmes and an organisational focus on excellence to ensure sustainable endoscopic quality endoscopic outcomes, including colorectal cancer screening performance. Within this framework, we aimed to identify key operational bottlenecks, assess the impact of alternative scheduling scenarios, and develop an optimisation strategy designed to enhance appointment planning, reduce waiting times, and improve patient throughput. By addressing both efficiency and fairness in access to procedures, the study provides a practical and replicable framework for hospital resource optimisation.
In this context, a prior observational workflow study was conducted in February 2023 in the Endoscopy Unit of Hospital del Mar (Barcelona, Spain) to characterise real-world time requirements and organisational constraints associated with digestive endoscopy procedures. Procedure-related times were prospectively collected over a two-week period by endoscopists and covered pre-procedural, procedural, and post-procedural phases for colonoscopy and gastroscopy, as well as additional non-programmed activity such as urgent examinations and inpatient procedures.
In early 2023, institutional measures were introduced in response to workforce pressures within the healthcare system, including workload assessments and optimisation of physicians’ schedules. These developments raised concerns regarding the potential impact of time constraints and production pressure on the quality and safety of endoscopic practice [
17]. Production pressure refers to overt or covert pressure to prioritise procedural volume over quality and safety. In endoscopy, such pressure may lead to deviations from standardised processes, accelerated procedural performance, and operator fatigue, with potential consequences for patient safety, procedural outcomes, and professional satisfaction [
18]. Previous studies have shown that fatigue and time pressure are associated with incomplete colonoscopies, reduced detection of polyps and adenomas, and lower colorectal cancer detection rates [
18,
19]. Despite this evidence, many endoscopy units continue to rely on uniform time slots that do not adequately reflect real procedural requirements.
The present departmental analysis aims to quantify the actual time required for colonoscopy and gastroscopy when all phases of care are considered and to examine the organisational implications of discrepancies between real-world practice and routine scheduling. Accordingly, this study analyses the operational efficiency of the Digestive Endoscopy Unit at Hospital del Mar, highlighting shortcomings in room utilisation and workflow management. Exploratory data analysis (EDA) and GAP analysis identified imbalanced room usage as a primary driver of operational bottlenecks and inefficient resource use. On this basis, an optimised scheduling model was implemented using Mixed-Integer Linear Programming (MILP) [
20]. Subsequent simulations demonstrated that the proposed schedules yielded a substantial and consistent improvement.
The results further showed that the actual time required to safely and effectively perform endoscopic procedures [
21] was substantially longer than the time routinely allocated in daily schedules. In addition, production pressure, endoscopist fatigue, and insufficient protection of time slots for urgent and inpatient cases emerged as key factors negatively affecting quality of care, patient safety, and professional well-being [
19]. These findings provided the empirical basis for the development of the subsequent workflow optimisation model.
The remainder of this paper is organised as follows:
Section 2 describes the materials and methods, including the clinical setting at Hospital del Mar, the data collection process, and the mathematical formulation of the Mixed-Integer Linear Programming (MILP) model.
Section 3 presents the experimental results and the performance of the optimised schedules under different simulation scenarios.
Section 4 discusses the practical implications of the findings, and
Section 5 concludes the paper and outlines directions for future research.
2. Materials and Methods
2.1. Data and Study Setting
Three main data sources were used. The first consisted of empirical time measurements collected over a two-week period in February 2023 (10 working days). During this period, pre-procedural, procedural, and post-procedural times were recorded for colonoscopy and gastroscopy. Limited time measurements were also collected for other endoscopic procedures grouped under the category “Other”. Data collection was performed by the Endoscopy Service during routine clinical activity.
The second data source comprised operational information obtained from the hospital’s internal management system, direct observation, and interviews with department coordinators. These data included the number of available endoscopy rooms, operating hours, categorised procedure types with their corresponding average durations, and additional information on staff composition, room assignments, and session schedules provided by the management team.
The third and main data source consisted of a database derived from the actual scheduling records of the Digestive Endoscopy Service. This dataset covered an observation period of approximately six months, from 1 February 2024 to 29 July 2024 (Input Dataset). Unless otherwise stated, all tables and figures presented in the manuscript refer to this observation window. Data were extracted from the Hospital Information System (HIS) and included detailed information for the five operating endoscopy rooms, such as planned schedules, procedure types, examination codes, clinical priority levels, and other operational attributes. All patient-related information was anonymised prior to analysis in accordance with data protection and privacy regulations. Unless otherwise stated, all analyses, figures, and tables refer to the full observation period from February to July 2024. Data are aggregated according to the grouping criteria specified in each figure or table (e.g., by room, by month, or by procedure type).
2.2. Workflow and Time Measurement in the Endoscopy Unit
This study was conducted as an observational descriptive analysis in the Digestive Endoscopy Unit of Hospital del Mar. It was carried out within the framework of institutional organisational measures implemented after the January 2023 healthcare strike, including workload assessments, optimisation of physicians’ schedules, and initiatives aimed at improving care quality and professional well-being. The main objective was to quantify the actual time required to perform endoscopic procedures—specifically colonoscopy and gastroscopy—across all phases of care, and to compare these values with the time allocated in routine endoscopy scheduling Table 6.
A detailed workflow analysis of the Digestive Endoscopy Unit was performed to identify the time requirements associated with each component of the endoscopic process. For both colonoscopy and gastroscopy, procedures were systematically divided into three consecutive phases: pre-procedural, procedural, and post-procedural. Time measurements reflected routine clinical practice under standard working conditions. All workflow descriptions, procedural timings, and time measurements were provided by the Endoscopy Department, which also carried out the clinical activity.
2.2.1. Procedural Workflow
Pre-procedural Phase. The pre-procedural phase encompassed all activities required to prepare the endoscopy room and the patient. These included room cleaning and equipment setup, endoscope replacement, preparation of anaesthesia materials, and review of the electronic medical record. Clinical tasks involved verification of the indication for the procedure, assessment of comorbidities, review of current medication—particularly antithrombotic therapy—confirmation of adherence to fasting and bowel preparation protocols, and completion of informed consent. Patient-related activities such as assistance with undressing, venous access placement, physiological monitoring, and anaesthetic induction were also included. Additional time was often required for elderly patients, individuals with cognitive impairment, or those with language barriers, often requiring verification with accompanying caregivers.
Procedural Phase. The procedural phase comprised the endoscopic examination itself. For colonoscopy, this included insertion time, withdrawal time, and therapeutic interventions when indicated. Based on routine clinical activity, therapeutic procedures such as polypectomy were performed in approximately 30% of colonoscopies, leading to longer overall examination times. For gastroscopy, the procedural phase consisted of diagnostic inspection with or without biopsy sampling. The analysis focused on total examination time under standard diagnostic conditions.
Post-procedural Phase. The post-procedural phase included completion of intra-procedural documentation, processing and labelling of biopsy or resection specimens, generation of the endoscopy report, and submission of pathology requests with double-check verification. Communication of results and post-procedure instructions to patients—and, when appropriate, to family members or caregivers—was part of this phase, particularly for elderly patients or those receiving antithrombotic therapy.
2.2.2. Data Collection
Prospective time measurements were collected over a two-week period in February 2023. Data recording was performed by endoscopists directly involved in patient care.
For colonoscopy, pre-procedural times were recorded for 72 examinations by nursing staff, and post-procedural times were recorded for 70 examinations by endoscopists. For gastroscopy, pre-procedural times were recorded for 42 examinations and post-procedural times for 39 examinations. Time data were summarised using mean and median values for each procedural phase.
2.2.3. Additional Clinical Activity
In addition to scheduled outpatient procedures, the analysis considered the impact of non-programmed endoscopic activity. Urgent endoscopies were increasingly performed during regular morning shifts, with a mean of 2.3 urgent procedures per day and up to three on Mondays. These examinations typically required longer procedural times due to patient instability, the need for anaesthesiology assessment, increased inspection and therapeutic complexity, and occasional transfer to intensive care units, resulting in prolonged endoscopist unavailability. Additional time associated with therapeutic routines during screening or planned procedures was not recorded, although such routines occur in approximately 30% of screening procedures and may increase procedure duration by up to 15 min [
19].
Endoscopic procedures in hospitalised patients were also considered. Although specific time slots were formally reserved for inpatients, these were frequently subject to scheduling pressure, limiting their availability for last-minute requests.
2.3. Organizational Characterization of the Endoscopy Unit
A structural and operational characterisation of the Digestive Endoscopy Unit was performed to establish baseline conditions prior to workflow optimisation.
Operational data were obtained through a combination of the hospital’s internal management information system, direct on-site observation, and semi-structured interviews with department coordinators. The dataset included detailed information on the number of endoscopy rooms, daily and weekly operating hours, and categorised procedure types with their corresponding average durations. The operating schedule and theoretical weekly capacity per endoscopy room are summarised in
Table 1. Complementary organisational and qualitative data—such as staff composition, room assignments, and session scheduling—were provided by the unit’s management team and validated through direct observation of routine clinical activity. This mixed-methods approach enabled a comprehensive understanding of formal planning structures and real-world operational dynamics within the Endoscopy Unit.
2.4. Data Input Preparation and Statistical Analysis
2.4.1. Descriptive Data Analysis of Real Program Dataset
This section outlines the data preparation and statistical framework used to characterise endoscopy scheduling patterns. To ensure a direct, like-for-like comparison, the same analytical pipeline was applied to both the baseline observed records (isDataInputSet = true) and the post-optimisation output generated by the MILP model (isDataInputSet = false). Descriptive statistics, including mean and median values for continuous variables, were employed to characterise procedural time requirements and workflow patterns. No inferential analysis was performed.
2.4.2. Data Preparation and Harmonization
A two-stage workflow was implemented to assess operational improvements. The Observed Scheduling Dataset was retrieved from the hospital information system, containing anonymised records with variables such as procedure date (DATE), start time (TIME), room identifier (ROOM_CODE), and procedure description (PROCEDURE). The Simulated Scheduling Dataset, generated by the MILP optimisation, was exported in CSV format and included planned start and end times (TIME, HORA_FI), assigned room (ROOM), procedure type (PROCEDURE_TYPE), and clinical priority (PRIORITY).
2.4.3. Clinical and Operational Variable Construction
Room Mapping and Standardization. Original room codes were mapped to standardised physical rooms (SALA_FIS) using a deterministic mapping summarised in
Table 2. When a room code did not match any predefined category, the normalised original identifier was preserved.
Procedure Type Classification. Procedure types were classified according to the deterministic rules summarised in
Table 3. For simulated schedules, procedure type was directly inherited from the optimisation output when available.
Priority Classification. Procedure priority was assigned using the rule-based mapping reported in
Table 4. For simulated schedules, priority labels were directly inherited from the MILP output when available.
2.4.4. Time Handling and Derived Temporal Metrics
Procedure End Time Estimation and Idle Time Computation. For observed scheduling data extracted from the hospital information system, explicit procedure end times were unavailable. A nominal procedure duration (PROC_DUR) was therefore assigned according to procedure type: 60 min for colonoscopy, 30 min for gastroscopy, and 60 min for other procedures. Estimated procedure end times were computed as the sum of the procedure start time and PROC_DUR.
Procedures were ordered chronologically within each standardised physical room, and the start time of the subsequent procedure (NextDateTime) was identified. Temporal differences between consecutive procedures were computed, together with an indicator specifying whether both procedures occurred on the same calendar day.
When consecutive procedures occurred on the same day, inter-procedure idle time was estimated using two complementary approaches: (i) the difference between the start time of the next procedure and the estimated end time based on PROC_DUR, and (ii) the difference between the start times of consecutive procedures. This dual strategy enabled the identification of inconsistencies between nominal duration-based estimates and observed scheduling sequences.
When the subsequent procedure occurred on a different calendar day, the end time was defined exclusively by the nominal duration-based estimate, and overnight gaps were excluded from idle time calculations. This process also allowed the identification of procedures starting or ending outside standard operating hours, as well as cases in which estimated end times overlapped with the start of subsequent procedures.
2.4.5. Preparation of Procedural Demand Dataset
Procedural activity data were processed in MATLAB®. Procedure dates were converted to datetime format and normalised to day-level resolution. Records with invalid or missing dates were excluded. Procedure type, clinical priority, and physical room variables were harmonised using predefined translation rules. Colonoscopy and gastroscopy procedures were explicitly identified, and priority categories were standardised prior to aggregation. These preprocessing steps yielded a cleaned and structured dataset used for all subsequent spatial, temporal, and priority-based analyses.
2.5. The MILP Optimisation Model and the MILP-Based Scheduling Process
This subsection describes the endoscopy scheduling problem modelled as a multi-objective mixed-integer linear programming (MILP) problem and the loop-based control structure governing the execution of the MILP execution. The complete matrix formulation required for the MATLAB
® implementation is provided in the
Appendix A.
The elective endoscopy scheduling problem is defined by: (i) a set of elective procedures, each characterised by an estimated duration; (ii) a discrete planning horizon defined by the selected days (days_selection); (iii) a set of operating rooms with finite daily capacity discretised into fixed-length time slots of minutes; and (iv) a set of pre-existing reservations and simulated capacity blocking, that reduce effective availability prior to each MILP execution.
2.5.1. Modeling of Non-Elective Demand Through Capacity Blocking
To emulate realistic operating conditions, the scheduling framework incorporates day-dependent capacity blocking to represent the expected impact of urgent and inpatient procedures that arise dynamically during execution and are unknown at planning time. Blocking patterns were defined based on direct operational observations provided by the Endoscopy Department and were corroborated by statistical analyses of historical activity. These analyses consistently indicated higher urgent-demand pressure at the beginning of the week, particularly on Mondays.
In practice, fixed amounts of time are reserved in each room for urgent or inpatient demand according to the weekday-dependent blocking scheme reported in
Table 5. Blocking is enforced at the time-slot level: slots that are reserved are declared unavailable for elective procedures, rather than subtracting minutes from a nominal day-level capacity outside the optimisation. The corresponding binary availability profile is introduced in the model notation (
Section 2.5.2) and is used in the constraints (
Section 2.5.5) to ensure that elective procedures can neither start in nor overlap reserved slots.
Urgent and inpatient procedures are explicitly identified in the dataset but are excluded from the elective scheduling optimisation, as they are assumed to be unknown at planning time. Their operational impact is therefore incorporated indirectly through the capacity blocking mechanism described above. The higher blocked capacity for urgent procedures on Mondays reflects qualitative operational experience and quantitative evidence from historical data, suggesting a significantly higher incidence of urgent cases compared with other weekdays.
Procedures classified as “Other” are also excluded from the MILP formulation. These procedures are assumed to be performed in a dedicated multifunction (MF) room that, according to capacity analysis, can absorb this workload without interfering with elective scheduling in standard endoscopy rooms.
By reserving capacity ex ante through a weekday-dependent slot-level availability profile, the proposed approach improves the robustness of the elective schedule to non-elective demand without increasing the dimensionality or complexity of the optimisation model.
2.5.2. Definition of Sets and Parameters
Let be the set of elective procedures to be scheduled, the set of available endoscopy rooms, and the set of discrete time slots. The time horizon is discretized into slots of duration min.
The input parameters are defined as follows:
: Duration of procedure i (in minutes).
: Number of time slots required for procedure i, where .
: set of feasible start slots for procedure
i, defined as
: availability of room k at time slot t (1 if available for elective activity; 0 if blocked/reserved).
: Total available capacity (in minutes) for room
k over the planning horizon,
: Target workload mean (in minutes) per room to achieve perfect balancing, defined as:
2.5.3. Decision Variables
The model employs the following combination of binary variables for scheduling and continuous auxiliary variables for resource management.
Binary Scheduling Variable: Continuous Auxiliary Variables (for each room ):
: Total utilisation time (minutes).
: Total idle time (minutes).
: Absolute deviation of the room’s workload from the target mean .
2.5.4. Objective Function
The objective function
Z minimises a weighted sum of three distinct cost components: punctuality cost (
), idle time inefficiency (
), and workload imbalance (
).
where the components are defined as:
The weights , , and are adjustable parameters allowing the planner to prioritise specific operational goals.
2.5.5. Constraints
The feasible region is defined by the following constraints:
- 1.
Procedure Assignment: Each procedure must be assigned to exactly one room and one start time.
- 2.
Room Capacity and Non-Overlap: At any time slot
t in room
k, at most one procedure can be active. This accounts for the duration
of the procedures.
- 3.
Availability Blocking (no-spill): Procedures cannot be scheduled to overlap slots reserved for emergencies or hospitalised patients (
). Notice that to ensure feasibility within the discretized horizon, start times are restricted to
, so that each scheduled procedure fits entirely within
T.
- 4.
Workload Definition: The total utilisation
is the sum of the durations of assigned procedures.
- 5.
Capacity Balance: The total capacity of a room is partitioned into utilisation and idle time.
- 6.
Linearisation of Workload Imbalance: To minimise the absolute deviation
which is constrained by two linear inequalities:
Notice that the MILP algorithm is solved using MATLAB
® by the intlinprog [
16] solver, which utilises a branch-and-cut algorithm and is based on the HiGHS 1.7.1 open-source software.
Appendix A provides the matrix-vector formulation required for intlinprog.
2.5.6. Iterative MILP-Based Scheduling Framework and Final Schedule Reconstruction
The scheduling process is implemented as an iterative optimisation framework consisting of an outer MILP loop and an inner slot-assignment loop. In the outer loop, the MILP is repeatedly solved using the current set of unscheduled elective procedures and the remaining available capacity across days and rooms. At each iteration, the model selects a subset of procedures whose total duration fits within the prevailing capacity constraints. This iterative strategy reduces computational burden and improves numerical stability compared with a single large-scale MILP formulation that encompasses all procedures simultaneously, while closely emulating real-world appointment scheduling. Following each MILP execution, an inner processing loop assigns the selected procedures to specific dayroom time slots and updates the remaining capacity accordingly. Assigned procedures are removed from the unscheduled pool. A non-recoverable slot policy is applied, whereby partially unused slot time is not reintroduced in subsequent iterations. After termination of the iterative process, the final schedule is reconstructed by combining: (i) elective procedure assignments generated across successive MILP executions; (ii) original reservation data; and (iii) remaining unused capacity. The resulting schedule provides a complete representation of resource utilisation across operating rooms and planning days.
2.6. Statistical Review of the MILP Scheduling Results—Statistical Analysis of Scheduling Data and Post-Optimisation Outcome
After solving the MILP model, two output datasets were generated and used as the basis for the subsequent statistical analyses. The first dataset corresponds to the optimised schedule produced by the MILP and includes all procedures assigned to rooms and time slots. In addition to scheduled procedures, this dataset explicitly identifies two categories of non-procedural time slots: Reserved_slots and Not_used_slots. Reserved slots represent capacity intentionally kept available to accommodate urgent and inpatient procedures, according to the organisational assumptions defined in the model. Not_used_slots correspond to idle capacity that the MILP does not allocate to any procedure due to demand–capacity imbalance or scheduling constraints. The second dataset includes procedures excluded from the MILP optimisation, namely urgent and inpatient cases. These procedures are not scheduled ex ante, as their occurrence cannot be anticipated at the planning phase. For analytical purposes, this dataset records that these procedures are performed in Rooms 1–4, reflecting current operational practice. Two complementary analytical strategies were defined based on these outputs. The first strategy evaluates planning feasibility and schedule adequacy using only the MILP scheduling dataset, explicitly accounting for Reserved_slots and Not_used_slots. This approach focuses on assessing capacity utilisation, idle time generation, and the alignment between planned demand and available resources. The second strategy approximates real operational conditions by merging both datasets. In this integrated scenario, Reserved_slots and Not_used_slots are removed from the optimised schedule and replaced by urgent and inpatient procedures. This combined dataset simulates actual daily operations and enables the assessment of the robustness of the MILP-based plan under unplanned demand.
2.6.1. Temporal Range Consistency Between the Original and Programmed Appointment Sets
To verify that the MILP output preserves a coherent planning horizon relative to historical demand, the first and last appointment timestamps were computed for both the original and the programmed datasets. The analysis excludes non-clinical slots (i.e., NOT_USED and reserved blocks) by filtering out rows whose PROCEDURE_TYPE [Tipo_Prueba] corresponds to NOT_USED or RESERVED. For the remaining valid procedures, the minimum and maximum values of ORG_DATE [FECHA_ORG](original date) and DATE [FECHA](Scheduled date) using omitnat to ignore missing timestamps. The resulting two-by-two summary table (First Date/Last Date versus Original/Scheduled) was exported for reporting and LaTeX integration.
2.6.2. Temporal Shift Analysis Between Original and Programmed Appointments
To assess whether the MILP-based scheduling process introduces systematic advances or delays relative to the original planned dates, a temporal shift analysis was performed at the procedure level. For each scheduled procedure, the difference between the programmed appointment date (DATE) and the original appointment date (ORG_DATE) was computed in days. Positive values indicate delays relative to the original date, whereas negative values correspond to advanced scheduling. The analysis was restricted to clinically valid procedures, excluding rows corresponding to non-operational slots such as NOT_USED blocks and reserved capacity for contingencies, using the same filtering criteria applied in the temporal range consistency check. Missing or undefined dates were ignored to avoid distortions in the distribution of temporal shifts. The resulting time differences were then summarised using descriptive statistics and empirical distributions to characterise the magnitude and direction of scheduling adjustments introduced by the optimisation model. This approach quantifies how the MILP redistributes demand within the planning horizon, distinguishing between minor rescheduling effects and structurally relevant temporal displacements.
2.7. Computational Setup and Reproducibility
All computational experiments were conducted in two environments, a local workstation and the MATLAB Online environment, in order to assess consistency and reproducibility across execution platforms. The local environment ran Windows 11 Pro (version 25H2, OS build 26200.7623) on a 64-bit system equipped with an AMD Ryzen 7 4700U processor (2.00 GHz) and 8 GB of RAM, using MATLAB R2025b Update 1 (25.2.0.3042426). In parallel, selected simulations were replicated using MATLAB Online, running MATLAB R2025b Update 3 (25.2.0.3123380) on a cloud-based infrastructure typically providing multiple virtual CPUs and approximately 16 GB of memory, with temporary storage available through MATLAB Drive. This environment is managed by MathWorks and does not expose fixed hardware specifications. No material differences in model behaviour or results were observed between the two environments. For all experiments, the mixed-integer linear programming model was solved using the MATLAB solver intlinprog with default optimisation settings, as documented in Matlab Help Center [
22]. No explicit time limit or target relative MIP gap was imposed, and the solver was allowed to terminate according to its default convergence criteria. Heuristics and cut generation were not explicitly configured. The solution process is deterministic, and therefore no random seeds were required to ensure reproducibility. Solver progress information was enabled through iterative display output.
To support transparency and reproducibility, the complete source code, an anonymised input data schema, and all scripts required to regenerate the reported tables and figures are publicly available in a dedicated repository at [
https://github.com/lllunas-lab/DataDrivenEndoscopyDepartmentResourcesOptimization-STATS (accessed on 3 February 2026)]. The repository includes detailed instructions to reproduce the computational environment and rerun all experiments.
Reproducibility and execution tracing. For each simulation loop, all parameters defining the corresponding optimisation scenario were systematically recorded prior to model execution. These records were linked to the solver execution logs, which include termination status, objective value, optimality metrics, and execution time (see
Supplementary Materials). This dual logging strategy ensures full traceability between scenario configuration, optimisation execution, and reported results, enabling exact regeneration of all experiments.
4. Discussion
4.1. Structural Mismatch Between Real Procedure Times and Standard Scheduling
The results consistently show that the actual time required for colonoscopy and gastroscopy exceeds the time allocated in routine scheduling agendas. This mismatch is not occasional but structural, as it remains stable across months and across rooms. Underestimation generates production pressure, staff overload, and artificial overlaps in daily schedules. This bias explains the recurrent operational tensions reported by the service even in the absence of an apparent excess of demand, and highlights the need to revise the temporal criteria used in the design of clinical agendas so that they better reflect the real care pathway. Importantly, the optimisation does not introduce significant scheduling delays, despite adjusting procedure durations to empirically derived values that are substantially longer than those used in routine hospital agendas. These adjusted times are supported by observed data and published meta-analyses, and reflect more realistic clinical practice (see
Table 6). The results indicate that incorporating realistic procedure durations does not inherently compromise system performance, but rather highlights the role of scheduling design in accommodating accurate time estimations.
4.2. Paradoxical Coexistence of Inefficiencies: Idle Time and Capacity Shortage
A detailed analysis reveals that the service simultaneously experiences inter-procedure idle time and near-daily capacity shortage. This coexistence indicates that inefficiency is not driven by resource scarcity, but by a suboptimal temporal and spatial distribution of workload. Persistent differences across rooms suggest that scheduling templates and organisational routines play a key role in generating these patterns. Considering idle time or shortage in isolation may lead to misleading conclusions; only an integrated analysis allows an accurate characterisation of the system’s real performance.
4.3. Impact of Non-Schedulable Activity (Urgent and Inpatient Procedures)
The results show that urgent and inpatient activity represents a quantitatively relevant workload, averaging approximately 4.5 h per working day, with clear weekly variability and multiple days exceeding the capacity reserved in the baseline model. These findings indicate that non-schedulable activity constitutes a structural constraint rather than a marginal phenomenon. Explicitly incorporating this demand through capacity-reservation mechanisms, such as the capacity-blocking approach implemented in the MILP, improves schedule robustness and reduces the need for reactive adjustments that destabilise agendas. The MILP framework enables explicit protection of capacity reserved for urgent and inpatient procedures without introducing delays in elective scheduling. In contrast, the real scheduling practice analysed did not incorporate predefined capacity reservations, leading to systematic overbooking when urgent or inpatient cases occurred. By allocating protected time ex ante, the optimisation model absorbs non-schedulable demand in a structured manner, avoiding cascading delays and schedule disruption while preserving planned activity.
4.4. Added Value of the MILP Model Compared with Routine Practice
The MILP-based optimisation eliminates artificial overlaps, improves workload balance across rooms, increases average utilisation (from approximately 79% to 94%), and produces a more predictable and bounded shortage pattern. In contrast to real-world agendas that may appear highly productive while concealing unsustainable overload, the MILP provides a realistic and operationally feasible representation of the system. Importantly, the observed improvement does not result from additional resources, but from a more coherent allocation aligned with real operational constraints, allowing previously latent capacity to be identified and exploited.
4.5. Implications for Quality of Care and Professional Well-Being
Underestimation of procedure times and sustained production pressure are well-documented factors associated with endoscopist fatigue, deterioration of quality indicators, and increased risk to patient safety. In this context, scheduling approaches grounded in real-world data and realistic temporal assumptions may contribute not only to improved efficiency, but also to higher-quality and more sustainable clinical practice, with potential benefits for both patient care and professional well-being.
4.6. Operational Stability and Reduction of Reactive Rescheduling
Analysis of routine practice shows that insufficiently robust temporal planning often forces real-time reorganisation of agendas to absorb delays, urgent cases, or deviations in procedure duration. This reactive approach increases operational instability, complicates team coordination, and raises cognitive workload for healthcare professionals. By contrast, MILP-based planning reduces the need for continuous manual intervention by providing a more stable agenda structure with explicit constraints and realistic temporal buffers. Improved system governability thus emerges as an additional benefit of the optimisation framework beyond quantitative efficiency gains.
Spatial Distribution of Urgent Workload and Bottleneck Mitigation
Results show that shortage time in MILP-optimised scenarios is mainly concentrated in rooms without specific reserved time for urgent or non-schedulable activity. Concentrating urgent workload in a limited number of rooms increases the risk of bottlenecks on high-demand days, as delays accumulate within a single queue. A more homogeneous spatial distribution of urgent activity could dilute these delays across rooms and reduce accumulated delay per room.
4.7. Considerations on the Use of the MILP and Block-Based Scheduling
As discussed in
Section 4.3, these findings suggest that part of the observed NOT_USED capacity arises from structural ingestion constraints rather than from intrinsic resource scarcity. Future work could therefore explore enhanced ingestion strategies, such as limited procedure reordering or flexible slot aggregation, to reduce systematic residual gaps while preserving clinical and operational constraints. In addition, further simulation studies could assess the impact of alternative behavioural assumptions embedded in the MILP formulation—such as reordering tolerance, priority relaxation, or adaptive block sizing—on schedule robustness, idle time generation, and end-of-day overruns.
Scheduling was performed using blocks of incoming requests, enabling effective local optimisation of idle time. However, treating blocks as independent entities prevents residual idle capacity from being reused across blocks. Future work should explore continuous or rolling-horizon planning strategies. In addition, the current formulation focuses on resource constraints rather than explicit clinical prioritisation.
Results suggest that during periods of lower clinical workload pressure, the MILP can generate scheduling advances by exploiting available capacity. Analysing seasonal demand patterns using larger datasets could allow proactive advancement of high-priority procedures.
4.8. Strengths and Limitations
Several limitations should be acknowledged. This is a single-centre study focusing on a specific subset of scheduling agendas within one service, which may limit the generalisability of the findings to other departments or organisational contexts.
The analysis relies on planning-level scheduling data and does not incorporate execution-level information. Consequently, deviations between planned and actual execution cannot be explicitly modelled, including intra-day procedure overlaps, staff absences, variability in procedure duration, or patient no-shows. In clinical practice, overlaps usually result in delays rather than cancellations, and no-shows may partially offset these delays; however, such dynamics are not represented in the dataset. Information on staff substitution strategies, material availability, and equipment reprocessing constraints was not available. Room cleaning and sterilisation activities are embedded within post-procedure tasks and do not introduce additional time beyond the post-processing intervals considered.
The study covers a six-month period, which does not allow the analysis of seasonal demand patterns or calendar-related constraints, such as holiday periods, that may substantially affect resource availability and protected capacity requirements. This limited temporal scope also restricts systematic sensitivity analyses of reserve levels.
Objective function weights were fixed to reflect the most restrictive operational policy, preventing both procedure overlaps and operating-time extensions. While this configuration represents the organisation’s desired target scenario and produced operationally satisfactory schedules, no sensitivity analysis of alternative weight settings was conducted. Exploring trade-offs under different policy assumptions is therefore left for future research using larger datasets, longer time horizons, or different services.
Computational results were obtained using MATLAB’s intlinprog solver with default optimisation settings, without explicit time limits or target relative MIP gaps, and without customising heuristics or cut generation. While this ensures transparency and reproducibility, it limits the depth of benchmarking across alternative solver configurations or stopping criteria.
Finally, uncertainty is not explicitly modelled within the MILP formulation but is indirectly addressed through capacity reservations. These limitations motivate future research aimed at extending the temporal scope of the data, refining service characterisation, and enhancing model robustness.
Despite these limitations, this study is based on real, prospectively collected operational data and provides a quantitative characterisation of the actual functioning of a digestive endoscopy unit. A key strength lies in the consistency between the patterns identified through data analysis and the operational constraints and inefficiencies reported by the clinical team, supporting the external validity of the findings. Moreover, despite being a preliminary optimisation study, the proposed MILP framework yields relevant and actionable results, highlighting its potential as a practical decision-support tool with significant room for further development and refinement.