Clarify routing documentation and refresh example figures
|
Before Width: | Height: | Size: 87 KiB After Width: | Height: | Size: 80 KiB |
|
Before Width: | Height: | Size: 93 KiB After Width: | Height: | Size: 88 KiB |
|
|
@ -3,13 +3,13 @@ from inire.utils.visualization import plot_routing_results
|
|||
|
||||
|
||||
def main() -> None:
|
||||
print("Running Example 05: Orientation Stress Test...")
|
||||
print("Running Example 05: Port Headings...")
|
||||
|
||||
bounds = (0, 0, 200, 200)
|
||||
netlist = {
|
||||
"u_turn": (Port(50, 50, 0), Port(50, 70, 180)),
|
||||
"loop": (Port(100, 100, 90), Port(100, 80, 270)),
|
||||
"zig_zag": (Port(20, 150, 0), Port(180, 150, 0)),
|
||||
"east_to_west": (Port(50, 50, 0), Port(50, 70, 180)),
|
||||
"north_to_south": (Port(100, 100, 90), Port(100, 80, 270)),
|
||||
"straight": (Port(20, 150, 0), Port(180, 150, 0)),
|
||||
}
|
||||
problem = RoutingProblem(
|
||||
bounds=bounds,
|
||||
|
|
@ -20,7 +20,7 @@ def main() -> None:
|
|||
objective=ObjectiveWeights(bend_penalty=50.0),
|
||||
)
|
||||
|
||||
print("Routing complex orientation nets...")
|
||||
print("Routing two heading reversals and one straight connection...")
|
||||
run = route(problem, options=options)
|
||||
for net_id, result in run.results_by_net.items():
|
||||
status = "Success" if result.is_valid else "Failed"
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 82 KiB |
|
Before Width: | Height: | Size: 55 KiB After Width: | Height: | Size: 53 KiB |
|
|
@ -1,6 +1,6 @@
|
|||
# Routing examples
|
||||
|
||||
After [installing Inire](../README.md#install), run the scripts from the repository root. They save PNGs in the examples directory by default.
|
||||
After [installing Inire](../README.md#install), run the scripts from the repository root. They save PNGs in `examples/` by default. Arrows at ports show the direction the route leaves its source or enters its target.
|
||||
|
||||
```sh
|
||||
python examples/01_simple_route.py
|
||||
|
|
@ -10,36 +10,37 @@ python examples/01_simple_route.py
|
|||
|
||||
| Script | What to look for | Preview |
|
||||
| --- | --- | --- |
|
||||
| [Simple route](01_simple_route.py) | One path leaves and enters its ports travelling east. | [Quick-start figure](../README.md#route-a-net) |
|
||||
| [Port orientations](05_orientation_stress.py) | Perpendicular and opposing headings require different approaches, even for nearby ports. | [Port approaches](05_orientation_stress.png) |
|
||||
| [Simple route](01_simple_route.py) | A straight waveguide connects two eastbound ports 80 units apart. | [Straight connection](01_simple_route.png) |
|
||||
| [Port headings](05_orientation_stress.py) | Two routes connect ports just 20 units apart. The lower route departs east and arrives west. The middle route departs north and arrives south. Both need room to turn. | [Two heading reversals and a straight route](05_orientation_stress.png) |
|
||||
|
||||
## Route around fixed geometry
|
||||
|
||||

|
||||
|
||||
The second route loops around the left end of the fixed straight. To reproduce the detour, run [`03_locked_paths.py`](03_locked_paths.py). To supply your own fixed polygons, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route).
|
||||
The first call routes a straight waveguide. The second uses its polygons as keepouts, so the new northbound connection passes to the left of the fixed route. Run [`03_locked_paths.py`](03_locked_paths.py) to reproduce the detour. To hold a route fixed in your own design, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route).
|
||||
|
||||
## Fit bends to available room
|
||||
|
||||

|
||||

|
||||
|
||||
Follow the short offset to see a single S-bend. The larger shift has room for a pair of right-angle bends.
|
||||
Run [`04_sbends_and_radii.py`](04_sbends_and_radii.py) to compare a 5-unit shift made with an S-bend and an 80-unit shift made with two 90-degree bends. Both routes leave and arrive heading east. The two 90-degree turns use radius 10 from the allowed radii of 10 and 30.
|
||||
|
||||
| Script | What to look for | Preview |
|
||||
| --- | --- | --- |
|
||||
| [S-bends and radii](04_sbends_and_radii.py) | The shapes used for a short offset and for a larger shift. | Compare the two paths in the figure above. |
|
||||
| [Bend proxies](06_bend_collision_models.py) | How an arc, a box proxy for an arc, and a custom physical bend affect the route. | [Bend model comparison](06_bend_collision_models.png) |
|
||||
| [Custom bends](08_custom_bend_geometry.py) | A route whose search proxy and physical bend use different polygons. | [Custom bend overlay](08_custom_bend_geometry.png) |
|
||||
| [Bend proxies](06_bend_collision_models.py) | Compare three separate runs. The middle route has round physical bends and uses rectangles to check for collisions during search. The bottom route uses a right-angle polygon for both. | [Arc, box proxy, and custom bend](06_bend_collision_models.png) |
|
||||
| [Custom bends](08_custom_bend_geometry.py) | Two runs connect the same ports. Compare the standard arc with the custom right-angle bend. The shaded box at the turn shows the custom bend's search proxy. | [Two bends at the same corner](08_custom_bend_geometry.png) |
|
||||
|
||||
The dashed outlines show the shapes used for collision checks during search. The solid outlines show the physical waveguides.
|
||||
|
||||
## Diagnose congestion or an incomplete route
|
||||
|
||||
| Script | What to look for | Preview |
|
||||
| --- | --- | --- |
|
||||
| [Congestion resolution](02_congestion_resolution.py) | How rerouting separates nets competing for the same space. | [Separated routes](02_congestion_resolution.png) |
|
||||
| [Best-effort result](09_unroutable_best_effort.py) | Where a path stops with a small node budget. Try `node_limit=500` to complete it. | [Budget comparison](../docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short) |
|
||||
| [Fan-out](07_large_scale_routing.py) | How search states cluster around a bottleneck. The example adjusts the heuristic between iterations through the internal worker. | [Fan-out search overlay](07_large_scale_routing.png) |
|
||||
| [Congestion resolution](02_congestion_resolution.py) | The eastbound route bends around the lower ends of two straight vertical routes. | [Detour around vertical routes](02_congestion_resolution.png) |
|
||||
| [Best-effort result](09_unroutable_best_effort.py) | At `node_limit=3`, the route stops after its first turn with outcome `partial`. At 500 it reaches the target heading west. | [Three versus 500 nodes](../docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short) |
|
||||
| [Fan-out](07_large_scale_routing.py) | Ten routes pass through one opening in a wall and spread out to widely spaced targets on the right. | [Ten routes through one opening](07_large_scale_routing.png) |
|
||||
|
||||
In the bend overlays, the dashed outline shows what search uses to screen candidate moves. The solid outline shows the physical bend you can measure for clearance. To interpret an incomplete or colliding path, read `result.outcome` using the [result guide](../docs/user/tune-and-troubleshoot.md#read-the-result).
|
||||
The fan-out script includes a callback that can adjust the search weight for later iterations. With these settings, the automatically generated starting paths already pass verification. For a multi-net example built on the public API, try the [two-crossing layout](advanced.md#two-crossings-with-an-outside-detour).
|
||||
|
||||
## Route a challenging layout
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# Advanced routing examples
|
||||
|
||||
These layouts exercise the same geometry as the stress tests and the nine-net Terminal-Bench cases. Each run starts with the board, keepouts, and ports. Inire computes all the plotted paths from those inputs.
|
||||
Compare the input board and the calculated routes on layouts with tight turns, shared openings, or preplaced crossing cells. The layouts come from Inire's stress tests and the nine-net Terminal-Bench cases.
|
||||
|
||||
- [Competing passages](#competing-passages) for mixed widths and opposing headings.
|
||||
- [Competing passages](#competing-passages) for different guide widths and routes travelling in both directions.
|
||||
- [Bend and return room](#bend-and-return-room) for alternating detours, short shifts, and branches.
|
||||
- [Placed crossings](#placed-crossings) for access slots and external detours.
|
||||
- [Nine-net Terminal-Bench board](#nine-net-terminal-bench-board) for fixed and inferred headings on the same input.
|
||||
|
|
@ -18,7 +18,7 @@ python examples/advanced_layouts.py \
|
|||
--output-dir /tmp/inire-advanced-routes
|
||||
```
|
||||
|
||||
The [input file](advanced-layouts.json) gives each board's bounds, polygon keepouts in WKT, clearance, and allowed bend and S-bend radii. Each net row contains its ID, source port, target port, and width. Ports are `[x, y, heading_in_degrees]`. The [example script](advanced_layouts.py) builds the `RoutingProblem` and calls `route()` in automatic mode.
|
||||
The [layout data](advanced-layouts.json) lists board bounds, polygon keepouts in well-known text (WKT), clearance, and allowed radii. Each net row contains its ID, source port, target port, and width. A port is `[x, y, heading_in_degrees]`, with the target heading giving the direction of arrival. The [example script](advanced_layouts.py) turns the data into a `RoutingProblem` and routes it automatically.
|
||||
|
||||
In the figures, gray shapes are keepouts. Open circles mark sources and filled squares mark targets. Arrows indicate the direction of travel at those ports. The result panel draws the physical waveguides and reports the number of nets that passed verification.
|
||||
|
||||
|
|
@ -26,13 +26,13 @@ In the figures, gray shapes are keepouts. Open circles mark sources and filled s
|
|||
|
||||
### Mixed widths at a slit
|
||||
|
||||
In `stress-passage-width-key`, the 2-unit-wide lane uses the lower slit with 5 units of clearance. The other five routes share the upper opening, including nets travelling in the opposite direction.
|
||||
In `stress-passage-width-key`, the 2-unit-wide guide fits through the 14-unit lower slit with the required clearance of 5 on each side. The upper opening carries the other five routes, some eastbound and some westbound.
|
||||
|
||||

|
||||
|
||||
### Staggered openings and one shared passage
|
||||
|
||||
In `stress-passage-split-merge`, the first wall offers two openings for three tracks each. The routes turn between the walls to enter the second opening as a six-track bank.
|
||||
In `stress-passage-split-merge`, three routes use each of the first wall's two openings. Their turns between the walls bring all six routes into one opening in the second wall, with clearance between the guides.
|
||||
|
||||

|
||||
|
||||
|
|
@ -46,13 +46,13 @@ In `stress-refine-alternating-doglegs`, three eastbound nets pass above a wall r
|
|||
|
||||
### Folded return near a shelf
|
||||
|
||||
In `stress-refine-return-shelf`, the folded net's target lies west of its source and requires eastbound arrival. Follow its loop below the two neighboring routes in the result panel.
|
||||
In `stress-refine-return-shelf`, the folded return starts and finishes heading east, even though its target lies west of its source. It loops below two nearby routes before turning east to enter its target.
|
||||
|
||||

|
||||

|
||||
|
||||
### Trunk that detours around branches
|
||||
|
||||
In `stress-retry-straight-decoy`, the straight line between the trunk's ports would cut across both perpendicular branches. The router sends the trunk below the branch ports and above the lower rail.
|
||||
In `stress-retry-straight-decoy`, a straight route between the trunk's ports would cross both vertical branches. The routed trunk passes below the lower end of each branch and above the bottom route.
|
||||
|
||||

|
||||
|
||||
|
|
@ -64,9 +64,9 @@ In `stress-retry-compact-shift-bank`, walls divide the board into four rows. The
|
|||
|
||||
### Mixed port bank
|
||||
|
||||
In `stress-retry-mixed-port-bank`, two compact shifts launch in opposite directions around different keepouts. The lower middle net turns from northbound to eastbound, and the top link runs west.
|
||||
In `stress-retry-mixed-port-bank`, the two short routes connect offset ports on opposite sides of the board. One launches east and the other west. The route starting near the bottom turns from northbound to eastbound, and the top route runs straight west.
|
||||
|
||||

|
||||

|
||||
|
||||
## Placed crossings
|
||||
|
||||
|
|
@ -74,34 +74,34 @@ The crossing cells are already placed. The board supplies keepouts with slots at
|
|||
|
||||
### Opposed S-bends beside a crossing
|
||||
|
||||
In `stress-sbend-competing-slots`, two links make 20-unit lateral shifts while travelling in opposite directions. Their S-bends fit on opposite sides of the small central keepout while two separate links reach the crossing's north and south ports.
|
||||
In `stress-sbend-competing-slots`, the two left-hand routes each shift sideways by 20 units. The eastbound route bends past the right end of the small keepout, and the westbound route bends past its left end. Two other routes connect to the north and south ports of the crossing.
|
||||
|
||||

|
||||
|
||||
### Odd offset and a short launch pocket
|
||||
|
||||
In `stress-crossing-off-lattice-slot`, the west approach must shift by 17 units and land on a recessed port. It uses a pair of 90-degree bends. The north link turns in a short pocket beside a keepout before straightening toward its target.
|
||||
In `stress-crossing-off-lattice-slot`, the west approach shifts 17 units north with two 90-degree bends and still arrives heading east. The route leaving the crossing's north port bends around the keepout above it.
|
||||
|
||||

|
||||
|
||||
### Two crossings with an outside detour
|
||||
|
||||
In `stress-crossings-shared-outside-detour`, a straight external link joins the two devices. The long lower route bends around the entire south approach bank, leaving both short vertical links in place.
|
||||
In `stress-crossings-shared-outside-detour`, a straight external waveguide joins the two crossing cells. The long eastbound route detours below the horizontal keepout and the two short links to the south ports.
|
||||
|
||||

|
||||
|
||||
## Nine-net Terminal-Bench board
|
||||
|
||||
The board has seven keepouts and nine connections out of a tight west-side launch bank. Both examples use 2-unit-wide waveguides, clearance 6, and radius 50 for bends and S-bends. For the upstream board pin and the waypoint export command, see the [Terminal-Bench fixture guide](../docs/benchmark-fixtures.md#automatic-nine-net-terminal-bench-routing).
|
||||
Nine closely spaced source ports on the left feed routes around seven keepouts. Both examples use guides 2 units wide, a clearance of 6 units, and a radius of 50 units for bends and S-bends. For the original board data and the waypoint export command, see the [Terminal-Bench fixture guide](../docs/benchmark-fixtures.md#automatic-nine-net-terminal-bench-routing).
|
||||
|
||||
### Fixed eastbound headings
|
||||
|
||||
In `terminal-bench`, both headings on every net are fixed eastbound. Follow `net_08` from the low end of the launch bank around the board. It makes a final turnaround to arrive eastbound at its target near the top edge.
|
||||
In `terminal-bench`, all routes must leave and arrive heading east. Follow `net_08` from the bottommost source around the board. Near the top edge, it turns back to approach its target from the west.
|
||||
|
||||

|
||||
|
||||
### Point terminals
|
||||
|
||||
In `terminal-bench-point-terminals`, heading inference can change the initial zero headings supplied to `Port`. The setup shows the terminal positions, and the result shows the inferred headings. `net_08` arrives westbound from the east and saves the final turnaround.
|
||||
In `terminal-bench-point-terminals`, the coordinates are the same and `infer_terminal_headings=True` lets the planner choose directions. The setup shows just the port positions. In the result, `net_08` enters its target from the east and avoids the final turnaround.
|
||||
|
||||

|
||||

|
||||
|
|
|
|||