Method and device for bus network optimization based on Q-learning algorithm

Through the bus line network optimization method based on Q-learning algorithm and combining bus operation data to optimize the bus line network, it solves the problems of high cost and low feasibility in the existing technology, achieves more efficient bus line network optimization, and improves the safety of citizens. Travel experience and resource utilization.

CN118378760BActive Publication Date: 2024-09-17XIAN ANBANG DINGLI INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410813461.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-17
Estimated Expiration
2044-06-24

AI Technical Summary

Technical Problem

The existing bus line network optimization method does not take into account specific line conditions, resulting in high cost investment and low feasibility, affecting citizens' travel experience and resource utilization efficiency.

Method used

The bus line network optimization method based on the Q-learning algorithm is used to obtain bus operation data, including bus trajectory data, card swipe data and site data, to calculate passenger flow and optimize routes, and use the Q-learning algorithm to iteratively optimize the bus line network and reduce the overall Optimized cost and resource waste.

Benefits of technology

It effectively solves the problem of bus line network optimization not taking into account the specific conditions of the lines, reduces cost investment, improves the feasibility of the plan and the balance of bus transportation capacity, and shortens the travel adaptation period for citizens.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118378760B
    Figure CN118378760B
Patent Text Reader

Abstract

The present application discloses a bus network optimization method and device based on the Q-learning algorithm, the method comprising: obtaining bus operation data; wherein the bus operation data includes a bus trajectory data set, a card swiping data set and a bus station data set; obtaining passenger flow according to the bus operation data; wherein the passenger flow includes the number of passengers getting on and getting off at each bus station; obtaining a result set of routes to be optimized according to the passenger flow and the bus station data set; optimizing the result set of routes to be optimized by the Q-learning algorithm to obtain an optimized bus network. The method solves the problem that the bus network optimization method in the prior art does not combine the specific conditions of the route, has a large investment cost and low feasibility. It can save economic costs, improve the feasibility of the plan, balance the bus capacity, and shorten the travel adaptation period of citizens.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of traffic network optimization, and in particular to a method and device for optimizing a bus network based on a Q-learning algorithm. Background Art

[0002] Buses have the advantages of large passenger capacity, high resource utilization, high safety factor, and low environmental pollution, and play an important role in urban transportation. However, with the development of urbanization, it is urgent to optimize the bus network.

[0003] In previous studies on line network optimization, most of them used intelligent optimization algorithms to optimize the entire bus line network. For example, in the patent with publication number CN104217086A, the interests of both passengers and operators were taken into consideration, and the line with the maximum DC passenger flow density was searched between OD pairs. Although this method effectively improves the utilization efficiency of the line, its optimization is still optimized for the entire line network. The patent with publication number CN113378337A established a bus line network optimization model based on passenger flow analysis, and used genetic algorithms to solve it, and formulated a more reasonable bus line network, mainly to improve the operating efficiency of the bus system.

[0004] Although the above two bus network optimization methods have optimized the bus network for different problems, they are both based on swarm intelligence optimization algorithms and have made large-scale adjustments to the overall bus network without considering the specific line conditions. This overall optimization method has a large cost investment, seriously affects the travel experience of citizens, and also causes a large waste of resources. In addition, the feasibility of making large-scale adjustments in a mature bus network is low. Summary of the invention

[0005] The embodiments of the present application provide a method and device for bus network optimization based on a Q-learning algorithm, thereby solving the problem that the bus network optimization method in the prior art does not take into account the specific conditions of the lines, has a high investment cost and low feasibility.

[0006] In a first aspect, an embodiment of the present application provides a bus network optimization method based on a Q-learning algorithm, comprising: obtaining bus operation data; wherein the bus operation data includes a bus trajectory data set, a card swiping data set, and a bus stop data set; obtaining passenger flow based on the bus operation data; wherein the passenger flow includes the number of passengers getting on and off at each of the bus stops; obtaining a result set of routes to be optimized based on the passenger flow and the bus stop data set; and optimizing the result set of routes to be optimized using a Q-learning algorithm to obtain an optimized bus network.

[0007] In combination with the first aspect, in a possible implementation, obtaining passenger flow according to the bus operation data includes: performing route matching according to the bus operation data to obtain a route matching result; wherein the route matching result includes the bus route and the route card swiping data of the bus route; performing vehicle matching according to the route matching result to obtain a vehicle matching result; wherein the vehicle matching result includes the scheduled buses of the bus route and the bus card swiping data of the scheduled buses; performing time matching according to the vehicle matching result to obtain the boarding volume and boarding station data of the scheduled bus; and determining the alighting volume according to the boarding volume and the boarding station data.

[0008] In combination with the first aspect, in a possible implementation method, determining the number of passengers alighting based on the number of passengers boarding and the boarding station data includes: obtaining the daily boarding card swiping data of each passenger based on the vehicle matching result and the boarding station data, screening out the card swiping records of passengers with two or more of the boarding card swiping data, and sorting the card swiping records of each passenger by time to obtain a card swiping sequence set; determining all downstream sites of the card swiping site of the first card swiping data in the card swiping sequence set, and respectively calculating the straight-line distance between each of the downstream sites and the card swiping site of the next card swiping record of the first card swiping data; screening out the straight-line distances that meet the distance threshold from the straight-line distances to form a straight-line distance set, and determining the walking time of each straight-line distance in the straight-line distance set; if the walking time meets the time threshold, taking the card swiping site of the next card swiping record as a transfer point; otherwise, taking it as an alighting point; determining the number of passengers alighting based on the transfer point and the alighting point.

