Tourist route optimization method, system, equipment and medium
By constructing and optimizing the traffic distance and time matrix of tourist routes, the problem of failing to meet the diversified needs of tourism routes in the existing technology is solved, and the optimized route planning with the shortest time to play during the business hours of attractions is realized, which improves the user experience.
Patent Information
- Application Number
- CN202510333759.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-20
- Publication Date
- 2025-06-27
AI Technical Summary
The existing tourism route planning methods are mainly based on transportation methods, and the diversified needs in tourism scenarios are not fully considered, such as the influence of arrival time, visit time and hotel location, making it difficult to actually apply the output route.
By obtaining the user's initial tourist route nodes, including attractions, hotels and transportation itineraries, building a traffic distance matrix and time matrix, and adjusting the traffic time matrix based on the travel scenarios, optimizing the route to ensure the shortest time to play during the business hours of each attraction.
The optimized travel routes more reasonably meet users' time and distance needs and improve user experience.
Smart Images

Figure CN120218378A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of data processing, and particularly to a method, system, device and medium for optimizing a travel route. Background Art
[0002] Existing travel route planning methods mainly focus on transportation modes for planning. For example, Baidu Map provides route planning interfaces based on different transportation modes. However, for route planning in a travel scenario, in addition to considering the transportation distance, there are more practical conditions that need to be taken into account. For example, whether the arrival time at a specific scenic spot is within the business hours of the scenic spot, whether different scenic spots can allow for different play durations, and the impact of hotel location on the play sequence. Existing technologies do not handle the characteristics of travel routes accordingly, so the output travel routes are difficult to be actually useful for users. Summary of the Invention
[0003] The technical problem to be solved by the present disclosure is to overcome the defect that the existing travel route planning based only on transportation modes is not reasonable and practical enough to meet the diverse needs of users, and to provide a method, system, device and medium for optimizing a travel route.
[0004] The present disclosure solves the above technical problem through the following technical solutions:
[0005] In a first aspect, a method for optimizing a travel route is provided. The method for optimizing a travel route includes:
[0006] Obtaining route nodes corresponding to an initial travel route of a user;
[0007] Wherein the route nodes include scenic spot nodes, hotel nodes and transportation itinerary nodes;
[0008] Performing a data processing operation on the route nodes to obtain a traffic distance matrix corresponding to the route nodes;
[0009] Obtaining an initial traffic time matrix corresponding to the route nodes based on the traffic distance matrix;
[0010] Obtaining the travel scenario corresponding to the initial travel route, and adjusting the initial traffic time matrix based on the travel scenario to obtain an optimized traffic time matrix;
[0011] Optimizing the initial travel route based on the route nodes and the optimized traffic time matrix to obtain an optimized travel route corresponding to the initial travel route;
[0012] Wherein the optimized travel route represents a travel route with the shortest total play duration within the business hours of each scenic spot node.
[0013] Optionally, the step of obtaining the initial traffic time matrix corresponding to the route nodes based on the traffic distance matrix includes:
[0014] Obtain the historical traffic data corresponding to any two route nodes;
[0015] Based on the historical traffic data and the traffic distance matrix, obtain the traffic time matrix corresponding to the route nodes;
[0016] Wherein, the historical traffic data includes historical traffic duration and / or historical traffic distance.
[0017] Optionally, the step of obtaining the travel scenario corresponding to the initial travel route and adjusting the initial traffic time matrix based on the travel scenario to obtain the optimized traffic time matrix includes:
[0018] Obtain the preset route configuration adjustment rules and the travel scenario corresponding to the initial travel route;
[0019] Based on the preset route configuration adjustment rules corresponding to the travel scenario, configure the starting route point and the ending route point corresponding to the initial travel route, and adjust the initial traffic time matrix based on the starting route point and the ending route point to obtain the optimized traffic time matrix;
[0020] Wherein, the travel scenario includes any one of a round-trip traffic scenario, a round-trip hotel scenario, a no-traffic scenario, and a regular traffic scenario.
[0021] Optionally, the step of optimizing the initial travel route based on the route nodes and the optimized traffic time matrix to obtain the optimized travel route corresponding to the initial travel route includes:
[0022] Obtain the scenic spot information corresponding to the scenic spot nodes and the traffic itinerary information corresponding to the traffic itinerary nodes;
[0023] Wherein, the scenic spot information includes business hours information, play duration range, and play preference information, and the traffic itinerary information includes departure place, arrival place, departure time, arrival time, and transportation tool type;
[0024] Based on the scenic spot information, determine the scenic spot time window corresponding to the scenic spot nodes, based on the traffic itinerary information, determine the traffic time window corresponding to the traffic itinerary nodes, and obtain the hotel time window corresponding to the hotel nodes;
[0025] Wherein, the time window includes an arrival time window and a stay duration;
[0026] Input the scenic spot time window, the transportation time window, the hotel time window, and the optimized transportation time matrix into a preset optimization model to output the optimized travel route.
[0027] Optionally, the preset optimization model includes an or-tools (an open-source software suite) model.
[0028] Optionally, the step of performing data processing operations on the route nodes to obtain the traffic distance matrix corresponding to the route nodes includes:
[0029] Obtain the latitude and longitude data corresponding to each route node;
[0030] Calculate the distance value between any two route nodes based on the latitude and longitude data;
[0031] Summarize the distance values to obtain the traffic distance matrix.
[0032] Optionally, the step of calculating the distance value between any two route nodes based on the latitude and longitude data includes:
[0033] Calculate the distance value between any two route nodes by using the spherical formula for the latitude and longitude data.
[0034] In a second aspect, a travel route optimization system is provided. The travel route optimization system includes:
[0035] An initial route acquisition module, configured to acquire the route nodes corresponding to the user's initial travel route;
[0036] Wherein, the route nodes include scenic spot nodes, hotel nodes, and transportation itinerary nodes;
[0037] A distance matrix acquisition module, configured to perform data processing operations on the route nodes to obtain the traffic distance matrix corresponding to the route nodes;
[0038] An initial matrix acquisition module, configured to acquire the initial traffic time matrix corresponding to the route nodes based on the traffic distance matrix;
[0039] A matrix optimization module, configured to acquire the travel scenario corresponding to the initial travel route, and adjust the initial traffic time matrix based on the travel scenario to obtain an optimized traffic time matrix;
[0040] A route optimization module, configured to optimize the initial travel route based on the route nodes and the optimized traffic time matrix to obtain the optimized travel route corresponding to the initial travel route;
[0041] Among them, the optimized travel route represents the travel route with the shortest total duration for playing within the business hours of each scenic spot node.
[0042] Optionally, the initial matrix obtaining module includes:
[0043] A historical data obtaining unit for obtaining historical traffic data corresponding to any two route nodes;
[0044] An initial matrix obtaining unit for obtaining an initial traffic time matrix corresponding to the route nodes based on the historical traffic data and the traffic distance matrix;
[0045] Among them, the historical traffic data includes historical traffic duration and / or historical traffic distance.
[0046] Optionally, the matrix optimization module includes:
[0047] A scenario obtaining unit for obtaining a preset route configuration adjustment rule and the travel scenario corresponding to the initial travel route;
[0048] A matrix optimization unit for configuring the starting route point and the ending route point corresponding to the initial travel route based on the preset route configuration adjustment rule corresponding to the travel scenario, and adjusting the initial traffic time matrix based on the starting route point and the ending route point to obtain the optimized traffic time matrix;
[0049] Among them, the travel scenario includes any one of a round-trip traffic scenario, a round-trip hotel scenario, a traffic-free scenario, and a regular traffic scenario.
[0050] Optionally, the route optimization module includes:
[0051] A node information obtaining unit for obtaining the scenic spot information corresponding to the scenic spot node and the traffic itinerary information corresponding to the traffic itinerary node;
[0052] Among them, the scenic spot information includes business hours information, play duration range, and play preference information, and the traffic itinerary information includes departure place, arrival place, departure time, arrival time, and transportation tool type; a time window obtaining unit for determining the scenic spot time window corresponding to the scenic spot node based on the scenic spot information, determining the traffic time window corresponding to the traffic itinerary node based on the traffic itinerary information, and obtaining the hotel time window corresponding to the hotel node;
[0053] A route optimization unit for inputting the scenic spot time window, the traffic time window, the hotel time window, and the optimized traffic time matrix into a preset optimization model, and outputting to obtain the optimized travel route.
[0054] Optionally, the preset optimization model includes an or-tools model.
[0055] Optionally, the distance matrix acquisition module includes:
[0056] A longitude and latitude acquisition unit for acquiring the longitude and latitude data of the departure and arrival locations corresponding to each route node;
[0057] A distance value acquisition unit for calculating the distance values between each departure location and each arrival location when any route node is used as the departure location and other route nodes within the initial route are used as the arrival locations based on the longitude and latitude data;
[0058] A matrix acquisition unit for summarizing the distance values to obtain a traffic distance matrix.
[0059] In a third aspect, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and configured to run on the processor. When the processor executes the computer program, the above-mentioned travel route optimization method is implemented.
[0060] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned travel route optimization method is implemented.
[0061] In a fifth aspect, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the above-mentioned travel route optimization method is implemented.
[0062] Based on common knowledge in the art, the above preferred conditions can be combined arbitrarily to obtain various preferred embodiments of the present disclosure.
[0063] The positive and progressive effects of the present disclosure are as follows:
[0064] For the travel route optimization method, system, device, and medium of the present disclosure, the route nodes corresponding to the user's initial travel route include scenic spot nodes, hotel nodes, and traffic itinerary nodes. By obtaining route nodes including various data types, a unique traffic distance matrix corresponding to the route nodes is obtained. Then, based on the traffic distance matrix, an initial traffic time matrix corresponding to the route nodes is obtained, and the initial traffic time matrix is optimized according to the travel scenario corresponding to the initial travel route to obtain an optimized traffic time matrix corresponding to the initial traffic time matrix. Furthermore, the initial travel route is optimized according to the route nodes and the optimized traffic time matrix to obtain an optimized travel route corresponding to the initial travel route. The optimized travel route represents the travel route with the shortest total duration for playing within the business hours of each scenic spot node, making the travel route planning more reasonable and closer to reality, meeting the diverse needs of users in terms of both time and distance, and improving the user experience. Description of the Drawings
[0065] Figure 1 It is the first process flow chart of the travel route optimization method provided in Embodiment 1 of the present disclosure;
[0066] Figure 2 It is the second process flow chart of the travel route optimization method provided in Embodiment 1 of the present disclosure;
[0067] Figure 3 It is the third process flow chart of the travel route optimization method provided in Embodiment 1 of the present disclosure;
[0068] Figure 4 It is the fourth process flow chart of the travel route optimization method provided in Embodiment 1 of the present disclosure;
[0069] Figure 5 It is the fifth process flow chart of the travel route optimization method provided in Embodiment 1 of the present disclosure;
[0070] Figure 6 It is the structural schematic diagram of the travel route optimization system provided in Embodiment 2 of the present disclosure;
[0071] Figure 7 It is the structural schematic diagram of the electronic device provided in Embodiment 3 of the present disclosure. Specific embodiments
[0072] The present disclosure will be further described below by way of examples, but the present disclosure is not limited thereto within the scope of the described examples.
[0073] In the embodiments of the present disclosure, prefix words such as "first" and "second" are only used to distinguish different described objects, and have no limiting effect on the position, order, priority, quantity, content, etc. of the described objects. The use of ordinal numbers and other prefix words for distinguishing described objects in the embodiments of the present disclosure does not constitute a limitation on the described objects. For the description of the described objects, refer to the description in the context of the embodiments, and no redundant limitation should be constituted due to the use of such prefix words. In addition, in the description of this embodiment, unless otherwise specified, "a plurality of" means two or more.
[0074] Embodiment 1
[0075] This embodiment provides a travel route optimization method. As Figure 1 shown, the travel route optimization method includes:
[0076] S1. Obtain the route nodes corresponding to the user's initial travel route.
[0077] S2. Perform data processing operations on the route nodes to obtain the traffic distance matrix corresponding to the route nodes.
[0078] S3. Obtain the initial traffic time matrix corresponding to the route nodes based on the traffic distance matrix.
[0079] S4. Obtain the travel scenarios corresponding to the initial travel route, and adjust the initial traffic time matrix based on the travel scenarios to obtain the optimized traffic time matrix.
[0080] S5. Optimize the initial travel route based on the route nodes and the optimized traffic time matrix to obtain the optimized travel route corresponding to the initial travel route.
[0081] Among them, the optimized travel route represents the travel route with the shortest total duration for playing within the business hours of each scenic spot node.
[0082] The initial travel route input by the user can be regarded as a combination of various data nodes in an orderly manner, that is, the route nodes correspond to multiple data types. The route nodes include, but are not limited to, scenic spot nodes, hotel nodes, and traffic itinerary nodes. The optimized travel route represents the travel route with the shortest total duration for playing within the business hours of each scenic spot node. The traffic itinerary node has corresponding vehicle types, departure locations, arrival locations, departure times, arrival times, etc.
[0083] Specifically, the traffic distance matrix represents the distances between each route node, and the traffic time matrix represents the traffic duration corresponding to the distances between each route node.
[0084] The travel route optimization method of this embodiment obtains the route nodes including multiple data types, obtains the unique traffic distance matrix corresponding to the route nodes, and then obtains the initial traffic time matrix corresponding to the route nodes based on the traffic distance matrix. The initial traffic time matrix is optimized according to the travel scenarios corresponding to the initial travel route to obtain the optimized traffic time matrix corresponding to the initial traffic time matrix. Then, the initial travel route is optimized according to the route nodes and the optimized traffic time matrix. The optimized travel route represents the travel route with the shortest total duration for playing within the business hours of each scenic spot node, making the travel route planning more reasonable and closer to reality, meeting the diverse needs of users to balance time and distance, and improving the user experience.
[0085] In an alternative embodiment, as Figure 2 shown, the above step S3 includes:
[0086] S31. Obtain the historical traffic data corresponding to any two route nodes.
[0087] S32. Obtain the initial traffic time matrix corresponding to the route nodes based on the historical traffic data and the traffic distance matrix.
[0088] Among them, the historical traffic data includes, but is not limited to, historical traffic duration and historical traffic distance.
[0089] Since each scenic spot has corresponding business hours information, it is necessary to convert the traffic distance matrix into a traffic time matrix. By combining historical traffic data and fitting the traffic duration required for the distance values in the traffic distance matrix, the traffic duration required for the distance values between any two route nodes can be obtained. Specifically, a large amount of historical traffic distance and historical traffic duration data are obtained through the Baidu Map interface, and the conversion formula between traffic distance and traffic duration is fitted by the least squares algorithm. The distance values in the traffic distance matrix are converted through the conversion formula to obtain the traffic duration, and the initial traffic time matrix can be obtained by summarizing each traffic duration.
[0090] In an optional embodiment, as Figure 3 shown, the above step S4 includes:
[0091] S41. Obtain the preset route configuration adjustment rules and the travel scenarios corresponding to the initial travel route.
[0092] S42. Configure the starting route point and the ending route point corresponding to the initial travel route based on the preset route configuration adjustment rules corresponding to the travel scenario, and adjust the initial traffic time matrix based on the starting route point and the ending route point to obtain the optimized traffic time matrix.
[0093] Among them, the travel scenario includes any one of a round-trip traffic scenario, a round-trip hotel scenario, a no-traffic scenario, and a regular traffic scenario.
[0094] Among them, the round-trip traffic scenario means a single-day round trip to a certain destination. The round-trip traffic scenario includes a departure traffic node and a return traffic node. The arrival place of the departure traffic node is the same as the departure place of the return traffic node. The preset route configuration adjustment rules corresponding to the round-trip traffic scenario are to use the departure place of the departure traffic node as the starting route point, the return traffic node as the ending route point, and adjust the initial traffic time matrix according to the time window from the starting route point to any route node and the time window from the ending route point to any route node to obtain the optimized traffic time matrix.
[0095] Among them, the round-trip hotel scenario means that there is a departure traffic node in the initial travel route, and there are two identical hotel nodes at the arrival place of the departure traffic node. The preset route configuration adjustment rules corresponding to the round-trip hotel scenario include secondary optimization. The first optimization uses the preset virtual starting point as the starting route point and the hotel node as the ending route point, and adjusts the initial traffic time matrix based on the time window from the starting route point and the ending route point to any route node respectively; the secondary optimization uses the hotel node as the starting route point and the ending route point, and adjusts the initial traffic time matrix after the first optimization based on the time window from the starting route point and the ending route point to any route node respectively to obtain the optimized traffic time matrix.
[0096] Among them, in the no-traffic scenario, that is, when there are no traffic itinerary nodes in the daily travel route but there are scenic spot nodes and a hotel node, usually the hotel node is used as the accommodation point for the day. The preset route configuration adjustment rule corresponding to the no-traffic scenario is to use the preset virtual starting point as the starting route point, use the hotel node as the ending route point, and adjust the initial traffic time matrix according to the time window from the starting route point to any route node and the time window from the ending route point to any route node to obtain the optimized traffic time matrix.
[0097] Scenarios other than the above round-trip traffic scenario, round-trip hotel scenario, and no-traffic scenario can all be referred to as regular traffic scenarios. The route configuration adjustment rule corresponding to the regular traffic scenario is to use the preset virtual starting point as the starting route point, use the preset virtual arrival point as the ending route point, and respectively adjust the initial traffic time matrix based on the preset time windows from the starting route point and the ending route point to any route node to obtain the optimized traffic time matrix.
[0098] In this embodiment, after determining the travel scenario corresponding to the user's initial travel route, configure the starting route point and the ending route point corresponding to the initial travel route according to the preset route configuration adjustment rule corresponding to the travel scenario, and adjust the initial traffic time matrix based on the starting route point and the ending route point to obtain the optimized traffic time matrix, so that the optimized traffic time matrix can adapt to various travel scenarios of the user and improve the practical feasibility of the optimized travel route.
[0099] In an optional embodiment, as Figure 4 shown, the above step S5 includes:
[0100] S51. Obtain the scenic spot information corresponding to the scenic spot node and the traffic itinerary information corresponding to the traffic itinerary node.
[0101] Among them, the scenic spot information includes business hours information, play duration range, and play preference information, and the traffic itinerary information includes departure place, arrival place, departure time, arrival time, and transportation tool type.
[0102] S52. Determine the scenic spot time window corresponding to the scenic spot node based on the scenic spot information, determine the traffic time window corresponding to the traffic itinerary node based on the traffic itinerary information, and obtain the hotel time window corresponding to the hotel node.
[0103] S53. Input the scenic spot time window, traffic time window, hotel time window, and optimized traffic time matrix into the preset optimization model, and output the optimized travel route.
[0104] Among them, the time window includes the reachable time window and the stay duration.
[0105] The route configuration adjustment rules corresponding to the round-trip hotel scenario include secondary optimization, that is, an optimized travel route is obtained after secondary optimization. Specifically, the initial traffic time matrix is initially optimized, and combined with a preset optimization model, after obtaining the initially optimized route, the route nodes before the departure traffic node remain unchanged as the optimized route. For the route nodes after the departure traffic node, secondary optimization is performed to obtain an optimized traffic time matrix, which is combined with the preset optimization model to obtain a secondarily optimized route. The initially optimized route and the secondarily optimized route are merged to obtain the optimized travel route.
[0106] Among them, the play preference information corresponding to a certain scenic spot node mainly depends on the historical average play duration of the scenic spot, the actual travel days of the user, and the number of all scenic spot nodes in the initial travel route.
[0107] During the actual travel process, in addition to the traffic time, the play time at each location will also affect the time to reach the next location. In order to reach each scenic spot node within the business hours of the scenic spot, three types of play preference information can be set for all scenic spot nodes, namely loose, normal, and compact. For example, the hotel node in the user's initial travel route is Hotel A, the scenic spot nodes include Scenic Spot B and Scenic Spot C, and the traffic itinerary nodes are D: Fly from Shanghai to Chengdu at 8:00 on March 10th, E: Fly from Chengdu to Shanghai at 15:00 on March 12th. It can be seen that the user only plays 2 scenic spots and the travel time is relatively loose. The play duration range of Scenic Spot B is about 2 - 4 hours, and the play duration range of Scenic Spot C is about 3 - 5 hours. Therefore, the play preference information for Scenic Spot A and Scenic Spot B can both be set to loose. The recommended play duration is determined as the stay duration by combining the play preference information and the play duration range, and the reachable time window corresponding to the scenic spot node is converted according to the business hours information and the stay duration, specifically from the opening time to the closing time of the scenic spot minus the stay duration.
[0108] If the distance between the hotel node and the scenic spot node is far, for example, exceeding a certain preset distance value, then when determining the play preference information corresponding to a certain scenic spot node, the distance between the hotel node and the scenic spot node should also be considered.
[0109] The traffic itinerary node has a departure time, an arrival time, and a means of transportation type. The time window from 1 - 2 hours before the departure time to the departure time is used as the reachable time window. Specifically, the reachable time window is determined according to the means of transportation type. For example, it is set that for a plane, the reachable time window is 2 hours before the departure time, and for a train, the reachable time window is 1 hour before the departure time. The stay duration is the duration calculated by subtracting the departure time from the arrival time.
[0110] For the hotel node, the reachable time window of the hotel can be set to be reachable throughout the day, and the stay duration is half an hour.
[0111] The above arrival time window and stay duration are only exemplary, and those skilled in the art can adjust them according to actual needs.
[0112] In an alternative embodiment, the preset optimization model includes an or-tools model.
[0113] Regarding the route nodes as multiple points to be visited, the traveler (i.e., the user) needs to visit all the points in sequence with the shortest distance. The tourism route optimization problem can also be converted into an integer programming problem. Define c ij as the distance from the point i to be visited to the point j to be visited, and n as the total number of visited points. Then the decision variable x ij indicates whether the route reaches from point i to point j. If it passes, the value of x ij is 1, otherwise it is 0. The objective function of the programming problem is the shortest distance, which can be specifically described as:
[0114] ;
[0115] Each point is visited only once, which can be converted into a constraint condition:
[0116] ;
[0117] ;
[0118] There are currently various mature algorithms for solving the above integer programming problem. Among them, those that can solve the exact solution include dynamic programming, etc., as well as some intelligent algorithms for solving approximate solutions. The present disclosure uses or-tools as a solver (i.e., the aforementioned preset optimization model) to solve this problem. When the number of input nodes is small, the optimal solution can be quickly obtained.
[0119] Since or-tools cannot separately specify the playing duration of each location, the playing duration is added to the traffic time matrix and input into or-tools. The time to reach each location is the time to reach the previous location plus the playing duration of this location and the traffic duration of the next leg, and it can be used to determine whether it is within the business hours when reaching each location.
[0120] According to the business hours information, the recommended playing duration information, and the traffic time matrix, the access route with the shortest total duration for accessing during the business hours of each scenic spot can be solved.
[0121] In an alternative embodiment, as Figure 5 shown, the above step S2 includes:
[0122] S21. Obtain the longitude and latitude data of the departure and arrival locations corresponding to each route node.
[0123] S22. Calculate the distance values between each starting point (a route node) and each destination (other route nodes within the initial route) based on the latitude and longitude data.
[0124] S23. Aggregate the distance values to obtain the traffic distance matrix.
[0125] The goal of route optimization is to minimize the travel distance. Therefore, it is necessary to obtain the pairwise distances between each pair of route nodes to get the distance values between any two route nodes.
[0126] Specifically, the distance value is calculated based on the latitude and longitude between two nodes using the spherical distance formula, and finally the distance values are aggregated to obtain the traffic distance matrix.
[0127] Each route node has corresponding latitude and longitude. In particular, a traffic itinerary node includes a starting point and a destination, so there will be the latitudes and longitudes of two different locations. For unified calculation, the latitudes and longitudes of the starting point and destination of the hotel node and the scenic spot node are set to the latitudes and longitudes of the locations of the hotel node and the scenic spot node themselves, which are the same latitude and longitude.
[0128] The following further illustrates the present disclosure in combination with a special tourism scenario:
[0129] Scenario 1: Round-trip traffic scenario
[0130] A common scenario in travel is a one-day round trip to a certain destination. If there is no fixed starting point and ending point, since the destination of the departure traffic node and the starting point of the return traffic node of the round-trip traffic itinerary node are the same, or-tools will arrange the round-trip traffic itinerary node to be visited consecutively for a shorter total duration. Therefore, it is necessary to first identify whether the initial travel route contains round-trip traffic nodes. If so, set the starting point of the departure traffic node as the starting access point of or-tools, and the destination of the return traffic node as the final access point of or-tools.
[0131] Specifically, first, it is determined whether the route contains two transportation itinerary nodes, and then it is determined whether these two transportation itinerary nodes are round-trip transportation. For the departure place A1 and the arrival place A2 of the transportation itinerary node A, and the departure place B3 and the arrival place B4 of the transportation itinerary node B, the distance between A1 and A2 is calculated as D12, the distance between B3 and B4 is calculated as D34, the distance between A2 and B3 is calculated as D23, and the distance between B4 and A1 is calculated as D41. It is judged whether the average value of D12 and D34 is greater than the sum of D23 and D41. If it is greater, and the sum of D23 and D41 is less than 100 km, then these two transportation itinerary nodes are round-trip transportation itinerary nodes, that is, A1 is the same as B4, and A2 is the same as B3. For the travel route containing round-trip transportation itinerary nodes, the departure place of the departure transportation node is set as the starting route point, and the return transportation node is set as the ending route point.
[0132] Scenario 2: Round-trip hotel scenario
[0133] When traveling in a different place, it is also a common solution to go to the hotel first when arriving at the destination, then play, and then return to the hotel (i.e., round-trip hotel nodes). However, data nodes with the same longitude and latitude will also be arranged by the solver to be accessed consecutively. To handle this situation, the present disclosure adopts a secondary optimization method. If it is recognized that the input initial travel route has a departure transportation node and there are two identical hotel nodes at the arrival place of the departure transportation node, then secondary optimization is performed. Among them, in the initial optimization, the hotel node is set as the ending route point, and a virtual point is added as the starting route point. Specifically, the added virtual point has the same data structure as the real route nodes in the initial travel route, but its longitude and latitude are set to -1, the reachable time window is the whole day, the stay duration is 15 minutes, and the duration from the virtual point to any route node in the route is set to 15 minutes. Since the virtual point is used as a fixed starting point, there will be no route node in the route that reaches the virtual point. However, for the structural integrity of the traffic time matrix, the duration from any point in the route to the virtual point can be set to 999 minutes. According to the above settings, the corresponding rows and columns are added to the traffic time matrix, and then the traffic time matrix is adjusted to obtain an optimized traffic time matrix.
[0134] After obtaining the initial optimization result through the preset optimization model, the route nodes before the departure transportation node remain unchanged, and the route nodes after the departure transportation node are optimized for the second time. Also, both the starting route point and the ending route point input to the solver are set as the hotel node. For example, the initial travel route entered by the user is scenic spot node A in Shanghai, scenic spot node B in Shanghai, transportation node C from Shanghai to Chengdu, hotel node D1 in Chengdu, scenic spot nodes E and F in Chengdu, and hotel node D2 in Chengdu. Here, nodes D1 and D2 represent the same hotel. During the initial optimization, a virtual point Z is added as the starting route point, and D2 is used as the ending route point. The reachable time window of the route nodes, the stay duration of the route nodes, and the optimized traffic time matrix are input into or-tools to obtain the optimization result as the initial optimization result Z->B->A->C->E->F->D1->D2. Keep the part of the route Z->B->A->C unchanged, and use E->F->D1->D2 as the travel route to be optimized for the second time. Here, D1 is used as the starting route point, and D2 is used as the ending route point. The time window of these route nodes and the optimized traffic time matrix are input into or-tools to obtain the second optimization result. Combine the initial optimization result and the second optimization result to obtain the optimized travel route.
[0135] Scenario 3: No traffic scenario.
[0136] When the travel route for a single day has no transportation itinerary nodes but includes scenic spot nodes and a hotel node, usually the hotel node serves as the accommodation point for that day. Therefore, the location of the hotel node is used as the fixed ending route point, and a virtual point is added as the starting route point. Specifically, the method of adding a virtual point as the starting route point is the same as in Scenario 2.
[0137] Scenario 4: Conventional traffic scenario
[0138] Scenarios other than the round-trip transportation scenario, the round-trip hotel scenario, and the no-traffic scenario can all be referred to as the conventional traffic scenario.
[0139] In order to optimize all route nodes in all routes, a virtual point is added as the starting route point for other scenarios, and a virtual point is added as the ending route point. Specifically, the added virtual points maintain the same data structure as the real route nodes in the initial tourist route, but their longitude and latitude are set to -1, the reachable time window is the whole day, and the stay duration is 15 minutes. Among them, for the virtual starting route point, the duration from the virtual starting route point to any route node in the departure and arrival route is set to 15 minutes, and the duration from any route node in the route to the starting route point is set to 999 minutes. For the virtual ending route point, the duration from any point in the route to the virtual ending route point is set to 15 minutes, and the duration from the virtual ending route point to any point in the departure and arrival route is set to 999 minutes. According to the above settings, corresponding rows and columns are added to the traffic time matrix, and then the traffic time matrix is adjusted to obtain an optimized traffic time matrix.
[0140] Embodiment 2
[0141] This embodiment provides a tourist route optimization system, as Figure 6 shown, the tourist route optimization system includes:
[0142] An initial route acquisition module 1, configured to acquire route nodes corresponding to a user's initial tourist route;
[0143] Among them, the route nodes include scenic spot nodes, hotel nodes, and traffic itinerary nodes;
[0144] A distance matrix acquisition module 2, configured to perform data processing operations on the route nodes to obtain a traffic distance matrix corresponding to the route nodes;
[0145] An initial matrix acquisition module 3, configured to obtain an initial traffic time matrix corresponding to the route nodes based on the traffic distance matrix;
[0146] A matrix optimization module 4, configured to obtain a travel scenario corresponding to the initial tourist route, and adjust the initial traffic time matrix based on the travel scenario to obtain an optimized traffic time matrix;
[0147] A route optimization module 5, configured to optimize the initial tourist route based on the route nodes and the optimized traffic time matrix to obtain an optimized tourist route corresponding to the initial tourist route;
[0148] Among them, the optimized tourist route represents a tourist route with the shortest total duration of playing within the business hours of each scenic spot node.
[0149] In an optional implementation manner, the initial matrix acquisition module 3 includes:
[0150] A historical data acquisition unit 31, configured to acquire historical traffic data corresponding to any two route nodes;
[0151] An initial matrix obtaining unit 32, configured to obtain an initial traffic time matrix corresponding to route nodes based on historical traffic data and a traffic distance matrix;
[0152] Wherein, the historical traffic data includes historical traffic duration and / or historical traffic distance.
[0153] In an optional implementation manner, the matrix optimization module 4 includes:
[0154] A scenario obtaining unit 41, configured to obtain a preset route configuration adjustment rule and a travel scenario corresponding to an initial travel route;
[0155] A matrix optimization unit 42, configured to configure a starting route point and an ending route point corresponding to the initial travel route based on the preset route configuration adjustment rule corresponding to the travel scenario, and adjust the initial traffic time matrix based on the starting route point and the ending route point to obtain an optimized traffic time matrix;
[0156] Wherein, the travel scenario includes any one of a round-trip traffic scenario, a round-trip hotel scenario, a no-traffic scenario, and a regular traffic scenario.
[0157] In an optional implementation manner, the route optimization module 5 includes:
[0158] A node information obtaining unit 51, configured to obtain scenic spot information corresponding to scenic spot nodes and traffic itinerary information corresponding to traffic itinerary nodes;
[0159] Wherein, the scenic spot information includes business hours information, a range of playing durations, and playing preference information, and the traffic itinerary information includes a departure place, an arrival place, a departure time, an arrival time, and a transportation tool type;
[0160] A time window obtaining unit 52, configured to determine a scenic spot time window corresponding to the scenic spot node based on the scenic spot information, determine a traffic time window corresponding to the traffic itinerary node based on the traffic itinerary information, and obtain a hotel time window corresponding to the hotel node;
[0161] A route optimization unit 53, configured to input the scenic spot time window, the traffic time window, the hotel time window, and the optimized traffic time matrix into a preset optimization model, and output an optimized travel route.
[0162] In an optional implementation manner, the preset optimization model includes an or-tools model.
[0163] In an optional implementation manner, the distance matrix obtaining module 2 includes:
[0164] A latitude and longitude obtaining unit 21, configured to obtain latitude and longitude data of the departure place and the arrival place corresponding to each route node;
[0165] A distance value acquisition unit 22, configured to calculate, based on longitude and latitude data, distance values between each departure place when any route node is used as the departure place and other route nodes within the initial route when used as the arrival places;
[0166] A matrix acquisition unit 23, configured to summarize the distance values to obtain a traffic distance matrix.
[0167] In an optional implementation manner, the distance value acquisition unit is configured to calculate the longitude and latitude data through a spherical formula to obtain the distance value between any two route nodes.
[0168] The travel route optimization system of this embodiment obtains a unique traffic distance matrix corresponding to the route nodes by acquiring route nodes including multiple data types, and then obtains an initial traffic time matrix corresponding to the route nodes based on the traffic distance matrix, and optimizes the initial traffic time matrix according to the travel scenarios corresponding to the initial travel route to obtain an optimized traffic time matrix corresponding to the initial traffic time matrix. Furthermore, the initial travel route is optimized according to the route nodes and the optimized traffic time matrix. The optimized travel route represents the travel route with the shortest total duration for playing within the business hours of each scenic spot node, making the travel route planning more reasonable and closer to reality, meeting the diverse needs of users to balance time and distance, and improving the user experience.
[0169] The travel route optimization system of this embodiment corresponds to the travel route optimization method in Embodiment 1, and has the same working principle. The specific content will not be elaborated here.
[0170] For the system embodiment, since it basically corresponds to the method embodiment, the relevant parts can be referred to the partial description of the method embodiment. The system embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the present disclosure solution.
[0171] Embodiment 3
[0172] Figure 7 FIG. is a schematic structural diagram of an electronic device shown in an exemplary embodiment of the present disclosure. The electronic device includes a memory, a processor, and a computer program stored on the memory and configured to run on the processor. When the processor executes the computer program, it implements the travel route optimization method in Embodiment 1 above. Figure 7 The displayed electronic device 80 is only an example and should not bring any limitation to the functions and usage scope of the embodiments of the present disclosure.
[0173] As Figure 7 shown, the electronic device 80 may be presented in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 80 may include but are not limited to: at least one of the above-mentioned processors 81, at least one of the above-mentioned memories 82, and a bus 83 connecting different system components (including the memory 82 and the processor 81).
[0174] The bus 83 includes a data bus, an address bus, and a control bus.
[0175] The memory 82 may include volatile memory, such as random access memory (RAM) 821 and / or cache memory 822, and may further include read-only memory (ROM) 823.
[0176] The memory 82 may further include a program tool 825 (or utility) having a set (at least one) of program modules 824. Such program modules 824 include but are not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include the implementation of a network environment.
[0177] The processor 81 executes various functional applications and data processing by running computer programs stored in the memory 82, such as the travel route optimization method provided in the above-mentioned Embodiment 1.
[0178] The electronic device 80 may also communicate with one or more external devices 84 (such as a keyboard, a pointing device, etc.). Such communication may be carried out through an input / output (I / O) interface 85. And, the electronic device 80 may also communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 86. As shown in the figure, the network adapter 86 communicates with other modules of the electronic device 80 through the bus 83. It should be understood that although not shown in the figure, other hardware and / or software modules may be used in combination with the electronic device 80, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
[0179] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, such a division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more of the above-mentioned units / modules may be embodied in one unit / module. Conversely, the features and functions of one unit / module described above may be further divided and embodied by multiple units / modules.
[0180] Embodiment 4
[0181] An embodiment of the present disclosure also provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, it implements the travel route optimization method provided in Embodiment 1 above.
[0182] Among them, the readable storage medium can more specifically include but is not limited to: portable disks, hard disks, random access memories, read-only memories, erasable programmable read-only memories, optical storage devices, magnetic storage devices, or any suitable combination of the above.
[0183] Embodiment 5
[0184] An embodiment of the present disclosure also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the travel route optimization method in any one of the above Embodiment 1.
[0185] Among them, the program code for executing the computer program product of the present disclosure can be written in any combination of one or more programming languages. The program code can be completely executed on the user device, partially executed on the user device, executed as an independent software package, partially executed on the user device and partially executed on a remote device, or completely executed on a remote device.
[0186] Although the specific implementation manners of the present disclosure have been described above, those skilled in the art should understand that this is only an example. The protection scope of the present disclosure is defined by the appended claims. Without departing from the principles and essence of the present disclosure, those skilled in the art can make various changes or modifications to these implementation manners, but these changes and modifications all fall within the protection scope of the present disclosure.
Claims
1. A method for optimizing a travel route, characterized in that: The travel route optimization method comprises: Get the route node corresponding to the user's initial travel route; The route nodes include scenic spot nodes, hotel nodes and transportation itinerary nodes; Performing data processing operations on the route nodes to obtain a traffic distance matrix corresponding to the route nodes; Acquire the initial traffic time matrix corresponding to the route node based on the traffic distance matrix; Acquire a travel scenario corresponding to the initial travel route, and adjust the initial traffic time matrix based on the travel scenario to obtain an optimized traffic time matrix; Optimizing the initial travel route based on the route nodes and the optimized traffic time matrix to obtain an optimized travel route corresponding to the initial travel route; The optimized tourist route represents a tourist route with the shortest total playing time during the business hours of each scenic spot node.
2. The method for optimizing a travel route according to claim 1, characterized in that: The step of acquiring the initial traffic time matrix corresponding to the route node based on the traffic distance matrix comprises: Get the historical traffic data corresponding to any two route nodes; Obtaining an initial traffic time matrix corresponding to the route node based on the historical traffic data and the traffic distance matrix; The historical traffic data includes historical traffic duration and / or historical traffic distance.
3. The method for optimizing a travel route according to claim 1, characterized in that: The steps of obtaining the travel scenario corresponding to the initial travel route, adjusting the initial traffic time matrix based on the travel scenario, and obtaining the optimized traffic time matrix include: Obtaining preset route configuration adjustment rules and travel scenarios corresponding to the initial travel route; Based on the preset route configuration adjustment rule corresponding to the travel scenario, the starting route point and the ending route point corresponding to the initial travel route are configured, and based on the starting route point and the ending route point, the initial traffic time matrix is adjusted to obtain the optimized traffic time matrix; The travel scenario includes any one of a round-trip traffic scenario, a round-trip hotel scenario, a no-traffic scenario, and a regular traffic scenario.
4. The method for optimizing a travel route according to claim 1, characterized in that: The step of optimizing the initial tourist route based on the route nodes and the optimized traffic time matrix to obtain an optimized tourist route corresponding to the initial tourist route comprises: Acquire the scenic spot information corresponding to the scenic spot node and the transportation itinerary information corresponding to the transportation itinerary node; The scenic spot information includes business hours, play time range and play preference information, and the transportation itinerary information includes departure place, arrival place, departure time, arrival time and transportation type; Determine the scenic spot time window corresponding to the scenic spot node based on the scenic spot information, determine the transportation time window corresponding to the transportation itinerary node based on the transportation itinerary information, and obtain the hotel time window corresponding to the hotel node; Among them, the time window includes the reachable time window and the length of stay; The scenic spot time window, the traffic time window, the hotel time window and the optimized traffic time matrix are input into a preset optimization model, and the optimized travel route is obtained as output.
5. The method for optimizing a travel route according to claim 4, characterized in that: The preset optimization model includes an or-tools model.
6. The method for optimizing a travel route according to claim 1, characterized in that: The step of performing data processing operations on the route nodes to obtain the traffic distance matrix corresponding to the route nodes comprises: Get the latitude and longitude data of the departure and arrival points corresponding to each route node; Based on the latitude and longitude data, calculating the distance values between each departure point and each arrival point when any route node is used as a departure point and other route nodes in the initial route are used as arrival points; The distance values are aggregated to obtain the traffic distance matrix.
7. A travel route optimization system, characterized in that: The travel route optimization system comprises: The initial route acquisition module is used to obtain the route nodes corresponding to the user's initial travel route; The route nodes include scenic spot nodes, hotel nodes and transportation itinerary nodes; A distance matrix acquisition module is used to perform data processing operations on the route nodes to obtain the traffic distance matrix corresponding to the route nodes; An initial matrix acquisition module, used for acquiring an initial traffic time matrix corresponding to the route node based on the traffic distance matrix; A matrix optimization module, used to obtain the travel scenario corresponding to the initial travel route, and adjust the initial traffic time matrix based on the travel scenario to obtain an optimized traffic time matrix; A route optimization module, used to optimize the initial travel route based on the route nodes and the optimized traffic time matrix to obtain an optimized travel route corresponding to the initial travel route; The optimized tourist route represents a tourist route with the shortest total playing time during the business hours of each scenic spot node.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and used to run on the processor, characterized in that: When the processor executes the computer program, the travel route optimization method described in any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the travel route optimization method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the travel route optimization method according to any one of claims 1 to 6 is implemented.