A HYBRID MACHINE LEARNING-OPTIMIZATION APPROACH TO PRICING AND TRAIN FORMATION PROBLEM UNDER DEMAND UNCERTAINTY

. Due to the complexity of pricing in the service industry, it is important to provide an efficient pricing framework for real-life and large-sized applications. To this end, we combined an optimization approach with a regression-based machine learning method to provide a reliable and efficient framework for integrated pricing and train formation problem under hybrid uncertainty. To do so, firstly, a regression-based machine learning model is applied to forecast the ticket price of the passenger railway, and then, the obtained price in is used as the input of a train formation optimization model. Further, in order to deal with the hybrid uncertainty of demand parameters, a robust fuzzy stochastic programming model is proposed. Finally, a real transportation network from the Iran railway is applied to demonstrate the efficiency of the proposed model. The analysis of numerical results indicated that the proposed framework is able to state the optimal price with less complexity in comparison to traditional models.


Introduction
The train formation problem (TFP) is one of the most important research areas in rail transportation planning.Among different transportation modes, the railway has important advantages over others in the aspects of safety, flexible capacity, and low emissions [49,54].In order to provide the best services in the railway system and to use the maximum capacity, it is acceptable that the transportation plan adapts to the changing conditions.Price changes are one of the most important issues affecting optimal transportation planning, therefore, comprehensive and extensive researches exist in the literature (e.g., [56]).
Pricing is the process whereby a business determines the price at which it will sell its products and services.Price is the key factor for revenue-generating, playing a fundamental role in railway operation planning.Therefore, the price should be determined at the right level, not so high that the potential buyers put off and not so low that the potential profits lose out [36].Generally, ticket pricing in public transportation can be considered as a game between the company and consumers where each party tries to maximize its own profit [40].Railway companies are trying to keep their overall revenue as high as possible and optimize their fundamental decisions, while customers are seeking to get the best price for their tickets [1].Previous research on train ticket pricing indicated that factors such as the number of days passed from booking to departure, departure or arrival time, etc. significantly influence the desired price of customers [4,5].So, one of the approaches that can adjust pricing considering customer satisfaction, is to pricing regarding factors that significantly influence pricing from a customer point of view.
Also, pricing influences customer demand, playing a significant role in attracting customers, and increasing sales [50].Since the demand changes dynamically (especially during seasons of holidays and festivals), rail transportation corporations are facing complicated and different strategies and techniques to assign ticket prices [29].Also, demand has a high degree of uncertainty [28], which influences fare prices and thereby affects railway planning; therefore, it is important to use an appropriate method to deal with the uncertainty of demand.Generally, some methods are developed to control the ambiguity of parameters including stochastic programming, robust programming, and fuzzy programming.In most of the previous researches related to pricing in railway transportation, the demand is considered as a scenario-based parameter that in each of them, the amount of demand is considered as a deterministic value.But in most real-life problems there is no or limited knowledge about the real amount of demand in each scenario and it is necessary to use experts' viewpoints.So, we faced the parameter with two sources of uncertainty.The first source is that this uncertain parameter is based on scenarios that are considered according to the probability of their occurrence.The second source is that the values of this parameter in each scenario are usually imprecise and can be specified by possibilistic distributions.Therefore, it is necessary to consider a framework to cope with the hybrid uncertainty simultaneously.
Due to this high complexity, it is important to use appropriate methods for predicting the ticket price.Considering the common applications of the pricing and the relevant complexity, one of the main contributions of this research is to provide a framework applicable to real-life and large-sized pricing problems.To this end, for the first time, we have combined an optimization approach with the regression-based machine learning method to provide a reliable and efficient framework for the integrated pricing-train formation problem.Considering a framework that integrated machine learning methods with optimization models can provide a reliable and efficient framework to deal with the complex market.Due to the ability of machine learning methods to examine large volumes of data and discover certain trends and patterns that are not achieved by using optimization models, developing the framework that used both of them concomitantly can improve the accuracy of the results.
Based on the above-mentioned descriptions, this study aims to provide a comprehensive model for pricing passengers' tickets in the railway system and to combine it with the train formation problem under demand uncertainty.The objective function of the proposed model is to maximize the profits of companies providing rail services and determining the optimal number of the train.In order to achieve a reliable and efficient framework to deal with the complex railway market, a framework that integrated machine learning methods with optimization models is developed.Also, to the best of our knowledge, this is the first attempt to ticket pricing considering both customers and railway sides by developing hybrid methods of machine learning and optimization approach.
The main contribution of our model is the effort to develop a framework that can deal with the weaknesses of each model of machine learning and optimization.Machine learning models cannot optimize and they are only predicting factors based on some available information.On the other hand, in optimization models, decisions are made without considering all the affecting factors.To be more precise, in the issue of train formation plan, price is one of the most important factors that affected the principal decisions of its.If the price is considered as a variable without considering the real factors such as travel time, distance, etc., the output of the model determines unrealistic prices that do not be efficient.Also, these unreliable prices negatively affect other important decisions, such as allocating trains over a period of time.Therefore, providing a comprehensive model for pricing passengers tickets in the railway system and combine it with the train formation problem provide more realistic results compared to previous approaches.