[0009] In combination with the first aspect, in a possible implementation, obtaining a result set of routes to be optimized according to the passenger flow and the bus stop data set includes: initializing the current bus network and setting a maximum population size and a preset number of iterations; generating a random bus route set according to the maximum population size and the preset number of iterations; iteratively performing an optimization step until the number of iterations reaches the preset number of iterations to obtain the result set of routes to be optimized; the optimization step includes: determining an objective function of bus routes in the random bus route set; determining a non-dominated grade and a congestion degree of the bus route according to an objective function value of the objective function; selecting bus routes according to the non-dominated grade and the congestion degree, and constructing them into a first route set; performing a crossover operation on the first route set to generate a new bus route; performing a genetic variation operation on the random bus route set to introduce new changes; merging the random bus route set with the new changes introduced with the new bus route to obtain a new bus route set, and increasing the number of iterations by one; using the new bus route set as the random bus route set to perform the optimization step.

[0010] In combination with the first aspect, in a possible implementation manner, the objective function includes an abnormal line objective function, a passenger flow objective function, a bus stop and line length objective function, and a passenger flow difference objective function.

[0011] In combination with the first aspect, in a possible implementation, the optimizing the to-be-optimized route result set by a Q-learning algorithm to obtain an optimized bus network includes: inputting the to-be-optimized route result set, the current bus network, and the passenger flow into a Q-learning algorithm, and initializing a Q value storage table; iteratively executing an optimization solution step until a maximum number of iterations is reached and then stopping the iteration to obtain the optimized bus network; the optimization solution step includes: selecting an initial bus route according to a current strategy and a current Q value, and executing the initial bus route to obtain an immediate reward and a next state; and updating the current Q value according to the immediate reward and the next state.

[0012] In combination with the first aspect, in a possible implementation manner, the reward function of the instant reward is as follows:

[0013] ; Where R represents the instant reward, i represents the maximum number of iterations, and m represents the mth iteration. Indicates the starting point, and They represent the total number of passengers boarding from the starting point to the downstream bus stop j and from the downstream bus stop j to the starting point, represents the line length from the starting point to the downstream bus stop j, Indicates the non-linear coefficient of the bus route searched by the current algorithm, Indicates the number of bus routes passing through the downstream station to the starting point, Indicates the number of bus routes passing through the starting point to the downstream station, and Respectively represent the minimum and maximum distances from the current location to the next bus stop. Indicates the distance from the current location to the next bus stop. represents the nonlinear coefficient, and They represent the maximum and minimum lengths of the generated bus routes respectively.

[0014] In a second aspect, an embodiment of the present application provides a bus network optimization device based on a Q-learning algorithm, comprising: a first acquisition module, used to acquire bus operation data; wherein the bus operation data includes a bus trajectory data set, a card swiping data set and a bus stop data set; a second acquisition module, used to acquire passenger flow based on the bus operation data; wherein the passenger flow includes the number of passengers getting on and off at each of the bus stops; a module for a result set of routes to be optimized, used to obtain a result set of routes to be optimized based on the passenger flow and the bus stop data set; an optimization module, used to optimize the result set of routes to be optimized through a Q-learning algorithm to obtain an optimized bus network.

[0015] In a third aspect, an embodiment of the present application provides a device, comprising: a processor; a memory for storing processor-executable instructions; when the processor executes the executable instructions, it implements the method described in the first aspect or any possible implementation method of the first aspect.

[0016] In a fourth aspect, an embodiment of the present application provides a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium includes a medium for storing a computer program or instructions, which, when executed, enables the method described in the first aspect or any possible implementation method of the first aspect to be implemented.

[0017] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:

[0018] The embodiment of the present application can understand the passenger flow pressure and bus capacity of each bus line by obtaining passenger flow; obtain the result set of lines to be optimized based on the passenger flow and bus station data set, and analyze the bus lines that need to be optimized; optimize the result set of lines to be optimized, and avoid the high cost and low efficiency caused by the overall optimization of the bus network. It effectively solves the problem that the bus network optimization method in the prior art does not combine the specific conditions of the line, has a large investment cost and low feasibility. It can save economic costs, improve the feasibility of the plan, balance the bus capacity, and shorten the travel adaptation period of citizens. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application or the description of the prior art will be briefly introduced below. 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 any creative work.

[0020] Figure 1 A flowchart of a bus network optimization method based on a Q-learning algorithm provided in an embodiment of the present application;

[0021] Figure 2 A flowchart for obtaining passenger flow based on bus operation data provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of the structure of a bus network optimization device based on the Q-learning algorithm provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. 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.

[0024] The following describes some of the techniques involved in the embodiments of the present application to facilitate understanding, and they should be considered as merely exemplary. Therefore, it should be appreciated by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present application. Similarly, for the sake of clarity and conciseness, some descriptions of well-known functions and structures are omitted in the following description.

