Next Article in Journal
Digital Twin Framework for Cutterhead Design and Assembly Process Simulation Optimization for TBM
Previous Article in Journal
Sodium Hydroxide-Activated Persulfate Remediation of Sites Contaminated with Moderate Concentrations of Aniline and Analysis of the Microbial Community Characteristics
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Data-Driven Optimisation of Endoscopy Department Resources Through Statistical Analysis and Mixed-Integer Linear Programming

by
Laia Llunas-Mestres
1,2,
Francesca L. Aguilar Paredes
3,
Luis Barranco-Priego
3,
Miguel Pantaleón Sánchez
3,
Pere Marti-Puig
1,* and
Jordi Cusido
4
1
Engineering Department, Universitat de Vic–Universitat Central de Catalunya (UVic-UCC), 08500 Vic, Spain
2
Hospital del Mar Research Institute, 08003 Barcelona, Spain
3
Hospital del Mar, 08003 Barcelona, Spain
4
Projects and Construction Department, Universitat Politècnica de Catalunya (UPC), 08034 Barcelona, Spain
*
Author to whom correspondence should be addressed.
Appl. Sci. 2026, 16(4), 1864; https://doi.org/10.3390/app16041864
Submission received: 11 January 2026 / Revised: 3 February 2026 / Accepted: 4 February 2026 / Published: 13 February 2026
(This article belongs to the Section Computing and Artificial Intelligence)

Abstract

The efficient use of resources represents a critical challenge for public healthcare systems facing increasing demand. In this study, an operational analysis was conducted at Hospital del Mar (Barcelona) to demonstrate that persistent bottlenecks and capacity deficits are primarily organizational and not only quantitative. Through a prospective observational study and exploratory data analysis (EDA), it was identified that high apparent workloads often coexist with structural inefficiencies, particularly regarding the unpredictable demand of urgent and inpatient procedures. To address these gaps, a Mixed-Integer Linear Programming (MILP) model was implemented to optimize spatial and temporal resource allocation. Unlike reactive scheduling, this data-driven approach explicitly incorporates capacity reserves for non-programmable activities and ensures realistic time slots without increasing physical or human resources. It is shown that MILP-optimized scheduling significantly balances workload, eliminates artificial overlaps, and improves room utilization—reaching rates of 99.5%. The findings highlight that temporal agenda design constitutes a critical, yet underutilized, lever for hospital management. A scalable tool for evidence-based decision-making is provided by this framework, allowing for a clear distinction between apparent productivity and real efficiency. The proposed model is considered highly transferable to other clinical settings facing similar operational constraints.

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 I = { 1 , , n P } be the set of elective procedures to be scheduled, K = { 1 , , n R } the set of available endoscopy rooms, and T = { 1 , , n T } the set of discrete time slots. The time horizon is discretized into slots of duration Δ = 15 min.
The input parameters are defined as follows:
  • d i : Duration of procedure i (in minutes).
  • θ i : Number of time slots required for procedure i, where θ i = d i / Δ .
  • T i T : set of feasible start slots for procedure i, defined as
    T i = { 1 , 2 , , n T θ i + 1 } .
  • A k , t { 0 , 1 } : availability of room k at time slot t (1 if available for elective activity; 0 if blocked/reserved).
  • c a p k : Total available capacity (in minutes) for room k over the planning horizon,
    cap k = Δ t T A k , t .
  • μ : Target workload mean (in minutes) per room to achieve perfect balancing, defined as:
    μ = min 1 n R i I d i , 1 n R k K cap k .

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:
x i , k , t = 1 if procedure i starts in room k at time slot t 0 otherwise
Continuous Auxiliary Variables (for each room k K ):
  • u k R 0 : Total utilisation time (minutes).
  • o k R 0 : Total idle time (minutes).
  • δ k R 0 : 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 ( Z t i m e ), idle time inefficiency ( Z i d l e ), and workload imbalance ( Z b a l ).
Minimize Z = w t i m e · Z t i m e + w i d l e · Z i d l e + w b a l · Z b a l
where the components are defined as:
Z t i m e = t T i k K i I C t · x i , k , t where C t = ( t 1 ) Δ
Z i d l e = k K o k
Z b a l = k K δ k
The weights w t i m e , w i d l e , and w b a l 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.
k K t T i x i , k , t = 1 , i I
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 θ i of the procedures.
i I τ = max ( 1 , t θ i + 1 ) t x i , k , τ 1 , k K , t T .
3.
Availability Blocking (no-spill): Procedures cannot be scheduled to overlap slots reserved for emergencies or hospitalised patients ( A k , t = 0 ). Notice that to ensure feasibility within the discretized horizon, start times are restricted to t T i , so that each scheduled procedure fits entirely within T.
i I t T i : τ [ t , t + θ i 1 ] x i , k , t A k , τ , k K , τ T .
4.
Workload Definition: The total utilisation u k is the sum of the durations of assigned procedures.
u k = i I t T i d i · x i , k , t , k K
5.
Capacity Balance: The total capacity of a room is partitioned into utilisation and idle time.
u k + o k = cap k , k K .
6.
Linearisation of Workload Imbalance: To minimise the absolute deviation | u k μ | δ k which is constrained by two linear inequalities:
u k μ δ k , k K
μ u k δ k , k K
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.

3. Results

Unless otherwise stated, the results presented in this section refer to the full observation period from February to July 2024 (Input Data Set), with data aggregated according to the grouping criteria specified in each figure and table. The results presented in this section are based on descriptive analyses of observed and simulated scheduling data. Differences between scenarios are reported in absolute and relative terms and should be interpreted as operational effects rather than estimates of statistical significance.

3.1. Procedure Time Requirements and Operational Factors

Empirical analysis showed that the actual time required for both colonoscopy and gastroscopy consistently exceeded the time slots typically allocated in routine scheduling. Colonoscopy required a total mean time of 57.2 min when all phases were considered, compared with the 30–40 min typically assigned, mainly due to longer pre- and post-procedural phases and the frequent need for therapeutic interventions. Gastroscopy required a total mean time of 29.5 min, exceeding the standard 20-min allocation.
Operational workload was further affected by non-elective activity. An average of 2.3 urgent endoscopic procedures per day was observed, with higher pressure at the beginning of the week. Urgent and inpatient procedures were associated with longer and less predictable durations, occasionally resulting in prolonged endoscopist unavailability despite formal reservation of time slots.
The results obtained from this analysis are presented in Table 6. Taken together, these findings highlight a systematic mismatch between real procedural time requirements, non-elective demand, and current scheduling assumptions. This mismatch is directly addressed in the proposed optimisation framework and further discussed in Section 4.

3.2. Statistical Analysis of Scheduling of the Input Data Set

3.2.1. Spatial and Priority-Based Characterization of Procedural Demand

