1 Introduction

Timetable scheduling is a combinatorial optimization problem that poses significant difficulties for classical computers. Due to the large scale and complexity of such NP-hard problems, classical algorithms typically either require unrealistic running times or fail to produce optimal solutions. In light of these limitations, quantum computing offers an attractive alternative for more efficient solutions to combinatorial optimization problems.

The concept of quantum computing and its related ideas can be traced back to 1980 when physicist Paul Benioff proposed a quantum Hamiltonian model of the Turing machine [1], and mathematician Yuri Manin pointed out the potential of quantum computers to surpass their classical counterparts. In 1986, Feynman introduced the prototype concept of quantum circuits [2]. The development of Shor’s quantum algorithm for integer factorization (later known as the “Shor’s algorithm”) in 1994 [3], followed by the Grover search algorithm [4], represented important progress in quantum algorithms and computing research. Based on categorization criteria proposed by Peng [5] and Cooper [6], existing quantum algorithms can be classified into two primary categories, as illustrated in Fig. 1: algorithms that run on quantum computers and algorithms that use the principles of quantum mechanics but run on classical computers [7,8,9,10].

Fig. 1
figure 1

Category of quantum algorithms

In the category of algorithms that run on quantum computers, there are quantum annealing algorithms as well as algorithms that operate under the framework of CIM (coherent Ising machine) [11]. Quantum annealing algorithm [12,13,14,15] is implemented on quantum annealing computers, with one of the most popular and widely used ones designed by D-Wave [16,17,18,19]. Algorithms running on CIM [20,21,22]. The CIM based on photonic quantum systems exhibits technical advantages such as room temperature operation, coherent optical encoding, and full connectivity [23, 24]. These two algorithms are generally considered to be well-suited and efficient for solving optimization problems [25]. Additionally, it is worth noting that while quantum computers are not yet highly mature, quantum simulators can be used to address these problems. The CIM simulator is a software implementation of the physical CIM system, designed to simulate and evaluate the performance and effectiveness of CIM in solving various problems. The CIM simulator utilizes numerical methods to simulate the operation process of CIM, providing a convenient means to explore and study optimization and computing tasks in different problem domains. In this research, the method of utilizing quantum simulators is employed to solve the problem of train timetable scheduling.

In recent years, there is a line of research applying quantum computing to the train scheduling problems. Domino et al. [26] introduced a quadratic unconstrained binary optimization (QUBO) model for the railway dispatching problem and solve the real-life case from the Polish railway network using D-Wave quantum annealers. Two years later, Domino et al. [27] proposed higher-order binary optimization (HOBO) formulation to use quantum annealing solving the railway rescheduling problem. The proof of concept implementation was demonstrated on the D-Wave quantum processing unit and D-Wave hybrid solver. Grozea et al. [28] focused on rolling stock optimization including maintenance tasks and compared constraint programming with quantum annealing methods.

It is observed that the complicated constraints that are hard to deal with always exist in train scheduling problems. To address this issue, in paper [29], for vehicle routing problem with pickup and delivery services with time windows (VRPPDTW), the state–space–time networks were constructed, and then a multi-commodity network flow programing model was established. The presence of multi-dimensional decision variables posed computational challenges when dealing with large-scale real-world data sets. Therefore, the problem was reformulated by Lagrangian relaxation (LR) approach, i.e., relaxing one complex constraint into the objective function and introducing Lagrangian multiplier \(\lambda (p)\) alongside to construct the dualized Lagrangian function. In this paper, we reformulate the problem into QUBO model, which means all constrains are put into the objective function and the penalty coefficient are added.

This paper aims to optimize train space–time paths for the high-speed train timetable problem by providing daily schedule sets from historical schedules [30, 31]. Based on quantum computing technics, we contributed the following advancements to the research on the high-speed train timetable optimization:

  1. (1)

    A simplified knapsack problem model (Sect. 2.2) is proposed to test the arithmetic power of quantum computing.

  2. (2)

    To fit the requirements of quantum simulators of solving the timetable scheduling problem, a QUBO model (Sect. 2.3) is introduced and transformed.

  3. (3)

    In order to compare the effectiveness of quantum simulators, two quantum algorithms including simulated annealing and CIM are utilized to solve the proposed QUBO model in different problem scales.