[0025] Figure 1 is a flowchart of a bus network optimization method based on a Q-learning algorithm provided in an embodiment of the present application, including steps 101 to 104. Among them, Figure 1 This is only an execution order shown in the embodiment of the present application, and does not represent the only execution order of the bus network optimization method based on the Q-learning algorithm. If the final result can be achieved, Figure 1 The steps shown may be performed in parallel or reversed.

[0026] Step 101: Obtain bus operation data. In an embodiment of the present application, the bus operation data includes a bus track data set, a card swiping data set, and a bus stop data set. Taking Xi'an as an example, the bus track data set is all bus routes in Xi'an, which can be obtained by collecting GPS data of buses. The card swiping data set is a collection of card swiping data of all buses in Xi'an, and the card swiping data can be obtained from the traffic management department. The bus stop data set is all bus stops in Xi'an, which can be obtained through some map applications, official bus platforms or third-party platforms.

[0027] In addition, the bus trajectory dataset, card swiping dataset and bus stop dataset can also be preprocessed. Specifically, when preprocessing the bus trajectory dataset, remove the noise points, abnormal points and useless information (for example, only the normal driving trajectory of the bus can be retained, and the trajectory information when parking or reversing can be removed). In one embodiment of the present application, the three-dimensional GPS information of the bus can be converted into two-dimensional coordinate information. It is also possible to only retain the longitude and latitude information of the bus GPS information and ignore the altitude information. The bus trajectory dataset includes information such as the trajectory number, line name, line starting point and end point, and line length.

[0028] When preprocessing the card swiping data set, remove missing values, outliers, and error values. The card swiping data includes card swiping time, card swiping station, card swiping bus, card swiping ID, etc.

[0029] When preprocessing the bus stop dataset, we corrected the erroneous values, removed the outliers, and filled in the missing values ​​to ensure that all bus stop information is accurate. The bus stop dataset includes the station name, longitude and latitude, and line number.

[0030] Step 102: Obtain passenger flow based on bus operation data. In the embodiment of the present application, passenger flow includes the number of passengers boarding and disembarking at each bus stop. Figure 2 As shown, it includes steps 201 to 204, as follows.

[0031] Step 201: Perform route matching according to the bus operation data to obtain route matching results. Specifically, route matching is performed according to the bus trajectory data set and the card swiping data set in the bus operation data, and each independent bus route and the route card swiping data of each bus route are determined to obtain route matching results. The route matching results here can be stored in the form of key-value pairs, with the bus route as the "key" and the route card swiping data as the "value" for corresponding storage. Those skilled in the art should be aware that the bus route here should be a complete route from the starting point to the end point, and there are situations where multiple bus routes partially overlap. And the above-mentioned bus route and the route card swiping data are in a one-to-many relationship, and the route card swiping data contains each boarding card swiping data at each bus stop on this bus route.

[0032] Step 202: Perform vehicle matching based on the line matching results to obtain vehicle matching results. Specifically, perform vehicle matching on the bus lines and the line card swiping data of the bus lines, determine the scheduled buses on each bus line and the bus card swiping data corresponding to each scheduled bus to obtain the vehicle matching results. The vehicle matching results here can still be stored in the form of key-value pairs, with the scheduled bus as the "key" and the bus card swiping data as the "value" for corresponding storage. The bus card swiping data includes the card swiping data for each boarding of this bus at each bus stop every time it runs. In addition, it can also be stored in the form of a tree diagram or a database according to the relationship between the vehicle matching results and the line matching results.

[0033] Step 203: Time matching is performed based on the vehicle matching result to obtain the boarding volume and boarding station data of the scheduled bus. Specifically, time matching is performed between the scheduled bus and the bus card swiping data of the scheduled bus to determine the boarding station data of the scheduled bus and the boarding volume of each boarding station.

[0034] Step 204: Determine the number of passengers getting off based on the number of passengers getting on and the boarding station data. In an embodiment of the present application, the number of passengers getting off is determined by a travel chain rule. Specifically, the daily card swiping data of each passenger is obtained based on the vehicle matching results and the boarding station data, the card swiping records of passengers with two or more card swiping data are screened out, and the card swiping records of each passenger are sorted by time to obtain a card swiping sequence set. It should be noted that only the card swiping records of passengers with two or more card swiping data in a day are screened out here, and the passenger data of a single card swipe is ignored, which does not have a big impact on the final result, because the overall trend will not change, and commuting passengers who swipe their cards twice are also the mainstream part of the daily passenger flow.

[0035] Determine all downstream sites of the card swiping site of the first card swiping data in the card swiping sequence set, and calculate the straight-line distance between each downstream site and the card swiping site of the next card swiping record of the first card swiping data. Specifically, the straight-line distance here can be calculated based on the longitude and latitude of the card swiping site of the next card swiping record of the first card swiping data and the downstream site. Exemplarily, F=sin(LatS1)*sin(LatS2)*cos(LonS1-LonS2)+cos(LatS1)*cos(LatS2). In the formula, F represents the straight-line distance, LatS1 and LatS2 respectively represent the longitude and latitude of the card swiping site of the next card swiping record of the first card swiping data, and LonS1 and LonS2 respectively represent the longitude and latitude of the downstream site.

