1 Introduction

As the transportation lifeline of major cities, urban rail transit networks bear the primary commuter flow. The average daily passenger flow of urban public transportation in the city reached 13.988 million in 2021, with rail transit accounting for 70.0% of the total, carrying an average of 9.786 million passengers per day, representing a year-on-year growth of 26.5% [1]. With the accelerated progress of urban rail transit construction, the passenger flow of urban rail transit has experienced explosive growth [2]. The sharp increase in passenger flow has exacerbated the issues of overcrowded trains and congested stations during peak hours. This not only diminishes passenger comfort during travel but also poses challenges in passenger flow management [3]. Therefore, alleviating the increasingly serious problem of passenger congestion during peak periods is imperative.

Through in-depth study of passenger flow data, it can be seen that the time distribution of passenger flow in rail transit exhibits significant temporal imbalance [4]. The most fundamental approach to alleviate peak period congestion is to balance passenger demand. Price regulation serves as an effective method for scientifically managing passenger flow demand.

This paper studies the willingness of passengers to change their travel times under different fare strategies and establishes an effective time-differentiated fare model. It aims to incentivize passengers traveling during peak periods to shift to off-peak periods, which fundamentally solves the peak period congestion problem and achieves a balanced full load rate throughout the day. Furthermore, the effectiveness of the model is validated through a case study using Shanghai Line 9, coupled with a questionnaire survey data.

The significance of this study is its investigation of passengers’ shifting of travel time behavior under different fare strategies and the use of Shanghai Line 9 as a case study. The constructed fare discount model can provide theoretical support and quantitative support for the implementation of time-differentiated pricing for urban rail transit.

The rest of the paper is organized as follows. Section 2 reviews related literature. Section 3 presents an overview of the temporal distribution patterns of urban rail transit passenger flows. Section 4 presents the questionnaire design and survey results. Section 5 constructs a time-differentiated fare discount model. Section 6 provides an example analysis using a genetic algorithm with nested fmincon functions combined with real data. In Sect. 7, the effectiveness of the model is validated based on the data collected from the questionnaire survey. Finally, Sect. 8 concludes the study.

2 Literature Review

Urban rail transit peak congestion has become a public transportation problem in major cities. Measures to alleviate peak congestion can be broadly categorized into two types: traffic supply management and traffic demand management [5]. As it becomes increasingly difficult to further increase capacity supply, domestic and foreign experts have begun to study effective measures to relieve peak congestion from the perspective of passenger demand. The most widely applied domestic and international demand management measures mainly include passenger flow control and time-differentiated pricing [6]. Daniels and Mulley [7] found that using the University of Sydney as the subject of the study, even if the university and government initiatives which would reduce peak use and encourage peak spreading, they may not achieve either a reduction in peak use or a spread of public transport demand to other times of the day. Passenger flow control measures are currently the primary approach used in China to address peak congestion, such as increasing waiting fences outside stations and temporarily closing some entrance gates [8]. These flow control measures indirectly alleviate peak-hour passenger congestion by extending passengers' boarding and walking times, which cannot fundamentally solve the problem, but increases the time that passengers wait in line to enter the station and greatly reduces passenger satisfaction.

Therefore, national and international experts have begun to study the management of peak rail congestion through time-differentiated pricing. Jaradiaz [9] first applied the theory of time-differentiated pricing to subway systems in 1986. By establishing a non-aggregate demand model and using a multi-output cost function, the optimal prices were calculated and the applicability of time-differentiated pricing in the Santiago metro system was demonstrated. Currie and Graham [10] analyzed data from Melbourne after the implementation of a time-differentiated fare policy and found that time-based pricing had a moderating effect on travelers’ choice of travel behavior. Liu and Charles [11] reviewed many studies on fare schemes and found that it is possible to shift passenger demand out of the peak period as long as the difference in fares between the off-peak periods and peak periods is significant. Building on successful experiences in foreign cities and combining the fare pricing model in China, Song [12] validated the effectiveness of time-differentiated pricing using the Hangzhou metro, addressing the issue of uneven spatial and temporal distribution of passenger flow. Yu and others [13] further analyzed the rail transit passenger departure time elasticity under time-differentiated fares to provide key parameters for differentiated fare programming. Wang [14], Liu [15], Zahra [16], and others have also confirmed through further research that time-differentiated pricing effectively alleviates peak congestion. However, these studies only verified the effectiveness of time-differentiated fares without proposing specific fare schemes.

As a result, Tian and others [17] conducted a stated preference survey on passengers in Shanghai and proposed fare schemes such as peak-hour price increases and off-peak price reductions. However, they did not analyze the impact of different fare schemes on passenger volumes. Zhang and others [18] proposed two fare incentive schemes based on a questionnaire survey of the Beijing subway system and examined the effects of incentives on commuters’ travel behavior. The study found that incentive measures had a positive effect on commuters’ avoidance of traveling during the morning peak period. Wang and others [19] explored the impact of fare increases in three different scenarios (high, medium, and low) on passenger volumes, and the research indicated that raising fares could alleviate rail transit train congestion but may also lead to passenger loss. Tang and others [20] provide diverse options for commuters with a fare-reward scheme (H-FRS) and a non-rewarding uniform fare scheme (H-UFS). Commuters have the opportunity to join either scheme according to their flexibility in scheduling decisions. Zou and others [21] further explored the impact of pre-peak discounts on passengers' travel times and pointed out significant differences in the effects of fare discounts on different passenger groups. Therefore, when formulating fare schemes, Liu [22] combined rail transit passenger fare elastic demand and developed an optimal fare scheme for certain lines in Beijing, with an optimal fare of 4.72 yuan during off-peak hours and 6.41 yuan during peak hours. The above studies have proposed many time-differentiated fare schemes and explored the effects of various fare schemes on passenger flow. However, qualitative analysis is the main focus, and the few quantitative analyses have only investigated fixed fare schemes during peak and flat periods, and few mathematical models have been used to solve dynamic fare schemes that satisfy multi-objective optimization.