Figure 1a shows the total number of procedures performed in each room. Procedural activity is relatively balanced across the main endoscopy rooms, whereas the multifunction room accounts for a smaller share of the overall workload. The global distribution of activity by procedure type is reported in Figure 1b. Colonoscopy represents the largest proportion of procedures, followed by gastroscopy, while other procedures contribute marginally.
The joint distribution of procedure type and physical room is illustrated in Figure 2a. The observed differences across rooms indicate heterogeneous functional use, with certain rooms showing a higher degree of procedure-specific specialisation. The distribution of procedures by clinical priority is presented in Figure 2b. Standard and screening procedures dominate overall activity, whereas urgent and inpatient cases represent a smaller fraction of the total workload.
Room-level priority distributions for colonoscopy and gastroscopy are shown in Figure 3a and Figure 3b, respectively. For colonoscopy, procedures are mainly concentrated in the primary endoscopy rooms and predominantly correspond to standard and screening priorities. In contrast, gastroscopy exhibits a relatively higher proportion of urgent procedures in specific rooms, highlighting differences in priority profiles between procedure types.
Monthly procedure volume by room and procedure type. Figure 4 illustrates the monthly distribution of procedures by type across Rooms 1–4 and the multifunction room (MFR). Although the relative procedure mix within each room remains stable over time, the total monthly volume shows clear irregularity, indicating non-uniform temporal demand. Rooms 1 and 2 are consistently dominated by colonoscopy, whereas Room 3 presents a more heterogeneous mix and higher variability. Room 4 maintains a balanced distribution between gastroscopy and colonoscopy. The MFR operates at lower volumes but also shows month-to-month variation and mainly accommodates procedures classified as Other. Overall, these results are consistent with temporal variability in procedural demand, potentially associated with seasonal effects, which should be considered when interpreting occupancy and planning analyses.
Figure 5 highlights moderate month-to-month variability in scheduled demand, with total procedure counts ranging from 982 in March 2024 to 1119 in May 2024. Across all months, colonoscopy volume consistently exceeds gastroscopy volume (approximately 513–611 vs. 413–508 procedures, respectively). Both series follow a similar temporal pattern characterised by a peak in April–May, a decline in June, and a partial rebound in July.
Hourly distribution by room. Figure 6 shows the average number of procedures performed per hour of the day, stratified by physical room and procedure category. Across all rooms, procedural activity is concentrated within standard working hours, with no relevant activity observed outside daytime schedule. Colonoscopy and gastroscopy exhibit relatively stable intraday profiles, with moderate fluctuations and peak values typically occurring during mid-morning and early afternoon hours. Room 4 displays the highest hourly volumes across most time slots, reflecting its higher overall procedural intensity compared to the other rooms. In contrast, the multifunction room presents a distinct pattern, with activity limited to specific morning hours and predominantly associated with procedures classified as Other, consistent with its specialised use. Urgent procedures show low average hourly volumes and an irregular temporal distribution across rooms, without a clear alignment with elective scheduling patterns.
Summary of operating schedule analysis. Average daily start and end times were computed by aggregating room-level schedules by weekday, while effective operating durations were from these start and end times to ensure consistency. As shown in Table 7, opening times remain highly stable throughout the week, centred around 09:00. In contrast, average closing times systematically extend beyond the nominal schedule, typically by one to two hours, with end times frequently approaching 22:00 on weekdays. These results indicate a structural extension of daily operations and reveal capacity slack within regular operating hours.
Mean working hours per room (Monday–Friday). Mean weekday operating hours by room, reported in Figure 7, reveal clear room-level differences. Rooms 1, 2, and 4 operate for close to a full working day (9.67, 9.56, and 9.45 h, respectively), whereas Room 3 exhibits a shorter mean operating time (8.11 h). The multifunction room exhibits substantially lower mean operating hours (2.55 h), reinforcing its auxiliary role rather than that of a full-capacity endoscopy room. The pooled mean operating time for Rooms 1–4 is 9.20 h.
Despite the extension of the daily working schedule, as illustrated in Figure 7, the fact that total operating hours remain substantially lower indicates the presence of systematic idle periods within the nominal working window. For Rooms 1–4, the pooled mean operating time is 9.20 h per weekday, indicating that a considerable fraction of the available schedule window is not effectively utilized. In other words, rooms are available over an extended time span but are not continuously in use throughout this interval. This gap between schedule extension and effective utilisation suggests recurring time slots, revealing inefficiencies in workload allocation rather than binding capacity constraints driven solely by opening hours.
Weekly schedule visualisation. Figure 8 illustrates a structured weekday schedule with two main daily blocks on Monday–Thursday separated by a short mid-afternoon gap, whereas Friday concentrates activity into a single morning-to-early-afternoon block. Across rooms, gastroscopy occupies a substantial fraction of late-day activity, while Other procedures appear more frequently in earlier blocks and within the multifunction room.
Mean Time Between Procedures Analysis. Figure 9a shows the average time between consecutive procedures across rooms. Mean inter-procedure time was broadly similar in Rooms 1, 2, 4, and the multifunction room (approximately 33–35 min), whereas Room 3 exhibited a noticeably higher mean interval of 41.1 min, corresponding to an increase of about 6–8 min relative to the other rooms indicating a longer turnover time or larger scheduling gaps in that room.
A more detailed breakdown by procedure type is presented in Figure 9b. Intervals for colonoscopy and gastroscopy were generally comparable across rooms and mostly within the 22–36 min range, with the lowest value observed for gastroscopy in Room 3 (21.8 min). Procedures classified as “Other” presented greater variability, with particularly long intervals in Room 3 (62.8 min) and elevated values in Room 2 (39.6 min). The multifunction room consistently exhibited shorter inter-procedure intervals, especially for gastroscopy (24.2 min), reflecting its distinct operational role.

3.2.2. Assessment of Inter-Procedure Idle Time, Scheduling Shortage, and Out-of-Timetable Activity: Idle Time and Scheduling Shortage Analysis

