A two-dimensional packing vehicle path planning method based on improved particle swarm optimization algorithm
By improving the particle swarm algorithm and PSO algorithm, combined with Skyline packing strategy, the two-dimensional packing vehicle path planning is optimized, solving the problem of insufficient optimization and timeline path planning in the existing technology, and achieving high efficiency of cargo transportation and cost reduction.
Patent Information
- Application Number
- CN202410609079.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2044-05-16
AI Technical Summary
When solving the problem of vehicle path planning under two-dimensional loading constraints, it is difficult to ensure optimality and timeliness. When the cargo demand exceeds the vehicle loading limit, it is difficult to effectively optimize the packing and path planning. Related research is relatively Lack.
The improved particle swarm algorithm is adopted, and through data preprocessing and particle swarm evolution algorithm, combined with the PSO algorithm and Skyline packing strategy, the order encoding and transportation scheme is optimized, and the order can be determined whether the order can be carpooled and needs to be split, and the lowest cost transportation scheme is calculated.
It realizes an integrated packaging and transportation planning based on order attributes, optimizes cargo transportation efficiency, reduces logistics transportation costs, and provides a more scientific and efficient transportation solution.
Smart Images

Figure CN118428572B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of vehicle path planning and particle swarm algorithm, and in particular relates to a two-dimensional boxed vehicle path planning method based on an improved particle swarm algorithm. Background Art
[0002] In recent years, the logistics industry has developed rapidly and has begun to take shape. In order to further improve logistics efficiency and ensure the quality of logistics services, the traditional logistics industry urgently needs to further transform into an information-based and intelligent one to reduce transportation costs and improve efficiency. How to optimize transportation routes, design reasonable loading plans, and achieve the goal of reducing logistics costs while taking into account transportation capacity and efficiency has important practical guiding significance.
[0003] In actual logistics and transportation, for the distribution of goods with different volumes that need to be packed, packing and transportation are two mutually constrained and inseparable processes. Researchers proposed the Capacitated vehicle routing problem with two dimensional loading constraints (2L-CVRP) to optimize the distribution route and packing efficiency of goods. This problem refers to placing a certain number of goods in a combination according to order requirements on a two-dimensional plane of a given loading area, and then the vehicle needs to transport these goods to the destination along a certain path. Here, on the one hand, it is necessary to consider factors such as how the shape, size, and weight of the goods adapt to the layout of the loading area and the load of the vehicle. On the other hand, it is also necessary to consider the coupling relationship between the packing order of the goods and the transportation path. On this basis, the optimal path is planned to improve logistics efficiency and reduce transportation costs. Researching and optimizing the vehicle routing problem under two-dimensional loading constraints can provide a more scientific and efficient transportation solution for the logistics and transportation industry, and help improve the operation efficiency and service quality of the entire logistics and transportation system.
[0004] In response to the 2L-CVRP problem, domestic and foreign scholars have proposed many precise or heuristic optimization methods. Wei et al. designed a skyline packing heuristic greedy algorithm to solve 2L-CVRP. The algorithm describes the packing pattern through the concepts of upper bound (skyline) and coordinate point (candidate position), and can quickly give an acceptable packing solution. Iori et al. used a branch and bound algorithm to solve the lower bound of the problem in 2007, and at the same time tested the feasibility of packing. Fuellerer et al. used an ant colony algorithm to solve the problem, and achieved certain advantages in solving large-scale examples.
[0005] However, the optimization algorithm that uses the above heuristic or exact algorithm to interact has the disadvantages of being difficult to guarantee optimality and timeliness. Some algorithms simply combine the greedy path planning method with the Skyline algorithm, so they cannot coordinate the optimization of the two sub-problems of packing and path planning, and it is difficult to obtain a satisfactory solution. In addition, in the actual logistics transportation process, there are orders where the demand for goods exceeds the vehicle loading limit. At this time, it is necessary to consider splitting the order and packing it for transportation. For this situation, researchers have proposed the 2L-CVRP problem where the goods can be split, but related research is still lacking. Summary of the invention
[0006] In view of this, the present invention provides a two-dimensional packing vehicle path planning method based on an improved particle swarm algorithm, which realizes the integrated planning of packing and transportation based on the actual cargo order attributes.
[0007] The present invention provides a two-dimensional container vehicle path planning method based on an improved particle swarm algorithm, comprising the following steps:
[0008] Step 1: pre-process the order data, initialize the dispatch truck data and city distance data; divide the order i into a set of carpooling orders Sh1 and a set of non-carpooling orders Sh0 according to whether carpooling is possible; execute step 2 for the orders in set Sh1, and execute step 3 for the orders in set Sh0;
[0009] Step 2: Use the PSO algorithm to encode the order into an ordered sequence, and then randomly shuffle the ordered sequence Ps times to obtain Ps randomly sorted sequences as individual particles. These individual particles form the first generation of particle swarm population, and set the population size Ps and the maximum number of iterations M. g , individual learning probability α and group learning probability β, execute step 4;
[0010] Step 3: Divide the orders into a set Sp0 of orders that do not need to be split and a set Sp1 of orders that need to be split. For the orders in set Sp1, the principle of minimum splitting is used to determine the total number of trucks required, and the number of pallets of goods remaining in the order is calculated. Then, the reorganized orders formed by the remaining pallets are added to the set Sp0, and the order costs are calculated. After traversing and matching trucks for the orders in set Sp0, the order costs are calculated. The sum of the order costs of all orders in sets Sp0 and Sp1 is the total cost of set Sh0. At the same time, the transportation plan of set Sh0 is obtained, and step 7 is executed.
[0011] Step 4: Calculate the fitness of each individual particle in the first generation of the particle swarm population. The fitness value is the inverse of the total cost of the order sequence corresponding to the particle individual. The position of the particle individual in the sorting sequence of the first generation of the particle swarm population is taken as its first generation optimal position. Its fitness in the first generation is taken as the optimal fitness value of the first generation The order of individuals with the highest fitness value in the first generation of the particle swarm population is taken as the first generation optimal position of the population. This highest fitness value is used as the first generation optimal fitness value of the group
[0012] Step 5: Execute the particle swarm algorithm, according to the position of the current d generation of the i-th particle individual Calculate its speed and its place in the next generation
[0013] Step 6: If the current number of iterations does not reach the maximum number of iterations, execute step 5; otherwise, the optimal solution of the current particle swarm population is And the fitness value of the optimal solution As a final result, and according to Get the optimal order sorting sequence according to Get the minimum cost and execute step 7;
[0014] Step 7: Combine and output the transportation plans for orders that can be carpooled and those that cannot be carpooled, and calculate the transportation costs of all orders.
[0015] Furthermore, in step 3, the orders are divided into a set Sp0 of orders that do not need to be split and a set Sp1 of orders that need to be split, and the following formula is used to determine whether the i-th order needs to be split:
[0016]
[0017] Among them, M A is the maximum load of vehicle type A, t i is the total mass of goods in the i-th order, n i is the total number of pallets for the i-th order, N A is the maximum number of pallets of the i-th order that can be loaded on vehicle A;
[0018] N A Calculated by the following formula:
[0019] N A =max{[L A / l i ]·[W A / w i ],[L A / w i ]·[W A / l i ]}
[0020] Among them, L Ais the length of the loading area of vehicle type A, W A Indicates the width of the loading area of model A, l i and w i They represent the length and width of the cargo in the i-th order respectively, and [ ] represents the rounding operator.
[0021] Furthermore, in step 3, after traversing and matching trucks for the orders in the set Sp0, the order fees are calculated, including:
[0022] Assume that the truck model corresponding to the i-th order is x i , traverse the vehicle types from small to large according to the load limit until x i The most suitable model is determined by satisfying the following formula:
[0023]
[0024] in, For x i The upper load limit of the vehicle type, t i is the total mass of goods in the i-th order, n i is the total number of pallets for the i-th order, For x i The maximum number of pallets of cargo that can be loaded on the vehicle is the number of pallets of cargo for the ith order;
[0025] Record the current order number on i The corresponding model x i , and calculate the cost of a single order:
[0026]
[0027] The total cost of all non-carpooling and non-split orders is:
[0028]
[0029] For vehicle model x i The corresponding cost per kilometer, d i is the city distance between the origin and destination of the i-th order.
[0030] Furthermore, in step 3, the total number of trucks required is determined by adopting the minimum splitting principle for the orders in the set Sp1, and the number of remaining pallets of goods for the order is calculated, and then the reorganized order formed by the remaining pallets of goods is added to the set Sp0, and the order fee is calculated, including:
[0031] Use the truck with the largest load limit to load the goods in a loop until the remaining goods of the order are updated to no longer need to be split. Calculate the number of times a that the i-th order needs to be loaded in a loop. i :
[0032]
[0033] Among them, n i is the total number of pallets for the i-th order, The maximum number of pallets of goods for the i-th order that can be loaded on the truck with the largest load limit;
[0034] At this time, the number of pallets remaining for the i-th order is n′ i for:
[0035]
[0036] By the number of pallets n′ i Form a reorganized order; record the truck model corresponding to the remaining goods as x i , current order number on i The model of the truck with the largest load limit is A i , the cost of the order is calculated using the following formula:
[0037]
[0038] in, For Model A i The corresponding cost per kilometer is For vehicle model x i The corresponding cost per kilometer, d i is the city distance between the origin and destination of the i-th order.
[0039] Furthermore, the step 4 of calculating the fitness of each individual particle in the first generation of the particle swarm population includes:
[0040] Step 5.1, read in individual particles sequentially, execute step 5.4 for orders that need to be split, and execute step 5.2 for orders that do not need to be split;
[0041] Step 5.2, add the to-be-carpooled vehicles output in the previous order operation to the current to-be-carpooled fleet set;
[0042] Step 5.3: Determine whether the order is a carpooling mode or a new car order mode;
[0043] Step 5.4: Calculate the total cost of carpooling without splitting the order
[0044] Step 5.5: For orders that can be shared and need to be split, load them with the largest model A in a loop. Suppose that the rth single loop loads b r After that, the status of the remaining goods is updated to no need to be split; then the processing method that can be carpooled and does not need to be split is executed to obtain the loading method of the remaining goods, among which the lowest cost carpooling vehicle corresponding to the carpooling order r′ is Yr’ ; The appropriate truck model selected for the order r″ in the new car mode is x r” , the cost of the order is:
[0045]
[0046] Among them, d r is the city distance between the origin and destination of the rth order, For Model A r The corresponding cost per kilometer, b r The number of A vehicles required for the rth order, For vehicle model x r” The corresponding cost per kilometer, d r″ is the city distance between the origin and destination of the r″th order, For model Y r’ The corresponding cost per kilometer, d r′ is the city distance between the origin and destination of the r′th order;
[0047] Step 5.6: The total cost of a single sequence, i.e., all carpoolable orders, is:
[0048]
[0049] The fitness value F is:
[0050] Furthermore, determining in step 5.3 whether the order is a carpooling mode or a single new car ordering mode includes:
[0051] Step 5.3.1: If there are vehicles in the set of waiting carpooling fleets, select a vehicle from the set of waiting carpooling fleets and execute step 5.3.2; if there are no vehicles in the set of waiting carpooling fleets, execute step 5.3.6;
[0052] Step 5.3.2: If the remaining load of the truck is greater than the total weight of the current order, execute step 5.3.3; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1;
[0053] Step 5.3.3: After adding the current order destination, if the number of destinations does not exceed 3, execute step 5.3.4; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1;
[0054] Step 5.3.4: Apply the Skyline packing strategy to each pallet of goods in the order to determine whether all the goods in the order can be put into the truck. If they can be put into the truck, keep the truck in the waiting carpooling fleet and execute step 5.3.1; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1; if all vehicles in the waiting carpooling fleet have been traversed, execute step 5.3.5;
[0055] Step 5.3.5: If there are z trucks that meet the conditions in the carpooling fleet searched for the k′th order, and the model of each truck is Then select the car with the lowest cost for carpooling; otherwise, if there is no available car in the carpooling fleet, execute step 5.3.6;
[0056] Suppose the lowest cost carpooling vehicle for the k′th order is Y k’ , then Y k’ satisfy:
[0057]
[0058] Among them, d k’ For vehicle Y k’ The distance from the original destination to the destination of order k′; similarly For vehicles The distance from the original destination to the destination of order k′; then order k′ is set to carpooling mode;
[0059] The cost of a single order in the carpooling mode is:
[0060] Step 5.3.6: Set the order to the single new vehicle mode and treat the order as an order that does not need to be split. Suppose the appropriate truck model selected for the k″th order is x k” , then the cost of a single order in the new car mode is: And the truck x k” Join the carpooling fleet.
[0061] Furthermore, the speed in step 5 and location The calculation formula is as follows:
[0062]
[0063] in, is the optimal solution or optimal position of the dth generation of the i-th particle individual, is the global optimal solution or optimal position of the dth generation, α is the individual learning probability, that is, the probability of learning from the individual historical optimal sequence, β is the group learning probability, that is, the probability of learning from the group historical optimal sequence, (α, β∈[0,1]); The basic exchange sequence All the commutators in are retained with probability α to obtain the resulting commutator sequence, The basic exchange sequence All commutators in are retained with probability β to obtain the resulting commutator sequence.
[0064] Beneficial effects:
[0065] The present invention aims at the widespread path planning problem in the logistics industry, takes into account practical scenarios such as cargo packing and mixed loading after splitting, and establishes a vehicle path planning algorithm under two-dimensional packing constraints based on an improved particle swarm algorithm. It determines the packing and transportation methods according to the attributes of the order such as whether it can be carpooled and whether it can be split, and calculates the transportation cost, so as to select the best transportation plan with lower cost, thereby improving the efficiency of cargo transportation and reducing the logistics transportation cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Figure 1 A schematic flow chart of a two-dimensional box vehicle path planning method based on an improved particle swarm algorithm provided by the present invention.
[0067] Figure 2 A calculation flow chart of a single sequence fitness value in a two-dimensional box vehicle path planning method based on an improved particle swarm algorithm provided by the present invention.
[0068] Figure 3 This is a cross-sectional diagram of cargo loading in a truck. DETAILED DESCRIPTION
[0069] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0070] The present invention establishes the following constraints:
[0071] 1. Carpooling is allowed for some goods;
[0072] 2. Allow vehicles to stop at a maximum of N unloading points;
[0073] 3. The vehicle types include T type;
[0074] 4. Minimize the splitting of delivery orders as much as possible. If splitting is necessary, split it by pallet;
[0075] 5. When calculating the cost, only the outbound freight is considered, not the return freight.
[0076] The symbol definitions are shown in the following table:
[0077] Table 1 Symbol definition table
[0078]
[0079]
[0080]
[0081] Problem description: There are several orders with the same departure point but different destinations, each order contains several goods; there are several types of trucks available for transportation; how to establish a mapping from each order to the truck model and transportation route to minimize the total cost of all orders.
[0082] Decision variables: mapping of each order to truck model and transportation route
[0083] Optimization goal: Minimize the total cost of all orders: The total cost is related to the truck model and transportation route selection.
[0084] The present invention provides a two-dimensional container vehicle path planning method based on an improved particle swarm algorithm, and its processing flow is as follows: Figure 1 As shown, it mainly includes the following steps:
[0085] Step 1: Preprocess the order data and merge and organize the following initial data: order number, material PN code, origin, destination, number of pallets, total weight, single pallet weight, length, and width; initialize the dispatch truck data, including the length and width of the loading area, maximum load, and per-kilometer fee of each truck model; initialize the city distance data and generate a distance data set S between all cities.
[0086] The order includes the content of transporting a certain number of pallets of goods from the origin to the destination, and the order clearly states the total weight, length and width of the goods.
[0087] Step 2: Divide the order i into two sets according to whether carpooling is possible, namely, carpooling order set Sh1 and non-carpooling order set Sh0; execute step 3 for the orders in set Sh1, and execute step 4 for the orders in set Sh0.
[0088] Step 3: Use the PSO algorithm to initialize and encode all orders in the set Sh1 to form an ordered sequence. Randomly shuffle the ordered sequence Ps times to obtain Ps initial random sorting sequences, i.e., individual particles. The first generation of particle swarm population is composed of Ps individual particles. Set the population size Ps and the maximum number of iterations M. g , individual learning probability α and group learning probability β, proceed to step 5.
[0089] By encoding all the orders in the set Sh1, a mapping relationship between the transportation problem and the particle swarm evolution algorithm is established. The optimal individual is obtained through the iterative evolution of the particle swarm, and then the specific total cost and transportation plan can be obtained after decoding. Among them, the transportation plan refers to the correspondence between orders and trucks.
[0090] Encode all orders in the set Sh1, specifically: number all carpooling orders, assuming there are E carpooling orders, and encode them into an ordered sequence of {1, 2, 3, ..., E}; in order to randomly generate Ps unordered sequences as particle individuals, the ordered sequence needs to be randomly shuffled Ps times, thereby obtaining Ps initial randomly sorted sequences, namely particle individuals, and all Ps particle individuals constitute the first generation of particle swarm population, completing the encoding.
[0091] Initialize the particle swarm optimization (PSO): set the population size Ps, that is, each generation contains Ps order sorting sequence individuals, the maximum number of iterations Mg, the individual learning probability α and the group learning probability β.
[0092] The significance of coding and mapping: Assign a processing order for carpooling orders. Orders processed earlier can determine the corresponding model earlier and can arrive at the destination first, with a more certain path distance. For orders processed later, more fleets are available for carpooling, which increases the possibility of carpooling and reduces costs, but the time to arrive at the destination is later, and the uncertainty of the path distance increases due to the influence of the destination of the previous order.
[0093] The determination of the model and the choice of the route are coupled, and these two factors are the key factors that determine the final total cost. Therefore, from an overall perspective, by encoding different order processing sequences, and then using evolutionary algorithms to evaluate the pros and cons of different sequence sequences, that is, the total cost, we can avoid directly dealing with the complex coupling problem of model and route.
[0094] Step 4. Divide the orders in the set Sh0 into orders that do not need to be split and orders that need to be split, forming a set Sp0 of orders that do not need to be split and a set Sp1 of orders that need to be split; for the orders in the set Sp1, the principle of minimum splitting is used to determine the total number of trucks required, and the number of pallets of goods remaining in the order is calculated, and then the reorganized orders formed by the remaining pallets are added to the set Sp0, and the order cost is calculated based on the total number of trucks required and the order-related city distances; for the orders in the set Sp0, traverse all vehicle models to find the most suitable truck, and calculate the order cost based on the per-kilometer cost of the truck and the order-related city distances; the sum of the order costs of all orders in the set Sp0 and the set Sp1 is the total cost of the set Sh0, and the transportation plan for the set Sh0 is obtained by the matching process, and then execute step 8.
[0095] Since each order consists of several pallets of goods with the same length and width, and the total mass or volume of the goods may exceed the loading range of the largest vehicle model, it is necessary to first determine whether the current order needs to be split because it is too large, and then further process it according to the split status, including:
[0096] Step 4.1: If the quantity of goods in the order is less than or equal to the maximum carrying capacity of a certain vehicle type, it means that the order does not need to be split, and the order is added to the set Sp0; otherwise, the order is added to the set Sp1.
[0097] The judgment rule for the i-th order is as follows:
[0098]
[0099] Among them, M A is the maximum load of vehicle type A, t i is the total mass of goods in the i-th order, n i is the total number of pallets for the i-th order, N A is the maximum number of pallets of goods for the i-th order that vehicle A can load.
[0100] N A Calculated by the following formula:
[0101] N A =amx{[L A / l i ]·[W A *w i ],[L A / w i ]·[W A / l i ]}
[0102] Among them, L A is the length of the loading area of vehicle type A, W A Indicates the width of the loading area of model A, l i and w i They represent the length and width of the cargo in the i-th order respectively, and [] represents the rounding operator.
[0103] Therefore, there are two states of orders in the set Sh0, namely: carpooling is not allowed and no splitting is required, represented by i∈Sh0∪Sp0; carpooling is not allowed and splitting is required, represented by i∈Sh0∪Sp1.
[0104] Step 4.2: For orders satisfying i∈Sh0∪Sp0, execute step 4.3; for orders satisfying i∈Sh0∪Sp1, execute step 4.4.
[0105] Step 4.3: Traverse the models from small to large according to the load limit to find the most suitable truck. Assume that the truck model corresponding to the i-th order is x i , until x i The most suitable model is determined by satisfying the following formula:
[0106]
[0107] in, For x i The upper load limit of the vehicle type, t i is the total mass of goods in the i-th order, n i is the total number of pallets for the i-th order, For x i The vehicle can carry at most the number of pallets of the i-th order.
[0108] Record the current order number on i The corresponding model x i , and calculate the cost of a single order:
[0109]
[0110] The total cost of all non-carpooling and non-split orders is:
[0111]
[0112] For vehicle model x i The corresponding cost per kilometer, d i is the city distance between the origin and destination of the i-th order.
[0113] Step 4.4: Use the principle of minimum splitting, that is, use the truck with the largest load limit to load the goods in a loop until the remaining goods of the order are updated to no need to split, and calculate the number of times a that the i-th order needs to be loaded in a loop i :
[0114]
[0115] Among them, n i is the total number of pallets for the i-th order, The maximum number of pallets of goods for the i-th order that can be loaded by a truck with the largest load limit.
[0116] At this time, the number of pallets remaining for the i-th order is n′ i for:
[0117]
[0118] For the remaining number of pallets n′ i Execute step 4.3 to determine the transportation plan for the remaining goods. The truck model corresponding to the remaining goods is recorded as x i , current order number on i The model of the truck with the largest load limit is A i , use the following formula to calculate the cost of the order:
[0119]
[0120] Step 4.5: Output the transportation plan for non-carpooling orders and use the following formula to calculate the total cost of the order:
[0121]
[0122] Step 5: Calculate the fitness of each individual particle in the first generation of the particle swarm population. The fitness value is the inverse of the total cost of the order sequence corresponding to the particle individual. The position of the particle individual in the sorting sequence of the first generation of the particle swarm population is taken as the first generation optimal position of the particle individual. The fitness of the first generation of particle individuals is taken as the optimal fitness value of the first generation of particle individuals. The order of individuals with the highest fitness value in the first generation of the particle swarm population is taken as the first generation optimal position of the population. This highest fitness value is used as the first generation optimal fitness value of the group
[0123] Among them, the total cost and fitness of the order sequence corresponding to the particle individual are calculated as follows: Figure 2 As shown, the specific steps include:
[0124] Step 5.1, read in individual particles sequentially, divide the orders therein into two parts: those that need to be split and those that do not need to be split. For the orders that need to be split, execute step 5.4, and for the orders that do not need to be split (i∈Sh1∪Sp0), execute step 5.2.
[0125] Step 5.2: Initialize the fleet set to be shared, that is, add the vehicles to be shared output in the previous order operation to the fleet set to be shared this time.
[0126] Step 5.3: There are two options available, including carpooling mode (Md=1) and driving a new car alone mode (Md=0). The decision process is as follows:
[0127] Step 5.3.1: If there are vehicles in the set of fleets to be carpooled, select a vehicle from the set of fleets to be carpooled and execute step 5.3.2; if there are no vehicles in the set of fleets to be carpooled, execute step 5.3.6.
[0128] Step 5.3.2: If the remaining load of the truck is greater than the total weight of the current order, execute step 5.3.3; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1.
[0129] Step 5.3.3: After adding the current order destination, if the number of destinations does not exceed 3, execute step 5.3.4; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1.
[0130] Step 5.3.4: Apply the Skyline packing strategy to each pallet of goods in the order to determine whether all the pallets of goods in the order can be placed in the vehicle. If all the pallets of goods in the order can be placed in the vehicle, keep the truck in the waiting carpooling fleet and execute step 5.3.1; otherwise, set the per-kilometer cost P of the truck to +∞, and then execute step 5.3.1; if all vehicles in the waiting carpooling fleet set have been traversed, execute step 5.3.5.
[0131] Since there may be goods of other orders of varying sizes on the truck to be shared during the carpooling process, how to put as many goods of the current order as possible into the limited irregular remaining space becomes a two-dimensional packing constraint problem. The Skyline packing strategy, as a heuristic algorithm, can calculate the reasonable position of each pallet of goods with a small amount of calculation, so as to determine whether all the goods of the current order can be fully loaded by the current candidate vehicle, and then determine whether the candidate vehicle has the ability to carpool.
[0132] Skyline's packing strategy is as follows:
[0133] S1. Read the number of pallets in the current order, the length and width of the first pallet of rectangular goods, and other information;
[0134] S2, the skyline algorithm defines a sequence of k consecutive horizontal line segments (s1, s2...s k ) to represent the skyline, which must satisfy the following properties: i (i=1,2,,...,k) and s i+1 The y-axis coordinate values of (i=1, 2, ..., k) are different, s i The x-axis coordinate value of the right endpoint is the same as s i+1 The left endpoints have the same x-axis coordinate value, and the initial unloaded state is represented by a skyline of a single horizontal line segment, corresponding to the bottom reference line of the loading area.
[0135] S3. Define a series of candidate points on the skyline to facilitate the placement of rectangular cargo: First, the left endpoint of the initial line segment s1 and the end line segment s k The right endpoint of is always a candidate point; for other intermediate segments, if and only if the previous segment s i-1 Higher than s i , line segment s i The left endpoint of is the left end candidate position; similarly, if and only if the next line segment s i+1 Higher than s i When line segment s i The right endpoint of is the right end candidate position;
[0136] S4. Place rectangles: The left bottom corner of each rectangle touches the line segment s in the skyline. i The left end candidate point, or its right bottom corner touches the line segment s in the skyline i The right end candidate point of the multiple candidate points is selected according to the Bottom-Left Fill (BLF) principle, and the line segment s with the smallest y-axis coordinate value is selected. miny The left candidate point is used to place the rectangular cargo, and a new loading area is formed after it is placed;
[0137] S5. Update the affected skyline: treat the upper edge of the placed rectangular cargo c as the new skyline segment s', and remove the upper edge of the rectangular cargo c below s'. c The old skyline segment of the affected existing skyline segment is updated; at the same time, the bottom shadow area covered by cargo c, such as Figure 3 As shown, it is considered as wasted space and is not considered in subsequent calculations; the next skyline s' c+1 The x-axis coordinate value of the left endpoint is the same as s' c The x-axis coordinate values of the right endpoints are the same;
[0138] S6. Update the global skyline: traverse each skyline segment. If it is lower than the adjacent segments and the remaining rectangular goods cannot be placed on the segment, that is, the width of the remaining goods is greater than the length of the segment, then the area where the segment is located is considered as wasted space, and the segment is raised to the height of the lowest adjacent segment and the skyline is updated again.
[0139] S7, judging the cargo status in the current loading area, if the cargo has exceeded the vehicle capacity after loading, that is, the highest skyline is higher than the vehicle width, then exit the strategy and set the output of step 5.3.4 to no; if the cargo has not exceeded the vehicle capacity after loading, then execute S8;
[0140] S8. Determine the status of the remaining goods in the current order. If there are still rectangular goods that have not been placed, read the information of the next pallet of rectangular goods and execute S2. If all pallets of goods in the current order have been loaded, exit the strategy and set the output of step 5.3.4 to yes.
[0141] Step 5.3.5: If there are z trucks that meet the conditions in the carpooling fleet searched for the k′th order, and the model of each truck is Then select the car with the lowest cost for carpooling; otherwise, if there is no available car in the carpooling fleet, execute step 5.3.6.
[0142] Suppose the lowest cost carpooling vehicle for the k′th order is Y k’ , then Y k’ satisfy:
[0143]
[0144] Among them, d k’ For vehicle Y k’ The distance from the original destination to the destination of order k′; similarly For vehicles The distance from the original destination to the destination of order k′. Then order k′ is set to carpooling mode (Md=1).
[0145] The cost of a single order in the carpooling mode (Md = 1) is:
[0146] Step 5.3.6: Set the order to the single new vehicle mode (Md = 0), execute step 4 to process the order as an order that does not need to be split, and set the appropriate truck model selected for the k″th order to be x k” , then the cost of a single order in the new car mode (Md = 0) is: And the truck x k” Join the carpooling fleet.
[0147] Step 5.4: Calculate the total cost of carpooling without splitting the order:
[0148]
[0149] That is: the first item calculates the carpooling fee of order k′ in the carpooling mode (Md=1), the second item calculates the sum of the fees of order k″ in the single new car mode, and then calculates the sum of the fees.
[0150] Step 5.5: For orders that can be shared and need to be split (i∈Sh1∪Sp1), the processing method of step 4.4 for orders that do not need to be shared and need to be split (i∈Sh0∪Sp1) is adopted, and the largest model A is used for loading in a loop. Suppose that the rth single loop loads b r After that, the status of the remaining goods is updated to no need to split (Sp1→Sp0); then execute step 5.3 for the processing method that can be carpooled and does not need to be split (i∈Sh1∪Sp0), and get the loading method of the remaining goods, where the order r′ of the carpooling mode (Md=1) corresponds to the lowest cost carpooling vehicle Y r’ ; The appropriate truck model selected for the order r″ in the single new car mode (Md=0) is x r” , then the calculation cost is:
[0151]
[0152] Step 5.6: The total cost and fitness value F of a single sequence, i.e., all carpoolable orders (Sh=1), are obtained as follows:
[0153]
[0154] Step 6: Start the iteration of the particle swarm algorithm, according to the position of the current d generation of the i-th particle individual Calculate its speed The speed represents the total exchange subsequence of the particle after learning from the group optimal and individual optimal sequences; and its position in the next generation (i.e., generation d+1) This is the new solution. The specific calculation formula is as follows:
[0155]
[0156] in, is the optimal solution or optimal position of the dth generation of the i-th particle individual, that is, the sorting sequence order corresponding to the generation with the highest fitness value or the lowest total sequence cost in the historical generation during the evolution of the i-th particle individual to the dth generation; is the global optimal solution or optimal position of the dth generation, that is, the sorting sequence corresponding to the generation with the highest fitness value or the lowest total sequence cost among all particle individuals in the historical generation during the evolution to the dth generation; α is the individual learning probability, that is, the probability of learning from the individual historical optimal sequence, and β is the group learning probability, that is, the probability of learning from the group historical optimal sequence, (α, β∈[0,]); The basic exchange sequence All the commutators in the are retained with probability α to obtain the commutator sequence, that is, the sorting sequence of the current generation of a single particle individual learns from the optimal sequence of its own historical generation, and each learned commutator retains the obtained commutator sequence with probability α; The basic exchange sequence The obtained commutator sequence is obtained by retaining all the commutators with probability β, that is, a single particle individual learns from the optimal sequence in the historical generation of the group with the sorted sequence of the current generation, and each learned commutator is retained with probability β to obtain the obtained commutator sequence.
[0157] Specifically, the evolutionary process is to randomly generate Ps different sorting sequences, i.e., particle positions, evaluate the fitness value of each sequence, i.e., the cost value, and determine the sequence with the highest fitness value of a single particle in the iteration, i.e., the optimal sequence, and the sequence with the highest fitness of all particles in the iteration, i.e., the group or global optimal sequence. In each generation, each individual learns from its own optimal sequence once with a certain probability, and then learns from the group's optimal sequence once with a certain probability to produce the next generation of individuals.
[0158] By continuously learning from its own optimal sequence and the overall optimal sequence, the fitness value of each individual in the entire population will decrease, and each individual sequence will be closer to its own optimal sequence and the overall optimal sequence with the lowest total cost. At the same time, the setting of the learning probability retains the inertia of the individual particles to a certain extent, that is, it will not completely accept the order of the optimal sequence. The difference between individual and global learning probabilities will also increase the variation and diversity of the next generation of individuals, further reducing the occurrence of premature convergence. After several generations of iterations, the particle swarm algorithm will output a sorted sequence with higher fitness, and after decoding, the correspondence between each order and the required truck in the sequence can be obtained.
[0159] The specific steps include:
[0160] Step 6.1: Calculation and The difference between Φ, Where Φ is the basic commutative order, which means that Φ acts on get
[0161] Step 6.2: Calculation Among them, Ψ is also the basic commutative order;
[0162] Step 6.3: Calculate the speed according to the following formula: And swap the order Convert to a basic commutative order:
[0163]
[0164] Step 6.4: Calculate the new solution found
[0165] Step 6.5: If a better solution is found, update If the entire group finds a better solution, update
[0166] Step 7: If the current number of iterations does not reach the maximum number of iterations set, repeat step 6; otherwise, the optimal solution of the current particle swarm population is And the fitness value of the optimal solution As a final result, according to the group optimal solution Get the optimal order sorting sequence of carpooling orders, and according to the fitness value of the optimal solution Get the minimum cost of the carpooling order and proceed to step 8.
[0167] Step 8: Combine and output the total transportation plan for carpooling and non-carpooling orders, and calculate the transportation cost of all orders
[0168] In summary, the above are only preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A two-dimensional box vehicle path planning method based on improved particle swarm algorithm, characterized in that: The following steps are involved: Step 1: Preprocess the order data and initialize the dispatch truck data and city distance data; According to whether carpooling is possible, order i is divided into a carpooling order set Sh1 and a non-carpooling order set Sh0; for orders in set Sh1, execute step 2, and for orders in set Sh0, execute step 3; Step 2: Use the PSO algorithm to encode the order into an ordered sequence, and then randomly shuffle the ordered sequence Ps times to obtain Ps randomly sorted sequences as individual particles. These individual particles form the first generation of particle swarm population, and set the population size Ps and the maximum number of iterations M. g , individual learning probability α and group learning probability β, execute step 4; Step 3: Divide the orders into a set Sp0 of orders that do not need to be split and a set Sp1 of orders that need to be split. For the orders in set Sp1, the total number of trucks required is determined using the principle of minimum splitting, and the number of pallets remaining for the order is calculated. The reorganized orders formed by the remaining pallets are then added to the set Sp0, and the order fees are calculated. After traversing and matching the trucks for the orders in set Sp0, the order fees are calculated. The sum of the order costs of all orders in sets Sp0 and Sp1 is the total cost of set Sh0. At the same time, the transportation plan of set Sh0 is obtained, and step 7 is executed; Step 4: Calculate the fitness of each individual particle in the first generation of the particle swarm population. The fitness value is the inverse of the total cost of the order sequence corresponding to the particle individual. The position of the particle individual in the sorting sequence of the first generation of the particle swarm population is taken as its first generation optimal position. Its fitness in the first generation is taken as the optimal fitness value of the first generation The order of individuals with the highest fitness value in the first generation of the particle swarm population is taken as the first generation optimal position of the population. This highest fitness value is used as the first generation optimal fitness value of the group Step 5: Execute the particle swarm algorithm, according to the position of the current d generation of the i-th particle individual Calculate its speed and its place in the next generation Step 6: If the current number of iterations does not reach the maximum number of iterations, execute step 5; otherwise, the optimal solution of the current particle swarm population is And the fitness value of the optimal solution As a final result, and according to Get the optimal order sorting sequence according to Get the minimum cost and execute step 7; Step 7: Combine and output the transportation plans for the orders that can be carpooled and those that cannot be carpooled, and calculate the transportation costs of all orders; In step 3, the total number of trucks required for the orders in the set Sp1 is determined by the principle of minimum splitting, and the number of pallets remaining for the order is calculated. The reorganized order formed by the remaining pallets is then added to the set Sp0, and the order fee is calculated, including: Use the truck with the largest load limit to load the goods in a loop until the remaining goods of the order are updated to no longer need to be split. Calculate the number of times a that the i-th order needs to be loaded in a loop. i : Among them, n i is the total number of pallets for the i-th order, The maximum number of pallets of goods for the i-th order that can be loaded on the truck with the largest load limit; At this time, the number of pallets remaining for the i-th order is n′ i for: By the number of pallets n′ i Form a reorganized order; record the truck model corresponding to the remaining goods as x i , current order number on i The model of the truck with the largest load limit is A i , the cost of the order is calculated using the following formula: in, For Model A i The corresponding cost per kilometer is For vehicle model x i The corresponding cost per kilometer, d i is the city distance between the origin and destination of the i-th order; The step 4 of calculating the fitness of each individual particle in the first generation of the particle swarm population includes: Step 5.1, read in individual particles sequentially, execute step 5.4 for orders that need to be split, and execute step 5.2 for orders that do not need to be split; Step 5.2, add the to-be-carpooled vehicles output in the previous order operation to the current to-be-carpooled fleet set; Step 5.3: Determine whether the order is a carpooling mode or a new car order mode; Step 5.4: Calculate the total cost of carpooling without splitting the order Step 5.5: For orders that can be shared and need to be split, load them with the largest model A in a loop. Suppose that the rth single loop loads b r After that, the status of the remaining goods is updated to no need to be split; then the processing method that can be carpooled and does not need to be split is executed to obtain the loading method of the remaining goods, among which the lowest cost carpooling vehicle corresponding to the carpooling order r′ is Y r’ ; The appropriate truck model selected for the order r″ in the new car mode is x r” , the cost of the order is: Among them, d r is the city distance between the origin and destination of the rth order, For Model A r The corresponding cost per kilometer, b r The number of A vehicles required for the rth order, For vehicle model x r” The corresponding cost per kilometer, d r ″ is the city distance between the origin and destination of the rth order, For model Y r’ The corresponding cost per kilometer, d r′ is the city distance between the origin and destination of the r′th order; Step 5.6: The total cost of a single sequence, i.e., all carpoolable orders, is: The fitness value F is:
2. The two-dimensional container vehicle path planning method according to claim 1 is characterized in that: In step 3, the orders are divided into a set Sp0 of orders that do not need to be split and a set Sp1 of orders that need to be split. The following formula is used to determine whether the i-th order needs to be split: Among them, M A is the maximum load of vehicle type A, t i is the total mass of goods in the i-th order, n i is the total number of pallets for the i-th order, and NA is the maximum number of pallets for the i-th order that vehicle A can load; N A Calculated by the following formula: N A =max{[L A / l i ]·[W A / w i ],[L A / w i ]·[W A / l i ]} Among them, L A is the length of the loading area of vehicle type A, W A Indicates the width of the loading area of model A, l i and w i They represent the length and width of the cargo in the i-th order respectively, and [] represents the rounding operator.
3. The two-dimensional container vehicle path planning method according to claim 1 is characterized in that: After traversing and matching trucks for the orders in the set Sp0 in step 3, the order costs are calculated, including: Assume that the truck model corresponding to the i-th order is x i , traverse the vehicle types from small to large according to the load limit until x i The most suitable model is determined by satisfying the following formula: in, For x i The upper load limit of the vehicle type, t i is the total mass of goods in the i-th order, n i is the total number of pallets for the i-th order, For x i The maximum number of pallets of cargo that can be loaded on the vehicle is the number of pallets of cargo for the i-th order; Record the current order number on i The corresponding model x i , and calculate the cost of a single order: Among them, S is the distance data set between all cities, Sh is the carpooling situation, S p is the order splitting situation, H i is the order fee for the i-th order; The total cost of all non-carpooling and non-split orders is: For car model x i The corresponding cost per kilometer, d i is the city distance between the origin and destination of the i-th order.
4. The two-dimensional container vehicle path planning method according to claim 1 is characterized in that: Determining whether the order is a carpooling mode or a single new car ordering mode in step 5.3 includes: Step 5.3.1: If there are vehicles in the set of waiting carpooling fleets, select a vehicle from the set of waiting carpooling fleets and execute step 5.3.2; if there are no vehicles in the set of waiting carpooling fleets, execute step 5.3.6; Step 5.3.2: If the remaining load of the truck is greater than the total weight of the current order, execute step 5.3.3; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1; Step 5.3.3: After adding the current order destination, if the number of destinations does not exceed 3, execute step 5.3.4; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1; Step 5.3.4: Apply the Skyline packing strategy to each pallet of goods in the order to determine whether all the goods in the order can be put into the truck. If they can be put into the truck, keep the truck in the waiting carpooling fleet and execute step 5.3.1; otherwise, set the per-kilometer cost P of the truck to +∞ and execute step 5.3.1; if all vehicles in the waiting carpooling fleet have been traversed, execute step 5.3.5; Step 5.3.5: If there are z trucks that meet the conditions in the carpooling fleet searched for the k′th order, and the model of each truck is Then select the car with the lowest cost for carpooling; otherwise, if there is no available car in the carpooling fleet, execute step 5.3.6; Suppose the lowest cost carpooling vehicle for the k′th order is Y k’ , then Y k’ satisfy: Among them, d k’ For vehicle Y k’ The distance from the original destination to the destination of order k′; similarly For vehicles The distance from the original destination to the destination of order k′; then order k′ is set to carpooling mode; For vehicle Y k’ The corresponding cost per kilometer is For vehicles The corresponding cost per kilometer; The cost of a single order in the carpooling model for: in, Step 5.3.6: Set the order to the single new vehicle mode and treat the order as an order that does not need to be split. Suppose the appropriate truck model selected for the k″th order is x k” , then the cost of a single order for a new car model is for: in, For vehicle x k” The corresponding cost per kilometer, d k” For vehicle x k” The distance from the original destination to the destination of order k″; and the truck x k” Join the carpooling fleet.
5. The two-dimensional container vehicle path planning method according to claim 1 is characterized in that: The speed in step 5 and location The calculation formula is as follows: in, is the optimal solution or optimal position of the dth generation of the i-th particle individual, is the global optimal solution or optimal position of the dth generation, α is the individual learning probability, that is, the probability of learning from the individual historical optimal sequence, β is the group learning probability, that is, the probability of learning from the group historical optimal sequence, (α, β∈[0,1]); The basic exchange sequence All the commutators in are retained with probability α to obtain the resulting commutator sequence, The basic exchange sequence All the commutators in are retained with probability β to obtain the resulting commutator sequence; is the current d-generation velocity of the particle.
