A large-scale urban distribution logistics capacity scheduling system and method with scalable computing power
By designing a large-scale urban distribution logistics capacity scheduling system with scalable computing power, and combining precise solutions and heuristic algorithms, the combined problem of vehicle distribution planning in urban logistics is solved, achieving rapid solution and efficient logistics scheduling, and reducing system maintenance. Costs and business constraints.
Patent Information
- Application Number
- CN202410736879.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-27
- Estimated Expiration
- 2044-06-07
AI Technical Summary
Existing technologies present multiple combination problems in vehicle distribution planning in urban logistics, making it difficult to come up with planning solutions that meet all needs. Moreover, existing algorithms require complex business logic embedded codes, resulting in high maintenance costs and limiting the business development of enterprises. .
A large-scale urban distribution logistics capacity scheduling system with scalable computing power is designed, using MySQL database, message middleware KAFKA, solver module, indicator monitoring module and middleware Redis, combined with precise solution algorithm and heuristic algorithm, through multi-core Parallel computing and dynamic adjustment of the number of solvers enable rapid solution of complex problems with large-scale combined constraints.
It solves the combination problem of urban distribution logistics dispatching system, improves the speed and accuracy of solution, reduces the complexity and workload when demand changes, improves the robustness of the system and the flexibility of business changes, and extends the use life cycle .
Smart Images