The structure of this paper is as follows: Sect. 2 presents our proposed integer programming flow model and binary integer programming model, which are based on the candidate-train-set and their corresponding QUBO models. In Sect. 3, various solution methods, including the CIM simulator, are discussed along with the presentation of four illustrative examples of different scales. Finally, the conclusions are provided in Sect. 4.

2 Mathematical model

Four models on timetable scheduling are constructed: ①Model ST (Space–time Network-Based Integer Programming Model), ②Model ST-QUBO (QUBO model of Model ST), ③Model KP (Knapsack Problem Reformulation [30] of Space–time Network Based Model), ④Model KP -QUBO (QUBO model of Model KP).

2.1 Space–time network-based integer programming model

2.1.1 Problem description

Based on graph theory, an optimization model using the space–time network is established for high-speed train timetabling [32]. To facilitate problem analysis, we abstract the train running time and state using the space–time network and discretize time into a single node. Passenger-oriented train timetables typically have a time accuracy of 1 min, and a day is divided into 1440 time nodes with 1 min as the unit, enabling the construction of space–time nodes and ensuring the accuracy requirements for describing the running state of high-speed trains. The space–time network represents the running states of the trains and the occupation of resources, with the horizontal axis representing the time dimension and the vertical axis representing the spatial dimension. The problem at hand is a typical large-scale combinatorial optimization problem.

2.1.2 Model assumptions

To enhance the alignment between the optimization model and real-world scenarios, and to increase its practical value, the following assumptions are made.

(1) Independence of upstream and downstream systems:

It is assumed that the upstream and downstream systems are completely independent. This means that in the model construction, only one direction of train operation is considered, while the optimization for the other direction can be conducted in a similar manner.

(2) Homogeneity of trains:

The assumption is made that trains are homogeneous. Currently, trains are primarily categorized into two grades: high-grade trains with fast running speeds and low-grade trains with relatively slower speeds. Trains within the same grade share the same standards for factors such as interval running speed, dwelling time, and additional time required for train starting and stopping.

(3) Known order of train operation:

To ensure the balance of passenger transportation services provided by the operation department, this paper roughly arranges the departure sequence of trains based on the actual train operation chart's departure times. However, it should be noted that the actual departure time and sequence might differ from the operational chart.

(4) Availability of adequate resources for train movement:

Furthermore, it is assumed that sufficient resources, such as the number of train sets and crews, are available to facilitate the optimization of train-stopping schemes and timetable preparation.

2.1.3 Symbol definition

To ensure clarity and understanding, we will start by defining the sets, parameters, decision variables, and their corresponding symbols that are pertinent to the collaborative optimization model of the train stopping scheme and operation diagram. The definitions are presented as follows (Tables 1, 2).

Table 1 Sets, indices, and parameters
Table 2 Decision variables

2.1.4 Objective functions

2.1.4.1 Minimize the total train travel time costs

In actual railway transportation operations, the primary goal of railway authorities is to minimize operating costs without compromising the quality of passenger service. To evaluate the quality of the train timetable, the total train travel time is considered as it reflects both the turnaround time and the utilization of transportation resources. Hence, minimizing the total train travel time serves as the initial optimization objective within the model. The cost associated with the total train travel time can be represented by the sum of the time costs for all trains within the selected arc.

$$ Z_{1} = \sum\limits_{k \in K} {\sum\limits_{{\left( {i,j,t,t^{\prime}} \right) \in A^{k} }} {c_{{i,j,t,t^{\prime}}}^{k} } } \cdot x_{{i,j,t,t^{\prime}}}^{k} $$
(1)
2.1.4.2 Minimize the total train departure delay at the departure station

In order to ensure a balanced service to passengers, it is desired for trains to adhere to their desired departure time as much as possible. So the second optimization objective of this paper is to choose the minimum total departure delay of trains at the departure station.

$$ Z_{2} = \sum\limits_{k \in K} {\sum\limits_{{\left( {i,j,t,t^{\prime}} \right) \in A^{{{\text{owait}}\;}} }} {\left( {t_{{k^{\prime}}} - t_{k}^{E} } \right)} } \cdot x_{{i,j,t,t^{\prime}}}^{k} $$
(2)
2.1.4.3 Minimize the number of train stops