Scheduling shortage. Figure 20a reports the total number of shortage minutes aggregated at the monthly level. The results show that shortage is present in all analysed months, with comparable magnitudes across the study period. Although some month-to-month variability is observed, the overall level of accumulated shortage remains consistently high, consistent with persistent underscheduling pressure rather than isolated temporal anomalies. Figure 18a shows that total monthly shortage in the input dataset ranges from 348 to 415 h, with no month falling below 340 h, indicating a persistently high level of accumulated overlap rather than isolated temporal anomalies.
The analysis reveals that capacity shortage was observed on 95.2% of working days in February and on 100% of working days from March to July in the input dataset, indicating that overlap-related shortages constitute a near-daily operational condition, as shown in Table 12.
Distribution of inter-procedure idle timeFigure 10 depicts the mean idle time between procedures per room and month. Figure 11 depicts the distribution of inter-procedure idle time gaps stratified by room and weekday. The results highlight distinct weekday patterns, with variability across rooms. While some rooms show relatively homogeneous distributions across weekdays, others exhibit marked differences, suggesting that weekly scheduling structures are not uniform across rooms.
Global distribution of idle time. Figure 12a The global distribution of idle times exhibits a pronounced right-skewed pattern, with the majority of observations concentrated below approximately 20–30 min. A long right tail is observed, with 25% of idle periods exceeding the third quartile (P75), indicating that a non-negligible proportion of idle times reach moderate to long durations. The median (P50) is shifted to the right of the main peak, indicating that a non-negligible proportion of idle periods have moderate durations. Furthermore, the relatively high third quartile (P75) highlights that 25% of idle times are prolonged, suggesting potential inefficiencies in resource utilisation. For clarity and readability, idle times exceeding 200 min are not displayed in the figure, although they are fully included in the statistical analysis.
Figure 12b presents room-specific histograms of inter-procedure idle time gaps. Distinct distributional profiles are observed across rooms. While Rooms 1, 2, and 4 exhibit relatively compact idle-time distributions centred around similar median values, Room 3 shows a broader spread with higher upper quartiles, reflecting longer and more variable inter-procedure gaps. Overall, all rooms exhibit a dominant mass at positive gap values. However, the spread and shape of the distributions differ, with some rooms showing tighter clustering around the median and others displaying broader variability. These differences indicate heterogeneous room-level scheduling structures.
Working-Day–Normalized Analysis of Urgent and Inpatient Endoscopic Activity
During the study period (February–July 2024), 683 non-schedulable endoscopic procedures were recorded, corresponding to urgent and inpatient cases occurring stochastically over time. As these procedures cannot be deterministically planned within the MILP framework, their impact can only be incorporated through capacity reservations expressed in available hours.
Overall activity stratified by clinical priority is summarised in Table 8. Inpatient procedures accounted for the larger share of non-programmable workload (424 procedures) compared with urgent procedures (259 procedures). When normalised by working days, inpatient activity corresponded to 3.34 procedures and 2.46 h per working day, whereas urgent activity reached 2.04 procedures and 2.04 h per working day, defining the baseline capacity that must be continuously reserved to absorb stochastic demand. These figures are consistent with the results of the field study described in Section 3.1, which reported an average of 2.3 urgent procedures per day, increasing to 3 procedures on Mondays, based on a 2-weeks observational analysis.
Monthly aggregated workload (Table 9) ranged from 3.82 to 5.15 h per working day, with the highest value in March 2024 and the lowest in May 2024, highlighting temporal variability that cannot be anticipated at the individual procedure level. Stratification by procedure type and priority (Table 10) showed that urgent colonoscopy generated the highest mean workload (2.07 h per working day) with moderate month-to-month variability (CV ≈ 0.16), whereas inpatient colonoscopy and inpatient gastroscopy exhibited lower and more stable workloads. No urgent gastroscopy procedures were observed. These temporal patterns are illustrated in Figure 13, where overall variability is primarily driven by urgent colonoscopy.
Comparison with MILP Capacity Reservations
Empirically observed non-schedulable workload was compared with the capacity reservations implemented in the MILP model, which allocates 3 h on Mondays and 2 h from Tuesday to Friday for urgent procedures, together with a fixed reservation of 2 h per working day for inpatient procedures. Observed urgent workload was close to the reserved capacity on Mondays (2.04 vs. 3 h) and exceeded the baseline reservation on Tuesdays and Wednesdays (2.32 and 2.44 h per working day). In contrast, it decreased markedly on Fridays (1.12 h per working day), indicating systematic over-reservation at the end of the week. In contrast, inpatient workload consistently exceeded the fixed reservation across all weekdays, ranging from 2.13 to 2.58 h per working day, suggesting a structurally underestimated baseline demand. When urgent and inpatient procedures were aggregated, total non-schedulable workload ranged from 3.69 h per working day on Fridays to 4.96 h on Wednesdays, with an overall mean of 4.47 h per working day (Table 11). This level exceeded the combined reserved capacity on most weekdays. These results indicate that stochastic demand is absorbed unevenly and partially relies on flexibility from scheduled activity. Overall, the observed weekday-specific patterns suggest that capacity reservations could be better aligned with empirical demand. This could be achieved through a redistribution of urgent capacity towards midweek and an upward adjustment of inpatient reservations to improve robustness against non-schedulable demand. Distributing reserved capacity across all rooms, rather than concentrating it in two rooms, could also reduce the magnitude of localised delays.

3.2.3. Statistical Review of the MILP Scheduling Results—Statistical Analysis of Scheduling Data and Post-Optimisation Outcome Results