Contributions
The other contributions of this research are as follows: (1) Provide a comprehensive model for pricing passengers' tickets in the railway system and to combine it with the train formation problem.The main decision in the train formation problem is to determine the optimal number of trains in each time period with the aim of maximizing the profits of railway companies.Previous articles on the train formation problem have neglected the combination of pricing with this issue (please see Sect.2.1).However, mismatches between train allocated and passenger demand (which is directly affected by the price) usually lead to either the customer paying more or the railway company losing revenue which will lead to dissatisfaction on both sides.Therefore, our paper is the first attempt to combine the ticket pricing with the train formation problem.(2) Using machine learning techniques to evaluate the effectiveness of the pricing-related factors in the railway system.Previous existing models in ticket pricing generally rely on a limited number of features which are not effective enough in predicting ticket price on both the customer and company sides.Also, given the huge amount of data available in the rail system, the use of data-driven methods can help decision-makers to extract useful knowledge from the relevant data [16].(3) Using the robust fuzzy stochastic programming to handle the uncertainty of demand in TFP is the other contribution of the paper.Due to the uncertain nature of demand and its significant impact on pricing decisions, it is very important to address the uncertainty of input parameters.
The remainder of this paper is organized as follows.Section 2 describes the literature review.The model assumptions and problem descriptions are addressed in Section 3. Section 4 represents the machine learning technique to determine the price.The proposed mathematical model is elaborated in Section 5. Explanation of the developed programming approach used to cope with the uncertainty of demand is addressed in Section 6. Section 7 represents numerical examples and discusses the computational results.Finally, the conclusions and future works are presented in Section 8.

Literature review
Since the main purpose of this article is to design a data-driven approach to combine the pricing problem and train formation problem, in this section, we reviewed the previous papers related to pricing in railway transportation and the train formation plan problem.To classify the past articles related to railroad transportation pricing in an appropriate way, we considered the relative papers in two categories: (1) Railroad.
(2) Combinational Transportation (refers to articles that consider railroad and another transportation mode, simultaneously).

Train formation problem
In this section, the works related to the train formation plan are reviewed.For example, Yaghini et al. [47] developed a mixed-integer programming model for train formation plan in Iranian railway.To solve the problem, a local branching algorithm is used.The results show the efficiency of the proposed approach in comparison to the exact approach.But'ko and Prokhorchenko [6] proposed an approach to analyzing the train formation problem based on interrelations between railway stations.To do this, the train formation plan was presented as a network structure with a directed graph and tested on Ukraine's railways for 2012-2013.Yaghini et al. [48] proposed a hybrid algorithm of the Simplex method and simulated annealing for the TFP problem in the Iranian railway.To adjust the best parameter values in the proposed algorithm, the design of experiments (DOE) method is used.Deng et al. [8] developed an optimization model to determine the train formation and service frequency in inter-city rail transport networks.The aim of this paper is to minimize the passengers' total travel costs and maximize the operator's benefit.The results show that the short train and high-frequency mode have greater ability to upgrade the service quality.Yaghini et al. [49] proposed a mathematical model with fuzzy costs for train formation planning in the Iranian railway.In this fuzzy model, the costs are considered in three scenarios, namely optimistic, normal and pessimistic.Also, a hybrid algorithm combining local branching and relaxation-induced neighborhood search methods is presented to solve the model.Xiao and Lin [43] present an optimization model of the train formulation plan which considers the one-block train and two-block train and delivers all of the commodities with the minimum car-hour consumption.In this paper, three sub-problems including shipment routing, shipment-to-block assignment, and block-to-train assignment are presented.Also, a heuristic optimization approach based on the ant colony system is proposed to solve the model.Lin [20] proposes a non-linear binary programming model to address the integrated railcar itinerary and train formation plan optimization problem.A simulated annealing-based heuristic solution approach is developed to solve the mathematical model.The results show the efficiency of the integrated model to determine the railcar path optimization and the train formation plan.Chen et al. [7] addressed a linear binary programming model to minimize total costs in the train formation plan problem in the China railway.In this paper, two subproblems are proposed to specify which blocks are built in each yard which railcars are allocated to which blocks.In this paper, the exact model is proposed for small-and medium-scale, and a novel two-stage tree-based decomposition approach is proposed to solve large-scale.Xiao et al. [44] considered the train formation problem in an actual 19-yard railway sub-network in China using both the single-block trains and the two-block trains.The main aim of this paper is to develop an optimization model of the train formulation plan to minimization of the total car-hour consumption at all yards.In order to solve the model, a hybrid algorithm of genetic algorithm and tabu search and a greedy algorithm are developed.Belošević et al. [3] proposed a new fuzzy multi-criteria approach to evaluate the train formation methods.The aim of this paper is to determine the rational sorting schedules based on different quantitative and qualitative indicators.Lin and Zhao [21] present a non-linear binary programming model for the train formation problem in order to minimize the total car-hour cost.In this paper, three train formation patterns including direct single-commodity trains, direct multi-commodity trains originating from loading stations, and direct trains from reclassification yards are discussed.Lin et al. [23] presented a linear 0-1 integer programming model to optimization of the total cost for the supplier and customer as well as the transportation costs of an entire train and non-direct train using data from the China rail system.In order to handle the uneven passenger demand in bi-directions, Zhao et al. [57] addressed a mixed-integer linear programming model to optimize the train formation plan and rolling stock scheduling.The proposed model is designed based on known passenger demand and timetable.Kozachenko et al. [17] presented a model for the multi-group train formation problem in order to minimize the time spent on shunting operations.In this paper, a discrete deterministic-controlled system is used to simulate the functioning of a flat yard.Lin et al. [24] proposes a non-linear binary programming model to address the simultaneous optimization of the railcar itinerary and train formation plan problems.The main purpose of this study is to minimize the total costs, travel distances and satisfy various practical requirements.A simulated annealing-based heuristic solution approach is developed to solve the mathematical model tested in a real-world railway network in China.

