Vehicle routing problem processing method, device, electronic device and storage medium
By decomposing the vehicle path problem into sub-problems and optimizing the arrangement order of the weight vectors using the 2-opt algorithm, the problem of how to effectively obtain the solution set of vehicle path problem is solved, and the effect of improving logistics operation efficiency and service quality is achieved.
Patent Information
- Application Number
- CN202410739204.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-06-07
AI Technical Summary
How to effectively obtain solutions to vehicle path problems to improve the optimization and operational efficiency of logistics vehicles' driving routes.
By decomposing the vehicle path problem into sub-problems corresponding to multiple optimization indicators, the weight vectors of each sub-problem are obtained, the arrangement order of the weight vectors is optimized using the 2-opt algorithm, and finally, the sub-problems are solved according to the optimization order to form the solution set of the vehicle path problem.
While improving the efficiency of vehicle path problem solution collection, it provides solutions for vehicle path problem solving, thereby improving the efficiency and service quality of logistics operations.
Smart Images

Figure CN118586813B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of Internet technology, and in particular to a vehicle path problem processing method, device, electronic device and storage medium. Background Art
[0002] In modern logistics systems, how to reasonably arrange the routes of logistics vehicles to serve customers under given constraints in order to save operating costs and improve service quality is a key issue related to the core competitiveness of enterprises. This logistics planning problem can usually be modeled as a vehicle routing problem (VRP).
[0003] By studying the vehicle routing problem and optimizing the scheduling of transport vehicles, we can significantly improve distribution efficiency, reduce transportation costs, and improve customer service quality, thereby enhancing the core competitiveness of enterprises. The solution set of the vehicle routing problem is crucial to the solution of the vehicle routing problem. Therefore, how to obtain the solution set of the vehicle routing problem is an urgent problem to be solved. Summary of the invention
[0004] The embodiments of the present application provide a vehicle routing problem processing method, device, electronic device and storage medium to solve the above-mentioned technical problem of how to obtain a solution set of the vehicle routing problem.
[0005] In a first aspect, an embodiment of the present application provides a vehicle path problem processing method, which is applied to an electronic device. The vehicle path problem processing method includes:
[0006] Acquire multiple optimization objectives of a vehicle routing problem, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators;
[0007] Obtaining a weight vector corresponding to the sub-problem;
[0008] Combining a plurality of the weight vectors into a first weight vector set corresponding to the vehicle routing problem;
[0009] In the first weight vector set, two positions are selected, and the weight vector between the two positions is reversed to form a second weight vector set;
[0010] Obtaining the Euclidean distances between two adjacent weight vectors of the second weight vector set, adding the Euclidean distances, and generating the sum of the Euclidean distances corresponding to the second weight vector set;
[0011] Determine a third weight vector set according to the minimum sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the order of solving the subproblems;
[0012] According to the solving order, the initial sub-problem is solved, and the optimized solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem.
[0013] Exemplarily, the multiple optimization objectives are vehicle use cost, transportation cost per kilometer, vehicle charging cost, vehicle waiting time, longest path time, and vehicle delay time.
[0014] Exemplarily, determining a third weight vector set according to the minimum sum of the Euclidean distances, and setting the arrangement order of the weight vectors of the third weight vector set as the order of solving the subproblems includes:
[0015] Adding the Euclidean distances of two adjacent weight vectors of the first weight vector set to obtain the sum of the Euclidean distances corresponding to the first weight vector set;
[0016] When the sum of the Euclidean distances corresponding to the second weight vector set is less than the sum of the Euclidean distances corresponding to the first weight vector set, repeatedly performing the 2-opt operation on the second weight vector set until the minimum sum of the Euclidean distances is found;
[0017] The second weight vector set corresponding to the smallest sum of the Euclidean distances is set as a third weight vector set, and the arrangement order of the weight vectors in the third weight vector set is set as the order of solving the subproblems.
[0018] In a possible implementation manner of the first aspect, the acquiring multiple optimization objectives of a vehicle routing problem and decomposing the vehicle routing problem into sub-problems corresponding to each of the optimization indicators includes:
[0019] Acquire multiple optimization objectives of the vehicle routing problem, acquire the selection probability corresponding to each decomposition algorithm, adopt the decomposition algorithm corresponding to the highest selection probability, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators.
[0020] In a possible implementation manner of the first aspect, obtaining the weight vector corresponding to the sub-problem includes:
[0021] A preset two-layer weight vector generation method or a simplex lattice method is used to obtain a weight vector corresponding to the sub-problem.
[0022] In a possible implementation manner of the first aspect, selecting two positions in the first weight vector set and inverting the weight vector between the two positions to form a second weight vector set includes:
[0023] In the first weight vector set, a preset 2-opt algorithm is used to select two positions, and the weight vector between the two positions is inverted to form a second weight vector set.
[0024] In a possible implementation of the first aspect, solving the initial subproblem according to the solving order, using the optimized solution corresponding to the initial subproblem as the initial solution corresponding to the next subproblem, until all the subproblems are solved, and forming the optimized solutions corresponding to the subproblems into a solution set of the vehicle routing problem, includes:
[0025] According to the solving order, the initial subproblem is determined, an initial solution of the initial subproblem is randomly generated, and a preset optimization algorithm is used to solve the initial subproblem starting from the initial solution of the initial subproblem to obtain an optimized solution corresponding to the initial subproblem;
[0026] The optimized solution corresponding to the initial sub-problem is set as the initial solution of the next sub-problem, and starting from the initial solution of the next sub-problem, the next sub-problem is solved using the optimization algorithm to obtain the optimized solution corresponding to the next sub-problem;
[0027] When the next sub-problem is the last sub-problem, the optimization solutions corresponding to the sub-problems are combined into the solution set of the vehicle routing problem.
[0028] In a possible implementation of the first aspect, when the next subproblem is the last subproblem, after the optimization solutions corresponding to the subproblems are combined into the solution set of the vehicle routing problem, the vehicle routing problem processing method includes:
[0029] A preset external archive is obtained, and the solution set is saved in the external archive.
[0030] In a possible implementation manner of the first aspect, the optimization algorithm includes one of a taboo search algorithm, a simulated annealing algorithm, an ant colony optimization algorithm, a particle swarm optimization algorithm, or a combination thereof.
[0031] In a second aspect, an embodiment of the present application provides a vehicle path problem processing device, which is applied to an electronic device, including:
[0032] A first acquisition module is used to acquire multiple optimization objectives of a vehicle routing problem and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators;
[0033] A second acquisition module is used to obtain a weight vector corresponding to the sub-problem;
[0034] A composition module, used for composing a plurality of the weight vectors into a first weight vector set corresponding to the vehicle routing problem;
[0035] A switching module, configured to select two positions in the first weight vector set, and invert the weight vector between the two positions to form a second weight vector set;
[0036] A generating module, configured to obtain the Euclidean distances between two adjacent weight vectors of the second weight vector set, add the Euclidean distances, and generate the sum of the Euclidean distances corresponding to the second weight vector set;
[0037] A determination module, configured to determine a third weight vector set according to the minimum sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the solution order of the subproblems;
[0038] A processing module is used to solve the initial sub-problem according to the solution order, and use the optimized solution corresponding to the initial sub-problem as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem.
[0039] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the vehicle path problem processing method of any one of the above-mentioned first aspects is implemented.
[0040] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the vehicle path problem processing method of any one of the above-mentioned first aspects is implemented.
[0041] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the vehicle path problem processing method described in any one of the first aspects above.
[0042] The beneficial effects of the embodiments of the present application lie in two aspects. On the one hand, according to the solution order, the initial sub-problem is solved, and the optimized solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems are combined into a solution set of the vehicle path problem. Therefore, the electronic device can solve the problem of how to obtain the solution set of the vehicle path problem, which is conducive to improving the efficiency of obtaining the solution set. On the other hand, through the solution set, a processing solution for the vehicle path problem can be obtained. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0044] Figure 1 An application scenario diagram of the vehicle routing problem processing method provided in an embodiment of the present application;
[0045] Figure 2 It is a flowchart of a method for processing a vehicle routing problem provided in an embodiment of the present application;
[0046] Figure 3 A flowchart of an output weight vector set provided in an embodiment of the present application;
[0047] Figure 4 A schematic block diagram of a vehicle routing problem processing device provided in an embodiment of the present application;
[0048] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0050] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0051] The technical solutions between the various embodiments can be combined with each other, but they must be based on the fact that they can be implemented by ordinary technicians in the field. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.
[0052] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0053] The vehicle path problem processing method provided in the embodiment of the present application can be applied to electronic devices such as mobile phones, tablet computers, wearable devices, vehicle-mounted devices, augmented reality (AR) / virtual reality (VR) devices, laptop computers, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), etc. The embodiment of the present application does not impose any restrictions on the specific types of electronic devices.
[0054] See also Figure 1 , Figure 1 The application scenario diagram of the vehicle routing problem processing method provided in the embodiment of the present application is described in detail as follows:
[0055] The electronic device obtains multiple optimization targets of the vehicle routing problem and decomposes the vehicle routing problem into sub-problems corresponding to each of the optimization indicators.
[0056] Among them, the electronic equipment is connected to the logistics server of the logistics system.
[0057] Among them, multiple optimization objectives of the vehicle routing problem can come from one file of the logistics server or from multiple files of the logistics server.
[0058] For ease of explanation, the optimization targets are taken from two files as an example, as detailed below:
[0059] The two files include file A and file B. The electronic device reads file A and file B of the logistics server respectively, and obtains multiple optimization objectives of the vehicle routing problem from file A and file B.
[0060] In an embodiment of the present application, the electronic device can read different files at the same time and obtain multiple optimization objectives of the vehicle routing problem from the different files.
[0061] See also Figure 2 , Figure 2 It is a flow chart of a vehicle path problem processing method provided in an embodiment of the present application, which method can be applied to electronic devices.
[0062] like Figure 2As shown, the vehicle routing problem processing method provided in the embodiment of the present application includes the following steps, which are described in detail as follows:
[0063] S201, obtaining multiple optimization objectives of a vehicle routing problem, and decomposing the vehicle routing problem into sub-problems corresponding to each of the optimization indicators;
[0064] The vehicle routing problem is described as follows:
[0065] 1. There are several types of vehicles with different capacities, mileage, transportation costs per kilometer, and vehicle use costs. The vehicle departs from the distribution center and must return to the distribution center at the end of the working day. The vehicle can make multiple round trips for distribution. The departure time is the working day, and the latest time to return to the distribution center is the end of the working day.
[0066] 2. Each customer is associated with a time window, which represents the time range in which service is allowed. The earliest arrival time before the customer's request will result in waiting time; the latest arrival time after the customer's request within a certain period of time will result in delay time. Each customer has the need for delivery or collection, and the vehicle can provide delivery or collection services at the same time. Each customer is served only once, which consumes a certain service time.
[0067] 3. There are some charging stations distributed in the city. Vehicles can charge at the charging stations before the sustainable mileage is reached, which will incur charging costs; they can also return to the distribution center to charge, which will incur additional waiting time.
[0068] 4. The distances between distribution centers, charging stations, and customers and the travel time of vehicles are asymmetric (i.e., the triangle inequality is not satisfied).
[0069] The constraints of the problem are as follows:
[0070] 1. Mixed vehicle constraints: The types of vehicles delivered are not unique, and the total number of vehicles must not exceed a certain number.
[0071] 2. Vehicle volume constraint: The vehicle's mass and cargo volume while in motion must not exceed the mass and volume limits of that vehicle model.
[0072] 3. Time window constraint: The vehicle must arrive at the customer no later than the latest arrival time + the maximum allowed late arrival time, and the latest time to return to the distribution center must not be later than the end of get off work time.
[0073] 4. Electric vehicle mileage constraints: Vehicles need to be charged at charging stations or distribution centers before the sustainable mileage is reached.
[0074] 5. Circular constraint: Vehicles can make multiple round trips to the distribution center for cyclical delivery.
[0075] The step of obtaining multiple optimization objectives of the vehicle routing problem and decomposing the vehicle routing problem into sub-problems corresponding to each of the optimization indicators includes:
[0076] Acquire multiple optimization objectives of the vehicle routing problem, acquire the selection probability corresponding to each decomposition algorithm, adopt the decomposition algorithm corresponding to the highest selection probability, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators.
[0077] Exemplarily, the multiple optimization objectives are vehicle use cost, transportation cost per kilometer, vehicle charging cost, vehicle waiting time, longest path time, and vehicle delay time.
[0078] Among them, the decomposition algorithms are weighted method and Chebyshev method.
[0079] For the sake of illustration, an example is given below:
[0080] For example, the selection probability corresponding to the weighted method is D1, and the selection probability corresponding to the Chebyshev method is D2. When D1 is greater than D2, the highest selection probability D1 is adopted, and the weighted method is adopted to decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators.
[0081] For example, the selection probability corresponding to the weighted method is D1, and the selection probability corresponding to the Chebyshev method is D2. When D1 is less than D2, the highest selection probability D2 is adopted, and the Chebyshev method is adopted to decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators.
[0082] Among them, the decomposition algorithm corresponding to the highest selection probability is used to decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators, which is conducive to enhancing the optimization ability of the decomposition algorithm.
[0083] When D1 is equal to D2, the vehicle routing problem is decomposed into sub-problems corresponding to each of the optimization indicators using a weighted method or a Chebyshev method.
[0084] S202, obtaining a weight vector corresponding to the sub-problem;
[0085] Wherein, obtaining the weight vector corresponding to the sub-problem includes:
[0086] A preset two-layer weight vector generation method or a simplex lattice method is used to obtain a weight vector corresponding to the sub-problem.
[0087] S203, combining the plurality of weight vectors into a first weight vector set corresponding to the vehicle routing problem;
[0088] S204, selecting two positions in the first weight vector set, and inverting the weight vector between the two positions to form a second weight vector set;
[0089] The step of selecting two positions in the first weight vector set and reversing the weight vector between the two positions to form a second weight vector set includes:
[0090] In the first weight vector set, a preset 2-opt algorithm is used to select two positions, and the weight vector between the two positions is inverted to form a second weight vector set.
[0091] Among them, the 2-opt algorithm, full name: 2-optimization, can also be called 2-exchange.
[0092] Among them, the 2-opt algorithm is a random algorithm, and its basic idea is to randomly select 2 elements for optimization until optimization is impossible.
[0093] S205, obtaining the Euclidean distances between two adjacent weight vectors of the second weight vector set, adding the Euclidean distances, and generating the sum of the Euclidean distances corresponding to the second weight vector set;
[0094] For the sake of illustration, an example is given below:
[0095] For example, there are 6 weight vectors, namely p1, p2, p3, p4, p5, p6, and the first weight vector set is P = {p1, p2, p3, p4, p5, p6}. Calculate the sum of the Euclidean distances corresponding to the first weight vector set:
[0096] d(p1, p2)+d(p2, p3)+d(p3, p4)+d(p4, p5)+d(p5, p6)=2.5;
[0097] Among them, d(p1, p2) represents the Euclidean distance between p1 and p2, d(p2, p3) represents the Euclidean distance between p2 and p3, d(p3, p4) represents the Euclidean distance between p3 and p4, d(p4, p5) represents the Euclidean distance between p4 and p5, and d(p5, p6) represents the Euclidean distance between p5 and p6.
[0098] In the first iteration, assuming that the position of p1 and the position of p5 are selected, the second weight vector set is generated after inversion: P'={p1, p5, p4, p3, p2, p6}, and the sum of the Euclidean distances corresponding to the second weight vector set is calculated:
[0099] d(p1, p5)+d(p5, p4)+d(p4, p3)+d(p3, p2)+d(p2, p6)=1.5;
[0100] Among them, d(p1, p5) represents the Euclidean distance between p1 and p5, d(p5, p4) represents the Euclidean distance between p5 and p4, d(p4, p3) represents the Euclidean distance between p4 and p3, d(p3, p2) represents the Euclidean distance between p3 and p2, and d(p2, p6) represents the Euclidean distance between p2 and p6.
[0101] It can be seen that the sum of the Euclidean distances of the second weight vector set after the inversion is smaller, and the second weight vector set is accepted, and multiple rounds of iterations are continued on this basis until the minimum sum of the Euclidean distances is found.
[0102] S206, determining a third weight vector set according to the minimum sum of the Euclidean distances, and setting the arrangement order of the weight vectors in the third weight vector set as the solution order of the subproblems;
[0103] Exemplarily, determining a third weight vector set according to the minimum sum of the Euclidean distances, and setting the arrangement order of the weight vectors of the third weight vector set as the order of solving the subproblems includes:
[0104] Adding the Euclidean distances of two adjacent weight vectors of the first weight vector set to obtain the sum of the Euclidean distances corresponding to the first weight vector set;
[0105] When the sum of the Euclidean distances corresponding to the second weight vector set is less than the sum of the Euclidean distances corresponding to the first weight vector set, repeatedly performing the 2-opt operation on the second weight vector set until the minimum sum of the Euclidean distances is found;
[0106] The second weight vector set corresponding to the smallest sum of the Euclidean distances is set as a third weight vector set, and the arrangement order of the weight vectors in the third weight vector set is set as the order of solving the subproblems.
[0107] The repeatedly performing the 2-opt operation on the second weight vector set is to perform multiple rounds of iterations on the second weight vector set using the 2-opt algorithm. The 2-opt operation is an operation of inverting the weight vector between two positions.
[0108] For the sake of illustration, an example is given below:
[0109] The vehicle routing problem is decomposed into subproblem A, subproblem B, subproblem C, subproblem D, subproblem E, and subproblem F;
[0110] The weight vector corresponding to subproblem A is weight vector A, the weight vector corresponding to subproblem B is weight vector B, the weight vector corresponding to subproblem C is weight vector C, the weight vector corresponding to subproblem D is weight vector D, the weight vector corresponding to subproblem E is weight vector E, and the weight vector corresponding to subproblem F is weight vector F;
[0111] According to the original sorting, weight vector A, weight vector B, weight vector C, weight vector, weight vector E, and weight vector F are combined into a first weight vector set;
[0112] The first weight vector set is: weight vector A, weight vector B, weight vector C, weight vector D, weight vector E, and weight vector F.
[0113] A 2-opt operation is performed on the first weight vector set to obtain a second weight vector set 1.
[0114] For example, two positions are selected, the two positions are the position of weight vector A and the position of weight vector F, and weight vector B, weight vector C, weight vector D, and weight vector E between the position of weight vector A and the position of weight vector F are reversed.
[0115] The second weight vector set 1 includes: weight vector A, weight vector E, weight vector D, weight vector C, weight vector B, and weight vector F.
[0116] A 2-opt operation is performed on the second weight vector set 1 to obtain a second weight vector set 2.
[0117] For example, two positions are selected, the two positions are the position of weight vector E and the position of weight vector F, and weight vector D, weight vector C, and weight vector B between the position of weight vector E and the position of weight vector F are reversed.
[0118] The second weight vector set 2 is: weight vector A, weight vector E, weight vector B, weight vector C, weight vector D, and weight vector F.
[0119] When the sum of the Euclidean distances of the second weight vector set 2 is the smallest, setting the second weight vector set 2 to the third weight vector set;
[0120] The third weight vector set is: weight vector A, weight vector E, weight vector B, weight vector C, weight vector D, and weight vector F.
[0121] The arrangement order of the subproblems in the third subproblem set is set as the solution order of the subproblems. At this time, the solution order of the subproblems is: subproblem A, subproblem E, subproblem B, subproblem C, subproblem D, subproblem F.
[0122] S207, solving the initial sub-problem according to the solution order, and using the optimized solution corresponding to the initial sub-problem as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem.
[0123] Exemplarily, the optimization solutions corresponding to the sub-problems are combined into a solution set of the vehicle routing problem, including:
[0124] Generate a total score according to the number of the optimization solutions, the weight coefficients corresponding to the optimization solutions, the scoring values corresponding to the optimization solutions, and a preset total score generation model;
[0125] Determine whether the total score is greater than a preset score;
[0126] If the total score is greater than a preset score, the optimization solutions corresponding to the sub-problems are combined into a solution set of the vehicle routing problem.
[0127] The total score generation model is:
[0128]
[0129] Wherein, F is the total score, M is the number of the optimization solutions, i is the sequence number of the optimization solution, E i is the weight coefficient corresponding to the i-th optimization solution, K i is the score value corresponding to the i-th optimization solution, and the total score generation model is the generation model of the total score.
[0130] The higher the total score, the higher the reliability of the optimization solution corresponding to each of the sub-problems; the lower the total score, the worse the reliability of the optimization solution corresponding to each of the sub-problems.
[0131] Wherein, according to the solving order, solving the initial sub-problem, taking the optimized solution corresponding to the initial sub-problem as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem, including:
[0132] According to the solving order, the initial subproblem is determined, an initial solution of the initial subproblem is randomly generated, and a preset optimization algorithm is used to solve the initial subproblem starting from the initial solution of the initial subproblem to obtain an optimized solution corresponding to the initial subproblem;
[0133] The optimized solution corresponding to the initial sub-problem is set as the initial solution of the next sub-problem, and starting from the initial solution of the next sub-problem, the next sub-problem is solved using the optimization algorithm to obtain the optimized solution corresponding to the next sub-problem;
[0134] When the next sub-problem is the last sub-problem, the optimization solutions corresponding to the sub-problems are combined into the solution set of the vehicle routing problem.
[0135] Among them, the sub-problems are solved in sequence according to the solving order, and the initial solution of the sub-problem is the optimized solution of the previous solved sub-problem.
[0136] For the sake of illustration, an example is given below:
[0137] The vehicle routing problem is decomposed into subproblem A, subproblem B, subproblem C, subproblem D, subproblem E, and subproblem F;
[0138] Randomly generate an initial solution to subproblem A, use an optimization algorithm to solve subproblem A, and obtain an optimized solution A1 of subproblem A;
[0139] Take the optimized solution A1 as the initial solution of sub-problem B, use the optimization algorithm to solve sub-problem B, and obtain the optimized solution B1 of sub-problem B;
[0140] Take the optimized solution B1 as the initial solution of subproblem C, use the optimization algorithm to solve subproblem C, and obtain the optimized solution C1 of subproblem C;
[0141] Take the optimized solution C1 as the initial solution of subproblem D, use the optimization algorithm to solve subproblem D, and obtain the optimized solution D1 of subproblem D;
[0142] Take the optimized solution D1 as the initial solution of subproblem E, use the optimization algorithm to solve subproblem E, and obtain the optimized solution E1 of subproblem E;
[0143] Take the optimized solution E1 as the initial solution of subproblem F, use the optimization algorithm to solve subproblem F, and obtain the optimized solution F1 of subproblem F;
[0144] Bringing A1, B1, C1, D1, E1, and F1 together, we obtain a solution set for the vehicle routing problem.
[0145] The optimization algorithm includes one of a taboo search algorithm, a simulated annealing algorithm, an ant colony optimization algorithm, and a particle swarm optimization algorithm, or a combination thereof.
[0146] Wherein, when the next sub-problem is the last sub-problem, after the optimization solutions corresponding to the sub-problems are formed into the solution set of the vehicle routing problem, the vehicle routing problem processing method includes:
[0147] A preset external archive is obtained, and the solution set is saved in the external archive.
[0148] Among them, users can select one or more optimized solutions from the solution set as solutions to the vehicle routing problem based on their specific preferences and needs.
[0149] The beneficial effects of the embodiments of the present application lie in two aspects. On the one hand, according to the solution order, the initial sub-problem is solved, and the optimized solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems are combined into a solution set of the vehicle path problem. Therefore, the electronic device can solve the problem of how to obtain the solution set of the vehicle path problem, which is conducive to improving the efficiency of obtaining the solution set. On the other hand, through the solution set, a processing solution for the vehicle path problem can be obtained.
[0150] See also Figure 3 , Figure 3 The flowchart of the output weight vector set provided in the embodiment of the present application is described in detail as follows:
[0151] S301, input weight vector;
[0152] S302, sorting the weight vectors to obtain a first weight vector set;
[0153] S303, performing a 2-opt operation on the first weight vector set to generate a second weight vector set;
[0154] Among them, the 2-opt operation is the operation of inverting the weight vector between two positions.
[0155] For example, in the first weight vector set, a 2-opt operation is performed on the first weight vector set, and the first weight vector set subjected to the 2-opt operation is used as the second weight vector set.
[0156] S304: Whether the stop condition is met, if yes, execute S305, if no, execute S303;
[0157] The maximum number of times is preset by the user or by the system default and is not limited here.
[0158] The stopping condition includes finding the minimum sum of the Euclidean distances, the number of executions of the 2-opt operation reaching the maximum number, or a combination thereof.
[0159] S305: output a third weight vector set.
[0160] In an embodiment of the present application, the arrangement order of the weight vectors of the third weight vector set is set as the solution order of the sub-problems. The solution order can improve the solution quality and solution speed of the vehicle routing problem.
[0161] For the vehicle routing problem processing method described in the above embodiment, please refer to Figure 4 , Figure 4 A schematic block diagram of a vehicle routing problem processing device provided in an embodiment of the present application, Figure 4 The vehicle routing problem processing device 400 shown can be applied to Figure 1 The electronic device in the application scenario diagram shown below takes the electronic device as an example. Figure 4 The vehicle routing problem processing device 400 shown is described in detail. The vehicle routing problem processing device 400 may include a first acquisition module 401, a second acquisition module 402, a composition module 403, an exchange module 404, a generation module 405, a determination module 406, and a processing module 407.
[0162] A first acquisition module 401 is used to acquire multiple optimization targets of a vehicle routing problem and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators;
[0163] A second acquisition module 402 is used to acquire a weight vector corresponding to the sub-problem;
[0164] A composition module 403, configured to combine the plurality of weight vectors into a first weight vector set corresponding to the vehicle routing problem;
[0165] A switching module 404 is used to select two positions in the first weight vector set, and invert the weight vector between the two positions to form a second weight vector set;
[0166] A generating module 405 is used to obtain the Euclidean distances between two adjacent weight vectors of the second weight vector set, add the Euclidean distances, and generate the sum of the Euclidean distances corresponding to the second weight vector set;
[0167] A determination module 406 is used to determine a third weight vector set according to the minimum sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the solution order of the sub-problems;
[0168] The processing module 407 is used to solve the initial sub-problem according to the solution order, and use the optimized solution corresponding to the initial sub-problem as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem.
[0169] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0170] The beneficial effects of the embodiments of the present application lie in two aspects. On the one hand, according to the solution order, the initial sub-problem is solved, and the optimized solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems are combined into a solution set of the vehicle path problem. Therefore, the electronic device can solve the problem of how to obtain the solution set of the vehicle path problem, which is conducive to improving the efficiency of obtaining the solution set. On the other hand, through the solution set, a processing solution for the vehicle path problem can be obtained.
[0171] See also Figure 5 , Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0172] like Figure 5 As shown, Figure 5 The electronic device 2 includes: at least one processor 20, a memory 21, and a computer program 22 stored in the memory 21 and executable on the at least one processor 20, and when the processor 20 executes the computer program 22, the steps in any of the above-mentioned method embodiments are implemented.
[0173] The electronic device 2 may include, but is not limited to, a processor 20 and a memory 21. Those skilled in the art will appreciate that Figure 5 It is only an example of the electronic device 2 and does not constitute a limitation on the electronic device 2. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.
[0174] The processor 20 is used to run the computer program 22 stored in the memory 21, and implement the following steps when executing the computer program 22:
[0175] Acquire multiple optimization objectives of a vehicle routing problem, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators;
[0176] Obtaining a weight vector corresponding to the sub-problem;
[0177] Combining a plurality of the weight vectors into a first weight vector set corresponding to the vehicle routing problem;
[0178] In the first weight vector set, two positions are selected, and the weight vector between the two positions is reversed to form a second weight vector set;
[0179] Obtain the Euclidean distances between two adjacent weight vectors of the second weight vector set, add the Euclidean distances, and generate the sum of the Euclidean distances corresponding to the second weight vector set; determine a third weight vector set based on the smallest sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the solution order of the subproblems; solve the initial subproblems according to the solution order, and use the optimized solution corresponding to the initial subproblem as the initial solution corresponding to the next subproblem, until all the subproblems are solved, and the optimized solutions corresponding to the subproblems form a solution set of the vehicle routing problem.
[0180] In some embodiments, the processor 20 is configured to implement:
[0181] Acquire multiple optimization objectives of the vehicle routing problem, acquire the selection probability corresponding to each decomposition algorithm, adopt the decomposition algorithm corresponding to the highest selection probability, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators.
[0182] In some embodiments, the processor 20 is configured to implement:
[0183] A preset two-layer weight vector generation method or a simplex lattice method is used to obtain a weight vector corresponding to the sub-problem.
[0184] In some embodiments, the processor 20 is configured to implement:
[0185] In the first weight vector set, a preset 2-opt algorithm is used to select two positions, and the weight vector between the two positions is inverted to form a second weight vector set.
[0186] In some embodiments, the processor 20 is configured to implement:
[0187] According to the solving order, the initial subproblem is determined, an initial solution of the initial subproblem is randomly generated, and a preset optimization algorithm is used to solve the initial subproblem starting from the initial solution of the initial subproblem to obtain an optimized solution corresponding to the initial subproblem;
[0188] The optimized solution corresponding to the initial sub-problem is set as the initial solution of the next sub-problem, and starting from the initial solution of the next sub-problem, the next sub-problem is solved using the optimization algorithm to obtain the optimized solution corresponding to the next sub-problem;
[0189] When the next sub-problem is the last sub-problem, the optimization solutions corresponding to the sub-problems are combined into the solution set of the vehicle routing problem.
[0190] In some embodiments, the processor 20 is configured to implement:
[0191] A preset external archive is obtained, and the solution set is saved in the external archive.
[0192] In some embodiments, the processor 20 is configured to implement:
[0193] The optimization algorithm includes one of a taboo search algorithm, a simulated annealing algorithm, an ant colony optimization algorithm, and a particle swarm optimization algorithm, or a combination thereof.
[0194] The processor 20 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0195] In some embodiments, the memory 21 may be an internal storage unit of the electronic device 2, such as a hard disk or memory of the electronic device 2. In other embodiments, the memory 21 may also be an external storage device of the electronic device 2, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device 2. Further, the memory 21 may also include both an internal storage unit of the electronic device 2 and an external storage device. The memory 21 is used to store an operating system, an application program, a boot loader (Boot Loader), data, and other programs, such as the program code of the computer program, etc. The memory 21 may also be used to temporarily store data that has been output or is to be output.
[0196] It should be noted that the information interaction, execution process, etc. between the above-mentioned devices / units are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.
[0197] An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0198] The computer-readable storage medium stores program codes, which can be called by a processor to execute the vehicle routing problem processing method described in the above method embodiment.
[0199] The computer-readable storage medium has a storage space for program codes.
[0200] The program code includes the code of any step in the vehicle routing problem processing method described in the above method embodiment.
[0201] For example, the program code is called by the processor and can execute the following steps:
[0202] Acquire multiple optimization objectives of a vehicle routing problem, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators;
[0203] Obtaining a weight vector corresponding to the sub-problem;
[0204] Combining a plurality of the weight vectors into a first weight vector set corresponding to the vehicle routing problem;
[0205] In the first weight vector set, two positions are selected, and the weight vector between the two positions is reversed to form a second weight vector set;
[0206] Obtaining the Euclidean distances between two adjacent weight vectors of the second weight vector set, adding the Euclidean distances, and generating the sum of the Euclidean distances corresponding to the second weight vector set;
[0207] Determine a third weight vector set according to the minimum sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the order of solving the subproblems;
[0208] According to the solving order, the initial sub-problem is solved, and the optimized solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem.
[0209] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.
[0210] The computer-readable storage medium may also be an external storage device of the vehicle routing problem processing device or the electronic device, for example, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), a non-transitory computer-readable storage medium, etc., equipped on the vehicle routing problem processing device or the electronic device.
[0211] Since the computer program stored in the computer-readable storage medium can execute any one of the vehicle path problem processing methods provided in the embodiments of the present application, the computer-readable storage medium can achieve the beneficial effects that can be achieved by any one of the vehicle path problem processing methods provided in the embodiments of the present application. For details, please refer to the previous embodiments and will not be repeated here.
[0212] An embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the above-mentioned vehicle routing problem processing method.
[0213] The computer program product is loaded into the electronic device and can execute the following steps:
[0214] Acquire multiple optimization objectives of a vehicle routing problem, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators;
[0215] Obtaining a weight vector corresponding to the sub-problem;
[0216] Combining a plurality of the weight vectors into a first weight vector set corresponding to the vehicle routing problem;
[0217] In the first weight vector set, two positions are selected, and the weight vector between the two positions is reversed to form a second weight vector set;
[0218] Obtaining the Euclidean distances between two adjacent weight vectors of the second weight vector set, adding the Euclidean distances, and generating the sum of the Euclidean distances corresponding to the second weight vector set;
[0219] Determine a third weight vector set according to the minimum sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the order of solving the subproblems;
[0220] According to the solving order, the initial sub-problem is solved, and the optimized solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem.
[0221] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium.
[0222] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0223] Based on such understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to an electronic device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0224] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0225] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for processing a vehicle routing problem, characterized in that: Applied to electronic equipment, the vehicle routing problem processing method includes: Obtain multiple optimization objectives of the vehicle routing problem, decompose the vehicle routing problem into sub-problems corresponding to the optimization indicators, the multiple optimization objectives are vehicle use cost, transportation cost per kilometer, vehicle charging cost, vehicle waiting time, longest path time, and vehicle delay time; Obtaining a weight vector corresponding to the sub-problem; Combining a plurality of the weight vectors into a first weight vector set corresponding to the vehicle routing problem; In the first weight vector set, two positions are selected, and the weight vector between the two positions is reversed to form a second weight vector set; Obtaining the Euclidean distances between two adjacent weight vectors of the second weight vector set, adding the Euclidean distances, and generating the sum of the Euclidean distances corresponding to the second weight vector set; Determine a third weight vector set according to the minimum sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the order of solving the subproblems; According to the solving order, the initial sub-problem is solved, and the optimized solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem; One or more optimized solutions are selected from the solution set as solutions to the vehicle routing problem.
2. The vehicle routing problem processing method according to claim 1, characterized in that: The step of obtaining multiple optimization objectives of the vehicle routing problem and decomposing the vehicle routing problem into sub-problems corresponding to each of the optimization indicators includes: Acquire multiple optimization objectives of the vehicle routing problem, acquire the selection probability corresponding to each decomposition algorithm, adopt the decomposition algorithm corresponding to the highest selection probability, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators.
3. The vehicle routing problem processing method according to claim 1, characterized in that: The obtaining of the weight vector corresponding to the sub-problem includes: A preset two-layer weight vector generation method or a simplex lattice method is used to obtain a weight vector corresponding to the sub-problem.
4. The vehicle routing problem processing method according to claim 1, characterized in that: The step of selecting two positions in the first weight vector set and inverting the weight vector between the two positions to form a second weight vector set includes: In the first weight vector set, a preset 2-opt algorithm is used to select two positions, and the weight vector between the two positions is inverted to form a second weight vector set.
5. The vehicle routing problem processing method according to any one of claims 1 to 4, characterized in that: The initial sub-problem is solved according to the solving order, and the optimization solution corresponding to the initial sub-problem is used as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimization solutions corresponding to the sub-problems are combined into a solution set of the vehicle routing problem, including: According to the solving order, the initial subproblem is determined, an initial solution of the initial subproblem is randomly generated, and a preset optimization algorithm is used to solve the initial subproblem starting from the initial solution of the initial subproblem to obtain an optimized solution corresponding to the initial subproblem; The optimized solution corresponding to the initial sub-problem is set as the initial solution of the next sub-problem, and starting from the initial solution of the next sub-problem, the next sub-problem is solved using the optimization algorithm to obtain the optimized solution corresponding to the next sub-problem; When the next sub-problem is the last sub-problem, the optimization solutions corresponding to the sub-problems are combined into the solution set of the vehicle routing problem.
6. The vehicle routing problem processing method according to claim 5, characterized in that: When the next sub-problem is the last sub-problem, after the optimization solutions corresponding to the sub-problems are combined into the solution set of the vehicle routing problem, the vehicle routing problem processing method includes: A preset external archive is obtained, and the solution set is saved in the external archive.
7. The vehicle routing problem processing method according to claim 5, characterized in that: The optimization algorithm includes one of a taboo search algorithm, a simulated annealing algorithm, an ant colony optimization algorithm, and a particle swarm optimization algorithm, or a combination thereof.
8. A vehicle routing problem processing device, characterized in that: Used in electronic equipment, including: A first acquisition module is used to acquire multiple optimization objectives of the vehicle routing problem, and decompose the vehicle routing problem into sub-problems corresponding to each of the optimization indicators, wherein the multiple optimization objectives are vehicle use cost, transportation cost per kilometer, vehicle charging cost, vehicle waiting time, longest path time, and vehicle delay time; A second acquisition module is used to obtain a weight vector corresponding to the sub-problem; A composition module, used for composing a plurality of the weight vectors into a first weight vector set corresponding to the vehicle routing problem; A switching module, configured to select two positions in the first weight vector set, and invert the weight vector between the two positions to form a second weight vector set; A generating module, configured to obtain the Euclidean distances between two adjacent weight vectors of the second weight vector set, add the Euclidean distances, and generate the sum of the Euclidean distances corresponding to the second weight vector set; A determination module, configured to determine a third weight vector set according to the minimum sum of the Euclidean distances, and set the arrangement order of the weight vectors of the third weight vector set as the solution order of the subproblems; A processing module, used to solve the initial sub-problem according to the solving order, and use the optimized solution corresponding to the initial sub-problem as the initial solution corresponding to the next sub-problem, until all the sub-problems are solved, and the optimized solutions corresponding to the sub-problems form a solution set of the vehicle routing problem; One or more optimized solutions are selected from the solution set as solutions to the vehicle routing problem.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the vehicle routing problem processing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the vehicle routing problem processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Multi-target urban logistics distribution path planning method
CN111144568A
Urban vehicle path optimization method based on data-driven swarm intelligence calculation
CN112270047A