Temporal range consistency between the original and programmed appointment sets. The original appointment dataset spans from 1 February 2024 to 29 July 2024, whereas the MILP-programmed schedule, which is generated using fixed five-day programming blocks, covers the period from 1 February 2024 to 31 July 2024 after excluding NOT_USED and reserved slots. The coincidence of the first appointment date in both datasets confirms that the simulated planning is anchored to the same temporal starting point as the observed demand. In contrast, the programmed schedule extends two additional days beyond the last observed appointment. This extension is not indicative of a temporal distortion but rather reflects the block-based structure of the MILP formulation, which may allocate the final procedures at the end of the last five-day block even when the historical activity concludes earlier within that same week.
Not-used time in simulated schedules and end-of-day schedule overruns. The simulated schedules revealed a total of fifteen time windows classified as NOT_USED. Of these, four occurred on the final scheduling day (31 July), while the remaining eleven were distributed across earlier days. For all days other than 31 July, the NOT_USED intervals corresponded systematically to 30-min gaps (equivalent to two slots). This effect is a direct consequence of the procedure ingestion logic embedded in the MILP formulation, which preserves the original procedure order from the input dataset and does not allow reordering. As a result, when the remaining available time in a scheduling block was insufficient to accommodate the next eligible procedure—typically requiring 60 min—that procedure was discarded, even though 30 min of capacity remained unused. Across the planning horizon, this mechanism accounted for a total of 330 min of unallocated time, attributable to ingestion constraints rather than resource scarcity. Of these slots, 73% were allocated to Room 4, with the remainder to Room 3. In contrast, the NOT_USED slots observed on 31 July, amounting to 240 min, stem from a different structural cause. As this date represents the final day of the scheduling horizon, there were no additional procedures available in the input dataset to be ingested and assigned, preventing full utilisation of the remaining capacity. Consequently, these unused intervals reflect data availability limitations at the boundary of the planning period, rather than modelling or operational inefficiencies. Out of the 6195 scheduled procedures, only 39 (0.63%) finished 30 min later than the planned end-of-service time, with each delay occurring on a different day, indicating isolated rather than systematic overruns. Of these delayed procedures, 27 were assigned to Room 4 and the remaining 12 to Room 3, suggesting a higher concentration of end-of-day overruns in Room 4 and 3 under the simulated scheduling configuration.
Monthly balance of advanced and delayed procedures under different punctuality thresholds. Figure 14 summarizes the monthly distribution of advanced, delayed, and on-time procedures when punctuality is defined within a ±2-day window, and implicitly allows comparison with a block-based tolerance of ±5 days. Under the stricter criterion, a larger proportion of procedures is classified as delayed, while the share of advanced procedures remains comparatively smaller. In contrast, when a ±5-day tolerance is considered, most procedures fall within the on-time category, indicating that temporal deviations introduced by the MILP are predominantly short-range and contained within the operational scheduling block.
Across months, the relative increase in delayed procedures under the ±2-day criterion is more pronounced during periods of higher activity, while the capacity to advance procedures is progressively absorbed. This behaviour is consistent with the monthly workload patterns reported in Figure 13, where higher procedural volumes constrain anticipatory scheduling and force the optimisation model to rely on minor delays to preserve feasibility.
Global distribution of temporal shifts under the ±2-day criterion. The analysis of the overall proportions of advanced, delayed, and on-time procedures aggregated over the full study period using the ±2-day punctuality definition. Under the ±2-day tolerance criterion, the majority of procedures (70.41%) were scheduled on time. Delays accounted for 18.68% of cases, while 10.89% of procedures were advanced relative to the original demand. Overall, the MILP-based scheduling approach preserves the original temporal distribution to a large extent. Approximately 70% of procedures are scheduled on time, while delayed procedures account for a larger share than advanced ones. This asymmetry reflects the preferential use of short delays, rather than early scheduling, as the primary temporal adjustment mechanism when the MILP operates under realistic capacity constraints.
Temporal Distribution of Procedures: Original Demand Versus MILP-Based Scheduling
Monthly distribution by procedure type. Figure 15 presents the monthly distribution of procedures by type in the MILP-simulated dataset, compared with the original demand shown in Figure 4. The simulated schedule preserves the temporal stability observed in the input data, with colonoscopy and gastroscopy consistently dominating activity across months. Minor variations reflect the exclusion of procedures classified as Other and the restriction of the optimisation to Rooms 1–4, rather than effects induced by the scheduling model.
Room-Level Workload Characterisation: Original Demand Versus MILP-Based Scheduling
Procedure mix by room and procedure type. Figure 16 shows the procedure mix by room and procedure type in the MILP-simulated dataset, compared with the original demand reported in Figure 2a. The MILP solution results in a more homogeneous distribution of procedure types across rooms and reflects a balanced allocation induced by the optimisation model.
Mean working hours per room. Figure 17 shows the mean working hours per room in the MILP-simulated dataset, compared with the original values reported in Figure 7. The working hours derived from the input dataset reflect planned room occupancy but do not account for procedure overlaps, which occur in historical scheduling and lead to fictitious workload levels. In contrast, the MILP produces overlap-free schedules and illustrates how high and operationally feasible room utilisation levels can be achieved under realistic capacity constraints. The overlap-free schedules generated by the MILP increases effective room utilization from approximately 79% in the input dataset to around 94% in the simulated scenario, corresponding to an observed gain of about 15 percentage points without extending operating hours. When overlaps are eliminated, high utilisation is preserved while becoming operationally feasible.
Overlap-Related Scheduling Shortage Analysis
Total monthly shortage of scheduled time (original vs. simulated data). Figure 18a,b compare the total monthly shortage, computed as the sum of daily overlap minutes, for the original and simulated datasets, respectively. In the original data, shortage is systematically observed across all months, with high magnitude and notable variability, indicating that overlaps are an intrinsic component of routine operations. In contrast, the simulated dataset exhibits a lower and more regular monthly shortage, with total monthly shortage reduced from 348–415 h in the input dataset to 33–51.5 h after MILP-based scheduling (see Figure 18). This reduction is not driven by lower demand, but by the elimination of overlaps between elective procedures enforced by the MILP model. Remaining shortages arise exclusively when urgent or inpatient demand exceeds the predefined reserved time blocks.
Distribution of daily shortage minutes by month (original vs. simulated data). Figure 19a,b present the monthly distributions of daily shortage minutes for the original and MILP-simulated datasets, respectively. In the original data, the distributions are wide and markedly asymmetric, with frequent extreme values reflecting high heterogeneity in the magnitude of daily procedure overlaps.
In contrast, the simulated scenario exhibits more compact and bounded distributions, with a clear reduction in dispersion. It is important to note that, in the MILP case, shortage does not arise from the optimisation process itself, since the algorithm explicitly prevents overlaps in the scheduled procedures. Instead, shortages emerge only after reintroducing urgent and inpatient procedures into the MILP-generated schedule. When these non-scheduled procedures cannot be fully accommodated within the predefined reserved slots, they overlap with the planned activity, generating residual shortage.
Despite the persistence of shortage events, their intensity is reduced in the MILP-based scenario. This reduction is primarily driven by the systematic reservation of capacity for unforeseen demand and, more importantly, by the optimised allocation of procedures that enforces non-overlapping schedules and a more accurate estimation of procedure durations. As a result, the severity of daily shortages is significantly constrained compared to the original operational setting.
Monthly shortage time by room (original vs. simulated data). Figure 20a,b report the breakdown of monthly shortage minutes by physical room. In the original dataset, shortages are spread across multiple rooms, with variable monthly patterns, suggesting overlaps emerge from global scheduling dynamics rather than a single structural bottleneck. In the simulated dataset, shortage is almost entirely concentrated in Rooms 1 and 2, where urgent and inpatient procedures are forcibly scheduled from 09:00 onward. This concentration confirms that residual overlaps are attributable to demand overflow beyond reserved capacity, rather than to limitations of the optimisation algorithm.
Monthly summary of scheduling shortage indicators (original vs. simulated data). Table 12 shows that, on average, the simulated scenario reduces the percentage of days experiencing shortages from 99.2% in the original dataset to 81.54%, corresponding to an observed reduction of 17.67 percentage points, or approximately 3.5 fewer shortage days per month. Beyond the reduction in the percentage of days with shortages, the results show a substantial reduction in the magnitude of shortage events, measured in terms of overlapping time. As illustrated in Figure 20 the simulated scenario not only concentrates shortages into fewer days but also significantly reduces their duration across rooms and months, indicating a structural mitigation of capacity overflows rather than a mere redistribution in time.
Taken together, the coexistence of extended opening hours, mean inter-procedure idle times exceeding 30 min, and moderate effective utilisation indicates that inefficiencies arise primarily from workload fragmentation rather than from insufficient nominal capacity.
All differences reported in this section reflect descriptive comparisons of observed and simulated schedules. No inferential statistical tests were performed, and no claims of statistical significance or causal inference are intended.

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.

5. Conclusions

5.1. Data-Driven Diagnosis of Real-World Inefficiencies

This study provides a quantitative diagnosis of structural inefficiencies in a digestive endoscopy unit based on real operational data. The analysis reveals temporal and spatial imbalances that are not captured by standard aggregate performance indicators, highlighting the importance of detailed operational analytics to understand actual system behaviour.
The analysis demonstrates that the coexistence of idle time and near-daily capacity shortage is primarily organisational rather than quantitative, arising from suboptimal temporal and spatial workload distribution rather than from insufficient resources.
The proposed MILP-based scheduling framework produces measurable operational gains without increasing physical or human resources. Compared with routine practice, the optimized schedules eliminate artificial overlaps, increase average room utilization from approximately 79% to 94%, and reduce the proportion of working days affected by capacity shortages from 99.21% to 81.54%, corresponding to an absolute reduction of 17.67 percentage points. In addition, the magnitude of shortage events is substantially reduced, indicating a structural mitigation of overload rather than a simple temporal redistribution.
From an operational perspective, these improvements translate into several hours of effective capacity recovered per working day, which, under realistic procedure durations, corresponds to the ability to accommodate multiple additional endoscopic procedures per week, without extending operating hours or increasing production pressure, when the workload is under 1000 procedures per month, as seen when comparing Figure 5 and the results of advanced procedures in Figure 14. Importantly, these gains arise from improved agenda design and realistic time allocation rather than from intensification of clinical work.

5.2. Organisational Rather than Quantitative Limitations

The persistent coexistence of idle time and capacity shortage demonstrates that inefficiency is primarily organisational rather than quantitative. Suboptimal temporal and spatial distribution of workload, rather than insufficient resources, emerges as the main driver of performance limitations.

5.3. Robust Optimisation Without Additional Resources

The MILP framework leads to a marked improvement in room utilisation, workload balance, and schedule predictability without increasing physical or human resources. The model acts as a decision-support tool that makes existing capacity visible and usable, rather than as an automated scheduler that creates new capacity. The proposed MILP-based scheduling framework transforms high but artificial room occupancy into high and effective utilisation. By eliminating overlaps and aligning schedules with realistic procedure durations, effective room utilisation increases from approximately 79% in routine practice to 94% in the optimised scenario, without additional resources or schedule extensions. This gain reflects the recovery of latent capacity through improved agenda design and confirms that the observed efficiency improvements are organisational in nature, rather than driven by intensification of clinical activity.

5.4. Emergent Temporal Flexibility as a System Advantage

