Method for planning paths with time windows in multiple types of places

By defining the M-TSPTW problem, building the objective function and optimizing the access order and plan, the path planning problem of travel merchants in multiple types of places is solved, and the fast and effective optimal path generation is achieved, adapting to the needs of multiple types of nodes, and reducing the computational complexity.

CN120387562APending Publication Date: 2025-07-29YANGZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510562812.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-30
Publication Date
2025-07-29

AI Technical Summary

Technical Problem

The existing technology is difficult to effectively solve the problem of travel dealers with time windows in multiple types of places, especially in the long-term operation, where travel plans are reasonably arranged and the optimal path is found. The traditional heuristic method has a long calculation time and cannot meet the hard time constraints.

Method used

The time-window path planning method in multiple types of places is adopted, and the objective function is constructed by defining the M-TSPTW problem, and the initial path is generated using hard time constraints and semantic constraints. Combining idle time insertion and neighborhood search, the access order and planning are optimized to form the optimal path.

Benefits of technology

Quickly find the optimal path, reduce computing time, meet hard time constraints, adapt to the needs of multiple nodes, improve the practical application value of path planning, and reduce computing complexity.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120387562A_ABST
    Figure CN120387562A_ABST
Patent Text Reader

Abstract

The invention discloses a path planning method with a time window in a multi-type place, which is based on a defined travel salesman problem M-TSPTW with the time window in the multi-type place and an objective function, and comprises four stages: classifying nodes according to places and time, and obtaining an initial path of a travel salesman every day based on nodes which can only be accessed in a certain day; searching the idle time of the initial path, and if the open time and the idle time of the multi-day time window node are overlapped, inserting the node into a corresponding position; for the nodes which are not successfully inserted into the path, performing neighborhood search based on the idle time of the current path, and adding the multi-day time window nodes into the path through multiple times of replacement to form a new path; and disturbing the new path to reduce the total length of the final path, and only changing the access sequence of the nodes in a certain day, or selecting and exchanging the nodes in the paths in certain two days. In order to solve the problem of overlong time consumption of the existing hard time constraint M-TSPTW precise algorithm, the invention provides a partially fixed strategy and a time-based neighborhood search strategy, thereby reducing the calculation amount and accurately judging the feasibility of the problem.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of solving the Traveling Salesman Problem, and particularly to a path planning method with time windows in multi-type places. Background Art

[0002] The Traveling Salesman Problem (TSP) is a classical combinatorial optimization problem, which refers to finding the shortest path that visits all nodes in a given graph and returns to the starting point. The TSP with Time Windows (TSPTW) is a combinatorial optimization problem that adds access time restrictions to each node based on TSP, and the Multiple-TSP with Time Windows (M-TSPTW) makes the nodes considered in the problem more diversified on this basis. This diversification is first reflected in the dates. Each node has multiple time windows, and at most one time window is opened per day. In addition, these nodes are roughly divided into four categories in terms of time and location: First, the location is determined and the time is determined. It must arrive at the specified location within the specified time window range, and such nodes only need to be visited once. Second, the location is determined but the time is uncertain. The time constraint is less, but it must be visited every day. Third, the location is uncertain but the time is determined. At least one such node must be selected in the path within a fixed time every day. Fourth, the location is uncertain and the time is uncertain. The traveling salesman needs to visit at least one such node every day.

[0003] M-TSPTW has broad application prospects in daily life and company operations. For example, in the schedule arrangement of a decoration company, after receiving messages from multiple customers, multiple time slots for on-site communication with customers (the first type of nodes) are reserved. These agreed-upon times are reasonably planned and then assigned to designers. The designers go to work, visit customers' homes to inquire about customers' needs and conduct on-site inspections. To avoid disturbing customers' lunch breaks, the designers can choose a nearby restaurant (the third type of nodes) during the noon period. At any time during working hours, the designers return to the company (the second type of nodes) once to submit the design requirements that were left over the previous day and those of the current day to the company. During the free time after work, the designers can choose any supermarket (the fourth type of nodes) to shop. This mode is closer to the actual travel decision-making and provides new ideas for new path planning problems.

[0004] By introducing dates and diverse nodes, M-TSPTW provides more possibilities for selection for the originally severe time constraints, increases the complexity of the problem, and also improves its value in practical applications. Although heuristic methods can quickly obtain approximate solutions to the problem, these algorithms lack a scheduling function. What they always consider is a path passing through all nodes, which does not conform to the long-term operation modes of many current companies. Therefore, they cannot be directly applied to the M-TSPTW problem. It is necessary to develop a special algorithm for M-TSPTW for long-term scheduling and path planning to meet its unique multi-day access requirements. Summary of the Invention

[0005] Objective of the Invention: The objective of the present invention is to provide a time-windowed path planning method in multi-type venues, which effectively solves the multi-type venue time-windowed traveling salesman problem (M-TSPTW). On the premise of meeting time constraints, it reasonably arranges travel plans and quickly finds the optimal path.

[0006] Technical Solution: To achieve the above objective, a time-windowed path planning method in multi-type venues according to the present invention includes the following steps:

[0007] Step 1: Define the multi-type venue time-windowed traveling salesman problem (M-TSPTW).

[0008] Step 2: Construct the objective function of the multi-type venue time-windowed traveling salesman problem (M-TSPTW).

[0009] Step 3: Based on hard time constraints and semantic constraints, find the optimal path for the traveling salesman to visit for multiple days, minimizing the objective function. The semantic constraints determine whether a certain node in the specified node set V must be visited, thereby judging whether the position of the node is determined. The optimal path requires that there is at least one of the nodes with uncertain positions in each day's path P i and the final path should cover all nodes with determined positions. The hard time constraints require that the traveling salesman must arrive before the access time window of a certain node closes on the same day. Specifically, it includes:

[0010] Step 31: Classify the nodes in the set V according to location and time to further obtain the single-day time-window node set Based on the set C * Obtain the initial path of the traveling salesman for each day.

[0011] Step 32: Based on the initial path, use the insertion addition method to insert the nodes in the multi-day time-window node set Ct\C * into the corresponding date paths according to the opening dates of their respective time windows. If it cannot be ensured that the path after inserting the node v i meets the time constraints, it is regarded as an addition failure.

[0012] Step 33: For the nodes that failed to be added and remained in Ct\C * , retrieve the idle time in all paths, perform neighborhood search, and add the nodes in Ct\C * to the paths through multiple replacements to form new paths.

[0013] Step 34: Modify each day's path P i based on semantic constraints. First, optimize the access order, that is, ensure that the access plan for the same day remains unchanged, and change the access order of the nodes to reduce P iThe path length, and then optimize the access plan, that is, swap the paths P of two days i , P j of some nodes in it, so that the total path length of these two days is reduced, and the objective function value is reduced through these two optimization methods to search for the optimal path;

[0014] Step 4: Visualize the optimal path.

[0015] Among them, the definition method of the traveling salesman problem with time windows in multi-type venues described in step 1 is as follows:

[0016] The traveling salesman problem with time windows in multi-type venues is defined on the complete graph G=(V, E); V represents the set of nodes in the complete graph, |V| = n means there are n nodes in the set; E represents the set of connections between nodes in the complete graph;

[0017] The node set V is determined by c nodes with determined locations and times Ct = {v1, v2, ···, v c}、1 node with a determined location and an undetermined time p = v c+1 、r nodes with undetermined locations but determined times Rt = {v c+2 , v c+3 , ···, v c+r+1}、n - c - r - 2 nodes with undetermined locations and undetermined times Mk = {v c+r+2 , v c+r+3 , ···, v n-1} and the starting point v0, that is, V = v0 ∪ p ∪ Ct ∪ Rt ∪ Mk; where v0 represents the starting point and the ending point of the path; for v i = (x i , y i , TW i ), where (x i , y i ) represents the coordinates of this node, and TW i represents the time window set of this node.

[0018] Among them, time constraints are defined for the access order of all nodes to form the traveling salesman problem with time windows in multi-type venues M-TSPTW, and the definition method of the time constraints is:

[0019] 1) The traveling salesman does not need to stay at a certain node all the time during the time when the time window is open, but only needs to arrive or arrive in advance within the specified time. The time the traveling salesman stays at a certain node is determined by the type of this node;

[0020] 2) Set |TW i| = m, each node can have at most one time window per day. Let D = {d1, d2, ···, d m}, representing the set of these m dates; where represents a time window when node v i opens at d m . represents the opening time of this window, represents the closing time. If , it means that on day d m , the traveling salesman cannot visit it, or it is considered that node v i has no time window on that day; use d(v i ) to query the dates when node v i can be visited. If d j ∈d(v i ), it means that the traveling salesman can visit v j on the day with date d i . 1 ≤ |d(v i )| ≤ m indicates that for node v i , within the m dates shown in D, it can be visited on at least one day and at most every day;

[0021] 3) When i ∈ [1, c], at least one of the time windows in TW i is not (None, None), and each time window can be different or the same;

[0022] 4) When i = c + 1, TW i consists of m time windows of (wks, wke). wks represents the start time of work, usually 8:00, and wke represents the end time of work, usually 17:00; The traveling salesman only needs to arrive within working hours every day to upload data. Because the time arrangement is relatively loose, this node p = v c+1 is listed separately as the type where the location is determined but the time is not;

[0023] 5) When i ∈ [c + 2, c + r + 1], TW i consists of m identical time windows. The traveling salesman needs to visit at least one node of the type where the location is not determined but the time is determined within a fixed period of time every day;

[0024] 6) When i ∈ [c + r + 2, n - 1], TW i consists of m time windows of (wke, de). wke represents the end time of work, usually 17:00, and de represents the end time of the day, usually 23:59. After the working hours every day, the traveling salesman visits at least one node of the type where the location and time are not determined;

[0025] In the present invention, the semantic constraint requires that there be at least one of various non-essential nodes in the daily path, that is:

[0026]

[0027]

[0028] At the same time, the semantic constraint also requires that the optimal path P formed by multi-day paths cover all nodes with determined positions:

[0029] P ∩ Ct = Ct (4).

