PCB automatic wiring method based on multi-thread adaptive ant colony algorithm

Through multi-threaded adaptive ant colony algorithm, independent search and optimization of probability selection formulas, the random search capability and convergence speed of PCB automatic routing are improved, and the problem of slow local optimal solution and convergence speed in the existing technology is solved, and the further development is achieved. Excellent wiring strategy and faster convergence effect.

CN119294345APending Publication Date: 2025-01-10XIDIAN UNIV
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411422899.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-10

AI Technical Summary

Technical Problem

The existing PCB automatic routing algorithm lacks random search capabilities in the early stage of iteration, and is prone to fall into local optimal solutions and has a slow convergence speed, which cannot effectively solve the requirements of complex circuit board routing.

Method used

The multi-threaded adaptive ant colony algorithm is used to divide the ant colony through a thread pool, and independently search and use optimization probability selection formulas and adaptive functions to improve the random search ability and convergence speed in the early stage of iteration and reduce the wiring cost.

Benefits of technology

With the same number of iterations, the multi-threaded adaptive ant colony algorithm significantly improves the optimization and convergence speed of understanding, and has powerful performance. It optimizes the wiring length, inflection points and through holes of the PCB, providing a feasible solution to reduce the wiring cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119294345A_ABST
    Figure CN119294345A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of PCB automatic wiring, and discloses a PCB automatic wiring method based on a multi-thread adaptive ant colony algorithm, and the method comprises the steps: obtaining the information of a to-be-wired PCB, carrying out the topology of the to-be-wired PCB into a three-dimensional array through a grid model, and initializing parameters; dividing ant colonies by using a thread pool, distributing a thread for each ant colony, and fixing the population quantity of each ant colony, so that different ant colonies are independently searched and have no information exchange; selecting a next target point by using the optimized probability selection formula; selecting an ant path and a global optimal solution which are optimal in each iteration to alternately update pheromones; and based on iteration of the multi-thread adaptive ant colony algorithm, finding out an optimal wiring strategy taking the wiring length, the number of inflection points and the number of via holes as optimization functions, and performing automatic wiring on the to-be-wired PCB according to the optimal wiring strategy. The method is high in convergence speed and high in efficiency, and a feasible scheme is provided for reducing the wiring cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the technical field of PCB automatic wiring, and in particular to a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm. Background Art

[0002] With the electrification of engineering technology, circuit design has entered a new era. As the pillar of the information industry, PCB (Printed Circuit Board) plays an irreplaceable role in promoting economic development, deepening industrial structure and changing lifestyle. Therefore, the design of PCB is particularly important, and the quality of PCB wiring will directly affect the subsequent availability. Different PCBs have various requirements for the layout of lines while realizing different functions, and various situations need to be handled during wiring, such as considering the impact of interference and power consumption on the circuit, or transmission delays on high-speed signal lines, which often determine the final quality of the circuit board. In short, wiring is a complex and critical task in the physical design process of PCB, and the performance of the circuit board is closely related to the level of wiring.

[0003] In order to effectively realize PCB automatic wiring, domestic research teams have proposed many algorithms, such as Stella algorithm and Floyd algorithm. Although these algorithms are accurate, the time consumed is unacceptable to engineers. Later, some research teams used intelligent optimization algorithms for PCB automatic wiring. At present, many automatic wiring methods based on ant colony algorithms have been proposed, such as maximum and minimum ant system algorithm, ant colony system, etc. However, these methods cannot overcome the shortcomings of falling into local optimal solutions and slow convergence speed. Summary of the invention

[0004] In order to solve the above technical problems, an embodiment of the present application proposes a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm. This method has low access cost and is directly improved on the basis of the original ant colony algorithm, thereby improving the random search capability in the early stage of iteration, with fast convergence speed and high efficiency, providing a feasible solution for reducing wiring costs.

[0005] In order to achieve the above-mentioned purpose, an embodiment of the present application provides a PCB automatic routing method based on a multi-threaded adaptive ant colony algorithm, comprising the following steps: obtaining information of a PCB board to be routed, topologically transforming the PCB board to be routed into a three-dimensional array using a grid model according to the information of the PCB board to be routed, and initializing parameters; wherein the information of the PCB board to be routed includes at least a circuit schematic, a scale, the location and number of obstacles, and the location and type of endpoints to be arranged; dividing ant colonies using a thread pool, assigning a thread to each ant colony, and fixing the population size of each ant colony so that different ant colonies search independently without information exchange between each other; selecting the next target point using an optimized probability selection formula; selecting the optimal ant path and the global optimal solution for each iteration to alternately update the pheromone; based on the iteration of the multi-threaded adaptive ant colony algorithm, finding the optimal routing strategy with routing length, number of inflection points and number of vias as optimization functions, and automatically routing the PCB board to be routed according to the optimal routing strategy.