In recent years, dual-level programming models have been commonly used in urban rail transit pricing models. Zhang [23], Ran [6], Dai [24] and others have developed dual-level programming models considering both the profit of the rail transit operator and the travel cost of passengers to obtain optimal fare-setting strategies that balance the interests of both parties. However, the impact of fares on passenger travel choices was not considered. Zhou and others [25] used a discrete choice model to examine the relationship between fare incentives and passenger choice behavior. Based on passenger travel characteristics, Ji [26] further analyzed passenger travel mode choices using a discrete choice model and established a dual-level programming model considering the operator’s interest at the upper level and the passenger travel cost at the lower level. Although the aforementioned studies solve time-differentiated schemes that satisfy the interests of both the operator and passengers by constructing dual-level programming models, none of them quantifies the passenger flow factors and incorporates them into the fare pricing models.

In summary, many domestic and international scholars have conducted extensive research on regulating urban rail transit peak congestion based on differentiated fares. However, most studies have focused on qualitative analysis of various time-differentiated fare schemes. The small proportion of quantitative analysis has mainly concentrated on constructing dual-level programming models that consider operator benefits and passenger travel costs. There is a lack of research that quantifies the impact of fares on changes in passenger demand and considers passenger flow equilibrium parameters in time-differentiated fare models. Therefore, this paper introduces the user response load model from the power system to represent the impact of fares on passenger demand changes, incorporating the balance of train occupancy rates in different time periods as an objective function in the fare optimization scheme, and constructing a fare optimization model that integrates operator benefits, passenger travel costs, and passenger flow equilibrium.

3 Classification of Operating Hours of Urban Rail Transit

The distribution of passenger flow in urban rail transit over time is uneven due to a variety of factors. The daily time distribution of passenger flow in urban rail transit is influenced primarily by factors such as commuting time demand and travel purpose. This distribution can be categorized into four patterns: double-peak, full-peak, sudden-peak, and no-peak.

By the end of 2022, Shanghai had 20 rail transit lines, totaling 407 rail transit stations and covering a total operating mileage of 825 kilometers. The annual passenger volume in 2022 reached a high of 2,279,261,000 person-times, with an annual inbound volume of 1,254,673,000.

This paper focuses on the Shanghai rail transit system as the research subject and utilizes passenger flow data for weekdays from April 12 (Monday) to April 16 (Friday) of 2021 to analyze the distribution pattern of daily passenger flow. The original automated fare collection (AFC) data sheet contains information including passenger ID, travel date, travel time, in and out stations, travel method, travel cost, and fare discount. Firstly, SQL Server is used to clean the original data and eliminate invalid data such as missing information and redundancy. Then, the operating hours of the day (from 5:00 am to 12:00 pm) are segmented into hourly intervals, and the passenger flow in and out of the station within each hour is counted, as shown in Fig. 1.

Fig. 1
figure 1

Weekday hourly passenger flow distribution

From Fig. 1, it is apparent that the passenger flow exhibits a bimodal pattern on working days, with distinct and relatively fixed morning and evening peak periods. The morning peak hour is defined as 7:00 am to 10:00 am, and the average daily passenger flow in and out of the stations during this period is calculated to be 342,053. The evening peak hour is defined as 5:00 pm to 8:00 pm, and the daily average passenger flow in and out of the station during the evening peak is 289,276. These two peak periods account for 32.71% and 27.66% of the total number of passengers in and out of the station during the whole day, respectively, amounting to a total of 60.37%. It is evident that there exists a significant imbalance in the time distribution of urban rail transit passenger flow on working days, leading to difficulties in organizing train operations, issues in managing passenger flow at stations during peak periods, and inadequate utilization of resources during off-peak periods.

In this paper, a time-differentiated fare discount system is constructed with the aim of achieving a balanced train occupancy rate across different time periods. According to the above passenger flow distribution characteristics, Shanghai subway operations are divided into five periods: (1) 5:00–7:00 am, the off-peak period before the morning peak; (2) 7:00–10:00 am, the morning peak; (3) 10:00 am–5:00 pm, the off-peak period between the morning and evening peaks; (4) 5:00–8:00 pm, the evening peak; (5) 8:00–12:00 pm, the off-peak period after the evening peak.

4 Analysis of Passenger Classification and Transfer Intention Based on a Questionnaire Survey

The main objective of the stated preference survey is to design hypothetical scenarios and choice sets for passengers to evaluate and make selections from, in order to analyze their preferences for different options. Fare is a significant factor influencing passengers’ travel behavior, as the fare level can impact passengers’ decision-making regarding travel choices. Passengers with different travel characteristics may have varying levels of acceptance toward fare levels. Therefore, prior to constructing a time-differentiated fare model, it is essential to analyze the travel behavior of different passenger categories under various time-differentiated fare strategies. Due to the unavailability of actual passenger flow data under different time-differentiated fare strategies, this paper adopts a stated preference questionnaire survey to gather the required data. Through the questionnaire survey, it is possible to obtain information regarding passengers’ level of acceptance towards different time-differentiated fare strategies, as well as their willingness to shift their travel behavior accordingly.