Each additional stop for high-speed trains results in increased starting and stopping times, as well as an extended total stopping time. This not only diminishes the high-speed and convenient advantages of these trains, impacting passenger travel experience but also leads to wasted operational capacity on the timetable. Therefore, the train stopping settings should minimize the number of unnecessary stops while still meeting the passenger flow exchange demand between stations, thereby ensuring a more rational and balanced distribution of stops. Therefore, the third optimization objective of the model is to minimize the number of stops for all trains.

$$ Z_{3} = \sum\limits_{i \in N} {\sum\limits_{k \in K} {y_{ki} } } $$
(3)

In order to construct a unified optimization objective, this paper introduces the corresponding weight coefficients \(\alpha_{1}\), \(\alpha_{1}\) and \(\alpha_{2}\) to the three optimization objectives. In particular, the values of \(\alpha_{1}\) and \(\alpha_{2}\) belong to [0,1] and satisfy the condition \(\alpha_{1} + \alpha_{2} = 1\). The above problem with three optimization objectives is converted into a single-objective optimization problem, and the weighted sum of the above three costs is used as the optimization objective to construct. The objective function of Model ST is as follows.

$$ \begin{aligned} minZ &= \sum\limits_{k \in K} \sum\limits_{{\left( {i,j,t,t^{\prime}} \right) \in A^{k} }} {\alpha_{1} } \cdot c_{{i,j,t,t^{\prime}}}^{k} \cdot x_{{i,j,t,t^{\prime}}}^{k} + \alpha_{1} \sum\limits_{i \in N} {\sum\limits_{k \in K} {y_{ki} } }\hfill\\ &\quad+\,\, \alpha_{2} \cdot \sum\limits_{k \in K} {\sum\limits_{{\left( {i,j,t,t^{\prime}} \right) \in A^{{{\text{ovait}}\;}} }} {\left( {t_{{k^{\prime}}} - t_{k}^{E} } \right)} } \cdot x_{{i,j,t,t^{\prime}}}^{k}\hfill \end{aligned}$$
(4)

2.1.5 Constraints

The constraints of Model ST are shown as follows.

2.1.5.1 Constraint on the number of stops of a single train

In order to meet the demand of passenger boarding and alighting, and at the same time to ensure the requirements of running speed of different classes of trains, it is necessary to determine the number of train stops. The requirements on the number of stops for different classes of trains are different, so the upper and lower limits of the number of stops for different classes of trains should be scientifically determined and constructed as follows.

$$ g_{k} \cdot G_{l} + \left( {1 - g_{k} } \right) \cdot D_{l} \le \sum\limits_{{i \in N^{k} }} {y_{ki} } \le g_{k} \cdot G_{h} + \left( {1 - g_{k} } \right) \cdot D_{h} ,\quad \forall k \in K $$
(5)
2.1.5.2 Station service frequency constraint

In order to meet the passenger demand between stations, each station has the requirement of minimum number of stops. The number of trains stopping at a station needs to meet the service frequency constraint of that station, which is constructed as follows:

$$ \sum\limits_{k \in K} {y_{ki} } \ge \underline{{f^{i} }} ,\quad \forall i \in N $$
(6)
2.1.5.3 Train stopping time constraints

In the space–time network, the selection of station stop arcs in the space–time path of the train and their space–time length describe the stopping operation of the train and the corresponding stopping time. If \(y_{ki} = 1\), train \(k\) stops at station \(i\) (not the train departure and arrival station), the stopping time of train \(k\) at station \(i\) should be no less than the minimum stopping time \(t_{i}^{min}\) to ensure that the train can successfully complete the necessary technical operations, such as passenger boarding and alighting, crew shift change, etc., during the stopping. Based on the correlation analysis of the train stopping scheme and the operation diagram decision variables before, the following is constructed.

$$ \sum\limits_{{t^{\prime}}} {\sum\limits_{t} {x_{{i,i,t,t^{\prime}}}^{k} } } \ge y_{ki} \cdot t_{i}^{min} ,\quad \forall i \in N_{k} \quad {\text{and}}\quad i \notin \left( {\left\{ {o_{k} } \right\} \cup \left\{ {d_{k} } \right\}} \right) $$
(7)
$$ \sum\limits_{{t^{\prime}}} {\sum\limits_{t} {x_{{i,i,t,t^{\prime}}}^{k} } } \le y_{ki} \cdot t_{i}^{max} ,\quad \forall i \in N_{k} \quad {\text{and}}\quad i \notin \left( {\left\{ {o_{k} } \right\} \cup \left\{ {d_{k} } \right\}} \right) $$
(8)

