Compare commits

...
Sign in to create a new pull request.
Author SHA1 Message Date
a05980e8af Retire routing archives and consolidate documentation tooling
Generate the guide, walkthrough, and gallery figures from one command. Keep benchmark fixtures and attribution with the tests and fold the durable findings from completed plans into the guides.
2026-12-02 20:33:19 -08:00
5c4d32cc3e Exercise routing regressions through router entry points
Keep coverage for worker options, locked retries, and route costs independent of the benchmark command-line tools.
2026-12-02 20:33:09 -08:00
63acb94642 Fix routing correctness and bound optional routing work
Check physical keepout clearance, retain useful partial paths, and account for all pair repair searches. Verify complete seeds early and recover narrower corridors when shared guides are blocked.

Keep frontier diagnostics outside routing decisions and bound their work by the worker deadline. Correct benchmark scaling and scenario validation, and update the guides and release metadata.
2026-12-02 17:16:34 -08:00
f6e7bac4c5 Make retry exports optional and report benchmark placement and selection 2026-12-02 00:55:43 -08:00
f247cff54a Validate direct benchmark inputs and preserve fallback headings 2026-12-01 23:05:48 -08:00
495bf8d307 Check reference route clearance against peers and fixed routes 2026-12-01 22:58:45 -08:00
8c8cbe569b Share routing preparation and report benchmark worker options 2026-12-01 22:58:43 -08:00
266aeb6c5e Include placed geometry in routing parity snapshots 2026-12-01 22:48:31 -08:00
72f8fbda5a Fix retry accounting and preserve authored bend lengths in benchmarks 2026-12-01 22:48:28 -08:00
f609e5a695 Simplify residual routing and document seed precedence 2026-12-01 22:39:16 -08:00
b59888265d Fix locked-order coverage and native benchmark scoring 2026-12-01 22:39:12 -08:00
7476209ef3 Require triangulation and simplify automatic routing
Remove the dependency fallback and joint portal lane retry, make tiered search opt-in, and consolidate tests while adding low-length-cost routing boards.
2026-12-01 22:30:29 -08:00
1f098fd4ca Render polygon holes in XY for 3D inputs 2026-12-01 22:30:23 -08:00
5f88e02775 Consolidate routing tests while preserving the benchmark corpus
Reuse benchmark and reference runs, combine related geometry and replay checks, and run example outcome and timing checks from the same cases. Keep every benchmark board and retry holdout independently selectable.
2026-11-30 19:30:10 -08:00
ed52ea6ffd Improve automatic routing retries and reuse component geometry
Try verified perimeter construction early and reuse probe routes as movable hints during lookahead. Batch collision checks and cache component generation for repeated placement and refinement candidates.
2026-11-30 19:29:51 -08:00
9e41c1abf8 Avoid unnecessary search and placement trials in automatic routing 2026-11-30 15:35:45 -08:00
6b699e492b Reuse physical bounds for rectangular board checks 2026-11-30 15:35:42 -08:00
9e97945174 Route the blocking link after packing short links 2026-11-30 15:24:18 -08:00
d64c70c68f Trim verification work and plan independent channels before search 2026-11-30 15:24:14 -08:00
bcd9ade3ea Recover remaining routes with column plans and residual detours 2026-11-30 15:24:10 -08:00
6c6eb37064 Expand the routing benchmark corpus with 72 boards 2026-11-30 15:24:03 -08:00
b6480ded62 Keep tracks straight when a column jog radius cannot fit them 2026-11-30 13:07:21 -08:00
ab14e62dca Try westward return bends directly at the ports 2026-11-30 13:06:14 -08:00
ccfe958cc3 Share the forward detour candidate budget across lanes 2026-11-30 13:05:49 -08:00
0847413ff6 Try inner forward detour lanes when outer lanes leave the board 2026-11-30 13:05:24 -08:00
393c01704a Share the return candidate budget across lanes 2026-11-30 12:42:15 -08:00
2b9d7886fd Try inner lanes for westward perimeter returns 2026-11-30 12:41:44 -08:00
2bc8cead6e Check actual keepouts on residual dogleg bounds hits 2026-11-30 12:41:20 -08:00
31ad878aeb Skip unusable circular radii for residual doglegs 2026-11-30 12:40:44 -08:00
f2b646143f Account for trace clearance in forward perimeter screening 2026-11-30 12:40:24 -08:00
2ffd12da5f Generate ordinary perimeter pairs on demand 2026-11-30 12:15:30 -08:00
4537392641 Choose forward detour lanes from nearby keepouts 2026-11-30 12:13:27 -08:00
c32148c312 Fit forward perimeter detours in tight spans 2026-11-30 12:12:36 -08:00
a15693ac4f Defer peer-reserved perimeter detours until needed 2026-11-30 11:59:45 -08:00
466c68024f Retry residual doglegs with relaxed straight spacing 2026-11-30 11:59:00 -08:00
d94f121ed2 Retry column jogs with relaxed straight spacing 2026-11-30 11:41:46 -08:00
0e923daa9c Allow residual dogleg seeds beyond the lattice scan length 2026-11-30 11:39:36 -08:00
5255b96e6a Retry bundle construction with later common radii 2026-11-30 11:39:17 -08:00
90b30608f6 Allow column jog seeds beyond the lattice scan length 2026-11-30 11:24:56 -08:00
a83b5ed155 Snap return-detour board pivots inward 2026-11-30 11:24:18 -08:00
6c5ee351c8 Choose eligible radii for constructive routing plans 2026-11-30 11:23:55 -08:00
5804ba568f Reuse column profiles across S-bend limit passes 2026-11-30 10:43:23 -08:00
13b2d8b7de Bound implicit exact S-bend offset discovery 2026-11-30 10:42:01 -08:00
653edda512 Skip forward perimeter detours that cannot fit four turns 2026-11-30 10:41:01 -08:00
80f463bf86 Check predecessor table growth in the short-window regression 2026-11-30 10:15:08 -08:00
1f48f60d93 Sweep active rectangles for automatic capacity bounds 2026-11-30 10:14:14 -08:00
e0efd04181 Store predecessor links for column S-bend sequences 2026-11-30 10:12:54 -08:00
253ea1f9c9 Keep lattice scan limits out of local S-bend seeds 2026-11-30 10:12:01 -08:00
5016c0e76a Build only reachable S-bend sequences that fit a window 2026-11-30 09:54:11 -08:00
5c8306c636 Limit exact S-bend span searches by lateral room 2026-11-30 09:52:16 -08:00
3ffe7cfc5d Honor signed offsets when planning column S-bends 2026-11-30 09:51:18 -08:00
06dbfd4093 Rank column S-bend profiles without enumerating full products 2026-11-30 09:29:21 -08:00
f4b16d3c55 Use reachable offset strides in the S-bend sequence table 2026-11-30 09:25:59 -08:00
26b12e33a2 Enforce net clearance when packing route candidates 2026-11-30 09:25:27 -08:00
b541632dde Use snapped S-bend spans in local planning 2026-11-30 09:25:08 -08:00
867aab8fa2 Keep ambiguous S-bend templates local to affected nets 2026-11-29 23:56:47 -08:00
f762b86429 Validate bend geometry options at construction 2026-11-29 23:53:39 -08:00
1723bf338f Prune S-bend sequences that cannot fit the window 2026-11-29 23:53:06 -08:00
ff36f94e8f Bound track assignments in both column planners 2026-11-29 23:52:49 -08:00
f11a5ef932 Centralize developer documentation links 2026-11-29 23:38:18 -08:00
b509efc95d Keep fabrication helpers in tests and simplify documentation links 2026-11-29 23:29:31 -08:00
eac083a37d Refine routing geometry checks and streamline documentation
Report coincident terminals and unusable seeds per net, update custom bend handling and verification, and cover the revised behavior with regression tests.

