Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db685794e5 | |||
| 13594632d4 | |||
| 0183a91e9c | |||
| ee41dc600a | |||
| 7616b398e9 | |||
| 3b3d1c74fc | |||
| a05980e8af | |||
| 5c4d32cc3e | |||
| 63acb94642 | |||
| f6e7bac4c5 | |||
| f247cff54a | |||
| 495bf8d307 | |||
| 8c8cbe569b | |||
| 266aeb6c5e | |||
| 72f8fbda5a | |||
| f609e5a695 | |||
| b59888265d | |||
| 7476209ef3 | |||
| 1f098fd4ca | |||
| 5f88e02775 | |||
| ed52ea6ffd | |||
| 9e41c1abf8 | |||
| 6b699e492b | |||
| 9e97945174 | |||
| d64c70c68f | |||
| bcd9ade3ea | |||
| 6c6eb37064 | |||
| b6480ded62 | |||
| ab14e62dca | |||
| ccfe958cc3 | |||
| 0847413ff6 | |||
| 393c01704a | |||
| 2b9d7886fd | |||
| 2bc8cead6e | |||
| 31ad878aeb | |||
| f2b646143f | |||
| 2ffd12da5f | |||
| 4537392641 | |||
| c32148c312 | |||
| a15693ac4f | |||
| 466c68024f | |||
| d94f121ed2 | |||
| 0e923daa9c | |||
| 5255b96e6a | |||
| 90b30608f6 | |||
| a83b5ed155 | |||
| 6c5ee351c8 | |||
| 5804ba568f | |||
| 13b2d8b7de | |||
| 653edda512 | |||
| 80f463bf86 | |||
| 1f48f60d93 | |||
| e0efd04181 | |||
| 253ea1f9c9 | |||
| 5016c0e76a | |||
| 5c8306c636 | |||
| 3ffe7cfc5d | |||
| 06dbfd4093 | |||
| f4b16d3c55 | |||
| 26b12e33a2 | |||
| b541632dde | |||
| 867aab8fa2 | |||
| f762b86429 | |||
| 1723bf338f | |||
| ff36f94e8f | |||
| f11a5ef932 | |||
| b509efc95d | |||
| eac083a37d | |||
| 8b32d68496 | |||
| fd6f96f341 | |||
| a6b0b9216a | |||
| 725f385ba3 | |||
| 8a97c1e64b | |||
| 23d0a140c1 | |||
| 42e1de9884 | |||
| 07f1c47e26 | |||
| aac0353382 | |||
| 8e8c8a7ba0 | |||
| 9ba1dc048a | |||
| 491988d620 | |||
| c480871f07 | |||
| 286caa273b | |||
| cea23ef1b4 | |||
| 1eed75ff5a | |||
| 8f6a917f51 | |||
| e6ae242cb2 | |||
| facde64f09 | |||
| af3ddfbb09 | |||
| d02dbb872f | |||
| 9ee786d138 | |||
| 8ad26cc3c1 | |||
| 2611085808 | |||
| f9ba5669dd | |||
| a86e0a4f5a | |||
| 3d7fc3a705 | |||
| e0f5543578 | |||
| b3580a9c07 | |||
| 196cd00445 | |||
| 760182f25c | |||
| c3e420eadb | |||
| 365c14c59a | |||
| 0c66a1c15a | |||
| 489c20847a | |||
| def1e4ea1d | |||
| c200d0f7c1 | |||
| 0755612723 | |||
| ab97281df3 | |||
| 4a91df39da | |||
| 2c7a7ea90a | |||
| 2d77877fff | |||
| 926b2645b5 | |||
| 15c2714f1f | |||
| a4c76f3a68 | |||
| 16145714a8 | |||
| 0319274163 | |||
| e9ed72d0dc | |||
| 0c059cc7d6 | |||
| 591560949c | |||
| d95eab6963 | |||
| 5120ef52e2 | |||
| 083f4365b4 | |||
| 1cad709c63 | |||
| 6608e18ef5 | |||
| a029791f33 | |||
| ec2768853e | |||
| 2c260e5e95 | |||
| e4d5952677 | |||
| 24559bb6aa | |||
| 2b02c6eae9 | |||
| 8fdb42122e | |||
| 07a2c0e167 | |||
| 64e103b59e | |||
| ea5cfe7f31 | |||
| a8720ac8c9 | |||
| 8af08a537e | |||
| a2dfb73c33 | |||
| d9f0e78330 | |||
| 9ddef652e1 | |||
| 2f2add98ec | |||
| be3222e5ae | |||
| d741456d6b | |||
| 66934cfdc3 | |||
| 78da3f4f12 | |||
| e20afdaed5 | |||
| 316eda090d | |||
| 7e0d96f987 | |||
| 46e7e13059 | |||
| 2c3aa90544 | |||
| 3b7568d6c9 | |||
| 2049353ee9 | |||
| 42e46c67e0 | |||
| 71e263c527 | |||
| e77fd6e69f | |||
| 725980e694 | |||
| 1849075b11 | |||
| e2c91076f7 | |||
| e11132b51d | |||
| bc218a416b | |||
| 941d3e01df | |||
| dcc4d6436c | |||
| 0c432bd229 | |||
| f2b2bf22f9 | |||
| 6a28dcf312 | |||
| a8c876ae69 | |||
| 4c2d5051cd | |||
| 457451d3b2 | |||
| 519dd48131 | |||
| a77ae781a7 | |||
| 62d357c147 | |||
| 148aca45d4 | |||
| 7455917b4a | |||
| bc4184693d | |||
| de7254f8f5 | |||
| d2d619fe1f | |||
| f505694523 | |||
| 7e6be50a86 | |||
| c989ab6b9f | |||
| 22ec194560 | |||
| b1feaa89f8 | |||
| 6ec953b76e | |||
| 51d8ddca51 | |||
| 064aed31a6 | |||
| 6827283886 | |||
| 8833240755 | |||
| d438c5b7c7 | |||
| 24ca402f67 | |||
| 3810e64a5c | |||
| c6116f88f3 | |||
| 91256cbcf9 | |||
| 7b0dddfe45 | |||
| 9fac436c50 | |||
| c36bce9978 | |||
| 8bf0ff279f | |||
| 8424171946 | |||
| 8eb0dbf64a | |||
| c9bb8d6469 | |||
| 58873692d6 | |||
| 4714bed9a8 | |||
| ba76589ffb | |||
| 4cbd15bc0d | |||
| 556241bae3 | |||
| 43a9a6cb3a | |||
| 41a2d9f058 | |||
| 18b2f83a7b | |||
| 82aaf066e2 | |||
| 07d079846b | |||
| f600b52f32 |
5
.gitignore
vendored
|
|
@ -8,3 +8,8 @@ wheels/
|
||||||
|
|
||||||
# Virtual environments
|
# Virtual environments
|
||||||
.venv
|
.venv
|
||||||
|
|
||||||
|
.hypothesis
|
||||||
|
*.png
|
||||||
|
!/docs/figures/*.png
|
||||||
|
|
||||||
|
|
|
||||||
1
.python-version
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
3.13
|
||||||
47
DOCS.md
Normal file
|
|
@ -0,0 +1,47 @@
|
||||||
|
<a id="inire-api-and-tuning-guide"></a>
|
||||||
|
|
||||||
|
# User guide
|
||||||
|
|
||||||
|
- [Quick start](README.md#route-a-net)
|
||||||
|
|
||||||
|
<a id="incremental-routing-with-locked-geometry"></a>
|
||||||
|
<a id="initial-paths-with-pathseed"></a>
|
||||||
|
|
||||||
|
## Describe a layout
|
||||||
|
|
||||||
|
- [Layout inputs](docs/user/route-a-layout.md#define-the-inputs)
|
||||||
|
- [Placed crossings](docs/user/route-a-layout.md#route-between-placed-crossings)
|
||||||
|
- [Route reuse](docs/user/route-a-layout.md#reuse-an-existing-route)
|
||||||
|
|
||||||
|
<a id="read-the-result"></a>
|
||||||
|
<a id="topological-routing"></a>
|
||||||
|
<a id="choose-a-routing-mode"></a>
|
||||||
|
<a id="automatic-routing"></a>
|
||||||
|
<a id="tune-a-run"></a>
|
||||||
|
|
||||||
|
## Check and improve a route
|
||||||
|
|
||||||
|
- [Route outcomes](docs/user/tune-and-troubleshoot.md#read-the-result)
|
||||||
|
- [Placement recipes](docs/user/route-a-layout.md#save-a-placement-recipe)
|
||||||
|
- [Unfinished routes](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short)
|
||||||
|
- [Routing modes](docs/user/tune-and-troubleshoot.md#choose-a-routing-mode)
|
||||||
|
- [Tuning settings](docs/user/tune-and-troubleshoot.md#choose-the-next-setting)
|
||||||
|
|
||||||
|
<a id="moved-reference-sections"></a>
|
||||||
|
<a id="searchoptions"></a>
|
||||||
|
<a id="objectiveweights"></a>
|
||||||
|
<a id="congestionoptions"></a>
|
||||||
|
<a id="refinementoptions"></a>
|
||||||
|
<a id="topologyoptions"></a>
|
||||||
|
<a id="diagnosticsoptions"></a>
|
||||||
|
|
||||||
|
## API reference
|
||||||
|
|
||||||
|
- [`route()` and progress callbacks](docs/user/api-reference.md#route-a-problem)
|
||||||
|
- [Result fields](docs/user/api-reference.md#results)
|
||||||
|
- [Options and defaults](docs/user/api-reference.md#options-and-defaults)
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
- [Runnable examples](examples/README.md)
|
||||||
|
- [Complex-routing walkthrough](docs/complex-routing-example-1.md)
|
||||||
52
README.md
|
|
@ -0,0 +1,52 @@
|
||||||
|
# inire
|
||||||
|
|
||||||
|
Inire routes photonic and RF layouts with straights, 90-degree bends, and S-bends.
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
From a checkout with Python 3.11 or newer, run `pip install .`. Inire requires Shapely 2.1 or newer and checks at import that Shapely is linked against GEOS 3.10 or newer.
|
||||||
|
|
||||||
|
## Route a net
|
||||||
|
|
||||||
|
```python
|
||||||
|
from inire import (
|
||||||
|
NetSpec, Port, RoutingProblem,
|
||||||
|
route,
|
||||||
|
)
|
||||||
|
|
||||||
|
start = Port(50, 100, 0)
|
||||||
|
target = Port(250, 100, 0)
|
||||||
|
net = NetSpec("input", start, target)
|
||||||
|
problem = RoutingProblem(
|
||||||
|
bounds=(0, 0, 1000, 1000),
|
||||||
|
nets=(net,),
|
||||||
|
clearance=2,
|
||||||
|
)
|
||||||
|
|
||||||
|
run = route(problem)
|
||||||
|
result = run.results_by_net["input"]
|
||||||
|
if result.is_valid:
|
||||||
|
print(result.report.total_length)
|
||||||
|
else:
|
||||||
|
print(result.outcome)
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The example prints `200.0`. Heading `0` is east at both ports.
|
||||||
|
|
||||||
|
## Route your own layout
|
||||||
|
|
||||||
|
- [Layout inputs](https://mpxd.net/code/jan/inire/src/branch/topo/docs/user/route-a-layout.md#user-content-define-the-inputs)
|
||||||
|
- [Partial routes](https://mpxd.net/code/jan/inire/src/branch/topo/docs/user/tune-and-troubleshoot.md#user-content-why-a-net-stopped-short)
|
||||||
|
- [Placement recipes](https://mpxd.net/code/jan/inire/src/branch/topo/docs/user/route-a-layout.md#user-content-save-a-placement-recipe)
|
||||||
|
- [User guide](https://mpxd.net/code/jan/inire/src/branch/topo/DOCS.md)
|
||||||
|
|
||||||
|
## Develop Inire
|
||||||
|
|
||||||
|
- [Developer guide](https://mpxd.net/code/jan/inire/src/branch/topo/docs/development.md)
|
||||||
|
- [Routing benchmarks](https://mpxd.net/code/jan/inire/src/branch/topo/docs/benchmarks.md)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
Inire is distributed under the [GNU Affero General Public License v3](https://mpxd.net/code/jan/inire/src/branch/topo/LICENSE.md).
|
||||||
49
docs/architecture.md
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
# Router architecture
|
||||||
|
|
||||||
|
`route()` uses the same worker to search, replay seeds, and verify paths. An explicit mode configures the worker directly. Automatic routing sets a coverage target and tries different plans or worker settings.
|
||||||
|
|
||||||
|
## Automatic routing
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Follow the left column while coverage is below the target. Reaching the target skips the remaining attempts. If the attempts run out, the router selects the best layout it verified.
|
||||||
|
|
||||||
|
1. **Set a coverage target.** Conflicting aligned port faces and [track capacity](../inire/router/_capacity.py#L29) at rectangular cuts can bound how many nets fit.
|
||||||
|
2. **Try constructive plans.** Bundles assign ordered tracks, columns schedule turns, and compact planners fit short links. Each plan supplies seeds for the worker to verify.
|
||||||
|
3. **Search for missing routes.** Early attempts use small budgets and can hold verified routes fixed. When a column plan stalls, try separated channels or a shared bypass around the keepouts. If the locks cut off a port, retry with movable seeds or different lanes. With one net left, try a verified detour around the locked paths, including incumbents found by the seed fallback. Lattice search handles custom outlines and proxies and can retry unresolved nets after corridor-guided attempts.
|
||||||
|
4. **Select and refine.** Prefer higher verified coverage. Compare cost on matching verified net IDs. Refinement can replace the selected layout only if those IDs remain verified.
|
||||||
|
|
||||||
|
### Example of a poor lock
|
||||||
|
|
||||||
|
Holding the straight trunk fixed in `stress-retry-straight-decoy` blocks both vertical routes. The `residual-dogleg` stage finishes the trunk with a four-turn detour, bringing coverage to four out of four. When changing lock ordering, check which stage finishes the trunk.
|
||||||
|
|
||||||
|
- [Trunk detour figure](../examples/advanced.md#trunk-that-detours-around-branches)
|
||||||
|
- [Single-case benchmark](benchmarks.md#run-a-benchmark)
|
||||||
|
|
||||||
|
## Detailed search and congestion
|
||||||
|
|
||||||
|
- **Propose moves.** Weighted A* searches snapped positions and headings. Rays, corners, and corridor waypoints suggest straight endpoints. Admission checks the footprint, cost, and state dominance.
|
||||||
|
- **Prune histories.** The closed set groups arrivals by position and heading. Paths with different final straights or footprints can have different valid continuations, so pruning can discard an alternative.
|
||||||
|
- **Recheck installed paths.** A later route can conflict with one installed earlier. After each iteration, the driver rechecks the installed set and ranks snapshots by completed nets, then conflicts and dynamic collisions.
|
||||||
|
- **Repair small conflict sets.** After restoring the best iteration, try rerouting up to two isolated pairs against the routes held fixed.
|
||||||
|
|
||||||
|
## Geometry and refinement
|
||||||
|
|
||||||
|
- **Replay.** Results carry the requested net and the effective net with resolved ports. Seed replay builds physical geometry from the effective start port using the same endpoint and bend calculations as search.
|
||||||
|
- **Verify.** Search uses collision proxies. Verification checks the physical polygons against the board, keepouts, and other paths. In zero-node replay, verify each path's own geometry first, then add cross-net conflicts. Fixed polygons retain their vertices and enter geometric operations at full coordinate precision.
|
||||||
|
- **Refine.** Try replacing sections with at least four quarter turns. Rank detours before building their polygons and verify the complete updated layout.
|
||||||
|
|
||||||
|
## Validate a change
|
||||||
|
|
||||||
|
| If you change | What to check | Where to start |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Worker setup or seed replay | Resolved ports and path geometry after replay. | [Worker entry point](../inire/router/_stack.py#L65), [placement recipes](user/route-a-layout.md#save-a-placement-recipe) |
|
||||||
|
| Stage order or budgets | Which stage wins and whether work reappears in a later attempt. Include tight passages and preplaced crossings. | [Constructive trials](../inire/router/_automatic.py#L228), [search trials](../inire/router/_automatic.py#L488) |
|
||||||
|
| Locks or candidate acceptance | The verified IDs and their paths after the complete layout is checked. | [Direct trials](../inire/router/_routing_policy.py#L288), [trial selection](../inire/router/_routing_policy.py#L324) |
|
||||||
|
| Corridor or seed allocation | Coverage through shared openings and search work when a corridor reaches the wrong lane or leaves too little turn room. | [Corridor planning and realization](topological-routing.md#corridor-planning-and-realization) |
|
||||||
|
| Moves or reroute scheduling | Which moves reach admission and which nets are retried. | [Move generation](../inire/router/_astar_moves.py), [reroute scheduling](../inire/router/_congestion_policy.py#L99) |
|
||||||
|
| Collision or caching | Clearance and boundary decisions for both physical and proxy shapes. Compare candidate counts and exact checks along with time. | [Physical checks](../inire/geometry/collision.py#L687), [work counters](routing-diagnostics.md#route-metrics) |
|
||||||
|
| Pair-local repair | Coverage and conflict edges before repair, plus the final installed geometry. | [Pair-local search](../inire/router/_pair_local.py), [pair repair trace](routing-diagnostics.md#follow-a-late-conflict-into-pair-local-repair) |
|
||||||
|
| Cost or refinement | Per-net costs on equal verified ID sets and validity after the final check. | [Path refinement](../inire/router/refiner.py), [refinement handoff](../inire/router/_automatic.py#L610) |
|
||||||
|
|
||||||
|
Use [benchmark profiles](benchmarks.md#choose-a-profile) for policy comparisons and [route results and traces](routing-diagnostics.md#reproduce-and-compare) for behavior-preserving changes.
|
||||||
61
docs/benchmark-fixtures.md
Normal file
|
|
@ -0,0 +1,61 @@
|
||||||
|
# Benchmark fixtures
|
||||||
|
|
||||||
|
- [Benchmark cases](benchmarks.md#choose-a-case)
|
||||||
|
- [Corpus registry and profiles](../inire/tests/routing_corpus.py)
|
||||||
|
|
||||||
|
## Micron-scale routing cases
|
||||||
|
|
||||||
|
The `expanded` group adds 75 deterministic, unseeded boards with independently constructed reference routes. The authored grid units are 10, 100, 250, 500, and 1000 nm. Bend radii span 10–100 µm and trace widths span 1–20 µm. The fixtures include `grid_nm` for these boards and the imported layouts. Convert benchmark-weighted lengths to microns by multiplying by `grid_nm / 1000`.
|
||||||
|
|
||||||
|
| Group | Boards | Coverage |
|
||||||
|
| --- | ---: | --- |
|
||||||
|
| `geometry-corners` | 32 | Exact four-bend spans, tight returns and paired routes, exact-span S-bend slots, mixed widths, and saturated or overloaded apertures. |
|
||||||
|
| `complex-layouts` | 24 | Serial aperture banks with opposing tracks, concave and fixed-route keepouts, and staggered crossing arrays. |
|
||||||
|
| `search-challenges` | 11 | Alternating comb walls and other tight passages that require repeated turns or exercise search-budget exhaustion. |
|
||||||
|
| `scaling` | 8 | Banks and crossing arrays of up to 256 nets, obstacle fields with up to 320 keepouts, and a 240-net board with 240 keepouts and four blocked approaches. |
|
||||||
|
|
||||||
|
Pytest verifies the 75 reference layouts and checks that unseeded routing reaches the known bound on every board. For a scaling comparison, use the same grid, mode, and budget across repeated runs.
|
||||||
|
|
||||||
|
- [Fixture definitions](../inire/tests/routing_expanded_benchmarks.py)
|
||||||
|
|
||||||
|
## Complex-routing example 1
|
||||||
|
|
||||||
|
Use `complex-routing-example-1` to test fixed eastbound arrival and `complex-routing-example-1-point-terminals` to test heading inference.
|
||||||
|
|
||||||
|
The Terminal-Bench tests verify the unseeded point-terminal bundle and replay both reference lane plans.
|
||||||
|
|
||||||
|
- [Example gallery](../examples/advanced.md#complex-routing-example-1)
|
||||||
|
- [Complex-routing walkthrough](complex-routing-example-1.md)
|
||||||
|
- [Terminal-Bench tests](../inire/tests/test_terminal_bench.py)
|
||||||
|
|
||||||
|
## Preplaced crossings
|
||||||
|
|
||||||
|
- `crossing-single` isolates port access on one placed cell with four straight external legs.
|
||||||
|
- `crossing-obstructed-approaches` adds blocked approaches and a turning exit.
|
||||||
|
- `crossing-aligned-grid` and `crossing-staggered-grid` test multiple cells and short links between device banks.
|
||||||
|
|
||||||
|
Use unseeded runs to evaluate routing policy. For a separate check of geometry and clearance, use the reference paths in the [crossing fixtures](../inire/tests/routing_crossing_benchmarks.py).
|
||||||
|
|
||||||
|
## Fabrication regression cases
|
||||||
|
|
||||||
|
The layout tests use process dimensions to exercise routing and placement replay.
|
||||||
|
|
||||||
|
| Case | Checks |
|
||||||
|
| --- | --- |
|
||||||
|
| Optical ports | Matching widths allow a direct link. A wider target needs a taper. |
|
||||||
|
| Authored lengths | Custom bend lengths are retained when the route is replayed. |
|
||||||
|
| Layers and process profiles | Independent planes retain layer assignment. Ordered profiles reserve earlier routes and apply their own bend limits. |
|
||||||
|
| Coplanar waveguide | Route the conductor and gap envelope from the same seed. With a 29.5 µm envelope and 3 µm clearance, 28 and 32 µm pitches fail and 36 µm passes. |
|
||||||
|
|
||||||
|
- [Layout regression tests](../inire/tests/test_layout.py)
|
||||||
|
|
||||||
|
### Phase-sensitive routes
|
||||||
|
|
||||||
|
In the Raymond fabrication study, the authored arms of `MZI9` measured 286.770 µm and 183.637 µm. A geometrically valid replacement for the longer arm measured 127.208 µm. It passed the EBeam design-rule check and changed the signed arm-length difference from +103.133 µm to −56.429 µm. Replaying a separate Bézier-based waveguide with circular bends changed its reported length from 156.137 µm to 154.948 µm. Compare the reported lengths against the circuit's tolerance before replacing a phase-sensitive route. [Raymond fabrication layout](https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/EBeam_hannahraymond_MZIv21.gds) · [EBeam bend definitions](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/WAVEGUIDES.xml#L3-L15) · [Reported lengths](user/api-reference.md#results)
|
||||||
|
|
||||||
|
## Imported fixtures
|
||||||
|
|
||||||
|
The converted fixtures have port openings cut into device keepouts and use a 0.1 µm grid. The test suite reads the checked-in layouts.
|
||||||
|
|
||||||
|
- [Converted geometry](../inire/tests/data/external_routing_benchmarks.json)
|
||||||
|
- [Fixture sources and licenses](../inire/tests/data/README.md)
|
||||||
177
docs/benchmarks.md
Normal file
|
|
@ -0,0 +1,177 @@
|
||||||
|
# Routing benchmarks
|
||||||
|
|
||||||
|
## Run a benchmark
|
||||||
|
|
||||||
|
From the repository root, run the overloaded-gate fixture.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python -m pytest -m routing_corpus -k overloaded-gate
|
||||||
|
```
|
||||||
|
|
||||||
|
The test checks that three of the four nets verify. All four nets need to cross a vertical cut with room for three tracks. Use `-k lidar-clements-8x8` to check an imported board with a bound of three out of six set by port spacing.
|
||||||
|
|
||||||
|
### Run the full benchmark corpus
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python -m pytest -m routing_corpus
|
||||||
|
```
|
||||||
|
|
||||||
|
The default test suite includes the corpus. Run `python -m pytest -m retry_holdout` to focus on the holdouts.
|
||||||
|
|
||||||
|
## Choose a case
|
||||||
|
|
||||||
|
Use `pytest --collect-only -q -m routing_corpus` to list the case IDs. Start with a board that exhibits the behavior and select it with `-k`.
|
||||||
|
|
||||||
|
- For tight corners and S-bend slots, start with the micron-scale geometry fixtures.
|
||||||
|
- For preplaced devices, choose a case such as `crossing-obstructed-approaches` or `crossing-staggered-grid`.
|
||||||
|
- For a change to retry order, include the held-out return shelves, bypasses, and competing trunks.
|
||||||
|
|
||||||
|
The [fixture guide](benchmark-fixtures.md) describes these layouts and their known bounds. The [corpus registry](../inire/tests/routing_corpus.py) lists the groups and options.
|
||||||
|
|
||||||
|
## Choose a profile
|
||||||
|
|
||||||
|
The corpus uses automatic routing under `corpus-regression`, with a 500-node search limit, a 500-node seed budget per net, and up to three congestion iterations per attempt. On the three `search-low-length-cost` boards it also checks the original 80- or 130-node lattice budget.
|
||||||
|
|
||||||
|
### Compare routing modes
|
||||||
|
|
||||||
|
For a mode comparison, use the same problem and options in each call to `route()`. Change the topology mode and compare verified IDs, route cost on matching net sets, and work counters. The [complex-routing walkthrough](complex-routing-example-1.md#compare-all-routing-modes) shows this comparison with a 100-node search budget.
|
||||||
|
|
||||||
|
## Compare the results
|
||||||
|
|
||||||
|
1. **Coverage and bounds.** Check which nets verified and whether their count reached the expected bound. The tests also verify known reference routes where available.
|
||||||
|
2. **Cost on matching net sets.** Benchmark-weighted length weights physical straights, 90-degree bends, and S-bends by 1, 4, and 13. Native objective cost uses the run's configured objective.
|
||||||
|
3. **Time and cost.** On identical verified net sets, compare median routing time × total cost². The legacy capture uses benchmark-weighted length and the catalog benchmark uses catalog cost. Compare expansion counts and inspect the [automatic reports](routing-diagnostics.md#automatic-reports) when the score changes. Constructive stages can spend time planning and verifying even with zero expansions.
|
||||||
|
|
||||||
|
## Capture legacy parity
|
||||||
|
|
||||||
|
Run `PYTHONPATH=. python scripts/capture_legacy_routing.py /tmp/inire-parity.json --repeat 3` from the checkout under test. Compare against revision `3b3d1c7` to measure the change to the move evaluator. To capture a Git archive, run the same script by absolute path from the extracted source tree and pass `--revision 3b3d1c7`. The capture records the effective ports, ordered moves, lengths, physical polygons, work counters, options, dependencies, and elapsed time. Use the same dependencies and compare route and work fields independently of elapsed time. The comparison covered 154 cases and modes with three repetitions per checkout and used Python 3.13.18, GEOS 3.13.1, NumPy 2.4.2, SciPy 1.17.1, Shapely 2.1.2, and Rtree 1.4.1. All recorded outcomes, routes, polygons, and deterministic work counters agreed. The sum of the per-case median times was 21.87 s at the reference revision and 21.88 s with the evaluation boundary.
|
||||||
|
|
||||||
|
### Weighted column routing
|
||||||
|
|
||||||
|
Under the corpus weights, verified quarter-turn layouts reduced weighted length by 70–75% on five ordered column fixtures. Across eleven interleaved runs per fixture, time × cost² fell by 64–94%. The largest time increase was on `complex-column-6x3`, from 52 ms to 298 ms. Its weighted length fell from 64,043 to 16,052. A three-repeat comparison across 152 automatic cases verified the same 2,245 net IDs. The other 147 cases retained identical routes and polygons.
|
||||||
|
|
||||||
|
For dense fields, the quarter-turn planner intersects apertures across neighboring columns when the gap cannot fit a jog. The S-bend planner only considers unchanged track rows in windows too short for an S-bend and reuses aperture profiles and bend-spacing measurements. Compared with the previous planner in eleven interleaved runs, `scale-field-16x16` fell from 183 to 153 ms and from 3,319 to 2,678 weighted length, lowering time × cost² by 46%. Physical length rose from 1,983 to 2,112 µm. The same score fell by 53% on `holdout-uneven-bypass` and 14% on `bypass-mixed-width`, with identical routes and costs on both.
|
||||||
|
|
||||||
|
After verifying a weighted S-bend column layout, the planner checks whether a straight can replace an excursion that returns to the same track. Indexed geometry rejects blocked shortcuts before replay. The replacement keeps both endpoint poses and must satisfy the board, keepout, peer-route, and self-clearance checks. Across the 152 automatic cases, this shortened routes on four boards and retained the same 2,245 verified net IDs. In eleven interleaved runs per case, time × cost² fell by 36% on `bypass-opposed-banks`, 19% on `bypass-three-branches`, 18% on `holdout-uneven-bypass`, and 3% on `bypass-long-dividers`.
|
||||||
|
|
||||||
|
### Terminal detours and refinement
|
||||||
|
|
||||||
|
The weighted native planner can compare a four-turn detour with a verified S-bend route between aligned ports. On `precision-forward-large-radius` the winning route uses four quarter turns at the configured radius. Weighted length fell from 4,290 to 2,513 and physical length rose from 433 to 628 µm. In eleven interleaved runs, median time rose from 49 to 56 ms and time × cost² fell by 61%.
|
||||||
|
|
||||||
|
Native refinement checks the center straight of a proposed dogleg before placing its bends. In the same comparison, `complex-column-6x3` took 59% less time and `stress-refine-alternating-doglegs` took 72% less time. Both kept the same verified geometry and cost. Across the 152 automatic cases, the same 2,245 net IDs verified, and `precision-forward-large-radius` was the sole geometry change.
|
||||||
|
|
||||||
|
When disjoint terminal conflicts set the coverage limit, automatic routing can try short terminal links and jogs, checking each route against the occupied board. If a seeded replay reaches the certified limit, the planner can skip the detailed search. On `lidar-clements-8x8`, nine interleaved runs reduced the median from 772 ms to 8 ms. Both versions verified the same three routes at the same weighted cost.
|
||||||
|
|
||||||
|
## Catalog scale benchmarks
|
||||||
|
|
||||||
|
The default `floorplan` case represents a synthetic single-layer photonic layout on a 5 × 5 mm die at 100 nm pitch. It uses 40 nets across seven port banks, with mixed approach directions, staggered fan-outs, and a short local connection. The 60 keepouts cover 11.0% of the die and represent clustered device and pad banks, larger electronics and thermal regions, and stepped block boundaries. Six reference routes pass through an 82 µm gap between two blocks. A separate keepout forces one aligned eastbound connection to detour. The frozen reference paths range from 0.33 to 2.52 mm. Each is verified against the board, keepouts, and the other reference paths before timing unseeded search. [Floorplan coordinates](../scripts/catalog_floorplan.py)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode native --no-refinement
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode manhattan --no-refinement
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode typed --no-refinement
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode octagonal --no-refinement
|
||||||
|
```
|
||||||
|
|
||||||
|
Native uses the Manhattan API. Catalog Manhattan uses the catalog evaluator with a single profile and cardinal turns. Typed adds the centered transition. Octagonal also admits 45° bends. All four modes receive the same floorplan and terminal pairs, with no supplied routes.
|
||||||
|
|
||||||
|
The floorplan defaults to `--net-order bank`, which groups nets by their terminal headings and routes the outside of a lateral fan-out first. Use `--net-order input` to route in fixture order. The native warm start defaults to `--native-jog-limit 48`. It verifies straight and single-turn links and samples two-turn jogs and four-turn detours around keepouts and peer routes. [Native search options](user/api-reference.md#searchoptions)
|
||||||
|
|
||||||
|
The catalog modes default to `--constructive` on this fixture. They verify straight, single-turn, two-turn, and four-turn candidates before falling back to detailed search. Four-turn candidates can bypass a blocker locally and return to the terminal row. After placing the routes, the router tries cheaper collinear profile changes, including changes on clear sections of a partially blocked straight. Every replacement must pass full path verification, meet the original terminal poses, and fit within the original physical length. With refinement enabled, the router also compares local replacements and can try another net order if coverage is incomplete. Use `--no-constructive` to run the detailed catalog strategy.
|
||||||
|
|
||||||
|
For aligned ports, detailed search can finish once a verified straight with profile changes meets the cost bound. The bound includes the cost of entering and leaving lower-cost profiles. When a profile-restricted fallback finds a route, the router also tries cheaper compatible straights on its existing spans.
|
||||||
|
|
||||||
|
Use `aligned` to isolate long-range profile changes and `constrained` to reproduce the rectangular obstacle grid with a single blocked lane. The `diagonal-savings` case keeps cardinal terminals and gives the octagonal search a shorter two-turn path. The `diagonal` case has a native diagonal terminal pair.
|
||||||
|
|
||||||
|
Use `--guide-pitch 1000` and `--guide-pitch 10000` to compare coarse guidance against explicit routing. The off-coarse case exercises a displaced transition at 1 nm layout precision. On the same case `--auto-pitch 1000` selects 200 nm and verifies the same terminal poses. For a bounded failure control, use `--node-limit 0`. Use `--geometry` to retain the ordered moves and physical polygons with each report.
|
||||||
|
|
||||||
|
The report includes repeated wall times, peak resident memory from the operating system, per-net cost and physical length, and `time_cost_squared`. Compare costs on the intersection of the completed net sets. Catalog reports also include work from discarded search attempts and budgeted retries.
|
||||||
|
|
||||||
|
### Photonic floorplan measurements
|
||||||
|
|
||||||
|
The table gives medians of 15 unseeded runs per setting on an AMD Ryzen 9 5900X with a 1,000-node detailed-search limit. The before and after runs alternated on one core. Routing time includes final verification. All four modes verified all 40 nets, including the six in the shared passage, with both refinement settings.
|
||||||
|
|
||||||
|
| Mode | Median without refinement | Median with refinement | Slowest run across both settings | Catalog cost |
|
||||||
|
| --- | ---: | ---: | ---: | ---: |
|
||||||
|
| Native Manhattan | 0.291 s | 0.289 s | 0.427 s | 8.0379 |
|
||||||
|
| Single-profile catalog Manhattan | 0.188 s | 0.210 s | 0.223 s | 8.0379 |
|
||||||
|
| Typed Manhattan | 0.179 s | 0.191 s | 0.271 s | 6.2756 |
|
||||||
|
| Octagonal | 0.123 s | 0.152 s | 0.162 s | 6.2720 |
|
||||||
|
|
||||||
|
The four-turn candidates resolve the blocked straight without expanding detailed search nodes on this floorplan in the catalog modes. Constructive trials reuse placed moves and check for collisions before measuring port faces.
|
||||||
|
|
||||||
|
The local east-output bypass reduced catalog cost by 1.8% in typed and octagonal modes. One route now uses cheaper straights before and after its bypass. Its neighbor uses the cheaper profile on both sides of the detour and the original profile alongside it. Every net kept its physical length, and the minimum clearances held. With refinement enabled, time × cost² fell by 33% in catalog Manhattan, 32% in typed Manhattan, and 5% in octagonal mode.
|
||||||
|
|
||||||
|
Fresh Python invocations with refinement enabled and `--repeat 1` took 0.98–1.12 s across the four modes. Those times include startup, reference verification, and JSON output.
|
||||||
|
|
||||||
|
### Controlled obstacle-grid measurements
|
||||||
|
|
||||||
|
The following constrained-case runs used an AMD Ryzen 9 5900X and a 1000-node detailed-search limit. Times are medians of three runs. The catalog Manhattan and typed configurations completed all 40 requests. Native Manhattan verified 39 within the same node limit.
|
||||||
|
|
||||||
|
| Configuration | Verified | Time | Catalog cost |
|
||||||
|
| --- | ---: | ---: | ---: |
|
||||||
|
| Native Manhattan, refinement disabled | 39 | 2.00 s | 17.9400 |
|
||||||
|
| Catalog Manhattan, refinement disabled | 40 | 0.25 s | 18.4426 |
|
||||||
|
| Typed Manhattan, refinement disabled | 40 | 1.29 s | 10.2136 |
|
||||||
|
| Typed Manhattan, refinement enabled | 40 | 0.99 s | 10.0140 |
|
||||||
|
| Octagonal, refinement disabled | 40 | 1.20 s | 10.2136 |
|
||||||
|
| Octagonal, refinement enabled | 40 | 1.52 s | 10.2136 |
|
||||||
|
|
||||||
|
On the 39 routes verified by native Manhattan, the unrefined typed and octagonal runs each cost 9.711. Deferring geometry until a proposal reaches the front of the queue, caching straight-span projections, and indexing the obstacles in final verification reduced the unrefined octagonal median from 6.40 s at `7616b39` to 1.20 s and the number of exact geometry checks in search from 19,123 to 2,483. All 40 routes kept their verified net IDs, physical lengths, and costs.
|
||||||
|
|
||||||
|
In nine interleaved runs of the current detailed strategy, the `aligned` typed case went from 139 to 65 ms with the same cost. On `constrained`, upgrading the fallback route's straight reduced that route's cost from 0.50260 to 0.30295. All 40 routes verified. Without refinement, time × cost² fell by 13% in typed Manhattan and 11% in octagonal mode. With refinement, the score fell by 6% and 32%, respectively.
|
||||||
|
|
||||||
|
The 40-net diagonal-savings case took 0.77 s in octagonal mode with refinement disabled. The planted route used 481.982 µm at a cost of 0.06663, compared with the cardinal reference's 591.416 µm and 0.076. The 40-net case with a native diagonal terminal pair took 0.24 s under the same settings.
|
||||||
|
|
||||||
|
At `7616b39`, typed Manhattan without refinement took 2.47 s with 1 µm guidance and 2.02 s with 10 µm guidance. At each pitch, 39 fine routes verified inside their first corridor and one completed after the explicit retry.
|
||||||
|
|
||||||
|
The `corpus-open-lanes` and `corpus-lanes` cases reuse twelve lanes from the existing scale banks. The open lanes all switched profiles and reduced the total catalog cost from 0.648 to 0.552. With the corpus keepouts present, all twelve routed and the total stayed at 0.648 because the wider guide would violate clearance.
|
||||||
|
|
||||||
|
The constrained run with a zero-node budget verified and completed zero routes and reported `node_limit` for all 40. On the constrained board, native Manhattan used 116 MiB peak resident memory, unrefined octagonal used 102 MiB, and refined typed Manhattan used 91 MiB.
|
||||||
|
|
||||||
|
## Delay and independent-net retry
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case tuning --no-refinement
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case retry --no-refinement
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case retry --no-refinement --no-independent-retry
|
||||||
|
```
|
||||||
|
|
||||||
|
The tuning case measures a four-turn detour inside a caller-supplied window. The retry case shows whether the released reservation lets an independent net complete. Compare the verified and completed sets, group skew, straight spans intersecting active tuning windows, checked replacements, and time spent tuning or retrying.
|
||||||
|
|
||||||
|
For constant timing models, a verified choice can eliminate a later candidate at the exact same adjusted delay when it also costs the same or less. In seven interleaved octagonal runs without refinement, this reduced the tuning median from 2.26 s to 1.02 s. Both runs considered 1,334 proposals and selected identical routes at zero residual skew and the same catalog cost. Verified replacements fell from 524 to 136. The released-reservation case completed one independent route with retry and zero with retry disabled.
|
||||||
|
|
||||||
|
## Routing cost holdouts
|
||||||
|
|
||||||
|
```sh
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case peer-cost-holdout --mode typed --repeat 30
|
||||||
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case matched-cost-holdout --mode typed --repeat 30
|
||||||
|
```
|
||||||
|
|
||||||
|
Both cases put a bypass beside a straight lane where the two routes compete for clearance. The matched case adds a reference lane. Each includes two authored reference layouts, which are verified before routing is timed. The benchmark starts from the ports and keepouts and reports the reference costs alongside its own result. The references for the matched case must both satisfy the zero-skew constraint.
|
||||||
|
|
||||||
|
In 30 interleaved runs per mode against `1359463`, the router completed every net on both holdouts. The matched result kept zero skew.
|
||||||
|
|
||||||
|
| Case | Prior cost | New cost | Cheaper reference | Change in time × cost² |
|
||||||
|
| --- | ---: | ---: | ---: | ---: |
|
||||||
|
| Competing profiles | 0.9560 | 0.5477 | 0.5480 | −34% in both modes |
|
||||||
|
| Matched competing profiles | 1.4160 | 0.7967 | 0.7970 | −23% typed, −24% octagonal |
|
||||||
|
|
||||||
|
After a complete layout verifies, catalog refinement can try a cheaper straight profile that displaces one independent peer. It ranks straight spans by potential savings, checks at most four spans, and can reroute at most two peers in separate trials. It accepts a trial only if it lowers the joint cost, verifies the entire layout, and keeps any affected match group within tolerance.
|
||||||
|
|
||||||
|
Native automatic routing with explicit length weights ranks windows containing S-bends by the difference between their verified cost and a geometric lower bound. It budgets up to one eighth of the preceding search expansions for this pass and caps it at 12 windows. It accepts only cheaper, verified splices into the incumbent.
|
||||||
|
|
||||||
|
In five interleaved native runs, the six-net splitter dropped from 39,963.88 to 36,661.15 in weighted cost and improved its time × cost² score by 15%. The single-net north-launch case kept its route and took about 5% longer.
|
||||||
|
|
||||||
|
## Catalog acceptance checks
|
||||||
|
|
||||||
|
Run the catalog fixtures with Masque 4.0a3 importable to include layout placement and terminal checks.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python -m pytest -q inire/tests/test_catalog_*.py
|
||||||
|
```
|
||||||
|
|
||||||
|
- The [device set](../inire/tests/catalog_device_set.py) records the three profiles, authored transitions, generated bend settings, and fixed delays. [Device checks](../inire/tests/test_catalog_device_set.py)
|
||||||
|
- The [move and placement checks](../inire/tests/test_catalog_moves.py) cover exact lattice membership, grid-compatible leads, profile transitions, attachments, replay, physical placement, and partial placement.
|
||||||
|
- The [small search oracles](../inire/tests/test_catalog_search_oracle.py) enumerate complete histories and compare them with production proposal and pruning rules.
|
||||||
|
- The [timing checks](../inire/tests/test_catalog_timing_cases.py) cover direction-aware and wavelength-aware delay, matching budgets, window containment, and final verification of the chosen layout.
|
||||||
113
docs/complex-routing-example-1.md
Normal file
|
|
@ -0,0 +1,113 @@
|
||||||
|
# Complex-routing example 1
|
||||||
|
|
||||||
|
Follow the outer return, `net_08`, from the input ports to its final eastbound arrival. Run from the repository root.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python examples/advanced_layouts.py \
|
||||||
|
--case complex-routing-example-1 \
|
||||||
|
--output-dir /tmp/inire-complex-routing-example-1
|
||||||
|
```
|
||||||
|
|
||||||
|
Origin. [Board 1 from Terminal-Bench pull request 345](https://raw.githubusercontent.com/harbor-framework/terminal-bench/249d125b59c0a5352d9e132195cfead6d81446be/tasks/photonic-waveguide-routing/environment/layout_spec.json).
|
||||||
|
|
||||||
|
## 1. Load the board and set the routing target
|
||||||
|
|
||||||
|
The 2,500 by 1,000 board has seven keepouts and nine nets. Width is 2, clearance is 6, and both bend radii are 50. All ports require eastbound travel. Automatic starts with a target of nine verified nets after checking port conflicts and track capacity.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Open circles mark sources and filled squares mark targets. The inset shows 24 tracks fitting through the purple cut after allowing for width and clearance.
|
||||||
|
|
||||||
|
## 2. Assign lanes and compile path seeds
|
||||||
|
|
||||||
|
The bundle planner groups nets by their passages and spaces the lanes at a pitch of 9. The first `net_08` plan takes the bottom lane at `y = 1`, rises on the right, and approaches its target heading west.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The dots mark waypoints. In the lower inset, only `net_08` and `net_00` fit below the tower. The planner compiles straight runs, right-angle corners, and diagonals into straight, quarter-turn, and S-bend seeds.
|
||||||
|
|
||||||
|
## 3. Fit the required eastbound arrival
|
||||||
|
|
||||||
|
The turnaround planner shifts the upper shelf route `net_07` and brings `net_08` beneath it. The return rises west of its target and takes a final right turn. The planner recompiles both changed seeds.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Compare the heading arrows above the red target squares.
|
||||||
|
|
||||||
|
## 4. Verify the seeds and refine the layout
|
||||||
|
|
||||||
|
A worker in mode `off` replays the `bundle-turnaround` seeds with a zero-node budget. It checks the resulting polygons against the board, keepouts, and other routes. All nine verify, so automatic skips search.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The upper panel shows the first four paths in installation order. The lower panel shows all nine checked together.
|
||||||
|
|
||||||
|
Automatic replays the seeds again with refinement enabled. The refiner replaces sections of `net_05` and `net_07`, preserving all nine verified nets and lowering the configured objective.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Compare the solid and dashed approaches of `net_07` near the top edge.
|
||||||
|
|
||||||
|
## 5. Inspect the result
|
||||||
|
|
||||||
|
Inspect `run.automatic.stages` and `run.automatic.selected_stage` after routing the fixed-heading board under the public defaults. Both stages report zero A* expansions.
|
||||||
|
|
||||||
|
| Stage | Planner | Operation | Verified nets |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 0 | `bundle-turnaround` | Verify the compiled seeds | 9 |
|
||||||
|
| 1, selected | `bundle-turnaround` | Refine and verify the layout | 9 |
|
||||||
|
|
||||||
|
The point-terminal variant accepts a westbound arrival for `net_08`, so the original bundle needs no turnaround. Rerun the gallery command with `--case complex-routing-example-1-point-terminals` to see the result.
|
||||||
|
|
||||||
|
- [Example gallery](../examples/advanced.md#complex-routing-example-1)
|
||||||
|
|
||||||
|
## Compare all routing modes
|
||||||
|
|
||||||
|
Each run uses 100 nodes per search and one congestion iteration, with warm start and refinement disabled. Set `infer_terminal_headings=True` for `bundle` so `net_08` can arrive westbound. Fixed eastbound headings raise a mismatch in that mode.
|
||||||
|
|
||||||
|
| Mode | Result |
|
||||||
|
| --- | --- |
|
||||||
|
| `automatic` | 9/9 verified. The turnaround plan completes the layout without building a mesh. |
|
||||||
|
| `off` | 0/9 verified at this budget. The worker runs lattice search directly. |
|
||||||
|
| `guide` | 1/9 verified. The worker builds a mesh and suggests corridors to lattice search. |
|
||||||
|
| `seed` | 1/9 verified. The worker builds a mesh and searches for starting paths inside the corridors before its routing iteration. |
|
||||||
|
| `bundle` | 9/9 verified. The worker builds and verifies ordered tracks directly from the board geometry. |
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### Triangulation support
|
||||||
|
|
||||||
|
Inire requires Shapely 2.1 or newer with GEOS 3.10 or newer. Check the versions in the environment that runs Inire.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python -c 'import shapely; print(shapely.__version__, shapely.geos_version_string)'
|
||||||
|
```
|
||||||
|
|
||||||
|
Automatic builds a mesh when it reaches corridor search. Here the turnaround plan finishes first. Guide and seed also replay supplied paths without a mesh at `node_limit=0`.
|
||||||
|
|
||||||
|
- [Shapely installation](https://shapely.readthedocs.io/en/2.1.2/installation.html)
|
||||||
|
- [Constrained triangulation API](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html)
|
||||||
|
|
||||||
|
## Compare a guide-mode search
|
||||||
|
|
||||||
|
To see the corridor model on the same board, run `net_08` on its own in guide mode.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Left, the mesh, green corridor cells, and dashed guide. Right, purple expanded positions and the red partial path at the 12-node limit.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
python -m scripts.render_documentation_figures --output-dir /tmp/inire-complex-routing-example-1
|
||||||
|
```
|
||||||
|
|
||||||
|
- [Corridor planning](topological-routing.md#corridor-planning-and-realization)
|
||||||
|
|
||||||
|
## Implementation
|
||||||
|
|
||||||
|
| Stage | Inputs and code |
|
||||||
|
| --- | --- |
|
||||||
|
| Board and routing target | [Board inputs](../examples/advanced-layouts.json), [problem builder](../examples/advanced_layouts.py#L37), [capacity calculation](../inire/router/_capacity.py#L29) |
|
||||||
|
| Lanes and seeds | [Lane assignment](../inire/router/_bundle.py#L114), [waypoint compiler](../inire/router/_waypoints.py#L33) |
|
||||||
|
| Eastbound arrival | [Turnaround candidates](../inire/router/_perimeter.py#L103) |
|
||||||
|
| Verification and refinement | [Seeded worker](../inire/router/_automatic.py#L173), [physical verification](../inire/geometry/collision.py#L687), [refinement handoff](../inire/router/_automatic.py#L610) |
|
||||||
|
| Figures and mode comparison | [Figure generator](../scripts/render_documentation_figures.py) |
|
||||||
30
docs/development.md
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
# Developer guide
|
||||||
|
|
||||||
|
<a id="choose-a-task"></a>
|
||||||
|
|
||||||
|
## Links
|
||||||
|
|
||||||
|
- [Complex-routing walkthrough](complex-routing-example-1.md)
|
||||||
|
- [Router architecture](architecture.md)
|
||||||
|
- [Topological routing](topological-routing.md)
|
||||||
|
- [Routing diagnostics](routing-diagnostics.md)
|
||||||
|
- [Benchmarks](benchmarks.md)
|
||||||
|
- [Benchmark fixtures](benchmark-fixtures.md)
|
||||||
|
- [Public API](user/api-reference.md)
|
||||||
|
|
||||||
|
## Check a change
|
||||||
|
|
||||||
|
1. From the repository root, run `uv sync` to install development dependencies. Activate `.venv` or prefix commands with `uv run`.
|
||||||
|
2. Run `python -m pytest` for the correctness suite and `ruff check inire scripts` for lint. Use `python -m pytest -m "not routing_corpus"` for a shorter local check.
|
||||||
|
3. For a cleanup that should preserve paths, use the same fixtures and options in both revisions. Compare the relevant [route results and traces](routing-diagnostics.md#reproduce-and-compare).
|
||||||
|
4. For a policy or budget change, start with a case that exhibits the behavior. Compare verified IDs, cost, and work under the same [benchmark profile](benchmarks.md#choose-a-profile). Check the corpus and related holdouts before adopting the change.
|
||||||
|
|
||||||
|
Build release archives with `uv build`. The wheel contains the runtime. The source archive also includes tests and fixtures. Smoke-test the wheel outside the checkout on Python 3.11 with Shapely 2.1.0 and GEOS 3.10 or newer, once with NumPy 1.26 and once with NumPy 2.x.
|
||||||
|
|
||||||
|
### Regenerate documentation figures
|
||||||
|
|
||||||
|
Run `python -m scripts.render_documentation_figures` to regenerate the guides, the complex-routing walkthrough, and the advanced example gallery in `docs/figures`. Pass `--output-dir /tmp/inire-figures` to preview them in a separate directory.
|
||||||
|
|
||||||
|
The gallery and walkthrough use the checked-in [layout data](../examples/advanced-layouts.json). The [numbered examples](../examples/README.md) save their own plots in `examples/`.
|
||||||
|
|
||||||
|
When editing a guide, state which inputs or earlier example a reader needs to follow a linked section. Run affected examples, check the links and figures, and preserve existing heading anchors.
|
||||||
BIN
docs/figures/automatic-stages.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
docs/figures/complex-routing-example-1-guide.png
Normal file
|
After Width: | Height: | Size: 148 KiB |
BIN
docs/figures/complex-routing-example-1-input.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
docs/figures/complex-routing-example-1-lanes.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
docs/figures/complex-routing-example-1-modes.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
docs/figures/complex-routing-example-1-refinement.png
Normal file
|
After Width: | Height: | Size: 43 KiB |
BIN
docs/figures/complex-routing-example-1-turnaround.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
docs/figures/complex-routing-example-1-verification.png
Normal file
|
After Width: | Height: | Size: 73 KiB |
BIN
docs/figures/corridor-realization.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
|
After Width: | Height: | Size: 70 KiB |
BIN
docs/figures/example-complex-routing-example-1.png
Normal file
|
After Width: | Height: | Size: 76 KiB |