Considering only a minimum stopping time constraint in the model cannot guarantee that when \(y_{ki} = 0\), \(x_{{i,i,t,t^{\prime}}}^{k}\) is also 0, i.e., no station stopping arc is selected, so in this paper, by adding a constraint of maximum train stopping time (Cons.8), the two constraints together form a standard constraint of train stopping time, which makes the optimization result of the train operation diagram more scientific, while the maximum stopping time constraint can also reduce the feasible domain of the model and improve the solving efficiency of the model.

2.1.5.4 Flow balancing constraints

The flow balance constraint is the basic constraint in solving the path selection optimization problem using graph theory. In practice, the flow of trains at each origin, intermediate and destination space–time nodes in the operation path should always be balanced, i.e., trains in the space–time network can only choose one space–time arc segment from the origin to the destination, and the entire space–time path of the train should be guaranteed to be continuous and uninterrupted at the intermediate nodes. The space–time path of each train is unique and the construction constraint is as follows.

$$ \sum\limits_{{\left( {i,j,t,t^{\prime}} \right) \in A_{i}^{k, + } }} {x_{{i,j,t,t^{\prime}}}^{k} } - \sum\limits_{{\left( {j,i,t^{\prime},t} \right) \in A_{i}^{k, - } }} {x_{j,i,t,t}^{k} } = \left\{ {\begin{array}{*{20}c} {1,} & {i = o_{k} ,\quad t = t_{k}^{E} } \\ { - 1,} & {i = d_{k} ,\quad t = t_{k}^{d} } \\ {0,} & {{\text{otherwise}}\;} \\ \end{array} } \right. $$
(9)

Since the arrival time of the train is difficult to determine before optimization, but all trains must complete the transportation service within the operation time, this paper treats the virtual terminal as the end point in the whole space–time network of train operation. In addition, in order to ensure the provision of transportation services as balanced as possible, trains have their determined desired departure time, which is used as the time attribute of the train departure waiting arc in the space–time network in this paper.

2.1.5.5 Constraint on the departure time expectation of the starting station

In order to provide balanced transportation services to passengers as much as possible, each train has a corresponding desired departure time \(t_{k}^{E}\) at the departure station. In practice, if trains operate strictly according to this time, and the time is not set reasonably enough, coupled with factors such as mutual interference between trains of different speeds, it may lead to conflicts between trains or cause waste of operating chart capacity. Therefore, this paper allows trains to fluctuate somewhat at the departure station compared to the desired departure moment, and at the same time, in order to ensure the necessary preparation activities before train departure, trains are only allowed to delay departure, with the delay time set to \(T\).

In this paper, the desired departure moment of the train at the origin station is regarded as the arrival moment of the train at that station (from the virtual origin station), and thus the constraint can be expressed as the stopping time of the train at the origin station is not greater than the maximum delay of the train departure at the origin station, which is constructed as follows.

$$ \sum\limits_{{t^{\prime}}} {\sum\limits_{t} {x_{{i,i,t,t^{\prime}}}^{k} } } \le \Delta T,\quad \forall \left( {i,i,t,t^{\prime}} \right) \in A^{{{\text{owait}}\;}} ,\quad \forall k \in K $$
(10)
2.1.5.6 Station stopping capacity constraint

Since a station has only a limited number of mainline and arrival and departure line resources, the station's stopping capacity constraint limits the maximum number of trains stopping at the station at the same time, and its value should be less than or equal to the maximum train stopping capacity of the station.

In the space–time network, the number of trains occupying the resources of a station at the same time can be expressed by the number of stopping arcs at the station at that time. In this paper, the stopping time of trains is discretized into intervals of 1 min, and then the station stopping capacity constraint is constructed as follows.

$$ \sum\limits_{k \in K} {\sum\limits_{{t^{\prime}}} {x_{{i,i,t,t^{\prime}}}^{k} } } \le R_{i} ,\quad \forall \left( {i,i,t,t^{\prime}} \right) \in A^{{{\text{dwell}}\;}} ,\quad \forall i \in N/1,|N| $$
(11)
2.1.5.7 Train safety interval constraint (departure and arrival)

In order to ensure the safety of trains, the continuous arrival and continuous departure of trains need to meet certain interval time criteria, so the constraint can be specifically subdivided into constraints on the departure and arrival intervals of trains at stations. In this paper, we define the incompatible arc set \(\Omega_{{\left( {i,i^{\prime},j,j^{\prime}} \right)}}\) to express the constraints on the departure and arrival time interval between two trains, for the interval running arc \((i,j,t,t^{\prime}\;) \in \;A^{{{\text{drive}}}}\) of the space–time network, its incompatible arc set \(\Omega_{{\left( {i,i^{\prime},j,j^{\prime}} \right)}}\) is defined as

$$ \Omega_{{\left( {i,j,t,t^{\prime}} \right)}} = \left\{ {\left( {i,j,\tau ,\tau^{\prime}} \right):|t - \tau | < h_{dep}^{min} \bigcup {\left| {t^{\prime} - \tau^{\prime}} \right|} < h_{arr}^{min} } \right\}. $$
(12)

The parameters \(h_{dep}^{min}\) and \(h_{arr}^{min}\) denote the minimum departure and arrival intervals between two trains, respectively. Equation (11) indicates that if arc \(\left( {i,j,t,t^{\prime}} \right) \in A^{{{\text{drive}}\;}}\) is used by a train, then for any arc \(\left( {i,j,\tau ,\tau^{\prime}} \right) \in A^{{{\text{drive}}\;}}\), as long as the arrival between the \(arc(i,j,t,t^{\prime})\) or departure interval is less than the minimum, all belong to the incompatible arc set \(\Omega_{{\left( {i,i^{\prime},j,j^{\prime}} \right)}}\), which cannot be used by other trains, and thus construct the train safety interval constraint as follows.

$$ \sum\limits_{k \in K} {\sum\limits_{{\left( {i,i^{\prime},j,j^{\prime}} \right) \in \Omega_{{\left( {i,i^{\prime},t,t^{\prime}} \right)}} }} {x_{{i^{\prime},j^{\prime},\tau ,\tau^{\prime}}}^{k} } } \le 1,\quad \forall \left( {i,j,t,t^{\prime}} \right) \in A^{{{\text{drive}}}} $$
(13)
2.1.5.8 Interval crossing constraint

In order to improve the efficiency of the utilization of the resources of the operation chart, generally the high-grade trains will cross the low-grade trains to improve the passing capacity of the interval, but since the interval does not have the crossing condition, the crossing cannot occur in the interval. When the trains in the same direction interval run at different speeds, each train may clash although they satisfy the train safety interval constraint, and then the constraint needs to be considered.

$$ x_{{i,j,\tau ,\tau^{\prime} + T_{i,j}^{k} }}^{k} + \sum\limits_{{t \in \left[ {\tau ,\tau + \tau_{i,j}^{k} } \right]}} {\sum\limits_{{t^{\prime}\left[ {\tau ,\tau + \tau_{i,j}^{k} } \right]}} {x_{{i,j,t,t^{\prime}}}^{{k^{\prime}}} } } \le 1,\quad \forall i,j,k,k^{\prime},\tau $$
(14)

Because of the existence of the train safety interval constraint, interval crossing of trains in the same direction occurs when and only when the running time of two trains satisfies \(T_{i,j}^{k} - T_{i,j}^{{k^{\prime}}} > h_{dep}^{min} + h_{arr}^{min}\).

2.1.5.9 Maintenance gap constraint

China's high-speed railroads specify the maintenance for 00:00–6:00, in this time period, train operation is prohibited, in the space–time network can be expressed as the skylight range of space–time arc occupancy variables take the value of 0, the construction of the following.

$$ x_{{i,j,t,t^{\prime}}}^{k} = 0,\forall k \in K,\forall i,j \in N,\forall 0 \le t,t^{\prime} \le 360 $$
(15)
2.1.5.10 Constraints on the value of decision variables
$$ x_{{i,j,t,t^{\prime}}}^{k} \in 0,1,\quad \forall k \in K,\quad \left( {i,j,t,t^{\prime}} \right) \in A $$
(16)
$$ y_{ki} \in 0,1,\quad \forall k \in K,\quad i \in N $$
(17)

Model ST involves a wide range of influencing factors, and in the process of solving them, all of them will explode in combination as the scale of the problem expands, [33] i.e., it is impossible to solve to an exact solution in polynomial time. This model is hence still complicated for quantum computing in the solution process, and the solution results are almost always infeasible. To solve this problem, we propose a simplified model to test the arithmetic power of quantum computing.

2.2 Knapsack problem reformulation of space–time network-based model

We use the space–time network model and historical timetable data to generate train running line, then we propose a 0–1 integer programming model based on the knapsack problem to simplify the model, which fixes the decision variables such as train arrival and departure times and train stops in the original model and uses the historical train trajectory selection as the core decision variable.

2.2.1 Symbol description

The definition of the sets, parameters, decision variables, and their notation involved in the binary integer programming model based on knapsack problem is shown in Tables 3 and 4.

Table 3 Sets, index, and parameters
Table 4 Decision variables

2.2.2 Objective function

With the objective of optimizing the maximum number of train running lines to be drawn, the objective function is as Eq. (18).

$$ \max Z = \sum\limits_{k \in K} {x_{k} } $$
(18)

2.2.3 Constraints

This paper mainly considers the train headway constraint. In order to describe this constraint, firstly the incompatible arc set is defined as shown in ①, and then the constraint expression is given as shown in ②.

①Set of incompatible arcs.

In order to ensure the safety of trains, the continuous arrivals and departures of trains need to meet minimum headway constraint. In this paper, for each train running line \(k \in K\), a set of incompatible arcs \(N_{k}\) is defined in Eq. (19).

$$ N_{k} = \left\{ {k:\;|t_{{k^{\prime}v}} - t_{kv} | < h^{min} } \right\}\forall v \in V,\quad \forall k^{\prime} \in K,\quad k \ne k^{\prime} $$
(19)

②Expression for the train safety interval constraint.

In the final selection of running arcs to form the timetable, it is required that no more than one running arc is selected from each incompatible arc set, and thus the train safety headway constraint is constructed as Eq. (20).

$$ x_{k} \cdot \sum\limits_{{k^{\prime} \in N_{k} }} {x_{{k^{\prime}}} } = 0,\quad \forall N_{k} \in {\mathbb{N}} $$
(20)

2.3 QUBO representation of the models

2.3.1 QUBO representation of model ST

While the QUBO formulation does not inherently support constraints, it is possible to incorporate constraints into the optimization process. These constraints can be effectively handled by translating them into penalty terms that impact the objective function. By reformulating constraints as quadratic equations and adding them to the objective function, we can ensure that they influence the optimization process. For detailed derivation rules regarding the transformation of non-QUBO models into QUBO models, please refer to Appendix.

For the inequality constraints existed in the Model ST, the slack positive integer variables \(s_{p}\) need to be introduced to transform inequalities into equalities. And \(s_{p} = \sum\nolimits_{q = 0}^{{r_{s} }} {2^{q} v_{q} }\) where \(r_{s}\) is an integer and \(v_{q}\) is binary variable [34]. Each penalty should be multiplied by a positive constant \(\lambda\) to have comparable magnitude with the objective function. A simpler example of such transformation is shown in Appendix. And the QUBO formulation result is shown as follows.

2.3.2 QUBO representation of model KP

Binary integer programming model based on knapsack problem mentioned in Sect. 2.2 is formulated as a QUBO problem. And the corresponding QUBO model is constructed as follows.

To transform the integer programming model described in Sect. 2.2 into a QUBO model, a three-step process is employed. First, we introduce a parameter, denoted as \(\lambda\), which serves as the penalty coefficient for handling constraints. Second, we modify the constraint equation [Eq. (20)] by multiplying it with the penalty coefficient, thereby transforming the inequalities into equations. Subsequently, these modified equations are integrated into the objective function. The resulting objective function is expressed as Eq. (21).

$$ \min \;\;\left[ { - \sum\limits_{k \in K} {x_{k} } + \lambda \cdot x_{k} \cdot \sum\limits_{{k^{\prime} \in N_{k} }} {x_{{k^{\prime}}} } } \right] $$
(21)

2.4 Comparisons among the proposed models

The relationship of the four proposed models is shown in Fig. 2.

Fig. 2
figure 2

Relationship of the four proposed models

In this paper, Fig. 2 illustrates the integration of models introduced in Sects. 2.2 and 2.3. We present Model ST, the space–time network model for integer programming, alongside its corresponding QUBO model, referred to as Model ST-QUBO. Similarly, model KP, the alternative set solution model for integer programming, is displayed alongside its corresponding QUBO model, Model KP-QUBO. This visual representation facilitates a clear understanding of the relationships between these models and their formulations, offering a valuable tool for those interested in exploring the optimization of space–time networks using integer programming and QUBO models.

A comprehensive comparison among the four proposed models is shown in Table 5.

Table 5 Comparisons among the four proposed models

3 Algorithms and analysis

We have used Model ST and Model ST-QUBO to solve the train scheduling problem. However, due to the complexity of this type of model and limited capacity of quantum simulator, the solving results were not satisfactory. Therefore, we decide to focus on Model KP and Model KP-QUBO for analysis. Two different algorithms are applied to solve these two models. For the general Model KP, we use the classical optimization solver Gurobi, whose result serves as a control group. For Model KP-QUBO, we apply SA (simulated annealing) and Kaiwu-SDK. The process of using a coherent Ising machine (CIM) to solve the QUBO model involves inputting the \(q_{ij}\) from the QUBO into the CIM, and then the CIM returns the value of decision variables. And Kaiwu-SDK is a software development kit developed by QBoson company for solving QUBO problems using CIM.

3.1 Numerical calculations

3.1.1 Defining penalty value \(\lambda\)

To assess the feasibility of the models, we initially employ the Gurobi solver and then investigate how the penalty term \(\lambda\) affects the QUBO problem, taking the example of 100 trains as an instance. Within the QUBO model of the problem, there exists a single penalty term \(\lambda\), and as \(\lambda\) assumes different values, the solution outcome of the QUBO problem undergoes changes. Theoretically, a larger value of \(\lambda\) should result in a better solution. However, it is crucial to note that a higher \(\lambda\) value also leads to longer solution times. Therefore, considering the attainment of a reasonable solution time while ensuring that the penalty term value and the original objective function value are within the same order of magnitude, we choose \(\lambda = 100\) as the penalty term for subsequent quantum solver experiments.

3.1.2 Numerical studies on SA

We employ simulated annealing (SA) to tackle this QUBO problem, utilizing 100 quantum bits with 168 different coefficients. The SA solution function includes several input parameters that require adjustment based on the quality of the solution obtained during the solving process, aiming to uncover the optimal solution.

  • \(T_{{{\text{init}}}}\): initial temperature of simulated annealing.

  • \(\alpha\): temperature drop rate of simulated annealing.

  • \(T_{\min }\): minimum threshold temperature for simulated annealing.

  • \(Iters_{{{\text{per}}}}\): number of iterative runs per cycle.

\(T_{{{\text{init}}}}\) and \(Iters_{{{\text{per}}}}\) exert a substantial influence on the solution time and results, while the remaining parameter \(\alpha\) is fixed at 0.99 and \(T_{\min }\) is set to \(10^{ - 3}\). Our tests indicate that increasing \(T_{\min }\) yields a slight enhancement in solution quality without causing a notable change in solution time. Conversely, elevating the value of \(Iters_{{{\text{per}}}}\) significantly impacts the solution and can lead to improved solution quality. We observe that when \(T_{\min }\) falls within the range of 500–1000 and \(Iters_{{{\text{per}}}}\) also lies within the same range, a balance can be struck between solution quality and computational time.

3.2 Numerical studies on CIM

Kaiwu-SDK function has the following parameters, which also need to be adjusted according to the quality of the solution obtained during the solution process in order to find the optimal solution.

  • \(Pump\): pump rate.

  • \(Noise\): noise power.

  • \(Laps\): number of laps per run.

  • \(D_{t}\): time step per lap.

  • \(Normalization\): minimum negative eigenvalue normalization factor of the matrix.

  • \(iterations\): number of independent runs.

After testing, a set of parameter adjustment scheme has been summarized as follows:

The pump parameter is positively correlated with the solution quality in the interval of [0.5, 2] and does not affect the running time too much.

The noise parameter is adjusted in the interval of [0.001,0.5], increasing appropriately can increase the randomness of the solution and make it easier to obtain the optimal solution.

The iterations parameter is positively correlated with the quality of the solution within a certain range, but it will significantly affect the running time and should be choosed according to the application scenario.

3.3 Numerical cases

To test the effectiveness of different solution algorithms, four different sizes of alternative sets are given for testing. The tests are conducted on a computer with a Core i7-12700H with 32 GB of RAM, and the runtime on that computer is used as a benchmark for algorithm efficiency comparisons. When CIM finds the better solution, we compare the solution found by SA.

3.3.1 15-Train case

The case of 15 trains is used to test the correctness of the algorithm and the effect of running it under small-scale conditions. We formulate an alternative set of 15 trains, 2 of which have significantly conflicting relationships with other trains. The optimal solution in the case is 13 trains. In the test, all algorithms can find the correct result, where CIM uses parameter random strategy and SA is fixed parameter, the parameters are shown in the table. In the resulting figures, the horizontal axis of each subplot represents the timeline of the train schedule, while the vertical axis represents all the stations along the route. The movement of all trains is depicted by a green line, representing their respective trajectories. Additionally, we have included the optimal results achieved by the corresponding solver in the title of each subplot. The subsequent explanations of the charts remain the same as mentioned above (Table 6; Fig. 3).

Table 6 Results of 15-train case
Fig. 3
figure 3

Train schedule of 15-train case

3.3.2 30-Train case

The case of 30 trains is used to test the correctness of the algorithm and the effect of running it under medium-scale conditions. The optimal solution in the case is 25 trains.

We noticed that the solution of the SA and CIM quantum algorithm is not optimal (Table 7; Fig. 4).

Table 7 Results of 30-train case
Fig. 4
figure 4

Train schedule of 30-train case

3.3.3 50-Train case

The case of 50 trains is used to test the correctness of the algorithm and the effect of running it under medium-scale conditions. The optimal solution in the case is 41 trains (Table 8; Fig. 5).

Table 8 Results of 50-train case
Fig. 5
figure 5

Train schedule of 50-train case

3.3.4 100-Train case

The case of 100 trains is used to test the correctness of the algorithm and the effect of running it under large-scale conditions. The optimal solution in the case is 70 trains (Table 9; Fig. 6).

Table 9 Results of 100-train case
Fig. 6
figure 6

Train schedule of 100-train case

It is noteworthy that the quality of solutions obtained through CIM and SA quantum algorithms tends to diminish as the problem size increases. In the case of large-scale problems, CIM seems to produce infeasible solutions. In general, both methods demonstrate the capability to achieve optimal solutions with similar computation times in small-scale test cases. However, for medium-scale cases such as the 30 Train Case and 50 Train Case, the CIM method exhibits advantages in terms of solution quality over the SA method. The overall solution performance is depicted in the graph below (Fig. 7).

Fig. 7
figure 7

Comparison of running results

4 Conclusions

Quantum simulators have the potential to provide significant speed-ups for combinatorial optimization problems. To utilize these simulators, the first step is to convert the problem from its conventional notation into the QUBO form, which is the format required by quantum simulators. This paper presents the QUBO representation for the railway timetabling problem, which involves determining the optimal train schedule based on a given set of conflicting trains.

However, there are three primary reasons why the current solving speed and outcomes of quantum simulators are not yet ideal. Firstly, the number of qubits remains a bottleneck for current quantum devices [35], and thus it is preferable to use the smallest possible number of qubits for problem modeling. In addition, the values of the model parameters (such as pump rate, noise power, and times of simulated annealing) also affect the results. Furthermore, finding appropriate penalty values for QUBO problems is a challenging task. While we have used experiments and manual calibration to determine the penalty values for our railway timetabling problem, recent research has proposed several algorithms for penalty determination. For instance, the cross-entropy optimization [36] and another algorithm [37] tested successfully on the particular Fujitsu digital annealer. These methods may offer a more efficient and automated approach for determining penalty values in QUBO problems.

Looking ahead, as quantum devices continue to improve, we anticipate more efficient solutions for larger problem instances. This progress holds the potential to significantly enhance the practicality and applicability of quantum devices for solving complex optimization challenges. Moreover, the problem transformation into the QUBO framework is not exclusive to railway timetabling; its adaptability extends to a myriad of combinatorial optimization problems in transportation field, such as routing, scheduling, assignment and rostering, namely vehicle routing problem, automated guided vehicle (AGV) scheduling, electric bus scheduling, railway crew assignment and rostering, and beyond. In fact, this method could also be used in other fields related to combinatorial optimization, such as telecommunications (e.g., wireless sensor network deployment), finance and economics (e.g., portfolio optimization), healthcare (e.g., nurse scheduling), and so on. The foundational principles and techniques presented in this paper lay the groundwork for addressing a diverse range of real-world optimization problems using quantum computing methodologies.