Temporal advances and short, bounded delays observed in the optimised schedules arise as an emergent property of realistic capacity modelling. This flexibility allows the system to absorb demand variability while preserving overall schedule stability and operational feasibility. As shown in Figure 5, the system is able to flatten the demand, balancing the workload between under 1000 procedures and over 1000 procedures by advanced procedure planning.

5.5. Clinical and Organisational Implications

By reducing artificial overlaps and sustained production pressure, data-driven scheduling grounded in real procedure times may contribute to improved quality of care and professional well-being. More stable and predictable agendas also have the potential to enhance system governability and coordination among clinical teams. Beyond efficiency, the results have relevant clinical and organisational implications. By aligning scheduled times with empirically observed procedure durations and explicitly protecting capacity for urgent and inpatient activity, the model substantially reduces sustained production pressure, artificial overlaps, and reactive rescheduling. As illustrated in Figure 20, the total monthly shortage time is markedly reduced in the MILP-based scenario, decreasing from values frequently exceeding 300–400 h per month in the original schedules to typically below 50–60 h per month after optimisation. This reduction is observed consistently across all analysed months and is accompanied by a clear concentration of residual shortages in a limited number of rooms (the ones with booked time for inpatients and urgent procedures, where we decided to allocate all these procedures, despite not having enough reservation time), rather than being diffusely distributed across the unit. These quantitative improvements translate into more stable and predictable agendas, improved system governability, and operating conditions that are more compatible with quality of care and professional well-being.

5.6. Transferability and Future Research Directions

The proposed methodology is transferable to other clinical services following appropriate service characterisation. Future research should address demand seasonality and calendar constraints, continuous data ingestion and rolling-horizon optimisation, sensitivity analyses of model parameters, explicit modelling of clinical priority and waiting-list dynamics, dynamic time allocation or adaptation to therapeutic intervention [19], and application of the approach to other healthcare agendas [20,23].

Supplementary Materials

The following supporting information can be downloaded at: https://github.com/lllunas-lab/DataDrivenEndoscopyDepartmentResourcesOptimization-MILP/tree/main CompleteDebugLogs (accessed on 3 February 2026). Supplementary materials provide a concise computational benchmarking summary of the MILP model, including solver runtime, optimality gaps, and sensitivity analyses with respect to objective weights and protected capacity levels.

Author Contributions

Conceptualization (theoretical framework and methodological design of the study), L.L.-M. and P.M.-P.; Conceptualization (proposal and design of the endoscopy field study “Optimization of the gastrointestinal endoscopy schedule” [“Optimización de la agenda de endoscopia digestiva”]), L.B.-P.; Methodology, L.L.-M.; Software, L.L.-M. and P.M.-P.; Validation, L.L.-M.; Formal analysis, L.L.-M., P.M.-P. and F.L.A.P.; Investigation (bibliographic research and general study), L.L.-M., P.M.-P. and F.L.A.P.; Investigation (fieldwork in the Endoscopy Department), F.L.A.P., L.L.-M. and L.B.-P.; Resources (clinical and bibliographic resources for the field study), M.P.S.; Data curation (collection and organization of field data), F.L.A.P. and L.B.-P.; Data curation (input dataset anonymization, preprocessing and preparation), L.L.-M. and F.L.A.P.; Writing—original draft preparation and editing, L.L.-M. and P.M.-P.; Writing—review L.L.-M., P.M.-P. and J.C.; Visualization, L.L.-M.; Supervision, P.M.-P. and J.C.; Project administration, L.L.-M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

This study did not involve human-subjects research. The dataset consisted exclusively of administrative appointment-scheduling records and contained no clinical information or direct personal identifiers. Prior to data access, all records were fully anonymised within the originating institution. Original medical record numbers were irreversibly pseudonymised using a randomisation process that preserved internal linkage between records while eliminating any possibility of reidentification. Consequently, ethical approval and informed consent were not required.

Informed Consent Statement

Not applicable.

Data Availability Statement

The input data used in this study, as well as the datasets generated through the simulation experiments, are available under a Creative Commons licence upon reasonable request from the corresponding author. Public release of the data is temporarily restricted due to institutional requirements. The authors are currently awaiting written authorisation from Hospital del Mar to make the datasets openly available in a public repository. Once approval is granted, the data will be deposited at: 1. A repository containing the core MILP implementation and execution scripts. https://github.com/lllunas-lab/DataDrivenEndoscopyDepartmentResourcesOptimization-MILP (accessed on 3 February 2026). 2. A repository with the post-processing code used to generate all tables and figures reported in the manuscript. https://github.com/lllunas-lab/DataDrivenEndoscopyDepartmentResourcesOptimization-STATS (accessed on 3 February 2026). 3. A repository containing an anonymised small input dataset. https://github.com/lllunas-lab/DataDrivenEndoscopyDepartmentResourcesOptimization-DATA (accessed on 3 February 2026).

Acknowledgments

The authors acknowledge Eduardo Rayo Montes, Sergio Monge Perez and Enzo Toscano García from the Information Systems Department of Hospital del Mar for their support in data extraction from the hospital information systems.

Conflicts of Interest

The authors declare no conflicts of interest.

Appendix A. Matrix Formulation for the MILP Solver

The problem was solved using the intlinprog solver, which utilises a branch-and-cut algorithm and is based on the HiGHS open-source software. The intlinprog converts MATLAB®-formatted inputs and options into equivalent HiGHS arguments and converts the returned solution into standard MATLAB® format as well. The inputs are required in the form:
min z f z subject to A z b , A eq z = b eq , l b z u b ,
where the notation corresponds to:
  • z : The global vector containing all decision variables ( x i , k , t , u k , δ k , o k ) .
  • f : The vector of objective function coefficients (weights).
  • A , b : The matrix and vector representing the linear inequality constraints (non-overlap and balancing).
  • A e q , b e q : The matrix and vector representing the linear equality constraints (assignment, usage definition, and capacity).
  • l b , u b : The vectors defining the lower and upper bounds for each decision variable.
  • i n t c o n : Vector indicating which of the variables of z are integers.

Appendix A.1. Decision Variables and Indexing

All variables defined in Section 2.5.3 are mapped into a single decision vector z R n Vars .
As there are n X = n P n R n T variables x i , k , t , n Vars = n X + 3 n R . Although x i , k , t is indexed for all t = 1 , , n T , infeasible start times ( t T i ) are disabled by setting the corresponding upper bounds to zero, i.e., u b xpos ( i , k , t ) = 0 for t T i .
We utilise the following linear indexing mapping (equivalent to column-major order) to map the three-way tensor containing x i , k , t to z :
xpos ( i , k , t ) = i + ( k 1 ) n P + ( t 1 ) n P n R ,
So, for i = 1 , , n P , k = 1 , , n R , and t = 1 , , n T , and using the xpos() mapping, the elements of z are:
z xpos ( i , k , t ) = x i , k , t , z n X + k = u k , z n X + n R + k = δ k , z n X + 2 n R + k = o k ,
Since the variables x i , k , t are the only integers (binary), the integer index vector is:
i n t c o n = { 1 , 2 , , n X } .

Appendix A.2. Objective Function Vector f