[0036] The straight-line distances that meet the distance threshold are selected to form a straight-line distance set, and the walking time of each straight-line distance in the straight-line distance set is determined. For example, the distance threshold is set to 800 meters. If it is greater than 800 meters, it is considered to be a broken link. The walking time required to pass the straight-line distance is calculated according to the walking speed of the person.

[0037] If the walking time meets the time threshold, the swipe station of the next swipe record is used as the transfer point. Otherwise, it is used as the alighting point. Exemplarily, the time threshold is set to 15 minutes. If the walking time exceeds the time threshold, the bus stop with a straight-line distance of less than 800 meters from the swipe station of the next swipe record is considered as the transfer point. Otherwise, the bus stop with a straight-line distance of less than 800 meters from the swipe station of the next swipe record is considered as the alighting point.

[0038] In one embodiment of the present application, the walking time here can also take into account the boarding time, the getting off time and the waiting time. Specifically, the waiting time is the next card swiping time minus the getting off time and the walking time. The getting off time here is the bus stop where the bus passes by and the straight-line distance from the card swiping station of the next card swiping record is less than 800 meters. If the waiting time exceeds the time threshold, the bus stop that is less than 800 meters away from the card swiping station of the next card swiping record is considered to be a transfer point. Otherwise, the bus stop that is less than 800 meters away from the card swiping station of the next card swiping record is considered to be the getting off point.

[0039] The passenger drop-off quantity is determined according to the transfer point and the alighting point. Specifically, the passenger drop-off quantity at the alighting point is determined according to the alighting point and the transfer point determined above and the next card swiping record.

[0040] Step 103: Obtain a result set of routes to be optimized based on the passenger flow and bus station data sets. In the embodiment of the present application, the current bus network is initialized, and the maximum population size and the preset number of iterations are set. A random bus route set is generated based on the maximum population size and the preset number of iterations. The optimization step is iteratively performed until the number of iterations reaches the preset number of iterations, and the result set of routes to be optimized is obtained. The optimization step includes: determining the objective function of the bus routes in the random bus route set. Determining the non-dominated level and congestion of the bus routes based on the objective function value of the objective function. Selecting bus routes based on the non-dominated level and congestion, and constructing them into a first route set. Performing a crossover operation on the first route set to generate a new bus route. Performing a genetic variation operation on the random bus route set to introduce new changes. The random bus route set with the new changes introduced is merged with the new bus route to obtain a new bus route set, and the number of iterations is increased by one. The new bus route set is used as a random bus route set, and the optimization step is performed. Exemplarily, the preset number of iterations here can be set to 200. Those skilled in the art can also set the preset number of iterations according to actual needs and experience.

[0041] In addition, the objective functions include abnormal line objective function, passenger flow objective function, bus stop and line length objective function and passenger flow difference objective function, as follows.

[0042] The objective function of the abnormal line is as follows:

[0043] In the formula, represents the abnormal line objective function, represents the distance between two adjacent sites. It represents the straight-line distance from the starting point to the end point of the current bus line, i represents the i-th line station, and N represents the total number of line stations of the current bus line.

[0044] The passenger flow objective function is as follows:

[0045] In the formula, represents the line passenger flow objective function, D represents the total number of days of data, d represents the data of the dth day, represents the passenger flow of the current bus line, R represents the total number of bus lines, r represents the rth bus line, represents the passenger flow of the rth bus line.

[0046] The objective function of bus stops and line length is as follows:

[0047] In the formula, represents the line station and circuit length objective function, represents the weight of the line station anomaly, i represents the i-th line station, N represents the total number of line stations of the current bus line, represents the distance between two adjacent sites. The weight representing the length of the bus line.

[0048] The passenger flow difference objective function is as follows:

[0049] In the formula, represents the passenger flow difference objective function of the bus line, S represents the total number of bus lines on the current bus line, s represents the sth bus line on the current bus line, represents, j represents, represents the passenger flow of the current line station, M represents the number of line stations within one kilometer around the current line station, and m represents the mth line station within one kilometer around the current line station. Indicates the passenger flow of other line stations within one kilometer around the current line station.

[0050] Step 104: Optimize the result set of routes to be optimized by the Q-learning algorithm to obtain an optimized bus network. In the embodiment of the present application, the result set of routes to be optimized, the current bus network and the passenger flow are input into the Q-learning algorithm, and the Q value storage table is initialized. The optimization solution step is iterated until the maximum number of iterations is reached and the iteration is stopped to obtain the optimized bus network. Exemplarily, the maximum number of iterations here is set to 500. Those skilled in the art can also set the maximum number of iterations according to actual needs and experience.

[0051] The optimization solution steps include: selecting the initial bus route according to the current strategy and the current Q value, and executing the initial bus route to obtain the immediate reward and the next state. Update the current Q value according to the immediate reward and the next state. Among them, the reward function of the immediate reward is as follows:

