-
Notifications
You must be signed in to change notification settings - Fork 119
Description
As per Discord discussion the current autorouter seems to wire multiple "elements" to the same location. you can see it here below. A probably valid DRC board with overlapping paths going same direction.
This will overcomplicate wiring wasting copper :) For example we might end up in a situation like the following (bottom layer not considered for clarity)
What you usually would like to obtain is something like this:
It will allow for much simpler solutions to high density boards....
An heuristic in pseudocode to create something similar to the desired state would be:
let unsolvedNodes = nodes.sortBy("numOfEdges");
while (unsolvedNodes.length >0) {
let curNode = unsolvedNodes.pop();
let nodesToConnect = curNode.neighbors();
let all = [curNode, ...nodesToConnect]
let L = all.length;
// remove all neighbors and assume solvability
for ( const n of nodesToConnect) {
unsolvedNodes.remove(n)
}
// path find matrix calculation
let paths = Matrix(L * L)
for (let i=0; i<L; i++) {
for (let j=i+1; j<L; j++) {
paths[i][j] = pathFind(all[i], all[j]);
}
}
// calculate MST ( minimum spanning tree )
res = kruskalMST(paths)
if ( res is false ) { throw Error }
}This algorithm as it is should be O(N^2 * O(pathFind)) where N are the connection points/smd pads or nodes in the algo before.
IT should already produce a good pcb ready to be optimized later in the pipeline.
Further optimizations:
- Selecting the
pathFindstep is crucial but I wouldnt be surprised if a simple A* produces a good starting point. furthermore we could potentially cacheweightsfrom previous steps asall[i]is being used as target for all the subsequent nodes. - instead of calculating full matrix we could heuristically filter out too far (air/linear distance) nodes.
Notes:
The algorithm assumes that each component can be "solved" independently, which is common in certain graph partition or network design problems. I believe PCBs fall into these subsets.
Also A PCB is composed by pads (nodes) and wires (edges) that form a particular case of a forest in graph theory where each tree is non disconnected