[0006] In order to achieve the above-mentioned purpose, an embodiment of the present application also provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as described above.

[0007] In order to achieve the above-mentioned purpose, an embodiment of the present application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as described above.

[0008] The embodiment of the present application provides a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm, which obtains the information of the PCB board to be wired, topologically transforms the PCB board to be wired into a three-dimensional array using a grid model, and initializes the parameters. Then, the multi-threaded adaptive ant colony algorithm is used for iteration. The design has low access cost and does not need to introduce other algorithms. It only needs to be optimized on the basis of the original ant colony algorithm. The ant colony is divided by the thread pool, and a thread is assigned to each ant colony. The population size of each ant colony is fixed, so that different ant colonies can search independently without information exchange. After that, the next target point is selected using the optimized probability selection formula, and the optimal ant path and the global optimal solution of each iteration are selected to update the pheromone alternately, and finally the optimal wiring strategy with wiring length, number of inflection points and number of vias as optimization functions is found, and the PCB board to be wired is automatically wired according to the optimal wiring strategy. The introduction of the adaptive function enables the algorithm to improve the random search capability at the beginning of the iteration, and the convergence speed is continuously improved with the increase of the number of iterations. Under the same number of iterations, the multi-threaded adaptive ant colony algorithm has better solutions and faster convergence speed, with powerful performance. It optimizes the wiring length, number of inflection points and number of vias of the PCB, providing a feasible solution for reducing the wiring cost.

[0009] In some optional embodiments, according to the information of the PCB board to be wired, a grid model is used to topologically transform the PCB board to be wired into a three-dimensional array, and the parameters are initialized, including: based on the circuit schematic of the PCB board to be wired, the PCB board to be wired is divided into grids of uniform size through a grid model, and the three-dimensional array is used to store component position information and pin information, and a set of initial wiring orders sorted by distance are given in combination with the distance between endpoints.

[0010] In some optional embodiments, the optimized probability selection formula is:

[0011]

[0012] Among them, i represents the current point, j represents the adjacent point, k represents the target point, and p ij is the probability of selecting the next adjacent point, α is the preset information heuristic factor, β is the preset expected heuristic factor, τ ij Indicates the pheromone on the edge, next dot(t) represents the set of all adjacent points, H ij is the heuristic coefficient, η ij represents the heuristic from the current point i to the adjacent point j, η ik Represents the heuristic from the current point i to the target point k.

[0013] In some optional embodiments, the next target point is selected using an optimized probability selection formula, including:

[0014] Get the actual step length from the current point to the target point, as well as the Manhattan distance between the current point and the target point. Based on the actual step length and Manhattan distance, find the heuristic element. The formula for finding the heuristic element is:

[0015]

[0016] Among them, k cur is the actual step length from the current point i to the target point k, k step is the preset maximum step size, d pre is the Manhattan distance between the current point i and the target point k;

[0017] Calculate the direction from the current point to the target point, the Manhattan distance between the current point and the end point, and the Manhattan distance between the target point and the end point;

[0018] The performance of the multi-threaded ant colony algorithm is improved by introducing an adaptive function to form a multi-threaded adaptive ant colony algorithm; among them, the inertia coefficient is introduced to reduce the number of inflection points, control the ants to move in the current direction as much as possible, introduce the traction coefficient to prompt the ants to move in the direction of the end point, speed up the ants' movement to the target point, avoid invalid searches, and prevent the ants from moving in the wrong direction. When looking for the next target point, different coefficients k are selected according to the direction of travel of each adjacent point and the node position. adaptive .

[0019] In some optional embodiments, the heuristic coefficient H ij It is expressed by the formula:

[0020] H ij =k adaptive ·f(x)

[0021] f(x)=(e x -cosx)·tanx

[0022] Among them, f(x) is an adaptive function, which is an increasing function. The slope of f(x) increases monotonically, that is, the growth rate of f(x) increases with the increase of the number of iterations. adaptive is a set of combination coefficients.

[0023] In some optional embodiments, k adaptive The selection rules are:

[0024]

[0025] Among them, λ1 is the inertia coefficient, λ2 is the traction coefficient, dir(i,j) represents the direction from i to j, and cur_dir(t) represents the current direction of the ant.