Shorten the user and developer guides around reader tasks and keep the illustrated routing walkthrough and reference links easy to find.
2026-11-29 23:12:28 -08:00
8b32d68496 Reuse geometry and conflict reports during seed replay
Check a replayed route against itself and fixed geometry before adding it to the collision index. Add cross-net conflicts once the index is populated, then share reports across review, traces, and the callback. Recheck changed geometry after refinement.
2026-11-29 19:13:44 -08:00
fd6f96f341 Name collision-index additions by their inputs
Use add_route for route components and add_path_geometry for prepared polygons. Update the router, tests, and index helpers to use those names.
2026-11-29 19:12:15 -08:00
a6b0b9216a Query exact corner visibility on demand
Cache local queries at indexed corners and preserve exact distance limits. Keep the legacy counters available and report corner-index builds in the performance summary.
2026-11-29 16:37:41 -08:00
725f385ba3 Preserve structured serialization of routing snapshots
Allow dataclass and JSON conversion to traverse seed and result mappings while keeping the public snapshot mutation methods read-only.
2026-11-29 16:37:28 -08:00
8a97c1e64b Check actual terminal faces in search and seed replay
Keep nominal terminal checks for standard geometry. Defer to materialized geometry when a custom outline can reach a terminal and report blocked terminals consistently in iteration callbacks.
2026-11-29 16:37:14 -08:00
23d0a140c1 Use physical clearance for fixed routes and terminal bounds
Use the same physical clearance rule for fixed-route admission and verification. Preserve imported vertices while clearing GEOS precision metadata. Count touching terminal faces as conflicts at zero clearance.
2026-11-29 16:36:54 -08:00
42e1de9884 Keep route placement at the layout writer boundary
Use the effective net, seed, and search settings as the placement recipe. Remove the export-grid, whole-layer, and CPW mask assembly helpers and cover replay from resolved ports.
2026-11-29 16:36:32 -08:00
07f1c47e26 Document and test history-sensitive A* successors 2026-11-29 00:37:13 -08:00
aac0353382 Verify whole-layer exports against current profiles 2026-11-29 00:36:50 -08:00
8e8c8a7ba0 Keep routing and export verification snapshots read-only 2026-11-29 00:31:51 -08:00
9ba1dc048a Reserve search budget for deferred turns 2026-11-29 00:24:00 -08:00
491988d620 Coordinate routing attempts and isolate scheduling effort 2026-11-29 00:18:30 -08:00
c480871f07 Preflight component geometry before tessellation 2026-11-29 00:16:13 -08:00
286caa273b Preserve route identity through reservation and export 2026-11-29 00:12:59 -08:00
cea23ef1b4 Fix fabrication verification and routing diagnostics follow-up 2026-11-29 00:09:54 -08:00
1eed75ff5a Refresh the routing walkthrough and record final verification 2026-11-28 21:01:41 -08:00
8f6a917f51 Preserve routing coverage and verify release and example regressions 2026-11-28 20:57:22 -08:00
e6ae242cb2 Bound search memory and verify process geometry before layout export 2026-11-28 20:42:25 -08:00
facde64f09 Package only runtime code in wheels and set compatible dependency floors 2026-11-28 20:42:25 -08:00
af3ddfbb09 Recover bounded routes around bends and through narrow corridors 2026-11-28 20:29:40 -08:00
d02dbb872f Check physical separation within and between routed nets 2026-11-28 20:16:29 -08:00
9ee786d138 Repair exact visibility and hole rendering and streamline search state 2026-11-28 20:13:00 -08:00
8ad26cc3c1 Use cardinal headings and objective units in search estimates 2026-11-28 20:07:20 -08:00
2611085808 Preserve verify-only diagnostics and honor refinement objectives 2026-11-28 20:06:06 -08:00
f9ba5669dd Validate routing options and match custom S-bend widths consistently 2026-11-28 20:03:41 -08:00
a86e0a4f5a Verify physical bend joins and preserve fine-grid arc accuracy 2026-11-28 20:01:29 -08:00
3d7fc3a705 Support whole custom S-bend outlines and recover routing detours 2026-11-28 10:57:01 -08:00
e0f5543578 Reject invalid path reservations and improve seeded routing 2026-11-28 00:09:11 -08:00
b3580a9c07 Keep partial routes diagnostic and recover width-specific corridors 2026-11-27 22:52:06 -08:00
196cd00445 Fix routing clearance, retries, and S-bend verification 2026-11-27 21:40:53 -08:00
760182f25c Keep constructive routing available without triangulation 2026-11-27 21:14:09 -08:00
c3e420eadb Illustrate the intermediate stages of complex-routing example 1 2026-11-27 19:28:48 -08:00
365c14c59a Fix clearance checks and document the Terminal-Bench routing flow 2026-11-27 19:12:09 -08:00
0c66a1c15a Correct search pruning and align fractional bends to the grid 2026-11-27 18:48:24 -08:00
489c20847a Preserve bend geometry through refinement and validate joins 2026-11-27 15:51:53 -08:00
def1e4ea1d Verify route continuity and simplify automatic search setup 2026-11-27 15:21:37 -08:00
c200d0f7c1 Verify physical route clearance and board containment 2026-11-27 14:12:40 -08:00
0755612723 Reorder routing examples around user workflows 2026-11-27 12:13:04 -08:00
ab97281df3 Clarify routing documentation and refresh example figures 2026-11-27 11:59:22 -08:00
4a91df39da Show stress and Terminal-Bench layouts in the examples gallery 2026-11-27 10:16:12 -08:00
2c7a7ea90a Tie routing documentation to user and developer workflows 2026-11-27 10:15:54 -08:00
2d77877fff Record routing simplification results and prototype decisions 2026-11-27 00:55:47 -08:00
926b2645b5 Reuse residual routing for perimeter recovery 2026-11-27 00:53:58 -08:00
15c2714f1f Sample proximity only for objectives that use it 2026-11-27 00:48:37 -08:00
a4c76f3a68 Skip refinement setup for paths with too few bends 2026-11-27 00:45:28 -08:00
16145714a8 Reuse the verified review of the installed best iteration 2026-11-27 00:42:27 -08:00
0319274163 Keep unrelated paths installed during pair repair 2026-11-27 00:40:44 -08:00
e9ed72d0dc Demonstrate locked routes with two public routing calls 2026-11-27 00:38:00 -08:00
0c059cc7d6 Share worker setup, residual preparation, and scenario capture 2026-11-27 00:38:00 -08:00
591560949c Reuse replay guidance and remove an unused visibility wrapper 2026-11-27 00:34:49 -08:00
d95eab6963 Simplify pair repair targets and avoid redundant index restores 2026-11-27 00:34:49 -08:00
5120ef52e2 Share stable net ordering across routing planners 2026-11-27 00:30:40 -08:00
083f4365b4 Share the layout ranking used during congestion and repair 2026-11-27 00:28:32 -08:00
1cad709c63 Reuse installed geometry for the best final iteration 2026-11-27 00:27:16 -08:00
6608e18ef5 Build traces on demand and share routing fixture setup 2026-11-26 23:00:23 -08:00
a029791f33 Tie documentation links to reader workflows 2026-11-26 22:03:08 -08:00
ec2768853e Simplify routing verification and isolate benchmark policies 2026-11-26 21:55:34 -08:00
2c260e5e95 Document routing between placed crossings and archive development records 2026-11-26 21:37:05 -08:00
e4d5952677 Separate user guides, benchmarks, and routing internals 2026-11-26 21:14:29 -08:00
24559bb6aa Make routing documentation task-oriented 2026-11-26 20:44:18 -08:00
2b02c6eae9 Rewrite routing documentation for users and developers 2026-11-26 20:25:20 -08:00
8fdb42122e Preserve probe budgets for alternate bend proxies 2026-11-26 20:21:22 -08:00
07a2c0e167 Remove hooks for archived early incumbent experiments 2026-11-26 20:17:53 -08:00
64e103b59e Cap the automatic near-port probe at two iterations 2026-11-26 19:59:00 -08:00
ea5cfe7f31 Refactor routing internals and archive retry benchmarks 2026-11-26 19:58:46 -08:00
a8720ac8c9 Try verified column jogs before the near-port search 2026-11-26 15:26:34 -08:00
8af08a537e Prefer bend-ended windows in default path refinement 2026-11-26 15:25:21 -08:00
a2dfb73c33 Complete feasible stress layouts with verified routing fallbacks 2026-11-26 15:23:24 -08:00
d9f0e78330 Score refinement moves before materializing geometry 2026-11-26 15:23:19 -08:00
9ddef652e1 Record alternate routing strategy experiments 2026-11-26 12:10:41 -08:00
2f2add98ec Add and measure a 57-board routing benchmark corpus 2026-11-26 11:57:49 -08:00
be3222e5ae Select and verify topological and constructive routing plans 2026-11-26 11:57:43 -08:00
d741456d6b Verify static clearance at mitred component corners 2026-11-26 11:57:35 -08:00
66934cfdc3 use agg for rendering by default 2026-11-25 17:29:35 -08:00
78da3f4f12 update example README 2026-04-06 16:53:58 -07:00
e20afdaed5 add missing images 2026-04-06 16:42:40 -07:00
316eda090d doc update 2026-04-02 22:30:22 -07:00
7e0d96f987 Refactor router late-phase control flow 2026-04-02 20:17:03 -07:00
46e7e13059 Optimize late no-warm reroutes 2026-04-02 18:57:34 -07:00
2c3aa90544 Limit late reroutes to conflicting nets 2026-04-02 17:10:00 -07:00
3b7568d6c9 Add iteration trace diagnostics for seed43 2026-04-02 16:15:02 -07:00
2049353ee9 more performance characterization work 2026-04-02 15:58:03 -07:00
42e46c67e0 Add conflict tracing and pair-local repair 2026-04-02 14:39:39 -07:00
71e263c527 various performance work (wip) 2026-04-01 21:29:23 -07:00
e77fd6e69f more perf counters 2026-03-31 17:41:15 -07:00
725980e694 update docs and perf metrics 2026-03-31 17:26:00 -07:00
1849075b11 linter fixes 2026-03-30 23:54:30 -07:00
e2c91076f7 example fixes and improvements 2026-03-30 23:40:29 -07:00
e11132b51d fix examples 2026-03-30 21:22:20 -07:00
bc218a416b lots more refactoring 2026-03-30 19:51:37 -07:00
941d3e01df rework structure of everything 2026-03-30 15:32:29 -07:00
dcc4d6436c refactor 2026-03-29 20:35:58 -07:00
0c432bd229 more fixes and refactoring 2026-03-29 18:27:03 -07:00
f2b2bf22f9 Add refinement by default 2026-03-29 15:46:37 -07:00
6a28dcf312 improve visibility checker and add refiner 2026-03-29 15:03:15 -07:00
a8c876ae69 add examples performance regression test 2026-03-29 12:50:22 -07:00
4c2d5051cd trim down 2026-03-29 01:26:22 -07:00
457451d3b2 fixup! clean up magic numbers, enable arbitrary gridding, add cache invalidatino 2026-03-27 23:29:36 -07:00
519dd48131 clean up magic numbers, enable arbitrary gridding, add cache invalidatino 2026-03-26 20:22:17 -07:00
a77ae781a7 Refactor: Remove AStarRouter, introduce AStarContext/AStarMetrics 2026-03-21 22:58:20 -07:00
62d357c147 astar refactor 2026-03-21 12:57:55 -07:00
148aca45d4 update defaults for speed 2026-03-21 12:05:06 -07:00
7455917b4a fix custom poly transform 2026-03-21 01:30:51 -07:00
bc4184693d tune examples for faster completion 2026-03-21 01:19:09 -07:00
de7254f8f5 make sure to check self-intersections 2026-03-21 00:59:29 -07:00
d2d619fe1f include failed nets in congestion map 2026-03-20 18:35:25 -07:00
f505694523 warm start and some perf 2026-03-20 16:59:36 -07:00
7e6be50a86 some perf improvements 2026-03-19 21:07:27 -07:00
c989ab6b9f performance optimizations 2026-03-19 15:03:29 -07:00
22ec194560 parametrized s-bend 2026-03-18 23:30:15 -07:00
b1feaa89f8 tweak ex7 tunavles for 6 iter convergence 2026-03-18 21:39:08 -07:00
6ec953b76e improve heuristic 2026-03-18 20:45:16 -07:00
51d8ddca51 back to working after bend-aware straights 2026-03-18 12:10:14 -07:00
064aed31a6 fix straight endpoint collisions 2026-03-18 00:06:41 -07:00
jan
6827283886 leave space for bends 2026-03-16 21:33:48 -07:00
8833240755 ex07 works 2026-03-16 17:05:16 -07:00
d438c5b7c7 Fix core geometry snapping, A* target lookahead, and test configurations 2026-03-15 21:14:42 -07:00
24ca402f67 first sparse steps 2026-03-13 20:13:05 -07:00
3810e64a5c performance bottleneck 2026-03-12 23:50:25 -07:00
jan
c6116f88f3 misc improvements? 2026-03-11 23:40:09 -07:00
jan
91256cbcf9 go to a tunable 5um grid 2026-03-11 09:37:54 -07:00
jan
7b0dddfe45 examples work 2026-03-10 21:55:54 -07:00
jan
9fac436c50 tiered bbox 2026-03-10 00:21:19 -07:00
c36bce9978 further performance improvements 2026-03-09 22:16:34 -07:00
8bf0ff279f speedup 2026-03-09 20:37:03 -07:00
8424171946 performance improvements 2026-03-09 12:23:17 -07:00
8eb0dbf64a style 2026-03-09 03:19:01 -07:00
c9bb8d6469 consistency and speed 2026-03-09 02:26:27 -07:00
58873692d6 more bend work; bounds constrain edges 2026-03-09 01:48:18 -07:00
4714bed9a8 misc doc updates 2026-03-08 23:34:18 -07:00
jan
ba76589ffb improve exmples 2026-03-08 23:03:07 -07:00
4cbd15bc0d add various direction examples 2026-03-08 22:57:42 -07:00
556241bae3 more bend-related work 2026-03-08 22:18:33 -07:00
43a9a6cb3a Improve visualizations 2026-03-08 22:13:10 -07:00
jan
41a2d9f058 more s-bend fixes and add docs 2026-03-08 22:02:07 -07:00
18b2f83a7b add s-bend example and surface config 2026-03-08 20:18:53 -07:00
82aaf066e2 initial pass on examples 2026-03-08 14:40:36 -07:00
07d079846b misc cleanup and tuning 2026-03-07 19:31:51 -08:00
f600b52f32 Initial buildout 2026-03-07 08:26:29 -08:00
147 changed files with 25658 additions and 25 deletions

