Wave soldering non-loop path planning methods, apparatus, equipment and media
By constructing a distance matrix and a K-NN candidate set, and combining the 2-opt or 3-opt algorithm to optimize the path, the problem of low efficiency in manual path planning in selective wave soldering is solved, achieving the shortest path planning that meets the constraints and improving welding efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN JIALICHUANG TECH DEV CO LTD
- Filing Date
- 2026-02-02
- Publication Date
- 2026-04-17
AI Technical Summary
In existing technologies, the path planning for selective wave soldering mainly relies on manual generation, which cannot guarantee the performance and time efficiency of the path, resulting in low work efficiency and insufficient process optimization.
By obtaining the coordinates and type of the solder joints, a distance matrix and a K-NN candidate set are constructed. Constraints are set, an initial path is established, and the path is optimized through multiple rounds of adjustment. The path length is optimized using the 2-opt or 3-opt algorithm to ensure that the path meets the constraints.
It achieves high efficiency and optimization in path planning, ensuring that the planned path is the shortest and meets welding requirements, avoiding local optima, and improving welding efficiency.
Smart Images

Figure CN121635367B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of path planning technology, and in particular to a method, apparatus, equipment and medium for wave soldering non-loop path planning. Background Technology
[0002] In the machine operation process of selective wave soldering, path planning is a crucial component, its purpose being to generate the welding path for the wave soldering machine. In actual selective wave soldering production, paths are often generated manually, which cannot guarantee performance or time efficiency, hindering the improvement of work efficiency and process optimization. Summary of the Invention
[0003] This invention aims to at least solve one of the technical problems existing in the prior art. To this end, this invention proposes a non-loop path planning method, apparatus, equipment, and medium for wave soldering, which can improve path planning efficiency and ensure that the planned path is as optimal as possible.
[0004] In a first aspect, according to the wave soldering non-loop path planning method of the present invention, the coordinates and types of all solder joints are obtained; the types of solder joints include spot solder joints and line solder joints.
[0005] Based on the coordinates of each solder joint, calculate the Euclidean distance between each solder joint and the other solder joints to obtain a distance matrix;
[0006] Based on the distance matrix, construct a K-NN candidate set for each of the weld points;
[0007] One of the solder joints is determined as the starting point, and an initial path is established from the starting point through all the solder joints according to the K-NN candidate set; the initial path satisfies preset constraints, including: there is only one starting point, there is only one ending point, the solder joints belonging to the same line must be adjacent, and there are no sub-loops or loops;
[0008] The initial path is adjusted in multiple rounds to obtain multiple welding paths;
[0009] Based on the initial path and the path length of each welding path, determine the optimal welding path that has the shortest length and meets the constraints.
[0010] According to some embodiments of the present invention, after obtaining the coordinates and types of all solder joints, the method further includes:
[0011] Construct a set of solder joints, denoted as V={0,1,…,N-1}, where N is the total number of solder joints and the starting point is 0;
[0012] Based on the type of solder joint, construct an unordered set of pairs, denoted as A. {{i, j}|i≠j}, i∈V, j∈V, the unordered pair set is used to represent two wire weld points belonging to the same wire weld.
[0013] According to some embodiments of the present invention, the constraints are satisfied as follows: the starting point has only one outgoing arc and no incoming arc; the ending point has only one incoming arc and no outgoing arc; except for the starting point and the ending point, all other welding points have one outgoing arc and one incoming arc.
[0014] According to some embodiments of the present invention, before determining one of the solder joints as a starting point and establishing an initial path from the starting point through all the solder joints based on the K-NN candidate set, the method further includes:
[0015] Create a first variable, denoted as X. ij And X ij For any point ∈ {0, 1} (i ≠ j), when moving from solder point i to solder point j along the path, then X ij =1, otherwise X ij =0;
[0016] Create a second variable, which is represented by Y. i And Y i ∈{0,1} (i∈V\{0}), when i is the endpoint, Y i =1, otherwise Y i =0;
[0017] Create a third variable, denoted as U. i The third variable is used to represent the welding sequence of each weld point.
[0018] According to some embodiments of the present invention, the constraint conditions satisfy the following formula:
[0019] ;
[0020] ;
[0021] , j∈V\{0};
[0022] , i∈V\{0};
[0023] ;
[0024] a and b are solder joints within an unordered set of pairs;
[0025] U j ≥U i +1-N(1-X) ij ).
[0026] According to some embodiments of the present invention, determining one of the solder joints as a starting point and establishing an initial path from the starting point through all the solder joints based on the K-NN candidate set includes:
[0027] Determine one of the solder joints as the starting point. Starting from the starting point, within the K-NN candidate set of each solder joint, obtain the solder joint that is closest to the current solder joint and has not been added to the path as the next solder joint, until all solder joints are traversed to obtain the original path.
[0028] The original path is adjusted according to the constraints to obtain an initial path that satisfies the constraints.
[0029] According to some embodiments of the present invention, the step of adjusting the initial path in multiple rounds to obtain multiple welding paths includes:
[0030] In the first round of adjustment, the initial path is adjusted several times using the 2-opt algorithm or the 3-opt algorithm to obtain the current optimal path with the shortest path length and that meets the constraints after several adjustments.
[0031] Perform several perturbations on the current optimal path, and determine whether there is a better path with a shorter path length than the current optimal path that satisfies the constraint conditions. If there is, update the current optimal path to the better path; otherwise, keep the current optimal path unchanged.
[0032] Starting from the second round of adjustment, based on the current optimal path obtained after all previous rounds of adjustment, several perturbations are performed to determine whether there is a new path superior to the current optimal path. If there is, the current optimal path is updated to the new path; if not, the new path obtained after perturbation is adjusted several times using the 2-opt or 3-opt algorithm. If a new path superior to the current optimal path exists after adjustment, the current optimal path is updated to the new path; if not, the new path obtained after adjustment continues to be perturbed several times until a new path superior to the current optimal path is obtained, or until the number of perturbations reaches a preset value.
[0033] In a second aspect, a wave soldering non-loop path planning apparatus according to an embodiment of the present invention includes at least one control processor and a memory for communicatively connecting to the at least one control processor; the memory stores instructions executable by the at least one control processor, the instructions being executed by the at least one control processor to enable the at least one control processor to perform the wave soldering non-loop path planning method as described in the first aspect embodiment.
[0034] Thirdly, an electronic device according to an embodiment of the present invention includes the wave soldering non-loop path planning device described in the second aspect embodiment.
[0035] Fourthly, according to an embodiment of the present invention, a computer-readable storage medium stores computer-executable instructions for causing a computer to perform the wave soldering non-loop path planning method as described in the first aspect embodiment.
[0036] The wave soldering non-loop path planning method, apparatus, equipment, and medium according to embodiments of the present invention have at least the following beneficial effects: by determining the coordinates and type of each solder joint and setting constraints according to the requirements of selective wave soldering, the final planned path is ensured to meet the welding requirements; by constructing a distance matrix and a K-NN candidate set, the path planning time is saved; at the same time, by adjusting the initial path in multiple rounds, the path planning avoids getting trapped in local optima, ensuring that the final optimal welding path is as short as possible.
[0037] Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description
[0038] The above and / or additional aspects and advantages of the present invention will become apparent and readily understood from the description of the embodiments taken in conjunction with the following drawings, in which:
[0039] Figure 1 This is a schematic diagram illustrating the steps of the wave soldering non-loop path planning method according to an embodiment of the present invention;
[0040] Figure 2 This is a flowchart illustrating the wave soldering non-loop path planning method according to an embodiment of the present invention.
[0041] Figure 3 This is a schematic diagram of the wave soldering non-loop path planning device according to an embodiment of the present invention. Detailed Implementation
[0042] The embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain this application, and should not be construed as limiting this application. The step numbers in the following embodiments are set only for ease of explanation, and there is no limitation on the order between the steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
[0043] In the description of this invention, it should be understood that the orientation descriptions, such as up, down, front, back, left, right, etc., are based on the orientation or positional relationship shown in the accompanying drawings. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limiting this invention.
[0044] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0045] In this invention, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0046] In the machine operation process of selective wave soldering, path planning is a crucial component, its purpose being to generate the welding path for the wave soldering machine. In actual selective wave soldering production, the path sequence is often generated manually, which cannot guarantee performance or time efficiency, hindering the improvement of work efficiency and process optimization.
[0047] To address this, embodiments of the present invention provide a method, apparatus, device, and medium for non-loop path planning in wave soldering. By determining the coordinates and type of each solder joint and setting constraints according to the requirements of selective wave soldering, the final planned path is ensured to meet the welding requirements. By constructing a distance matrix and a K-NN candidate set, path planning time is saved. At the same time, by adjusting the initial path in multiple rounds, the path planning avoids getting stuck in local optima, ensuring that the final optimal welding path is as short as possible.
[0048] The wave soldering non-loop path planning method, apparatus, equipment, and medium of the present invention will now be described in detail with reference to the accompanying drawings.
[0049] In a first aspect, embodiments of the present invention propose a non-loop path planning method for wave soldering, such as... Figure 1 and Figure 2 As shown, the method includes the following steps:
[0050] Step S100: Obtain the coordinates and type of all solder joints; the types of solder joints include spot solder joints and line solder joints;
[0051] It should be noted that before planning the route, all the weld points that need to be welded must be identified and the coordinates of each weld point must be obtained to facilitate the subsequent planning of the welding path and the determination of the path length. At the same time, it is necessary to determine whether each weld point is a spot weld point or a line weld point. For line weld points, which belong to the same line weld, continuous welding is required. Therefore, when planning the welding path, line weld points belonging to the same line weld need to be placed in adjacent positions.
[0052] Step S200: Based on the coordinates of each solder joint, calculate the Euclidean distance between each solder joint and other solder joints to obtain the distance matrix;
[0053] To facilitate subsequent welding path planning, it is necessary to determine the Euclidean distance between each weld point and other weld points, thereby determining the path length required for the welding path and planning the welding path with the shortest path length.
[0054] Step S300: Construct a K-NN candidate set for each weld point based on the distance matrix;
[0055] The K-Nearest Neighbors Candidate Set refers to a set of the most likely "nearest" candidate objects pre-selected for the current object when using the K-Nearest Neighbors algorithm for search or optimization; its core purpose is to narrow the search range and improve computational efficiency. In this application, after setting the value of K (K is a positive integer, and K is less than N-1, where N is the total number of solder joints), the K nearest solder joints to the current solder joint are found in the distance matrix, thus constructing the K-NN candidate set for the current solder joint. By constructing a K-NN candidate set for each solder joint, subsequent local searches only select solder joints from the K-NN candidate set, avoiding traversing all solder joints and thus improving efficiency.
[0056] Step S400: Determine one of the solder joints as the starting point, and based on the K-NN candidate set, establish an initial path starting from the starting point and passing through all solder joints; the initial path satisfies the preset constraints, including: there is only one starting point, there is only one ending point, solder joints belonging to the same line must be adjacent, and there are no sub-loops or loops;
[0057] It should be noted that before planning the path, one welding point is selected as a fixed starting point. All paths originate from this welding point. Then, starting from the starting point, based on the K-NN candidate set for each welding point, the welding point closest to the current welding point is selected as the next welding point, thus forming an initial path that passes through all welding points and satisfies the constraints. These constraints include: only one starting point and one ending point (to avoid forming multiple different intersecting paths); welding points belonging to the same line must be adjacent (to ensure normal line welding); and no sub-loops or loops, ensuring that there is only one welding path and avoiding unreasonable routes. By setting these constraints, path planning is restricted, thereby saving path planning time and avoiding unreasonable paths.
[0058] Step S500: Adjust the initial path multiple times to obtain multiple welding paths;
[0059] After obtaining the initial path, it needs to be adjusted multiple times to obtain the shortest possible welding path, avoid getting trapped in local optima, and thus perform global optimization of the path length to obtain the best possible welding path, thereby improving welding efficiency.
[0060] Step S600: Based on the initial path and the path length of each welding path, determine the optimal welding path that is the shortest and meets the constraints.
[0061] After multiple adjustments to obtain multiple welding paths, the path length of the initial path and each welding path is compared, and the path with the shortest length that meets the constraints is selected as the optimal welding path.
[0062] According to the wave soldering non-loop path planning method of the embodiments of this application, by determining the coordinates and type of each solder point and constructing a distance matrix and a K-NN candidate set, it is easy to save the time of path planning. At the same time, by setting constraints, the path length of the final planned welding path is minimized and meets the requirements of wave soldering.
[0063] Furthermore, in some embodiments of this application, after obtaining the coordinates and types of all solder joints, the wave soldering non-loop path planning method further includes the following two steps:
[0064] Construct a set of solder joints, represented as V={0,1,…,N-1}, where N is the total number of solder joints, starting from 0;
[0065] Based on the type of solder joint, construct an unordered set of pairs, denoted as A. {{i, j}|i≠j}, i∈V, j∈V, an unordered set of pairs is used to represent two wire weld points belonging to the same wire weld.
[0066] Specifically, in this application, a set of solder joints V and a set of unordered pairs A are constructed. The set of solder joints V includes all solder joints, while the set of unordered pairs is used to represent two solder joints of a line weld. For spot solder joints, only one spot needs to be welded at a time. For line solder joints, a line weld includes two line solder joints. The two line solder joints of the same line weld must be adjacent, but the welding order of the two line solder joints can be changed.
[0067] Since the final welding path cannot form sub-loops or loops, the following constraints must also be met: the starting point has only one outgoing arc and no incoming arc; the ending point has only one incoming arc and no outgoing arc; except for the starting and ending points, all other weld points have one outgoing arc and one incoming arc. These constraints ensure that the final welding path starts from the starting point and ends at the ending point, and each weld point is traversed only once, without any sub-loops or loops.
[0068] To facilitate meeting all the constraints mentioned above, in this example, before step S400: determining one of the solder joints as the starting point and establishing an initial path from the starting point through all solder joints based on the K-NN candidate set, the wave soldering non-loop path planning method also includes the following three steps:
[0069] Create a first variable, denoted as X. ij And X ijFor any point ∈ {0, 1} (i ≠ j), when moving from solder point i to solder point j along the path, then X ij =1, otherwise X ij =0;
[0070] Create a second variable, denoted as Y. i And Y i ∈{0,1} (i∈V\{0}), when i is the endpoint, Y i =1, otherwise Y i =0;
[0071] Create a third variable, denoted as U. i The third variable is used to represent the welding sequence of each weld point.
[0072] Specifically, a first variable is created to represent the relationship between any two solder joints. When solder joint i immediately follows solder joint j in the soldering path, then X... ij =1, for other cases, X ij All values are 0. Therefore, the value of the first variable can be used to determine whether solder point i immediately follows solder point j. By creating a second variable to indicate whether a solder point is the endpoint, when solder point i is the endpoint, Y... i =1, when solder joint i is not the endpoint, Y i =0. By creating a third variable to represent the welding sequence of each weld point, for the starting point, when i is the starting point, U i =1; when i is the second solder joint, U i =2, and so on, when i is the endpoint, U i =N. Therefore, U i ∈R, and 1≤U i ≤N.
[0073] Based on the constraints set above, the following formula can be derived:
[0074] (1)
[0075] (2)
[0076] , j∈V\{0};(3)
[0077] , i∈V\{0};(4)
[0078] (5)
[0079] , a and b are solder joints within the unordered pair set; (6)
[0080] U j ≥U i +1-N(1-X) ij (7)
[0081] Equation (1) indicates that the starting point 0 has only one outgoing arc; Equation (2) indicates that the starting point 0 has no incoming arc; Equation (3) indicates that each weld point, except for the starting point, has only one incoming arc; Equation (4) indicates that, except for the starting point, the other weld points either have one outgoing arc or are the endpoint; Equation (5) indicates that there is only one endpoint. Equations (1) to (5) together ensure that the final welding path starts from the starting point, covers all weld points, and ends precisely at an endpoint. Equation (6) ensures that two wire weld points on the wire weld are adjacent in the welding path, but their directions are not fixed; they can move from weld point a to weld point b, or from weld point b to weld point a. If the starting point is also a wire weld point, since the starting point has no incoming arc, therefore... =0, then =1 (meaning point b is the second solder joint), which meets the requirements. The formula.
[0082] It should be noted that if two unordered pairs including the same solder joint are given, such as {a, b} and {a, c}, it will not be feasible, because it is impossible for a single path to have a solder joint followed by two different solder joints.
[0083] Furthermore, in order to eliminate sub-loops, in this application, let =1, for all i≠j and j≠0, the following holds: -N(1- When solder joint i is immediately following solder joint j, =1, at which point it is just forced +1; This formula restricts the path by making it impossible to create "self-looping in ascending order" in a subgraph not connected to the starting point, thus eliminating sub-loops. Simultaneously, it assigns an ascending sequence number to open paths. For example, if there are 6 solder joints {0, 1, 2, 3, 4, 5}, and the final planned path contains two small loops, such as 0-1-2-0 and 3-4-5-3, this is an illegal path and does not meet the constraints.
[0084] In some embodiments of this application, the Euclidean distance between each solder joint and other solder joints is denoted as C. ij Therefore, the objective function for achieving the shortest welding path in this application is:
[0085] .
[0086] In some embodiments of this application, step S400 above—determining one of the solder joints as the starting point and establishing an initial path from the starting point through all solder joints based on the K-NN candidate set—includes the following two steps:
[0087] Determine one of the solder joints as the starting point. Starting from the starting point, within the K-NN candidate set of each solder joint, obtain the solder joint that is closest to the current solder joint and has not been added to the path as the next solder joint, until all solder joints are traversed to obtain the original path.
[0088] Based on the constraints, the original path is adjusted to obtain an initial path that satisfies the constraints.
[0089] To improve path planning efficiency and ensure a short initial path length, in this example, starting from the starting point, the nearest solder point that is not yet included in the path is selected from the K-NN candidate set of each solder point as the next solder point, until all solder points are traversed to obtain the original path. At this point, the length of the original path is short, but it may not be the shortest, and it may not meet the constraints. Therefore, it is necessary to adjust the original path according to the set constraints to obtain an initial path that meets the constraints. Subsequently, a better path is found based on this initial path.
[0090] To illustrate the path planning method described above, consider a concrete example: Assume there are 11 solder joints, numbered 0-10. Among these 11 joints, {(6, 7), (8, 9)} represent line welding nodes, while the others are spot welding nodes. The coordinates of each solder joint are:
[0091] 0: (0.00, 0.00);
[0092] 1: (6.69, 41.32);
[0093] 2: (11.05, 75.21);
[0094] 3: (51.13, 4.97);
[0095] 4: (4.48, 73.59);
[0096] 5: (15.43, 73.37);
[0097] 6: (63.04, 50.43);
[0098] 7: (85.58, 60.26);
[0099] 8: (57.34, 40.01);
[0100] 9: (24.87, 13.80);
[0101] 10: (42.32, 37.61).
[0102] Based on the coordinates of each solder joint, the Euclidean distance between each solder joint and other solder joints can be calculated, thus obtaining the distance matrix, as shown below (for ease of display, only one decimal place is shown):
[0103]
[0104] This distance matrix provides a clear view of the distances between each solder joint and other solder joints. Based on this matrix, a K-NN candidate set is established for each solder joint, where K is the number of its nearest neighbors. Establishing a K-NN candidate set avoids traversing all solder joints each time, reducing computation and improving efficiency. Assuming K=8 (or other suitable values as needed), the K-NN candidate set for each solder joint is as follows:
[0105] Node 0: [9, 1, 3, 10, 8, 4, 5, 2];
[0106] Node 1: [4, 9, 5, 2, 10, 0, 8, 6];
[0107] Node 2: [5, 4, 1, 10, 6, 8, 9, 7];
[0108] Node 3: [9, 10, 8, 6, 0, 1, 7, 5];
[0109] Node 4: [2, 5, 1, 10, 8, 6, 9, 0];
[0110] Node 5: [2, 4, 1, 10, 6, 8, 9, 7];
[0111] Node 6: [8, 10, 7, 3, 5, 9, 1, 2];
[0112] Node 7: [6, 8, 10, 3, 5, 2, 9, 1];
[0113] Node 8: [6, 10, 7, 3, 9, 1, 5, 2];
[0114] Node 9: [3, 0, 10, 1, 8, 6, 5, 2];
[0115] Node 10: [8, 6, 9, 3, 1, 5, 7, 2].
[0116] Based on the K-NN candidate set, starting from the starting point, within the K-NN candidate set of each solder point, the solder point closest to the current solder point and not yet added to the path is selected as the next solder point. This process continues until all solder points are traversed, resulting in the original path: 0-9-3-10-8-6-7-5-2-4-1. Since (8, 9) is an unordered pair and requires adjacency, the original path does not meet the constraint. Therefore, the original path is adjusted by placing node 9 after node 8, making nodes 8 and 9 adjacent, thus obtaining the initial path 0-3-10-8-9-6-7-5-2-4-1. The length of this initial path is 334.809993.
[0117] After obtaining the initial path, it needs to be adjusted multiple times to obtain multiple welding paths in order to find the optimal welding path. This involves the following three steps:
[0118] In the first round of adjustment, the initial path is adjusted several times using the 2-opt algorithm or the 3-opt algorithm to obtain the current optimal path with the shortest path length and that meets the constraints after several adjustments.
[0119] Perform several perturbations on the current optimal path, and determine whether there is a better path with a shorter path length than the current optimal path that satisfies the constraints. If there is, update the current optimal path to the better path; otherwise, keep the current optimal path unchanged.
[0120] Starting from the second round of adjustment, based on the current optimal path obtained after all previous rounds of adjustment, several perturbations are performed to determine whether there is a new path better than the current optimal path. If there is, the current optimal path is updated to the new path; if not, the new path obtained after perturbation is adjusted several times using the 2-opt algorithm or the 3-opt algorithm. If a new path better than the current optimal path exists after adjustment, the current optimal path is updated to the new path; if not, the new path obtained after adjustment continues to be perturbed several times until a new path better than the current optimal path is obtained, or until the number of perturbations reaches a preset value.
[0121] It's important to note that the 2-opt algorithm attempts to shorten the total path length by cutting two edges (each edge consisting of two solder joints) and reversing the middle path. The 3-opt algorithm, on the other hand, simultaneously deletes three edges and reconnects and reverses the broken sub-paths in various ways, thus finding a better solution in a larger search space and significantly improving the ability to escape local optima. Perturbation refers to selecting a specific interval in the path and reversing the soldering order of the solder joints within that interval. The following example illustrates the process of multiple rounds of adjustment:
[0122] First, set the parameters: | Restart rounds: 6 | Maximum number of perturbations without improvement: 3 | Maximum number of 3-opt attempts per round: 6; It should be noted that the parameter settings can be changed according to actual needs, and are not limited to these.
[0123] First round of adjustments:
[0124] The initial path is adjusted using 3-opt, resulting in the new path: 0-3-9-8-10-6-7-5-2-4-1. The path length of the new path is 300.168397, which is a gain of 34.641596 compared to the initial path. It also meets the constraints, so the current optimal path is updated to this path.
[0125] Based on the current optimal path, a 2-opt adjustment is made to obtain a new path: 0-1-4-2-5-7-6-10-8-9-3. The path length of this path is 290.661195 and meets the constraints. Compared with the previous path, the gain is 9.507202. The current optimal path is updated to this path.
[0126] If several 2-opt / 3-opt adjustments are performed without improvement, then several perturbations are applied to the current optimal path (perturbation refers to reversing some intermediate paths of the current optimal path):
[0127] First disturbance: Reverse the interval [6:8], that is, change 6-10-8 to 8-10-6;
[0128] Second disturbance: Reverse the interval [7:8], that is, change 10-6 to 6-10;
[0129] The perturbated path is 0-1-4-2-5-7-8-6-10-9-3, with a path length of 285.303934. Although the length is shorter, it does not meet the constraints, therefore this path is unsuitable. Thus, after the first round of adjustment, the current optimal path remains 0-1-4-2-5-7-6-10-8-9-3.
[0130] Second round of adjustments:
[0131] The current optimal path is perturbed three times. The first perturbation reverses the interval [7:8], changing 10-8 to 8-10. The second perturbation reverses the interval [2:7], changing 4-2-5-7-6-8 to 8-6-7-5-2-4. The third perturbation reverses the interval [5:8], changing 5-2-4-10 to 10-4-2-5. The path after these three perturbations is: 0-1-8-6-7-10-4-2-5-9-3; the path length is 329.580424, which is longer and does not meet the constraints. Therefore, based on this path, several 2-opt / 3-opt adjustments are made. First, the path 0-1-5-2-4-10-3-9-8-6-7 is obtained, with a path length of 278.519172, which meets the constraints. Then, the path 0-1-4-2-5-10-3-9-8-6-7 is obtained, with a path length of 270.166982, which also meets the constraints. Therefore, the current optimal path is updated to 0-1-4-2-5-10-3-9-8-6-7. Continuing with 2-opt / 3-opt adjustments yields no improvement, so a perturbation is then performed. The first perturbation reverses the interval [3:7], changing 2-5-10-3-9 to 9-3-10-5-2. The second perturbation reverses the interval [4:7], changing 3-10-5-2 to 2-5-10-3. The perturbed path is 0-1-4-9-2-5-10-3-8-6-7, with a path length of 355.692416, which does not meet the constraints. Therefore, after the second round of adjustments, the current optimal path is 0-1-4-2-5-10-3-9-8-6-7.
[0132] Third round of adjustments:
[0133] The current optimal path is perturbed three times. The first perturbation: reverse the interval [5:9], changing 10-3-9-8-6 to 6-8-9-3-10; the second perturbation: reverse the interval [8:9], changing 3-10 to 10-3; the third perturbation: reverse the interval [7:9], changing 9-10-3 to 3-10-9. The perturbed path is 0-1-4-2-5-6-8-3-10-9-7, with a path length of 325.809122, which does not meet the constraints. 2-opt adjustment / 3-opt adjustment is performed on this path, but no improvement is found. Therefore, the current optimal path is perturbed again. The first perturbation reverses the interval [1:4], changing 1-4-2-5 to 5-2-4-1; the second perturbation reverses the interval [1:5], changing 5-2-4-1-10 to 10-1-4-2-5; the perturbed path is 0-10-1-4-2-5-3-9-8-6-7, with a path length of 319.358036, satisfying the constraint condition. Further adjustments are made to this path using 2-opt and 3-opt methods. There is no improvement. Continue to perturb the current optimal path. First perturbation: reverse the interval [2:9], changing 4-2-5-10-3-9-8-6 to 6-8-9-3-10-5-2-4; Second perturbation: reverse the interval [5:6], changing 3-10 to 10-3. The perturbed path is 0-1-6-8-9-10-3-5-2-4-7, with a path length of 386.741144, which does not meet the constraints. End the third round of adjustment. In this round, the current optimal path is not updated.
[0134] Fourth round of adjustments:
[0135] The current optimal path is perturbed as follows: First perturbation: Reverse the interval [1:7], changing 1-4-2-5-10-3-9 to 9-3-10-5-2-4-1; Second perturbation: Reverse the interval [1:8], changing 9-3-10-5-2-4-1-8 to 8-1-4-2-5-10-3-9; Third perturbation: Reverse the interval [6:7], changing 10-3 to 3-10. The perturbed path is now 0-8-1-4-2-5-3-10-9-6-7, with a path length of 38. 2.412271, does not meet the constraints. A 2-opt / 3-opt adjustment is performed on this path, but no better path than the current optimal path is found. The current optimal path is further perturbed: First perturbation: reverse the interval [8:9], changing 8-6 to 6-8; Second perturbation: reverse the interval [7:9], changing 9-6-8 to 8-6-9. The perturbed path is 0-1-4-2-5-10-3-8-6-9-7, with a path length of 341.091329, which does not meet the constraints. The fourth round of adjustments ends. In this round, the current optimal path is not updated.
[0136] Fifth round of adjustments:
[0137] The current optimal path is perturbed. First perturbation: reverse the interval [8:9], changing 8-6 to 6-8. Second perturbation: reverse the interval [5:9], changing 10-3-9-6-8 to 8-6-9-3-10. Third perturbation: reverse the interval [6:7], changing 6-9 to 9-6. The perturbed path is 0-1-4-2-5-8-9-6-3-10-7, with a path length of 363.540181, which does not meet the constraints. Therefore, a 2-opt adjustment is performed on this path. After adjusting the 3-opt interval, no better path than the current optimal path was found. The current optimal path was further perturbed. The first perturbation reversed the interval [2:8], changing 4-2-5-10-3-9-8 to 8-9-3-10-5-2-4. The second perturbation reversed the interval [7:9], changing 2-4-6 to 6-4-2. The perturbed path is now 0-1-8-9-3-10-5-6-4-2-7, with a path length of 439.111282, which does not meet the constraints. The fifth round of adjustments ends. In this round, the current optimal path was not updated.
[0138] Sixth round of adjustments:
[0139] The current optimal path is perturbed as follows: First perturbation: Reverse the interval [8:9], changing 8-6 to 6-8; Second perturbation: Reverse the interval [2:8], changing 4-2-5-10-3-9-6 to 6-9-3-10-5-2-4; Third perturbation: Reverse the interval [4:6], changing 3-10-5 to 5-10-3. The perturbed path is now 0-1-6-9-5-10-3-2-4-8-7, with a path length of 475.737111, which does not satisfy the constraint condition. The path was adjusted using 2-opt and 3-opt methods, but no better path was found. The current optimal path was further perturbed: first perturbation: inverting the interval [7:9], changing 9-8-6 to 6-8-9; second perturbation: inverting the interval [1:4], changing 1-4-2-5 to 5-2-4-1. The perturbed path is now 0-5-2-4-1-10-3-6-8-9-7, with a path length of 365.519884, which does not meet the constraints. The sixth round of adjustments ends. In this round, the current optimal path was not updated.
[0140] The loop terminates when the loop termination condition is met. After cyclic adjustment, the final optimal welding path is 0-1-4-2-5-10-3-9-8-6-7, with a path length of 270.166982.
[0141] The wave soldering non-loop path planning method according to embodiments of this application sets constraints based on the welding requirements of selective wave soldering, and then constructs a distance matrix and a K-NN candidate set, thereby saving traversal time and finding the optimal welding path more quickly. Simultaneously, by adjusting the initial path multiple times, it escapes local optima and finds the optimal welding path as quickly as possible. This method improves path planning efficiency and ensures the superiority of path planning.
[0142] Secondly, embodiments of the present invention also provide a wave soldering non-loop path planning device, such as... Figure 3 As shown, the device includes:
[0143] The processor 101 can be implemented using a general-purpose central processing unit (CPU), microprocessor, application specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0144] The memory 102 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 102 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 102 and is called and executed by the processor 101 to execute the wave soldering non-loop path planning method of the embodiments of this application.
[0145] Input / output interface 103 is used to implement information input and output;
[0146] The communication interface 104 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0147] Bus 105 transmits information between various components of the device (e.g., processor 101, memory 102, input / output interface 103, and communication interface 104);
[0148] The processor 101, memory 102, input / output interface 103 and communication interface 104 are connected to each other within the device via bus 105.
[0149] Thirdly, embodiments of the present invention also provide an electronic device, including the wave soldering non-loop path planning device of the second aspect embodiment.
[0150] Fourthly, embodiments of the present invention also provide a storage medium, which is a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described wave soldering non-loop path planning method.
[0151] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof. The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separate, and may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0152] Although specific embodiments are described herein, those skilled in the art will recognize that many other modifications or alternative embodiments are also within the scope of this disclosure. For example, any of the functions and / or processing capabilities described in connection with a particular device or component can be performed by any other device or component. Furthermore, while various exemplary embodiments and architectures have been described according to embodiments of this disclosure, those skilled in the art will recognize that many other modifications to the exemplary embodiments and architectures described herein are also within the scope of this disclosure.
[0153] The foregoing description, with reference to block diagrams and flowcharts of systems, methods, systems, and / or computer program products according to exemplary embodiments, has described certain aspects of this disclosure. It should be understood that one or more blocks in the block diagrams and flowcharts, as well as combinations of blocks in the block diagrams and flowcharts, can be implemented by executing computer-executable program instructions, respectively. Similarly, according to some embodiments, some blocks in the block diagrams and flowcharts may not need to be executed in the order shown, or may not all need to be executed. Furthermore, additional components and / or operations beyond those shown in the blocks in the block diagrams and flowcharts may exist in some embodiments.
[0154] Therefore, blocks in block diagrams and flowcharts support combinations of means for performing a specified function, combinations of elements or steps for performing a specified function, and program instruction means for performing a specified function. It should also be understood that each block in a block diagram and flowchart, and combinations of blocks in block diagrams and flowcharts, can be implemented by a dedicated hardware computer system or a combination of dedicated hardware and computer instructions that performs a specific function, element, or step.
[0155] The program modules, applications, etc., described herein may include one or more software components, including, for example, software objects, methods, data structures, etc. Each such software component may include computer-executable instructions that, in response to execution, cause at least a portion of the functionality described herein (e.g., one or more operations of the exemplary methods described herein) to be performed.
[0156] Software components can be coded using any of a variety of programming languages. An exemplary programming language could be a low-level programming language, such as assembly language associated with a specific hardware architecture and / or operating system platform. Software components including assembly language instructions may need to be converted into executable machine code by an assembler before being executed by the hardware architecture and / or platform. Another exemplary programming language could be a higher-level programming language that is portable across multiple architectures. Software components including higher-level programming languages may need to be converted into an intermediate representation by an interpreter or compiler before execution. Other examples of programming languages include, but are not limited to, macro languages, shell or command languages, job control languages, scripting languages, database query or search languages, or report writing languages. In one or more exemplary embodiments, a software component containing instructions from one of the above-described programming language examples can be executed directly by the operating system or other software components without first being converted into another form.
[0157] Software components can be stored as files or other data storage structures. Software components of similar type or related function can be stored together in a specific directory, folder, or library. Software components can be static (e.g., pre-defined or fixed) or dynamic (e.g., created or modified at runtime).
[0158] The embodiments of the present invention have been described in detail above with reference to the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those skilled in the art, various changes can be made without departing from the spirit of the present invention.
Claims
1. A wave soldering non-loop path planning method, characterized by, include: Get the coordinates and type of all solder joints; The types of solder joints include spot solder joints and wire solder joints; Based on the coordinates of each solder joint, calculate the Euclidean distance between each solder joint and the other solder joints to obtain a distance matrix; Based on the distance matrix, construct a K-NN candidate set for each of the weld points; Determine one of the solder joints as the starting point, and based on the K-NN candidate set, establish an initial path starting from the starting point and passing through all the solder joints; The initial path satisfies preset constraints, including: there is only one starting point, there is only one ending point, the weld points belonging to the same weld line must be adjacent, and there are no sub-loops or loops. The initial path is adjusted in multiple rounds to obtain multiple welding paths; Based on the initial path and the path length of each welding path, determine the optimal welding path that has the shortest length and meets the constraints. After obtaining the coordinates and types of all solder joints, the method further includes: Construct a set of solder joints, denoted as V={0,1,…,N-1}, where N is the total number of solder joints and the starting point is 0; According to the type of the weld, a set of unordered pairs is constructed, denoted as A, A {{i, j} | i≠j}, i∈V, j∈V, which is used to represent two line weld points belonging to the same line weld; Before determining one of the solder joints as the starting point and establishing an initial path from the starting point through all the solder joints based on the K-NN candidate set, the method further includes: Create a first variable, denoted as X. ij And X ij ∈{0,1}, i≠j, when moving from solder point i to solder point j in the path, then X ij =1, otherwise X ij =0; Create a second variable, which is represented by Y. i And Y i ∈{0,1}, i∈V\{0}, when i is the endpoint, Y i =1, otherwise Y i =0; A third variable is created, denoted as U i , which is used to represent the welding sequence of each of the welding points. The constraints satisfy the following equation: ; ; , j e V \ {0} ; , i e V \ {0} ; ; a and b are solder joints within an unordered set of pairs; U j ≥U i +1-N(1-X ij ); The process of adjusting the initial path in multiple rounds to obtain multiple welding paths includes: In the first round of adjustment, the initial path is adjusted several times using the 2-opt algorithm or the 3-opt algorithm to obtain the current optimal path with the shortest path length and that meets the constraints after several adjustments. Perform several perturbations on the current optimal path, and determine whether there is a better path with a shorter path length than the current optimal path that satisfies the constraint conditions. If there is, update the current optimal path to the better path; otherwise, keep the current optimal path unchanged. Starting from the second round of adjustment, based on the current optimal path obtained after all previous rounds of adjustment, several perturbations are performed to determine whether there is a new path superior to the current optimal path. If there is, the current optimal path is updated to the new path; if not, the new path obtained after perturbation is adjusted several times using the 2-opt or 3-opt algorithm. If a new path superior to the current optimal path exists after adjustment, the current optimal path is updated to the new path; if not, the new path obtained after adjustment continues to be perturbed several times until a new path superior to the current optimal path is obtained, or until the number of perturbations reaches a preset value.
2. The wave-solder non-loop path planning method of claim 1, wherein, The constraints are satisfied as follows: the starting point has only one outgoing arc and no incoming arc; the ending point has only one incoming arc and no outgoing arc; except for the starting point and the ending point, all other welding points have one outgoing arc and one incoming arc.
3. The wave-solder non-loop path planning method of claim 2, wherein, The step of determining one of the solder joints as the starting point and establishing an initial path from the starting point through all the solder joints based on the K-NN candidate set includes: Determine one of the solder joints as the starting point. Starting from the starting point, within the K-NN candidate set of each solder joint, obtain the solder joint that is closest to the current solder joint and has not been added to the path as the next solder joint, until all solder joints are traversed to obtain the original path. The original path is adjusted according to the constraints to obtain an initial path that satisfies the constraints.
4. A wave soldering non-loop path planning device, characterized by It includes at least one control processor and a memory for communicatively connecting to the at least one control processor; The memory stores instructions that can be executed by the at least one control processor to enable the at least one control processor to perform the wave soldering non-loop path planning method as described in any one of claims 1 to 3.
5. An electronic device, comprising: Includes the wave soldering non-loop path planning device as described in claim 4.
6. A storage medium, characterized in that, The storage medium stores computer-executable instructions, which are used to cause a computer to execute the wave soldering non-loop path planning method according to any one of claims 1-3.
Citation Information
Patent Citations
Welding robot and planning method for swinging track of welding robot
CN110450170A
Welding robot path planning method, electronic equipment and storage medium
CN114924565A