Let w start > 0 , w o > 0 , and w bal > 0 be the weights for the objective function. The vector f R n Vars is defined in terms of its elements component-wise as:
f j = w start ( t 1 ) Δ , if j = xpos ( i , k , t ) for some i , k , t , 0 , if j = n X + k ( variables u k ) , w bal , if j = n X + n R + k ( variables δ k ) , w o , if j = n X + 2 n R + k ( variables o k ) ,
where indices i , k , t range over 1 , , n P , 1 , , n R , and 1 , , n T , respectively.
Therefore, the product f z corresponds to the scalar expression:
f z = w start i = 1 n P k = 1 n R t T i ( t 1 ) Δ x i , k , t + w o k = 1 n R o k + w bal k = 1 n R δ k .

Appendix A.3. Equality Constraints

The constraints that must be satisfied with equality are organised in the matrix form as A eq z = b eq . This matrix and vector are composed of three blocks, each one concerning a particular type of constraint. So,
A eq = A eq assign A eq u A eq cap , b eq = b eq assign b eq u b eq cap ,
where the Unique Assignment Constraint given by Equation (6) is the first block and in matrix notation is written using A eq assign R n P × n Vars and b eq assign R n P .
For i = 1 , , n P , j = 1 , , n Vars , their corresponding elements take the values:
A eq assign i , j = 1 , if j = xpos ( i , k , t ) for any k K and any t T i , 0 , otherwise .
( b eq assign ) i = 1
The next block corresponds to the Usage Definition constraints, which enforce that the total utilisation u k equals the sum of the durations of the procedures assigned to room k. These constraints are given in Equation (9) and expressed in matrix form as A eq u R n R × n Vars and b eq u R n R in the way:
For each room k = 1 , , n R and j = 1 , , n Vars :
A eq u k , j = 1 , if j = n X + k ( u k position ) , d i , if j = xpos ( i , k , t ) for some i I and t T i , 0 , otherwise .
( b eq u ) k = 0 , k K .
Finally, the capacity balance constraints enforce that the total capacity of room k is partitioned into utilisation and idle time, as defined in (10). In matrix form, they are expressed using A eq cap R n R × n Vars and b eq cap R n R as follows.
For each room k K and j = 1 , , n Vars ,
A eq cap k , j = 1 , if j = n X + k ( u k position ) , 1 , if j = n X + 2 n R + k ( o k position ) , 0 , otherwise ,
( b eq cap ) k = cap k , k K ,
where cap k is the known total available capacity (in minutes) for room k over the planning horizon.

Appendix A.4. Inequality Constraints

The constraints to be satisfied with inequality are organised as A z b . A and b are built by two subblocks, each one concerning, again, a particular type of constraint. That is:
A = A overlap A bal , b = b overlap b bal .
The first block of A and b deals with the Non-overlap constraint which ensures that at any time slot t in room k, at most one procedure can be active. This accounts for the duration θ i of the procedures. These constraints are given in Equation (7). To rewrite them in matrix form we use A overlap R ( n R n T ) × n Vars and b overlap R n R n T . Notice that rows are indexed by pairs ( k , t ) using, in this particular case, the mapping:
row ( k , t ) = ( k 1 ) n T + t
So, for each room k K and slot t T :
A overlap row ( k , t ) , j = 1 , if j = xpos ( i , k , τ ) for some i I and τ T i { max ( 1 , t θ i + 1 ) , , t } 0 , otherwise ,
( b overlap ) row ( k , t ) = 1 , k K , t T .
Finally, the workload balancing constraints expressed as the n R absolute-value conditions | u k μ | δ k are linearised and split into 2 n R inequalities (see (12)). They are written using A bal R ( 2 n R ) × n Vars and b bal R 2 n R as follows.
For each room k K , we define two rows:
Inequality I ( u k δ k μ ):
A bal 2 k 1 , j = 1 , if j = n X + k ( u k ) , 1 , if j = n X + n R + k ( δ k ) , 0 , otherwise , ( b bal ) 2 k 1 = μ .
Inequality II ( μ u k δ k ):
A bal 2 k , j = 1 , if j = n X + k ( u k ) , 1 , if j = n X + n R + k ( δ k ) , 0 , otherwise , ( b bal ) 2 k = μ .

Appendix A.5. Bounds and Integrality

The lower and upper bounds are defined as:
lb j = 0 , ub j = 1 , if j n X ( variables x i , k , t ) , + , if j > n X ( u k , δ k , o k ) , j = 1 , , n Vars .
Additionally, to enforce feasibility of start times and slot-level availability (no-spill), we tighten bounds by forcing to zero those binary variables that correspond to infeasible starts. Specifically,
ub xpos ( i , k , t ) = 0 if t T i or r { 0 , , θ i 1 } such that A k , t + r = 0 .
This ensures that a procedure can only start at feasible slots and cannot overlap any blocked slot, thus enforcing constraint (8) in the intlinprog implementation.

