This repository contains a discrete-event simulation and optimization framework for outpatient scheduling in an interventional radiology setting. The project combines input-model fitting, a weekly appointment-capacity policy represented by Qik, and several optimization approaches to compare scheduling policies under a common simulation model.
To reproduce the final evaluation and analysis shown in the report:
- Run
evaluate_policy.py. This script evaluates the selected policies from the optimization methods using 100 simulation replications and stores the replication-level results in theevaluate_policy/folder. The evaluation uses fixed random seeds, so rerunning it with the same settings will reproduce the same results. - Run
Result_Analysis.py. This script reads the evaluation outputs, creates summary tables, computes 95% confidence intervals, and generates the comparison plots.
The raw data used for fitting the simulation inputs is stored in df_selected.xlsx.
arrival_rate.pyanalyzes arrival patterns for the two patient classes.service_rate.pyfits the preparation-time, procedure-time, and lateness distributions.- The selected fitted input models are saved in
arrival_model_params.jsonandservices rate.json. - Diagnostic plots for the fitted models are saved in
arrival_rate_plot/andserivce_rate_plot/.
The main simulation logic is implemented in simulation_model.py. It is a discrete-event simulation of the outpatient booking and procedure process for two patient classes: Interventional and Angiography. SimClasses.py, SimFunctions.py and SimRNG.py are used to support the simulation moodel.
At a high level, the model works as follows:
- Patient orders arrive over time according to class-specific arrival models.
- Each patient is assigned a preparation type, and a preparation duration is sampled.
- Once preparation is complete, the patient becomes ready to schedule.
- The scheduler books the patient into the earliest feasible future appointment slot allowed by the weekly timetable and the
Qikcapacities. - The patient arrives for the appointment after the scheduled time plus a sampled lateness delay.
- If the procedure room is free, service starts immediately; otherwise, the patient waits in a FIFO queue.
- When the procedure ends, the room is released, overtime is recorded, and the next waiting patient begins service if one is available.
- At the end of the run, the model summarizes performance using:
Z1: waiting-time performanceZ2: overtime performanceZ3: congestion performanceH: the weighted objective used for policy comparison
The simulation flowchart is shown below:
The model depends primarily on input_loader.py to load the fitted arrival and service distributions used by the simulation.
This repository includes three optimization approaches for searching for good scheduling policies:
Optimization_SAA2.py: sample average approximation based optimization -- about 15 minutes to runOptimization_Subset_Selection+KN_simplified.py: subset-selection and Kim-Nelson based ranking-and-selection approach -- about 3 hours to runOptimization_Lin_Stage2.py: linearized stage-2 improvement procedure -- about 2 minutes to run
Their outputs are saved in:
SAA2_output_folder/optimization_subset_selection_kn_simplified_outputs5/optimization_lin_stage2_outputs/
Notice the estimated running time depends on your environment, this is the running time based on the author's computer.
evaluate_policy.pyre-evaluates the selected policies under a common validation setting and stores the full replication-level outputs inevaluate_policy/.Result_Analysis.pyreads those evaluation results, produces summary tables, computes 95% confidence intervals, and creates comparison plots inresult_analysis_outputs/.
evaluate_policy/: replication-level validation results for the selected policiesresult_analysis_outputs/: summary tables and plots used for final comparisonSAA2_output_folder/: outputs from the SAA optimizationoptimization_subset_selection_kn_simplified_outputs5/: outputs from the subset-selection and KN procedureoptimization_lin_stage2_outputs/: outputs from the linear stage-2 method
- Notice old_folder only includes old_version of the py and ipynb files to track the progress. Not count in the submission.
