TrafSched: Integrating Bayesian Adaptation with LLMs for Traffic Scheduling Optimization
Abstract
1. Introduction
- Develop a comprehensive railway traffic schedule environment model specifically designed for conflict simulation and resolution, providing a standardized framework for timetabling research.
- Create a diverse strategy library containing 32 specialized resolution strategies for four fundamental conflict types: dwell time violations, running time violations, insufficient intervals, and overtaking conflicts.
- Propose the TrafSched decision framework that significantly outperforms traditional methods through its integration of Bayesian strategy adaptation, multi-dimensional conflict prioritization, and hierarchical backtracking mechanisms.
- Pioneer the integration of LLMs into railway scheduling, demonstrating how natural language reasoning can enhance conflict resolution in complex operational scenarios.
2. Related Work
2.1. Mathematical Optimization for Railway Scheduling
2.2. Reinforcement Learning for Railway Scheduling
2.3. Large Language Models in Transportation
2.4. Summarize and Motivation
3. Problem Formulation and Modeling
3.1. Preliminary
3.2. The Constraints and Optimization Objective
3.2.1. Dwell Time Constraints
3.2.2. Running Time Constrains
3.2.3. Interval Time Constraints
- : Train arrival at the station;
- : Train departure from the station;
- : train passage through the station without stopping.
3.2.4. Overtaking Constrains
3.2.5. Optimization Objective
- Fundamental feasibility requirement. Conflict resolution represents a prerequisite for any feasible timetable, regardless of other optimization criteria. A schedule with unresolved conflicts violates safety constraints and cannot be operationally deployed. In this sense, conflict minimization serves as a necessary foundation before multi-objective optimization can be meaningfully applied.
- Computational tractability. The single-objective formulation enables systematic exploration of the solution space through our adaptive decision framework without the exponential complexity introduced by Pareto frontier exploration in multi-objective optimization. This design choice aligns with our goal of developing a practical framework that can handle real-world scale problems (50–120 trains).
- Industrial practice alignment. In operational railway dispatching, conflict resolution is typically prioritized as the first-stage objective, with other performance metrics optimized subsequently. Our formulation reflects this hierarchical decision-making process commonly adopted in railway control centers.
3.3. Timetable Matrix and Conflict Detection
- Rows : Each intermediate station ( in total) contributes two rows representing arrival and departure events, while each terminal station contributes a single row (departure for the origin, arrival for the destination).
- Columns : Correspond to the set of trains .
- Elements : Denote the scheduled event time (arrival or departure) of train j at the station associated with row i.
4. Methodology
4.1. Framework Overview
4.2. Conflict Resolution Strategy Library
4.2.1. Strategies for Dwell Time Conflicts
4.2.2. Strategies for Running Time Conflicts
4.2.3. Strategies for Insufficient Interval Conflicts
4.2.4. Strategies for Overtaking Conflicts
4.2.5. The Advanced Strategies
- Cascade Dwell Time Adjustment Strategies: These strategies adjust dwell times across multiple consecutive stations, respecting dwell time bounds at each station while accumulating sufficient temporal shift to resolve the target conflict. An example can be seen in Figure 2e.
- Systematic Timetable Adjustment Strategies: These involve coordinated time shifts for multiple trains in opposite directions, by redistributing temporal buffers across multiple trains to resolve complex conflicts.
- Opportunity Window Insertion Strategy: This strategy searches for the top N largest time gaps within a given window, evaluates insertion feasibility for the conflicting train, and repositions it at the first conflict-free opportunity while satisfying all constraints.
4.3. The Railway Scheduling Decision Method
4.3.1. Multi-Dimensional Conflict Prioritization
4.3.2. Bayesian Strategy Adaptation
4.3.3. Hierarchical Strategy Evaluation
- : Total conflicts in the current timetable before applying strategy s
- : Conflicts in the network section up to station ()
- : New conflicts created upstream (earlier stations) after applying s
- : New conflicts created downstream (later stations) after applying s
- : Weighting coefficients for upstream and downstream effects
4.3.4. Multi-Level Backtracking and Exploration
4.4. LLM-Enhanced Decision Module
4.4.1. Strategy Knowledge Representation
- Identifier: Overtaking Resolution by Dwell Extension (O5)
- Applicability: Overtaking conflict where Train A (slower) departs the station before Train B (faster) but Train B arrives at the next station first.
- Operation: Extend Train A’s dwell time at the conflict station until Train B passes, ensuring Train B departs before Train A.
- Requirements: Train A ID, Train B ID, conflict station index, Train B passage time, minimum separation interval.
- Effects: Resolves overtaking conflict by adjusting temporal ordering. May increase Train A’s delay. Downstream conflicts are possible if extended dwell violates the maximum dwell time constraint.
| Algorithm 1: Railway Scheduling Decision Algorithm |
|
4.4.2. Contextual Conflict Analysis and Reasoning
5. Experiments
5.1. Experimental Setup
- Heuristic methods represent operational practice in railway systems. Our selected heuristic baseline implements rule-based conflict resolution commonly used in railway control centers, providing a fair representation of this paradigm’s capabilities.
- Reinforcement learning (PPO) represents state-of-the-art learning-based approaches for sequential decision problems. PPO was selected as a widely-recognized effective method, though all RL algorithms share similar limitations in our context, such as sample inefficiency, poor cross-scenario generalization, and lack of interpretability.
- Mathematical optimization methods are not included as direct baselines because: (1) our problem focuses on resolving conflicts in existing timetables rather than generating optimal schedules from scratch, it is a different problem; (2) constraint programming methods faces prohibitive computational complexity at large scale trains as documented in Section 2.1.
5.2. Result Analysis
6. Discussion
6.1. The Contributing to TrafSched’s Performance
6.2. Limitations and Future Directions
7. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Conflicts of Interest
References
- Pyrgidis, C.N. Railway Transportation Systems: Design, Construction and Operation; CRC Press: Boca Raton, FL, USA, 2021. [Google Scholar]
- Chen, S.; Piao, L.; Zang, X.; Luo, Q.; Li, J.; Yang, J.; Rong, J. Analyzing differences of highway lane-changing behavior using vehicle trajectory data. Phys. A Stat. Mech. Its Appl. 2023, 624, 128980. [Google Scholar] [CrossRef]
- Chen, X.; Wu, S.; Shi, C.; Huang, Y.; Yang, Y.; Ke, R.; Zhao, J. Sensing Data Supported Traffic Flow Prediction via Denoising Schemes and ANN: A Comparison. IEEE Sens. J. 2020, 20, 14317–14328. [Google Scholar] [CrossRef]
- Cacchiani, V.; Toth, P. Nominal and robust train timetabling problems. Eur. J. Oper. Res. 2012, 219, 727–737. [Google Scholar] [CrossRef]
- Cacchiani, V.; Furini, F.; Kidd, M.P. Approaches to a real-world train timetabling problem in a railway node. Omega 2016, 58, 97–110. [Google Scholar] [CrossRef]
- Broman, E.; Eliasson, J.; Aronsson, M. Efficient capacity allocation on deregulated railway markets. J. Rail Transp. Plan. Manag. 2022, 21, 100294. [Google Scholar] [CrossRef]
- Lubin, M.; Dowson, O.; Garcia, J.D.; Huchette, J.; Legat, B.; Vielma, J.P. JuMP 1.0: Recent improvements to a modeling language for mathematical optimization. Math. Program. Comput. 2023, 15, 581–589. [Google Scholar] [CrossRef]
- Zhou, X.; Zhong, M. Single-track train timetabling with guaranteed optimality: Branch-and-bound algorithms with enhanced lower bounds. Transp. Res. Part B Methodol. 2007, 41, 320–341. [Google Scholar] [CrossRef]
- D’Ariano, A.; Pranzo, M.; Hansen, I.A. Conflict Resolution and Train Speed Coordination for Solving Real-Time Timetable Perturbations. IEEE Trans. Intell. Transp. Syst. 2007, 8, 208–222. [Google Scholar] [CrossRef]
- Danavulapadu, V.P.; Singamsetty, P. Trains scheduling problem with multiple lines. Sci. Rep. 2024, 14, 31129. [Google Scholar] [CrossRef]
- Bettinelli, A.; Santini, A.; Vigo, D. A real-time conflict solution algorithm for the train rescheduling problem. Transp. Res. Part B Methodol. 2017, 106, 237–265. [Google Scholar] [CrossRef]
- Şahin, İ. Railway traffic control and train scheduling based oninter-train conflict management. Transp. Res. Part B Methodol. 1999, 33, 511–534. [Google Scholar] [CrossRef]
- Van Thielen, S.; Corman, F.; Vansteenwegen, P. Towards a conflict prevention strategy applicable for real-time railway traffic management. J. Rail Transp. Plan. Manag. 2019, 11, 100139. [Google Scholar] [CrossRef]
- Li, Y. Deep reinforcement learning: An overview. arXiv 2017, arXiv:1701.07274. [Google Scholar]
- Liu, E.; Lin, Z.; Wang, J.Y.; Chen, H. A Mobile Data-Driven Hierarchical Deep Reinforcement Learning Approach for Real-time Demand-Responsive Railway Rescheduling and Station Overcrowding Mitigation. arXiv 2023, arXiv:2308.11849. [Google Scholar]
- Tang, T.; Chai, S.; Wu, W.; Yin, J.; D’Ariano, A. A multi-task deep reinforcement learning approach to real-time railway train rescheduling. Transp. Res. Part E Logist. Transp. Rev. 2025, 194, 103900. [Google Scholar] [CrossRef]
- Yue, P.; Jin, Y.; Dai, X.; Feng, Z.; Cui, D. Reinforcement Learning for Scalable Train Timetable Rescheduling with Graph Representation. IEEE Trans. Intell. Transp. Syst. 2024, 25, 6472–6485. [Google Scholar] [CrossRef]
- Lusby, R.M.; Larsen, J.; Bull, S. A survey on robustness in railway planning. Eur. J. Oper. Res. 2018, 266, 1–15. [Google Scholar] [CrossRef]
- Schneider, S.; Ramesh, A.; Roets, A.; Stirbu, C.; Safaei, F.; Ghriss, F.; Wülfing, J.; Güra, M.; Sibon, N.; Gentry, R.; et al. Intelligent Railway Capacity and Traffic Management Using Multi-Agent Deep Reinforcement Learning. In Proceedings of the 2024 IEEE 27th International Conference on Intelligent Transportation Systems (ITSC), Edmonton, AB, Canada, 24–27 September 2024; pp. 1743–1748. [Google Scholar]
- Zhao, W.X.; Zhou, K.; Li, J.; Tang, T.; Wang, X.; Hou, Y.; Min, Y.; Zhang, B.; Zhang, J.; Dong, Z.; et al. A survey of large language models. arXiv 2023, arXiv:2303.18223. [Google Scholar]
- Cacchiani, V.; Huisman, D.; Kidd, M.; Kroon, L.; Toth, P.; Veelenturf, L.; Wagenaar, J. An overview of recovery models and algorithms for real-time railway rescheduling. Transp. Res. Part B Methodol. 2014, 63, 15–37. [Google Scholar] [CrossRef]
- Bragin, M.A. Survey on Lagrangian relaxation for MILP: Importance, challenges, historical review, recent advancements, and opportunities. Ann. Oper. Res. 2024, 333, 29–45. [Google Scholar] [CrossRef]
- Rodríguez, J. A constraint programming model for real-time train scheduling. INFORMS J. Comput. 2007, 19, 50–63. [Google Scholar] [CrossRef]
- D’Ariano, A.; Pranzo, M.; Hansen, I.A. Conflict resolution and train speed coordination for real-time railway traffic management. IEEE Trans. Intell. Transp. Syst. 2008, 9, 228–244. [Google Scholar]
- Zhang, Y.; Zhang, Z.; Zeng, Y.; Wu, T. Constraint programming for multi-line parallel partial disassembly line balancing problem with optional common stations. Appl. Math. Model. 2023, 122, 435–455. [Google Scholar] [CrossRef]
- Lövei, I.; Kővári, B.; Bécsi, T.; Aradi, S. Environment Representations of Railway Infrastructure for Reinforcement Learning-Based Traffic Control. Appl. Sci. 2022, 12, 4465. [Google Scholar] [CrossRef]
- Roderick, M.; MacGlashan, J.; Tellex, S. Implementing the Deep Q-Network. arXiv 2017, arXiv:1711.07478. [Google Scholar] [CrossRef]
- Jin, K.H.; Wi, J.A.; Lee, E.J.; Kang, S.J.; Kim, S.K.; Kim, Y.B. TrafficBERT: Pre-trained model with large-scale data for long-range traffic flow forecasting. Expert Syst. Appl. 2021, 186, 115738. [Google Scholar] [CrossRef]
- Guo, X.; Zhang, Q.; Jiang, J.; Peng, M.; Zhu, M.; Yang, H.F. Towards explainable traffic flow prediction with large language models. Commun. Transp. Res. 2024, 4, 100150. [Google Scholar] [CrossRef]
- Li, Z.; Deng, X.; Feng, C.; Li, H.; Wang, S.; Zhang, H.; Jia, T.; Chen, C.; Wu, L.L.; Wang, J. LLM4Rail: An LLM-Augmented Railway Service Consulting Platform. arXiv 2025, arXiv:2507.23377. [Google Scholar]
- Chen, A.; Tian, Y.; Zhang, J.; Li, C.; Zhang, H. LLM-based intelligent Q&A system for railway locomotive maintenance standardization. Sci. Rep. 2025, 15, 12953. [Google Scholar]
- Huang, W.; Deng, X. Real-time tracking railway intruders using multiple-agent cooperated large language models with edge stream processing engine. J. Netw. Comput. Appl. 2025, 242, 104231. [Google Scholar] [CrossRef]
- Tan, M.; Merrill, M.A.; Gottesman, Z.; Althoff, T.; Evans, D.; Hartvigsen, T. Inferring Event Descriptions from Time Series with Language Models. arXiv 2025, arXiv:2503.14190. [Google Scholar] [CrossRef]
- Back, W.E.; Boles, W.W.; Fry, G.T. Defining triangular probability distributions from historical cost data. J. Constr. Eng. Manag. 2000, 126, 29–37. [Google Scholar] [CrossRef]
- Mansourian, A.M.; Ahmadi, R.; Ghafouri, M.; Babaei, A.M.; Golezani, E.B.; Ghamchi, Z.Y.; Ramezanian, V.; Taherian, A.; Dinashi, K.; Miri, A.; et al. A Comprehensive Survey on Knowledge Distillation. arXiv 2025, arXiv:2503.12067. [Google Scholar] [CrossRef]
- Carta, S.; Giuliani, A.; Piano, L.; Podda, A.S.; Pompianu, L.; Tiddia, S.G. Iterative zero-shot llm prompting for knowledge graph construction. arXiv 2023, arXiv:2307.01128. [Google Scholar] [CrossRef]
- Wei, J.; Wang, X.; Schuurmans, D.; Bosma, M.; Ichter, B.; Xia, F.; Chi, E.; Le, Q.; Zhou, D. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv 2023, arXiv:2201.11903. [Google Scholar] [CrossRef]
- Yang, A.; Li, A.; Yang, B.; Zhang, B.; Hui, B.; Zheng, B.; Yu, B.; Gao, C.; Huang, C.; Lv, C.; et al. Qwen3 Technical Report. arXiv 2025, arXiv:2505.09388. [Google Scholar] [CrossRef]