Figure CN118313632B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a large-scale urban distribution logistics capacity scheduling system and method with scalable computing power. Background Art
[0002] With the rapid development of the logistics and transportation industry, the number of road vehicles and logistics has increased dramatically, and the proportion of urban logistics business in people's work and life has gradually increased;
[0003] Studies have pointed out that trucks, as high-energy-consuming means of transportation, account for nearly 65% of the country's annual gasoline consumption on average. In addition, the vehicle empty rate is over 40%, and the average interval between vehicle stops for cargo distribution is about 72 hours. The low transportation efficiency not only causes a huge waste of resources and exhaust emissions, but is also not conducive to carbon emission reduction in the transportation industry. Vehicle distribution in urban logistics faces huge challenges. Therefore, a system and method that can effectively improve the vehicle distribution efficiency in the logistics distribution industry is very necessary, both in terms of economic benefits and social benefits.
[0004] The existing methods for planning vehicle distribution in urban logistics have the following disadvantages:
[0005] 1. It is difficult to come up with a planning solution that meets all the needs for various combinations of vehicle distribution in urban logistics;
[0006] 2. Currently, the industry usually uses two methods for such problems: exact solution algorithm and heuristic algorithm. The exact algorithm is to establish a corresponding mathematical model for a specific problem and use mathematical methods to solve it. It is usually used to find the optimal solution to the problem, but this method is not suitable for actual industrial scenarios; the heuristic algorithm gives a feasible solution to the combinatorial optimization problem to be solved within an acceptable range, but the heuristic algorithm needs to embed complex business logic into the algorithm code. In order to meet certain needs, the original code must be overturned, and the maintenance of the code wastes manpower and material resources, which restricts the business development of the enterprise. Summary of the invention
[0007] The purpose of the present invention is to solve the shortcomings existing in the prior art and to propose a large-scale urban distribution logistics capacity scheduling system and method with scalable computing power.
[0008] To achieve the above object, the present invention adopts the following technical solutions:
[0009] A large-scale urban logistics capacity dispatching system with scalable computing power, including MySQL database, message middleware KAFKA, solver module, indicator monitoring module, and middleware Redis;
[0010] It also includes an external business system module, which is used to integrate the SDK interface provided by this system to interact with the system for data;
[0011] The MySQL database is used to store the input data set of each city distribution logistics scheduling planning task and the final route planning result returned after the city distribution logistics scheduling planning task is completed;
[0012] The message middleware KAFKA is used to publish urban distribution logistics scheduling planning tasks, receive the results of urban distribution logistics scheduling planning tasks, and publish and receive the heartbeat data of the solver;
[0013] The solver module is used to receive the city distribution logistics scheduling planning task and perform multi-core parallel computing to solve it, and return the obtained planning solution of the approximate optimal route to the external business system module;
[0014] The indicator monitoring module is used to collect and analyze the heartbeat data of each solver, and analyze the current status of each solver and the processing status of the city distribution logistics scheduling planning task;
[0015] The middleware Redis is used to cache solver status, task status and instruction data.
[0016] The present invention also proposes a large-scale urban distribution logistics capacity scheduling method with scalable computing power, comprising the following steps:
[0017] S1: Get the dataset and transfer it to the MySQL database;
[0018] The external business system module obtains multiple data sets for urban distribution logistics scheduling planning from internal data sources, including data set ID, parking lot data, vehicle model data, customer data, cargo data, distance matrix data, time matrix data, cargo mutual exclusion matrix data, cargo vehicle matching data, etc.
[0019] The data set ID is unique;
[0020] The parking lot data includes the parking lot name, parking lot address, longitude, latitude, parking lot type, etc. The parking lot type includes the starting and ending points, and the starting point only;
[0021] The vehicle model data includes maximum capacity, number of available vehicles, labels matching the goods, name of the departure yard, etc.;
[0022] The customer data includes customer code, customer name, customer address, cargo loading and unloading time, etc.;
[0023] The cargo data includes cargo code, cargo name, cargo volume measurement, vehicle matching attributes, cargo quality, cargo mutually exclusive label information, etc.;
[0024] The distance matrix data includes the starting position point number, the arrival position point number, the distance between the starting position point and the arrival position point, etc.;
[0025] The time matrix data includes the starting position point number, the arrival position point number, the time between the starting position point and the arrival position point, etc.;
[0026] The goods mutually exclusive matrix data includes mutually exclusive goods codes;
[0027] The cargo vehicle matching data includes cargo code, etc.;
[0028] The external business system module transfers each data set to the MySQL database through the SDK interface, and the MySQL database receives and saves the data set.
[0029] S2: Publish and receive city distribution logistics scheduling planning tasks;
[0030] The external business system module constructs the message of the city distribution logistics scheduling planning task, calls the SDK interface to connect to the message middleware KAFKA, and publishes the constructed message to the specified topic of the message middleware KAFKA;
[0031] The message contains specific information of the city distribution logistics scheduling planning task, such as data set ID, parking lot data, cargo data, customer data, and specific cargo requirements of customers;
[0032] The solver module subscribes to the specified topic of the message middleware KAFKA through the SDK interface. When a new city distribution logistics scheduling planning task is published to the specified topic of the message middleware KAFKA, the solver module will receive the message;
[0033] After the external business system publishes the message of the urban distribution logistics scheduling planning task to the designated topic of the message middleware KAFKA, the solver module receives the message.
[0034] S3: Execute the city distribution logistics scheduling planning task;
[0035] The solver module executes the city distribution logistics scheduling planning task according to the specific information of the city distribution logistics scheduling planning task contained in the message;
[0036] The following sub-steps are included:
[0037] S31: Get the dataset from MySQL;
[0038] The solver module receives the message, parses the specific information of the city distribution logistics scheduling planning task contained in the message, and obtains the corresponding dataset data from MySQL according to the dataset ID contained in the message;
[0039] S32: Create subprocesses and execute each subprocess;
[0040] The cpu_count function is used to obtain the number of CPU cores of a large-scale urban distribution logistics capacity scheduling system with scalable computing power, and a corresponding number of child processes are created according to the number of CPU cores;
[0041] Each subprocess is started through the start function, and the execution process of the subprocess is as follows:
[0042] S321: Allocate vehicles and goods;
[0043] Allocate vehicles and goods based on the cargo information in the city distribution logistics scheduling planning task and the vehicle model data contained in the data set;
[0044] Specifically, vehicles and goods are randomly allocated in one of the following three ways;
[0045] 1. Completely random vehicle allocation: randomly select a cargo, and randomly select a matching vehicle model based on the cargo information and vehicle matching attributes; randomly select another cargo that can match this vehicle model from the remaining cargo, and assign it to the same vehicle; repeat the above steps until the remaining cargo can no longer be added to this vehicle; repeat the above steps until all cargo allocations in the city distribution logistics scheduling planning task are completed;
[0046] 2. Prioritize the allocation of vehicles based on the maximum cargo capacity:
[0047] Filter out all available models based on the vehicle attributes matching the information, sort each model according to the maximum capacity, and divide them into intervals; classify all goods contained in the cargo information into intervals according to the quality of the goods, and randomly sort multiple goods in the same interval in units of intervals. After the sorting is completed, sort them from large to small according to the intervals to form a sequence;
[0048] Take a cargo from the leftmost side of the cargo sequence, that is, remove this cargo from the sequence, randomly select a car model from the car models that match the cargo, and take a cargo that can match this car model from the remaining cargo in the cargo sequence from left to right, and assign it to the same car. Repeat the above steps until the remaining cargo can no longer be added to this car; repeat the above steps until all cargoes are assigned;
[0049] 3. Unify the vehicles for goods in adjacent positions: Randomly arrange all goods to obtain a randomly arranged goods sequence; take the leftmost goods in the above goods sequence from the goods sequence, randomly select a model from the models that match this goods, and use this goods as the comparison target goods;
[0050] Among the remaining goods in the goods sequence, a goods that can be matched with this vehicle model is obtained in order from left to right, and the goods are closest to the comparison target goods. This goods and the comparison target goods are assigned to the same vehicle and taken out from the goods sequence; the distance is obtained by the distance between the starting position point and the arrival position point of the distance matrix data;
[0051] Take this cargo as the new comparison target cargo and repeat the above steps until the remaining cargo in the cargo sequence cannot be added to this vehicle; repeat the above steps until all cargoes are allocated;
[0052] S322: Performing route planning for the assigned vehicle;
[0053] After the goods are distributed, the route planning is performed for the vehicle containing the goods, i.e., the vehicle that has been assigned the task;
[0054] The route planning of the bicycle refers to the route planning in which the vehicle starts from the parking lot, visits the customer addresses corresponding to each customer data in the task in a certain order, and finally returns to the starting parking lot;
[0055] The following mathematical model is used to plan the route of the assigned vehicle:
[0056]
[0057] st
[0058]
[0059] s n+1 ≤T (3.2)
[0060]
[0061] ∑ i∈N ∑ j∈N (x ij *d ij )≤MD (5.1)
[0062]
[0063] Among them, x ij is a path variable. The subscripts i and j indicate whether the path from customer point i to customer point j is selected. ij The value of is 0 or 1. If it is 0, it means that the path from customer point i to customer point j is not selected. If it is 1, it means that the path from customer point i to customer point j has been selected.
[0064] y ijis the cumulative demand variable, and the subscripts i and j represent the current cumulative customer demand for vehicles from customer point i to customer point j, such as the cumulative cargo volume, etc.; ij The range is 0-the maximum volume of the vehicle;
[0065] s i is the time point variable of reaching each customer, subscript i represents customer point i, s The value of i is the specific time of arrival at customer point i, s i is an integer;
[0066] Set N is the set of all points, including the starting point set {0}, the customer point set C: {1, 2, ..., n}, and the end point set {n+1};
[0067] Set C is a customer data set {1, 2, ..., n};
[0068] q i Meet the needs of customers at their specific locations;
[0069] t ij is the travel time from customer point i to customer point j;
[0070] serviceTime i The service time at customer point i;
[0071] Q is the maximum capacity of the car;
[0072] T is the maximum return time of the trip;
[0073] is the time right window for customer j;
[0074] d ij is the mileage from i to j;
[0075] MD is the maximum distance in the route;
[0076] The customer point corresponds to the customer address;
[0077] (1.1) is the route planning with the least mileage, (1.2) is the route planning with the least total time, and (1.3) is the route planning with the least total cost;
[0078] (2.1) means that each customer point and destination will only be visited once;
[0079] (2.2) is the starting point and each customer point, there will be only one car leaving;
[0080] (2.3) is the demand constraint for customer i, that is, the vehicle load when leaving customer point i - the vehicle load when just arriving at customer point i = the demand at customer point i;
[0081] (2.4) The cumulative demand cannot exceed the maximum capacity of the current vehicle;
[0082] (3.1) When the customer arrives at the next point of i - when the customer arrives at point i = travel time from i to j + waiting time + service time at i, K is a very large coefficient, such as 99999999;
[0083] (3.2) Constraint on the maximum return time of the trip;
[0084] (4.1) Constraint for ensuring the access order, where P in the formula h represents a binary tuple of location points with requirements for the access order. The subscript h is the serial number of the binary tuple and has no business meaning; for example, P h = {5, 2}, and in the formula in 4.1: it becomes s5 < s2; by constraining that the time to reach customer 5 is less than the time to reach customer 2, the purpose of the access customer order constraint is achieved;
[0085] (5.1) Constraint on the maximum driving distance of the route;
[0086] (6.1) For the range of values of the decision variable x ij ;
[0087] (6.2) For the range of values of the decision variable y ij ;
[0088] (6.3) For the range of values of the decision variable s i ;
[0089] After the operation of each subprocess is completed, the execution result is a score and a route planning scheme. The route planning scheme includes planning scheme data of the vehicle, route data, route detailed data, customer point - cargo relationship data, etc.;
[0090] The planning scheme data includes scheme id, scheme score, etc.;
[0091] The route data, that is, the relationship between the route and the vehicle type, includes the vehicle type used for the route, etc.;
[0092] The route detailed data includes the vehicle used for the route, the remaining capacity of the vehicle at the current location point, cumulative driving distance, cumulative driving duration, etc.;
[0093] The customer point - cargo relationship data includes the cargo data loaded and unloaded at the specified customer point on the current route, etc.;
[0094] S33: Save the execution result of the subprocess into the MySQL database;
[0095] It includes the following steps:
[0096] S331: Check whether there is a child process still running;
[0097] Check whether there is any child process still running through the is_alive function. If there is any child process still running, continue to execute the child process; if there is no child process, it means that all child processes have been completed, and go to step S332;
[0098] S332: Obtain the final route planning result of the execution results of each sub-process;
[0099] If all subprocesses have finished running, the execution results of each subprocess are compared through a heuristic algorithm to obtain the global optimal solution;
[0100] The sub-process execution result corresponding to the global optimal solution is the final route planning result, and the final route planning result is saved in MySQL;
[0101] Furthermore, the solver module sends a heartbeat message to the message middleware KAFKA at a period of 30 seconds; the reporting status of the heartbeat message includes idle and running, the idle state means that the solver state is idle, and the running state means that the solver state is running;
[0102] When there is a city distribution logistics scheduling planning task being processed in the solver module, the solver status in the heartbeat message sent is running. At the same time, the heartbeat message contains the specific processing information of the city distribution logistics scheduling planning task; when there is no city distribution logistics scheduling planning task being processed in the solver module, the solver status in the heartbeat message sent is idle;
[0103] The indicator monitoring module receives and parses the heartbeat message in the message middleware KAFKA. According to the timestamp of the heartbeat message, it determines whether there is a situation where the reporting period has been exceeded but the heartbeat message has not been received. If so, it means that the solver has stopped serving. At this time, the solver status is stopped; the indicator monitoring module caches the current status of the solver in the middleware Redis;
[0104] S34: Release the execution results of the city distribution logistics scheduling planning task;
[0105] The solver module publishes the execution results of the urban distribution logistics scheduling planning task to the specified topic of the message middleware KAFKA.
[0106] S4: The city distribution logistics scheduling planning task processing is completed;
[0107] The external business system module receives the execution results of the city distribution logistics scheduling planning task from the message middleware KAFKA through the SDK interface, and the city distribution logistics scheduling planning task processing is completed;
[0108] Preferably, when the external business system needs to know the current state of the solver, the cached state information is obtained from the middleware Redis; the SDK interface returns the solver state information queried by the indicator monitoring module to the external business system;
[0109] Furthermore, the external business system module can enable the function of dynamically adjusting the number of solvers through the SDK interface; when the indicator monitoring module determines that the system needs to adjust the number of solvers, it will generate corresponding control instructions, which include increasing or decreasing the number of solvers, and sending the control instructions to a specific location in Redis. The solver module periodically checks whether there are new control instructions in Redis. When there are new control instructions, the solver module obtains and parses these control instructions; according to the information in the control instructions, the solver module will automatically perform corresponding operations, such as increasing or decreasing the number of solvers; after the solver module executes the control instructions, it will feed back the execution results to the system and update its own status.
[0110] By dynamically adjusting the number of solvers, the number of solvers can be quickly adjusted according to actual needs to better adapt to business changes or system loads.
[0111] Compared with the prior art, the present invention has the following beneficial effects:
[0112] The large-scale urban distribution logistics capacity dispatching system and method with scalable computing power proposed in the present invention can solve the combination problems of the urban distribution logistics dispatching system, such as: selectable multiple usage scenarios, selectable multiple constraints, combinable multiple optimization objectives, and large-scale solution. In the current urban distribution logistics industry, it has high practical use value;
[0113] Combining the advantages of heuristic algorithms and exact solution algorithms, an acceptable intersection is achieved between solution speed and solution accuracy. The heuristic algorithm performs the first layer of operations, and the exact solution algorithm performs the second layer of solutions. It can quickly solve large-scale, complex problems with combined constraints, and meet the business needs of the urban distribution logistics industry in terms of time feasibility; the business logic and algorithm logic of urban distribution logistics are designed in a layered manner to ensure the stability of the requirements of complex algorithm modules while reducing the complexity and workload when the requirements change, thereby improving the robustness, stability, and flexibility of business changes of the present invention; at the same time, it also extends the service life cycle of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0114] Figure 1 This is a main flow chart of a large-scale urban distribution logistics capacity scheduling method with scalable computing power according to the present invention;
[0115] Figure 2 A module relationship diagram of a large-scale urban distribution logistics capacity scheduling method with scalable computing power according to the present invention;
[0116] Figure 3 A flowchart of completely random vehicle allocation in vehicle and cargo allocation in a large-scale urban distribution logistics capacity scheduling method with scalable computing power of the present invention;
[0117] Figure 4 A flowchart for allocating vehicles according to the maximum capacity of goods in the allocation of vehicles and goods in a large-scale urban distribution logistics capacity scheduling method with scalable computing power of the present invention;
[0118] Figure 5 A flowchart of uniformly allocating vehicles to adjacent goods in a vehicle and goods allocation method of a large-scale urban distribution logistics capacity scheduling method with scalable computing power according to the present invention; DETAILED DESCRIPTION
[0119] In order to provide a further understanding of the purpose, structure, features, and functions of the present invention, the following detailed description is given in conjunction with the embodiments.
[0120] like Figure 1-5 As shown in the figure, a large-scale urban distribution logistics capacity scheduling system with scalable computing power includes a MySQL database, a message middleware KAFKA, a solver module, an indicator monitoring module, and a middleware Redis;
[0121] It also includes an external business system module, which is used to integrate the SDK interface provided by this system to interact with the system for data;
[0122] The MySQL database is used to store the input data set of each city distribution logistics scheduling planning task and the final route planning result returned after the city distribution logistics scheduling planning task is completed;
[0123] The message middleware KAFKA is used to publish urban distribution logistics scheduling planning tasks, receive the results of urban distribution logistics scheduling planning tasks, and publish and receive the heartbeat data of the solver;
[0124] The solver module is used to receive the city distribution logistics scheduling planning task and perform multi-core parallel computing to solve it, and return the obtained planning solution of the approximate optimal route to the external business system module;
[0125] The indicator monitoring module is used to collect and analyze the heartbeat data of each solver, and analyze the current status of each solver and the processing status of the city distribution logistics scheduling planning task;
[0126] The middleware Redis is used to cache solver status, task status and instruction data.
[0127] The present invention also proposes a large-scale urban distribution logistics capacity scheduling method with scalable computing power, comprising the following steps:
[0128] S1: Get the dataset and transfer it to the MySQL database;
[0129] The external business system module obtains multiple data sets for urban distribution logistics scheduling planning from internal data sources, including data set ID, parking lot data, vehicle model data, customer data, cargo data, distance matrix data, time matrix data, cargo mutual exclusion matrix data, cargo vehicle matching data, etc.
[0130] The data set ID is unique;
[0131] The parking lot data includes the parking lot name, parking lot address, longitude, latitude, parking lot type, etc. The parking lot type includes the starting and ending points, and the starting point only;
[0132] The vehicle model data includes maximum capacity, number of available vehicles, labels matching the goods, name of the departure yard, etc.;
[0133] The customer data includes customer code, customer name, customer address, cargo loading and unloading time, etc.;
[0134] The cargo data includes cargo code, cargo name, cargo volume measurement, vehicle matching attributes, cargo quality, cargo mutually exclusive label information, etc.;
[0135] The distance matrix data includes the starting position point number, the arrival position point number, the distance between the starting position point and the arrival position point, etc.;
[0136] The time matrix data includes the starting position point number, the arrival position point number, the time between the starting position point and the arrival position point, etc.;
[0137] The goods mutually exclusive matrix data includes mutually exclusive goods codes;
[0138] The cargo vehicle matching data includes cargo code, etc.;
[0139] The external business system module transfers each data set to the MySQL database through the SDK interface, and the MySQL database receives and saves the data set.
[0140] S2: Publish and receive city distribution logistics scheduling planning tasks;
[0141] The external business system module constructs the message of the city distribution logistics scheduling planning task, calls the SDK interface to connect to the message middleware KAFKA, and publishes the constructed message to the specified topic of the message middleware KAFKA;
[0142] The message contains specific information of the city distribution logistics scheduling planning task, such as data set ID, parking lot data, cargo data, customer address, customer's specific cargo demand, etc.;
[0143] The solver module subscribes to the specified topic of the message middleware KAFKA through the SDK interface. When a new city distribution logistics scheduling planning task is published to the specified topic of the message middleware KAFKA, the solver module will receive the message;
[0144] After the external business system publishes the message of the urban distribution logistics scheduling planning task to the designated topic of the message middleware KAFKA, the solver module receives the message.
[0145] S3: Execute the city distribution logistics scheduling planning task;
[0146] The solver module executes the city distribution logistics scheduling planning task according to the specific information of the city distribution logistics scheduling planning task contained in the message;
[0147] The following sub-steps are included:
[0148] S31: Get the dataset from MySQL;
[0149] The solver module receives the message, parses the specific information of the city distribution logistics scheduling planning task contained in the message, and obtains the corresponding dataset data from MySQL according to the dataset ID contained in the message;
[0150] S32: Create subprocesses and execute each subprocess;
[0151] The cpu_count function is used to obtain the number of CPU cores of a large-scale urban distribution logistics capacity scheduling system with scalable computing power, and a corresponding number of child processes are created according to the number of CPU cores;
[0152] Each subprocess is started through the start function, and the execution process of the subprocess is as follows:
[0153] S321: Allocate vehicles and goods;
[0154] Allocate vehicles and goods based on the cargo information in the city distribution logistics scheduling planning task and the vehicle model data contained in the data set;
[0155] Specifically, vehicles and goods are randomly allocated in one of the following three ways;
[0156] 1. Completely random vehicle allocation: randomly select a cargo, and randomly select a matching vehicle model based on the cargo information and vehicle matching attributes; randomly select another cargo that can match this vehicle model from the remaining cargo, and assign it to the same vehicle; repeat the above steps until the remaining cargo can no longer be added to this vehicle; repeat the above steps until all cargo allocations in the city distribution logistics scheduling planning task are completed;
[0157] 2. Prioritize the allocation of vehicles based on the maximum cargo capacity:
[0158] Filter out all available models based on the vehicle attributes matching the information, sort each model according to the maximum capacity, and divide them into intervals; classify all goods contained in the cargo information into intervals according to the quality of the goods, and randomly sort multiple goods in the same interval in units of intervals. After the sorting is completed, sort them from large to small according to the intervals to form a sequence;
[0159] Take a cargo from the leftmost side of the cargo sequence, that is, remove this cargo from the sequence, randomly select a car model from the car models that match the cargo, and take a cargo that can match this car model from the remaining cargo in the cargo sequence from left to right, and assign it to the same car. Repeat the above steps until the remaining cargo can no longer be added to this car; repeat the above steps until all cargoes are assigned;
[0160] For example: The order of goods after random sorting in each area:
[0161] Interval(32,36]: [goods m, goods a, goods t];
[0162] interval(24,32]:[];
[0163] Interval (20,24]: [goods f, goods h, goods b, goods e];
[0164] Interval (10,20]: [goods w, goods l, goods z];
[0165] interval(4,10]:[cargo n];
[0166] Interval (-36,4]: [goods i, goods p];
[0167] The combined sequence: [goods m, goods a, goods t, goods f, goods h, goods b, goods e, goods w, goods l, goods z, goods n, goods i, goods p];
[0168] 3. Unify the vehicles for goods in adjacent positions: Randomly arrange all goods to obtain a randomly arranged goods sequence; take the leftmost goods in the above goods sequence from the goods sequence, randomly select a model from the models that match this goods, and use this goods as the comparison target goods;
[0169] Among the remaining goods in the goods sequence, a goods that can be matched with this vehicle model is obtained in order from left to right, and the goods are closest to the comparison target goods. This goods and the comparison target goods are assigned to the same vehicle and taken out from the goods sequence; the distance is obtained by the distance between the starting position point and the arrival position point of the distance matrix data;
[0170] Take this cargo as the new comparison target cargo and repeat the above steps until the remaining cargo in the cargo sequence cannot be added to this vehicle; repeat the above steps until all cargoes are allocated;
[0171] By randomly adopting three vehicle allocation algorithms, namely, completely random vehicle allocation, priority allocation of large-volume goods, and uniform allocation of goods in adjacent locations, the speed of obtaining the optimal solution is accelerated without affecting the randomness of the heuristic algorithm.
[0172] S322: Performing route planning for the assigned vehicle;
[0173] After the goods are distributed, the route planning is performed for the vehicle containing the goods, i.e., the vehicle that has been assigned the task;
[0174] The route planning of the bicycle refers to the route planning in which the vehicle starts from the parking lot, visits the customer addresses corresponding to each customer data in the task in a certain order, and finally returns to the starting parking lot;
[0175] The following mathematical model is used to plan the route of the assigned vehicle:
[0176]
[0177] st
[0178]
[0179] s n+1 ≤T (3.2)
[0180]
[0181] ∑ i∈N ∑ j∈N (x ij *d ij )≤MD (5.1)
[0182]
[0183] Among them, x ij is a path variable. The subscripts i and j indicate whether the path from customer point i to customer point j is selected. ij The value of is 0 or 1. If it is 0, it means that the path from customer point i to customer point j is not selected. If it is 1, it means that the path from customer point i to customer point j has been selected.
[0184] y ij is the cumulative demand variable, and the subscripts i and j represent the current cumulative customer demand for vehicles from customer point i to customer point j, such as the cumulative cargo volume, etc.; ij The range is 0-the maximum volume of the vehicle;
[0185] s i is the time point variable of reaching each customer, the subscript i represents the customer point i, and the s i The value of is the specific time of arrival at customer point i, s i is an integer;
[0186] Set N is the set of all points, including the starting point set {0}, the customer point set C: {1, 2, ..., n}, and the end point set {n+1};
[0187] Set C is a customer data set {1, 2, ..., n};
[0188] q i Meet the needs of customers at their specific locations;
[0189] t ij is the travel time from customer point i to customer point j;
[0190] serviceTime i The service time at customer point i;
[0191] Q is the maximum capacity of the car;
[0192] T is the maximum return time of the trip;
[0193] is the time right window for customer j;
[0194] d ij is the mileage from i to j;
[0195] MD is the maximum distance in the route;
[0196] The customer point corresponds to the customer address;
[0197] (1.1) is the route planning with the least mileage, (1.2) is the route planning with the least total time, and (1.3) is the route planning with the least total cost;
[0198] (2.1) Each customer point and the end point are visited only once;
[0199] (2.2) Only one vehicle departs from the starting point and each customer point;
[0200] (2.3) It is the demand constraint for customer i, that is, the vehicle load when leaving customer point i - the vehicle load when just arriving at customer point i = the demand at customer point i;
[0201] (2.4) The cumulative demand cannot exceed the maximum capacity of the current vehicle;
[0202] (3.1) When the customer arrives at the next point of i - when the customer arrives at point i = the driving time from i to j + the waiting time + the service time at i, K is a very large coefficient, such as 99999999;
[0203] (3.2) It is the constraint of the maximum return time of the itinerary;
[0204] (4.1) It is used to ensure the constraint of the access order. In the formula, P h represents the binary tuple of the position points with requirements for the access sequence. The subscript h is the serial number of the binary tuple and has no business meaning. For example, P h = {5, 2}. In the formula in 4.1: it becomes s5 < s2; by constraining that the time to reach customer 5 is less than the time to reach customer 2, the purpose of the access customer sequence constraint is achieved;
[0205] (5.1) It is the constraint of the maximum driving distance of the route;
[0206] (6.1) It is the value range of the decision variable x ij ;
[0207] (6.2) It is the value range of the decision variable y ij ;
[0208] (6.3) It is the acquisition range of the decision variable s i ;
[0209] After the operation of each subprocess ends, the execution result is a score and a route planning scheme. The route planning scheme includes the planning scheme data of the vehicle, route data, route detailed data, customer point - cargo relationship data, etc.;
[0210] The planning scheme data includes the scheme id, scheme score, etc.;
[0211] The route data, that is, the relationship between the route and the vehicle type, includes the vehicle type used for the route, etc.;
[0212] The route detailed data includes the vehicles used in the route, the remaining capacity of the vehicles at the current location, the accumulated travel distance, the accumulated travel time, etc.;
[0213] The customer-point cargo relationship data includes cargo data loaded and unloaded at a designated customer point on the current route, etc.;
[0214] S33: Save the execution result of the subprocess to the MySQL database;
[0215] The steps include:
[0216] S331: Check whether there is a child process still running;
[0217] Check whether there is any child process still running through the is_alive function. If there is any child process still running, continue to execute the child process; if there is no child process, it means that all child processes have been completed, and go to step S332;
[0218] S332: Obtain the final route planning result of the execution results of each sub-process;
[0219] If all subprocesses have finished running, the execution results of each subprocess are compared through a heuristic algorithm to obtain the global optimal solution;
[0220] The sub-process execution result corresponding to the global optimal solution is the final route planning result, and the final route planning result is saved in MySQL;
[0221] Specifically, the heuristic algorithm compares the execution results of each subprocess and obtains the global optimal solution as follows:
[0222] Randomly obtain an execution result as the current global optimal solution. The execution result is a score and a route planning scheme. The current temperature and the end temperature are set according to the score of the current optimal solution. The current temperature = score * 100, and the end temperature = score.
[0223] Randomly obtain another execution result. If the score of this round is less than the score of the previous round, keep the execution result of this round, and obtain the local optimal solution through neighborhood search. The score of the local optimal solution is used as the score of this round. If the score of this round is less than the score of the global optimal solution, the local optimal solution of this round replaces the original global optimal solution and becomes the new global optimal solution.
[0224] If the score of this round is greater than the score of the previous round, the acceptance probability value is obtained through the algorithm, and the current temperature value is reduced. For example, the current temperature = current temperature * 0.095. A probability value is randomly generated through the random.uniform function. If the probability value is greater than the acceptance probability value, the global optimal solution of the previous round is retained; if the probability value is less than the acceptance probability value, the local optimal solution is obtained through neighborhood search, and the score of the local optimal solution is used as the score of this round. If the score of this round is less than the score of the global optimal solution, the local optimal solution of this round replaces the original global optimal solution and becomes the new global optimal solution;
[0225] Repeat the above steps until the execution results of all sub-threads have been judged and the final global optimal solution is obtained. The sub-process execution result corresponding to the global optimal solution is the final route planning result, and the final route planning result is saved in MySQL;
[0226] Furthermore, in the neighborhood search, the execution results are randomly transformed and the local optimal solution of the execution results is obtained by comparing the random transformation results;
[0227] The random transformations include the following three types:
[0228] 1. Goods exchange: Randomly select two vehicles from the execution results, and then randomly select a piece of goods from each vehicle for exchange, for example:
[0229] Before exchange:
[0230] Cargo of vehicle A: [cargo 1, cargo 2, cargo 3, ...];
[0231] Cargo of vehicle B: [cargo 7, cargo 8, cargo 9, ...];
[0232] After swap:
[0233] Cargo of vehicle A: [cargo 1, cargo 9, cargo 3, ...];
[0234] Cargo of vehicle B: [cargo 7, cargo 8, cargo 2, ...];
[0235] 2. Change of cargo distribution vehicle
[0236] Randomly select two cars, randomly select a cargo from the first car, and put it in the second car; for example:
[0237] Before exchange:
[0238] Cargo of vehicle A: [cargo 1, cargo 2, cargo 3, ...];
[0239] Cargo of vehicle B: [cargo 7, cargo 8, cargo 9, ...];
[0240] After swap:
[0241] Cargo of vehicle A: [cargo 1, cargo 2, ...];
[0242] Cargo of vehicle B: [cargo 3, cargo 7, cargo 8, cargo 9, ...];
[0243] 3. Consolidation of multiple vehicles
[0244] Randomly select two vehicles and put all the goods in the vehicle with smaller total usage capacity into the other vehicle; for example:
[0245] Before exchange:
[0246] Cargo of vehicle A: [Cargo 1, Cargo 2];
[0247] Cargo of vehicle B: [cargo 7, cargo 8, cargo 9, ...];
[0248] After swap:
[0249] Cargo of vehicle B: [cargo 1, cargo 2, cargo 7, cargo 8, cargo 9, ...];
[0250] Furthermore, the solver module sends a heartbeat message to the message middleware KAFKA at a period of 30 seconds; the reporting status of the heartbeat message includes idle and running, the idle state means that the solver state is idle, and the running state means that the solver state is running;
[0251] When there is a city distribution logistics scheduling planning task being processed in the solver module, the solver status in the heartbeat message sent is running. At the same time, the heartbeat message contains the specific processing information of the city distribution logistics scheduling planning task; when there is no city distribution logistics scheduling planning task being processed in the solver module, the solver status in the heartbeat message sent is idle;
[0252] The indicator monitoring module receives and parses the heartbeat message in the message middleware KAFKA. According to the timestamp of the heartbeat message, it determines whether there is a situation where the reporting period has been exceeded but the heartbeat message has not been received. If so, it means that the solver has stopped serving. At this time, the solver status is stopped; the indicator monitoring module caches the current status of the solver in the middleware Redis;
[0253] By sending heartbeat messages to the message middleware KAFKA, the message middleware is informed of the current solver task processing status and specific processing information; the solver status and processing information can be monitored in real time without active query or polling, so that the system can respond and process status changes more quickly; the message middleware KAFKA records the heartbeat message and can track the solver status history, which is very useful for troubleshooting, performance analysis and system optimization, and is conducive to improving the reliability, stability and maintainability of the system;
[0254] S34: Release the execution results of the city distribution logistics scheduling planning task;
[0255] Publish the execution results of the city distribution logistics scheduling planning task to the specified topic of the message middleware KAFKA;
[0256] S4: The city distribution logistics scheduling planning task processing is completed;
[0257] The external business system module receives the execution results of the city distribution logistics scheduling planning task from the message middleware KAFKA through the SDK interface, and the city distribution logistics scheduling planning task processing is completed;
[0258] Preferably, when the external business system needs to know the current state of the solver, the cached state information is obtained from the middleware Redis; the SDK interface returns the solver state information queried by the indicator monitoring module to the external business system;
[0259] Furthermore, the external business system module can enable the function of dynamically adjusting the number of solvers through the SDK interface; when the indicator monitoring module determines that the system needs to adjust the number of solvers, it will generate corresponding control instructions, which include increasing or decreasing the number of solvers, and sending the control instructions to a specific location in Redis. The solver module periodically checks whether there are new control instructions in Redis. When there are new control instructions, the solver module obtains and parses these control instructions; according to the information in the control instructions, the solver module will automatically perform corresponding operations, such as increasing or decreasing the number of solvers; after the solver module executes the control instructions, it will feed back the execution results to the system and update its own status.
[0260] By dynamically adjusting the number of solvers, the number of solvers can be quickly adjusted according to actual needs to better adapt to business changes or system loads.
[0261] The present invention not only supports various common urban distribution logistics scheduling planning scenarios, such as: vehicle routing problems with time windows, vehicle routing problems with multiple distribution centers, vehicle routing problems with multi-objective optimization, vehicle routing problems for pickup and delivery, etc., but also supports customizable business function expansion to meet the needs of daily urban distribution logistics scheduling; the present invention has complete monitoring capabilities, which can not only understand the computing status of the task in real time, but also intelligently scale the computing power, which saves costs and improves resource utilization.
[0262] The present invention creatively adopts architectural design and combines containerized deployment of algorithm modules to dynamically and elastically scale the number of containers of the algorithm modules by monitoring the results of the modules, thereby saving costs and improving resource utilization.
[0263] The present invention has been described by the above-mentioned relevant embodiments, however, the above-mentioned embodiments are only examples for implementing the present invention. It must be pointed out that the disclosed embodiments do not limit the scope of the present invention. On the contrary, changes and modifications made without departing from the spirit and scope of the present invention are all within the scope of patent protection of the present invention.
Claims
1. A large-scale urban distribution logistics capacity scheduling method with scalable computing power, characterized by: The following steps are involved: S1: Get the dataset and transfer it to the MySQL database; The external business system module obtains multiple data sets for urban distribution logistics scheduling planning from internal data sources. The data sets include data set ID, parking lot data, vehicle model data, customer data, cargo data, distance matrix data, time matrix data, cargo mutual exclusion matrix data, and cargo-vehicle matching data. The dataset id is unique; The external business system module transfers each data set to the MySQL database through the SDK interface, and the MySQL database receives and saves the data set; S2: Publish and receive city distribution logistics scheduling planning tasks; The external business system module constructs the message of the city distribution logistics scheduling planning task, calls the SDK interface to connect to the message middleware Kafka, and publishes the constructed message to the specified topic of the message middleware Kafka; The message contains specific information about the city distribution logistics scheduling planning task; The solver module subscribes to the designated topic of the message middleware KAFKA through the SDK interface. When a new urban distribution logistics scheduling planning task is published to the designated topic of the message middleware KAFKA, the solver module will receive the message; After the external business system publishes the city distribution logistics scheduling planning task message to the designated topic of the message middleware KAFKA, the solver module receives the message; S3: Execute city distribution logistics scheduling and planning tasks; The solver module executes the city distribution logistics scheduling planning task according to the specific information of the city distribution logistics scheduling planning task contained in the message; The following sub-steps are included: S31: Get the dataset from MySQL; The solver module receives the message, parses the specific information of the urban distribution logistics scheduling planning task contained in the message, and obtains the corresponding dataset data from MySQL according to the dataset ID contained in the message; S32: Create subprocesses and execute each subprocess; Use the cpu_count function to obtain the number of CPU cores in a large-scale, scalable urban logistics capacity scheduling system, and create a corresponding number of child processes based on the number of CPU cores. Start each subprocess through the start function; The following sub-steps are included: S321: Allocate vehicles and goods; Assign vehicles and goods based on the cargo information in the urban distribution logistics scheduling planning task and the vehicle model data contained in the dataset; The allocation methods of vehicles and goods include completely random vehicle allocation, priority allocation of vehicles according to the maximum capacity of goods, and unified allocation of vehicles for goods in adjacent locations. S322: Planning a route for each vehicle that has been assigned a task; After the goods are allocated, a mathematical model is used to plan the route of the vehicle that carries the goods, i.e., the assigned vehicle. The bicycle route planning refers to the route planning of the vehicle starting from the parking lot, visiting the customer addresses corresponding to the customer data in the task in sequence, and finally returning to the starting parking lot; The mathematical model is as follows: Among them, x ij is the path variable, and the subscripts i and j indicate whether the path from customer point i to customer point j is selected. ij The value of is 0 or 1. If it is 0, it means that the path from customer point i to customer point j has not been selected. If it is 1, it means that the path from customer point i to customer point j has been selected. y ij is the cumulative demand variable, and the subscripts i and j represent the current cumulative customer demand for vehicles from customer point i to customer point j; ij The range is 0-the maximum volume of the vehicle; s i is the time point variable of reaching each customer, subscript i represents customer point i, and the s i The value of is the specific time of arrival at customer point i, s i is an integer; Set N is the set of all points, including the starting point set {0}, the customer point set C: {1, 2, ..., n}, and the end point set {n+1}; Set C is the customer data set {1, 2, ..., n}; q i Meet the needs of customers at their specific point; t ij is the travel time from customer point i to customer point j; serviceTime i The service time at customer point i; Q is the maximum capacity of the car; T is the maximum return time of the trip; is the time right window for customer j; d ij is the mileage from i to j; MD is the maximum distance in the route; The customer point corresponds to the customer address; (1.1) is the route planning with the least mileage, (1.2) is the route planning with the least total time, and (1.3) is the route planning with the least total cost; (2.1) means that each customer point and destination will only be visited once; (2.2) is the starting point and each customer point, there will be only one car leaving; (2.3) is the demand constraint for customer i, i.e., the vehicle load when leaving customer point i - the vehicle load when just arriving at customer point i = the demand at customer point i; (2.4) The cumulative demand cannot exceed the maximum capacity of the current vehicle; (3.1) is the time when the customer arrives at the next point i - the time when the customer arrives at point i = the travel time from i to j + the waiting time + the service time at point i; (3.2) is the constraint on the maximum return time of the trip; (4.1) is used to ensure the access order constraint, where P h A pair of locations that require a visit order. The subscript h is the sequence number of the pair and has no business significance. (5.1) is the maximum travel distance constraint of the route; (6.1) is the decision variable x ij The value range of (6.2) is the decision variable y ij The value range of (6.3) is the decision variable s i the scope of acquisition; After each sub-process is completed, the execution result is a score and a route planning scheme, which includes vehicle planning scheme data, route data, route details, and customer-point-goods relationship data; The planning scheme data includes scheme ID and scheme score; The route data refers to the relationship between the route and the vehicle type, including the vehicle type used for the route; The route detailed data includes the vehicle used for the route, the remaining capacity of the vehicle at the current location, the cumulative travel distance, and the cumulative travel time; The customer-point cargo relationship data includes cargo data loaded and unloaded at a designated customer point on the current route; S33: Save the execution result of the subprocess to the MySQL database; The following sub-steps are included: S331: Check whether there is a child process still running; Check whether any child process is still running through the is_alive function. If any child process is still running, continue to execute the child process; if not, it means that all child processes have ended, and go to step S332; S332: Obtain the final route planning result of the execution results of each sub-process; If all subprocesses have finished running, the execution results of each subprocess are compared through a heuristic algorithm to obtain the global optimal solution; The result of executing the sub-process corresponding to the global optimal solution is the final route planning result, which is saved in MySQL; S34: Release the execution results of the urban distribution logistics scheduling planning task; The solver module publishes the execution results of the urban distribution logistics scheduling planning task to the designated topic of the message middleware KAFKA; S4: The city distribution logistics scheduling planning task is completed; The external business system module receives the execution results of the urban distribution logistics scheduling planning task from the message middleware KAFKA through the SDK interface, and the urban distribution logistics scheduling planning task processing is completed; When an external business system needs to know the current status of the solver, it obtains the cached status information from the middleware Redis; the SDK interface returns the solver status information queried by the indicator monitoring module to the external business system.
2. The large-scale urban distribution logistics capacity scheduling method with scalable computing power as claimed in claim 1 is characterized by: The three methods of allocating vehicles and goods are as follows:
1. Completely random vehicle allocation: Randomly select a shipment and randomly select a matching vehicle model based on the shipment information and vehicle matching attributes. From the remaining shipments, randomly select another shipment matching this vehicle model and assign it to the same vehicle. Repeat the above steps until all remaining shipments can no longer be added to this vehicle. Repeat the above steps until all shipments in the urban distribution logistics scheduling planning task are allocated.
2. Prioritize vehicle allocation based on maximum cargo capacity: Filter all available vehicle models based on the matching vehicle attributes in the cargo information, sort each model by maximum capacity, and divide it into intervals. All cargo included in the cargo information is categorized into intervals based on cargo quality. Multiple cargoes in the same interval are randomly sorted by interval. After sorting, the cargoes are sorted from largest to smallest interval to form a sequence. Take a cargo from the leftmost side of the cargo sequence, that is, remove this cargo from the sequence, randomly select a car model from the car models that match the cargo, and take a cargo that matches this car model from the remaining cargo in the cargo sequence from left to right, and assign it to the same car. Repeat the above steps until the remaining cargo can no longer be added to this car; repeat the above steps until all the cargo has been assigned; 3. Unify adjacent cargoes into vehicles: Randomly arrange all cargoes to obtain a randomly arranged cargo sequence. Take the leftmost cargo in the sequence and randomly select a vehicle model from the vehicle models that match this cargo. This vehicle model is used as the comparison target. From the remaining goods in the goods sequence, find a goods that matches this vehicle type in order from left to right. This goods is closest to the comparison target goods. This goods and the comparison target goods are assigned to the same vehicle and removed from the goods sequence. The distance is calculated from the distance between the starting position and the arrival position in the distance matrix data. Use this cargo as the new comparison target cargo and repeat the above steps until the remaining cargo in the cargo sequence cannot be added to this vehicle; repeat the above steps until all cargo is allocated.
3. The large-scale urban distribution logistics capacity scheduling method with scalable computing power as claimed in claim 1 is characterized by: In step S33, the solver module sends a heartbeat message to the message middleware KAFKA with a period of 30 seconds; the reporting status of the heartbeat message includes idle and running, the idle state means the solver state is idle, and the running state means the solver state is running; When there is a city distribution logistics scheduling planning task being processed in the solver module, the solver status in the heartbeat message sent is running. At the same time, the heartbeat message contains the specific processing status information of the city distribution logistics scheduling planning task; When there is no city distribution logistics scheduling planning task being processed in the solver module, the solver status in the heartbeat message sent is idle; The indicator monitoring module receives and parses the heartbeat message in the message middleware KAFKA. Based on the timestamp of the heartbeat message, it determines whether there is a situation where the reporting period has been exceeded but the heartbeat message has not been received. If so, it means that the solver has stopped service. At this time, the solver status is stopped; the indicator monitoring module caches the current status of the solver in the middleware Redis.
4. The large-scale urban distribution logistics capacity scheduling method with scalable computing power as claimed in claim 2 is characterized by: The external business system module can enable the function of dynamically adjusting the number of solvers through the SDK interface; when the indicator monitoring module determines that the system needs to adjust the number of solvers, it will generate corresponding control instructions, which include increasing or decreasing the number of solvers, and send the control instructions to Redis. The solver module regularly checks whether there are new control instructions in Redis. When there are new control instructions, the solver module obtains and parses these control instructions; according to the information in the control instructions, the solver module will automatically perform the corresponding operations; after the solver module executes the control instructions, it will feed back the execution results to the system and update its own status.
5. A large-scale urban distribution logistics capacity scheduling system with scalable computing power, used to implement the large-scale urban distribution logistics capacity scheduling method with scalable computing power according to any one of claims 1 to 4, characterized in that: Including MySQL database, message middleware KAFKA, solver module, indicator monitoring module, and middleware Redis; It also includes an external business system module, which is used to integrate the SDK interface provided by this system to interact with the system for data; The MySQL database is used to store the input data set of each city distribution logistics scheduling planning task and the final route planning result returned after the city distribution logistics scheduling planning task is completed; The message middleware KAFKA is used to publish urban distribution logistics scheduling planning tasks, receive the results of urban distribution logistics scheduling planning tasks, and publish and receive the solver's heartbeat data; The solver module is used to receive the city distribution logistics scheduling planning task and perform multi-core parallel computing to solve it, and return the obtained approximately optimal route planning solution to the external business system module; The indicator monitoring module is used to collect and analyze the heartbeat data of each solver, analyze the current status of each solver and the processing status of the urban distribution logistics scheduling planning task; The middleware Redis is used to cache solver status, task status and instruction data.
Citation Information
Patent Citations
Urban distribution path decision-making method considering consumables under cold-chain logistics
CN116452097A
Scenarized vehicle distribution and route planning method for customizing access sequence
CN117077869A
Intelligent traffic dispersion management system for industrial upstairs
CN117975713A
Aggregating system
US20160140519A1
Fourth-party logistics transportation edge planning method based on ant colony optimization algorithm
WO2023245740A1