[0030] Among them, the method for constructing the objective function of the multi-type location traveling salesman problem with time windows M-TSPTW in step 3 is as follows:

[0031]

[0032] In the formula, is used to judge whether the traveling salesman passes through the edge (v i , v j ). If then it means that the traveling salesman passes through the edge (v i , v j ), otherwise the traveling salesman does not pass through the edge (v i , v j ); d ij represents the distance from node v i to v j , that is, the length of the edge (v i , v j ); x i , x j respectively represent the abscissas of nodes v i , v j , and y i , y j respectively represent the ordinates of nodes v i , v j ;

[0033]

[0034] Establish formula (8) to ensure that there is no time conflict in the final path:

[0035]

[0036] Among them, o i is a binary indicator used to determine whether the arrival time at v i is within the corresponding time window. If the arrival time is earlier than the closing time of the time window, then o i = 0, otherwise oi = 1;

[0037] The traveling salesman starts from the starting point v0 and finally ends at v0, which is constrained by formulas (8)-(10):

[0038]

[0039] Among them, the method of classifying the nodes in V according to location and time described in step 31 is as follows:

[0040] The nodes in the set V are classified into five categories: v0, p, Ct, Rt, and Mk according to location and time, where Ct = {v1, v2, ···, v c} is a set of c nodes with determined locations and determined times, p = v c+1 is 1 node with a determined location and an undetermined time, Rt = {v c+2 , v c+3 , ···, v c+r+1} is a set of r nodes with undetermined locations but determined times, Mk = {v c+r+2 , v c+r+3 , ···, v n-1} is a set of n - c - r - 2 nodes with undetermined locations and undetermined times, and v0 is the starting point;

[0041] In addition, the semantic constraint requires that all nodes in Ct must be visited by the traveling salesman once, but there is no restriction on the visit date, while v0 and p must appear in the daily path, and at least one node of each of the remaining types must be included in the daily path.

[0042] Among them, the insertion method described in step 32 includes the following steps:

[0043] Step 321: After classification, the set of nodes with determined locations is Ct, where the single-day time-window node C * is already in the initial path, and the insertion-based addition mainly targets the multi-day time-window nodes Ct\C * , and retrieve the free time in the current path P, denoted as FT;

[0044] Step 322: Traverse the multi-day time-window nodes v * in the set Ct\C j in turn, check whether the time-window set TW j of v j has an intersection with the free time FT. If there is an intersection, try to add vj to the current path P, and denote the new path formed after adding v j as P new ;

[0045] Step 323: Judge P newWhether there is a time conflict in it. If there is no time conflict, update the current path to: P = P new , and remove v j from Ct\C * ;

[0046] Step 324: Repeat steps 312 - 313. If all multi - day time - window nodes have been added to the current path, stop; if, after repeated execution, there are always multi - day time - window nodes that cannot be added to the current path, it means that the free time of the traveling salesman cannot be utilized to make the traveling salesman visit more nodes. Denote the set of these unsuccessfully added multi - day time - window nodes as L, L = Ct\(C * ∪P).

[0047] Among them, step 33 performs a neighborhood search based on free time and adds the multi - day time - window nodes in L to the path through multiple replacements, including the following steps:

[0048] Step 331: Given that the free time in the current path P is FT. For the sake of distinction, the nodes in the set L will be called customers hereafter, to distinguish them from the nodes of the tree. Assume that the customer to be added currently is x, and create a tree with the root node root;

[0049] Step 332: Traverse FT, and use each period of free time f i in FT as the leaf node node of the tree. The root node root has multiple child pointers, each pointing to a leaf node formed by free time. The leaf node records a time period (start_time, end_time) and a date date. There are also multiple child pointers and a parent pointer in the tree;

[0050] Step 333: Perform a time neighborhood search for each leaf node node, and search for a customer v i in P∪x whose time window intersects with the time period (start_time, end_time) recorded in node i . Take the time spent by the traveling salesman to communicate with the customer v new as the time period in the new leaf node node;

[0051] Step 334: The root node root is the first layer of the tree, and the nodes pointed to by the child of the root node root are the second layer, and so on. If the node node new does not appear in a lower layer, the child pointer of node points to node new , and the parent pointer of node new points to node;

[0052] Step 335: Nodes that are the same are allowed to appear in the same layer, but a node node that appears in layer α is not allowed to appear in layer β (β > α).

[0053] Step 336: Repeat steps 323 - 325. Stop repeating when a certain node in the tree contains x and its corresponding time window, or when the tree cannot generate new child nodes.

[0054] If x appears in the tree, it means that a solution solution for adding x to P has been found. Replace the nodes according to the solution and update the original path P. When there are multiple solutions, compare the lengths of the updated paths and keep the P with the smaller length as the new path. Conversely, if x does not appear in the tree and the solution is an empty set, it means that the solution does not exist, and it is determined that the time - windowed traveling salesman problem in multi - type venues has no solution on the current data set.

[0055] Among them, the addition is based on idle time priority rather than distance priority.

[0056] Among them, in step 34, the access order is optimized first, and then the access plan is optimized, including the following sub - steps:

[0057] Step 341: Access order optimization: Randomly select a date d j The path P of the day j , record P j For each node v in i On date d j Form a set with the time windows Randomly select a node v from P j , whose time window is k Find the nodes in STW that have time overlap with to form a candidate set Cand; Traverse the nodes v in Cand

[0058] , swap the access order of v a and v a and v i . If this swap successfully reduces the length of the path P j and there are no time conflicts in the path, update the path; otherwise, keep the original path;

[0059] Step 342: Access plan optimization: Randomly select a node v from P j , query the set of corresponding paths of the dates d(v k ) = {d k that v can access k}, d j , d i , ···}, which is {Pj , P i , ···}; Traverse the path set. If the date is d i and the corresponding path P i has a certain node v l that can be accessed at d j (d j ∈ d(v l ))), then swap v l and v k ; If this swap successfully reduces the length of path P j and P i and there is no time conflict in the path, update the path; otherwise, retain the original path.

[0060] Among them, the visualization of the optimal path described in step S4 refers to visualizing the edges and nodes in the optimal path; in M-TSPTW, that is, nodes carrying different semantics are represented by different colors and shapes.

[0061] Beneficial effects: The present invention has the following advantages: 1. The method of the present invention integrates time windows of different dates into TSPTW, improving the description ability of TSPTW for actual path planning problems. By introducing the concept of date, it can be closer to the application scenarios of long-term operation in reality, providing new ideas for intelligent operation and path planning;

[0062] 2. The method of the present invention can quickly find a multi-day access plan from a large number of restrictions and approach the optimal solution. At the same time, the algorithm has good scalability, allowing users to customize multiple types of nodes to quickly adapt to the needs of each customer;

[0063] 3. The method of the present invention uses a partially fixed strategy. First, generate an initial path according to the nodes of the single-day time window, determine the time occupied by these nodes, which is convenient for adjusting the travel plan according to the idle time of the traveling salesman in the initial path, reducing the search space to improve the efficiency of the algorithm;

[0064] 4. The method of the present invention uses a neighborhood search based on idle time to create a tree, accurately searching the possibility of the traveling salesman accessing a certain node under hard time constraints. Except for the root node and the nodes corresponding to the idle time, the rest of the nodes record the time when the traveling salesman talks with the customer, rather than the time window of the customer, effectively narrowing the search scope. Brief description of the drawings

[0065] Figure 1 is the path optimization flowchart of the method of the present invention;

[0066] Figure 2 is the flowchart for generating the initial path of the method of the present invention;

[0067] Figure 3 is the flowchart of the plug-in addition of the method of the present invention;

[0068] Figure 4 is the flowchart of the node replacement process of the method of the present invention;

[0069] Figure 5 is the flowchart of the access order optimization in the method of the present invention;

[0070] Figure 6 is the flowchart of the access plan optimization in the method of the present invention. Detailed implementation manners

[0071] The technical solution of the present invention will be described in detail below in conjunction with embodiments and drawings.

[0072] A path planning method with time windows in multiple types of venues according to the present invention is based on the defined multi-type venue time-window traveling salesman problem M-TSPTW and objective function. The method includes four stages to find the optimal path passed by the traveling salesman. The finding process is as Figure 1 shown and includes four stages:

[0073] Retrieve the idle time in the initial path. Based on the opening dates and times of the multi-day time-window nodes, select the overlapping part with the idle time and insert the node into one of the idle times; for the nodes that fail to be inserted into the path successfully, perform neighborhood search based on the idle time in the current path, and add the multi-day time-window nodes to the path through multiple replacements to form a new path; perform perturbation optimization on the new path to ensure that the access plan for the current day remains unchanged, change the access order of the nodes to reduce the path length, or exchange some nodes in the paths of two days to reduce the path length. The present invention provides a partial fixed strategy and a time-based neighborhood search strategy for the problem that the current exact algorithm for solving the hard time-constrained M-TSPTW consumes too much time, reduces the computational amount and accurately judges the feasibility of the problem, and at the same time finds a solution to modify the current solution into a feasible solution.

[0074] The first stage: Initial path generation stage

[0075] Step 1: First classify the nodes in the node set V( Figure 2 (a)), where p = v 10 , Ct = {v1, v2, ···, v9}, Rt = {v 11 , v 12 , v 13}, Mk = {v 14 , v 15 , v 16}.

[0076] Step 2: Then, screen the nodes from Ct that can be accessed only on a certain day, i.e., the single-day time window nodes, and we can obtain

[0077] Step 3: Sort the nodes in and respectively according to the time window. First, sort them by the closing time of the time window. If the closing times of the time windows of multiple nodes are the same on the same day, then select these nodes and sort them in ascending order according to the opening time of the time window, and keep the order of other nodes unchanged ( Figure 2 (b));

[0078] Step 4: After the sorting is completed, add the starting point and the ending point to obtain the initial path for multiple days ( Figure 2 (c));

[0079] The second stage: The insertion addition stage