[0026] In some optional embodiments, the optimal ant path in each iteration and the global optimal solution are selected to update the pheromone alternately, including:

[0027] The cost function is used to calculate the costs of all paths in the iteration process and compare them. In each iteration, the path with the smallest path cost is selected as the optimal ant path. The formula of the cost function is expressed as:

[0028]

[0029] Wherein, l is the wiring length, d is the number of inflection points, h is the number of vias, and k1 and k2 are preset weight coefficients;

[0030] After each iteration of the preset number of iterations is completed, the pheromone is updated using the global optimal solution, the pheromone of the points on the path is increased, and then the pheromone concentration of each point is checked to see if it is within the specified range. If it exceeds the range, it is updated to the boundary value.

[0031] In some optional embodiments, the updating formula of pheromone is:

[0032] τ ij (t+1)=(1-ρ)·τ ij (t)+Δτ ij

[0033]

[0034] Among them, ρ is the preset evaporation coefficient, Δτ ij is the added pheromone, Q is a constant, L best is the global optimal solution;

[0035] The pheromone concentration is limited to [τ max ,τ min ],τ max =Q / (1-ρ) / L best , τ min =τ max / 2. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the related technologies, the drawings required for use in the embodiments of the present application or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0037] Figure 1 It is a flowchart of a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm provided in one embodiment of the present application;

[0038] Figure 2 is a flowchart of a multi-threaded adaptive ant colony algorithm provided in one embodiment of the present application;

[0039] Figure 3 is a schematic diagram of an automatic routing result provided in an embodiment of the present application;

[0040] Figure 4 It is a structural schematic diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0041] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the embodiments of the present application will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the present application, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can also be implemented. The division of the following embodiments is for the convenience of description, and the specific implementation of the present application should not be construed as any limitation, and the various embodiments can be combined and referenced with each other under the premise of no contradiction.

[0042] An embodiment of the present application proposes a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm, which is applied to an electronic device, wherein the electronic device can be a terminal or a server. In this embodiment and the following embodiments, the electronic device is described by taking the server as an example. The implementation details of the PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm proposed in this embodiment are specifically described below. The following content is only the implementation details provided for the convenience of understanding and is not necessary for the implementation of this solution.

[0043] The specific process of the PCB automatic wiring method based on the multi-threaded adaptive ant colony algorithm proposed in this embodiment can be as follows: Figure 1 As shown, including:

[0044] Step 101, obtaining information of a PCB board to be wired, topologically transforming the PCB board to be wired into a three-dimensional array using a grid model according to the information of the PCB board to be wired, and initializing parameters.

[0045] In a specific implementation, the server first determines the PCB board to be wired and obtains the information of the PCB board to be wired, which includes at least the circuit schematic diagram, scale, number of layers, location and number of obstacles, and location and type of endpoints to be arranged of the PCB board to be wired. Then, according to the information of the PCB board to be wired, the PCB board to be wired is topologically transformed into a three-dimensional array using a grid model, and the parameters are initialized.

[0046] In one example, the server divides the PCB board to be wired into grids of uniform size based on the circuit schematic of the PCB board to be wired through a grid model, uses a three-dimensional array to store component position information and pin information, and combines the distance between endpoints to give a set of initial wiring orders sorted by distance. In the three-dimensional array, 0 represents a routable point, 1 represents a point that has been wired, 4 represents an obstacle, 2 represents the starting point, and 3 represents the end point. The initialization parameters include the initialization number of ants in the range of [30,50], the number of iterations is 100 times, and the pheromone matrix is ​​initialized to the maximum pheromone value.

[0047] Step 102, using a thread pool to divide the ant colonies, assigning a thread to each ant colony, and fixing the population size of each ant colony so that different ant colonies search independently without exchanging information with each other.

[0048] In the specific implementation, the original ant colony algorithm is improved to a multi-threaded ant colony algorithm, which is implemented through a thread pool. The server uses the thread pool to divide the ant colony, assigns a thread to each ant colony, and fixes the population size of each ant colony, so that different ant colonies search independently without information exchange between each other, so as to reduce unnecessary communication overhead. This design avoids the low search efficiency caused by all ants queuing up to search in sequence, and allows the entire ant colony to be split into multiple independent sub-colonies, which not only speeds up the search efficiency, but also has a higher randomness and is conducive to finding a better solution.

[0049] It is worth noting that the size of the thread pool is set differently according to different situations. For frequent computing, Pool = N + 1 can be designed, and for frequent I / O processing, pool = N·(1+W·C) can be designed, where N is the number of CPU cores of the computer.