4.1 Questionnaire Design and Survey

The survey questionnaire consists of two main parts: passenger travel characteristics and passenger travel choice behavior under different fare strategies. The section on passenger travel characteristics includes the following information: frequency of subway usage per week, the number of round trips taken on the subway per week, the average cost per subway trip, the main reasons for using the subway, sensitivity towards different factors influencing travel choices, and the most common travel times during weekdays. The section on passenger travel choice behavior under different fare strategies covers the following aspects: different fare strategies, including off-peak discounts, peak-hour surcharges, and combination fares, and available travel choices for passengers include advancing to pre-peak hours, delaying to post-peak hours, and maintaining current travel behavior.

The survey was conducted at railway transit stations, specifically targeting passengers who choose to travel by rail transit. A total of 224 valid questionnaires were collected for this survey, and statistical analysis was conducted on these valid questionnaires pertaining to passenger intentions.

4.2 Analysis of Transfer Intentions Among Different Types Of Passengers

4.2.1 Analysis of Passenger Category Characteristics

Using the average number of days of subway usage per week and the most common travel time on weekdays as classification indicators, a second-order clustering method applicable to both continuous and categorical variables is employed to partition the passengers. Second-order clustering of passengers was performed using SPSS software, and an optimal number of three clusters was determined according to the Bayesian information criterion (BIC), with type 1 passengers accounting for 15.2%, type 2 passengers accounting for 51%, and type 3 passengers accounting for 33.8%. Some of the classification data are shown in Table 1.

Table 1 Some of the classification data

Based on the analysis of travel characteristics for different types of passengers using the available travel characteristic data, the following observations can be made:

Type 1 passengers have an average of 1.87 days of subway travel per week, which is lower than the other passengers. Additionally, these passengers have a common travel time during weekdays that falls within the off-peak period. This indicates that type 1 passengers are likely to be students or individuals who are not employed, as their travel patterns are not influenced by peak commuting hours.

Type 2 passengers have an average of 4 days of subway travel per week, which is significantly higher than the other passengers. They can be considered frequent subway passengers. Furthermore, these passengers have a common travel time during weekdays that falls within the peak period, and it tends to be relatively consistent. This suggests that type 2 passengers are predominantly white-collar workers or individuals employed in public institutions, who have fixed commuting times.

Type 3 passengers have an average of 2.39 days of subway travel per week. Their most common travel time during weekdays is primarily within the peak period. However, compared to type 2 passengers, type 3 passengers exhibit more flexibility in their travel times. They also have a higher frequency of subway usage than type 1 passengers. This indicates that type 3 passengers consist mainly of self-employed individuals or those with flexible work schedules who may have the freedom to adjust their travel times within the peak period.

4.2.2 Analysis of Travel Transfer Intention Based on Passenger Classification

Based on the classification results of the passengers in Sect. 4.2.1, we will analyze the travel choice behavior characteristics of the three types of passengers under different fare strategies. The questionnaire included a total of eight scenarios, where passengers were presented with three fare strategies to choose from, along with an option to maintain their original travel time regardless of the fare strategy. The specific scenario settings and fare strategies can be found in Table 2.

Table 2 Specific scenario settings and fare strategies

The results of the classification analysis are shown below:

  1. (1)

    Analysis of travel choice behavior of type 1 passengers

For this type of passenger, in the scenario of traveling during the morning peak hours, they are significantly influenced by the fare strategy of off-peak discount. On average, 45.31% of the passengers choose to shift their travel time. Among them, 21.88% of the passengers consider shifting their travel to the pre-peak period when there is a 40% fare reduction, while 12.5% of the passengers consider shifting their travel to the post-peak period when there is a 10% fare reduction. However, during the peak-hour surcharge strategy, on average, only 39.84% of the passengers consider shifting their travel time. In the scenario of traveling during the evening peak hours, only 47.66% of the passengers consistently choose not to shift their travel time. Furthermore, the majority of passengers consider shifting their travel to the pre-peak period. In conclusion, type 1 passengers show a higher sensitivity to off-peak discount strategies and are more likely to change their travel time accordingly.

  1. (2)

    Analysis of travel choice behavior of type 2 passengers

For this type of passenger, in the scenario of traveling during the morning peak hours, regardless of the fare strategy, only an average of 33.5% of the passengers choose to change their travel time. Among them, 37.62% of the passengers consider shifting their travel time when there is an off-peak discount strategy, and 28.27% of the passengers change their travel time when there is a peak-hour surcharge strategy. Furthermore, it is only when there is a 70% fare increase during peak hours that the passengers consider changing their travel time. In the scenario of traveling during the evening peak hours, an average of 63.79% of the passengers do not consider changing their travel time. However, when an off-peak discount strategy is implemented, the majority of these passengers consider shifting their travel to the post-peak period. In conclusion, type 2 passengers are less influenced by fare strategies, especially in the scenario of traveling during the morning peak hours. They are less likely to change their travel time.

  1. (3)

    Analysis of travel choice behavior of type 3 passengers

In the scenario of traveling during the morning peak hours, an average of 66.55% of the passengers in type 3 consider changing their travel time. Among them, 71.13% of the passengers consider changing their travel time when there is an off-peak discount strategy, while only 61.97% of the passengers change their travel time under the peak-hour surcharge strategy. Furthermore, the passengers in this group are more inclined to shift their travel to the post-peak period when considering a change in travel time during the morning peak hours. In the scenario of traveling during the evening peak hours, an average of 82.04% of the passengers consider changing their travel time. In conclusion, type 3 passengers are more inclined to change their travel time under the off-peak discount strategy.