| Timetable Scale | Success Rate (%) | |||||
|---|---|---|---|---|---|---|
| Trains | Events | Conflicts | Heur. | PPO | TrafS. | TrafS. + LLMs |
| 50 | 1160 | 42 | 88.90 | 64.29 | 100.00 | 100.00 |
| 60 | 1429 | 53 | 79.24 | 60.38 | 88.68 | 90.57 |
| 70 | 1683 | 53 | 47.17 | 47.17 | 98.11 | 96.23 |
| 80 | 1906 | 70 | 42.86 | 58.57 | 80.00 | 84.29 |
| 90 | 2113 | 71 | 42.25 | 57.75 | 74.65 | 85.92 |
| 100 | 2335 | 79 | 44.30 | 44.30 | 88.61 | 89.87 |
| 110 | 2597 | 92 | 46.74 | 30.43 | 76.09 | 81.52 |
| 120 | 2890 | 107 | 36.48 | 36.48 | 79.44 | 85.05 |
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. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.
Share and Cite
Fan, W.; Xu, L.; Zeng, Y.; Xia, S.; Cui, X.; Shi, J.; Lin, S.; Zhang, M.; Guo, Y.; Zhang, X.; et al. TrafSched: Integrating Bayesian Adaptation with LLMs for Traffic Scheduling Optimization. Electronics 2026, 15, 695. https://doi.org/10.3390/electronics15030695
Fan W, Xu L, Zeng Y, Xia S, Cui X, Shi J, Lin S, Zhang M, Guo Y, Zhang X, et al. TrafSched: Integrating Bayesian Adaptation with LLMs for Traffic Scheduling Optimization. Electronics. 2026; 15(3):695. https://doi.org/10.3390/electronics15030695
Chicago/Turabian StyleFan, Wentian, Li Xu, Yongcheng Zeng, Siyu Xia, Xinyu Cui, Junyan Shi, Shu Lin, Mengyao Zhang, Yiwei Guo, Xin Zhang, and et al. 2026. "TrafSched: Integrating Bayesian Adaptation with LLMs for Traffic Scheduling Optimization" Electronics 15, no. 3: 695. https://doi.org/10.3390/electronics15030695
APA StyleFan, W., Xu, L., Zeng, Y., Xia, S., Cui, X., Shi, J., Lin, S., Zhang, M., Guo, Y., Zhang, X., & Zhang, H. (2026). TrafSched: Integrating Bayesian Adaptation with LLMs for Traffic Scheduling Optimization. Electronics, 15(3), 695. https://doi.org/10.3390/electronics15030695