[0050] In an example, the automatic wiring task is mainly computing, and the number of CPU cores of the selected computer is generally 16, so the thread pool size can be designed to be 17.

[0051] Step 103, select the next target point using the optimized probability selection formula.

[0052] In the specific implementation, in addition to multi-threading, this application also needs to introduce an adaptive function to form the final multi-threaded adaptive ant colony algorithm, which is achieved by optimizing the probability selection formula. After completing the thread allocation, you can enter the iteration of the multi-threaded adaptive ant colony algorithm. The iteration process of the multi-threaded adaptive ant colony algorithm can be as follows Figure 2 The server obtains the set of neighboring points of the current location (current point), and then calculates the direction from the current point to each neighboring point, as well as the estimated distance d between the current point and the end point. est, and then use these conditions to calculate the heuristic coefficient of each neighboring point, and finally randomly generate a number between 0 and 1. When this number is greater than the set q0, the point with the largest probability is selected as the target point, otherwise the next point is selected by roulette.

[0053] In one example, the optimized probability selection formula is as follows:

[0054]

[0055] Among them, i represents the current point, j represents the adjacent point, k represents the target point, and p ij is the probability of selecting the next adjacent point, α is the preset information heuristic factor, β is the preset expected heuristic factor, τ ij Indicates the pheromone on the edge, next dot(t) represents the set of all adjacent points, H ij is the heuristic coefficient, η ij represents the heuristic from the current point i to the adjacent point j, η ik Represents the heuristic from the current point i to the target point k.

[0056] In one example, when the server selects the next target point using the optimized probability selection formula, it first obtains the actual step length from the current point to the target point and the Manhattan distance between the current point and the target point, and then calculates the heuristic based on the actual step length and Manhattan distance. The formula for calculating the heuristic is: ik =(1+k cur / k step )·(1 / d pre ), k cur is the actual step length from the current point i to the target point k, k step is the preset maximum step size, d pre is the Manhattan distance between the current point i and the target point k. Then the direction from the current point to the target point, the Manhattan distance between the current point and the end point, and the Manhattan distance between the target point and the end point are calculated. Then the performance of the multi-threaded ant colony algorithm is improved by introducing an adaptive function to form a multi-threaded adaptive ant colony algorithm. The inertia coefficient in the adaptive function introduced is used to reduce the number of inflection points and control the ants to move in the current direction as much as possible. The traction coefficient in the adaptive function introduced encourages the ants to move in the direction of the end point, speeds up the ants' movement towards the target point, avoids invalid searches, and prevents the ants from moving in the wrong direction. When looking for the next target point, different coefficients k are selected according to the direction of travel of each adjacent point and the node position. adaptive The adaptive function ensures that the algorithm has a high random search capability in the early stage of convergence. As the function increases, the convergence speed of the algorithm is gradually improved with continuous iterations, avoiding falling into the local optimal solution too early and improving the convergence speed.

[0057] In one example, the heuristic coefficient H ij The specific formula is expressed as:

[0058] H ij =k adaptive ·f(x)

[0059] f(x)=(e x -cosx)·tanx

[0060] Among them, f(x) is an adaptive function, which is an increasing function. The slope of f(x) increases monotonically, that is, the growth rate of f(x) increases with the increase of the number of iterations. adaptive is a set of combination coefficients.

[0061] In one example, k adaptive The selection rules are:

[0062]

[0063] Among them, λ1 is the inertia coefficient, λ2 is the traction coefficient, dir(i,j) represents the direction from i to j, and cur_dir(t) represents the current direction of the ant.

[0064] Step 104, selecting the optimal ant path in each iteration and the global optimal solution to update the pheromone alternately.

[0065] In the specific implementation, the server calculates the cost of all paths in the iteration process through the cost function and compares them. In each iteration, the path with the smallest path cost is selected as the optimal ant path. After each preset number of iterations (generally set to 5 times), the pheromone is updated using the global optimal solution, the pheromone of the points on the path is increased, and then the pheromone concentration of each point is checked to see if it is within the specified range. If it exceeds the range, it is updated to the boundary value.

[0066] In one example, the formula of the cost function is specifically expressed as: Among them, l is the wiring length, d is the number of inflection points, h is the number of vias, and k1 and k2 are preset weight coefficients.

[0067] In one example, the pheromone update formula is as follows:

[0068] τ ij (t+1)=(1-ρ)·τ ij (t)+Δτ ij

[0069]

