Tie routing documentation to user and developer workflows

This commit is contained in:
Jan Petykiewicz 2026-11-27 10:15:54 -08:00
commit 2c7a7ea90a
2 changed files with 309 additions and 148 deletions

View file

@ -29,13 +29,12 @@ def main() -> None:
congestion=CongestionOptions(warm_start_enabled=False, max_iterations=1),
)
print("Routing with a deliberately tiny node budget (should return a partial path)...")
print(f"Routing with a node limit of {options.search.node_limit} per search.")
run = route(problem, options=options)
result = run.results_by_net["budget_limited_net"]
if not result.reached_target:
print(f"Target not reached as expected. Partial path length: {len(result.path)} segments.")
else:
print("The route unexpectedly reached the target. Increase difficulty or reduce the node budget further.")
print(f"Outcome: {result.outcome}")
if result.outcome == "partial":
print(f"Partial path contains {len(result.path)} segments.")
fig, _ax = plot_routing_results(
run.results_by_net,

View file

@ -1,6 +1,6 @@
# Routing examples
Run these scripts from the repository root after [installation](../README.md#install). Each script saves a PNG alongside its source.
After [installing Inire](../README.md#install), run the scripts from the repository root. Each saves a PNG beside its source.
```sh
python examples/01_simple_route.py
@ -8,31 +8,35 @@ python examples/01_simple_route.py
## Start with a connection
Use the [quick start](../README.md#route-a-net) to connect two ports with copyable code. For perpendicular and opposing headings, compare the [port orientations example](05_orientation_stress.py) with its [route plot](05_orientation_stress.png).
| 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) |
## 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 straight route is fixed, so the second route loops around its left end. Run the [locked-path example](03_locked_paths.py) to reproduce the detour. To pass a fixed route into your own layout, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route).
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).
## 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)
The short path fits a small offset with an S-bend. The longer path has room for a pair of right-angle bends. Run [S-bends and radii](04_sbends_and_radii.py) to see both geometries.
Follow the short offset to see a single S-bend. The larger shift has room for a pair of right-angle bends.
| Example | What to look for | Preview |
| 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) |
## Diagnose congestion or an incomplete route
| Example | What to look for | Preview |
| 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) |
In physical overlays, dashed outlines show search proxies and solid outlines show physical geometry. Inspect clearance using the solid outlines. For red paths, look up `result.outcome` in the [result guide](../docs/user/tune-and-troubleshoot.md#read-the-result).
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).