Clarify routing documentation and refresh example figures

This commit is contained in:
Jan Petykiewicz 2026-11-27 11:59:22 -08:00
commit ab97281df3

View file

@ -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
![A second waveguide makes a U-shaped detour around the left end of a fixed straight waveguide.](03_locked_paths.png)
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
![A short S-bend shifts one guide laterally. A separate route uses two 90-degree bends to make a larger vertical shift.](04_sbends_and_radii.png)
![An S-bend shifts one route 5 units upward. The other route shifts 80 units upward using two 90-degree bends.](04_sbends_and_radii.png)
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