[0070] Among them, ρ is the preset evaporation coefficient, Δτ ijis the added pheromone, Q is a constant, L best is the global optimal solution. The limited range of pheromone concentration is [τ max ,τ min ],τ max =Q / (1-ρ) / L best , τ min =τ max / 2.

[0071] Step 105, based on the iteration of the multi-threaded adaptive ant colony algorithm, find out the optimal routing strategy with routing length, number of inflection points and number of vias as optimization functions, and automatically route the PCB board to be routed according to the optimal routing strategy.

[0072] In the specific implementation, the server gradually finds the optimal routing strategy with routing length, number of inflection points and number of vias as optimization functions based on the iteration of the multi-threaded adaptive ant colony algorithm, and finally automatically routes the PCB board to be wired according to the found optimal routing strategy.

[0073] In one example, an automatic routing result may be Figure 3 As shown, Figure 3 The number of inflection points is 900, the number of vias is 136, and the wiring length (path length) is 4160.418756581978 mm.

[0074] In this embodiment, the information of the PCB board to be wired is obtained, and the PCB board to be wired is topologically transformed into a three-dimensional array using a grid model, and the parameters are initialized. Then, a multi-threaded adaptive ant colony algorithm is used for iteration. The design has low access cost and does not need to introduce other algorithms. It only needs to be optimized on the basis of the original ant colony algorithm. The ant colonies are divided by thread pools, and a thread is assigned to each ant colony. The population size of each ant colony is fixed, so that different ant colonies can search independently without information exchange. After that, the next target point is selected using the optimized probability selection formula, and the optimal ant path and the global optimal solution of each iteration are selected to update the pheromone alternately, and finally the optimal wiring strategy with wiring length, number of inflection points and number of vias as optimization functions is found, and the PCB board to be wired is automatically wired according to the optimal wiring strategy. The introduction of the adaptive function enables the algorithm to improve the random search capability at the early stage of iteration, and the convergence speed is continuously improved with the increase of the number of iterations. Under the same number of iterations, the multi-threaded adaptive ant colony algorithm has better solutions and faster convergence speed, with powerful performance. It optimizes the wiring length, number of inflection points and number of vias of the PCB, providing a feasible solution for reducing the wiring cost.

[0075] The step division of the above methods is only for clear description. When implemented, they can be combined into one step or some steps can be split and decomposed into multiple steps. As long as they include the same logical relationship, they are all within the scope of protection of this application; adding insignificant modifications to the algorithm or process or introducing insignificant designs without changing the core design of the algorithm and process are all within the scope of protection of this application.

[0076] Another embodiment of the present application provides an electronic device, whose specific structure can be as follows: Figure 4 As shown, it includes: at least one processor 201; and a memory 202 that is communicatively connected to the at least one processor 201; wherein the memory 202 stores instructions that can be executed by the at least one processor 201, and the instructions are executed by the at least one processor 201 so that the at least one processor 201 can execute a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm in the above-mentioned method embodiments.

[0077] Among them, the memory and the processor are connected in a bus manner, and the bus includes any number of interconnected buses and bridges, and the bus connects various circuits of one or more processors and memories together. The bus can also connect various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and will not be further described in this article. The bus interface provides an interface between the bus and the transceiver. The transceiver can be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. The data processed by the processor is transmitted on a wireless medium through an antenna, and further, the antenna also receives data and transmits the data to the processor.

[0078] The processor is responsible for managing the bus and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management, and other control functions. Memory can be used to store data used by the processor when performing operations.

[0079] Another embodiment of the present application proposes a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it can implement a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm in the above method embodiment.

[0080] That is, those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including a number of instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as: ROM), random access memory (Random Access Memory, referred to as: RAM), disk or optical disk and other media that can store program codes.

[0081] Those skilled in the art will appreciate that the above embodiments are specific embodiments for implementing the present application, and in actual applications, various changes may be made thereto in form and detail without departing from the spirit and scope of the present application.

Claims

1. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm, characterized in that: include: Acquire information of the PCB board to be wired, topologically transform the PCB board to be wired into a three-dimensional array using a grid model according to the information of the PCB board to be wired, and initialize parameters; wherein the information of the PCB board to be wired includes at least a circuit schematic, a scale, the location and quantity of obstacles, and the location and type of endpoints to be arranged; Use thread pool to divide ant colonies, assign one thread to each ant colony, and fix the population size of each ant colony, so that different ant colonies search independently without exchanging information with each other; Use the optimized probability selection formula to select the next target point; Select the best ant path in each iteration and the global optimal solution to update the pheromone alternately; Based on the iteration of multi-threaded adaptive ant colony algorithm, the optimal routing strategy with routing length, number of inflection points and number of vias as optimization functions is found, and the PCB board to be routed is automatically routed according to the optimal routing strategy.

2. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as claimed in claim 1, characterized in that: According to the information of the PCB board to be wired, the PCB board to be wired is topologically transformed into a three-dimensional array using a grid model, and the parameters are initialized, including: Based on the circuit schematic of the PCB board to be wired, the PCB board to be wired is divided into grids of uniform size through a grid model. A three-dimensional array is used to store component position information and pin information. At the same time, a set of initial wiring orders sorted by distance are given in combination with the distance between endpoints.

3. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as claimed in claim 2, characterized in that: The optimized probability selection formula is: Among them, i represents the current point, j represents the adjacent point, k represents the target point, and p ij is the probability of selecting the next adjacent point, α is the preset information heuristic factor, β is the preset expected heuristic factor, τ ij Indicates the pheromone on the edge, next dot(t) represents the set of all adjacent points, H ij is the heuristic coefficient, η ij represents the heuristic from the current point i to the adjacent point j, η ik Represents the heuristic from the current point i to the target point k.

4. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as claimed in claim 3, characterized in that: The next target point is selected using an optimized probability selection formula, including: Get the actual step length from the current point to the target point, as well as the Manhattan distance between the current point and the target point. Based on the actual step length and Manhattan distance, find the heuristic element. The formula for finding the heuristic element is: Among them, k cur is the actual step length from the current point i to the target point k, k step is the preset maximum step size, d pre is the Manhattan distance between the current point i and the target point k; Calculate the direction from the current point to the target point, the Manhattan distance between the current point and the end point, and the Manhattan distance between the target point and the end point; The performance of the multi-threaded ant colony algorithm is improved by introducing an adaptive function to form a multi-threaded adaptive ant colony algorithm; among them, the inertia coefficient is introduced to reduce the number of inflection points, control the ants to move in the current direction as much as possible, introduce the traction coefficient to prompt the ants to move in the direction of the end point, speed up the ants' movement to the target point, avoid invalid searches, and prevent the ants from moving in the wrong direction. When looking for the next target point, different coefficients k are selected according to the direction of travel of each adjacent point and the node position. adaptive .

5. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as claimed in claim 4, characterized in that: Heuristic coefficient H ij It is expressed by the formula: H ij =k adaptive ·f(x) f(x)=(e x -cosx)·tanx Among them, f(x) is an adaptive function, which is an increasing function. The slope of f(x) increases monotonically, that is, the growth rate of f(x) increases with the increase of the number of iterations. adaptive is a set of combination coefficients.

6. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as claimed in claim 5, characterized in that: k adaptive The selection rules are: Among them, λ1 is the inertia coefficient, λ2 is the traction coefficient, dir(i,j) represents the direction from i to j, and cur_dir(t) represents the current direction of the ant.

7. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm according to any one of claims 1 to 6, characterized in that: The optimal ant path in each iteration and the global optimal solution are selected to update the pheromone alternately, including: The cost function is used to calculate the costs of all paths in the iteration process and compare them. In each iteration, the path with the smallest path cost is selected as the optimal ant path. The formula of the cost function is expressed as: Wherein, l is the wiring length, d is the number of inflection points, h is the number of vias, and k1 and k2 are preset weight coefficients; After each iteration of the preset number of iterations is completed, the pheromone is updated using the global optimal solution, the pheromone of the points on the path is increased, and then the pheromone concentration of each point is checked to see if it is within the specified range. If it exceeds the range, it is updated to the boundary value.

8. A PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as claimed in claim 7, characterized in that: The update formula of pheromone is: t ij (t+1)=(1-ρ)·τ ij (t)+Δτ ij Among them, ρ is the preset evaporation coefficient, Δτ ij is the added pheromone, Q is a constant, L best is the global optimal solution; The pheromone concentration is limited to [τ max ,τ min ],τ max =Q / (1-ρ) / L best , τ min =τ max / 2.

9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as described in any one of claims 1 to 8.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, it can implement a PCB automatic wiring method based on a multi-threaded adaptive ant colony algorithm as described in any one of claims 1 to 8.

Citation Information

Cited By

  • A method, system and storage medium for automatic routing of PCB sketches

    CN122674636A

  • PCB automatic routing method based on reinforcement learning state-aware ant colony algorithm

    CN122797438A