[0052] . In the formula, R represents the immediate reward, i represents the maximum number of iterations, and m represents the mth iteration. Indicates the starting point, and They represent the total number of passengers boarding from the starting point to the downstream bus stop j and from the downstream bus stop j to the starting point, represents the line length from the starting point to the downstream bus stop j, Indicates the non-linear coefficient of the bus route searched by the current algorithm, Indicates the number of bus routes passing through the downstream station to the starting point, Indicates the number of bus routes passing through the starting point to the downstream station, and Respectively represent the minimum and maximum distances from the current location to the next bus stop. Indicates the distance from the current location to the next bus stop. represents the nonlinear coefficient, and They represent the maximum and minimum lengths of the generated bus routes respectively.

[0053] Although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in this embodiment is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in sequence or in parallel according to the method shown in this embodiment or the accompanying drawings (for example, in a parallel processor or multi-threaded processing environment).

[0054] like Figure 3As shown, the embodiment of the present application also provides a bus network optimization device 300 based on the Q-learning algorithm. The device includes: a first acquisition module 301, a second acquisition module 302, a route result set module to be optimized 303 and an optimization module 304, which are specifically as follows.

[0055] The first acquisition module 301 is used to obtain bus operation data. Among them, the bus operation data includes a bus track data set, a card swiping data set and a bus stop data set. The first acquisition module 301 is specifically used for bus operation data including a bus track data set, a card swiping data set and a bus stop data set. Taking Xi'an as an example, the bus track data set is all bus routes in Xi'an, which can be obtained by collecting GPS data of buses. The card swiping data set is a collection of card swiping data of all buses in Xi'an, and the card swiping data can be obtained from the traffic management department. The bus stop data set is all the bus stops in Xi'an, which can be obtained through some map applications, official bus platforms or third-party platforms.

[0056] In addition, the bus trajectory dataset, card swiping dataset and bus stop dataset can also be preprocessed. Specifically, when preprocessing the bus trajectory dataset, remove the noise points, abnormal points and useless information (for example, only the normal driving trajectory of the bus can be retained, and the trajectory information when parking or reversing can be removed). In one embodiment of the present application, the three-dimensional GPS information of the bus can be converted into two-dimensional coordinate information. It is also possible to only retain the longitude and latitude information of the bus GPS information and ignore the altitude information. The bus trajectory dataset includes information such as the trajectory number, line name, line starting point and end point, and line length.

[0057] When preprocessing the card swiping data set, remove missing values, outliers, and error values. The card swiping data includes card swiping time, card swiping station, card swiping bus, card swiping ID, etc.

[0058] When preprocessing the bus stop dataset, we corrected the erroneous values, removed the outliers, and filled in the missing values ​​to ensure that all bus stop information is accurate. The bus stop dataset includes the station name, longitude and latitude, and line number.

[0059] The second acquisition module 302 is used to obtain passenger flow according to the bus operation data. Among them, the passenger flow includes the number of passengers getting on and off at each bus stop. The second acquisition module 302 is specifically used to perform route matching according to the bus operation data to obtain a route matching result. Specifically, route matching is performed according to the bus trajectory data set and the card swiping data set in the bus operation data, and each independent bus line and the line card swiping data of each bus line are determined to obtain the line matching result. The line matching result here can be stored in the form of key-value pairs, with the bus line as the "key" and the line card swiping data as the "value" for corresponding storage. Those skilled in the art should be aware that the bus line here should be a complete line from the starting point to the end point, and there are cases where multiple bus lines partially overlap. And the above-mentioned bus line and line card swiping data are in a one-to-many relationship, and the line card swiping data contains each boarding card swiping data at each bus stop on this bus line.

[0060] Vehicle matching is performed based on the line matching results to obtain vehicle matching results. Specifically, vehicle matching is performed on bus lines and the line card swiping data of bus lines to determine the scheduled buses on each bus line and the bus card swiping data corresponding to each scheduled bus to obtain vehicle matching results. The vehicle matching results here can still be stored in the form of key-value pairs, with the scheduled bus as the "key" and the bus card swiping data as the "value" for corresponding storage. The bus card swiping data includes the card swiping data for each boarding of this bus at each bus stop every time it runs. In addition, it can also be stored in the form of a tree diagram or a database according to the relationship between the vehicle matching results and the line matching results.

[0061] According to the vehicle matching result, time matching is performed to obtain the passenger volume and boarding station data of the scheduled bus. Specifically, the scheduled bus and the bus card swiping data of the scheduled bus are time matched to determine the boarding station data of the scheduled bus and the passenger volume of each boarding station.

[0062] The number of passengers getting off is determined based on the number of passengers getting on and the boarding station data. In an embodiment of the present application, the number of passengers getting off is determined by the travel chain rule. Specifically, the daily card swiping data of each passenger is obtained based on the vehicle matching results and the boarding station data, the card swiping records of passengers with two or more card swiping data are screened out, and the card swiping records of each passenger are sorted by time to obtain a card swiping sequence set. It should be noted that only the card swiping records of passengers with two or more card swiping data in a day are screened out here, and the passenger data of a single card swipe is ignored, which does not have a big impact on the final result, because the overall trend will not change, and commuting passengers who swipe the card twice are also the mainstream part of the daily passenger flow.

