Train timetable determination method, device, equipment and medium
By using reinforcement learning algorithms in urban rail transit, combined with policy network models and value network models, the train schedule is optimized, the problem of departure time interval optimization is solved, operating costs and passenger waiting costs are reduced, and optimization efficiency and reliability are improved.
Patent Information
- Application Number
- CN202211469422.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-22
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2042-11-22
AI Technical Summary
Existing technology cannot optimize departure time intervals and cannot reasonably balance enterprise operating costs and passenger waiting costs, resulting in high passenger waiting costs or high enterprise operating costs.
A method based on reinforcement learning is used to optimize the train timetable through interactive iteration of the policy network model and the value network model. A virtual operating environment is constructed based on passenger flow information and train dynamics characteristics, and the optimized train timetable is learned and determined.
It improves the optimization efficiency of train timetables under long-term traffic mode, reduces subway operating costs and passenger waiting costs, and improves the operability and robustness of the method.
Smart Images

Figure CN115743248B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rail transit technology, and in particular to a method, device, equipment and medium for determining a train timetable. Background Art
[0002] In the operation of urban rail transit, the quality of the train timetable is related to the level of enterprise operating costs and passenger waiting costs. Too long a time interval between departures will increase passenger waiting costs and thus reduce passenger satisfaction, while too short a time interval between departures will increase enterprise operating costs. Summary of the invention
[0003] The present invention provides a method, device, equipment and medium for determining a train timetable, which are used to solve the technical problems that the prior art cannot optimize the departure time interval and cannot reasonably balance the enterprise operating cost and the passenger waiting cost, and provides an optimization solution for the traffic train timetable under the long route mode based on reinforcement learning.
[0004] In a first aspect, the present invention provides a method for determining a train timetable, comprising:
[0005] Repeat the following steps until the preset conditions are met:
[0006] Input the current train status group to the strategy network model to obtain the current departure interval output by the strategy network model; input the next train status group to the strategy network model to obtain the next departure interval output by the strategy network model;
[0007] Input the current train status group and the current departure interval into the value network model to obtain a first evaluation value output by the value network model; input the next train status group and the next departure interval into the value network model to obtain a second evaluation value output by the value network model;
[0008] The strategy network model is updated according to the current departure interval and the first evaluation value, and the value network model is updated according to the first evaluation value and the second evaluation value;
[0009] After the preset conditions are met, the target train status group is input into the strategy network model to obtain the target departure interval output by the strategy network model;
[0010] Determine the train schedule of the target train according to the initial departure time of the target train and the target departure interval;
[0011] The state group is determined according to the initial departure time of the train corresponding to the state group and the total number of remaining passengers who are unable to board the train corresponding to the state group in all stations along the line of the train corresponding to the state group.
[0012] According to the train schedule determination method provided by the present invention, before inputting the next train status group and the next departure interval into the value network model, it also includes: determining the next train status group according to the current train status group and the current departure interval;
[0013] The determining the next train status group according to the current train status group and the current departure interval specifically includes:
[0014] Determine the initial departure time of the next train according to the initial departure time of the current train and the current departure interval;
[0015] The total number of passengers waiting to take the next train at each station is determined based on the number of passengers who are unable to take the current train and are forced to wait for the next train at each station along the route and the number of new passengers departing from each station to the designated station;
[0016] Determine the actual number of passengers arriving at the designated station at each station based on the remaining carrying capacity of the next train and the total number of passengers waiting to board the next train at each station;
[0017] Determine the number of remaining passengers who cannot take the next train to the designated station at each station based on the total number of passengers departing from each station to the designated station and the actual number of passengers arriving at the designated station at each station, so as to determine the total number of remaining passengers who cannot take the next train at all stations;
[0018] The next train status group is determined according to the initial departure time of the next train and the total number of remaining people who cannot take the next train in all stations.
[0019] According to the train schedule determination method provided by the present invention, the updating of the strategy network model according to the current departure interval and the first evaluation value includes:
[0020] Determine a first update value according to the first learning parameter, the influence gradient of the current departure interval, and the influence gradient of the first evaluation value;
[0021] An updated policy network parameter is determined according to the policy network parameter corresponding to the policy network model and the first update value, so as to update the policy network model according to the updated policy network parameter.
[0022] According to the train schedule determination method provided by the present invention, updating the value network model according to the first evaluation value and the second evaluation value includes:
[0023] Determine the reward function for the current train based on the passenger waiting cost and the enterprise operating cost;
[0024] Determine a reward target according to the reward function and the second evaluation value;
[0025] Determine a reward error according to the first evaluation value and the reward target;
[0026] Determine a second update value according to a second learning parameter, the reward error, and an influence gradient of the first evaluation value;
[0027] Determining updated value network parameters according to the value network parameters corresponding to the value network model and the second update value, so as to update the value network model according to the updated value network parameters;
[0028] The passenger waiting cost is determined according to the total waiting time spent by passengers in all stations in the current train.
[0029] According to the train schedule determination method provided by the present invention, the reward function for determining the current train number according to the passenger waiting cost and the enterprise operating cost includes:
[0030] The passenger waiting cost is determined based on the product of the passenger waiting time and the unit time value;
[0031] Determining a first weighted value according to the passenger waiting cost and the first weight value;
[0032] Determining a second weighted value according to the enterprise operating cost and the second weight value;
[0033] Determine a reward function for the current trip according to the first weighted value and the second weighted value;
[0034] The sum of the first weight value and the second weight value is a preset constant.
[0035] According to the train schedule determination method provided by the present invention, the preset condition is any one of the following conditions:
[0036] The train departure time exceeds the traffic operation time;
[0037] There are no leftovers in any station;
[0038] Alternatively, the train departure time exceeds the traffic operation time and there are no leftover passengers at all stations.
[0039] According to the train schedule determination method provided by the present invention, the train schedule of the target train is determined according to the initial departure time of the target train and the target departure interval, including:
[0040] The departure time of each station along the train line is determined according to the initial departure time of the target train, the target departure interval, the running time between stations, and the stay time at each station, so as to determine the train schedule of the target train according to the departure times of all stations.
[0041] In a second aspect, the present invention provides a train timetable determination device, comprising:
[0042] Execution unit: used to repeatedly execute the following steps until the preset conditions are met:
[0043] Input the current train status group to the strategy network model to obtain the current departure interval output by the strategy network model; input the next train status group to the strategy network model to obtain the next departure interval output by the strategy network model;
[0044] Input the current train status group and the current departure interval into the value network model to obtain a first evaluation value output by the value network model; input the next train status group and the next departure interval into the value network model to obtain a second evaluation value output by the value network model;
[0045] The strategy network model is updated according to the current departure interval and the first evaluation value, and the value network model is updated according to the first evaluation value and the second evaluation value;
[0046] An acquisition unit is used to input the target train status group into the strategy network model after the preset conditions are met, and acquire the target departure interval output by the strategy network model;
[0047] Determining unit: used to determine the train schedule of the target train according to the initial departure time of the target train and the target departure interval;
[0048] The state group is determined according to the initial departure time of the train corresponding to the state group and the total number of remaining passengers who are unable to board the train corresponding to the state group in all stations along the line of the train corresponding to the state group.
[0049] In a third aspect, the present invention further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, a train timetable determination method as described above is implemented.
[0050] In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements any of the train timetable determination methods described above.
[0051] The present invention provides a method, device, equipment and medium for determining a train schedule, which can determine the current departure interval through a policy network model and a current train status group, and determine the next train status group according to the current train status group and the current departure interval, and then determine the next departure interval, thereby realizing the continuous interactive iteration of the train status group and the departure interval, and at the same time introducing a value network model, using reward error as a value to guide the continuous iteration and update of the policy network model and the value network model, thereby determining an optimized policy network model, and finally determining a train schedule according to the optimized policy network model. The present invention constructs a virtual operating environment based on passenger flow information and train dynamics characteristics, uses a reinforcement learning algorithm to learn and optimize on the constructed environment, simulates train operation conditions, and then obtains a train schedule. The present invention has strong operability and high robustness, can greatly improve the optimization efficiency of the train schedule under the long route mode, and effectively reduce subway operating costs and passenger waiting costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0053] Figure 1 It is one of the flow charts of the method for determining a train timetable provided by the present invention;
[0054] Figure 2 It is a schematic diagram of a process for determining the next train status group provided by the present invention;
[0055] Figure 3 is a schematic diagram of a process for updating the strategy network model provided by the present invention;
[0056] Figure 4 is a schematic diagram of a process for updating the value network model provided by the present invention;
[0057] Figure 5 It is a flow chart of determining the reward function of the current train number provided by the present invention;
[0058] Figure 6 It is a schematic diagram of the traffic operation scene in the long-distance road provided by the present invention;
[0059] Figure 7 This is the second flow chart of the train timetable determination method provided by the present invention;
[0060] Figure 8 It is a structural schematic diagram of the train timetable determination device provided by the present invention;
[0061] Fig. 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0062] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0063] Traditional methods for optimizing train timetables can be divided into two categories. The first category is integer programming or mixed integer programming methods, which have high computational complexity, large amount of calculations, and slow convergence speed. The second category is heuristic methods, such as particle swarm optimization, genetic algorithm, and differential evolution algorithm. These methods rely on expert experience, have unstable performance, and are prone to fall into local optimal solutions.
[0064] The present invention abandons the above-mentioned traditional optimization algorithm and adopts model-free reinforcement learning in the reinforcement learning algorithm to directly interact with the environment in real time to learn the optimal strategy, which has good versatility for complex application scenarios. Figure 1 The present invention discloses a method for determining a train timetable, comprising:
[0065] Repeat the following steps until the preset conditions are met:
[0066] Input the current train status group to the strategy network model to obtain the current departure interval output by the strategy network model; input the next train status group to the strategy network model to obtain the next departure interval output by the strategy network model;
[0067] Input the current train status group and the current departure interval into the value network model to obtain a first evaluation value output by the value network model; input the next train status group and the next departure interval into the value network model to obtain a second evaluation value output by the value network model;
[0068] The strategy network model is updated according to the current departure interval and the first evaluation value, and the value network model is updated according to the first evaluation value and the second evaluation value;
[0069] After the preset conditions are met, the target train status group is input into the strategy network model to obtain the target departure interval output by the strategy network model;
[0070] Determine the train schedule of the target train according to the initial departure time of the target train and the target departure interval;
[0071] The state group is determined according to the initial departure time of the train corresponding to the state group and the total number of remaining passengers who are unable to board the train corresponding to the state group in all stations along the line of the train corresponding to the state group.
[0072] Before obtaining the final optimized policy network model, the present invention needs to continuously train the model so that the policy network model can achieve the optimal effect. Therefore, the following steps need to be repeatedly performed until the preset conditions are met:
[0073] In step 101, the current train state group is input into the policy network model to obtain the current departure interval output by the policy network model; the next train state group is input into the policy network model to obtain the next departure interval output by the policy network model. The present invention first initializes the training environment, and trains the policy network model according to the initial policy network parameters so that the policy network model can output the current departure interval according to the current train state group. Those skilled in the art understand that after constructing the design environment, the present invention adopts a deterministic policy reinforcement learning algorithm, the policy network control instruction moves, and takes action based on the state. The value network model evaluates the action based on the state, thereby guiding the policy network to make improvements. In the present invention, the state is the current train state group, and the action is the current departure interval. Then, the next train state group is determined according to the current train state group and the current departure interval, and the next train state group is input into the policy network model to obtain the next departure interval output by the policy network model.
[0074] The state group is determined based on the initial departure time of the target train corresponding to the state group and the total number of remaining people who cannot take the target train at all stations along the line of the target train. The present invention uses the initial departure time of the current train and the total number of remaining people who cannot take the current train at all stations as a state tuple, and after executing the action, that is, inputting the current departure interval, generates the next state tuple, that is, the next train state group, and the initial departure time of the next train is determined based on the initial departure time of the current train and the current departure interval. The total number of remaining people who cannot take the next train at all stations is determined by the sum of the total number of passengers departing from each station to the designated station and the actual number of passengers arriving at each station, who cannot take the next train to the designated station.
[0075] Optionally, the inputting of the current train status group into the policy network model to obtain the current departure interval output by the policy network model includes: constructing the policy network model according to initial policy network parameters; inputting the initial departure time of the current train and the total number of remaining persons who cannot take the current train at all stations to obtain the current departure interval output by the policy network model.
[0076] Specifically, the strategy network model is constructed according to the initial strategy network parameters, which are the parameters used to construct the strategy network model in model-free strong learning. Before constructing the virtual operation environment, the present invention needs to assume that there are sufficient trains and fixed train formations in the long route mode, that the trains adopt a stop-at-every-station mode and that overrunning is prohibited, and that the running time of the trains between stations, the stopping time at the stations and the return time at the terminal station are known. At this time, the train timetable is only related to the departure time of the train from the train departure station.
[0077] Furthermore, a passenger travel quantity matrix is preset, and the quantity matrix consists of three dimensions, the first dimension is time, the second dimension is the departure station, and the third dimension is the destination station, for example:
[0078]
[0079] In formula (1), the number matrix indicates that the number of passengers departing from station i and arriving at station j from time t-1 to time t is Δ.
[0080] The total number of remaining people who cannot take the current train at all stations can be directly obtained in the virtual operating environment constructed as above. The initial departure time of the current train and the total number of remaining people who cannot take the current train at all stations will be input into the strategy network model as a whole, that is, the current train status group, and the current departure interval will be output according to the strategy network model.
[0081] Those skilled in the art will appreciate that the current departure interval, as an action in reinforcement learning, is represented by a scalar a k It is composed of, indicating the departure time interval between the k+1th train and the kth train. According to the operation regulations, the departure time interval of the train has a restricted interval [h min ,h max ], where h max Indicates the maximum time interval allowed for train departure. In order to ensure service quality, h max No more than 720 seconds, h min Indicates the minimum time interval allowed for train departure. In order to ensure the safety of train operation, h min Not less than 90 seconds. k Limited to [h min ,hmax ] range, optionally, the present invention uses a neural network model to output a k In order to ensure the stability of the reinforcement learning algorithm, the neural network output value can be Restricted to the range of [-1,1], and then converted to [h min ,h max ] range, thus obtaining the current departure interval a k :
[0082]
[0083] In formula (2), the current departure interval, h max Indicates the maximum time interval allowed for train departure, h min Indicates the minimum time interval allowed for train departure. is the output value of the neural network, a k The current departure interval.
[0084] In step 102, the current train status group and the current departure interval are input into the value network model to obtain a first evaluation value output by the value network model, and the next train status group and the next departure interval are input into the value network model to obtain a second evaluation value output by the value network model. The construction of the value network model is similar to that of the measurement network model. The value network model is constructed according to the initial value network model parameters. Since the initial value network parameters and the initial strategy network parameters at the beginning of training are random and non-targeted parameters, they will be continuously updated in the subsequent iteration process according to the reward error guided by the reward function, forming a direction that continuously approaches the optimization of the value network model and the measurement network model. Therefore, the purpose of this step is to determine the difference between the value evaluation under the current train status and the value evaluation under the next train status.
[0085] In step 103, the policy network model is updated according to the current departure interval and the first evaluation value, and the value network model is updated according to the first evaluation value and the second evaluation value. The present invention updates the policy network model according to the current departure interval and the first evaluation value to obtain an updated policy network model, and updates the value network model according to the first evaluation value and the second evaluation value to obtain an updated value network model. The present invention calculates the update parameters for updating the policy network model through the current departure interval and the first evaluation value, and then calculates the updated policy network parameters according to the initial policy network parameters and the update parameters of the policy network model, and then determines the updated policy network model. Accordingly, the update parameters for updating the value network model are calculated according to the reward error and the first evaluation value, and then the updated value network parameters are calculated according to the initial value network parameters of the value network model and the corresponding update parameters, and then determines the updated value network model.
[0086] The basis for updating the above-mentioned value network model is the reward error, and the reward error is determined according to the first evaluation value, the second evaluation value and the reward function, that is, the update of the value network model is realized according to the evaluation value and the reward function before and after each iteration. The relationship between the passenger waiting cost and the enterprise operating cost specified in the reward function is what the present invention needs to solve. It is the key to optimizing the train timetable based on the passenger waiting cost and the enterprise operating cost.
[0087] More specifically, in step 104, after the preset conditions are met, the target train status group is input into the strategy network model to obtain the target departure interval output by the strategy network model. The present invention determines the optimal strategy network model by inputting the next train status group into the updated strategy network model, inputting the next train status group and the next departure interval into the updated value network model, and iterating until the preset conditions are met. The target train status group is input into the strategy network model to obtain the target departure interval output by the strategy network model, and finally determines the train schedule, inputs the next train status group into the updated strategy network model, and inputs the next train status group and the next departure interval into the updated value network model. In the next iteration, the next train status group and the next departure interval will be used as input parameters, and the updated strategy network model and the updated value network model will be used as the models used, thereby achieving continuous iteration. However, for the present invention, it is necessary to set the iteration completion conditions, such as setting the number of iterations, setting the iteration effect estimation, etc.
[0088] Optionally, the preset condition is any one of the following conditions:
[0089] The train departure time exceeds the traffic operation time;
[0090] There are no leftovers in any station;
[0091] Alternatively, the train departure time exceeds the traffic operation time and there are no leftover passengers at all stations.
[0092] Optionally, when the train departure time exceeds the traffic operation time and there are no remaining passengers in all stations, the iteration is stopped, and the final strategy network parameters are determined according to the strategy network parameters determined in the previous iteration and the final update values, so as to construct a final strategy network model according to the final strategy network parameters; the final update value is determined according to the first learning parameter, the influence gradient of the departure interval in the previous iteration, and the influence gradient of the first evaluation value in the previous iteration.
[0093] The traffic operation time is the working time of the train, for example, from 8 am to 9 pm, and from 6 am to 11 pm. In order to ensure that everyone can get on the train, the present invention sets that the iteration is completed only when there are no leftover people in all stations. Based on the above expectations, the present invention actually needs to stop the iteration when the train departure time exceeds the traffic operation time and there are no leftover people in all stations, and then determine the final strategy network parameters according to the strategy network parameters determined in the previous iteration before stopping the iteration and the final update value, and construct the final strategy network model according to the final strategy network parameters.
[0094] In step 105, the train schedule of the target train is determined according to the initial departure time of the target train and the target departure interval. In an optional embodiment, the train schedule of the target train is determined according to the initial departure time of the target train and the target departure interval, including:
[0095] The departure time of each station along the train line is determined according to the initial departure time of the target train, the target departure interval, the running time between stations, and the stay time at each station, so as to determine the train schedule of the target train according to the departure times of all stations.
[0096] In such an embodiment, there are four stations, namely the first station, the second station, the third station and the fourth station, among which the current train departs at 8 o'clock, and the running time between each station is fixed, that is, it takes 11 minutes from the first station to the second station, 13 minutes from the second station to the third station, and 8 minutes from the third station to the fourth station. In the long route mode, there will be not only a line timetable for the outbound direction, but also a line timetable for the return direction. For example, it takes 8 minutes from the fourth station to the third station, 13 minutes from the third station to the second station, and 11 minutes from the second station to the first station. More specifically, the train stays at the first station for 2 minutes, at the second station for 3 minutes, at the third station for 2 minutes, and at the fourth station for 5 minutes. At this time, knowing the departure interval of each train, the train timetable for all trains can be determined.
[0097] Alternatively, since the running time between stations, the stay time at each station, and the return time at the terminal are fixed, the departure time of station i can be calculated by the following formula:
[0098]
[0099] In formula (3), w i represents the dwell time at station i, z i-1,i represents the running time between stations i-1 and i. It should be noted that in the case of the terminal station, the return time needs to be added to formula (3).
[0100] Compared with intercity railway operations, urban rail transit operations have complex train timetables. In the operation of urban rail transit, the quality of the train timetable is related to the level of enterprise operating costs and passenger waiting costs. If the departure time interval is too large, the passenger waiting cost will increase and thus reduce passenger satisfaction. If the departure time interval is too small, the enterprise operating costs will increase and affect the enterprise's profits. The train timetable refers to the arrival and departure times of trains at various stations along the line. It is worth noting that since the distance between stations is fixed, when the operating speed, stop time and return time between stations are determined, the train timetable is only related to the time when the train departs from the initial departure station.
[0101] For ease of understanding, Figure 6 is a schematic diagram of a traffic operation scenario in a long road provided by the present invention, such as Figure 6 As shown in the figure, a long route refers to a route in which a train runs a through train at the starting point and the end point of the line. There are i+1 nodes in total, where node 0 represents the initial departure station, and nodes 1 to i represent stations for passengers to get on and off. The train departs from node 0, passes through i nodes, and returns to node 0, where node i / 2 is the terminal station in the upward direction, and node i is the terminal station in the downward direction.
[0102] Figure 7 This is the second flow chart of the train schedule determination method provided by the present invention. In order to avoid the shortcomings of the traditional method, the present invention proposes to use model-free reinforcement learning to optimize the train schedule. Model-free reinforcement learning interacts with the environment through the intelligent agent, such as Figure 7 As shown, the agent first obtains the state of the environment, and then selects an action to act on the environment according to the strategy. After the environment accepts the action, the state changes, and a reward is generated and fed back to the agent. The agent then selects the next action according to the current state of the environment. In such an embodiment, the purpose of the agent is to learn the strategy function and obtain as many rewards as possible from the environment. In the present invention, the departure time of the train and the total number of people left at the station are used as the state, the departure interval of the train is used as the action, and the inverse of the weighted sum of the enterprise operating cost and the passenger waiting cost is used as the reward. By using the reinforcement learning algorithm, the departure time of all trains within the operating time can be obtained, and the departure time of the train at each station can be calculated from the departure time of the train, thereby obtaining the train schedule.
[0103] The present invention discloses a method for optimizing a train timetable for urban rail transit under a long-route mode based on reinforcement learning. The method is aimed at optimizing a train timetable under a long-route mode during the operation of urban rail transit, constructs a virtual operation environment according to passenger flow information and train dynamics characteristics, creates states, creates actions, creates state transfer rules, creates reward functions, and creates termination conditions.
[0104] The present invention provides a method, device, equipment and medium for determining a train schedule, which can determine the current departure interval through a policy network model and a current train status group, and determine the next train status group according to the current train status group and the current departure interval, and then determine the next departure interval, thereby realizing the continuous interactive iteration of the train status group and the departure interval, and at the same time introducing a value network model, using reward error as a value to guide the continuous iteration and update of the policy network model and the value network model, thereby determining an optimized policy network model, and finally determining a train schedule according to the optimized policy network model. The present invention constructs a virtual operating environment based on passenger flow information and train dynamics characteristics, uses a reinforcement learning algorithm to learn and optimize on the constructed environment, simulates train operation conditions, and then obtains a train schedule. The present invention has strong operability and high robustness, can greatly improve the optimization efficiency of the train schedule under the long route mode, and effectively reduce subway operating costs and passenger waiting costs.
[0105] Figure 2 The present invention provides a flow chart of determining the next train status group, which includes, before inputting the next train status group and the next departure interval into the value network model: determining the next train status group according to the current train status group and the current departure interval;
[0106] The determining the next train status group according to the current train status group and the current departure interval specifically includes:
[0107] Determine the initial departure time of the next train according to the initial departure time of the current train and the current departure interval;
[0108] The total number of passengers waiting to take the next train at each station is determined based on the number of passengers who are unable to take the current train and are forced to wait for the next train at each station along the route and the number of new passengers departing from each station to the designated station;
[0109] Determine the actual number of passengers arriving at the designated station at each station based on the remaining carrying capacity of the next train and the total number of passengers waiting to board the next train at each station;
[0110] Determine the number of remaining passengers who cannot take the next train to the designated station at each station based on the total number of passengers departing from each station to the designated station and the actual number of passengers arriving at the designated station at each station, so as to determine the total number of remaining passengers who cannot take the next train at all stations;
[0111] The next train status group is determined according to the initial departure time of the next train and the total number of remaining people who cannot take the next train in all stations.
[0112] In step 201, the initial departure time of the next train is determined according to the initial departure time of the current train and the current departure interval. Those skilled in the art understand that in the current train status group In the case of k , that is, input the current departure interval. At this time, the time for the next train, that is, the k+1th train, to depart from the departure station or parking lot is
[0113] In step 202, the total number of people waiting to take the next train at each station is determined based on the number of people who cannot take the current train and are forced to wait for the next train at each station among all stations along the train line, and the number of new passengers departing from each station to the designated station. The total number of people waiting to take the next train at each station includes not only the number of people who are forced to wait for the next train because they cannot take the current train, but also the number of people who need to depart from the current station to the designated station. Therefore, the total number of people waiting to take the next train at each station is determined based on the sum of the number of people who cannot take the current train and are forced to wait for the next train at each station and the number of new passengers departing from each station to the designated station. Specifically, the following formula can be used as a reference:
[0114]
[0115]
[0116] in, represents the number of people who did not take the kth train at station i and were forced to wait for the k+1th train, and is the number of new passengers departing from each station i to the designated station j, is the number of passengers departing from station i and arriving at station j from time t-1 to time t.
[0117] In step 203, the actual number of passengers arriving at the designated station from each station is determined based on the remaining carrying capacity of the next train and the total number of people waiting to take the next train at each station. First, the remaining carrying capacity of the next train needs to be determined. Since there are a certain number of passengers in the train, and considering the situation where passengers get on and off the train, if the train capacity is limited, when the number of people waiting to take the k+1th train at station i is greater than the remaining capacity of the train, some passengers will not be able to take the train and will be forced to wait for the k+2th train. When the k+1th train arrives at station i, the remaining carrying capacity that can be provided The calculation formula is as follows:
[0118]
[0119] Where Γ represents the total train capacity, represents the number of passengers in the train before it arrives at station i, The number of passengers who got off at station i.
[0120] After determining the remaining carrying capacity of the next train, the actual number of passengers arriving at the designated station at each station is determined based on the remaining carrying capacity of the next train and the total number of passengers waiting to board the next train at each station, including:
[0121]
[0122] In formula (7), is the actual number of passengers arriving at the designated station at each station, is the passenger waiting at station i to take the k+1th train to station j, that is, if the remaining carrying capacity of the train is sufficient for the passengers waiting at station i to take the k+1th train to station j to board the train, then Otherwise, the remaining space on the train is allocated to passengers according to the percentage of passengers waiting at station i to take the train to station j to all the people waiting for the train at station i. For example, there are 5 passengers waiting to take the train to station j at station i, and there are 15 passengers waiting for the train at station i. Then the percentage of passengers waiting to take the train to station j at station i to all the people waiting for the train at station i is 1:3. At this time, if the remaining carrying capacity is 9, 3 of the passengers waiting to take the train to station j at station i are allowed to board the train.
[0123] In step 204, the number of passengers who cannot take the next train to the designated station at each station is determined according to the total number of passengers departing from each station to the designated station and the actual number of passengers arriving at the designated station at each station, so as to determine the total number of passengers who cannot take the next train at all stations, and the total number of passengers who cannot take the next train at all stations is determined. In combination with steps 201 to 203, the number of passengers who cannot take the next train to the designated station at each station is determined by the following formula:
[0124]
[0125] In formula (8), The remaining number of passengers at each station who cannot take the next train to the designated station, is the total number of passengers departing from each station to the designated station, Indicates the actual number of passengers arriving at the designated station at each station.
[0126] The total number of people left behind who cannot take the next train at all stations can be determined using the following formula:
[0127]
[0128] In formula (9), is the number of remaining passengers at each station who cannot take the next train to the designated station, l k+1 It is the total number of remaining passengers who cannot take the next train at all stations.
[0129] In step 205, the next train status group is determined based on the initial departure time of the next train and the total number of remaining people who cannot board the next train in all stations. The initial departure time of the next train is determined according to step 201, and the total number of remaining people who cannot board the next train in all stations is determined according to steps 202 to 204, thereby determining the next train status group.
[0130] Figure 3is a flow chart of updating the strategy network model provided by the present invention, wherein updating the strategy network model according to the current departure interval and the first evaluation value includes:
[0131] Determine a first update value according to the first learning parameter, the influence gradient of the current departure interval, and the influence gradient of the first evaluation value;
[0132] An updated policy network parameter is determined according to the policy network parameter corresponding to the policy network model and the first update value, so as to update the policy network model according to the updated policy network parameter.
[0133] In step 1031 , a first update value is determined according to a product of a first learning parameter, an influence gradient of a current departure interval, and an influence gradient of a first evaluation value.
[0134] In step 1032, the updated policy network parameters are determined according to the policy network parameters corresponding to the policy network model and the first update value, so as to update the policy network model according to the updated policy network parameters, and the updated policy network parameters are determined according to the difference between the policy network parameters corresponding to the policy network model and the first update value, specifically, referring to the following formula:
[0135]
[0136] In formula (10), θ new is the updated policy network parameter, θ now is the policy network parameter corresponding to the policy network model, β is the first learning parameter, is the impact gradient of the current departure interval, is the influence gradient of the first evaluation value, and then an updated strategy network model is constructed according to the updated strategy network parameters.
[0137] Figure 4 is a schematic diagram of a process for updating the value network model provided by the present invention, wherein updating the value network model according to the first evaluation value and the second evaluation value includes:
[0138] Determine the reward function for the current train based on the passenger waiting cost and the enterprise operating cost;
[0139] Determine a reward target according to the reward function and the second evaluation value;
[0140] Determine a reward error according to the first evaluation value and the reward target;
[0141] Determine a second update value according to a second learning parameter, the reward error, and an influence gradient of the first evaluation value;
[0142] Determining updated value network parameters according to the value network parameters corresponding to the value network model and the second update value, so as to update the value network model according to the updated value network parameters;
[0143] The passenger waiting cost is determined according to the total waiting time spent by passengers in all stations in the current train.
[0144] In step 1033, the reward function of the current train is determined according to the passenger waiting cost and the enterprise operating cost. The passenger waiting cost is determined according to the total waiting time spent by passengers in all stations in the current train. Specifically, the core of reinforcement learning is to obtain as many rewards as possible by interacting with the environment. Therefore, rewards are crucial to the reinforcement learning algorithm. The reward function can be regarded as the opposite of the cost function. First, the cost function is calculated. The cost can be divided into two types. The first is the passenger waiting cost, and the second is the enterprise operating cost. The enterprise operating cost is usually composed of a series of complex costs such as the bottom configuration cost, operating cost, depreciation and maintenance cost. Since the present invention focuses on the optimization of the train running time rather than the control of the train running speed, it is impossible to accurately calculate the cost of operating each train. Therefore, the total cost of each train operation is regarded as the same and represented by CO.
[0145] The passenger waiting cost is determined based on the product of the passenger waiting time and the unit time value. Since the unit time value is fixed and known, the key to calculating the passenger waiting cost is to calculate the passenger waiting time.
[0146] Alternatively, the waiting time of passengers on the kth train is taken as an example. The waiting time of passengers on the kth train is composed of the total waiting time of passengers waiting for the kth train at each station. For station i, the waiting time of passengers is composed of two parts. The first part is the passengers who were left behind because they did not take the k-1th train. The second part is the passengers who arrive at station i between the time when the k-1th train leaves from station i and the time when the kth train leaves from station i.
[0147] for The waiting time calculation formula is: is the time difference between the arrival time of the kth train at station i and the departure time of the k-1th train from station i.
[0148] for The waiting time calculation formula is: It means the time difference between the time when the kth train arrives at station i and the time when the passengers arrive at the station, where the waiting time of the passengers at station i is obtained by the above method. for:
[0149]
[0150] Then we can get the waiting time of passengers at all stations for the kth train as
[0151] In step 1034, a reward target is determined according to the reward function and the second evaluation value. The reward target may be determined by referring to the following formula:
[0152]
[0153] In formula (12), is the reward target, r k is the reward function, γ is the discount factor, usually 0.99, q k+1 is the second evaluation value.
[0154] In step 1035, a reward error is determined according to the first evaluation value and the reward target. The reward error may be determined by referring to the following formula:
[0155]
[0156] In formula (13), δ k is the reward error, q k is the first evaluation value, For reward goals.
[0157] In step 1036, a second update value is determined according to the product of the second learning parameter, the reward error, and the influence gradient of the first evaluation value.
[0158] In step 1037, the updated value network parameter is determined according to the value network parameter corresponding to the value network model and the second update value, so as to update the value network model according to the updated value network parameter. The following formula may be referred to:
[0159]
[0160] In formula (14), w new is the updated value network parameter, w now is the value network parameter corresponding to the value network model, α is the second learning parameter, δ k is the reward error, is the influence gradient of the first evaluation value, so as to construct an updated value network model according to the updated value network parameters.
[0161] Figure 5It is a flow chart of determining the reward function of the current train provided by the present invention, wherein the reward function of the current train is determined according to the passenger waiting cost and the enterprise operating cost, including:
[0162] Determine the passenger waiting cost based on the product of the passenger waiting time and the unit time value;
[0163] Determining a first weighted value according to the passenger waiting cost and the first weight value;
[0164] Determining a second weighted value according to the enterprise operating cost and the second weight value;
[0165] Determine a reward function for the current trip according to the first weighted value and the second weighted value;
[0166] The sum of the first weight value and the second weight value is a preset constant.
[0167] In step 10331, the passenger waiting cost is determined based on the product of the passenger waiting time and the unit time value, where the passenger waiting cost is determined by multiplying the total waiting time spent by passengers in all stations in the current train and the unit time value.
[0168] In step 10332, a first weighted value is determined based on the product of the passenger waiting cost and the first weight value.
[0169] In step 10332, the second weighted value is determined based on the enterprise operating cost and the second weight value. Since the sum of the first weight value and the second weight value is a preset constant, the second weight value is the difference between the preset constant and the first weight value. The second weighted value is then determined based on the product of the enterprise operating cost and the second weight value.
[0170] In step 10333, the reward function of the current train is determined according to the first weighted value and the second weighted value. Specifically, refer to the following formula:
[0171] r=-(α×CP k +(1-α)×CO) (15)
[0172] In formula (15), α is a weight ranging from 0 to 1, which is used to perform a weighted summation of the two. k is the passenger waiting cost, and CO is the enterprise operating cost.
[0173] Figure 8 is a structural schematic diagram of a train schedule determination device provided by the present invention. The present invention also provides a train schedule determination device, comprising an execution unit 1: for repeatedly executing the following steps until a preset condition is met:
[0174] Input the current train status group to the strategy network model to obtain the current departure interval output by the strategy network model; input the next train status group to the strategy network model to obtain the next departure interval output by the strategy network model;
[0175] Input the current train status group and the current departure interval into the value network model to obtain a first evaluation value output by the value network model; input the next train status group and the next departure interval into the value network model to obtain a second evaluation value output by the value network model;
[0176] The strategy network model is updated according to the current departure interval and the first evaluation value, and the value network model is updated according to the first evaluation value and the second evaluation value. The working principle of the execution unit 1 can refer to the aforementioned steps 101 to 103 and will not be repeated here.
[0177] The train schedule determination device also includes an acquisition unit 2: after the preset conditions are met, the target train status group is input into the strategy network model to obtain the target departure interval output by the strategy network model. The working principle of the acquisition unit 2 can refer to the aforementioned step 104 and will not be repeated here.
[0178] The train schedule determination device also includes a determination unit 3: used to determine the train schedule of the target train according to the initial departure time of the target train and the target departure interval. The working principle of the determination unit 3 can refer to the aforementioned step 105 and will not be repeated here.
[0179] The state group is determined according to the initial departure time of the train corresponding to the state group and the total number of remaining passengers who are unable to board the train corresponding to the state group in all stations along the line of the train corresponding to the state group.
[0180] The present invention provides a method, device, equipment and medium for determining a train schedule, which can determine the current departure interval through a policy network model and a current train status group, and determine the next train status group according to the current train status group and the current departure interval, and then determine the next departure interval, thereby realizing the continuous interactive iteration of the train status group and the departure interval, and at the same time introducing a value network model, using reward error as a value to guide the continuous iteration and update of the policy network model and the value network model, thereby determining an optimized policy network model, and finally determining a train schedule according to the optimized policy network model. The present invention constructs a virtual operating environment based on passenger flow information and train dynamics characteristics, uses a reinforcement learning algorithm to learn and optimize on the constructed environment, simulates train operation conditions, and then obtains a train schedule. The present invention has strong operability and high robustness, can greatly improve the optimization efficiency of the train schedule under the long route mode, and effectively reduce subway operating costs and passenger waiting costs.
[0181] Fig. 9 Schematic diagram of the structure of the electronic device provided by the present invention. Fig. 9 As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the train schedule determination method, which includes: repeatedly executing the following steps until a preset condition is met: inputting the current train status group into the policy network model to obtain the current departure interval output by the policy network model; inputting the next train status group into the policy network model to obtain the next departure interval output by the policy network model; inputting the current train status group and the current departure interval into the value network model to obtain the first evaluation value output by the value network model; inputting the next train status group and the next departure interval into the value network model to obtain the second evaluation value output by the value network model Evaluation value; updating the policy network model according to the current departure interval and the first evaluation value, and updating the value network model according to the first evaluation value and the second evaluation value; after satisfying the preset conditions, inputting the target train state group into the policy network model, and obtaining the target departure interval output by the policy network model; determining the train schedule of the target train according to the initial departure time of the target train and the target departure interval; wherein the state group is determined according to the initial departure time of the train corresponding to the state group and the total number of remaining passengers who cannot take the train corresponding to the state group in all stations along the line of the train corresponding to the state group.
[0182] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0183] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute a train schedule determination method provided by the above methods, which method includes: repeatedly executing the following steps until a preset condition is met: inputting the current train status group into the strategy network model to obtain the current departure interval output by the strategy network model; inputting the next train status group into the strategy network model to obtain the next departure interval output by the strategy network model; inputting the current train status group and the current departure interval into the value network model to obtain the first evaluation value output by the value network model; inputting the next train status group with and the next departure interval to the value network model, and obtain the second evaluation value output by the value network model; update the strategy network model according to the current departure interval and the first evaluation value, and update the value network model according to the first evaluation value and the second evaluation value; after meeting the preset conditions, input the target train state group to the strategy network model, and obtain the target departure interval output by the strategy network model; determine the train schedule of the target train according to the initial departure time of the target train and the target departure interval; wherein the state group is determined according to the initial departure time of the train corresponding to the state group and the total number of remaining people who cannot take the train corresponding to the state group in all stations along the line of the train corresponding to the state group.
[0184] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the train schedule determination method provided by the above-mentioned methods, the method comprising: repeatedly executing the following steps until a preset condition is met: inputting the current train status group into the policy network model to obtain the current departure interval output by the policy network model; inputting the next train status group into the policy network model to obtain the next departure interval output by the policy network model; inputting the current train status group and the current departure interval into the value network model to obtain the first evaluation value output by the value network model; inputting the next train status group and the next departure interval into the value network model model, obtaining the second evaluation value output by the value network model; updating the strategy network model according to the current departure interval and the first evaluation value, and updating the value network model according to the first evaluation value and the second evaluation value; after satisfying the preset conditions, inputting the target train state group into the strategy network model, obtaining the target departure interval output by the strategy network model; determining the train schedule of the target train according to the initial departure time of the target train and the target departure interval; wherein the state group is determined according to the initial departure time of the train corresponding to the state group and the total number of remaining passengers who cannot take the train corresponding to the state group in all stations along the line of the train corresponding to the state group.
[0185] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0186] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0187] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for determining a train timetable, characterized in that: include: Repeat the following steps until the preset conditions are met: Input the current train status group to the strategy network model to obtain the current departure interval output by the strategy network model; input the next train status group to the strategy network model to obtain the next departure interval output by the strategy network model; Inputting the current train status group and the current departure interval into the value network model, and obtaining a first evaluation value output by the value network model; Inputting the next train status group and the next departure interval into the value network model, and obtaining a second evaluation value output by the value network model; The strategy network model is updated according to the current departure interval and the first evaluation value, and the value network model is updated according to the first evaluation value and the second evaluation value; After the preset conditions are met, the target train status group is input into the strategy network model to obtain the target departure interval output by the strategy network model; Determine the train schedule of the target train according to the initial departure time of the target train and the target departure interval; The state group is determined according to the initial departure time of the train number corresponding to the state group and the total number of remaining persons who cannot take the train number corresponding to the state group at all stations along the line of the train number corresponding to the state group; The updating of the strategy network model according to the current departure interval and the first evaluation value includes: Determine a first update value according to the first learning parameter, the influence gradient of the current departure interval, and the influence gradient of the first evaluation value; Determining updated policy network parameters according to the policy network parameters corresponding to the policy network model and the first update value, so as to update the policy network model according to the updated policy network parameters; The updating of the value network model according to the first evaluation value and the second evaluation value includes: Determine the reward function for the current train based on the passenger waiting cost and the enterprise operating cost; Determine a reward target according to the reward function and the second evaluation value; Determine a reward error according to the first evaluation value and the reward target; Determine a second update value according to a second learning parameter, the reward error, and an influence gradient of the first evaluation value; Determining updated value network parameters according to the value network parameters corresponding to the value network model and the second update value, so as to update the value network model according to the updated value network parameters; The passenger waiting cost is determined according to the total waiting time spent by passengers in all stations in the current train.
2. The train schedule determination method according to claim 1, characterized in that: Before inputting the next train status group and the next departure interval into the value network model, the method further includes: determining the next train status group according to the current train status group and the current departure interval; The determining the next train status group according to the current train status group and the current departure interval specifically includes: Determine the initial departure time of the next train according to the initial departure time of the current train and the current departure interval; The total number of passengers waiting to take the next train at each station is determined based on the number of passengers who are unable to take the current train and are forced to wait for the next train at each station along the route and the number of new passengers departing from each station to the designated station; Determine the actual number of passengers arriving at the designated station at each station based on the remaining carrying capacity of the next train and the total number of passengers waiting to board the next train at each station; Determine the number of remaining passengers who cannot take the next train to the designated station at each station based on the total number of passengers departing from each station to the designated station and the actual number of passengers arriving at the designated station at each station, so as to determine the total number of remaining passengers who cannot take the next train at all stations; The next train status group is determined according to the initial departure time of the next train and the total number of remaining people who cannot take the next train in all stations.
3. The train schedule determination method according to claim 1, characterized in that: The reward function for determining the current train number based on the passenger waiting cost and the enterprise operating cost includes: Determine the passenger waiting cost based on the product of the passenger waiting time and the unit time value; Determining a first weighted value according to the passenger waiting cost and the first weight value; Determining a second weighted value according to the enterprise operating cost and the second weight value; Determine a reward function for the current trip according to the first weighted value and the second weighted value; The sum of the first weight value and the second weight value is a preset constant.
4. The train schedule determination method according to claim 1, characterized in that: The preset condition is any one of the following conditions: The train departure time exceeds the traffic operation time; There are no leftovers in any station; Alternatively, the train departure time exceeds the traffic operation time and there are no leftover passengers at all stations.
5. The train schedule determination method according to claim 1, characterized in that: Determining the train schedule of the target train according to the initial departure time of the target train and the target departure interval includes: The departure time of each station along the train line is determined according to the initial departure time of the target train, the target departure interval, the running time between stations, and the stay time at each station, so as to determine the train schedule of the target train according to the departure times of all stations.
6. A train timetable determination device, characterized in that: include: Execution unit: used to repeatedly execute the following steps until the preset conditions are met: Input the current train status group to the strategy network model to obtain the current departure interval output by the strategy network model; input the next train status group to the strategy network model to obtain the next departure interval output by the strategy network model; Inputting the current train status group and the current departure interval into the value network model, and obtaining a first evaluation value output by the value network model; Inputting the next train status group and the next departure interval into the value network model, and obtaining a second evaluation value output by the value network model; The strategy network model is updated according to the current departure interval and the first evaluation value, and the value network model is updated according to the first evaluation value and the second evaluation value; An acquisition unit is used to input the target train status group into the strategy network model after the preset conditions are met, and acquire the target departure interval output by the strategy network model; Determining unit: used to determine the train schedule of the target train according to the initial departure time of the target train and the target departure interval; The state group is determined according to the initial departure time of the train number corresponding to the state group and the total number of remaining persons who cannot take the train number corresponding to the state group at all stations along the line of the train number corresponding to the state group; The updating of the strategy network model according to the current departure interval and the first evaluation value includes: Determine a first update value according to the first learning parameter, the influence gradient of the current departure interval, and the influence gradient of the first evaluation value; Determining updated policy network parameters according to the policy network parameters corresponding to the policy network model and the first update value, so as to update the policy network model according to the updated policy network parameters; The updating of the value network model according to the first evaluation value and the second evaluation value includes: Determine the reward function for the current train based on the passenger waiting cost and the enterprise operating cost; Determine a reward target according to the reward function and the second evaluation value; Determine a reward error according to the first evaluation value and the reward target; Determine a second update value according to a second learning parameter, the reward error, and an influence gradient of the first evaluation value; Determining updated value network parameters according to the value network parameters corresponding to the value network model and the second update value, so as to update the value network model according to the updated value network parameters; The passenger waiting cost is determined according to the total waiting time spent by passengers in all stations in the current train.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the train timetable determination method as described in any one of claims 1 to 5 is implemented.
8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the train schedule determination method according to any one of claims 1 to 5 is implemented.