[0080] Suppose the traveling salesman spends an average of 5 minutes on each path segment, and the conversation time with the customer is 60 minutes. To conform to the daily schedules of the customers and the traveling salesman, the traveling salesman starts visiting customers at 8:00 in the morning and gets off work at 17:00 in the afternoon. The customers take a lunch break from 11:00 to 13:00, and the traveling salesman also takes an appropriate break. Given the initial path Figure 3 (a), now it is necessary to add the multi-day time window nodes v 10 , v 11 to the path.

[0081] Case 1: Adopt distance-first addition, as shown in Figure 3 (b-f);

[0082] Step 1: The time window of v 10 on day1 is (08:00, 11:00). In the current path of day1, there are three nodes v3 (time window (08:00, 09:00)), v2 (time window (08:30, 10:00)), and v1 (time window (09:00, 11:00)) whose time windows intersect with (08:00, 11:00). Therefore, select the three edges (v0, v3), (v3, v2), (v2, v1), and (v1, v8). Similarly, select the edges (v6, v7), (v7, v 11 ) and (v 11 , v0) in the path of day2;

[0083] Step 2: Calculate the distances from the node v 10 to the selected edges and sort them. The following order can be obtained: d 10,(1,2) < d 10,(1,8) < d 10,(7,11) < d 10,(0,11)<d 10,(2,3) <d 10,(6,7) ;

[0084] Step 3: Since the distance d from v 10 to the edge (v2, v1) is the shortest, first try to insert v 10,(1,2) into the edge (v2, v1) to form a new path ( 10 (d)); Figure 3 );

[0085] Step 4: Check whether there is a time conflict in the new path. Mainly check the nodes visited after v 10 , that is, check whether the traveling salesman can arrive at v1, v8, and v4 before the corresponding time window closes. It can be seen that the traveling salesman arrives at v3 at 8:00, finishes the conversation and leaves at 9:00, and arrives at v2 at 9:05... The traveling salesman will arrive at v1 at 11:15, which is later than the closing time of the time window of v1, so there is a time conflict and the new path is not feasible;

[0086] Step 5: The attempt to add fails. Try to insert v 10 into the middle of the edge (v1, v8) ( Figure 3 (e)). It can be calculated that the traveling salesman will arrive at v 10 at 11:15, and there is still a time conflict. Finally, after many attempts, until v 10 is added to (v7, v 11 ) later ( Figure 3 (f)), there is no time conflict in the path, so update the path;

[0087] Case 2: Add according to idle time first, such as Figure 3 (g);

[0088] Step 6: Retrieve the idle time in the current path P, denoted as FT. As in Figure 3 (a), v8 is the first customer visited after the lunch break. The traveling salesman visits v8 at 13:00. After a 60-minute conversation, the traveling salesman leaves and visits v4 at 14:05. It can be observed that the traveling salesman does not visit other customers from 15:05 to 17:00 before getting off work. Define (15:05, 17:00) as the idle time of the traveling salesman on day1. Similarly, we can get the idle time of the traveling salesman on day2 as (14:05, 15:00) and (16:00, 17:00);

[0089] Step 7: Traverse the multi-day time window nodes v * in the set Ct\C j in turn, and check whether there is an intersection between its time window set TW j and the idle time FT. If there is an intersection, try to insert v jAdd it to the current path P, and add v j The new path formed afterwards is denoted as P new .

[0090] Step 8: Determine whether there is a time conflict in P new If there is no time conflict, then update the path, P = P new , and remove v j from Ct\C * ;

[0091] Step 9: Repeat Steps 6 to 8. If all multi-day time window nodes have been added to the path, the TM algorithm terminates. In addition, if it is repeated multiple times, but there are always multi-day time window nodes that cannot be added to the path, it means that the idle time of the traveling salesman cannot be utilized to make it visit more nodes.

[0092] The third stage: Node replacement stage

[0093] Step 1: As shown in Figure 4 (a - b), retrieve the idle time in the current path, denoted as FT( Figure 4 (c));

[0094] Step 2: Add the nodes in L to the path one by one. For the sake of distinction, the nodes in L will be called customers later, to distinguish them from the nodes of the tree. Assume that the current customer to be added is x. Create a tree, traverse FT, and use each period of idle time f i as the leaf node of the tree. The root node root has multiple child pointers, each pointing to the leaf node formed by the idle time. The leaf node records a time period (start_time, end_time) and a date date. In addition, there are multiple child pointers and a parent pointer.;

[0095] Step 3: Perform a time neighborhood search on each leaf node node. Search for customers in P∪x whose time windows intersect with the time period (start_time, end_time) recorded in node to form a new leaf node node new . If this node does not appear in the lower layer, the child pointer of node points to node new , and the parent pointer of node new points to node. Otherwise, a new leaf node cannot be generated. See specifically in( Figure 4 (d)).

[0096] Step 4: Repeat Step 3 until the currently to-be-added customer x = v7 appears in the tree or the tree cannot generate new child nodes. If x appears in the tree, it means a solution solution for adding x to P is found. Replace the nodes according to the solution and update the original path P. As Figure 4 (d) shows, the solution is found, and v7 replaces v 10 , and then use the idle time f3 to visit v 10 . When there are multiple solutions simultaneously, the lengths of the updated paths can be compared, and the P with the smaller length is retained. If the solution is an empty set, it means the solution does not exist, and it can be determined that the problem has no solution. The path P will contain as many customers in C as possible while ensuring no time conflicts.