[0063] Determine all downstream sites of the card swiping site of the first card swiping data in the card swiping sequence set, and calculate the straight-line distance between each downstream site and the card swiping site of the next card swiping record of the first card swiping data. Specifically, the straight-line distance here can be calculated based on the longitude and latitude of the card swiping site of the next card swiping record of the first card swiping data and the downstream site. Exemplarily, F=sin(LatS1)*sin(LatS2)*cos(LonS1-LonS2)+cos(LatS1)*cos(LatS2). In the formula, F represents the straight-line distance, LatS1 and LatS2 respectively represent the longitude and latitude of the card swiping site of the next card swiping record of the first card swiping data, and LonS1 and LonS2 respectively represent the longitude and latitude of the downstream site.

[0064] The straight-line distances that meet the distance threshold are selected to form a straight-line distance set, and the walking time of each straight-line distance in the straight-line distance set is determined. For example, the distance threshold is set to 800 meters. If it is greater than 800 meters, it is considered to be a broken link. The walking time required to pass the straight-line distance is calculated according to the walking speed of the person.

[0065] If the walking time meets the time threshold, the swipe station of the next swipe record is used as the transfer point. Otherwise, it is used as the alighting point. Exemplarily, the time threshold is set to 15 minutes. If the walking time exceeds the time threshold, the bus stop with a straight-line distance of less than 800 meters from the swipe station of the next swipe record is considered as the transfer point. Otherwise, the bus stop with a straight-line distance of less than 800 meters from the swipe station of the next swipe record is considered as the alighting point.

[0066] In one embodiment of the present application, the walking time here can also take into account the boarding time, the getting off time and the waiting time. Specifically, the waiting time is the next card swiping time minus the getting off time and the walking time. The getting off time here is the bus stop where the bus passes by and the straight-line distance from the card swiping station of the next card swiping record is less than 800 meters. If the waiting time exceeds the time threshold, the bus stop that is less than 800 meters away from the card swiping station of the next card swiping record is considered to be a transfer point. Otherwise, the bus stop that is less than 800 meters away from the card swiping station of the next card swiping record is considered to be the getting off point.

[0067] The passenger drop-off quantity is determined according to the transfer point and the alighting point. Specifically, the passenger drop-off quantity at the alighting point is determined according to the alighting point and the transfer point determined above and the next card swiping record.

[0068] The module 303 for the result set of routes to be optimized is used to obtain the result set of routes to be optimized according to the passenger flow and bus station data sets. The module 303 for the result set of routes to be optimized is specifically used to initialize the current bus network and set the maximum population size and the preset number of iterations. A random bus route set is generated according to the maximum population size and the preset number of iterations. The optimization step is iteratively performed until the number of iterations reaches the preset number of iterations to obtain the result set of routes to be optimized. The optimization step includes: determining the objective function of the bus routes in the random bus route set. Determining the non-dominated level and congestion of the bus routes according to the objective function value of the objective function. Selecting bus routes according to the non-dominated level and congestion, and constructing them into a first route set. Performing a crossover operation on the first route set to generate a new bus route. Performing a genetic variation operation on the random bus route set to introduce new changes. The random bus route set with the new changes introduced is merged with the new bus route to obtain a new bus route set, and the number of iterations is increased by one. The new bus route set is used as the random bus route set to perform the optimization step. Exemplarily, the preset number of iterations here can be set to 200. Those skilled in the art can also set the preset number of iterations according to actual needs and experience.

[0069] In addition, the objective functions include abnormal line objective function, passenger flow objective function, bus stop and line length objective function and passenger flow difference objective function, as follows.

[0070] The objective function of the abnormal line is as follows:

[0071] In the formula, represents the abnormal line objective function, represents the distance between two adjacent sites. It represents the straight-line distance from the starting point to the end point of the current bus line, i represents the i-th line station, and N represents the total number of line stations of the current bus line.

[0072] The passenger flow objective function is as follows:

[0073] In the formula, represents the line passenger flow objective function, D represents the total number of days of data, d represents the data of the dth day, represents the passenger flow of the current bus line, R represents the total number of bus lines, r represents the rth bus line, represents the passenger flow of the rth bus line.

[0074] The objective function of bus stops and line length is as follows:

[0075] In the formula, represents the line station and circuit length objective function, represents the weight of the line station anomaly, i represents the i-th line station, N represents the total number of line stations of the current bus line, represents the distance between two adjacent sites. The weight representing the length of the bus line.

[0076] The passenger flow difference objective function is as follows:

[0077] In the formula, represents the passenger flow difference objective function of the bus line, S represents the total number of bus lines on the current bus line, s represents the sth bus line on the current bus line, represents, j represents, represents the passenger flow of the current line station, M represents the number of line stations within one kilometer around the current line station, and m represents the mth line station within one kilometer around the current line station. Indicates the passenger flow of other line stations within one kilometer around the current line station.

[0078] The optimization module 304 is used to optimize the result set of the to-be-optimized routes by the Q-learning algorithm to obtain an optimized bus network. The optimization module 304 is specifically used to input the result set of the to-be-optimized routes, the current bus network and the passenger flow into the Q-learning algorithm, and initialize the Q value storage table. The optimization solution step is iterated until the maximum number of iterations is reached and the iteration is stopped to obtain an optimized bus network. Exemplarily, the maximum number of iterations here is set to 500. Those skilled in the art may also set the maximum number of iterations according to actual needs and experience.

