Hybrid vehicle routing optimization method and system based on genetic and whale hybrid algorithm
By introducing a battery swap link in electric vehicle path optimization and using a method based on genetic and whale hybrid algorithm, the problem that the path optimization solution in long-distance transportation of electric vehicles is solved, and the convenience of electric vehicles in the distribution environment and the carbon emission reduction effect are improved.
Patent Information
- Application Number
- CN202210290630.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2042-03-23
Smart Images

Figure CN114861972B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of vehicle path optimization, and in particular to a hybrid vehicle path optimization method, system, storage medium and electronic device based on a genetic and whale hybrid algorithm. Background Art
[0002] Energy costs have been rising steadily in recent years, while more and more laws have been passed to regulate greenhouse gas emissions in the transportation sector. These external factors, as well as society's rising environmental and social awareness, have sparked many green initiatives in companies. In the logistics sector, electric commercial vehicles are now considered an important alternative to traditional internal combustion engine commercial vehicles. Due to the limited range of electric commercial vehicles, goods can only be delivered to customers within a certain range, and the cost is high, so the use of pure electric commercial vehicles for delivering goods is still very limited.
[0003] At present, combining electric commercial vehicles with traditional internal combustion engine commercial vehicles for distribution can effectively solve the problems of endurance and environmental pollution, and solve the huge cost of replacing electric commercial vehicles at one time, playing a role of intermediate transition. In the process of hybrid vehicle coordinated distribution, how to choose the best distribution node and the right time to replace the electric vehicle to ensure sufficient power, optimize the driving route of hybrid vehicles, and improve the efficiency and cost of hybrid vehicle coordinated distribution while minimizing environmental pollution is a research direction worth exploring. Establishing a reasonable optimization problem description model and finding an efficient solution algorithm for the model are of great significance to improving the efficiency of hybrid vehicle coordinated distribution.
[0004] In the existing scheme design, there are only pure fuel vehicle model optimization, pure electric vehicle model optimization or hybrid model optimization without battery swap stations. However, in real life, long-distance transportation is an inevitable disadvantage of electric vehicles, which makes the generated path optimization scheme unable to be actually applied. Summary of the invention
[0005] 1. Technical issues to be resolved
[0006] In view of the shortcomings of the prior art, the present invention provides a hybrid vehicle path optimization method, system, storage medium and electronic device based on genetic and whale hybrid algorithms, which solves the technical problem that the long-distance transportation of electric vehicles does not take the battery replacement link into consideration, resulting in the inability to actually apply the generated path optimization solution.
[0007] (II) Technical solution
[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0009] A hybrid vehicle routing optimization method based on genetic and whale hybrid algorithms, comprising:
[0010] S1. Obtaining task data including at least vehicle, battery swap station, distribution center, and customer node information;
[0011] S2. constructing a hybrid vehicle collaborative delivery model based on the task data;
[0012] S3, solving the mixed vehicle collaborative distribution model by using a hybrid algorithm based on genetics and whales to obtain a mixed vehicle path optimization solution;
[0013] The hybrid vehicle route optimization scheme includes an electric vehicle distribution scheme with battery swap stations inserted: the power required for any electric vehicle in the optimization scheme to reach each node is calculated; if the power of the current electric vehicle arriving at a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and the previous node.
[0014] Preferably, S3 specifically includes:
[0015] S31. Initializing a whale population according to the task data, wherein any individual whale in the population includes an electric vehicle distribution plan inserted into a battery swap station after decoding;
[0016] S32. According to the hybrid vehicle collaborative delivery model, the objective function value corresponding to each whale individual is calculated to obtain the local optimal individual and use it as the global optimal individual;
[0017] S33, the introduced genetic algorithm crossover operation completes the update of whale individuals;
[0018] S34, after performing a local search on the updated whale population, obtain the current local optimal individual, and update the global optimal individual;
[0019] S35, determine whether the maximum update iteration number is reached, if so, proceed to S36; otherwise, proceed to S33;
[0020] S36: Output the final global optimal individual, and decode to obtain the hybrid vehicle path optimization solution.
[0021] Preferably, the S31 includes:
[0022] S311. According to the task data, the whale individuals are encoded by real number encoding, specifically, the number 0 represents the distribution center; 1, ..., n represents the customer node; n+1, ..., n+m represents the location of the battery swap station; the total maximum number of vehicles K that can be used by the distribution center is equal to the maximum number of fuel vehicles maxfv plus the number of electric vehicles maxev, then the individual code can be randomly generated by real numbers 1, ..., n+K-1, where the real numbers n+1, ..., n+K-1 are vehicle segmentation points;
[0023] S312, decoding the whale individuals, and obtaining vehicle distribution plans for fuel vehicles and electric vehicles plugged into the battery swap station;
[0024] S3121. Obtain the vehicle distribution plan for fuel vehicles.
[0025] According to the maximum number of fuel vehicles in use maxfv, extract the coding segment before the maxfv-th vehicle segmentation point, and use a value greater than n in the previous coding segment to divide the selected segment into at most maxfv parts, each of which represents a client node visited by each fuel vehicle;
[0026] S3122, obtaining a distribution plan for electric vehicles that are not plugged into a battery swap station,
[0027] Extract the coding segment after the maxfvth vehicle segmentation point appears, and use a value greater than n in the latter part of the coding segment to divide the selected segment into at most maxev parts, each of which represents the customer node visited by each electric vehicle;
[0028] S3123, obtaining a vehicle distribution plan for electric vehicles inserted into the battery swap station,
[0029] Calculate the distance from the distribution center to the i-th customer node for any electric vehicle in the above electric vehicle distribution plan without inserting a battery swap station, and derive the remaining power of the current electric vehicle to reach the i-th customer node according to the distance until it can return to the distribution center;
[0030] When the remaining power is less than 0%, return to the i-1th customer node, find the location of the nearest power swap station to the i-1th customer node based on the current location, calculate the remaining power of the i-1th customer node to reach the nearest power swap station, and if the remaining power is sufficient to reach the power swap station, insert the power swap station number between the i-1th and i-th customer nodes;
[0031] If not, continue to return to the i-2th customer node and repeat the above search operation until the battery swap station can be reached and the battery swap is performed. After the battery swap, the order of reaching the unvisited customer nodes from the battery swap station is calculated, and the remaining power to reach the remaining customer nodes is obtained based on the distance, and the above operation is continued to repeat;
[0032] S313. Combining the vehicle distribution plan for fuel vehicles and the vehicle distribution plan for electric vehicles inserted into the battery swap station, obtain a solution corresponding to any individual whale in the initial whale population.
[0033] Preferably, the S33 specifically includes:
[0034] Define the local optimal individual as X * , the remaining whale individuals are X i , then the update formula is:
[0035]
[0036] Among them, rand means generating a random number between 0 and 1;
[0037] cross1 indicates the cyclic cross mode, including:
[0038] S10, randomly select element e1 at position i1 of whale individual 1, find element e2 at the same position i1 of individual 2, then go back to individual 1 to find position i2 where element e2 is located, and repeat the process until a closed loop is reached;
[0039] S11, replace the positions of the values on the two individuals in order, and complete the update of the current whale individual;
[0040] cross2 indicates the sequential cross mode, including:
[0041] S100, randomly select the positions of any individuals in whale individual 1, and record the corresponding numerical position sequence, select the same numerical value in individual 2, and record the position sequence of individual 2;
[0042] S101, the numerical position order of individual 1 is reinserted into individual 1 according to the numerical position order of individual 2, and the numerical values selected by individual 2 are reinserted into the individual according to the order of numerical values selected by individual 1.
[0043] Preferably, the S34 specifically adopts a local search method of a reversal operation and / or an insertion operation, including:
[0044] The definition of a whale individual can be expressed as:
[0045] R=[R(1), R(2),..., R(i), R(i+1),..., R(j-1), R(j),..., R(N+K-2), R(N+K-1)];
[0046] (1) The reversal operation local search method refers to reversing the order of all elements between two positions on the whale individual. If the selected reversal positions are i and j, reversing all elements between the i-th and j-th positions, the sorted solution can be expressed as:
[0047] R=[R(1), R(2),…, R(j), R(j-1),…, R(i+1), R(i),…, R(N+K-2), R(N+K-1)];
[0048] (2) The insertion operation local search method refers to inserting the i-th position element into the j-th position element, and the sorted solution is expressed as:
[0049] R=[R(1), R(2), ..., R(i+1), ..., R(j-1), R(j), R(i), ..., R(N+K-2), R(N+K-1)].
[0050] Preferably, the hybrid vehicle collaborative delivery model in S2 includes:
[0051] Consider the objective function of minimum cost:
[0052] min z=f F +f c +f p
[0053] Among them, f F Indicates that fixed costs are included;
[0054]
[0055] K is the set of cars, subscripted as k; F ev 、F cv Represent the fixed costs of electric vehicles and fuel vehicles respectively; y k is a decision variable, which is 1 if the vehicle is an electric vehicle and 0 otherwise;
[0056] f c represents variable costs, including charging costs for electric vehicles and distance costs for fuel vehicles;
[0057]
[0058] C ev , C cv Represent the variable costs of electric vehicles and fuel vehicles respectively; S kis a decision variable, which is 1 if the battery swap station S is selected, otherwise it is 0; V represents the set of all nodes, V = C∪S∪{o}; C is the set of customer nodes, subscripted as c; S is the set of battery swap stations, subscripted as s; {o} represents the distribution center; d gh represents the distance between any two nodes g and h; x ghk is a decision variable, which is 1 if the vehicle passes through point h from point g, otherwise it is 0;
[0059] f p represents the time penalty cost;
[0060]
[0061]
[0062] They represent the time when the vehicle arrives at and leaves the customer node respectively; epu and lpu represent the penalty costs for the vehicle arriving early and late at the customer node respectively; e g , l g Respectively represent the earliest and latest service times required by the customer.
[0063] Preferably, the hybrid vehicle collaborative delivery model in S2 further includes constraints:
[0064] (1)∑ g∈V,g≠v x gvk =∑ h∈V,h≠v x vhk , k∈K,
[0065] It means that the vehicle entering a node must leave the node and the vehicle will eventually return to the distribution center;
[0066] (2)
[0067] It means that a customer point can only have one vehicle to provide delivery service and only provide service once;
[0068] (3)
[0069] Indicates that the total demand for each vehicle’s service cannot exceed the vehicle’s load capacity; u c represents the demand of customer node c; U represents the vehicle capacity;
[0070] (4)
[0071] It indicates the relationship between the power of the two nodes before and after the vehicle during driving: only when the vehicle is an electric vehicle and the vehicle starts from g to visit h, that is, y k =x ghk=1, the battery capacity of the vehicle will decrease; r represents the battery consumption rate of the electric vehicle;
[0072] (5)
[0073] It means that the electric vehicle at the customer node has the same charge when it arrives and leaves;
[0074] (6)
[0075] It indicates that the electric vehicle is fully charged when it leaves the distribution center; D indicates the full charge of the electric vehicle;
[0076] (7)
[0077] Indicates that the electric vehicle is fully charged when it leaves the battery swap station;
[0078] (8)
[0079] Indicates that when the vehicle departs from the distribution center, the time is 0;
[0080] (9)t gh =d gh / speed,g,h∈V,
[0081] Indicates the calculation of driving time, speed indicates the vehicle speed;
[0082] (10) And g≠h,
[0083] It means that the time when a vehicle arrives at node h is equal to the time when the vehicle leaves the previous node g plus the time it takes to travel from node g to node h;
[0084] (11)
[0085] If the vehicle arrives at customer node g earlier than the earliest service time e required by customer node g, g , then the vehicle needs to wait until the earliest service time e g To start the service, the waiting time is Otherwise, no need to wait, tw g is 0;
[0086] (12)
[0087] It means that the time when the vehicle leaves the customer node is equal to the time when it arrives at the customer node plus the waiting time and service time.
[0088] A hybrid vehicle routing optimization system based on genetic and whale hybrid algorithms, comprising:
[0089] A data acquisition module, used to acquire task data including at least vehicle, battery swap station, distribution center, and customer node information;
[0090] A model building module, used for building a hybrid vehicle collaborative delivery model according to the task data;
[0091] A solution solving module is used to solve the mixed vehicle collaborative distribution model by using a genetic and whale hybrid algorithm to obtain a mixed vehicle path optimization solution;
[0092] The hybrid vehicle route optimization scheme includes an electric vehicle distribution scheme with battery swap stations inserted: the power required for any electric vehicle in the optimization scheme to reach each node is calculated; if the power of the current electric vehicle arriving at a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and the previous node.
[0093] A storage medium stores a computer program for hybrid vehicle path optimization based on a genetic and whale hybrid algorithm, wherein the computer program enables a computer to execute the hybrid vehicle path optimization method as described above.
[0094] An electronic device, comprising:
[0095] one or more processors;
[0096] Memory; and
[0097] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs including instructions for executing the hybrid vehicle path optimization method as described above.
[0098] (III) Beneficial effects
[0099] The present invention provides a hybrid vehicle path optimization method, system, storage medium and electronic device based on a genetic and whale hybrid algorithm. Compared with the prior art, it has the following beneficial effects:
[0100] In the present invention, the task data of vehicles, battery swap stations, distribution centers, and customer nodes are obtained; based on the task data, a hybrid vehicle collaborative distribution model is constructed; the hybrid vehicle collaborative distribution model is solved by a genetic and whale hybrid algorithm to obtain a hybrid vehicle path optimization plan; the hybrid vehicle path optimization plan includes an electric vehicle distribution plan with battery swap stations inserted: the power required for any electric vehicle in the optimization plan to reach each node is calculated, and if the power of the current electric vehicle to reach a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and its previous node. The battery swap link is added to the distribution path optimization link on the basis of existing facilities, which further improves the convenience of electric vehicles in the distribution environment and their contribution to reducing carbon emissions. BRIEF DESCRIPTION OF THE DRAWINGS
[0101] In order to more clearly illustrate the embodiments of the present invention 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, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0102] Figure 1 A flow chart of a hybrid vehicle path optimization method based on a genetic and whale hybrid algorithm provided in an embodiment of the present invention;
[0103] Figure 2 An example of coding of an individual whale provided by an embodiment of the present invention;
[0104] Figure 3 A decoding example of a fuel vehicle distribution solution provided by an embodiment of the present invention;
[0105] Figure 4 A decoding example of an electric vehicle delivery solution without inserting a battery swap station provided by an embodiment of the present invention;
[0106] Figure 5 A decoding example of an electric vehicle distribution solution inserted into a battery swap station provided by an embodiment of the present invention;
[0107] Figure 6 An example of decoding of a whale individual provided by an embodiment of the present invention;
[0108] Figure 7 A schematic diagram of a cyclic crossover method provided by an embodiment of the present invention;
[0109] Figure 8 A schematic diagram of a sequential crossover method provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0110] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention are clearly and completely described. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0111] The embodiments of the present application provide a hybrid vehicle path optimization method, system, storage medium and electronic device based on a genetic and whale hybrid algorithm to solve the technical problem that the long-distance transportation of electric vehicles does not take the battery replacement link into consideration, resulting in the inability to actually apply the generated path optimization solution.
[0112] The technical solution in the embodiment of the present application is to solve the above technical problems, and the overall idea is as follows:
[0113] The embodiment of the present invention proposes a fuel-electric hybrid vehicle optimization model. With the increasing development of electric vehicle technology and supporting facilities, electric vehicles can replace fuel vehicles for logistics distribution. However, the use of electric vehicle distribution requires huge costs in the early stage and a transition period is required. In today's popular form of carbon emissions, it is imperative to balance the huge initial investment with green travel. A hybrid vehicle path optimization model based on reducing carbon emissions is established. The modern emerging whale algorithm is combined with a genetic algorithm and the function of local search is added to the algorithm solution. At the same time, the insertion of a battery swap station in the electric vehicle distribution plan is considered, which solves the embarrassing situation in the situation where electric vehicles replace fuel vehicles.
[0114] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0115] Example:
[0116] like Figure 1 As shown, the embodiment of the present invention provides a hybrid vehicle path optimization method based on a genetic and whale hybrid algorithm, comprising:
[0117] S1. Obtaining task data including at least vehicle, battery swap station, distribution center, and customer node information;
[0118] S2. constructing a hybrid vehicle collaborative delivery model based on the task data;
[0119] S3, solving the mixed vehicle collaborative distribution model by using a hybrid algorithm based on genetics and whales to obtain a mixed vehicle path optimization solution;
[0120] The hybrid vehicle route optimization scheme includes an electric vehicle distribution scheme with battery swap stations inserted: the power required for any electric vehicle in the optimization scheme to reach each node is calculated; if the power of the current electric vehicle arriving at a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and the previous node.
[0121] The embodiment of the present invention adds a battery replacement link to the distribution route optimization link based on existing facilities, which further improves the convenience of using electric vehicles in the distribution environment and contributes to reducing carbon emissions.
[0122] The following will introduce each step of the above technical solution in detail in combination with the specific content and drawings:
[0123] S1. Obtain task data including at least information about vehicles, battery swap stations, distribution centers, and customer nodes.
[0124] The definition is as follows:
[0125] gather:
[0126] C is the set of client nodes, with the subscript c;
[0127] S is the set of locations of battery swap stations, subscript s;
[0128] {o} is the distribution center;
[0129] V is the set of all nodes, V = C∪S∪{o};
[0130] K is the set of cars, subscripted as k.
[0131] parameter:
[0132] U-Car capacity
[0133] u c -Demands from client node c
[0134] d gh -The distance between two points g and h, g, h∈V
[0135] D - Full charge of electric vehicle
[0136] r - rate of battery consumption in electric vehicles
[0137] -The amount of electricity when the electric vehicle reaches / leaves point g, g∈V, k∈K
[0138] F ev / F cv - Fixed costs of electric and fuel vehicles
[0139] Cev / C cv -Variable costs of electric and fuel vehicles
[0140] The time of arrival / departure of the vehicle at the customer point
[0141] tw g Waiting time at customer point g
[0142] tf g Service time at customer point g
[0143] e g The earliest service time required by the customer
[0144] l g The latest service time required by the customer
[0145] t gh The time it takes for the car to travel from point G to point H
[0146] EPU / LPU early / late arrival penalty cost
[0147] Decision variables:
[0148] x ghk If the vehicle passes through point h from point g, then it is 1, otherwise it is 0, g, h∈V, g≠h
[0149] y k 1 if the vehicle is an electric car, 0 otherwise,
[0150] S k If the battery swap station S is selected, it is 1, otherwise it is 0.
[0151] S2. constructing a hybrid vehicle collaborative delivery model based on the task data;
[0152] The hybrid vehicle collaborative delivery model includes:
[0153] Consider the objective function of minimum cost:
[0154] min z=f F +f c +f p
[0155] Among them, f F Indicates that fixed costs are included;
[0156]
[0157] K is the set of cars, subscripted as k; F ev 、F cv Represent the fixed costs of electric vehicles and fuel vehicles respectively; yk is a decision variable, which is 1 if the vehicle is an electric vehicle and 0 otherwise;
[0158] f c represents variable costs, including charging costs for electric vehicles and distance costs for fuel vehicles;
[0159]
[0160] C ev , C cv Represent the variable costs of electric vehicles and fuel vehicles respectively; S k is a decision variable, which is 1 if the battery swap station S is selected, otherwise it is 0; V represents the set of all nodes, V = C∪S∪{o}; C is the set of customer nodes, subscripted as c; S is the set of battery swap stations, subscripted as s; {o} represents the distribution center; d gh represents the distance between any two nodes g and h; x ghk is a decision variable, which is 1 if the vehicle passes through point h from point g, otherwise it is 0;
[0161] f p represents the time penalty cost;
[0162]
[0163]
[0164] They represent the time when the vehicle arrives at and leaves the customer node respectively; epu and lpu represent the penalty costs for the vehicle arriving early and late at the customer node respectively; e g , l g Respectively represent the earliest and latest service times required by the customer.
[0165] The hybrid vehicle collaborative delivery model also includes constraints:
[0166] (1)∑ g∈V,g≠v x gvk =∑ h∈V,h≠v x vhk , k∈K,
[0167] It means that the vehicle entering a node must leave the node and the vehicle will eventually return to the distribution center;
[0168] (2)
[0169] It means that a customer point can only have one vehicle to provide delivery service and only provide service once;
[0170] (3)
[0171] Indicates that the total demand for each vehicle’s service cannot exceed the vehicle’s load capacity; u c represents the demand of customer node c; U represents the vehicle capacity;
[0172] (4)
[0173] It indicates the relationship between the power of the two nodes before and after the vehicle during driving: only when the vehicle is an electric vehicle and the vehicle starts from g to visit h, that is, y k =x ghk =1, the battery capacity of the vehicle will decrease; r represents the battery consumption rate of the electric vehicle;
[0174] (5)
[0175] It means that the electric vehicle at the customer node has the same charge when it arrives and leaves;
[0176] (6)
[0177] It indicates that the electric vehicle is fully charged when it leaves the distribution center; D indicates the full charge of the electric vehicle;
[0178] (7)
[0179] Indicates that the electric vehicle is fully charged when it leaves the battery swap station;
[0180] (8)
[0181] Indicates that when the vehicle departs from the distribution center, the time is 0;
[0182] (9)t gh =d gh / speed,g,h∈V,
[0183] Indicates the calculation of driving time, speed indicates the vehicle speed;
[0184] (10) And g≠h,
[0185] It means that the time when a vehicle arrives at node h is equal to the time when the vehicle leaves the previous node g plus the time it takes to travel from node g to node h;
[0186] (11)
[0187] If the vehicle arrives at customer node g earlier than the earliest service time e required by customer node g, g , then the vehicle needs to wait until the earliest service time e g To start the service, the waiting time is Otherwise, no need to wait, tw g is 0;
[0188] (12)
[0189] It means that the time when the vehicle leaves the customer node is equal to the time when it arrives at the customer node plus the waiting time and service time.
[0190] S3, solving the mixed vehicle collaborative distribution model by using a hybrid algorithm based on genetics and whales to obtain a mixed vehicle path optimization solution;
[0191] It needs to be emphasized again that in the existing basic hybrid vehicle model, it is assumed that the electric vehicle's mileage meets the delivery mileage and does not include the location of the battery swap station. However, in real life, long-distance transportation is an inevitable disadvantage of electric vehicles. On the basis of existing facilities, the battery swap link is added to the distribution route optimization link, which further improves the convenience of electric vehicles in the distribution environment and their contribution to reducing carbon emissions.
[0192] In order to overcome the above-mentioned defects, the hybrid vehicle path optimization scheme obtained based on the genetic and whale hybrid algorithm in this step includes an electric vehicle distribution scheme with battery swap stations inserted: the power required for any electric vehicle in the optimization scheme to reach each node is calculated; if the power of the current electric vehicle reaching a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and its previous node.
[0193] The whale algorithm is a new group intelligence optimization algorithm that imitates the hunting behavior of whales in nature. Whale hunting can be divided into three behaviors: ① surrounding prey; ② attacking with a bubble net; ③ searching for prey. The whale hunting behavior is to obtain the location of the prey through the emitted sonar. When a group of whales hunt, there must be a whale that first discovers the approximate location of the prey, and then approaches the prey through group communication to form an encirclement and organize an attack, and finally achieves the purpose of predation. This algorithm retains the simplicity of the parameters of the whale algorithm, combines the characteristics of the vehicle routing problem (VRP), introduces the crossover step in the genetic algorithm into the update of the whale position of the whale algorithm, mixes the powerful search ability of the genetic algorithm, and adds local search to improve the quality of the solution.
[0194] Specifically, S3 includes:
[0195] S31. Initialize the whale population according to the task data, and any whale individual in the population includes the electric vehicle distribution plan inserted into the battery swap station after decoding; including:
[0196] S311. According to the task data, the whale individuals are encoded by real number encoding, specifically, the number 0 represents the distribution center; 1, ..., n represents the customer node; n+1, ..., n+m represents the location of the battery swap station; the total maximum number of vehicles K that can be used by the distribution center is equal to the maximum number of fuel vehicles maxfv plus the number of electric vehicles maxev, then the individual code can be randomly generated by real numbers 1, ..., n+K-1, where the real numbers n+1, ..., n+K-1 are vehicle segmentation points;
[0197] like Figure 2 As shown, assuming that 0 represents the distribution center, 1-14 are customer nodes, the maximum number of fuel vehicles is 3, and the maximum number of electric vehicles is 3, then the number of segmentation points is 3+3-1=5, of which 15-19 are vehicle segmentation points, that is, points greater than 14 are vehicle segmentation points.
[0198] S312, decoding the whale individuals, and obtaining vehicle distribution plans for fuel vehicles and electric vehicles plugged into the battery swap station;
[0199] S3121. Obtain the vehicle distribution plan for fuel vehicles.
[0200] like Figure 3 As shown, according to the maximum number of fuel vehicles used maxfv, the coding segment before the maxfv-th vehicle segmentation point appears is extracted, and the selected segment is divided into at most maxfv parts using a value greater than n in the front coding segment, and each segment represents a client node visited by each fuel vehicle;
[0201] S3122, obtaining a distribution plan for electric vehicles that are not plugged into a battery swap station,
[0202] like Figure 4 As shown, extract the coding segment after the maxfvth vehicle segmentation point appears, and use a value greater than n in the latter part of the coding segment to divide the selected segment into at most maxev parts, each of which represents a customer node visited by each electric vehicle;
[0203] S3123, obtaining a vehicle distribution plan for electric vehicles inserted into the battery swap station,
[0204] like Figure 5 As shown, the distance from any electric vehicle in the above electric vehicle distribution plan without inserting a battery swap station to the i-th customer node from the distribution center is calculated, and the remaining power of the current electric vehicle to reach the i-th customer node is obtained according to the distance until it can return to the distribution center;
[0205] When the remaining power is less than 0%, return to the i-1th customer node, find the location of the nearest power swap station to the i-1th customer node based on the current location, calculate the remaining power of the i-1th customer node to reach the nearest power swap station, and if the remaining power is sufficient to reach the power swap station, insert the power swap station number between the i-1th and i-th customer nodes;
[0206] If not, continue to return to the i-2th customer node and repeat the above search operation until the battery swap station can be reached and the battery swap is performed. After the battery swap, the order of reaching the unvisited customer nodes from the battery swap station is calculated, and the remaining power to reach the remaining customer nodes is obtained based on the distance, and the above operation is continued to repeat;
[0207] S313, such as Figure 6 As shown, the vehicle distribution plan for fuel vehicles and the vehicle distribution plan for electric vehicles inserted into the battery swap station are combined to obtain the solution corresponding to any individual whale in the initial whale population.
[0208] S32. According to the hybrid vehicle collaborative delivery model, the objective function value corresponding to each whale individual is calculated to obtain the local optimal individual and use it as the global optimal individual;
[0209] In particular, in this step, the vehicle load constraint can also be converted into a penalty cost. If violated, an infinite penalty is given to calculate the distance between the individual whale and the prey (the smaller the target value, the closer the distance to the prey).
[0210] S33, the introduced genetic algorithm crossover operation completes the update of whale individuals; including:
[0211] Define the local optimal individual as X * , the remaining whale individuals are X i , then the update formula is:
[0212]
[0213] Among them, rand means generating a random number between 0 and 1;
[0214] cross1 indicates a cyclic crossover mode, such as Figure 7 As shown, including:
[0215] S10, randomly select element e1 at position i1 of whale individual 1, find element e2 at the same position i1 of individual 2, then go back to individual 1 to find position i2 where element e2 is located, and repeat the process until a closed loop is reached;
[0216] S11, replace the positions of the values on the two individuals in order, and complete the update of the current whale individual;
[0217] cross2 indicates a sequential crossover mode, such as Figure 8 As shown, including:
[0218] S100, randomly select the positions of any individuals in whale individual 1, and record the corresponding numerical position sequence, select the same numerical value in individual 2, and record the position sequence of individual 2;
[0219] S101, the numerical position order of individual 1 is reinserted into individual 1 according to the numerical position order of individual 2, and the numerical values selected by individual 2 are reinserted into the individual according to the order of numerical values selected by individual 1.
[0220] S34, after performing a local search on the updated whale population, obtain the current local optimal individual, and update the global optimal individual;
[0221] In this step, a local search method using a reversal operation and / or an insertion operation is specifically used, including:
[0222] The definition of a whale individual can be expressed as:
[0223] R=[R(1), R(2),..., R(i), R(i+1),..., R(j-1), R(j),..., R(N+K-2), R(N+K-1)];
[0224] (1) The reversal operation local search method refers to reversing the order of all elements between two positions on the whale individual. If the selected reversal positions are i and j, reversing all elements between the i-th and j-th positions, the sorted solution can be expressed as:
[0225] R=[R(1), R(2),..., R(j), R(j-1),..., R(i+1), R(i),..., R(N+K-2), R(N+K-1)];
[0226] (2) The insertion operation local search method refers to inserting the i-th position element into the j-th position element, and the sorted solution is expressed as:
[0227] R=[R(1), R(2), ..., R(i+1), ..., R(j-1), R(j), R(i), ..., R(N+K-2), R(N+K-1)].
[0228] Specifically, if the target value corresponding to the current local optimal individual is greater than the target value of the global optimal individual, the global optimal individual is replaced by the current local optimal individual, otherwise the global optimal individual determined in the previous cycle is retained.
[0229] S35, determine whether the maximum update iteration number is reached, if so, proceed to S36; otherwise, proceed to S33;
[0230] S36: Output the final global optimal individual, and decode to obtain the hybrid vehicle path optimization solution.
[0231] The embodiment of the present invention provides a hybrid vehicle path optimization system based on a genetic and whale hybrid algorithm, comprising:
[0232] A data acquisition module, used to acquire task data including at least vehicle, battery swap station, distribution center, and customer node information;
[0233] A model building module, used for building a hybrid vehicle collaborative delivery model according to the task data;
[0234] A solution solving module is used to solve the mixed vehicle collaborative distribution model by using a genetic and whale hybrid algorithm to obtain a mixed vehicle path optimization solution;
[0235] The hybrid vehicle route optimization scheme includes an electric vehicle distribution scheme with battery swap stations inserted: the power required for any electric vehicle in the optimization scheme to reach each node is calculated; if the power of the current electric vehicle arriving at a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and the previous node.
[0236] An embodiment of the present invention provides a storage medium storing a computer program for hybrid vehicle path optimization based on a genetic and whale hybrid algorithm, wherein the computer program enables a computer to execute the hybrid vehicle path optimization method as described above.
[0237] An embodiment of the present invention further provides an electronic device, including:
[0238] one or more processors;
[0239] Memory; and
[0240] One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the programs including instructions for executing the hybrid vehicle path optimization method as described above.
[0241] It can be understood that the hybrid vehicle path optimization system, storage medium and electronic device based on genetic and whale hybrid algorithms provided in the embodiments of the present invention correspond to the hybrid vehicle path optimization method based on genetic and whale hybrid algorithms provided in the embodiments of the present invention. The explanations, examples and beneficial effects of the relevant contents can refer to the corresponding parts in the hybrid vehicle path optimization method and will not be repeated here.
[0242] In summary, compared with the prior art, the present invention has the following beneficial effects:
[0243] In the embodiment of the present invention, task data of vehicles, battery swap stations, distribution centers, and customer nodes are obtained; a hybrid vehicle collaborative distribution model is constructed based on the task data; the hybrid vehicle collaborative distribution model is solved by a genetic and whale hybrid algorithm to obtain a hybrid vehicle path optimization plan; the hybrid vehicle path optimization plan includes an electric vehicle distribution plan with battery swap stations inserted: the amount of electricity required for any electric vehicle to reach each node in the optimization plan is calculated, and if the current amount of electricity of the electric vehicle to reach a certain node is less than or equal to zero, and the remaining electricity at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and the previous node. Adding the battery swap link to the distribution path optimization link based on existing facilities further improves the convenience of using electric vehicles in the distribution environment and its contribution to reducing carbon emissions.
[0244] It should be noted that, in this article, relational terms such as first and second, etc. 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.
[0245] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A hybrid vehicle routing optimization method based on genetic and whale hybrid algorithms, characterized in that: include: S1. Obtaining task data including at least vehicle, battery swap station, distribution center, and customer node information; S2. constructing a hybrid vehicle collaborative delivery model based on the task data; S3, solving the mixed vehicle collaborative distribution model by using a hybrid algorithm based on genetics and whales to obtain a mixed vehicle path optimization solution; The hybrid vehicle route optimization scheme includes an electric vehicle distribution scheme with an inserted battery swap station: the power required by any electric vehicle in the optimization scheme to reach each node is calculated. If the power of the current electric vehicle arriving at a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and the previous node; The S3 specifically includes: S31. Initializing a whale population according to the task data, wherein any individual whale in the population includes an electric vehicle distribution plan inserted into a battery swap station after decoding; S32. According to the hybrid vehicle collaborative delivery model, the objective function value corresponding to each whale individual is calculated to obtain the local optimal individual and use it as the global optimal individual; S33, the introduced genetic algorithm crossover operation completes the update of whale individuals; S34, after performing a local search on the updated whale population, obtain the current local optimal individual, and update the global optimal individual; S35, determine whether the maximum number of update iterations has been reached, if so, proceed to S36; otherwise, proceed to S33; S36, outputting the final global optimal individual, decoding and obtaining the hybrid vehicle path optimization solution; The S31 includes: S311. According to the task data, the whale individuals are encoded by real number encoding, specifically, the number 0 represents the distribution center; 1, ..., n represents the customer node; n+1, ..., n+m represents the location of the battery swap station; the total maximum number of vehicles K that can be used by the distribution center is equal to the maximum number of fuel vehicles maxfv plus the number of electric vehicles maxev, then the individual encoding is randomly generated by real numbers 1, ..., n+K-1, where the real numbers n+1, ..., n+K-1 are vehicle segmentation points; S312, decoding the whale individuals, and obtaining vehicle distribution plans for fuel vehicles and electric vehicles plugged into the battery swap station; S3121. Obtain the vehicle distribution plan for fuel vehicles. According to the maximum number of fuel vehicles in use, maxfv, extract the coded segments before the maxfvth vehicle segmentation point, and use a value greater than n to divide the selected segments into at most maxfv parts in the coded segments before the vehicle segmentation point. Each segment represents a client node visited by each fuel vehicle. S3122, obtaining a distribution plan for electric vehicles that are not plugged into a battery swap station, Extract the coded segments after the maxfvth vehicle segmentation point, and use a value greater than n to divide the selected segments into at most maxev parts in the coded segments after the vehicle segmentation point, each of which represents a customer node visited by each electric vehicle; S3123, obtaining a vehicle distribution plan for electric vehicles inserted into the battery swap station, Calculate the distance from the distribution center to the i-th customer node for any electric vehicle in the above electric vehicle distribution plan without inserting a battery swap station, and derive the remaining power of the current electric vehicle to reach the i-th customer node according to the distance until it can return to the distribution center; When the remaining power is less than 0%, return to the i-1th customer node, find the location of the nearest power swap station to the i-1th customer node based on the current location, calculate the remaining power of the i-1th customer node to reach the nearest power swap station, and if the remaining power is sufficient to reach the power swap station, insert the power swap station number between the i-1th and i-th customer nodes; If not, continue to return to the i-2th customer node and repeat the above search operation until the battery swap station can be reached and the battery swap is performed. After the battery swap, the order of reaching the unvisited customer nodes from the battery swap station is calculated, and the remaining power to reach the remaining customer nodes is obtained based on the distance, and the above operation is continued to repeat; S313, combining the vehicle distribution plan of fuel vehicles and the vehicle distribution plan of electric vehicles inserted into the battery swap station, and obtaining a solution corresponding to any individual whale in the initial whale population; The S33 specifically includes: Define the local optimal individual as X * , the remaining whale individuals are X i , then the update formula is: Among them, rand means generating a random number between 0 and 1; cross1 indicates the cyclic cross mode, including: S10, randomly select element e1 at position i1 of whale individual 1, find element e2 at the same position i1 of individual 2, then go back to individual 1 to find position i2 where element e2 is located, and repeat the process until a closed loop is reached; S11, replace the positions of the values on the two individuals in order, and complete the update of the current whale individual; cross2 indicates the sequential crossover mode, including: S100, randomly select the positions of any individuals in whale individual 1, and record the corresponding numerical position sequence, select the same numerical value in individual 2, and record the position sequence of individual 2; S101, the numerical position order of individual 1 is reinserted into individual 1 according to the numerical position order of individual 2, and the numerical value selected by individual 2 is reinserted into the individual according to the numerical value order selected by individual 1; The hybrid vehicle collaborative delivery model in S2 includes: Consider the objective function of minimum cost: minz=f F +f c +f p Among them, f F Indicates that fixed costs are included; K is the car set, subscripted as k; F ev 、F cv Represent the fixed costs of electric vehicles and fuel vehicles respectively; y k is a decision variable, which is 1 if the vehicle is an electric vehicle and 0 otherwise; f c represents variable costs, including charging costs for electric vehicles and distance costs for fuel vehicles; C ev , C cv Represent the variable costs of electric vehicles and fuel vehicles respectively; S k is a decision variable, which is 1 if the battery swap station S is selected, otherwise it is 0; V represents the set of all nodes, V = C∪S∪{o}; C is the set of customer nodes, subscripted as c; S is the set of battery swap stations, subscripted as s; {o} represents the distribution center; d gh represents the distance between any two nodes g and h; x ghk is a decision variable, which is 1 if the vehicle passes through point h from point g, otherwise it is 0; f p represents the time penalty cost; represents the time when the vehicle arrives at the customer node; epu and lpu represent the penalty costs for the vehicle arriving early and late at the customer node respectively; e g , l g Respectively represent the earliest and latest service times required by the customer; The hybrid vehicle collaborative delivery model in S2 also includes constraints: (1)∑ g∈V,g≠v x gvk =∑ h∈V,h≠v x vhk ,k∈K, It means that the vehicle entering a node must leave the node and the vehicle will eventually return to the distribution center; (2) It means that a customer point can only have one vehicle to provide delivery service and only provide service once; (3) Indicates that the total demand for each vehicle’s service cannot exceed the vehicle’s load capacity; u c represents the demand of customer node c; U represents the vehicle capacity; (4) It indicates the relationship between the power of the two nodes before and after the vehicle during driving: only when the vehicle is an electric vehicle and the vehicle starts from g to visit h, that is, y k =x ghk =1, the battery capacity of the vehicle will decrease; r represents the battery consumption rate of the electric vehicle; (5) It means that the electric vehicle at the customer node has the same charge when it arrives and leaves; (6) It indicates that the electric vehicle is fully charged when it leaves the distribution center; D indicates the full charge of the electric vehicle; (7) Indicates that the electric vehicle is fully charged when it leaves the battery swap station; (8) Indicates that when the vehicle departs from the distribution center, the time is 0; (9)t gh =d gh / speed,g,h∈V, Indicates the calculation of driving time, speed indicates the vehicle speed; (10) It means that the time when a vehicle arrives at node h is equal to the time when the vehicle leaves the previous node g plus the time it takes to travel from node g to node h; (11) If the vehicle arrives at customer node g earlier than the earliest service time e required by customer node g, g , then the vehicle needs to wait until the earliest service time e g To start the service, the waiting time is Otherwise, no need to wait, tw g is 0; (12) Indicates the time when the vehicle leaves the customer node It is equal to the time to reach the customer node plus the waiting time and service time.
2. The hybrid vehicle path optimization method according to claim 1, characterized in that: The S34 specifically adopts a reversal operation local search method and / or an insertion operation local search method, including: The definition of a whale individual can be expressed as: R=[R(1), R(2),…, R(i), R(i+1),…, R(j-1), R(j),…, R(N+K-2), R(N+K-1)]; (1) The reversal operation local search method refers to reversing the order of all elements between two positions on the whale individual. If the selected reversal positions are i and j, reversing all elements between the i-th and j-th positions, the sorted solution can be expressed as: R=[R(1), R(2),…, R(j), R(j-1),…, R(i+1), R(i),…, R(N+K-2), R(N+K-1)]; (2) The insertion operation local search method refers to inserting the i-th position element after the ,th position element. The sorted solution is expressed as: R=[R(1), R(2), ..., R(i+1), ..., R(j-1), R(j), R(i), ..., R(N+K-2), R(N+K-1)].
3. A hybrid vehicle routing optimization system based on genetic and whale hybrid algorithms, characterized in that: The method for performing the hybrid vehicle path optimization method as claimed in claim 1 comprises: A data acquisition module, used to acquire task data including at least vehicle, battery swap station, distribution center, and customer node information; A model building module, used for building a hybrid vehicle collaborative delivery model according to the task data; A solution solving module is used to solve the mixed vehicle collaborative distribution model by using a genetic and whale hybrid algorithm to obtain a mixed vehicle path optimization solution; The hybrid vehicle route optimization scheme includes an electric vehicle distribution scheme with battery swap stations inserted: the power required for any electric vehicle in the optimization scheme to reach each node is calculated; if the power of the current electric vehicle arriving at a certain node is less than or equal to zero, and the remaining power at the previous node of the node is sufficient to reach the nearest battery swap station, the nearest battery swap station is inserted between the node and the previous node.
4. A storage medium, characterized in that: The computer stores a computer program for hybrid vehicle path optimization based on a genetic and whale hybrid algorithm, wherein the computer program enables the computer to execute the hybrid vehicle path optimization method as claimed in claim 1 or 2.
5. An electronic device, characterized in that: include: one or more processors; Memory; as well as One or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, the programs including instructions for executing the hybrid vehicle path optimization method according to claim 1 or 2.
Citation Information
Patent Citations
Nonlinear charging vehicle path optimization method
CN111222705A
Method for solving flexible job shop scheduling based on hybrid genetic algorithm
CN111967654A