In conclusion, an average of 48.45% of passengers consider shifting their travel time under all fare strategies, and all types of passengers are more sensitive to off-peak fare discount strategies. Under such strategies, even a modest reduction in fares can persuade a significant number of passengers to shift their departure time. Therefore, this paper focuses exclusively on investigating the impact of off-peak fare discount strategies on passengers' willingness to change their departure time.

5 Model Construction of Time-Differentiated Fare Discount

The results of Sect. 4 show that the time-differentiated pricing strategy is feasible and that passengers of all types of travel characteristics are more sensitive to the off-peak reduction strategy. Therefore, this paper proposes to encourage passengers who travel during peak periods to change their travel time by adopting a fare discount strategy during each off-peak period, so that the departure time can be shifted from peak hours to off-peak hours. The services provided by urban rail transit are public service products, so its fares need to consider the public welfare of public transportation, and ensure the interests of passengers while also considering the revenue of urban rail transit operating enterprises.

5.1 Notations

Basic notations used for modeling the problem are listed in Table 3.

Table 3 Basic notations

5.2 Passenger Flow and Fare Relationship Function

  1. (1)

    Price elasticity


Price elasticity accurately reflects passengers’ sensitivity to fares. Urban rail transit is a primary mode of transportation for intra-city travel and has high fare elasticity. With the implementation of the time-differentiated fare discount scheme, passenger demand during each time slot changes accordingly. The number of passenger trips during a certain period is related not only to the fares for that period but also to the fares during other periods. This indicates a cross-elasticity of fares across different time periods, as shown in Eq. (1).

$$E\left( {i,j} \right) = \frac{{{{\Delta q_{j} (i)} \mathord{\left/ {\vphantom {{\Delta q_{j} (i)} {q_{j} (i)}}} \right. \kern-0pt} {q_{j} (i)}}}}{{{{\Delta P\left( j \right)} \mathord{\left/ {\vphantom {{\Delta P\left( j \right)} {P\left( j \right)}}} \right. \kern-0pt} {P\left( j \right)}}}}$$
(1)
  1. (2)

    User response load model


Aalami et al. [27] proposed an economic response load model, which was widely applied in the study of time-differentiated electricity prices. Based on this, a responsive load model for urban rail transit users was proposed [28], as shown in Eq. (2).

$$S\left[ {q\left( i \right)} \right] = B\left[ {q\left( i \right)} \right] - P\left( i \right) \cdot q\left( i \right)$$
(2)

Derivation of \(q\left( i \right)\) yields Eq. (3):

$$\frac{\partial S}{{\partial q\left( i \right)}} = \frac{{\partial B\left[ {q\left( i \right)} \right]}}{\partial q\left( i \right)} - P\left( i \right)$$
(3)

To maximize the benefit to passengers, the derivative value should be zero, which leads to Eq. (4):

$$\frac{\partial S}{{\partial q\left( i \right)}} = \frac{{\partial B\left[ {q\left( i \right)} \right]}}{\partial q\left( i \right)} - P\left( i \right) = 0$$
(4)

A commonly employed user benefit function is shown in Eq. (5):

$$B\left[ {q_{j} \left( i \right)} \right] = B_{0} \left( i \right) + P_{0} \cdot \left[ {q_{j} \left( i \right) - q_{0} \left( i \right)} \right] \cdot \left[ {1 + \frac{{q_{j} \left( i \right) - q_{0} \left( i \right)}}{{2E\left( {i,j} \right) \cdot q_{0} \left( i \right)}}} \right]$$
(5)

Derivation of Eq. (5) and substitution of Eq. (4) into the derived equation gives the relationship between passenger flow and fare, as shown in Eq. (6):

$$q_{j} \left( i \right) = q_{0} \left( i \right) \cdot \left[ {1 - E\left( {i,j} \right) \cdot \alpha_{{\text{j}}} } \right]$$
(6)

That is, the relationship between passenger flow and fare discount after period i, which is affected by the fare discount in period j, can be obtained as shown in Eq. (7):