Railroad transportation pricing
This section presents an overview of related works on pricing in the passenger section of the railway system.For example, Mingbao et al. [25] used a discrete choice model to determine the passenger mode choice in the public transport system.Also, the rail and bus transit pricing game models are considered to determine the optimal price of urban rail transit.Yang and Chang [51] used the multinomial logit model to determine the cabin choice preferences.This paper also examined cabin attributes designed by the stated-preference method.The result shows that integrating the stated-preference method and revealed-preference data obtain more informative models.Xueyu and Jiaqi [46] considered the bi-level programming model to interests of both sides of the public transport companies and the passengers.The upper-level consider maximizing the overall revenue and the lowerlevel consider minimizing the generalized travel cost.Jin et al. [15] proposed a pricing model that is based on the value of travel time and Bi-level programming.The aim of this paper is to maximize the benefit of the railway agencies and the passengers' utility with different income levels.Hetrakul and Cirillo [14] incorporated the passenger choice models and the demand functions into a revenue management optimization system to maximize expected ticket revenue per each train trip.Qin et al. [30] developed the mixed-integer programming model to a combination of market segmentation, market competition, and dynamic pricing policy is a railway passenger fare policy portfolio.The aim of this paper is to maximize the expected revenue of China railway passenger transportation.Xiaoqiang et al. [45] considered a dynamic pricing model to provide the optimal price for passenger groups in the high-speed railway in China.The main aim of this study is to maximize the expected revenue of selling tickets by considering the best price for passenger groups.Vigren [39] investigated the effect of entry on the private railway companies in the state railways of Sweden.The main purpose of this study is to investigate the effect of entering the private railway company on the ticket price on the Stockholm-Gothenburg line.The results show significant price changes in the competitive markets.Gong et al. [11] established a discriminate Ramsey suboptimal pricing model to corporate the profit and the social welfare in Chinese highspeed rail.Gong et al. [12] adopted the theory of Ramsey suboptimal pricing, and build a sub-time pricing model of high-speed rail based on the operation cost and weights of peak and off-peak periods.Noordin and Mohd Ali Amran [26] used Monte Carlo Simulation to optimization the ticket pricing of electric train service in Malaya.In order to determine the minimum price for the ticket, the relationship between price and type of passenger, distance traveled and type of seat is considered.Wu et al. [42] proposed the model to combine pricing with seat allocation problems in the high-speed railway in China.The main goal of this paper is to maximize the ticket revenue, based on pricing constraints and revenue management strategies.To solve the proposed model, a two-stage algorithm is developed.The output of the first stage is the optimal price and the second is the optimal seat allocation.Beria et al. [4] investigated the pricing strategies of the two domestic rail passenger companies in Italy.The focus of this study is on determining the effect of some factors on price determination.The results indicated that in addition to distance, other factors such as demand, capacity, users' willingness to pay, are important.Qin et al. [31] used the differential pricing strategy to determine the best price for the high-speed railway in China.The results express the importance of using a dynamic pricing method in increasing the revenue of selling tickets, especially during the peak period.Lin et al. [22] considering the ticket pricing in investigated the problem of passenger assignment in a railway transportation system.A mathematical program and a heuristic approach were proposed as considering the price effect on passenger assignment problems Ali et al. [2] propose a hybrid method to resolve capacity conflicts between publicly controlled traffic and commercial traffic.The main goal of this paper is to calculate a reservation price for a commercial operator's path request by estimating the societal costs.