References

  1. Marcus, S.N. Efficiency in Endoscopy Centers. Gastrointest. Endosc. 2006, 64, 765–767. [Google Scholar] [CrossRef] [PubMed]
  2. Marcus, R.; Vargo, J.; Dumot, J. Improving efficiency in endoscopy centers: Strategies and evidence. Gastrointest. Endosc. Clin. N. Am. 2017, 27, 639–652. [Google Scholar] [CrossRef]
  3. Leal, C.; Almeida, N.; Silva, M.; Santos, A.; Vasconcelos, H.; Figueiredo, P. Appropriateness of Endoscopic Procedures: A Prospective, Multicenter Study. GE Port. J. Gastroenterol. 2021, 29, 5–12. [Google Scholar] [CrossRef] [PubMed]
  4. Tewani, S.K.; Tannous, G.C.; Stier, M.W.; Natal, E.; Vicari, J. Improving and Driving Efficiency in Your Endoscopy Unit in the 21st Century. Clin. Gastroenterol. Hepatol. 2022, 20, 2680–2683. [Google Scholar] [CrossRef] [PubMed]
  5. Söderberg, S.; Nyhlin, N.; Moro, A.; Figaro, C.; Fransson, E.; Stefansdotter, J.; Schagerström, M.; Lindblad, M.; Ahlzén, M.; Zukovets, O.; et al. Time and Motion at the Endoscopy Unit—A University Hospital Experience. Health Serv. Res. Manag. Epidemiol. 2023, 10, 233339282311598. [Google Scholar] [CrossRef] [PubMed]
  6. Aiken, L.H.; Clarke, S.P.; Sloane, D.M.; Sochalski, J.; Silber, J.H. Hospital nurse staffing and patient mortality, nurse burnout, and job dissatisfaction. JAMA 2002, 288, 1987–1993. [Google Scholar] [CrossRef] [PubMed]
  7. Shanafelt, T.D.; Hasan, O.; Dyrbye, L.N.; Sinsky, C.; Satele, D.; Sloan, J.A.; West, C.P. Changes in burnout and satisfaction with work-life balance in physicians and the general US working population between 2011 and 2014. Mayo Clin. Proc. 2015, 90, 1600–1613. [Google Scholar] [CrossRef] [PubMed]
  8. Lacy, B.E.; Chan, J.L. Physician Burnout: The Hidden Health Care Crisis. Clin. Gastroenterol. Hepatol. 2018, 16, 311–317. [Google Scholar] [CrossRef] [PubMed]
  9. Ala, A.; Yazdani, M.; Ahmadi, M.; Poorianasab, A.; Attari, M.Y.N. An Efficient Healthcare Chain Design for Resolving the Patient Scheduling Problem: Queuing Theory and MILP-ASA Optimization Approach. Ann. Oper. Res. 2023, 328, 3–33. [Google Scholar] [CrossRef]
  10. Teran-Somohano, A.; Smith, A.E. A sequential space syntax approach for healthcare facility layout design. Comput. Ind. Eng. 2023, 177, 109038. [Google Scholar] [CrossRef]
  11. Louati, A.; Lahyani, R.; Aldaej, A.; Mellouli, R.; Nusir, M. Mixed Integer Linear Programming Models to Solve a Real-Life Vehicle Routing Problem with Pickup and Delivery. Appl. Sci. 2021, 11, 9551. [Google Scholar] [CrossRef]
  12. Benfedel, R.; Belkaid, F.; Brahimi, N. Production and distribution planning with direct shipment and multi-trips. J. Ind. Manag. Optim. 2025, 21, 3960–3984. [Google Scholar] [CrossRef]
  13. Perez-Tezoco, J.Y.; Aguilar-Lasserre, A.A.; Moras-Sánchez, C.G.; Vázquez-Rodríguez, C.F.; Azzaro-Pantel, C. Hospital reconversion in response to the COVID-19 pandemic using simulation and multi-objective genetic algorithms. Comput. Ind. Eng. 2023, 182, 109408. [Google Scholar] [CrossRef] [PubMed]
  14. Liñán, D.A.; Ricardez-Sandoval, L.A. Trends and perspectives in deterministic MINLP optimization for integrated planning, scheduling, control, and design of chemical processes. Rev. Chem. Eng. 2025, 41, 451–472. [Google Scholar] [CrossRef] [PubMed]
  15. Zuo, X.; Li, B.; Huang, X.; Zhou, M.; Cheng, C.; Zhao, X.; Liu, Z. Optimizing Hospital Emergency Department Layout via Multiobjective Tabu Search. IEEE Trans. Autom. Sci. Eng. 2019, 16, 1137–1147. [Google Scholar] [CrossRef]
  16. MathWorks. Mixed-Integer Linear Programming (MILP) Algorithms. MATLAB & Simulink Documentation. Available online: https://www.mathworks.com/help/optim/ug/mixed-integer-linear-programming-algorithms.html (accessed on 15 November 2025).
  17. Whitson, M.J.; Bodian, C.A.; Aisenberg, J.; Cohen, L.B. Is production pressure jeopardizing the quality of colonoscopy? A survey of U.S. endoscopists’ practices and perceptions. Gastrointest. Endosc. 2012, 75, 123–131. [Google Scholar] [CrossRef] [PubMed]
  18. Lawrence, B. The impact of endoscopist fatigue on colonoscopy quality. Gastroenterology 2008, 135, 1916–1924. [Google Scholar]
  19. Kaminski, M.F.; Thomas-Gibson, S.; Bugajski, M.; Bretthauer, M.; Rees, C.J.; Dekker, E.; Hoff, G.; Jover, R.; Suchanek, S.; Ferlitsch, M.; et al. Performance measures for lower gastrointestinal endoscopy: A European Society of Gastrointestinal Endoscopy (ESGE) quality improvement initiative. Endoscopy 2017, 49, 378–397. [Google Scholar] [CrossRef] [PubMed]
  20. Maravelias, C.T. Mixed-Integer Programming. In Chemical Production Scheduling: Mixed-Integer Programming Models and Methods; Cambridge University Press: Cambridge, UK, 2021; pp. 32–64. [Google Scholar] [CrossRef]
  21. Cadoni, S.; Hassan, C.; Frazzoni, L.; Ishaq, S.; Leung, F.W. Impact of water exchange colonoscopy on endoscopy room efficiency: A systematic review and meta-analysis. Gastrointest. Endosc. 2019, 89, 159–167. [Google Scholar] [CrossRef] [PubMed]
  22. MathWorks. intlinprog—Solve Mixed-Integer Linear Programming Problems. 2025. Available online: https://es.mathworks.com/help/optim/ug/intlinprog.html (accessed on 24 January 2026).
  23. Khlif Hachicha, H.; Zeghal Mansour, F. Two-MILP Models for Scheduling Elective Surgeries within a Private Healthcare Facility. Health Care Manag. Sci. 2018, 21, 376–392. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Workload characterisation of endoscopy activity.