$$q_{j} \left( i \right) = q_{0} \left( i \right) \cdot \left[ {1 - E\left( {i,j} \right) \cdot \alpha_{j} } \right]$$
(7)
$$\left\{ {\begin{array}{*{20}c} {i = 2,4} \\ {\left| {{\text{j}} - i} \right| = 1} \\ \end{array} } \right.$$

From the user demand response function, it can be observed that after the implementation of the fare discount, the total passenger flow in period i is given by Eqs. (8) and (9):

$$q_{i} = q_{0} \left( i \right) - \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]}$$
(8)
$$\left\{ {\begin{array}{*{20}c} {i = 2,4} \\ {\left| {j - i} \right| = 1} \\ \end{array} } \right.$$
$$q_{i} = q_{0} \left( i \right) + \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( j \right) - q_{i} \left( j \right)} \right]}$$
(9)
$$\left\{ {\begin{array}{*{20}c} {\{ i{\text{ }} = {\text{ }}1,3,5\} } \\ {\;\;\;\;\;\;\;\;\;\left| {j - i} \right| = 1,0 < j < 6} \\ \end{array} } \right.$$

5.3 Utility Functions for Urban Rail Transit Operators and Passengers

  1. (1)

    Utility function for urban rail transit operators


The revenue of urban rail transit operating companies depends on their operating income and operating costs. This study considers only the fare revenue as the operating income, while the operating cost is composed of vehicle maintenance cost, line facility and equipment maintenance cost, and operating service cost [29]. As the vehicle maintenance cost and line facility and equipment maintenance cost are not affected by fare strategy, the revenue of the operating enterprise in this paper is related only to fare revenue and operating service cost. The calculation formulas are shown in Eqs. (10) and (11):

$$O = P \cdot Q$$
(10)
$$C_{S} = \delta_{G} + \delta_{q} \cdot Q$$
(11)

Based on the above analysis, the operating revenue function of the enterprise before the implementation of the fare discount scheme is shown in Eq. (12):

$$\begin{aligned} R_{0} = & P_{0} \cdot Q_{0} - \left[ {\delta_{G} + \delta_{q} \cdot Q_{0} } \right] \\ = & P_{0} \cdot \sum\limits_{i = 1}^{5} {q_{0} } \left( i \right) - \left[ {\delta_{G} + \delta_{q} \cdot \sum\limits_{i = 1}^{5} {q_{0} } \left( i \right)} \right] \\ \end{aligned}$$
(12)

Following the implementing of the time-differentiated fare discount scheme, the enterprise's revenue function is as in Eq. (13):

$$\begin{aligned} R_{L} = & P_{0} \cdot \sum\limits_{i = 1}^{5} {\left[ {q_{0} \left( i \right) - \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right]} \\ & + P_{0} \cdot \sum\limits_{i = 1}^{5} {\left( {1 - \alpha_{{\text{i}}} } \right)} \cdot \left[ {q_{0} \left( i \right) + \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right] \\ & - \left( {\delta_{G} + \delta_{q} \cdot \sum\limits_{i = 1}^{5} {q_{i} } } \right) \\ \begin{array}{*{20}c} {\begin{array}{*{20}c} {\begin{array}{*{20}c} {} & {} \\ \end{array} } & {} & {} & {} \\ \end{array} } & {} & {} \\ \end{array} 0 < \alpha_{i} < 1 \\ \end{aligned}$$
(13)
  1. (2)

    Utility function for urban rail transit operators

Urban rail transit serves as a mode of transportation for passengers to travel within a city. Therefore, passengers' utility function depends not only on the fare they pay but also on the cost of crowding, which is affected by the level of congestion on the subway.

The cost of crowding represents a measure of passenger discomfort on the subway, and it is mainly influenced by the level of congestion on the subway after boarding. Therefore, we consider the cost of crowding to be related to the passenger flow in each period, and we calculate it using Eq. (14):

$$C_{C} = \theta \cdot \frac{{q_{i} \cdot t_{jg}^{i} }}{{N_{zc}^{i} \cdot 60 \cdot b \cdot Z}}$$
(14)

Based on the above analysis, the passenger utility function before the implementation of the fare discount scheme can be expressed as Eq. (15):

$$S_{0} = - \sum\limits_{i = 1}^{5} {q_{0} \left( i \right) \cdot } \left[ {\sigma_{1} \cdot P_{0} + \sigma_{2} \cdot C_{C} } \right]$$
(15)

After the implementation of the time-differentiated fare discount scheme, the passenger utility function is as in Eq. (16):

$$S_{L} = - \left\{ \begin{gathered} \sigma_{1} \cdot P_{0} \cdot \sum\limits_{i = 1}^{5} {\left( {1 - \alpha_{i} } \right)} \cdot \left[ {q_{0} \left( i \right) + \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right] \hfill \\ + \sigma_{1} \cdot P_{0} \cdot \sum\limits_{i = 1}^{5} {\left[ {q_{0} \left( i \right) - \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right] + \sum\limits_{i = 1}^{5} {\sigma_{2} \cdot C_{C}^{i} } } \hfill \\ \end{gathered} \right\}$$
(16)

5.4 Equilibrium Modeling of Full Load Factor by Period

The full load rate equilibrium model aims to achieve the full load rate equilibrium of trains in the urban rail transit line network for each period, serving as the optimization objective. The train full load rate, denoted by r, can be calculated using Eq. (17):

$$r_{i} = \frac{{q_{i} \cdot t_{jg}^{i} }}{{N_{zc}^{i} \cdot 60 \cdot b \cdot Z}}$$
(17)

The objective of this paper is to equalize the full train load rate across the entire day. To achieve this, the minimum sum of squares of the differences of the full load rate in each period is taken as the objective function, as shown in Eq. (18):

$$\min X = \frac{{\sum\limits_{i = 1}^{5} {\left( {r_{i} - \overline{r} } \right)^{2} } }}{5}$$
(18)

5.5 Construction of the Fare Discount Model

After establishing the relationship between passenger flow and fares through the user fare demand response function, we construct an optimization model for time-differentiated fare discounts for urban rail transit based on this.

To facilitate the analysis, the following assumptions have been made: (1) Only transfers between different time periods within urban rail transit are considered. (2) No transfers occur between different peak periods. (3) Fare discounts are only applied during off-peak periods, and no fare adjustments are made during peak periods. (4) The study only considers transfers of passenger flow within urban rail transit and does not account for transfers from other modes of transportation to urban rail transit.

To ensure the safe and efficient operation of urban rail transit, the optimization objective of the model is to minimize the sum of squared differences of the full load rate of urban rail transit in different periods, subject to constraints related to operating company efficiency, passenger efficiency, and fare adjustments.

  1. (1)

    Operating enterprise efficiency

To ensure the profitability of the operating companies, the model must also take into account their benefits. Since implementing the fare discount strategy will result in revenue loss for the enterprise, a constraint is added to ensure that the loss of fare revenue does not exceed a certain percentage of the original revenue. This is shown in Eq. (19):

$$\left| {\Delta R} \right| = \left| {R_{L} - R_{0} } \right| \le P \cdot \varsigma$$
(19)

By substituting Eqs. (12) and (13) into Eq. (19), we obtain Eq. (20):

$$\begin{gathered} \left| {\Delta R} \right| = \left| \begin{gathered} \left\{ \begin{gathered} \sum\limits_{i = 1}^{5} {P_{0} \cdot \left( {1 - \alpha_{i} } \right) \cdot \left[ {q_{0} \left( i \right) + \sum\limits_{{{\text{j}} = 1}}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right]} \hfill \\ + P_{0} \cdot \sum\limits_{i = 1}^{5} {\left[ {q_{0} \left( i \right) - \sum\limits_{{{\text{j}} = 1}}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right]} - \left( {\delta_{G} + \delta_{q} \cdot \sum\limits_{i = 1}^{5} {q_{i} } } \right) \hfill \\ \end{gathered} \right\} \hfill \\ - \left\{ {P_{0} \cdot \sum\limits_{i = 1}^{5} {q_{0} } \left( i \right) - \left[ {\delta_{G} + \delta_{q} \cdot \sum\limits_{i = 1}^{5} {q_{0} } \left( i \right)} \right]} \right\} \hfill \\ \end{gathered} \right| \le P \cdot \varsigma \hfill \\ = \qquad \left| {\sum\limits_{i = 1}^{5} {P_{0} \cdot \left( {1 - \alpha_{i} } \right) \cdot \sum\limits_{{{\text{j}} = 1}}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } + P_{0} \cdot \sum\limits_{i = 1}^{5} {\sum\limits_{j = 1}^{5} {q_{j} } } \left( i \right) - \left( {\delta_{G} + \delta_{q} \cdot \sum\limits_{i = 1}^{5} {q_{i} } } \right) - P_{0} \cdot \sum\limits_{i = 1}^{5} {q_{0} } \left( i \right)} \right| \le P \cdot \varsigma \hfill \\ \end{gathered}$$
(20)
  1. (2)

    Passenger benefits

As a form of public transportation, the public nature of urban rail transit is an important consideration in pricing, and its public nature can be measured by passenger benefits. Therefore, when constructing the fare discount model, the change in total passenger benefits should be considered. The passenger benefit/loss should be controlled within a certain range, as shown in Eq. (21):

$$\left| {\Delta S} \right| = \left| {S_{L} - S_{0} } \right| \le S_{m}$$
(21)

By substituting Eqs. (15) and (16) into Eq. (21), we obtain Eq. (22):

$$\begin{gathered} \Delta S = \left| \begin{gathered} \left\{ { - \left[ {\sum\limits_{i = 1}^{5} \begin{gathered} \sigma_{1} \cdot P_{0} \cdot \left( {1 - \alpha_{i} } \right) \cdot \left[ {q_{0} \left( i \right) + \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right] \hfill \\ + \sigma_{1} \cdot P_{0} \cdot \sum\limits_{i = 1}^{5} {\left[ {q_{0} \left( i \right) - \sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( i \right) - q_{j} \left( i \right)} \right]} } \right] + \sum\limits_{i = 1}^{5} {\sigma_{2} \cdot C_{C}^{i} } } \hfill \\ \end{gathered} } \right]} \right\} \hfill \\ - \left\{ { - \sum\limits_{i = 1}^{5} {q_{0} \left( i \right) \cdot } \left[ {\sigma_{1} \cdot P_{0} + \sigma_{2} \cdot C_{C}^{{}} } \right]} \right\} \hfill \\ \end{gathered} \right| \le S_{m} \hfill \\ \hfill \\ \end{gathered}$$
(22)
  1. (3)

    Fare constraints

To avoid a reduction in passenger benefits due to excessive fare changes, there will be a range for passenger discount rates, as shown in Eq. (23):

$$0 < \alpha_{j} < 1$$
(23)

In summary, the constructed time-differentiated fare discount model is shown in Eq. (24):

$$\min X = \frac{{\sum\nolimits_{i = 1}^{5} {\left( {r_{i} - \overline{r} } \right)^{2} } }}{5}$$
(24)

s.t:

$$\left| {\Delta R} \right| = \left| {R_{L} - R_{0} } \right| \le P \cdot \varsigma$$
$$\left| {\Delta S} \right| = \left| {S_{L} - S_{0} } \right| \le S_{m}$$
$$0 < \alpha_{j} < 1$$

6 Solving the Time-Differentiated Fare Discount Model

This section describes the construction of a time-differentiated fare discount model. The objective of the model is to minimize the sum of squares of the difference of the full load rate of urban rail transit in different periods, subject to constraints on the operating enterprise's interests, passenger benefits, and ticket discount rate. In the time-differentiated fare discount model, the passenger flow of each period is affected by the fare discount rate. The passenger fare response function is used to express the relationship between fare and passenger flow, which can be used to calculate the passenger flow for each period after the fare discount. To solve this optimization problem, a genetic algorithm with a nested fmincon function is designed.

6.1 Design of Time-Differentiated Fare Discount Model Solving Algorithm

In the time-differentiated fare discount model constructed in this paper, the objective is to achieve the full load rate equilibrium in each period while considering both the operating company’s interests and passenger travel benefits, with fare serving as the constraint. As discussed in Sect. 5, the full-day operation period is divided into five periods, including two peak periods and three off-peak periods. The time-differentiated fare discount model mainly provides fare discounts for the three off-peak periods to encourage passengers to shift their travel to these periods. Therefore, the solution to the fare model involves finding the optimal value of the ternary variable function.

  1. (1)

    Fare discount model combined with actual passenger flow data

According to the actual passenger flow data, to output a fare discount model with only decision variables, follow these specific steps:

Step 1 Input the initial passenger flow for each period, the departure interval for each period, the number of hours for each period, and the price elasticity of the demand coefficient between periods.

Step 2 Calculate the relationship between passenger flow and fare discount in period i after being affected by fare discount in period j using Eq. (7).

Step 3 Based on Step 2, use Eqs. (8) and (9) to calculate the passenger flow for each period after the fare discount.

Step 4 Calculate the change in the operating company revenue before and after the fare discount based on the passenger flow during each period after the fare discount using Eq. (20).

Step 5 Calculate the initial full load factor of each period using Eq. (17), based on the passenger flow and the departure time interval of each period, and the number of hours of each period after the fare discount. Then, use Eq. (24) to calculate the sum of squares of the difference of the full load rate in different periods before and after the fare discount.

Step 6 Calculate the congestion cost using Eq. (14) and then calculate the change in passenger benefits before and after the fare discount using Eq. (22).

The pseudocode is shown in Fig. 2.

Fig. 2
figure 2

Algorithmic flowchart

  1. (2)

    Designing genetic algorithms with nested fmincon functions

The classical nonlinear programming algorithm is employed primarily to solve problems involving multivariate functions, with the objective of finding the maximum value. However, most of these classical nonlinear programming algorithms rely on the gradient descent method to address the problem. While this method is highly effective for local search, it has limited ability for global search, often resulting in suboptimal rather than optimal solutions. To overcome this limitation, this section proposes a combination of two algorithms, the genetic algorithm for global search and the nonlinear programming algorithm for local search, resulting in the identification of the global optimal solution.

Step 1 Initialization. Given the interval of fare discount rate of urban rail transit in the model constraints, set the population size to N, generate N individuals randomly in the fare discount rate interval to form a discrete population, and then set the maximum genetic generation number MAXGEN, individual length PRECI, crossover probability px, and variation probability pm. And set the current number of iterations gen = 0.

Step 2 Adaptation degree calculation. By nesting fmincon function to calculate the adaptation degree, the fmincon function is used to calculate the optimal value of the function with the enterprise revenue and passenger benefits as constraints and the sum of squares of the difference of the full load rate in different periods as the target, and the optimal objective function value solved fmincon function is used as the individual adaptation degree to calculate the adaptation degree corresponding to each discount rate scheme.

Step 3 Selection operation. Inherit the individuals with higher fitness in the current population to the next generation population according to some rule or model.

Step 4 Crossover operation. The single-point crossover method is used to exchange part of the chromosomes between two individuals with a cross probability px to produce a new individual.

Step 5 Mutation operation. Some genes in the chromosome are mutated according to the mutation probability pm. Go to Step 7.

Step 6 Update the target value. The mutated population is considered the child generation, which is then transformed into a new set of subpopulations using decimal transformation. These subpopulations are then substituted into the objective function to obtain the objective function value of the child generation. The child generation is then reintroduced into the parent generation to create a new population. Finally, the number of iterations is updated as gen = gen + 1.

Step 7 Termination condition judgment. If gen<MAXGEN, return to step 2; otherwise, the algorithm terminates. At this point, the optimal solution obtained is the optimal discount rate combination in the objective function.

6.2 Analysis of Fare Discount Model Solving Results

In this paper, Shanghai rail transit line 9 is selected as a case to verify the feasibility of the constructed time-differentiated fare discount rate model and the effectiveness of the algorithm.

Table 4 shows the values of the parameters in our models. To maintain a strong alignment between experiments and real-life planning, parameter values associated with urban rail transit (e.g., driving speed, departure interval, and price demand elasticity by period) were first collected from previous research, relevant reports, and subway official website, and then carefully trimmed to adapt to our case study.

Table 4 Parameter values

According to the developed time-dependent fare discount model for urban rail transit, the genetic algorithm combined with the fmincon function is used to solve the problem and implemented with MATLAB software. After the algorithm reaches convergence, the results of the optimal fare discount rate for each period are shown in Table 5.

Table 5 Discount rate calculation results

From the above time-differentiated fare discount model solution results, the actual fare discount when taking the arithmetic results of the fare discount to more decimal places is difficult to clear, so the arithmetic results use the rounding method to obtain the final fare discount rate. The fare discount strategy by period is as follows: a 40% discount in the off-peak period before the morning peak, a 10% discount in the off-peak period between the morning and evening peaks, and a 70% discount in the off-peak period after the evening peak, which can achieve the most balanced full load rate in all periods of the day based on ensuring passenger travel benefits. Although the off-peak period fare discount strategy may result in some fare loss for the operating companies, it can attract passengers from other modes of transportation to transfer to rail transportation and reduce the operating and service costs of trains during the peak period, both of which can offset the loss of the operating companies to a certain extent.

The loss of revenue caused by the implementation of fare discounts during the off-peak period is mainly the loss of revenue due to the reduction in ticket prices, which is calculated as in Eq. (25):

$$E_{L} = \sum\limits_{i = 1}^{5} {\sum\limits_{j = 1}^{5} {\left[ {q_{0} \left( j \right) - q_{i} \left( j \right)} \right] \cdot \alpha_{i} } \cdot P_{0} }$$
(25)
$$\left\{ {\begin{array}{*{20}c} {i = 1,3,5} \\ {\left| {j - i} \right| = 1,\;0 < j < 6} \\ \end{array} } \right.$$

In this example, the data obtained in Tables 5 and 6 can be substituted into Eq. (25), and the revenue loss caused by the fare discount to the enterprise is 10,702 yuan, accounting for 2.1% of the total fare revenue. The results of the calculation of the total passenger flow and full load ratio for each period before and after the implementation of the fare discount strategy are shown in Table6.

Table 6 Calculation results for passenger flow and full load ratio before and after optimization for each period

Table 6 indicates that after the implementation of the fare discount strategy, 6.88% of passengers who previously traveled during the morning peak shifted to travel during the off-peak period before the morning peak or between the morning and evening peaks. Similarly, 6.66% of passengers who previously traveled during the evening peak shifted to travel during the off-peak period between the morning and evening peaks or after the evening peak.

As shown in Fig. 3, the implementation of discounted fares during the off-peak period significantly reduces the full train load rate during the morning and evening peak hours. This leads to a balanced full train load rate during each operating period, which achieves the goal of “peak shaving and valley filling” for urban rail transit passenger flow.

Fig. 3
figure 3

Comparison of full load rate before and after optimization in each period

6.3 Model Validation

Due to the uniqueness of urban rail transit fares, the effectiveness of the fare discount model can only be verified through fitting with data obtained from questionnaire surveys.

Further analysis of the passengers' travel behavior under the off-peak discount strategy in the section of the questionnaire survey reveals that passengers traveling during the morning peak period tend to prefer advancing their travel time to before the peak. They only consider postponing their travel time to after the peak when the fare discount is significant. On the other hand, passengers traveling during the evening peak period consider delaying their travel time only when the fare discount is substantial. Therefore, in order to achieve a more balanced load factor during different time periods, the fare discount rates for the off-peak before the morning peak and the off-peak after the evening should be higher than the discount rate during the off-peak between the morning and evening peaks. This aligns with the results obtained from the fare discount model calculations in Sect. 6.

The passenger flow data analyzed by the example are compared, and the questionnaire data are processed and analyzed, as shown in Table 7.

Table 7 Comparison and analysis of questionnaire survey data and example passenger flow data

To calculate the average absolute error value between the questionnaire data and the model solution data in the case analysis, the calculation formula is expressed as Eq. (26):

$${\text{MAE}} = \frac{1}{{\text{n}}} \cdot \sum\limits_{i = 1}^{n} {\left| {\widehat{{y_{i} }} - y_{i} } \right|}$$
(26)

The average absolute error is 0.1368, which shows that the fare model constructed in this paper can effectively reflect passengers' willingness to transfer under different fare discounts, and the optimal fare discount rate satisfies the equilibrium full load rate equilibrium of the equilibrium whole day and time slots can be solved through the model operation.

7 Conclusions and Further Studies

This study considers the sensitivity differences of urban rail transit passengers to different time-differentiated fare schemes based on stated preference surveys. Taking into account the interaction between rail transit operators and passengers, a time-differentiated fare discount model is constructed with the operator's interest and passenger benefits as constraints and the balance of train occupancy rates in different time periods as the objective. Based on the characteristics of the model, a genetic algorithm with nested fmincon functions is designed to solve it. Finally, the effectiveness of the model is validated through actual case analysis. The main research conclusions are as follows:

  1. (1)

    The stated preference survey method is used to investigate passenger travel characteristics and their willingness to choose different travel options under various time-differentiated fare scenarios. Based on the stated preference survey data, passengers are classified according to their travel characteristics, and their sensitivity differences to different time-differentiated fare schemes are analyzed based on their willingness to choose under different fare scenarios. Finally, the three categories of passengers are found to be more sensitive to the flat-peak fare discount scheme.

  2. (2)

    Based on the conclusions of the stated preference survey analysis, a time-differentiated fare discount model is constructed that comprehensively considers the operator's interest, passenger travel costs, and passenger flow equilibrium distribution, and a genetic algorithm with nested fmincon function is designed to solve the model. Finally, the practical strategy of fare discounts in time slots is obtained as follows: 40% discount for off-peak periods before the morning peak, 10% discount for off-peak periods between the morning and evening peaks, and 70% discount for off-peak periods after the evening peak. Under this fare strategy, 6.88% of morning peak travelers and 6.66% of evening peak travelers choose to shift to off-peak periods.

  3. (3)

    The results of the case study are further compared and analyzed with the stated preference survey data, and the average absolute error was calculated to be 0.1368. This indicates that the time-differentiated fare discount model constructed in this paper effectively reflects passengers' willingness to shift.

In this study, the effect of fares on changes in passenger demand and passenger flow equilibrium parameters are taken into account in the time-of-day differentiated fare model. A time-differentiated fare discount model is constructed that comprehensively considers the operator’s interest, passenger travel costs, and passenger flow equilibrium based on the stated preference survey. The research results provide theoretical support and decision-making basis for implementing time-differentiated pricing in urban rail transit.

This paper has some limitations and we hope that future research will take a further step. Firstly, after implementing the fare optimization scheme in this study, the passenger volume transfer from other modes of public transportation to the subway is not considered. Secondly, when transferring passengers to off-peak periods, the original number of operating vehicles during off-peak periods is not considered in terms of whether it could accommodate the transferred total passenger flow. In the future, we will continue to research these two aspects to establish a more accurate and effective time-differentiated fare optimization model, so as to achieve a more balanced temporal distribution of passenger flow in urban rail transit throughout the day.