Combinational transportation pricing
This section considered a review of related works on combinational transportation pricing.As mentioned previously, this section refers to articles that consider railroad and other transportation mode, simultaneously.In the field of articles considered pricing in the passenger transportation, Sato and Sawaki [33] presented a revenue management model of dynamic pricing for a competitive market of high-speed railways and airlines.In this paper, by using the multinomial logit model to describe the customer's discrete choice, we derive an optimal pricing policy determine to maximize the expected total revenue for the high-speed railway.Yang and Zhang [52] investigate the effects of competition between air transport and high-speed rail.The results indicated that for homogeneous passengers and given schedule frequencies, that the ticket prices of air transport and HSR decrease in the weight of welfare.Van den Berg and Verhoef [38] analyzed congestion pricing in a road and rail network with heterogeneous users, where the train and car are imperfect substitutes.The bottleneck congestion and the crowding congestion are used respectively to pricing in road and rail.Gremm [13] investigated the intermodal competition between a railway company and intercity bus companies in Germany.The results show that the railway prices are lower on routes with intermodal competition compared to monopolistic routes.Wang et al. [41] investigated the effect of travel time and safety of high-speed rail speed on airline traffic and price, taking into account the degree of substitutability between the two services.The results show the significant effect of reducing the travel time of high-speed railways airline traffic and price.Zhang et al. [56] analyzed the effect of the high-speed railway system on air ticket pricing and flight frequency in China.The results indicated on the routes with HSR services, airlines' prices and frequencies were reduced greatly.Su et al. [35] investigated the effect of the development of high-speed rail on airlines price.The results show a change in price strategy for leisure and business airline travelers.
Based on the above-mentioned overview, most of the previous work used stochastic programming to handle the demand uncertainty.Despite the fact that comprehensive and extensive researches are existed in the literature, using machine learning techniques along with optimization methods is neglected.Finally, the development of a mathematical model for ticket-pricing in the field of passenger train formation planning is the other issue that is not considered.Therefore, in order to enrich the literature, this paper presents a mathematical model for the integrated pricing-train formation problem that used a framework that integrated machine learning methods with optimization models.The objective function of this paper is to maximize the profits of companies providing rail services and determining the optimal number of the train.Moreover, the proposed model employs the Robust Fuzzy Stochastic Programming (RFSP) approach to handle the demand uncertainty.

Problem definition
According to the above-mentioned discussion, this study aims to integrate the pricing of the rail passenger transportation system and the train formation problem, which has not been addressed in related literature.So, the main contribution of this study is to provide a comprehensive model for pricing passengers' tickets in the railway system and combine it with the train formation problem that can deal with the weaknesses of each model of machine learning and optimization.The objective of this paper is to maximize the profits of companies providing rail services and determine the optimal number of the train.In order to achieve this goal, we proposed a framework illustrated in Section 4.

Assumptions
-Multiple periods are taken into account under 30 days' time horizon.-Train capacity is pre-determined and limited.In other words, the goal is to allocate demand to the trains, and it is assumed that trains cannot change the wagon's arrangement along the origin-destination path.-The travel time is definite and the demand is uncertain and dynamic.-Unsatisfied demand in each time period is considered as lost demand.
-No new line will be added to the railway network during the investigation period.Also, no station will be removed from the line or added to it.-The type and the quality of service provided by each train are known and do not change during the investigation period.

Research method and framework
The proposed optimization framework solves a joint pricing and train formation problem.This framework includes two stages (see Fig. 1).Our proposed framework has two phases including the machine learning-based stage and optimization stage.
The machine learning-based stage phase estimated the ticket price of the railway system by using the regression-based machine learning approaches.To ticket pricing, a machine learning workflow is considered which is known as the Cross-Industry Standard Process for Data Mining (CRISP-DM) and is described by Shearer [34].The process of machine learning starts with data collection.In our case, we used historical data about ticket reservations in the railway system (see Sect. 4.1).Then, the data is analyzed to realize and investigate the data structure in Section 4.2.Finally, a regression-based machine learning algorithm is used to fit the model and to predict the price in Section 4.3.
In the optimization stage, first of all, we used previous stage estimated price as a parameter of the train formation problem to define the optimal number of trains (see Sect. 5).Then, the robust fuzzy stochastic programming approach is used to deal with the uncertainty of demand and to analyze the results (see Sect. 6).