[0079] The optimization solution steps include: selecting the initial bus route according to the current strategy and the current Q value, and executing the initial bus route to obtain the immediate reward and the next state. Update the current Q value according to the immediate reward and the next state. Among them, the reward function of the immediate reward is as follows:

[0080] . In the formula, R represents the immediate reward, i represents the maximum number of iterations, and m represents the mth iteration. Indicates the starting point, and They represent the total number of passengers boarding from the starting point to the downstream bus stop j and from the downstream bus stop j to the starting point, represents the line length from the starting point to the downstream bus stop j, Indicates the non-linear coefficient of the bus route searched by the current algorithm, Indicates the number of bus routes passing through the downstream station to the starting point, Indicates the number of bus routes passing through the starting point to the downstream station, and Respectively represent the minimum and maximum distances from the current location to the next bus stop. Indicates the distance from the current location to the next bus stop. represents the nonlinear coefficient, and They represent the maximum and minimum lengths of the generated bus routes respectively.

[0081] Some modules in the apparatus described in the present application can be described in the general context of computer executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, classes, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0082] The devices or modules described in the above application embodiments can be implemented by computer chips or entities, or by products with certain functions. For the convenience of description, the above devices are described in various modules according to their functions. When implementing the embodiments of the present application, the functions of each module can be implemented in the same or multiple software and / or hardware. Of course, the module that implements a certain function can also be implemented by combining multiple sub-modules or sub-units.

[0083] The methods, devices or modules described in this application can be implemented in the form of computer-readable program codes. The controller can be implemented in any appropriate manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program codes (such as software or firmware) that can be executed by the (micro)processor, logic gates, switches, application-specific integrated circuits (English: Application Specific Integrated Circuit; Abbreviation: ASIC), programmable logic controllers and embedded microcontrollers. Examples of controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20 and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in the form of pure computer-readable program codes, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded microcontrollers by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included in it for implementing various functions can also be regarded as structures within the hardware component. Or even, the means for realizing various functions may be regarded as both a software module for realizing the method and a structure within a hardware component.

[0084] An embodiment of the present application further provides a device, comprising: a processor; a memory for storing processor executable instructions; when the processor executes the executable instructions, the method described in the embodiment of the present application is implemented.

[0085] The embodiments of the present application also provide a non-volatile computer-readable storage medium on which a computer program or instruction is stored. When the computer program or instruction is executed, the method described in the embodiments of the present application is implemented.

[0086] In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist independently, or two or more modules may be integrated into one module.

[0087] The above storage media include but are not limited to random access memory (RAM), read-only memory (ROM), cache, hard disk drive (HDD) or memory card. The memory can be used to store computer program instructions.

[0088] It can be seen from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus necessary hardware. Based on this understanding, the technical solution of the present application can be essentially or partly reflected in the prior art in the form of a software product, or it can be reflected in the implementation process of data migration. The computer software product can be stored in a storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a mobile terminal, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0089] The various embodiments in this specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. All or part of this application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld devices or portable devices, tablet devices, mobile communication terminals, multi-processor systems, microprocessor-based systems, programmable electronic devices, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc.

[0090] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the present application.

Claims

1. A bus network optimization method based on Q-learning algorithm, characterized in that: include: Obtaining bus operation data; wherein the bus operation data includes a bus track data set, a card swiping data set, and a bus station data set; Obtaining passenger flow according to the bus operation data; wherein the passenger flow includes the number of passengers getting on and off at each of the bus stops; The result set of routes to be optimized is obtained based on the passenger flow and the bus station data set, as follows: Initialize the current bus network and set the maximum population size and the preset number of iterations; Generate a random bus route set according to the maximum population size and the preset number of iterations; Iteratively executing the optimization step until the number of iterations reaches the preset number of iterations, and obtaining the line result set to be optimized; The optimization step comprises: Determine an objective function of a bus route in the random bus route set; Determining the non-dominated level and congestion degree of the bus line according to the objective function value of the objective function; Selecting bus routes according to the non-dominated level and the congestion degree, and constructing the bus routes into a first route set; Performing a cross operation on the first route set to generate a new bus route; Performing a genetic mutation operation on the random bus route set to introduce new changes; The random bus route set with new changes introduced is combined with the new bus route to obtain a new bus route set, and the number of iterations is increased by one; Taking the new bus route set as the random bus route set, executing the optimization step; The optimized bus network is obtained by optimizing the result set of the routes to be optimized through the Q-learning algorithm, as follows: Input the result set of routes to be optimized, the current bus network and the passenger flow into the Q-learning algorithm, and initialize the Q value storage table; Iteratively executing the optimization solution step until the maximum number of iterations is reached and then stopping the iteration to obtain the optimized bus network; The optimization solution step comprises: Select an initial bus route according to the current strategy and the current Q value, and execute the initial bus route to obtain an immediate reward and a next state; Update the current Q value according to the instant reward and the next state; The reward function of the instant reward is as follows: ; Where R represents the instant reward, i represents the maximum number of iterations, and m represents the mth iteration. Indicates the starting point, and They represent the total number of passengers boarding from the starting point to the downstream bus stop j and from the downstream bus stop j to the starting point, represents the line length from the starting point to the downstream bus stop j, Indicates the non-linear coefficient of the bus route searched by the current algorithm, Indicates the number of bus routes passing through the downstream station to the starting point, Indicates the number of bus routes passing through the starting point to the downstream station, and Respectively represent the minimum and maximum distances from the current location to the next bus stop. Indicates the distance from the current location to the next bus stop. represents the nonlinear coefficient, and They represent the maximum and minimum lengths of the generated bus routes respectively.