Figure 1. Workload characterisation of endoscopy activity.
Applsci 16 01864 g001
Figure 2. Spatial and procedural characterisation of endoscopy activity.
Figure 2. Spatial and procedural characterisation of endoscopy activity.
Applsci 16 01864 g002
Figure 3. Room-level distribution of procedure types (colonoscopy and gastroscopy) by clinical priority.
Figure 3. Room-level distribution of procedure types (colonoscopy and gastroscopy) by clinical priority.
Applsci 16 01864 g003
Figure 4. Monthly distribution by procedure type (Rooms 1–4 + Multifunction).
Figure 4. Monthly distribution by procedure type (Rooms 1–4 + Multifunction).
Applsci 16 01864 g004
Figure 5. Total number of planned procedures by month and type.
Figure 5. Total number of planned procedures by month and type.
Applsci 16 01864 g005
Figure 6. Hourly distribution by room average (input dataset).
Figure 6. Hourly distribution by room average (input dataset).
Applsci 16 01864 g006
Figure 7. Mean working hours per room.
Figure 7. Mean working hours per room.
Applsci 16 01864 g007
Figure 8. Weekly schedule visualization (Gantt-type) showing start times.
Figure 8. Weekly schedule visualization (Gantt-type) showing start times.
Applsci 16 01864 g008
Figure 9. Mean time between procedures.
Figure 9. Mean time between procedures.
Applsci 16 01864 g009
Figure 10. Mean idle time between procedures per room and month.
Figure 10. Mean idle time between procedures per room and month.
Applsci 16 01864 g010
Figure 11. Distribution of interprocedure idle time by room and day of week.
Figure 11. Distribution of interprocedure idle time by room and day of week.
Applsci 16 01864 g011
Figure 12. Distribution of inter-procedure idle time (gap between consecutive procedures, excluding overnight periods).
Figure 12. Distribution of inter-procedure idle time (gap between consecutive procedures, excluding overnight periods).
Applsci 16 01864 g012
Figure 13. Monthly workload of non-schedulable urgent and inpatient endoscopic procedures. Mean hours per working day are shown for each procedure type and priority.
Figure 13. Monthly workload of non-schedulable urgent and inpatient endoscopic procedures. Mean hours per working day are shown for each procedure type and priority.
Applsci 16 01864 g013
Figure 14. Monthly distribution of advanced, on-time, and delayed procedures under the ±2-day punctuality criterion.
Figure 14. Monthly distribution of advanced, on-time, and delayed procedures under the ±2-day punctuality criterion.
Applsci 16 01864 g014
Figure 15. Monthly distribution of procedures by type and room in the MILP-simulated dataset (Rooms 1–4; procedures classified as Other excluded).
Figure 15. Monthly distribution of procedures by type and room in the MILP-simulated dataset (Rooms 1–4; procedures classified as Other excluded).
Applsci 16 01864 g015
Figure 16. Procedure mix by room and procedure.
Figure 16. Procedure mix by room and procedure.
Applsci 16 01864 g016
Figure 17. Mean Working hours per room MILP-simulated schedules.
Figure 17. Mean Working hours per room MILP-simulated schedules.
Applsci 16 01864 g017
Figure 18. Total monthly scheduling shortage, computed as the sum of daily overlap minutes (input vs. MILP-simulated datasets).
Figure 18. Total monthly scheduling shortage, computed as the sum of daily overlap minutes (input vs. MILP-simulated datasets).
Applsci 16 01864 g018
Figure 19. Comparative Daily shortage distribution by month box plots.
Figure 19. Comparative Daily shortage distribution by month box plots.
Applsci 16 01864 g019
Figure 20. Comparison between Shortage hours by room and month.
Figure 20. Comparison between Shortage hours by room and month.
Applsci 16 01864 g020
Table 1. Operating schedule and weekly capacity per endoscopy room.
Table 1. Operating schedule and weekly capacity per endoscopy room.
DayShiftOperating Hours
Monday–ThursdayMorning shift09:00–15:00 (6 h)
Afternoon shift15:00–20:00 (5 h)
FridaySingle shift09:00–15:00 (6 h)
Weekly capacity per room
Monday–Thursday44 h (11 h/day × 4 days)
Friday6 h
Total50 h/week
Table 2. Relationships between Hospital Information System agenda codes and standardised physical rooms.
Table 2. Relationships between Hospital Information System agenda codes and standardised physical rooms.
Standardized Physical RoomHIS Codification (Agenda Code)
Room 133, 35
Room 23, 34, 12
Room 31, 5, 14
Room 4PDIG3, PDIG4
Multifunction Room (MFR)6
Table 3. Mapping rules for procedure type and estimated time (assigned values).
Table 3. Mapping rules for procedure type and estimated time (assigned values).
Source FieldKeywordProc. TypeProc. Time (min)
PROCEDUREcontains “GASTROSCOPY”Gastroscopy30
PROCEDUREcontains “COLONOSCOPY”Colonoscopy60
PROCEDUREotherwiseOthers60
Note: Proc. = Procedure.
Table 4. Mapping rules for procedure priority classification.
Table 4. Mapping rules for procedure priority classification.
Source FieldKeyword/Value MatchAssigned Priority
PROCEDUREcontains “URGENT”urgent
PROCEDUREcontains “INPATIENT”inpatient
PROCEDUREcontains “PRIORITY”priority
PROCEDUREcontains “SCREENING”screening
PROCEDUREotherwisestandard
Table 5. Weekly blocking scheme used in the simulation (minutes per room and day).
Table 5. Weekly blocking scheme used in the simulation (minutes per room and day).
UrgentInpatient
DayTime (min)RoomTime (min)Room
Monday18011202
Tuesday12011202
Wednesday12011202
Thursday12011202
Friday12011202
Table 6. Mean and median time requirements for gastroscopy and colonoscopy according to procedural phase, compared with scheduled time allocation obtained from field data collection. Adoption of time reference to be used in the simulation.
Table 6. Mean and median time requirements for gastroscopy and colonoscopy according to procedural phase, compared with scheduled time allocation obtained from field data collection. Adoption of time reference to be used in the simulation.
Procedural PhaseGastroscopy (min)Colonoscopy (min)
Pre-procedural time (mean/median)10.9/10.215.3/14.9
Procedural time without therapy (mean ± SD)10.024.2 ± 9.6
Estimated additional time for therapy+5.0
Procedural time total (estimated mean)10.030.0
Post-procedural time (mean/median)10.1/9.313.5/12.3
Total procedure time (observed/estimated)29.5/3057.2/60
Scheduled time allocation (Hospital del Mar)2030–40
Standard times to be used in the simulation3060
Table 7. Average start and end times by weekday (all rooms).
Table 7. Average start and end times by weekday (all rooms).
WeekdayStart Time (hh:mm)End Time (hh:mm)
Monday09:2621:38
Tuesday09:1321:54
Wednesday09:1221:38
Thursday09:3921:55
Friday09:0320:59
Saturday11:1520:42
Table 8. Overall non-schedulable endoscopic activity by priority, adjusted by working days.
Table 8. Overall non-schedulable endoscopic activity by priority, adjusted by working days.
PriorityTotal ProceduresMean Procedures/Working DayMean Hours/Working Day
Inpatient4243.33862.4606
Urgent2592.03942.0394
Table 9. Monthly total workload of non-schedulable endoscopic procedures, adjusted by working days.
Table 9. Monthly total workload of non-schedulable endoscopic procedures, adjusted by working days.
Month (24)Total ProceduresMean Procedures/Working DayMean Hours/Working Day
February1135.654.6750
March1216.055.1500
April1215.76194.7381
May964.36363.8182
June1105.504.4750
July1225.54554.6364
Table 10. Monthly distribution of working-day-adjusted workload (hours per working day) by procedure type and priority.
Table 10. Monthly distribution of working-day-adjusted workload (hours per working day) by procedure type and priority.
GroupMonthsMeanSDCVMedianQ1Q3
Colonoscopy—Inpatient61.61410.22570.13981.63101.50001.8000
Colonoscopy—Urgent62.07160.33230.16042.07621.77272.4000
Gastroscopy—Inpatient60.89640.18020.20100.94210.90001.0238
Gastroscopy—Urgent600000
Table 11. Overall weekday distribution of non-schedulable endoscopic workload, aggregated across priorities and adjusted by working days.
Table 11. Overall weekday distribution of non-schedulable endoscopic workload, aggregated across priorities and adjusted by working days.
WeekdayMean Procedures/Working DayMean Hours/Working Day
Monday4.92314.1731
Tuesday5.84004.8400
Wednesday5.80004.9600
Thursday5.46154.6923
Friday4.69233.6923
Total (Mon–Fri)5.3434.472
Note. The total row reflects the overall mean per working day across the study period and is not the sum of weekday values. It follows the working-day–adjusted methodology described in the Methods section.
Table 12. Monthly shortage indicators between original and simulated datasets.
Table 12. Monthly shortage indicators between original and simulated datasets.
Days with Shortage (%)
MonthInput DatasetSimulatedDifference (pp)
February95.2476.19−19.05
March100.0090.48−9.52
April100.0081.82−18.18
May100.0078.26−21.74
June100.0085.00−15.00
July100.0078.26−21.74
Average99.2181.5417.67
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Llunas-Mestres, L.; Aguilar Paredes, F.L.; Barranco-Priego, L.; Sánchez, M.P.; Marti-Puig, P.; Cusido, J. Data-Driven Optimisation of Endoscopy Department Resources Through Statistical Analysis and Mixed-Integer Linear Programming. Appl. Sci. 2026, 16, 1864. https://doi.org/10.3390/app16041864

AMA Style

Llunas-Mestres L, Aguilar Paredes FL, Barranco-Priego L, Sánchez MP, Marti-Puig P, Cusido J. Data-Driven Optimisation of Endoscopy Department Resources Through Statistical Analysis and Mixed-Integer Linear Programming. Applied Sciences. 2026; 16(4):1864. https://doi.org/10.3390/app16041864

Chicago/Turabian Style

Llunas-Mestres, Laia, Francesca L. Aguilar Paredes, Luis Barranco-Priego, Miguel Pantaleón Sánchez, Pere Marti-Puig, and Jordi Cusido. 2026. "Data-Driven Optimisation of Endoscopy Department Resources Through Statistical Analysis and Mixed-Integer Linear Programming" Applied Sciences 16, no. 4: 1864. https://doi.org/10.3390/app16041864

APA Style

Llunas-Mestres, L., Aguilar Paredes, F. L., Barranco-Priego, L., Sánchez, M. P., Marti-Puig, P., & Cusido, J. (2026). Data-Driven Optimisation of Endoscopy Department Resources Through Statistical Analysis and Mixed-Integer Linear Programming. Applied Sciences, 16(4), 1864. https://doi.org/10.3390/app16041864

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop