Path determination method and device, storage medium and electronic equipment
By dividing cities into clusters and using iterative genetic algorithms to process access sequences, the problems of low path information accuracy and local optimal solutions in the prior art are solved, and accurate calculation and efficient solution of the global shortest path are achieved.
Patent Information
- Application Number
- CN202410990258.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-12
AI Technical Summary
In the case of large passenger numbers in the prior art, it is difficult to accurately determine the global shortest ride path, resulting in low accuracy of path information and may fall into a local optimal solution.
By dividing cities into clusters, local shortest path information is determined, and the iterative genetic algorithm is used to process the access order of urban clusters, ensuring that the genetic results meet preset constraints and gradually generate the global shortest path.
The accuracy and calculation efficiency of path information are improved, local optimal solutions are avoided, and the passenger's comprehensive shortest distance is no longer trapped in the local optimal solutions when converges.
Smart Images

Figure CN118940925A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a path determination method, device, storage medium and electronic device. Background Art
[0002] With the development of cloud computing and the continuous optimization of scheduling algorithms, the goal of determining the riding route is to minimize the driver's driving distance and time cost, improve vehicle utilization, and optimize passenger waiting time and satisfaction while meeting the travel needs of passengers.
[0003] At present, the determination of the global shortest riding route is mainly achieved by establishing a task model in the form of a directed acyclic graph, where vertices represent tasks and task costs are edge lengths. Based on the multi-traveling salesman problem model, the shortest path information is obtained through a hybrid nonlinear integer programming solver.
[0004] However, using this path determination method will result in low accuracy of the determined shortest path information. In the case of a large number of passengers, the shortest path information may be local shortest path information rather than global shortest path information. Summary of the invention
[0005] In view of this, the present application provides a path determination method, device, storage medium and electronic device, the main purpose of which is to improve the technical problem that the current existing technology will result in low accuracy of the shortest path information determined, and when the number of passengers is large, it will also cause the shortest path information to be local shortest path information rather than global shortest path information.
[0006] In a first aspect, the present application provides a path determination method, comprising:
[0007] Obtaining ride information corresponding to a plurality of passengers, and determining a plurality of cities included in the ride information, wherein the plurality of cities include a ride starting city, a ride passing city, and a ride arrival city of each passenger;
[0008] Dividing the multiple cities into multiple city clusters, determining connection path information between the multiple city clusters and local shortest path information between cities included in each city cluster, wherein each city cluster includes cities less than or equal to a preset number of cities;
[0009] Based on the connection path information and the local shortest path information, determine a first access sequence of the multiple city clusters, and perform iterative genetic processing on the first access sequence, wherein, for each genetic processing process, if it is determined that the genetic result meets the preset constraint condition, perform the next genetic processing on the genetic result;
[0010] In response to determining that the target genetic result meets the preset convergence condition, the global shortest path information corresponding to the multiple passengers is generated according to the target access sequence corresponding to the target genetic result, the connection path information and the local shortest path information.
[0011] In a second aspect, the present application provides a path determination device, comprising:
[0012] An acquisition module is configured to acquire ride information corresponding to a plurality of passengers, and determine a plurality of cities included in the ride information, wherein the plurality of cities include a ride starting city, a ride passing city, and a ride arrival city of each passenger;
[0013] a determination module configured to divide the plurality of cities into a plurality of city clusters, determine connection path information between the plurality of city clusters and local shortest path information between cities included in each city cluster, wherein each city cluster includes cities less than or equal to a preset number of cities;
[0014] a processing module configured to determine a first access sequence of the plurality of city clusters based on the connection path information and the local shortest path information, and perform iterative genetic processing on the first access sequence, wherein, for each genetic processing process, when it is determined that the genetic result meets a preset constraint condition, the genetic result is subjected to the next genetic processing;
[0015] The generation module is configured to generate the global shortest path information corresponding to the multiple passengers according to the target access sequence corresponding to the target genetic result, the connection path information and the local shortest path information in response to judging that the target genetic result meets the preset convergence condition.
[0016] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the path determination method of the first aspect when the computer program is executed by a processor.
[0017] In a fourth aspect, the present application provides an electronic device, including a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, wherein the processor implements the path determination method of the first aspect when executing the computer program.
[0018] In a fifth aspect, the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the path determination method of the first aspect is implemented.
[0019] By means of the above technical scheme, the present application provides a path determination method, device, storage medium and electronic device, which obtains the riding information corresponding to multiple passengers, determines the multiple cities contained in the riding information, and the multiple cities include the starting city, the passing city and the arrival city of each passenger; divides the multiple cities into multiple city clusters, determines the connection path information between the multiple city clusters and the local shortest path information between the cities contained in each city cluster, wherein each city cluster contains cities less than or equal to the number of preset cities; based on the connection path information and the local shortest path information, determines the first access sequence of the multiple city clusters, and iterates the first access sequence for genetic processing, wherein for each genetic processing process, when it is judged that the genetic result meets the preset constraint condition, the genetic result is subjected to the next genetic processing; in response to judging that the target genetic result meets the preset convergence condition, the global shortest path information corresponding to the multiple passengers is generated according to the target access sequence corresponding to the target genetic result, the connection path information and the local shortest path information. Compared with the current prior art, this embodiment determines the local shortest path between the cities in each cluster. Then, the first access sequence is determined based on the local shortest path information and the connection path information between clusters, and the first access sequence is iterated by genetic processing. During each genetic processing, it is necessary to determine whether the genetic result is feasible by judging whether the genetic result meets the preset constraints. That is, the dynamic solution process is perceived to correct whether the taxi route plan is feasible. If feasible, the next genetic processing is performed until the comprehensive shortest distance from the starting point to the destination of each passenger is no longer converged. This can not only ensure faster convergence and shorter time to calculate the shortest path, but also avoid falling into the local optimal solution.
[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0022] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0023] Figure 1A schematic diagram of a process flow of a path determination method provided in an embodiment of the present application is shown;
[0024] Figure 2 A schematic diagram of a process flow of a path determination method provided in an embodiment of the present application is shown;
[0025] Figure 3 A schematic diagram showing an example provided by an embodiment of the present application;
[0026] Figure 4 A schematic diagram showing an example provided by an embodiment of the present application;
[0027] Figure 5 A schematic diagram showing an example provided by an embodiment of the present application;
[0028] Figure 6 A schematic diagram showing an example provided by an embodiment of the present application;
[0029] Figure 7 A schematic diagram showing an example provided by an embodiment of the present application;
[0030] Figure 8 A schematic diagram showing an example provided by an embodiment of the present application;
[0031] Fig. 9 A schematic diagram of the structure of a path determination device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0032] The embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that the embodiments and features in the embodiments of the present application can be combined with each other without conflict.
[0033] In order to improve the technical problem that the shortest path information determined by the existing technology is low in accuracy and, when the number of passengers is large, the shortest path information is local shortest path information instead of global shortest path information. This embodiment provides a path determination method, such as Figure 1 As shown, the method includes:
[0034] Step 101: Obtain travel information corresponding to multiple passengers, and determine multiple cities included in the travel information.
[0035] Among them, the multiple cities include each passenger's starting city, passing cities and arrival city.
[0036] In an embodiment of the present application, the riding information may include the passenger's starting location information, terminal location information, city location information that needs to be passed through, etc. Correspondingly, the multiple cities included in the riding information can be the passenger's starting city, the city that the ride passes through, and the city that the ride arrives at.
[0037] Step 102: Divide the multiple cities into multiple city clusters, determine the connection path information between the multiple city clusters and the local shortest path information between the cities included in each city cluster.
[0038] Each city cluster contains cities that are less than or equal to a preset number of cities.
[0039] In some examples, the connection path information may be connection path information between every two clusters, and correspondingly, the local shortest path information may be local shortest path information between cities included in each city cluster.
[0040] For example, if city A, city B, city C and city D are divided into cluster 1, city a, city b, city c and city d are divided into cluster 2, the connection path information is the connection path information between cluster 1 and cluster 2, and the local shortest path information is the shortest path information between city A, city B, city C and city D in cluster 1 and the shortest path information between city a, city b, city c and city d in cluster 2.
[0041] It should be noted that the number of preset cities can be set according to demand, and the number of preset cities needs to be kept within a certain range to ensure the calculation efficiency of the objective function in the passenger path optimization problem model. The specific value of the number of preset cities is not specifically limited in the embodiments of this application.
[0042] For this embodiment, the local shortest path information may be a local optimal solution (LocalOptimum) of the path information. The local optimal solution means that in the optimization problem, compared with other candidate solutions in a neighborhood in the problem definition domain, the current solution is the best, but it is not necessarily the global optimal solution in the entire problem definition domain. In other words, the local optimal solution is a solution that cannot be found better than it in a small range in the search space, but if it jumps out of this range, there may be a global optimal solution whose overall performance is better than the local optimal solution.
[0043] Step 103: Determine a first access sequence of multiple city clusters based on the connection path information and the local shortest path information, and perform iterative genetic processing on the first access sequence.
[0044] In each genetic processing process, when it is determined that the genetic result meets the preset constraint conditions, the genetic result is subjected to the next genetic processing.
[0045] For this embodiment, the first access sequence is the access sequence between multiple city clusters, and the iterative genetic processing can be iterative processing through a genetic algorithm. Specifically, the multiple traveling salesman problem (MTSP) is an extension of the traveling salesman problem (TSP), involving multiple traveling salesmen, each of which needs to visit a series of cities, and the goal is to determine the access sequence of each traveling salesman so that the sum of the total travel distances of all traveling salesmen is minimized. Compared with TSP, MTSP has higher complexity and a larger solution space. The basic process of using a genetic algorithm to solve MTSP is similar to TSP, but it is necessary to consider the collaborative work of multiple traveling salesmen, so there are differences in encoding, fitness function design and genetic operations: the encoding method is more complicated, because not only the access sequence of each city must be specified, but also the city must be assigned to different traveling salesmen. The possible methods include but are not limited to overall encoding (encoding the paths of all traveling salesmen at one time), group encoding (encoding each traveling salesman separately) or mixed encoding. In addition to calculating the total path length, it is also necessary to ensure that the load balance and path conflicts between each traveling salesman are not ensured. The fitness function may comprehensively consider the travel distance of each traveling salesman and the balance of the entire team. Selection: Based on the fitness function, multiple excellent "chromosomes" (i.e., a set of traveling salesmen's path solutions) are selected to enter the next generation population. In the crossover operation, it may involve the exchange of multiple traveling salesmen's paths or the reorganization of some paths to ensure that the offspring after the crossover still meets the constraint that each traveling salesman only visits each city once. Mutation may include exchanging the positions of cities on a single traveling salesman's path or reallocating cities to different traveling salesmen, while keeping the constraints of the problem unchanged. Continuously perform selection, crossover, and mutation operations to update the population until the preset number of iterations is reached or a sufficiently high-quality solution is found.
[0046] In an embodiment of the present application, the preset constraint condition is a constraint condition determined based on the connection path information and the local shortest path information.
[0047] It should be noted that, in the process of iterative genetic processing, it is necessary to ensure that the offspring obtained by genetic processing meet the preset constraints after each genetic processing before the next genetic processing can be carried out.
[0048] Step 104, in response to determining that the target genetic result meets the preset convergence condition, generating global shortest path information corresponding to multiple passengers according to the target access sequence, connection path information and local shortest path information corresponding to the target genetic result.
[0049] In the embodiment of the present application, the global shortest path information may be the global optimal solution (GlobalOptimum) of the path information. The global optimal solution refers to the solution with the best performance found in the optimization problem relative to the entire solution space of the problem. In other words, the global optimal solution is the solution that satisfies the problem constraints and maximizes (for maximization problems) or minimizes (for minimization problems) the objective function value among all possible solutions.
[0050] Compared with the current existing technology, this embodiment determines the local shortest path between cities in each cluster. Then, the first access sequence is determined based on the local shortest path information and the connection path information between clusters, and the first access sequence is iteratively genetically processed. In each genetic processing, it is necessary to determine whether the genetic result is feasible by judging whether the genetic result meets the preset constraints, that is, to correct the taxi route plan for the perception dynamic solution process. If it is feasible, the next genetic processing is performed until the comprehensive shortest distance from the starting point to the destination of each passenger is no longer converged, which can ensure faster convergence and shorter calculation time of the shortest path, and avoid falling into the local optimal solution.
[0051] In order to further illustrate the specific implementation process of the method of this embodiment, this embodiment provides the following Figure 2 The specific method shown includes:
[0052] Step 201: Obtain travel information corresponding to multiple passengers, and determine multiple cities included in the travel information.
[0053] Among them, the multiple cities include each passenger's starting city, passing cities and arrival city.
[0054] For example, if passenger A's travel information is from city A to city B via city C, the multiple cities corresponding to passenger A are city A, city B and city C; correspondingly, if passenger B's travel information is from city B to city D via city A and then to city E, the multiple cities corresponding to passenger B are city A, city B, city D and city E.
[0055] Step 202: Generate distance information between multiple cities based on the ride information.
[0056] Exemplarily, based on step 201, distance information between each of city A, city B, city C, city D and city E is obtained.
[0057] Step 203: divide the multiple cities into multiple city clusters, and determine the distance information between the multiple city clusters.
[0058] Exemplarily, city A, city B, city C, city D and city E are divided into multiple clusters. If city A, city B and city C are cluster 1, and city D and city E are cluster 2, the distance information between cluster 1 and cluster 2 is determined.
[0059] Step 204: Based on the distance information between the multiple cities and the distance information between the multiple city clusters, determine the connection path information between the multiple city clusters and the local shortest path information between the cities included in each city cluster.
[0060] Optionally, step 204 may specifically include: constructing a passenger path optimization problem model and an objective function corresponding to the passenger path optimization problem model based on distance information between multiple cities and distance information between multiple city clusters; solving a target city cluster among the multiple city clusters according to preset constraint information through the passenger path optimization problem model and the objective function to determine a second visit order between target cities in the target cluster, where the target city cluster is any one of the multiple city clusters; iteratively genetically processing the second visit order to obtain a target visit order between target cities; and generating target local shortest path information between the target cities in the target city cluster according to the target visit order.
[0061] The objective function is used to determine the shortest path information of multiple passengers, and the target cities are all cities in the target city cluster.
[0062] In some examples, the passenger path optimization problem model usually refers to planning the optimal path from the starting point to the end point for passengers in a public transportation system, a shared travel platform or similar scenarios to meet the travel needs of passengers while maximizing system efficiency, reducing costs or improving passenger satisfaction. The key elements involved in this problem model include: Passenger demand: including the passenger's starting point, end point, travel time, travel preferences (such as shortest time, least transfers, lowest cost, etc.) and possible constraints (such as time windows, accessibility requirements, etc.). Transportation network: describes the transportation modes (such as buses, subways, taxis, shared bicycles, etc.) available to passengers, routes, stations, schedules, fares, transfer rules and other information, which constitute the spatial and temporal background of passenger path planning. Optimization objectives: can be a single objective (such as shortest time, lowest cost) or multiple objectives (such as comprehensive consideration of time, cost, comfort, number of transfers, etc.), which needs to be set according to passenger demand and system operation objectives. Decision variables: mainly include the transportation mode selected by the passenger, the starting station, the destination station, the transfer point, the ride time, the transfer time, etc. Constraints: such as the travel time window of passengers, the operating hours of different modes of transportation, transfer rules (such as the minimum transfer interval, the longest waiting time, etc.), the accessibility requirements of passengers, etc. Based on the above factors, the passenger path optimization problem model can be expressed as a mathematical programming problem, such as integer linear programming (ILP), dynamic programming (DP), shortest path problem (such as Dijkstra algorithm, A* algorithm), etc., or it can be solved by heuristic search algorithms (such as genetic algorithms, simulated annealing, ant colony algorithms, etc.) or machine learning methods (such as reinforcement learning, deep learning). The solution process usually involves constructing a traffic network diagram, defining optimization objectives and constraints, selecting appropriate algorithms for path search and optimization, and finally outputting the optimal or approximately optimal path recommendations that meet passenger needs and system constraints.
[0063] For this embodiment, the second access sequence is the access sequence of cities in each cluster. The iterative genetic processing of the second access sequence is mainly carried out through the genetic algorithm of the Traveling Salesman Problem (TSP). TSP is a classic combinatorial optimization problem. The goal is to find the shortest possible path so that the traveling salesman can traverse all given cities and finally return to the starting point, while minimizing the total travel distance as much as possible. Genetic Algorithm (GA) is a heuristic global optimization search algorithm that draws on the ideas of biological evolution, such as natural selection, inheritance, mutation and other principles to solve such complex optimization problems. When solving the TSP problem, the basic steps of the genetic algorithm include: encoding each possible route into a chromosome (Chromosome), that is, a string or array representing the order of city visits. Create a population (Population) containing multiple chromosomes (i.e., initial routes), each chromosome represents a possible solution. Calculate the fitness function value for each chromosome, which is usually a function based on the corresponding route length (i.e., total travel distance), and the shorter the route, the higher the fitness. Select excellent chromosomes based on the fitness function value to enter the next generation population. By simulating the genetic process of the biological world, crossover operations are performed on the selected chromosomes to generate new offspring chromosomes, which may inherit the good characteristics of the parent generation. Random mutations are performed on some offspring chromosomes to introduce new search spaces to prevent the algorithm from converging to the local optimal solution too early. The above process is repeated to generate a new generation of populations until the preset number of iterations is reached or a solution that meets the termination conditions is found.
[0064] For example, the starting point information of the target customer, the information between the city clusters, and the distance information between the cities are obtained, and the passenger path optimization problem model is constructed based on this information. Specifically, the task of the vehicle from the starting point to the end point is first regarded as the final goal, and each vertex is regarded as a city, represented by V, where V = {1,2,...,n} represents the city set, and the distance between the vertices is represented by an edge as E, and each edge (i,j) in E is associated with a non-negative real number d ij , represents the distance between city i and city j, and uses a completely undirected graph G = (V, E) and m passengers to represent the vertex set, where Vi is the departure vertex of passenger i. Given a subset Define the weight of E' as the sum of the shortest distances of a certain passenger. The requirement of the problem is to design a path for each passenger so that the distance from the starting point to the end point of all passengers is the shortest. The goal is to solve the shortest riding path.
[0065] Furthermore, based on the multi-traveling salesman problem model and the vehicle path planning problem model, an objective function of minimizing the total mileage is proposed; the multi-traveling salesman problem model includes at least flow constraints and traversal uniqueness constraints, and minZ represents the minimization of the total mileage; the starting and departure position constraints, passenger pick-up and drop-off sequence constraints, vehicle route rule constraints, and multi-point time constraints based on the constraints of the shortest distance of the total mileage are constructed; through x ijk It indicates that the passenger numbered k performs tasks Vi and Vj and passes through the corresponding path to represent the matching relationship between the pick-up task and the passenger, as shown in the following formula 1:
[0066]
[0067] In formula 1, x ijk is a three-dimensional Boolean optimization variable, and k is the set of all passengers.
[0068] Due to d ij represents the execution cost between task Pi and task Pj, then x ijk *d ij It can be used as the execution cost of the passenger to perform tasks Pi and Pj, and the objective function is to minimize the total mileage, and the constraint conditions shown in the following formula 2 can be obtained. The specific formula 2 is as follows:
[0069]
[0070] The starting station constraint is to ensure that each vehicle departs from the passenger's starting station, and the vehicle leaving the starting station must go to perform one of the k tasks in the passenger pickup task set, as shown in the following formula 3:
[0071]
[0072] The terminal station constraint is to ensure that each vehicle stops at the passenger's terminal point, and the vehicle leaving the starting station must go to perform one of the k tasks in the passenger drop-off task set, as shown in the following formula 4:
[0073]
[0074] The point set traversal uniqueness constraint is set to a city that can only be passed once, as shown in the following formulas 5 and 6:
[0075]
[0076] To ensure that the node has an out-degree, all the cities it passes through have an out-degree, as shown in Formula 7 below:
[0077]
[0078] To ensure that a city has in-degree, the cities it passes through have in-degree, as shown in the following formula 8:
[0079]
[0080] In the process of finding the shortest path, constraints are required to eliminate the impact of the loop, as shown in the following formula 9:
[0081]
[0082] It should be noted that the objective function (Formula 1) and the constraint condition (Formula 2) ensure the Min type target, the constraints (Formula 3) and (Formula 4) ensure that each passenger starts from vertex i and eventually returns to vertex j, the constraints (Formula 5) and (Formula 6) ensure that each city is visited only once, the constraints (Formula 7) and (Formula 8) ensure the continuity of passenger visits, and Formula 9 is the sub-tour elimination constraint.
[0083] Furthermore, in the first stage of the genetic algorithm, the TSP classic model is used to solve each passenger: for each passenger, a TSP problem is abstracted, and then a genetic algorithm for the TSP problem is applied to finally determine the order of visits from the starting point to the end point. The fitness function of the genetic algorithm in this stage is the inverse of the tour weight. In terms of genetic operators, selection, crossover and mutation operators are used. Specifically: the selection operator uses roulette selection, the crossover operator uses two strategies of partial matching crossover and sequential crossover with equal probability, and the mutation operator uses two strategies of exchange mutation and reversal mutation with equal probability. At the same time, the algorithm uses an elite retention strategy during the population iteration process.
[0084] In the embodiment of the present application, step 204 specifically further includes: determining the in-degree cities and out-degree cities of the multiple city clusters respectively according to the local shortest path information; and determining the connection path information between the multiple city clusters based on the in-degree cities and out-degree cities.
[0085] It should be noted that an in-degree city is a city that enters its city cluster, and an out-degree city is a city that leaves its cluster. For example, if the local shortest path information of the cities in cluster 1 is from city A to city B to city C to city D, then city A can be used as an in-degree city or an out-degree city of cluster 1, and city D can also be used as an in-degree city or an out-degree city of cluster 1.
[0086] For example, in the second stage, each passenger's access path is first regarded as a node. By combining the results of the first stage and integrating the ideas of greed and randomness, the distance between each two nodes is defined, and then an MTSP problem is abstracted. Then, a genetic algorithm for the MTSP problem is applied, and finally the comprehensive shortest distance from each passenger's starting point to the destination is calculated.
[0087] Each city subgroup is regarded as a node, and the node number corresponds to the subgroup subscript. Next, the connection method between each two city subgroups is given, and then it is combined with the passenger distance calculation results in the first stage to give the distance between each two city subgroups, and finally an MTSP problem is abstracted. By solving the MTSP problem, the comprehensive shortest distance from the starting point to the destination of each passenger in the MMCTSP problem is given.
[0088] Connection selection between cities: In order to enrich the connection methods between passengers and obtain a variety of feasible solutions, two access strategies are adopted based on the TSP tour corresponding to each city set and are executed with equal probability. Figure 3 and Figure 4 As shown, given the starting city A of the pre-order city set 1, the following uses Figure 3 and Figure 4 Explain how to apply these two visit strategies to determine the cities that leave the cluster:
[0089] The first strategy is to take A as the in-degree city and select the city with the shortest distance to the subsequent city subgroup 2 as the city leaving the city subgroup. Figure 3 In the example, the distance from D to city subgroup 2 is the shortest, so D is selected as the city leaving city subgroup 1, and the order of visiting cities in this city subgroup is A→B→C→D. The second strategy is to select D as the in-degree city in Figure 4 In the figure, A is selected as the city leaving city subgroup 1, so the order in which passengers traverse cities in this city subgroup is D→C→B→A.
[0090] Step 205: Determine a first access sequence of multiple city clusters based on the connection path information and the local shortest path information, and perform iterative genetic processing on the first access sequence.
[0091] In each genetic processing process, when it is determined that the genetic result meets the preset constraint conditions, the genetic result is subjected to the next genetic processing.
[0092] Optionally, step 205 may specifically include: in each genetic processing process, using the offspring access sequence generated by the previous genetic processing as the parent access sequence of the current genetic processing; performing genetic processing on the parent access sequence of the current genetic processing to obtain multiple offspring access sequences of the current genetic processing; based on preset constraints, analyzing the multiple offspring access sequences of the current genetic processing; if it is determined that the multiple offspring access sequences of the current genetic processing meet the preset constraints, then performing genetic processing on the multiple offspring access sequences of the current genetic processing respectively to obtain multiple parent access sequences for the next genetic processing.
[0093] In an embodiment of the present application, step 205 specifically also includes: if it is determined that the target child access sequence among the multiple child access sequences of the current genetic processing violates the preset constraints, the target child access sequence is deleted from the multiple child access sequences; if it is determined that the multiple child access sequences of the current genetic processing all violate the preset constraints, the current genetic processing process is rolled back and the parent access sequence of the current genetic processing is updated.
[0094] As an example, the following is a specific implementation process of using genetic algorithms to solve the problem of the shortest distance from each passenger's starting point to their destination. Since the objective function of the problem studied in this paper is of Min type, compared with traditional genetic algorithms, group genetic algorithms have better advantages in solving this type of problem.
[0095] Furthermore, the passenger paths are chromosomally encoded, and natural number encoding is also used in this stage. The total number of chromosome genes is the number of all city subgroups, and each gene represents a city subgroup. All genes (city subgroups) are divided into m groups, and each group of genes (city subgroups) determines the assigned pick-up of city subgroups and the order of visits between city subgroups. The weight of each group of genes corresponding to the tour is calculated, and the genomes are sorted from small to large according to the weight value.
[0096] Correspondingly, the execution process of the city cluster crossover operator may include: generating genomes (city subgroups) one by one from left to right in an iterative manner until m are constructed. When calculating the genome (city subgroup) at the i-th position, first generate a random number, select the genome at the i-th position of the first parent, and the generated child is Pchild; in this way, the feasibility of the judgment method when selecting the next city in the current task execution city during each process of determining the pick-up and drop-off of passengers can be calculated, and whether the conditional constraints are violated. If not, the optimal ride scheduling method is determined.
[0097] Furthermore, in order to improve the convergence accuracy of calculating the comprehensive shortest distance, the greedy strategy and the 2-opt strategy are randomly applied to insert unassigned cities into the calculated children. If the current task violates the conditional constraints, the executable passenger pick-up and drop-off tasks are reselected until the next selectable task is found; if all executable tasks violate the conditional constraints, the state rollback strategy is adopted to roll back the city visit state, and the executable task set is updated until the comprehensive shortest distance from each passenger's starting point to the destination is no longer converged.
[0098] The above two sections solve the comprehensive shortest distance plan from the starting point to the destination of each passenger. According to the characteristics of the problem, a two-stage solution method based on genetic algorithm is proposed. The first stage determines the visit order of each passenger by solving the abstract TSP problem, and the second stage determines the visit order between passengers by solving the abstract MTSP problem. For the abstract TSP problem and MTSP problem, this paper uses the method based on genetic algorithm to solve them respectively. In the simulation experiment, examples of various sizes are tested.
[0099] Step 206 , in response to determining that the target genetic result meets the preset convergence condition, generating global shortest path information corresponding to multiple passengers according to the target access sequence, connection path information and local shortest path information corresponding to the target genetic result.
[0100] To verify the effectiveness of the proposed solution, experiments were conducted on small, medium and large cities. In the small-scale city example, the best relative error GBest was used as the evaluation index, as shown in the following formula 10:
[0101]
[0102] In Formula 10, CBest represents the optimal value obtained by applying Cplex software, and IBest represents the best result obtained by applying the algorithm in this paper 10 times. The comparison results between the algorithm in this paper and Cplex software are shown in Figure 10. Figure 5 As shown, IAverage here represents the average value obtained by calculating 10 times by the algorithm in this paper.
[0103] like Figure 5 , Figure 6 and Figure 7 As shown in the figure, the experimental results of the following small-scale, medium-scale, and large-scale city examples are shown. In the small-scale city, the algorithm in this paper can obtain the accurate passenger comprehensive shortest distance results in a short time; in the calculation of medium- and large-scale cities, compared with the two comparison algorithms, in terms of calculation time, the time consumed by this scheme in all 8 examples is significantly less than the solution time of Cplex software, indicating that the solution efficiency of this scheme has obvious advantages. Figure 5 The solution for the small-scale urban agglomeration example is: Figure 6 The solution for the medium-sized urban agglomeration example is shown below. Figure 7 The results are obtained for a large-scale urban agglomeration example.
[0104] Compared with the current existing technology, this embodiment abstracts the access sequence within each city subset into a TSP problem on the corresponding subset, and then applies a genetic algorithm to solve it, and finds the local shortest path between cities in each cluster. Then, based on the local shortest path information and the connection path information between clusters, each city subset is regarded as a node to determine the first access sequence, and the first access sequence is iteratively genetically processed. In each genetic processing process, it is necessary to determine whether the genetic result is feasible by judging whether the genetic result meets the preset constraints, that is, to correct the taxi route plan by sensing the dynamic solution process. If it is feasible, the next genetic processing is performed. If all executable tasks violate the conditional constraints, the state rollback strategy is adopted to roll back the city access state, and the executable task set is updated until the comprehensive shortest distance from the starting point to the destination of each passenger is no longer converged, which can not only ensure faster convergence speed and shorter time to calculate the shortest path, but also avoid falling into the local optimal solution.
[0105] In order to illustrate the specific implementation process of this embodiment, the following specific application examples are given: Figure 8 As shown, but not limited to:
[0106] First of all, the task of driving the vehicle from the starting point to the end point is regarded as the final goal. Each vertex is regarded as a city, represented by V, and the distance between vertices is represented by edges as E. A completely undirected graph and passengers are used to represent the vertex set, where 1 is the common starting vertex of all passengers, and each vertex corresponds to a city. The vertex set is divided into subsets, each of which is associated with a non-negative real number, representing the distance between cities. Given a subset, the weight defined is the sum of the lengths of all edges in the subset. The requirement of the problem is to design a path for each passenger to solve the shortest ride path. It can not only ensure faster convergence and shorter calculation time of the shortest path, but also avoid falling into the local optimal solution.
[0107] Specifically, in the first stage, a TSP problem is abstracted for each passenger, and then a genetic algorithm for the TSP problem is applied to finally determine the order of visiting vertices in the urban area. In the second stage, each urban cluster is first regarded as a node. By combining the results of the first stage and integrating the ideas of greed and randomness, the distance between each two cities is defined, and then an MTSP problem is abstracted. Then a genetic algorithm for the MTSP problem is applied to finally determine the path from the urban cluster to the passenger and the shortest taxi distance for each passenger. The algorithm is then prevented from falling into a local optimal solution. In small-scale examples, compared with the exact results obtained by Cplex software, the best result obtained by the algorithm in this paper has a relative error of no more than 1.5%, but the solution time is significantly reduced; in medium-scale and large-scale examples, compared with the two two-stage solution strategies in the literature, the algorithm of the present invention shows good solution performance.
[0108] Compared with the current existing technology, this embodiment abstracts the access sequence within each city subset into a TSP problem on the corresponding subset, and then applies a genetic algorithm to solve it, and finds the local shortest path between cities in each cluster. Then, based on the local shortest path information and the connection path information between clusters, each city subset is regarded as a node to determine the first access sequence, and the first access sequence is iteratively genetically processed. In each genetic processing process, it is necessary to determine whether the genetic result is feasible by judging whether the genetic result meets the preset constraints, that is, to correct the taxi route plan by sensing the dynamic solution process. If it is feasible, the next genetic processing is performed. If all executable tasks violate the conditional constraints, the state rollback strategy is adopted to roll back the city access state, and the executable task set is updated until the comprehensive shortest distance from the starting point to the destination of each passenger is no longer converged, which can not only ensure faster convergence speed and shorter time to calculate the shortest path, but also avoid falling into the local optimal solution.
[0109] Further, as Figure 1 and Figure 2 The specific implementation of the method shown in the embodiment provides a path determination device, such as Fig. 9 As shown, the device includes: an acquisition module 31, a determination module 32, a processing module 33, and a generation module 34.
[0110] The acquisition module 31 is configured to acquire the ride information corresponding to the plurality of passengers, and determine the plurality of cities included in the ride information, wherein the plurality of cities include the ride starting city, the ride passing city and the ride arrival city of each passenger;
[0111] A determination module 32 is configured to divide the plurality of cities into a plurality of city clusters, determine connection path information between the plurality of city clusters and local shortest path information between cities included in each city cluster, wherein each city cluster includes cities less than or equal to a preset number of cities;
[0112] The processing module 33 is configured to determine a first access sequence of the plurality of city clusters based on the connection path information and the local shortest path information, and perform iterative genetic processing on the first access sequence, wherein, for each genetic processing process, when it is determined that the genetic result meets the preset constraint condition, the genetic result is subjected to the next genetic processing;
[0113] The generation module 34 is configured to generate the global shortest path information corresponding to the multiple passengers based on the target access sequence corresponding to the target genetic result, the connection path information and the local shortest path information in response to judging that the target genetic result meets the preset convergence condition.
[0114] In some examples of this embodiment, the determination module 32 is further configured to generate distance information between the multiple cities based on the riding information; accordingly, the determination module 32 is specifically configured to divide the multiple cities into multiple city clusters, and determine the distance information between the multiple city clusters; based on the distance information between the multiple cities and the distance information between the multiple city clusters, determine the connection path information between the multiple city clusters and the local shortest path information between the cities included in each city cluster.
[0115] In some examples of this embodiment, the determination module 32 is further specifically configured to construct a passenger path optimization problem model and an objective function corresponding to the passenger path optimization problem model based on the distance information between the multiple cities and the distance information between the multiple city clusters, and the objective function is used to determine the shortest path information of the multiple passengers; for a target city cluster among the multiple city clusters, according to the preset constraint information, the passenger path optimization problem model and the objective function are solved to determine a second access order between target cities in the target cluster, the target city cluster is any one of the multiple city clusters, and the target city is all cities in the target city cluster; the second access order is iteratively genetically processed to obtain a target access order between the target cities; according to the target access order, the target local shortest path information between the target cities in the target city cluster is generated.
[0116] In some examples of this embodiment, the determination module 32 is further specifically configured to determine the in-degree cities and out-degree cities of the multiple city clusters respectively according to the local shortest path information; and determine the connection path information between the multiple city clusters based on the in-degree cities and the out-degree cities.
[0117] In some examples of the present embodiment, the processing module 33 is specifically configured to, during each genetic processing, use the offspring access sequence generated by the previous genetic processing as the parent access sequence of the current genetic processing; perform genetic processing on the parent access sequence of the current genetic processing to obtain multiple offspring access sequences of the current genetic processing; analyze the multiple offspring access sequences of the current genetic processing based on the preset constraints; if it is determined that the multiple offspring access sequences of the current genetic processing meet the preset constraints, then perform genetic processing on the multiple offspring access sequences of the current genetic processing respectively to obtain multiple parent access sequences for the next genetic processing.
[0118] In some examples of the present embodiment, the processing module 33 is further specifically configured to delete the target child access sequence in the multiple child access sequences if it is determined that the target child access sequence in the multiple child access sequences of the current genetic processing violates the preset constraints; if it is determined that the multiple child access sequences of the current genetic processing all violate the preset constraints, then roll back the current genetic processing process and update the parent access sequence of the current genetic processing.
[0119] It should be noted that for other corresponding descriptions of the functional units involved in the path determination device provided in this embodiment, reference can be made to Figure 1 and Figure 2 The corresponding description in will not be repeated here.
[0120] Based on the above Figure 1 to Figure 2 The method shown in the embodiment also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the above-mentioned Figure 1 to Figure 2 The method shown.
[0121] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, USB flash drive, mobile hard disk, etc.), including a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods of various implementation scenarios of the present application.
[0122] Based on the above Figure 1 to Figure 2 The method shown, and Fig. 9 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides an electronic device, such as a personal computer, a server, a laptop computer, a smart phone, an intelligent robot or other intelligent terminal, which includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1 to Figure 2 The method shown.
[0123] Optionally, the above-mentioned physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0124] Those skilled in the art will appreciate that the above-mentioned physical device structure provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different arrangements of components.
[0125] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the above-mentioned physical device, and supports the operation of the information processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing physical device.
[0126] Based on the above Figure 1 to Figure 2 The present application also provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the above-mentioned Figure 1 to Figure 2 The method shown, the method implemented when the computer program is executed by the processor can refer to the various embodiments of the present application, and will not be described in detail here.
[0127] Through the description of the above implementation methods, the technicians in this field can clearly understand that the present application can be implemented by means of software plus necessary general hardware platforms, or by hardware. Compared with the current prior art, the present embodiment abstracts the access order within each city subset into a TSP problem on the corresponding subset, and then applies a genetic algorithm to solve it, and finds the local shortest path between cities in each cluster. Then, based on the local shortest path information and the connection path information between clusters, each city subset is regarded as a node to determine the first access order, and the first access order is iteratively genetically processed. In the process of each genetic processing, it is necessary to determine whether the genetic result is feasible by judging whether the genetic result meets the preset constraint conditions, that is, to perceive the dynamic solution process to correct whether the taxi route plan is feasible. If feasible, the next genetic processing is performed. If all executable tasks violate the conditional constraints, the state rollback strategy is adopted to roll back the city access state, and the executable task set is updated until the comprehensive shortest distance from the starting point to the destination of each passenger is no longer converged, which can not only ensure faster convergence speed and shorter calculation time of the shortest path, but also avoid falling into the local optimal solution.
[0128] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0129] The above is only a specific implementation of the present application, so that those skilled in the art can understand or implement the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features applied for herein.
Claims
1. A path determination method, It is characterized in that include: Obtaining ride information corresponding to a plurality of passengers, and determining a plurality of cities included in the ride information, wherein the plurality of cities include a ride starting city, a ride passing city, and a ride arrival city of each passenger; Dividing the multiple cities into multiple city clusters, determining connection path information between the multiple city clusters and local shortest path information between cities included in each city cluster, wherein each city cluster includes cities less than or equal to a preset number of cities; Based on the connection path information and the local shortest path information, determine a first access sequence of the multiple city clusters, and perform iterative genetic processing on the first access sequence, wherein, for each genetic processing process, if it is determined that the genetic result meets the preset constraint condition, perform the next genetic processing on the genetic result; In response to determining that the target genetic result meets the preset convergence condition, the global shortest path information corresponding to the multiple passengers is generated according to the target access sequence corresponding to the target genetic result, the connection path information and the local shortest path information.
2. The method according to claim 1, It is characterized in that Before dividing the plurality of cities into a plurality of city clusters and determining connection path information between the plurality of city clusters and local shortest path information between cities included in each city cluster, the method further includes: generating distance information between the plurality of cities according to the riding information; The step of dividing the plurality of cities into a plurality of city clusters and determining connection path information between the plurality of city clusters and local shortest path information between cities included in each city cluster includes: Dividing the multiple cities into multiple city clusters, and determining distance information between the multiple city clusters; Based on the distance information between the multiple cities and the distance information between the multiple city clusters, the connection path information between the multiple city clusters and the local shortest path information between the cities included in each city cluster are determined.
3. The method according to claim 2, It is characterized in that The determining, based on the distance information between the multiple cities and the distance information between the multiple city clusters, the connection path information between the multiple city clusters and the local shortest path information between the cities included in each city cluster includes: Based on the distance information between the multiple cities and the distance information between the multiple city clusters, construct a passenger path optimization problem model and an objective function corresponding to the passenger path optimization problem model, wherein the objective function is used to determine the shortest path information of the multiple passengers; For a target city cluster among the multiple city clusters, solving the passenger path optimization problem model and the objective function according to the preset constraint information to determine a second visit order between target cities in the target cluster, wherein the target city cluster is any one of the multiple city clusters, and the target cities are all cities in the target city cluster; Performing iterative genetic processing on the second access sequence to obtain a target access sequence between the target cities; According to the target access sequence, target local shortest path information between the target cities in the target city cluster is generated.
4. The method according to claim 3, It is characterized in that The method further comprises: Determining in-degree cities and out-degree cities of the plurality of city clusters respectively according to the local shortest path information; Based on the in-degree cities and the out-degree cities, connection path information between the plurality of city clusters is determined.
5. The method according to claim 1, It is characterized in that The determining, based on the connection path information and the local shortest path information, a first access sequence of the plurality of city clusters, and performing iterative genetic processing on the first access sequence comprises: In each genetic processing, the offspring access order generated by the previous genetic processing is used as the parent access order of the current genetic processing; Performing hereditary processing on the parent access sequence of the current hereditary processing to obtain multiple child access sequences of the current hereditary processing; Based on the preset constraint condition, analyzing the access order of multiple offsprings of the current genetic process; If it is determined that the multiple offspring access sequences of the current genetic processing meet the preset constraint conditions, the multiple offspring access sequences of the current genetic processing are genetically processed respectively to obtain multiple parent access sequences for the next genetic processing.
6. The method according to claim 5, It is characterized in that After analyzing the offspring access sequence of the current genetic processing based on the preset constraint condition, the method further includes: If it is determined that the target child access sequence in the multiple child access sequences of the current genetic processing violates the preset constraint condition, the target child access sequence is deleted from the multiple child access sequences; If it is determined that the multiple child access sequences of the current genetic processing violate the preset constraint conditions, the current genetic processing process is rolled back and the parent access sequence of the current genetic processing is updated.
7. A path determination device, It is characterized in that include: An acquisition module is configured to acquire ride information corresponding to a plurality of passengers, and determine a plurality of cities included in the ride information, wherein the plurality of cities include a ride starting city, a ride passing city, and a ride arrival city of each passenger; a determination module configured to divide the plurality of cities into a plurality of city clusters, determine connection path information between the plurality of city clusters and local shortest path information between cities included in each city cluster, wherein each city cluster includes cities less than or equal to a preset number of cities; a processing module configured to determine a first access sequence of the plurality of city clusters based on the connection path information and the local shortest path information, and perform iterative genetic processing on the first access sequence, wherein, for each genetic processing process, when it is determined that the genetic result meets a preset constraint condition, the genetic result is subjected to the next genetic processing; The generation module is configured to generate the global shortest path information corresponding to the multiple passengers according to the target access sequence corresponding to the target genetic result, the connection path information and the local shortest path information in response to judging that the target genetic result meets the preset convergence condition.
8. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
9. An electronic device comprising a storage medium, a processor, and a computer program stored on the storage medium and executable on the processor, It is characterized in that When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, the computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