2. The method according to claim 1, characterized in that The obtaining of passenger flow according to the bus operation data comprises: Performing route matching according to the bus operation data to obtain a route matching result; wherein the route matching result includes a bus route and route card swiping data of the bus route; Performing vehicle matching according to the route matching result to obtain a vehicle matching result; wherein the vehicle matching result includes the scheduled buses of the bus route and the bus card swiping data of the scheduled buses; Perform time matching according to the vehicle matching result to obtain the passenger volume and boarding station data of the scheduled bus; The number of passengers getting off is determined according to the number of passengers getting on and the boarding station data.

3. The method according to claim 2, characterized in that The determining the number of passengers getting off based on the number of passengers getting on and the boarding station data includes: Obtaining the daily boarding card swiping data of each passenger according to the vehicle matching result and the boarding station data, screening out the card swiping records of passengers with two or more boarding card swiping data, and sorting the card swiping records of each passenger by time to obtain a card swiping sequence set; Determine all downstream sites of the card swiping site of the first card swiping data in the card swiping sequence set, and respectively calculate the straight-line distance between each of the downstream sites and the card swiping site of the next card swiping record of the first card swiping data; Filter out the straight-line distances that meet the distance threshold from the straight-line distances to form a straight-line distance set, and determine the walking time of each straight-line distance in the straight-line distance set; If the walking time meets the time threshold, the card swiping site of the next card swiping record is used as the transfer point; otherwise, it is used as the alighting point; The passenger drop-off quantity is determined according to the transfer point and the drop-off point.

4. The method according to claim 1, characterized in that: The objective functions include an abnormal line objective function, a passenger flow objective function, a bus stop and line length objective function, and a passenger flow difference objective function.

5. A bus network optimization device based on Q-learning algorithm, characterized in that: include: The first acquisition module is used to acquire bus operation data; wherein the bus operation data includes a bus track data set, a card swiping data set and a bus station data set; A second acquisition module is used to acquire passenger flow according to the bus operation data; wherein the passenger flow includes the number of passengers getting on and getting off at each of the bus stops; The route result set module to be optimized is used to obtain the route result set to be optimized according to the passenger flow and the bus station data set, as follows: Initialize the current bus network and set the maximum population size and the preset number of iterations; Generate a random bus route set according to the maximum population size and the preset number of iterations; Iteratively executing the optimization step until the number of iterations reaches the preset number of iterations, and obtaining the line result set to be optimized; The optimization step comprises: Determine an objective function of a bus route in the random bus route set; Determining the non-dominated level and congestion degree of the bus line according to the objective function value of the objective function; Selecting bus routes according to the non-dominated level and the congestion degree, and constructing the bus routes into a first route set; Performing a cross operation on the first route set to generate a new bus route; Performing a genetic mutation operation on the random bus route set to introduce new changes; The random bus route set with new changes introduced is combined with the new bus route to obtain a new bus route set, and the number of iterations is increased by one; Taking the new bus route set as the random bus route set, executing the optimization step; The optimization module is used to optimize the result set of the routes to be optimized by using the Q-learning algorithm to obtain an optimized bus network, as follows: Input the result set of routes to be optimized, the current bus network and the passenger flow into the Q-learning algorithm, and initialize the Q value storage table; Iteratively executing the optimization solution step until the maximum number of iterations is reached and then stopping the iteration to obtain the optimized bus network; The optimization solution step comprises: Select an initial bus route according to the current strategy and the current Q value, and execute the initial bus route to obtain an immediate reward and a next state; Update the current Q value according to the instant reward and the next state; The reward function of the instant reward is as follows: ; Where R represents the instant reward, i represents the maximum number of iterations, and m represents the mth iteration. Indicates the starting point, and They represent the total number of passengers boarding from the starting point to the downstream bus stop j and from the downstream bus stop j to the starting point, represents the line length from the starting point to the downstream bus stop j, Indicates the non-linear coefficient of the bus route searched by the current algorithm, Indicates the number of bus routes passing through the downstream station to the starting point, Indicates the number of bus routes passing through the starting point to the downstream station, and Respectively represent the minimum and maximum distances from the current location to the next bus stop. Indicates the distance from the current location to the next bus stop. represents the nonlinear coefficient, and They represent the maximum and minimum lengths of the generated bus routes respectively.

6. A device for executing a method for optimizing a bus network based on a Q-learning algorithm, characterized in that: include: processor; a memory for storing processor-executable instructions; When the processor executes the executable instructions, the method according to any one of claims 1 to 4 is implemented.

7. A non-volatile computer-readable storage medium, characterized in that: The device comprises a computer program or an instruction for storing the computer program or the instruction, which, when executed, enables the method according to any one of claims 1 to 4 to be implemented.