5
.gitignore vendored
View file

@ -8,3 +8,8 @@ wheels/
# Virtual environments # Virtual environments
.venv .venv
.hypothesis
*.png
!/docs/figures/*.png

1
.python-version Normal file
View file

@ -0,0 +1 @@
3.13

47
DOCS.md Normal file
View 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)

View file

@ -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)
```
![A short solid waveguide connects the start at (50, 100) and target at (250, 100). Both port arrows point east.](https://mpxd.net/code/jan/inire/raw/branch/topo/docs/figures/first-route.png)
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
View 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
![Automatic routing sets a target for the number of verified nets and tries several ways to reach it. The router selects and optionally refines its best layout before returning a result for each net.](figures/automatic-stages.png)
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.

View 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)

43
docs/benchmarks.md Normal file
View file

@ -0,0 +1,43 @@
# 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. **Search and time.** Compare expansions and repeated wall times at the same settings. Constructive stages can spend time planning and verifying even with zero expansions. Inspect the [automatic reports](routing-diagnostics.md#automatic-reports) to find which stage performed the work.

View 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.
![The nine input nets surround seven rectangular keepouts. A cut at x = 500 has openings at the bottom, center, and top of the board.](figures/complex-routing-example-1-input.png)
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.
![Colored waypoint lines separate the lower, upper, short, and return routes. A close-up shows net_08 at y = 1 and net_00 at y = 10 beneath the tower.](figures/complex-routing-example-1-lanes.png)
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.
![Two views show the materialized shelf and return paths. In the initial plan net_08 arrives westbound. In the turnaround candidate it passes below the shelf, rises left of the target, and arrives eastbound.](figures/complex-routing-example-1-turnaround.png)
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 physical paths of the first four nets in installation order. The lower panel shows all nine paths after verification.](figures/complex-routing-example-1-verification.png)
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.
![The refined net_07 stays near the top edge longer and descends close to its target. Its earlier approach is dashed, and the outer return remains visible below it.](figures/complex-routing-example-1-refinement.png)
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. |
![Five panels show route outcomes at the same search budget. Automatic and bundle verify all nine nets. Off, guide, and seed leave partial paths.](figures/complex-routing-example-1-modes.png)
### 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.
![A triangle mesh and highlighted cells guide the isolated net toward its target. A zoom near the source shows purple expanded positions and a red partial path ending before the target.](figures/complex-routing-example-1-guide.png)
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
View 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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Some files were not shown because too many files have changed in this diff Show more