[0097] Fourth stage: The stage of optimizing the path to obtain the optimal path

[0098] To construct a feasible solution, a node r (r ∈ Rt) and a node m (m ∈ Mk) need to be selected from Rt and Mk respectively, and r, m, and p are added to the path P of each day k After that, traverse the path of each day The length of the path is optimized in the following two ways:

[0099] 1) Optimization of access order: Record each node v j in P i at the time window on date d j Randomly select a node v from P j , and its time window is k Find the nodes with time overlap with from the above records to form the candidate set Cand. Traverse the nodes v in Cand and swap the access orders of the two nodes. If this swap successfully reduces the length of the path P a and there are no time conflicts in the path, update the path; otherwise, retain the original path. j The length of the path P

[0100] Step 1: After adding r, m, and p to the path of each day, the visitor path P of a certain day j is shown in Figure 5 (a).

[0101] Step 2: Assume that the node v7 is currently selected. The time windows of all nodes in P j on that day can be obtained from the schedule, and the nodes with time overlap with the time window of v7 are found, such as Figure 5(as shown in (b)). Try to exchange the access order of v7 and v6, and it can be found that the path length becomes longer. And it is not difficult to see that starting to communicate with the customer about v6 at 16:00 earliest and leaving v6 at 17:00, the time to access v7 has been missed, and there is a time conflict in the path, so this plan is discarded.

[0102] Step 3: Finally, it is found that exchanging the access order of v7 and v5 can shorten the path, and the feasibility of the path is not damaged, so update the path P for that day. j , such as Figure 5 (b).

[0103] 2) Optimization of access plan: Randomly select a node v j from P k , and query the dates d(v k ) = {d k , d j , ···} that v can be accessed. The corresponding path sets are {P b , P j , ···}. Traverse the path sets. If a certain node v b in P b can be accessed on d l (d j ∈ d(v j ))), then try to exchange v l and v l . If this exchange successfully reduces the combined length of paths P k and P j , and there is no time conflict in the path, then update the path; otherwise, keep the original path. b

[0104] Step 1: Figure 6 (a) shows the path P a for date d a and the corresponding schedule;

[0105] Step 2: Assume that node v7 is randomly selected now. By retrieving d(v7) = {d a , d b}, it is known that v7 can also appear in the path P b for date d b ;

[0106] Step 3: First, find the nodes that can be accessed on both dates d b and d a from P b . The node that meets the above conditions is v2. By observing the time windows of v2 and v7 on dates d a and d b , it is found that v2 and v7 are on d a ​The time windows of overlap partially, and there is also overlap in the time window of d b The time windows also overlap. It is preliminarily judged that there is a possibility of exchange between these two nodes;

[0107] Step 4: Exchange v2 and v7, and the formed path is as Figure 6 shown in (b). After inspection, the newly formed path is shorter and there is no time conflict, so the path is updated.

[0108] This paper proposes a time window-based path planning method (TFNS) in multi-type venues, which solves the multi-type venue time window traveling salesman problem (M-TSPTW). Compared with traditional heuristic algorithms, the TFNS algorithm can fully meet the hard time constraints, and the running time is significantly reduced. Especially when compared with heuristic algorithms involving ethnic groups, the running time of TFNS is less than one-tenth of these algorithms. In terms of the quality of the solution, the TFNS algorithm is significantly better than other heuristic algorithms and is more stable.

[0109] This embodiment analyzes based on a large number of data sets provided by TSPLIB, verifying the effectiveness and practical application value of this method, and it can be applied to M-TSPTW. M-TSPTW can well describe the actual problems in life, and the proposed TFNS method in the present invention has made good progress in the new combinatorial optimization problem M-TSPTW, especially in path planning problems that require long-term planning and multi-day visits. It provides a solid foundation for future research and practical applications in fields such as long-term corporate operations, long-distance travel, and logistics express delivery.

Claims

1. A path planning method with time windows in multi-type places, characterized in that, Including the following steps: Step 1: Define the multi-type venue Traveling Salesman Problem with Time Windows (M-TSPTW). Step 2: Construct the objective function of the multi-type venue Traveling Salesman Problem with Time Windows (M-TSPTW). Step 3: Based on the hard time constraint and semantic constraint, find the optimal path for the traveling salesman to visit over multiple days to minimize the objective function; the semantic constraint determines whether a node in the specified node set V must be visited to judge whether the position of the node is determined, and the optimal path requires that there is at least one of the nodes with uncertain positions in each day's path P i and finally the path should cover all the nodes with determined positions. The hard time constraint requires that the traveling salesman must arrive before the closing time window of a certain node on the same day, including: Step 31: Classify the nodes in set V according to location and time to further obtain the single-day time-window node set C * , based on set C * Obtain the initial path of the traveling salesman every day; Step 32: Based on the initial path, enable the insertion addition method, and insert the nodes in the multi-day time window node set Ct\C * into the corresponding date paths respectively according to the start dates of their respective time windows of the nodes. If it is impossible to ensure that the path after inserting the node v i satisfies the time constraint, it is regarded as a failed addition; Step 33: For the nodes with failed addition remaining in Ct\C * , retrieve the idle time in all paths, conduct a neighborhood search, and add the nodes in Ct\C * to the path through multiple replacements to form a new path; Step 34: Modify the daily path P based on semantic constraints i , first perform access order optimization, that is, ensure that the daily access plan remains unchanged, and change the access order of nodes to reduce the path length of P i , then optimize the access plan, that is, exchange some nodes in the paths P i and P j to reduce the total path length of these two days, and search for the optimal path by optimizing and reducing the objective function value; Step 4: Visualize the optimal path.