Data collection
In order to collect the passenger reservation data, the real data of a railway company in Iran, is collected.The trains that belong to this railway company are divided into 5 classes, each of which is slightly different in terms of service quality.This classification includes general class (type 1), economy class (type 2), business class (type 3), special class (type 4), and super special class (type 5).Type 1 is the cheapest and type 5 is the most expensive in comparison to other trains.This railway company provides most of its services on the Tehran-Mashhad route.Therefore, in this research, information related to the passenger ticket reservation on the Tehran-Mashhad route has been used.Exactly, our dataset includes data collected from April 2019 to July 2019, both on weekdays and weekends.Given the detailed booking and ticketing information available to this study, we are able to incorporate the following variables in the model: Table 1 provides the definitions and summary statistics for some variables used in estimation.There are several features of the data depicted in Table 1 that are worth mentioning.First, the highest number of trips is from Tehran to Mashhad or Mashhad to Tehran.In the considered route, the volume of the passenger is considerable in Tehran and Mashhad, which is also clear in Figure 6.Another note is the distance between the  ticket booking and departure day.According to observations, most travelers book tickets in the days close to departure time.Indeed, tickets are purchased on average 17 days before departure day.

OD pairs analyzed
Iran is a vast country with hundreds of kilometers between major cities.Therefore, trains are nice tools to bridge those long distances.One of the long-distance paths with a huge number of passengers is the route between Mashhad and Tehran.Mashhad is one of the biggest cities in Iran, which entices hosts thousands of travelers annually due to tourist and religious attractions.Considering the Tehran-Mashhad rail network, this line totally covers 926 km and connects 50 cities, including Garmsar, Semnan, Damghan, Shahrood, and other cities.Depending on the train type, the duration of trips varies between 8 and 12 h.There are a total of 15 stations on this route, that we exclude 9 stations because passenger demand in these markets is low and insufficient for estimation.The remaining 6 stations are shown in Figure 2.
Through this data, concerning the origin and destination, we can calculate the number of passengers per month for the considered route (see Fig. 3).Accordingly, the volume of passengers' commutes per month from Tehran and Mashhad are considerable in comparison to other cities, which representations the strategic position of these cities in the proposed route.

Data preparation
All of the collected data need a lot of work before using.The collected data should be cleaned and prepared according to the model requirements.All the unnecessary data is removed and missing value is investigated.

Missing data
In our dataset, approximately 20% percent of the data is missing.The data relating to Tehran, Mashhad, Neyshabur, and Shahrood are more complete.The pattern of missing data is related to the less commuting city such as Semnan and Neghab.There are many methods that can be used to account for missing data.In this paper, we used the Predictive Mean Matching (PMM) for imputation missing values.PMM is widely used for imputation missing values.It aims to reduce the bias introduced in a dataset through imputation, by drawing real values sampled from the data.This is achieved by building a small subset of observations where the outcome variable matches the outcome of the observations with missing values [32].

Fit the models
In order to develop a model for price forecasting, linear regression has been used, which is presented below.Linear regression is a subdivision of supervised learning, investigating the relationship between dependent and independent variable/variables.The goal of regression analysis is to create a mathematical model that can be used to predict the values of a dependent variable based upon the values of an independent variable.
Let { 1 ,  2 , • • • ,   } be a set of  observations.The linear regression outputs a prediction for the target value using the function : where the  0 is the intercept, the   ( = 1, • • • , ) is the slope and  is the regression residual.The slope indicates the relationship between the dependent variable and a series of other independent ones.The  is the difference between the predicted value (ŷ) and the observed value.Based on the multiple linear regression, our prediction model is defined as follows: where: -   is the point-to-point O&D fare for each ticket that is purchased for train  in time ; -  is a vector of variables accounting for determining the effect of origin in the tickets that are purchased; -  is a vector of variables accounting for determining the effect of destination in the tickets that are purchased; -DT  is a vector of variables accounting for determining the effect of departure time in the tickets that are purchased; -AT  is a vector of variables accounting for determining the effect of arrival time in the tickets that are purchased; -NDD  is a vector of variables considered for determining the effect of the number of days from departure in the tickets that are purchased; -DW  is a vector of variables considered for determining the effect of day of the week in the tickets that are purchased; -MY  is a vector of variables considered for determining the effect of month of the year in the tickets that are purchased; -ToT  is a vector of variables considered for determining the effect of type of train in the tickets that are purchased; - 0 is the intercept term; -  is the regression coefficient for regressor ; -   is the error term.

Evaluation and validation
Before discussing the statistical description of the regression model, some points should be made.As can be seen, only two indices related to the train type and time are considered in the developed regression model.Our justification for considering the  index for all variables is the fact that all variables expressed in the regression model depend on the train type.In other words, all information, including origin, destination, departure time, etc., are determined according to train number.It should also be noted that, since the price predicted by the regression model is used as an input in the optimization model, increasing the indices results in more computational complexity of the mathematical model.
Table 2 indicates the statistics description of the model.There are 841 977 observations considered in this sample from the specific route control variables that are unreported for the sake of brevity.According to Table 2    the values reported for R-squared and F-statistic indicate the performance of the fitted model.Based on the fitted model, the prediction price for 10 periods obtained as demonstrated in Table 3.
According to Table 3, the prices predicted for train Type 5 are higher than other trains.Also, the price of this train fluctuates more than the other ones.Based on initial information received from the railway company, due to variable demand and the high price of Type 5 trains, price fluctuations for this type of train are due to the demand coverage and revenue management goals.
Figures 4 and 5 demonstrate the price fluctuation due to change in the day and the month of the booking ticket.Since July is the beginning of the summer holidays in Iran, price fluctuation is considerable than in other months.But the ticket booking day seems to have little effect.

Model formulation
In this section, a mixed-integer programming (MIP) is developed to maximize the total revenue of selling tickets (second phase of our research framework).It should be noted that we were inspired by the model introduced by Yaghini et al. [47] and developed it based on our problem characteristics.The Objective function (5.1) considered the total cost and profit, calculated as the sum of the fixed costs of the trains and shipping cost of demand decrease from the profit of selling the ticket.The variable and fixed costs are dependent on many factors such as time, season, weather conditions [49], and economical changes such as inflation fluctuation.The fixed cost mainly consists of the cost of a unit of the locomotive such as train crew that is independent of the number of cars assigned to the train.While, shipping or variable cost is related to the number of locomotives assigned to the train [47]. (5.1) In the above-mentioned equation, the first term calculates the revenue for selling tickets.The second term shows the fixed cost for the formation train and, the last term indicated the shipping cost for transferring passengers.
(5.2) Constraints (5.2) ensure that the train containing the passenger must leave the origin and enter the destination.Also, demand satisfaction at each origin-destination is controlled by this equation.As mentioned previously, (  ) refer to origin nodes for demand  in period , while (  ) mention to destination nodes for demand  in period .Also, each demand  ∈  is characterized by a given amount    of flow to be shipped from an origin node (  ) to a destination node (  ) in period .The    is calculated based on equation (5.5) proposed in Section 5.After calculating the total amount of demand for each train in each period (   ), the origin/destination nodes for demand  in period  is determined based on available information from customer demand for each city and is placed in (  ) and (  ), respectively.
3) assures that the number of cars that can be assembled in the origin yard should not exceed the yard capacity.The number of cars can be assembled only considered in the origin yard because the arrangement of passenger trains does not change along the way.
Constraint (5.4) states that the total flow on the train cannot exceed its capacity.They also ensure that no passengers are allowed on a train unless the fixed cost is paid.
≥ 0 ∀, , ;    ∈ {0, 1} ∀, . ( Constraints (5.5) calculate the proposed demand function.In general, demand is a function of various factors, but in this study, price is considered as the main factor affecting demand.Accordingly, demand decreases when the price increases.The vector  shows price sensitivity.Also, the number of customers switching from the train  to the train  ′ per unit increase as a result of the price difference between   and   ′ considered by using vector .The actual demand and the vectors  and  achieved based on forecasting the previous period.

Robust fuzzy stochastic programming approach
Stochastic programming is one of the methods used in the situation the data probability distributions are known or can be estimated, is an appropriate approach to deal with the uncertainty of parameters.Also, using stochastic programming is logical only when an action can be repeated several times [37].Due to the repeated characteristics of traveling by train, usually, there is enough historical data to model uncertain parameters within each scenario.Despite the repetition of some events, due to the high sensitivity of some parameters, relying on historical data for decision making is illogical and it is necessary to benefit from experts' experiences and their professional opinions.In practice, when there is not a sufficient amount of historical data or it is necessary to rely on expert opinion to provide reasonable estimations for imprecise parameters [9], fuzzy mathematical programming is used.This method uses fuzzy numbers to formulate parameters with epistemic uncertainty through the possibility theory.
In the context of passenger transportation in the railway system, usually, there is historical data about passenger demand to estimate the probability distribution.But the expert's opinion expresses the existence of inherent impreciseness in the scenario-dependent data.The existence of such inherent uncertainties in demand can significantly influence the performance of railway planning.As such, since we are dealing with a parameter with a mixture of random and possibilistic nature, it is necessary to consider a framework to cope with the hybrid uncertainty simultaneously.Recently, new methods have been developed to model hybrid uncertainty and handle the ambiguity of parameters.
In this paper, we used the method described in Fazli-Khalaf et al. [10] named the Robust Fuzzy Stochastic Programming approach that is suitable to cope with the uncertainty of passenger demand with a mixture of random and possibilistic nature.The logic of the RFSP is based on considering the uncertainty parameter as a scenario-based parameter and using the experts' knowledge to estimate the range in each scenario.In order to express the RFSP method, we consider the following compact model: is considered as the variable of the above model.The vectors  , , and  represented the parameters of the model.The matrices ,  and,  are coefficient matrices of the constraints.Also, all binary decision variables are included in vector  and all the continuous decision variables are included in vector .It is assumed that vectors  and  and the coefficient matrix  are the uncertainty parameters of this issue.To develop the RFSP approach, the method stated in Leung et al. [19] is used to consider the stochastic programming aspect of the model.Based on this method, the robust stochastic approach for the Model (6.1) is defined as follows: shows the possible scenarios while   denotes the probability of scenario .The first term in the objective function is the expected value of , maximizing the total profit of the system.The second term, attempts to minimize the deviation of the total profit, and the third term, try to minimize the penalty violation of constraints.

Robust fuzzy stochastic programming model
As mentioned previously, in this research we use the robust fuzzy stochastic programming model to deal with the uncertainty of demand.Due to the incompatibility of customer behavior and higher demand on specific routes during seasons of holidays and festivals [18], demand is a parameter with uncertain nature with significant fluctuation.Despite the availability of sufficient and reliable information regarding the demand, fluctuation in Table 4. Fix cost of each train (Million Toman).
Train type 1 5 6.5 7 6 Train type 2 6 7 6.5 5.5 Train type 3 6.5 6.5 7 6.5 Train type 4 6.5 7 6 6.5 Train type 5 5.5 6.5 6. 5 7 demand as a result of customer behavior, makes a complex and unpredictable tendency in this parameter.In this situation, hybrid methods generate reliable output that could be desirable.In order to estimate the possibility distribution function for demand, we used the expert's opinions.Based on their comments, demand is defined based on a trapezoidal distribution and credibility measure.Based on the RFSP approach, the joint pricing and train formation problem under demand uncertainty is defined as follows:

Sets
In addition to the sets defined in Section 5, the following set is added.

Parameters
Some parameters defined in Section 5 are modified as the following parameters; others are the same as defined before.

𝑟𝜃
Demand for train  in period  under scenario    Price sensitivity under scenario    ′  Number of customers switching from the train  to the train  ′ per unit increase in the price difference between   and   ′ under scenario     Ticket prices on train  in period  under scenario

Variables
As with the parameters, some variables are modified and the others are the same as defined before.

𝑋 𝑡
Amount of flow of demand  on train  in period  under scenario  Based on the sets, parameters, and variables defined in this section, we rewrote the model presented in Section 5 based on the provided descriptions in Section 6.

Computational results
In this section, our model is applied to an instance problem.As mentioned previously, the real data collected from a railway company in Iran belonging to the stations shown in Figure 7 is used in this research.The scale of the problem is as follows: the number of yards is 6; the type of train is 5, and the number of time periods is 10.Table 4 provides the fixed cost of the train in 4 periods, while the passenger demand is given in Table 5.
The ILOG CPLEX 12.6 optimization software is employed to solve the model of the research.All the experiments are carried out by a Pentium dual-core 3.9 GHz computer with 8 GB of RAM.In order to prepare the data and fitting the model, we used R and Python.A summary of the results in terms of total income obtained during a month, corresponding revenue across the different months, and corresponding revenue across different trains are provided in Figures 6-8, respectively.Based on Figure 6, train type 1, by allocating over 50% of demand, is the most profitable train in comparison to others.Also, the profit obtained from trains types 3, 4, and 5 is almost equal.Although the price of the Type 1 train is lower than others, it can be considered as a profitable train for the company.In other words, not only is train type 1 a profitable train for the company, but it also is a desirable train for customers.The effect of travel history on profit is demonstrated in Figure 7. From mid-June, summer holidays begin in Iran, and train travel increases considerably.Since the Tehran-Mashhad route has high demand, with the start of the holidays, the volume of passengers increases significantly compared to previous months.
Another analysis is worth mentioning is related to the total income obtained from each OD pair (Fig. 8).In our proposed route, a significant percentage of passengers are traveled between Tehran and Mashhad without   stopping at middle stations.Accordingly, the revenue from selling tickets on this route is mostly due to nonstopping passengers.Because of this significant revenue, the railway company can form only non-stopping trains.
The other result obtained from our model is investigating the price sensitivity effect on the income fluctuation.Figure 9 shows the profit variation as a result of changing the coefficient related to price sensitivity.According to this figure, from 0.5 onwards, the profit has fallen more steeply, which indicates that the passenger with high  sensitivity of price has a significant impact on profit.Therefore, if a significant percentage of passengers are price sensitive, the company's profits will be greatly reduced as a result of price increases.Hence, it is necessary to consider a solution, which minimizes the impact of passengers' price sensitivity on the final profit.
Table 6 indicated the accepted demand (   ) for a ten-day period.Based on these results, the average demand for this route is approximately 37 000 people per day, most of which are related to the train type 1.In order to examine the demand more clearly, we demonstrated the difference between the actual and the accepted demand in Figure 10.Accordingly, the average distance between actual demand and accepted demand is about 1000 people.This difference may be due to the inability of the company to satisfy the demand or the significant impact of price-sensitive passengers.In order to determine the company's ability to satisfy the demand, we examined the difference between the actual demand and the accepted demand for each train in Figure 11.Since the difference between them is negligible, the number of price-sensitive passengers seems to be considerable, which led to a significant reduction in demand.
Based on the above analysis, it could be concluded that the company can allocate a significant percentage of its train schedule to train type 1 because of its notable profitability.Also, due to the considerable volume of passengers traveling between Tehran and Mashhad without stopping on middle stations, the company can use special facilities for these passengers or can plan specifically for this route.

Robust fuzzy stochastic programming model performance evaluation
In order to evaluate the performance of the deterministic and RFSP model, several numerical experiments are implemented and the related results are reported in this section.The four prominent values of trapezoidal In the realization model, we use the objective function of the definite model.Also, we used the constraints have the uncertainty parameters.In this model, Ψ +  and Ψ −  are the only decision variables that determine the violation of chance constraints under realization (see [27]).The  represents the violation fine of constraints that apply when Ψ + takes a value.In the above model,  real represents the realization value of the parameter.Values such as  * marked with * represent the solution obtained by the models under nominal data.Other factors in the above model such as  show the parameters of the problem.
The results obtained from Table 8 demonstrate the efficiency of the RFSP model and the advantage of using it.Based on Table 6, for all experiments, the values of the objective function (profit) are improved in the RFSP model in comparison to the deterministic one while semi-variance has decreased in the RFSP model.Therefore, using RFSP to deal with the uncertainty of demand improves the results.Given the above results, considering the RFSP model to deal with the uncertainty of sensitive parameters such as demand, obtained realistic and reliable results.

Conclusions
Given the importance of pricing in the railway system and its effect of it on passenger demand, this paper has addressed a framework that focuses on ticket pricing to maximize the revenue of selling the ticket.Due to the complexity of traditional pricing methods, we used regression-based machine learning approaches to obtain the optimal price.The result demonstrates that the accuracy of the fitted model is appropriate to predict the price and is able to combine with the optimization problem.After using a regression-based machine learning model to forecast the ticket pricing of the passenger railway, we applied the obtained price in the train formation problem.The results of the model's analysis show the efficiency of the developed framework in pricing with less complexity and proportionality of it for real and large problems.Because of the imprecise nature of the demand and weaknesses of traditional methods to obtain reliable output decisions, we used the hybrid uncertainty method named the robust fuzzy stochastic programming to handle the inherent uncertainty of this parameter.Using the real data inspired by the real case study, both the non-deterministic and deterministic models are solved and compared to each other.The results showed the efficiency of the result obtained from a robust fuzzy stochastic programming model.
As future works, in terms of the machine learning methods, taking into account the others technique such as neural networks could be considered in the railway ticket price prediction.Also, considering other variables such as the sales impact of other railway companies and government effect could be considered as an influential variable.In terms of the optimization methods, developing competitive models for considering the competition between railway companies, and using other alternative methods to maximize the companies' profit may be considered in the train formation problem.Create a balance between the customer's desired price and the company's satisfying price is also an important issue that should be considered in future studies.

Figure 3 .
Figure 3.The number of passengers commutes per month for each city.(a) Number of passengers arrival each city.(b) Number of passengers departure each city.

Figure 6 .
Figure 6.The profit obtained from each train during a month.

Figure 7 .
Figure 7.Total income obtained during a month.

Figure 8 .
Figure 8. Profit obtained from each OD pair during a month.

Figure 9 .
Figure 9.The profit changes as a result of variation the price sensitivity.

Figure 10 .
Figure10.The difference between actual demand and accepted demand.

Figure 11 .
Figure 11.The difference between actual demand and accepted demand per train.

Table 1 .
Some features of the data.

Table 2 .
, The statistics description of the model.
Number of customers switching from the train  to the train  ′ per unit increase in the price difference between   and   ′ Amount of demand  that is satisfied by train  in period Index of demand from origin node () Destination node ()  = 1, . . .,   + () Index of trains outward from yard   = 1, . . .,   − () Index of trains inward to yard   = 1, . . .,