A method for matching bus and on-board POS machine numbers
By establishing the arrival and departure time index and mixed integer linear programming model, the problem of matching bus vehicle numbers with POS terminals is solved, efficient and accurate matching of vehicles and POS terminals is achieved, and the accuracy and computational efficiency of bus passenger flow analysis are improved.
Patent Information
- Application Number
- CN202311008233.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-11
- Publication Date
- 2025-10-03
- Estimated Expiration
- 2043-08-11
AI Technical Summary
Existing technology cannot accurately match the bus vehicle numbers with the on-board POS terminals, resulting in inaccurate bus passenger flow analysis, especially during peak hours when the number of departures is dense and difficult to distinguish, and the calculation efficiency is low.
By establishing the arrival and departure time index, calculating the weight matrix wij, using the mixed integer linear programming model to optimize the matching error, establishing the corresponding relationship between vehicles and POS machines, and using the rectangular assignment problem to solve the matching problem between vehicles and POS machines.
It can efficiently and accurately resolve the matching relationship between vehicles and POS machines during peak hours when the number of departures is dense. It does not need to store the full amount of original data, supports the calculation of large-scale card swiping data, and improves the accuracy of bus passenger flow analysis.
Smart Images

Figure CN117093786B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method for matching numbers of a public bus and a vehicle-mounted POS machine, and belongs to the technical field of public transportation planning and management. Background Art
[0002] Public transportation passenger flow statistics and analysis are a crucial component of urban transportation management, providing strong support for urban transportation planning and bus route optimization. By leveraging the relationship between bus card swipe data (or other electronic payment methods) and bus schedules, arrival and departure information, or satellite positioning information, we can infer passenger boarding points and, in turn, analyze passenger alighting points and passenger flow distribution along each route.
[0003] In some cities, bus card (or other electronic payment method) transaction data does not include information such as license plate numbers or vehicle numbers. Instead, it contains only the onboard POS machine number and route number. However, the mapping between POS machines and vehicles is unavailable or unrecorded. Therefore, obtaining the mapping between vehicles and POS machines is necessary to infer passenger boarding stations in transaction records, thereby enabling more accurate analysis of bus passenger flow characteristics.
[0004] There are two main solutions to this problem in existing technology: 1. Bypassing this problem, the number of passengers boarding each station is obtained by clustering card swipe records. However, this cannot be accurately determined by the shift, and the calculation time is long due to the amount of data. 2. Matching POS machines by the number of matches between shift time periods, stop time periods and card swipe times in card swipe records. This method has difficulty distinguishing between shifts with dense departures during peak hours and is greatly affected by the time distribution of passenger flow on the route. Summary of the Invention
[0005] In view of this, the present invention provides a method for matching bus numbers with on-board POS machines. During peak hours, the number of buses is dense, which effectively and accurately solves the matching relationship problem between vehicles and POS machines. It does not need to store the full amount of original data in the memory and can support the calculation of large-scale card swiping data.
[0006] The present invention provides a method for matching bus numbers with on-board POS terminals, which comprises the following steps:
[0007] 1) Obtain the data information of each bus on the bus route that needs to be matched;
[0008] 2) Traverse the bus arrival and departure schedule for each stop in step 1);
[0009] 3) Establish an arrival and departure time index, where the departure time index key is the time range of arrival time and departure time, and the value is the license plate number or vehicle number;
[0010] 4) Extract the list of license plate numbers operating on the same day and create a record table for license plate number j ∈ B and POS machine i ∈ A;
[0011] A: The set of POS machine numbers;
[0012] B: The set of license plate numbers;
[0013] i: A certain POS machine number;
[0014] j: A certain license plate number;
[0015] 5) Traverse the card - swiping transaction records of this line on that day. For each record, query the above index to find the arrival and departure time period that can cover the card - swiping time point of this record, and the license plate number to which this time period belongs;
[0016] 6) Traverse all the license plate numbers in step 4). According to whether this record is within the vehicle's stop time period corresponding to this license plate number, increment the count in the record table of license plate number and POS machine accordingly;
[0017] 7) Establish a rectangular assignment problem with the optimization goal of reducing the total matching error: Let whether to match POS machine i to license plate j be a 0 - 1 variable x ij , i ∈ A, j ∈ B. Calculate the weight matrix w ij , i ∈ A, j ∈ B. The meaning of this value is the matching error. Let a very large number M, which is greater than the total number of daily card - swipes;
[0018] Let a relatively large number N < M, which is greater than the maximum number of stop - time matches max(n<> ij )
[0019] A: The set of POS machine numbers;
[0020] B: The set of license plate numbers;
[0021] i: A certain POS machine number;
[0022] j: A certain license plate number;
[0023] n ij : For the vehicle represented by j, within all time periods when the vehicle stops at the station, the number of card - swiping records of the POS machine represented by i;
[0024] 8) According to the number of card - swiping records n ij within the vehicle stop - time period in the record table of license plate number and POS machine in step 4), and the number of card - swiping records m ij outside the vehicle stop - time period, calculate the value w ij of this matrix.
[0025] n ij: For vehicle j, the number of card swipe records of POS machine i during all time periods when the vehicle stops at the station;
[0026] m ij : For vehicle j, the POS of i during all time periods when the vehicle does not stop at a station (is driving);
[0027] 9) For data from multiple routes and multiple days, use the above steps to create multiple matching tables, multiple error matrices, and multiple assignment problems. At the same time, calculate the matching status of POS machines and license plates for multiple routes every day. The data from multiple days can be combined into the same assignment problem for calculation.
[0028] 10) The number of card swipe records n recorded in step 4) under the corresponding relationship between the license plate number and the POS terminal during the vehicle stop time period ij , and the number of card swipe records outside the vehicle stop time period m ij ;
[0029] n ij : For vehicle j, the number of card swipe records of POS machine i during all time periods when the vehicle stops at the station;
[0030] m ij : For the vehicle represented by j, the number of card swiping records of the POS machine represented by i during all time periods when the vehicle is driving without stopping at a station.
[0031] Preferably, the data information of each bus on the bus route in step 1) includes records of the arrival time, departure time, door opening time and door closing time of each bus at each stop.
[0032] Preferably, in step 1), the track record of the vehicle-mounted satellite positioning device is matched with the station coordinates of the corresponding route to obtain the arrival time and departure time of the vehicle at each station.
[0033] Preferably, the rectangle assignment problem in step 7) is a mixed integer linear programming problem.
[0034] Preferably, the value w in the matrix in step 8) is ij
[0035]
[0036] The mixed integer linear programming model is:
[0037] minz=∑ i∈A,j∈B w ij x ij
[0038] st∑ j∈B xij = 1, i ∈ A
[0039]
[0040] x ij ∈ {0, 1}, i ∈ A, j ∈ B
[0041] If the license plate number is more than the POS machine number, the constraint conditions can be changed accordingly;
[0042] Set of POS machine numbers;
[0043] B: Set of license plate numbers;
[0044] i: A certain POS machine number;
[0045] j: A certain license plate number;
[0046] x ij : Decision variable, whether to match a certain POS machine with a certain license plate number, 0 for not matching, 1 for matching;
[0047] n ij : For the vehicle represented by j, the number of card swiping records of the POS machine represented by i during all time periods when the vehicle stops at the station;
[0048] m ij : For the vehicle represented by j, the number of card swiping records of the POS machine represented by i during all time periods when the vehicle is not stopping at the station (is in motion);
[0049] M: Constant, greater than the total number of card swipes per day, taking a fixed empirical value;
[0050] N: Constant, N < M, greater than the maximum number of docking time matches max(n ij ), taking a fixed empirical value;
[0051] w ij : Cost coefficient, the meaning of this value is the matching error, the smaller the better, calculated by the above formula;
[0052] z: Objective function of linear programming, minimizing it.
[0053] Preferably, the calculation method of the said w ij is to first consider the number of card swiping records outside the time period when the vehicle stops at the station, and then consider the number of card swiping records within the time period when the vehicle stops at the station when they are the same.
[0054] Advantages of the present invention:
[0055] The present invention provides a method for matching bus numbers with on-board POS terminals. During peak hours, when departures are dense, the method effectively and accurately solves the matching relationship problem between buses and POS terminals. It does not require storing all original data in memory and can support the calculation of large-scale card swiping data. The method is applicable to planning, operation management and other aspects of public transportation, and has high practicality and promotion value. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 The figure is a schematic diagram of the overall structure of a method for matching numbers of a public bus and an on-board POS machine according to the present invention.
[0057] Figure 2 This is a schematic diagram of a weight value determination method in an assignment problem of a method for matching bus vehicle and on-board POS machine numbers according to the present invention. DETAILED DESCRIPTION
[0058] The preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0059] Example 1
[0060] The present invention provides a method for matching bus numbers with on-board POS terminals, which comprises the following steps:
[0061] 1) Obtain the arrival and departure times, or door opening and closing times, of each bus at each stop on the bus route to be matched. If there are no corresponding records or the corresponding records are inaccurate, the trajectory records of the on-board satellite positioning device can be matched with the station coordinates of the corresponding route to obtain the arrival and departure times of the vehicle at each stop;
[0062] 2) Traverse the bus arrival and departure schedule for each stop in step 1);
[0063] 3) Create an arrival and departure time index. The departure time index key is the time range of arrival and departure time, and the value is the license plate number or vehicle number. The purpose of establishing this index is to improve the efficiency of searching for vehicles that stop at the station by recording the time of card swiping;
[0064] 4) Extract the list of all license plates in operation on the day, establish a record table of license plate number j∈B and POS machine i∈A, and record the number of card swipe records n at the vehicle stop within the time period under the corresponding relationship between the vehicle license plate number and the POS machine ij , and the number of card swipe records outside the vehicle stop time period m ij ;
[0065] A: POS machine number set;
[0066] B: license plate number set;
[0067] i: A certain POS machine number;
[0068] j: A certain license plate number;
[0069] 5) Traverse the card - swiping transaction records of this line on the current day. For each record, query the above index to find the arrival and departure time period that can cover the card - swiping time point of this record, and the license plate number to which this time period belongs;
[0070] 6) Traverse all the license plate numbers in step 4). According to whether this record is within the vehicle stop time period of the vehicle with this license plate number, correspondingly increase the count in the record table of license plate number and POS machine;
[0071] 7) Establish a rectangular assignment problem whose optimization goal is to reduce the total matching error:
[0072] Let whether to match POS machine i to license plate j be a 0 - 1 variable x ij , i ∈ A, j ∈ B.
[0073] Calculate the weight matrix w ij , i ∈ A, j ∈ B, and the meaning of this value is the matching error.
[0074] Let a very large number M, which is greater than the total number of daily card - swipes;
[0075] 8) Let a relatively large number N < M, which is greater than the maximum number of stop - time matches max(n ij )
[0076] A: The set of POS machine numbers;
[0077] B: The set of license plate numbers;
[0078] i: A certain POS machine number;
[0079] j: A certain license plate number;
[0080] n ij : For the vehicle represented by j, within all time periods of the vehicle's stop site,
[0081] The number of card - swiping records of the POS machine represented by i;
[0082] 9) According to the number of card - swiping records n ij within the vehicle stop time period in the record table of license plate number and POS machine in step 4), ij and the number of card - swiping records m ij
[0083]
[0084] The mixed integer linear programming model is (assuming the license plate number is less than the POS machine number):
[0085] minz=∑ i∈A,j∈B w ij x ij
[0086] s.t.∑ j∈B x ij =1,i∈A
[0087]
[0088] x ij ∈{0,1},i∈A,j∈B
[0089] If the license plate number is more than the POS machine number, the constraint conditions can be changed accordingly.
[0090] A: Set of POS machine numbers;
[0091] B: Set of license plate numbers;
[0092] i: A certain POS machine number;
[0093] j: A certain license plate number;
[0094] x ij : Decision variable, whether to match a certain POS machine with a certain license plate number, 0 for not matching, 1 for matching;
[0095] n ij : For the vehicle represented by j, the number of card swiping records of the POS machine represented by i during all time periods when the vehicle stops at the station;
[0096] m ij : For the vehicle represented by j, the number of card swiping records of the POS machine represented by i during all time periods when the vehicle does not stop at the station (is in motion);
[0097] M: Constant, greater than the total number of daily card swiping times, taking a fixed empirical value;
[0098] N: Constant, N < M, greater than the maximum number of docking time matches max(n ij ), taking a fixed empirical value;
[0099] w ij : Cost coefficient, the meaning of this value is the matching error, the smaller the better, calculated by the above formula;
[0100] z: Objective function of the linear programming, minimizing it;
[0101] 10) For data from multiple routes and multiple days, use the above steps to establish multiple matching tables, multiple error matrices, and multiple assignment problems, and simultaneously calculate the matching status of POS machines and license plates for multiple routes every day. The data from multiple days can be combined into the same assignment problem for calculation.
[0102] Example 2:
[0103] The present invention provides a method for matching bus and on-board POS machine numbers, which comprises:
[0104] Collect satellite positioning trajectory data (including license plate number, route number, time, longitude and latitude) for the bus routes to be studied within a certain timeframe, as well as bus dispatch data (including route code, license plate number, direction, departure time, arrival time), route direction, station name sequence, and geographic location. Collect card swipe data (or other electronic payment method) transaction records for the relevant routes within the study area, including swipe time, POS terminal number, and route number.
[0105] The satellite positioning trajectory data of the bus is matched with the station locations of the corresponding lines to obtain the time when each vehicle approaches and leaves each station within 300m and the speed is less than 4m / s, which is the arrival time and departure time at each station.
[0106] The arrival and departure times of public buses and card transaction records are entered into a database. In one embodiment, the data volume is: 1622 bus routes, 19,091,597 card transaction records, and 18,329,949 arrival and departure records over a 7-day period. Each route has an average of approximately 10 buses, with a maximum of 51 buses.
[0107] During the timeframe studied, the matching of license plate numbers and POS terminals for all bus routes is calculated on a daily basis. For each route, an interval tree index is created, associating arrival and departure times with license plate numbers, enabling quick retrieval of vehicles stopping at a given point in time. For each route, a license plate number (vehicle number) set is created, encompassing all vehicles operating that day. The arrival and departure times of each vehicle on all routes for that day are retrieved from the database and added to the index and license plate number set.
[0108] For each route, a hash mapping table is created, with the key being the license plate number and the POS machine number, and the value including the number of card swipe records n during the vehicle stop time period. ij , and the number of card swipe records outside the vehicle stop time period m ij .
[0109] Read all the card - swiping transaction records of the day one by one from the database. For each record, query the interval tree index of the bus line involved in this record, find all the arrival and departure time periods that cover the card - swiping time point of this record, and the vehicle license plate numbers belonging to each time period. Traverse all the vehicle license plate numbers operating on this line, and increase the count in the mapping table of vehicle license plate number and POS machine accordingly according to whether this record is within the stop - site time period of the vehicle with this license plate number.
[0110] Establish the weight matrix w of the assignment problem ij , i ∈ A, j ∈ B, which means the matching error between the vehicle license plate number and the POS machine.
[0111] Set a very large number M, greater than the total number of daily card - swipes. In this implementation, it is set to 10 7 ;
[0112] Set a relatively large number N < M, greater than the maximum number of stop - time matches max(n ij ), in this implementation, it is set to 1000.
[0113] According to the number of card - swiping records n ij within the stop - site time period of the vehicle in the hash mapping table of vehicle license plate number and POS machine, and the number of card - swiping records m ij outside the stop - site time period of the vehicle, calculate the value w in this matrix ij
[0114]
[0115] Establish the decision - variable matrix x of the assignment problem ij , x ij ∈ {0, 1}, i ∈ A, j ∈ B, and the initial value is 0.
[0116] Use the improved Hungarian algorithm to solve this rectangular assignment problem.
[0117] Enter the calculation results into the database. Using these calculation results, deduce the boarding stations and corresponding shifts of each card - swiping record.
[0118] The present invention and its implementation manners have been described above. This description is not restrictive. What is shown in the drawings is only one of the implementation manners of the present invention, and the actual structure is not limited thereto. Generally speaking, if those of ordinary skill in the art are inspired by it and, without departing from the gist of the present invention - creation, design similar structural modes and embodiments to this technical solution without creative efforts, they shall fall within the protection scope of the present invention.
Claims
1. A method for matching bus and on-board POS machine numbers, characterized in that The following steps are involved: 1) Obtain the data information of each bus on the bus route that needs to be matched; 2) Traverse the bus arrival and departure schedule for each stop in step 1); 3) Establish an arrival and departure time index, where the arrival and departure time index key is the time range of arrival time and departure time, and the value is the license plate number or vehicle number; 4) Extract the list of all license plates in operation on that day and create a record table of license plate number j∈B and POS machine i∈A; A: POS machine number set; B: license plate number set; i: a POS machine number; j: a license plate number; 5) Traverse the card swipe transaction records for the route on that day. For each record, query the above index to find the arrival and departure time period that covers the card swipe time point of the record, as well as the license plate number belonging to that time period; 6) Traverse all license plate numbers in step 4), and increase the count in the license plate number and POS machine record table accordingly based on whether the record is within the time period of the vehicle stop at the license plate number; 7) Establish a rectangle assignment problem whose optimization goal is to reduce the total matching error: Let whether to match POS machine i to license plate j be the decision variable x ij ,i∈A,j∈B; Calculate the weight matrix w ij ,i∈A,j∈B, the meaning of this value is matching error; A: POS machine number set; B: license plate number set; i: a POS machine number; j: a license plate number; 8) According to the license plate number in step 4) and the number of card swiping records in the POS machine record table during the vehicle stop time period n ij , and the number of card swipe records outside the vehicle stop time period m ij , calculate the value w in the weight matrix in step 7) ij n ij : For vehicle j, the number of card swipe records of POS machine i during all time periods when the vehicle stops at the station; m ij : For vehicle j, the number of card swipe records of POS machine i during all time periods when the vehicle is driving without stopping at a station; 9) Solve the assignment problem in step 7) and the result is the matching between the POS terminal and the license plate number; The rectangle assignment problem in step 7) is a mixed integer linear programming problem, and the model is: minz=∑ i∈A,j∈B w ij x ij s.t.∑ j∈B x ij =1,i∈A x ij ∈{0,1},i∈A,j∈B If the license plate number is greater than the POS machine number, the constraint condition can be changed accordingly; A: POS machine number set; B: license plate number set; i: a POS machine number; j: a license plate number; x ij : Decision variable, whether to match a POS machine with a license plate number, 0 for no match, 1 for match; w ij : Cost coefficient, the meaning of this value is matching error, the smaller the better; z: The objective function of linear programming, which is minimized.
2. The method for matching bus and on-board POS machine numbers according to claim 1, characterized in that: The data information of each bus on the bus route in step 1) includes the arrival time, departure time, or door opening and closing time of each bus at each stop.
3. The method for matching bus and on-board POS machine numbers according to claim 1, characterized in that: In step 4), the number of card swiping records n during the vehicle stop time period is recorded under the corresponding relationship between the license plate number and the POS machine. ij , and the number of card swipe records outside the vehicle stop time period m ij ; n ij : For vehicle j, the number of card swipe records of POS machine i during all time periods when the vehicle stops at the station; m ij : For vehicle j, the number of card swiping records of POS machine i during all time periods when the vehicle is driving without stopping at any station.
4. The method for matching bus and on-board POS machine numbers according to claim 1, characterized in that: The value w in the matrix in step 8) ij i: a POS machine number; j: a license plate number; n ij : For vehicle j, the number of card swipe records of POS machine i during all time periods when the vehicle stops at the station; m ij : For vehicle j, the number of card swipe records of POS machine i during all time periods when the vehicle is driving without stopping at a station; M: constant, greater than the total number of card swipes per day, with a fixed empirical value; N: A constant, N < M, greater than the maximum number of docking time matches max(n ij ), and take a fixed empirical value; w ij : Cost coefficient, the value means matching error, the smaller the better.
5. The method for matching bus and on-board POS machine numbers according to claim 4, characterized in that: The w ij The calculation method is to first consider the number of card swiping records outside the time period of the vehicle stop, and then consider the number of card swiping records within the time period of the stop.
Citation Information
Patent Citations
Public transport passenger flow corridor OD acquisition method based on multi-source data
CN115271371A
Hand-held POS machine bus card swiping data automatic matching method
CN115905349A