2. A path planning method with time windows in multiple types of venues according to claim 1, characterized in that, The method for defining the multi-type venue Traveling Salesman Problem with Time Windows described in Step 1 is as follows: The multi-type venue Traveling Salesman Problem with Time Windows is defined on a complete graph G = (V, E); V represents the set of nodes in the complete graph, |V| = n indicates that there are n nodes in the set; E represents the set of connections between nodes in the complete graph. The node set V consists of c location - determined and time - determined nodes Ct = {v1, v2, ···, v c}, 1 location - determined and time - indefinite node p = v c+1 , r location - indefinite but time - determined nodes Rt = {v c+2 , v c+3 , ···, v c+r+1}, n - c - r - 2 location - indefinite and time - indefinite nodes Mk = {v c+r+2 , v c+r+3 , ···, v n-1} and the starting point v0, that is, V = v0 ∪ p ∪ Ct ∪ Rt ∪ Mk; where v0 represents the starting point and the ending point of the path; for v i = (x i , y i , TW i ), where (x i , y i ) represents the coordinates of the node, and TW i represents the time - window set of the node.

3. A path planning method with time windows in multiple types of venues according to claim 2, characterized in that Define time constraints for the access order of all nodes to form the multi-type venue Traveling Salesman Problem with Time Windows (M-TSPTW). The method for defining the time constraints is: 1) The traveling salesman does not need to stay at a certain node during the entire time when the time window is open, but only needs to arrive at or before the specified time. The time the traveling salesman stays at a certain node is determined by the type of that node. 2) Settings |TW i | = m. Each node can have at most one time window per day. Let D = {d1, d2, ···, d m}, representing the set of these m dates. Among them represents a time window opened by node v i on d m . represents the opening time of this window, represents the closing time. If , it means that on d m , it cannot be visited by the traveling salesman, or it is considered that node v i has no time window on that day. Use d(v i ) to query the dates when node v i can be visited. If d j ∈d(v i ), it means that the traveling salesman can visit v j on the day when the date is d i . 1 ≤ |d(v i )| ≤ m indicates that for node v i , within the m dates shown in D, it can be visited on at least one day and at most every day; 3) When i ∈ [1, c], there is at least one time window in TW i that is not (None, None), and each time window is different or the same; 4) When i = c + 1, TW i It consists of m time windows of (wks, wke). wks represents the start time of work, and wke represents the end time of work. The traveling salesman only needs to arrive within the working hours every day to upload data. This node p = v c+1 It is separately listed as a type where the location is determined but the time is uncertain; 5) When \(i\in[c + 2,c + r+1]\), \(TW\) i It consists of \(m\) identical time windows. The traveling salesman needs to visit at least one node of the type where the location is uncertain but the time is certain at a fixed period every day; 6) When i ∈ [c + r + 2, n - 1], TW i consists of m time windows of (wke, de), where wke represents the end time of work and de represents the end time of the day. After the end of the working hours each day, the traveling salesman visits at least one node in the type of nodes with uncertain number and uncertain time; Semantic constraints require that there is at least one of each type of non-essential node in the path every day, that is: At the same time, semantic constraints also require that the optimal path P formed by the multi-day paths covers all nodes with determined positions: P ∩ Ct = Ct (4).

4. A path planning method with time windows in multiple types of venues according to claim 1, characterized in that, The method for constructing the objective function of the multi-type venue Traveling Salesman Problem with Time Windows (M-TSPTW) described in Step 3 is: In the formula, is used to determine whether the traveling salesman passes through the edge (v i , v j ). If it means that the traveling salesman passes through the edge (v i , v j ), otherwise the traveling salesman does not pass through the edge (v i , v j ); d ij represents the distance from node v i to v j , that is, the length of the edge (v i , v j ); x i , x j respectively represent the abscissas of nodes v i , v j , and y i , y i respectively represent the ordinates of nodes v i , v j . Establish formula (8) to ensure that there are no time conflicts in the final path: where, o i is a binary indicator used to determine whether the arrival time at v i is within the corresponding time window. If the arrival time is earlier than the closing time of the time window, then o i = 0; otherwise o i = 1; The traveling salesman starts from the starting point v0 and finally ends at v0, and is constrained by formulas (8)-(10):

5. A path planning method with time windows in multiple types of venues according to claim 1, characterized in that The method for classifying the nodes in V according to location and time described in Step 31 is as follows: The nodes in set V are divided into five categories: v0, p, Ct, Rt, and Mk according to location and time, where Ct = {v1, v2, ···, v c} is a set of c nodes with determined locations and determined times, p = v c+1 is a node with a determined location and undetermined time, Rt = {v c+2 , v c+3 , ···, v c+r+1} is a set of r nodes with undetermined locations but determined times, Mk = {v c+r+2 , v c+r+3 , ···, v n-1} is a set of n - c - r - 2 nodes with undetermined locations and undetermined times, and v0 is the starting point; In addition, semantic constraints require that all nodes in Ct must be visited by the traveling salesman once, but there is no restriction on the visit date. And v0 and p must appear in the path every day, and at least one node of each other type must be included in the path every day.

6. A path planning method with time windows in multiple types of venues according to claim 1, characterized in that The insertion method described in Step 32 includes the following steps: Step 321: After classification, the set of nodes with determined positions is Ct, where the single-day time window nodes C * are already in the initial path, and the insertional addition mainly targets the multi-day time window nodes Ct\C * , retrieve the free time in the current path P, denoted as FT; Step 322: Traverse the multi-day time window nodes v in the set Ct\C one by one * to check if there is an intersection between the time window set TW of v j and the free time FT. If there is an intersection, try to add v j to the current path P, and denote the new path formed after adding v j as P j ; j new ​​ Step 323: Determine whether there is a time conflict in P new ; if there is no time conflict, update the current path to: P = P new , and remove v j from Ct\C * ; Step 324: Repeat Steps 312 - 313. If all multi - day time window nodes have been added to the current path, stop; if, after repeated execution, there are always multi - day time window nodes that cannot be added to the current path, it means that the free time of the traveling salesman cannot be utilized to enable the traveling salesman to visit more nodes. Denote the set of these multi - day time window nodes that have not been successfully added as L, where L = Ct\(C * ∪P).

7. A path planning method with time windows in multiple types of venues according to claim 6, characterized in that Step 33 conducts neighborhood search based on idle time and adds the multi-day time window nodes in L to the path through multiple replacements, including the following steps: Step 331: Given that the idle time in the current path P is FT, the nodes in the set L are called customers. Assume that the customer to be added currently is x, and create a tree with the root node as root. Step 332: Traverse FT, and for each idle time f in FT i is used as a leaf node node of the tree. The root node root has multiple child pointers, each pointing to a leaf node formed by idle times. The leaf node records a time period (start_time, end_time) and a date date. There are also multiple child pointers and a parent pointer in the tree; Step 333: Conduct a temporal neighborhood search for each leaf node node, searching for customers v in P ∪ x whose time windows intersect with the time period (start_time, end_time) recorded in node, and use the time spent by the traveling salesman in communicating with customer v as the new time period in leaf node node; i , i new in the time period;​ Step 334: The root node root is the first layer of the tree. The node pointed to by the child of the root node is the second layer, and so on. If the node node new does not appear in a lower layer, the child pointer of node points to node new , and the parent pointer of node new points to node; Step 335: The same node is allowed to appear in the same layer, but the node node that appears in the α-th layer is not allowed to appear in the β-th layer (β > α). Step 336: Repeat steps 323-325. When a certain node in the tree contains x and its corresponding time window, or the tree cannot generate new child nodes, stop repeating. Step 337: If x appears in the tree, it indicates that a solution for adding x to P has been found. Replace the nodes according to the solution and update the original path P. When there are multiple solutions simultaneously, compare the lengths of the updated paths and retain the P with the smaller length as the new path. Conversely, if x does not appear in the tree and the solution is an empty set, it means the solution does not exist, and it is determined that on the current data set, the multi-type location vehicle routing problem with time windows has no solution.

8. A method for path planning with time windows in multiple types of venues according to claim 1, characterized in that Idle time first addition is adopted instead of distance first addition.

9. A path planning method with time windows in multiple types of venues according to claim 1, characterized in that In step 34, the access order is optimized first, and then the access plan is optimized, including the following sub-steps: Step 341: Access order optimization: Randomly select a date d j The path P of the current day j , record P j For each node v in i date d j form a set within the time window Randomly select a node v from P j , whose time window is k Find nodes with time overlap with from STW to form a candidate set Cand; ​ Traverse the node v in Cand a , swap v a and v i 's access order. If this swap successfully reduces the length of path P j and there is no time conflict in the path, then update the path; otherwise, retain the original path Step 342: Access plan optimization: From P j Randomly select a node v k , search for v k The date d(v k )={d j ,d i ,···}, the corresponding path set is {P j ,P i ,···}; traverse the path set, if date d i The corresponding path P i A node v in l Can be in d j Visit (d j ∈d(v l )), then swap v l and v k ; If this exchange successfully reduces the path P j and P i If the length of the path is greater than , and there is no time conflict in the path, the path is updated, otherwise the original path is retained.

10. A method for path planning with time windows in multiple types of venues according to claim 1, characterized in that, Visualizing the optimal path as described in step S4 means visualizing the edges and nodes in the optimal path; in M-TSPTW, nodes carrying different semantics are represented by different colors and shapes.