diff --git a/DOCS.md b/DOCS.md
index 9e1a724..164c369 100644
--- a/DOCS.md
+++ b/DOCS.md
@@ -2,46 +2,41 @@
# User guide
-If you're new to Inire, start with the [single-net quick start](README.md#route-a-net).
-
-
-
+Get a [first route running](README.md#route-a-net), then use these guides for your own layout.
## Describe a layout
-- [Set units, port headings, and keepouts](docs/user/route-a-layout.md#define-the-inputs) before routing.
-- [Route between placed crossings](docs/user/route-a-layout.md#route-between-placed-crossings) using the cell footprints and local port openings.
-- [Reuse an existing route](docs/user/route-a-layout.md#reuse-an-existing-route) when a later net must avoid it or when search could benefit from a movable seed.
+- [Route a layout](docs/user/route-a-layout.md) covers units, port headings, widths, and keepouts.
+- [Route between placed crossings](docs/user/route-a-layout.md#route-between-placed-crossings) uses the cell footprints, port access, and external connections from your layout.
+- [Reuse an existing route](docs/user/route-a-layout.md#reuse-an-existing-route) explains fixed routes and movable seeds.
+
+## Read the result
+
+- [Interpret the result](docs/user/tune-and-troubleshoot.md#read-the-result) before exporting physical paths.
+- [Diagnose an unfinished net](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short) and decide whether to change the layout or try another search.
-
-
-
-
-## Check and improve a route
+## Choose a routing mode
-- [Check the result](docs/user/tune-and-troubleshoot.md#read-the-result) to see whether each net reached its port and cleared obstacles.
-- [Export verified geometry](docs/user/route-a-layout.md#export-verified-geometry) to use the physical polygons in your layout.
-- [Diagnose an unfinished net](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short) to decide whether to change the layout or spend more search time.
-- [Choose a routing mode](docs/user/tune-and-troubleshoot.md#choose-a-routing-mode) when your layout calls for a specific planner.
-- [Adjust a setting](docs/user/tune-and-troubleshoot.md#choose-the-next-setting) if routes collide, take too long, or use too many bends.
+[Compare routing modes](docs/user/tune-and-troubleshoot.md#choose-a-routing-mode) for automatic selection, lattice search, guide, seed, or ordered bundles.
-
-
-
-
-
-
-
+## Tune a run
+
+[Choose a setting to try](docs/user/tune-and-troubleshoot.md#choose-the-next-setting) when a route is unfinished, too expensive, or slow.
## API reference
-- Look up the call and progress callback in the [`route()` signature](docs/user/api-reference.md#route-a-problem).
-- Find the fields that describe arrival, collisions, and physical geometry in the [result reference](docs/user/api-reference.md#results).
-- Check accepted values and defaults in the [option tables](docs/user/api-reference.md#options-and-defaults).
+[Look up public signatures, result fields, and option defaults](docs/user/api-reference.md).
## Examples
-- See how bends, locks, and congestion affect individual routes in the [basic examples](examples/README.md).
-- Compare the boards, ports, and verified results for multi-net layouts in the [advanced examples](examples/advanced.md).
+[Browse the visual examples](examples/README.md) for locked paths, bend geometry, congestion, and partial results.
+
+## Moved reference sections
+
+- [Fixed routes and path seeds](docs/user/route-a-layout.md#reuse-an-existing-route)
+- [Automatic routing and other modes](docs/user/tune-and-troubleshoot.md#choose-a-routing-mode)
+- [SearchOptions](docs/user/api-reference.md#searchoptions) and [ObjectiveWeights](docs/user/api-reference.md#objectiveweights)
+- [CongestionOptions](docs/user/api-reference.md#congestionoptions) and [RefinementOptions](docs/user/api-reference.md#refinementoptions)
+- [TopologyOptions](docs/user/api-reference.md#topologyoptions) and [DiagnosticsOptions](docs/user/api-reference.md#diagnosticsoptions)
diff --git a/README.md b/README.md
index bd98455..addb7ad 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,13 @@
Use Inire to connect fixed ports on a photonic or RF layout with straight segments, 90-degree bends, and S-bends. Supply the device placement, keepouts, and allowed bend radii. The router checks the finished geometry for clearance and returns partial paths to help you diagnose unfinished nets.
+
+
+[User guide](DOCS.md) · [Developer guide](docs/development.md) · [Benchmarks](docs/benchmarks.md)
+
## Install
-From a checkout with Python 3.11 or newer, run `pip install .`.
+From a checkout with Python 3.11 or newer, run `pip install .`. For development, `uv sync` also installs the test and lint tools.
## Route a net
@@ -33,19 +37,14 @@ else:

-The example prints `200.0` in the layout's coordinate unit. Both ports use heading 0 because the path leaves the source and enters the target travelling east. Use this result to try [exporting the physical path](docs/user/route-a-layout.md#export-verified-geometry).
+The example prints `200.0` in the layout's coordinate unit. Both ports have heading 0 because the path travels east at departure and arrival. The plot shows the area around the first route. [Read the result](docs/user/tune-and-troubleshoot.md#read-the-result)
## Route your own layout
-- For your own ports and keepouts, follow the [layout workflow](docs/user/route-a-layout.md#define-the-inputs).
-- If a path stops short, work through the [partial route checks](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short).
-- To find examples and look up fields as you work, use the [user guide](DOCS.md).
-
-## Develop Inire
-
-- To set up the development environment and find the relevant routing code, use the [developer guide](docs/development.md).
-- To measure routing coverage, cost, or runtime, run the [routing benchmarks](docs/benchmarks.md).
+- [Define your ports and keepouts](docs/user/route-a-layout.md), including access to preplaced crossing cells.
+- [Choose what to try after a partial route](docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short).
+- [Browse visual examples](examples/README.md) of multi-net routing, locked paths, and bend geometry.
## License
-Inire is distributed under the [GNU Affero General Public License v3](LICENSE.md).
+GNU Affero General Public License v3. [License text](LICENSE.md)
diff --git a/archive/routing/README.md b/archive/routing/README.md
index 93bb414..ddfc121 100644
--- a/archive/routing/README.md
+++ b/archive/routing/README.md
@@ -1,29 +1,9 @@
# Routing development archive
-Use these records to recover the rationale for a routing decision or compare a fresh capture with an earlier run.
+Historical plans, run captures, and raw measurements live here. For current workflows, start with the [developer guide](../../docs/development.md) or [benchmarks](../../docs/benchmarks.md).
-## Recover earlier decisions
+- **Plans.** [Original routing goal](routing-policy-goal.md), [routing refactor plan](routing-refactor-plan.md), and [documentation improvement plan](documentation-improvement-plan.md).
+- **Performance records.** [Example baseline](performance.md) and its [JSON](performance_baseline.json), [optimization log](optimization_pass_01_log.md), and [pair-local characterization](pair_local_characterization.md).
+- **Recorded diagnostics.** [Iteration](iteration_trace.md), [conflict](conflict_trace.md), [frontier](frontier_trace.md), and [pre-pair](pre_pair_frontier_trace.md) traces. Each report has a companion JSON file with the raw data.
-- For the original coverage target and retry priorities, read the [routing policy goal](routing-policy-goal.md).
-- For the reason a responsibility lives in a particular module, consult the [routing refactor plan](routing-refactor-plan.md).
-- For the original audience and page split, see the [first documentation reorganization plan](documentation-improvement-plan.md).
-
-## Reproduce probe and retry experiments
-
-- To recover the measured probe and holdout tables from November 26, 2026, run `git show 2b02c6e:docs/topological-routing.md`.
-- For the original retry triggers, budget sweeps, and authored Terminal-Bench lane comparisons, run `git show ea5cfe7:docs/topological-routing.md`. To rerun a retired policy, use that revision's driver in a separate worktree.
-- To see how these experiments inform the current probe and retry policy, read the [measurement summary](../../docs/benchmark-results.md).
-
-## Compare performance or diagnose a trace
-
-| What to recover | Archive record |
-| --- | --- |
-| Example coverage and timings | [Baseline report](performance.md) with a [machine-readable snapshot](performance_baseline.json) for comparisons. |
-| Work measured during the earlier optimization pass | [Optimization log](optimization_pass_01_log.md). |
-| Conditions under which repair succeeds in the fan-out fixture | [Pair-local characterization](pair_local_characterization.md) with [per-case measurements](pair_local_characterization.json). |
-| Work by net and iteration | [Iteration trace](iteration_trace.md). |
-| Overlapping components before and after repair | [Conflict trace](conflict_trace.md). |
-| Sampled prune reasons near remaining overlaps | [Frontier trace](frontier_trace.md). |
-| Reroute order and work immediately before repair | [Pre-pair frontier trace](pre_pair_frontier_trace.md). |
-
-Each trace report has a companion JSON file with the same basename. The baseline comparison tool reads `performance_baseline.json` from this directory by default. Capture tools also write here by default and replace files with the same name. To preserve an earlier record while running a fresh capture, follow the [scratch output commands](../../docs/routing-diagnostics.md#reproduce-and-compare).
+The baseline comparison tool reads `archive/routing/performance_baseline.json` by default. Capture tools write here by default and replace files with the same name. Pass `--output-dir` for a scratch capture. [Capture and comparison commands](../../docs/routing-diagnostics.md#reproduce-and-compare)
diff --git a/archive/routing/conflict_trace.json b/archive/routing/conflict_trace.json
index 93454cc..90fc817 100644
--- a/archive/routing/conflict_trace.json
+++ b/archive/routing/conflict_trace.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-11-26T21:47:32-08:00",
+ "generated_at": "2026-04-02T14:24:39-07:00",
"generator": "scripts/record_conflict_trace.py",
"scenarios": [
{
@@ -119,7 +119,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 6,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -184,7 +183,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 9,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
@@ -244,7 +242,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 8,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -284,7 +281,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 4,
- "out_of_bounds": false,
"self_collision_count": 1,
"static_collision_count": 0,
"total_length": 1621.236812357892
@@ -338,7 +334,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 7,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -382,7 +377,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 5,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -416,7 +410,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 1,
"static_collision_count": 0,
"total_length": 1631.236812357892
@@ -470,7 +463,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 7,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -484,7 +476,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -506,7 +497,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 1,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -580,7 +570,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -629,7 +618,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 6,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
@@ -683,7 +671,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 7,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -732,7 +719,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 6,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
@@ -746,7 +732,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -805,7 +790,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 8,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -854,7 +838,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 6,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
@@ -903,7 +886,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 6,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -962,7 +944,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 8,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -1016,7 +997,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 7,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -1027,7 +1007,6 @@
},
{
"completed_net_ids": [
- "net_03",
"net_04",
"net_05",
"net_08",
@@ -1042,6 +1021,10 @@
"net_00",
"net_02"
],
+ [
+ "net_00",
+ "net_03"
+ ],
[
"net_01",
"net_02"
@@ -1061,7 +1044,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -1070,7 +1052,7 @@
{
"component_conflicts": [
{
- "other_component_index": 1,
+ "other_component_index": 0,
"other_net_id": "net_00",
"self_component_index": 2
},
@@ -1090,7 +1072,7 @@
"self_component_index": 4
},
{
- "other_component_index": 3,
+ "other_component_index": 2,
"other_net_id": "net_00",
"self_component_index": 5
}
@@ -1104,7 +1086,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 5,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -1118,7 +1099,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -1127,7 +1107,7 @@
{
"component_conflicts": [
{
- "other_component_index": 1,
+ "other_component_index": 0,
"other_net_id": "net_00",
"self_component_index": 2
},
@@ -1142,7 +1122,7 @@
"self_component_index": 3
},
{
- "other_component_index": 3,
+ "other_component_index": 2,
"other_net_id": "net_00",
"self_component_index": 5
}
@@ -1156,7 +1136,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 4,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -1170,7 +1149,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -1184,21 +1162,32 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
}
},
{
- "component_conflicts": [],
- "conflicting_net_ids": [],
+ "component_conflicts": [
+ {
+ "other_component_index": 1,
+ "other_net_id": "net_00",
+ "self_component_index": 2
+ },
+ {
+ "other_component_index": 1,
+ "other_net_id": "net_00",
+ "self_component_index": 3
+ }
+ ],
+ "conflicting_net_ids": [
+ "net_00"
+ ],
"net_id": "net_03",
- "outcome": "completed",
+ "outcome": "colliding",
"reached_target": true,
"report": {
- "dynamic_collision_count": 0,
- "out_of_bounds": false,
+ "dynamic_collision_count": 2,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -1230,7 +1219,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
@@ -1257,7 +1245,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 2,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -1268,34 +1255,44 @@
{
"other_component_index": 2,
"other_net_id": "net_01",
- "self_component_index": 1
+ "self_component_index": 0
},
{
"other_component_index": 2,
"other_net_id": "net_02",
+ "self_component_index": 0
+ },
+ {
+ "other_component_index": 2,
+ "other_net_id": "net_03",
"self_component_index": 1
},
{
"other_component_index": 5,
"other_net_id": "net_01",
- "self_component_index": 3
+ "self_component_index": 2
},
{
"other_component_index": 5,
"other_net_id": "net_02",
- "self_component_index": 3
+ "self_component_index": 2
+ },
+ {
+ "other_component_index": 3,
+ "other_net_id": "net_03",
+ "self_component_index": 2
}
],
"conflicting_net_ids": [
"net_01",
- "net_02"
+ "net_02",
+ "net_03"
],
"net_id": "net_00",
"outcome": "colliding",
"reached_target": true,
"report": {
- "dynamic_collision_count": 4,
- "out_of_bounds": false,
+ "dynamic_collision_count": 6,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
@@ -1306,51 +1303,33 @@
},
{
"completed_net_ids": [
+ "net_02",
+ "net_03",
"net_04",
- "net_05"
+ "net_05",
+ "net_08",
+ "net_09"
],
"conflict_edges": [
[
"net_00",
"net_01"
],
- [
- "net_02",
- "net_03"
- ],
[
"net_06",
"net_07"
- ],
- [
- "net_08",
- "net_09"
]
],
"iteration": 3,
"nets": [
{
- "component_conflicts": [
- {
- "other_component_index": 1,
- "other_net_id": "net_03",
- "self_component_index": 1
- },
- {
- "other_component_index": 2,
- "other_net_id": "net_03",
- "self_component_index": 2
- }
- ],
- "conflicting_net_ids": [
- "net_03"
- ],
+ "component_conflicts": [],
+ "conflicting_net_ids": [],
"net_id": "net_02",
- "outcome": "colliding",
+ "outcome": "completed",
"reached_target": true,
"report": {
- "dynamic_collision_count": 2,
- "out_of_bounds": false,
+ "dynamic_collision_count": 0,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -1361,17 +1340,17 @@
{
"other_component_index": 2,
"other_net_id": "net_00",
- "self_component_index": 3
+ "self_component_index": 2
},
{
"other_component_index": 2,
"other_net_id": "net_00",
- "self_component_index": 4
+ "self_component_index": 3
},
{
"other_component_index": 3,
"other_net_id": "net_00",
- "self_component_index": 5
+ "self_component_index": 4
}
],
"conflicting_net_ids": [
@@ -1382,34 +1361,19 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
}
},
{
- "component_conflicts": [
- {
- "other_component_index": 3,
- "other_net_id": "net_08",
- "self_component_index": 3
- },
- {
- "other_component_index": 4,
- "other_net_id": "net_08",
- "self_component_index": 4
- }
- ],
- "conflicting_net_ids": [
- "net_08"
- ],
+ "component_conflicts": [],
+ "conflicting_net_ids": [],
"net_id": "net_09",
- "outcome": "colliding",
+ "outcome": "completed",
"reached_target": true,
"report": {
- "dynamic_collision_count": 2,
- "out_of_bounds": false,
+ "dynamic_collision_count": 0,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
@@ -1418,12 +1382,12 @@
{
"component_conflicts": [
{
- "other_component_index": 3,
+ "other_component_index": 2,
"other_net_id": "net_01",
"self_component_index": 2
},
{
- "other_component_index": 4,
+ "other_component_index": 3,
"other_net_id": "net_01",
"self_component_index": 3
}
@@ -1436,7 +1400,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 2,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
@@ -1463,7 +1426,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 2,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -1477,7 +1439,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -1491,7 +1452,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -1523,71 +1483,32 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
}
},
{
- "component_conflicts": [
- {
- "other_component_index": 1,
- "other_net_id": "net_02",
- "self_component_index": 1
- },
- {
- "other_component_index": 1,
- "other_net_id": "net_02",
- "self_component_index": 2
- },
- {
- "other_component_index": 2,
- "other_net_id": "net_02",
- "self_component_index": 3
- }
- ],
- "conflicting_net_ids": [
- "net_02"
- ],
+ "component_conflicts": [],
+ "conflicting_net_ids": [],
"net_id": "net_03",
- "outcome": "colliding",
+ "outcome": "completed",
"reached_target": true,
"report": {
- "dynamic_collision_count": 3,
- "out_of_bounds": false,
+ "dynamic_collision_count": 0,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
}
},
{
- "component_conflicts": [
- {
- "other_component_index": 3,
- "other_net_id": "net_09",
- "self_component_index": 3
- },
- {
- "other_component_index": 3,
- "other_net_id": "net_09",
- "self_component_index": 4
- },
- {
- "other_component_index": 4,
- "other_net_id": "net_09",
- "self_component_index": 5
- }
- ],
- "conflicting_net_ids": [
- "net_09"
- ],
+ "component_conflicts": [],
+ "conflicting_net_ids": [],
"net_id": "net_08",
- "outcome": "colliding",
+ "outcome": "completed",
"reached_target": true,
"report": {
- "dynamic_collision_count": 3,
- "out_of_bounds": false,
+ "dynamic_collision_count": 0,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -1599,7 +1520,7 @@
{
"completed_net_ids": [
"net_00",
- "net_01",
+ "net_03",
"net_04",
"net_05",
"net_08",
@@ -1607,8 +1528,8 @@
],
"conflict_edges": [
[
- "net_02",
- "net_03"
+ "net_01",
+ "net_02"
],
[
"net_06",
@@ -1625,7 +1546,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
@@ -1657,7 +1577,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
@@ -1671,7 +1590,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
@@ -1685,7 +1603,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -1699,39 +1616,19 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
}
},
{
- "component_conflicts": [
- {
- "other_component_index": 1,
- "other_net_id": "net_02",
- "self_component_index": 1
- },
- {
- "other_component_index": 1,
- "other_net_id": "net_02",
- "self_component_index": 2
- },
- {
- "other_component_index": 2,
- "other_net_id": "net_02",
- "self_component_index": 3
- }
- ],
- "conflicting_net_ids": [
- "net_02"
- ],
+ "component_conflicts": [],
+ "conflicting_net_ids": [],
"net_id": "net_03",
- "outcome": "colliding",
+ "outcome": "completed",
"reached_target": true,
"report": {
- "dynamic_collision_count": 3,
- "out_of_bounds": false,
+ "dynamic_collision_count": 0,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -1758,7 +1655,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 2,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -1767,25 +1663,29 @@
{
"component_conflicts": [
{
- "other_component_index": 1,
- "other_net_id": "net_03",
- "self_component_index": 1
+ "other_component_index": 3,
+ "other_net_id": "net_01",
+ "self_component_index": 2
},
{
- "other_component_index": 2,
- "other_net_id": "net_03",
- "self_component_index": 2
+ "other_component_index": 3,
+ "other_net_id": "net_01",
+ "self_component_index": 3
+ },
+ {
+ "other_component_index": 4,
+ "other_net_id": "net_01",
+ "self_component_index": 4
}
],
"conflicting_net_ids": [
- "net_03"
+ "net_01"
],
"net_id": "net_02",
"outcome": "colliding",
"reached_target": true,
"report": {
- "dynamic_collision_count": 2,
- "out_of_bounds": false,
+ "dynamic_collision_count": 3,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -1799,21 +1699,32 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
}
},
{
- "component_conflicts": [],
- "conflicting_net_ids": [],
+ "component_conflicts": [
+ {
+ "other_component_index": 2,
+ "other_net_id": "net_02",
+ "self_component_index": 3
+ },
+ {
+ "other_component_index": 3,
+ "other_net_id": "net_02",
+ "self_component_index": 4
+ }
+ ],
+ "conflicting_net_ids": [
+ "net_02"
+ ],
"net_id": "net_01",
- "outcome": "completed",
+ "outcome": "colliding",
"reached_target": true,
"report": {
- "dynamic_collision_count": 0,
- "out_of_bounds": false,
+ "dynamic_collision_count": 2,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -1851,7 +1762,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
@@ -1865,7 +1775,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -1879,7 +1788,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -1893,7 +1801,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
@@ -1920,7 +1827,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 2,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -1934,7 +1840,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -1948,7 +1853,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -1975,7 +1879,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 2,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -2007,7 +1910,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
@@ -2039,7 +1941,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -2050,8 +1951,8 @@
},
{
"completed_net_ids": [
- "net_00",
- "net_01",
+ "net_02",
+ "net_03",
"net_04",
"net_05",
"net_08",
@@ -2059,8 +1960,8 @@
],
"conflict_edges": [
[
- "net_02",
- "net_03"
+ "net_00",
+ "net_01"
],
[
"net_06",
@@ -2070,28 +1971,57 @@
"iteration": null,
"nets": [
{
- "component_conflicts": [],
- "conflicting_net_ids": [],
+ "component_conflicts": [
+ {
+ "other_component_index": 2,
+ "other_net_id": "net_01",
+ "self_component_index": 2
+ },
+ {
+ "other_component_index": 3,
+ "other_net_id": "net_01",
+ "self_component_index": 3
+ }
+ ],
+ "conflicting_net_ids": [
+ "net_01"
+ ],
"net_id": "net_00",
- "outcome": "completed",
+ "outcome": "colliding",
"reached_target": true,
"report": {
- "dynamic_collision_count": 0,
- "out_of_bounds": false,
+ "dynamic_collision_count": 2,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
}
},
{
- "component_conflicts": [],
- "conflicting_net_ids": [],
+ "component_conflicts": [
+ {
+ "other_component_index": 2,
+ "other_net_id": "net_00",
+ "self_component_index": 2
+ },
+ {
+ "other_component_index": 2,
+ "other_net_id": "net_00",
+ "self_component_index": 3
+ },
+ {
+ "other_component_index": 3,
+ "other_net_id": "net_00",
+ "self_component_index": 4
+ }
+ ],
+ "conflicting_net_ids": [
+ "net_00"
+ ],
"net_id": "net_01",
- "outcome": "completed",
+ "outcome": "colliding",
"reached_target": true,
"report": {
- "dynamic_collision_count": 0,
- "out_of_bounds": false,
+ "dynamic_collision_count": 3,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -2105,7 +2035,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -2119,34 +2048,19 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
}
},
{
- "component_conflicts": [
- {
- "other_component_index": 1,
- "other_net_id": "net_03",
- "self_component_index": 1
- },
- {
- "other_component_index": 2,
- "other_net_id": "net_03",
- "self_component_index": 2
- }
- ],
- "conflicting_net_ids": [
- "net_03"
- ],
+ "component_conflicts": [],
+ "conflicting_net_ids": [],
"net_id": "net_02",
- "outcome": "colliding",
+ "outcome": "completed",
"reached_target": true,
"report": {
- "dynamic_collision_count": 2,
- "out_of_bounds": false,
+ "dynamic_collision_count": 0,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -2160,7 +2074,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -2174,7 +2087,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -2201,7 +2113,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 2,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -2233,39 +2144,19 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 3,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
}
},
{
- "component_conflicts": [
- {
- "other_component_index": 1,
- "other_net_id": "net_02",
- "self_component_index": 1
- },
- {
- "other_component_index": 1,
- "other_net_id": "net_02",
- "self_component_index": 2
- },
- {
- "other_component_index": 2,
- "other_net_id": "net_02",
- "self_component_index": 3
- }
- ],
- "conflicting_net_ids": [
- "net_02"
- ],
+ "component_conflicts": [],
+ "conflicting_net_ids": [],
"net_id": "net_03",
- "outcome": "colliding",
+ "outcome": "completed",
"reached_target": true,
"report": {
- "dynamic_collision_count": 3,
- "out_of_bounds": false,
+ "dynamic_collision_count": 0,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -2298,7 +2189,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
@@ -2312,7 +2202,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -2326,7 +2215,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -2340,7 +2228,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
@@ -2354,7 +2241,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -2368,7 +2254,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -2382,7 +2267,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -2396,7 +2280,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -2410,7 +2293,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
@@ -2424,7 +2306,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -2435,77 +2316,75 @@
}
],
"metrics": {
- "congestion_cache_hits": 24,
- "congestion_cache_misses": 3411,
- "congestion_candidate_ids": 7213,
- "congestion_candidate_nets": 7410,
- "congestion_candidate_precheck_hits": 1677,
- "congestion_candidate_precheck_misses": 1795,
- "congestion_candidate_precheck_skips": 37,
- "congestion_check_calls": 3411,
- "congestion_exact_pair_checks": 5860,
- "congestion_grid_net_cache_hits": 1676,
- "congestion_grid_net_cache_misses": 3276,
- "congestion_grid_span_cache_hits": 1517,
- "congestion_grid_span_cache_misses": 1637,
+ "congestion_cache_hits": 31,
+ "congestion_cache_misses": 4625,
+ "congestion_candidate_ids": 9924,
+ "congestion_candidate_nets": 9979,
+ "congestion_candidate_precheck_hits": 2562,
+ "congestion_candidate_precheck_misses": 2165,
+ "congestion_candidate_precheck_skips": 71,
+ "congestion_check_calls": 4625,
+ "congestion_exact_pair_checks": 8122,
+ "congestion_grid_net_cache_hits": 2457,
+ "congestion_grid_net_cache_misses": 3942,
+ "congestion_grid_span_cache_hits": 2283,
+ "congestion_grid_span_cache_misses": 1948,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
- "congestion_net_envelope_cache_hits": 1801,
- "congestion_net_envelope_cache_misses": 3433,
- "congestion_presence_cache_hits": 1857,
- "congestion_presence_cache_misses": 2075,
- "congestion_presence_skips": 460,
- "danger_map_cache_hits": 13605,
- "danger_map_cache_misses": 6252,
- "danger_map_lookup_calls": 19857,
- "danger_map_query_calls": 6252,
- "danger_map_total_ns": 184537291,
+ "congestion_net_envelope_cache_hits": 2673,
+ "congestion_net_envelope_cache_misses": 4139,
+ "congestion_presence_cache_hits": 2858,
+ "congestion_presence_cache_misses": 2556,
+ "congestion_presence_skips": 687,
+ "danger_map_cache_hits": 16878,
+ "danger_map_cache_misses": 7425,
+ "danger_map_lookup_calls": 24303,
+ "danger_map_query_calls": 7425,
+ "danger_map_total_ns": 222763960,
"dynamic_grid_rebuilds": 0,
- "dynamic_path_objects_added": 430,
- "dynamic_path_objects_removed": 384,
+ "dynamic_path_objects_added": 471,
+ "dynamic_path_objects_removed": 423,
"dynamic_tree_rebuilds": 0,
- "guidance_bonus_applied": 3275.0,
- "guidance_bonus_applied_bend90": 1075.0,
- "guidance_bonus_applied_sbend": 200.0,
- "guidance_bonus_applied_straight": 2000.0,
- "guidance_match_moves": 131,
- "guidance_match_moves_bend90": 43,
- "guidance_match_moves_sbend": 8,
- "guidance_match_moves_straight": 80,
+ "guidance_bonus_applied": 11000.0,
+ "guidance_bonus_applied_bend90": 3500.0,
+ "guidance_bonus_applied_sbend": 625.0,
+ "guidance_bonus_applied_straight": 6875.0,
+ "guidance_match_moves": 176,
+ "guidance_match_moves_bend90": 56,
+ "guidance_match_moves_sbend": 10,
+ "guidance_match_moves_straight": 110,
"hard_collision_cache_hits": 0,
- "iteration_conflict_edges": 40,
- "iteration_conflicting_nets": 39,
+ "iteration_conflict_edges": 39,
+ "iteration_conflicting_nets": 36,
"iteration_reverified_nets": 60,
"iteration_reverify_calls": 6,
- "late_phase_capped_fallbacks": 2,
- "late_phase_capped_nets": 2,
- "move_cache_abs_hits": 1831,
- "move_cache_abs_misses": 5516,
- "move_cache_rel_hits": 4926,
- "move_cache_rel_misses": 590,
- "moves_added": 6594,
- "moves_generated": 7347,
- "nets_carried_forward": 6,
- "nets_reached_target": 52,
- "nets_routed": 54,
- "nodes_expanded": 1408,
+ "move_cache_abs_hits": 2559,
+ "move_cache_abs_misses": 6494,
+ "move_cache_rel_hits": 5872,
+ "move_cache_rel_misses": 622,
+ "moves_added": 8081,
+ "moves_generated": 9053,
+ "nets_carried_forward": 0,
+ "nets_reached_target": 60,
+ "nets_routed": 60,
+ "nodes_expanded": 1764,
"pair_local_search_accepts": 2,
- "pair_local_search_attempts": 3,
- "pair_local_search_nodes_expanded": 42,
+ "pair_local_search_attempts": 2,
+ "pair_local_search_nodes_expanded": 68,
"pair_local_search_pairs_considered": 2,
"path_cost_calls": 0,
- "pruned_closed_set": 414,
- "pruned_cost": 339,
+ "pruned_closed_set": 439,
+ "pruned_cost": 533,
"pruned_hard_collision": 0,
- "ray_cast_calls": 4577,
- "ray_cast_calls_expand_forward": 1356,
- "ray_cast_calls_expand_snap": 36,
+ "ray_cast_calls": 5477,
+ "ray_cast_calls_expand_forward": 1704,
+ "ray_cast_calls_expand_snap": 46,
"ray_cast_calls_other": 0,
- "ray_cast_calls_straight_static": 3179,
+ "ray_cast_calls_straight_static": 3721,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 6,
- "ray_cast_candidate_bounds": 162,
+ "ray_cast_candidate_bounds": 305,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 10,
"refinement_candidate_side_extents": 0,
@@ -2516,17 +2395,17 @@
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
"route_iterations": 6,
- "score_component_calls": 6958,
- "score_component_total_ns": 208990676,
+ "score_component_calls": 8634,
+ "score_component_total_ns": 252458856,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
- "static_safe_cache_hits": 1778,
+ "static_safe_cache_hits": 2482,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 1638,
- "verify_dynamic_exact_pair_checks": 507,
- "verify_path_report_calls": 152,
- "verify_static_buffer_ops": 699,
+ "verify_dynamic_candidate_nets": 2106,
+ "verify_dynamic_exact_pair_checks": 558,
+ "verify_path_report_calls": 190,
+ "verify_static_buffer_ops": 895,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 1,
@@ -2537,7 +2416,7 @@
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 6,
"visibility_tangent_candidate_ray_tests": 6,
- "visibility_tangent_candidate_scans": 1356,
+ "visibility_tangent_candidate_scans": 1704,
"warm_start_paths_built": 0,
"warm_start_paths_used": 0
},
@@ -2550,7 +2429,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1207.0796326794896
@@ -2561,7 +2439,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1128.0796326794896
@@ -2572,7 +2449,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1049.0796326794896
@@ -2583,7 +2459,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 970.0796326794897
@@ -2594,7 +2469,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 909.9977565924808
@@ -2605,7 +2479,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 914.6410526793834
@@ -2616,7 +2489,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 980.0796326794897
@@ -2627,7 +2499,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1059.0796326794896
@@ -2638,7 +2509,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1138.0796326794896
@@ -2649,7 +2519,6 @@
"reached_target": true,
"report": {
"dynamic_collision_count": 0,
- "out_of_bounds": false,
"self_collision_count": 0,
"static_collision_count": 0,
"total_length": 1217.0796326794896
diff --git a/archive/routing/conflict_trace.md b/archive/routing/conflict_trace.md
index 01d43db..75d3c8b 100644
--- a/archive/routing/conflict_trace.md
+++ b/archive/routing/conflict_trace.md
@@ -1,6 +1,6 @@
# Conflict Trace
-Generated at 2026-11-26T21:47:32-08:00 by `scripts/record_conflict_trace.py`.
+Generated at 2026-04-02T14:24:39-07:00 by `scripts/record_conflict_trace.py`.
## example_07_large_scale_routing_no_warm_start
@@ -10,8 +10,8 @@ Results: 10 valid / 10 reached / 10 total.
| :-- | --: | --: | --: | --: |
| iteration | 0 | 9 | 16 | 1 |
| iteration | 1 | 8 | 12 | 2 |
-| iteration | 2 | 5 | 4 | 5 |
-| iteration | 3 | 8 | 4 | 2 |
+| iteration | 2 | 6 | 5 | 4 |
+| iteration | 3 | 4 | 2 | 6 |
| iteration | 4 | 4 | 2 | 6 |
| iteration | 5 | 4 | 2 | 6 |
| restored_best | | 4 | 2 | 6 |
@@ -21,37 +21,37 @@ Top nets by traced dynamic-collision stages:
- `net_06`: 7
- `net_07`: 7
-- `net_02`: 7
-- `net_03`: 6
-- `net_00`: 4
-- `net_01`: 4
-- `net_08`: 3
-- `net_09`: 3
+- `net_01`: 6
+- `net_00`: 5
+- `net_02`: 5
+- `net_03`: 4
+- `net_08`: 2
+- `net_09`: 2
- `net_05`: 1
Top net pairs by frequency:
- `net_06` <-> `net_07`: 7
-- `net_02` <-> `net_03`: 6
-- `net_00` <-> `net_01`: 4
+- `net_00` <-> `net_01`: 5
+- `net_01` <-> `net_02`: 4
- `net_00` <-> `net_02`: 3
-- `net_01` <-> `net_02`: 3
-- `net_08` <-> `net_09`: 3
-- `net_00` <-> `net_03`: 2
+- `net_00` <-> `net_03`: 3
+- `net_02` <-> `net_03`: 3
- `net_01` <-> `net_03`: 2
- `net_06` <-> `net_08`: 2
- `net_06` <-> `net_09`: 2
+- `net_07` <-> `net_08`: 2
Top component pairs by frequency:
-- `net_06[3]` <-> `net_07[2]`: 6
- `net_06[2]` <-> `net_07[2]`: 6
+- `net_06[3]` <-> `net_07[2]`: 6
- `net_06[1]` <-> `net_07[1]`: 6
-- `net_02[2]` <-> `net_03[3]`: 5
-- `net_02[1]` <-> `net_03[1]`: 5
-- `net_02[2]` <-> `net_03[2]`: 5
- `net_06[2]` <-> `net_07[1]`: 5
-- `net_02[1]` <-> `net_03[2]`: 4
+- `net_00[2]` <-> `net_01[3]`: 4
- `net_01[2]` <-> `net_02[2]`: 3
- `net_01[2]` <-> `net_02[3]`: 3
+- `net_00[2]` <-> `net_01[2]`: 3
+- `net_07[3]` <-> `net_08[2]`: 2
+- `net_02[1]` <-> `net_03[1]`: 2
diff --git a/archive/routing/frontier_trace.json b/archive/routing/frontier_trace.json
index ae89d71..130350c 100644
--- a/archive/routing/frontier_trace.json
+++ b/archive/routing/frontier_trace.json
@@ -1,81 +1,79 @@
{
- "generated_at": "2026-11-26T21:47:35-08:00",
+ "generated_at": "2026-04-02T14:24:39-07:00",
"generator": "scripts/record_frontier_trace.py",
"scenarios": [
{
"frontier_trace": [],
"metrics": {
- "congestion_cache_hits": 24,
- "congestion_cache_misses": 3411,
- "congestion_candidate_ids": 7213,
- "congestion_candidate_nets": 7410,
- "congestion_candidate_precheck_hits": 1677,
- "congestion_candidate_precheck_misses": 1795,
- "congestion_candidate_precheck_skips": 37,
- "congestion_check_calls": 3411,
- "congestion_exact_pair_checks": 5860,
- "congestion_grid_net_cache_hits": 1676,
- "congestion_grid_net_cache_misses": 3276,
- "congestion_grid_span_cache_hits": 1517,
- "congestion_grid_span_cache_misses": 1637,
+ "congestion_cache_hits": 31,
+ "congestion_cache_misses": 4625,
+ "congestion_candidate_ids": 9924,
+ "congestion_candidate_nets": 9979,
+ "congestion_candidate_precheck_hits": 2562,
+ "congestion_candidate_precheck_misses": 2165,
+ "congestion_candidate_precheck_skips": 71,
+ "congestion_check_calls": 4625,
+ "congestion_exact_pair_checks": 8122,
+ "congestion_grid_net_cache_hits": 2457,
+ "congestion_grid_net_cache_misses": 3942,
+ "congestion_grid_span_cache_hits": 2283,
+ "congestion_grid_span_cache_misses": 1948,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
- "congestion_net_envelope_cache_hits": 1801,
- "congestion_net_envelope_cache_misses": 3433,
- "congestion_presence_cache_hits": 1857,
- "congestion_presence_cache_misses": 2075,
- "congestion_presence_skips": 460,
- "danger_map_cache_hits": 13605,
- "danger_map_cache_misses": 6252,
- "danger_map_lookup_calls": 19857,
- "danger_map_query_calls": 6252,
- "danger_map_total_ns": 180793966,
+ "congestion_net_envelope_cache_hits": 2673,
+ "congestion_net_envelope_cache_misses": 4139,
+ "congestion_presence_cache_hits": 2858,
+ "congestion_presence_cache_misses": 2556,
+ "congestion_presence_skips": 687,
+ "danger_map_cache_hits": 16878,
+ "danger_map_cache_misses": 7425,
+ "danger_map_lookup_calls": 24303,
+ "danger_map_query_calls": 7425,
+ "danger_map_total_ns": 212814061,
"dynamic_grid_rebuilds": 0,
- "dynamic_path_objects_added": 430,
- "dynamic_path_objects_removed": 384,
+ "dynamic_path_objects_added": 471,
+ "dynamic_path_objects_removed": 423,
"dynamic_tree_rebuilds": 0,
- "guidance_bonus_applied": 3275.0,
- "guidance_bonus_applied_bend90": 1075.0,
- "guidance_bonus_applied_sbend": 200.0,
- "guidance_bonus_applied_straight": 2000.0,
- "guidance_match_moves": 131,
- "guidance_match_moves_bend90": 43,
- "guidance_match_moves_sbend": 8,
- "guidance_match_moves_straight": 80,
+ "guidance_bonus_applied": 11000.0,
+ "guidance_bonus_applied_bend90": 3500.0,
+ "guidance_bonus_applied_sbend": 625.0,
+ "guidance_bonus_applied_straight": 6875.0,
+ "guidance_match_moves": 176,
+ "guidance_match_moves_bend90": 56,
+ "guidance_match_moves_sbend": 10,
+ "guidance_match_moves_straight": 110,
"hard_collision_cache_hits": 0,
- "iteration_conflict_edges": 40,
- "iteration_conflicting_nets": 39,
+ "iteration_conflict_edges": 39,
+ "iteration_conflicting_nets": 36,
"iteration_reverified_nets": 60,
"iteration_reverify_calls": 6,
- "late_phase_capped_fallbacks": 2,
- "late_phase_capped_nets": 2,
- "move_cache_abs_hits": 1831,
- "move_cache_abs_misses": 5516,
- "move_cache_rel_hits": 4926,
- "move_cache_rel_misses": 590,
- "moves_added": 6594,
- "moves_generated": 7347,
- "nets_carried_forward": 6,
- "nets_reached_target": 52,
- "nets_routed": 54,
- "nodes_expanded": 1408,
+ "move_cache_abs_hits": 2559,
+ "move_cache_abs_misses": 6494,
+ "move_cache_rel_hits": 5872,
+ "move_cache_rel_misses": 622,
+ "moves_added": 8081,
+ "moves_generated": 9053,
+ "nets_carried_forward": 0,
+ "nets_reached_target": 60,
+ "nets_routed": 60,
+ "nodes_expanded": 1764,
"pair_local_search_accepts": 2,
- "pair_local_search_attempts": 3,
- "pair_local_search_nodes_expanded": 42,
+ "pair_local_search_attempts": 2,
+ "pair_local_search_nodes_expanded": 68,
"pair_local_search_pairs_considered": 2,
"path_cost_calls": 0,
- "pruned_closed_set": 414,
- "pruned_cost": 339,
+ "pruned_closed_set": 439,
+ "pruned_cost": 533,
"pruned_hard_collision": 0,
- "ray_cast_calls": 4577,
- "ray_cast_calls_expand_forward": 1356,
- "ray_cast_calls_expand_snap": 36,
+ "ray_cast_calls": 5477,
+ "ray_cast_calls_expand_forward": 1704,
+ "ray_cast_calls_expand_snap": 46,
"ray_cast_calls_other": 0,
- "ray_cast_calls_straight_static": 3179,
+ "ray_cast_calls_straight_static": 3721,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 6,
- "ray_cast_candidate_bounds": 162,
+ "ray_cast_candidate_bounds": 305,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 10,
"refinement_candidate_side_extents": 0,
@@ -86,17 +84,17 @@
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
"route_iterations": 6,
- "score_component_calls": 6958,
- "score_component_total_ns": 205362623,
+ "score_component_calls": 8634,
+ "score_component_total_ns": 241025335,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
- "static_safe_cache_hits": 1778,
+ "static_safe_cache_hits": 2482,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 1638,
- "verify_dynamic_exact_pair_checks": 507,
- "verify_path_report_calls": 152,
- "verify_static_buffer_ops": 699,
+ "verify_dynamic_candidate_nets": 2106,
+ "verify_dynamic_exact_pair_checks": 558,
+ "verify_path_report_calls": 190,
+ "verify_static_buffer_ops": 895,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 1,
@@ -107,7 +105,7 @@
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 6,
"visibility_tangent_candidate_ray_tests": 6,
- "visibility_tangent_candidate_scans": 1356,
+ "visibility_tangent_candidate_scans": 1704,
"warm_start_paths_built": 0,
"warm_start_paths_used": 0
},
diff --git a/archive/routing/frontier_trace.md b/archive/routing/frontier_trace.md
index 42c635b..4351f37 100644
--- a/archive/routing/frontier_trace.md
+++ b/archive/routing/frontier_trace.md
@@ -1,6 +1,6 @@
# Frontier Trace
-Generated at 2026-11-26T21:47:35-08:00 by `scripts/record_frontier_trace.py`.
+Generated at 2026-04-02T14:24:39-07:00 by `scripts/record_frontier_trace.py`.
## example_07_large_scale_routing_no_warm_start
diff --git a/archive/routing/iteration_trace.json b/archive/routing/iteration_trace.json
index 9954a8e..2bebaa6 100644
--- a/archive/routing/iteration_trace.json
+++ b/archive/routing/iteration_trace.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-11-26T21:47:40-08:00",
+ "generated_at": "2026-04-02T18:51:01-07:00",
"generator": "scripts/record_iteration_trace.py",
"scenarios": [
{
@@ -132,29 +132,29 @@
{
"completed_nets": 2,
"conflict_edges": 12,
- "congestion_candidate_ids": 2581,
- "congestion_check_calls": 1074,
- "congestion_exact_pair_checks": 2150,
+ "congestion_candidate_ids": 2378,
+ "congestion_check_calls": 974,
+ "congestion_exact_pair_checks": 1998,
"congestion_penalty": 140.0,
"iteration": 1,
"net_attempts": [
{
- "congestion_check_calls": 27,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_04",
- "nodes_expanded": 4,
+ "nodes_expanded": 3,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 283,
+ "congestion_check_calls": 317,
"guidance_seed_present": true,
"net_id": "net_06",
- "nodes_expanded": 72,
- "pruned_closed_set": 13,
- "pruned_cost": 18,
+ "nodes_expanded": 81,
+ "pruned_closed_set": 14,
+ "pruned_cost": 22,
"pruned_hard_collision": 0,
"reached_target": true
},
@@ -179,11 +179,11 @@
"reached_target": true
},
{
- "congestion_check_calls": 26,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_05",
- "nodes_expanded": 4,
- "pruned_closed_set": 1,
+ "nodes_expanded": 3,
+ "pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
@@ -209,22 +209,22 @@
"reached_target": true
},
{
- "congestion_check_calls": 363,
+ "congestion_check_calls": 372,
"guidance_seed_present": true,
"net_id": "net_03",
- "nodes_expanded": 110,
+ "nodes_expanded": 117,
"pruned_closed_set": 19,
- "pruned_cost": 42,
+ "pruned_cost": 47,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 184,
+ "congestion_check_calls": 54,
"guidance_seed_present": true,
"net_id": "net_07",
- "nodes_expanded": 41,
- "pruned_closed_set": 7,
- "pruned_cost": 8,
+ "nodes_expanded": 11,
+ "pruned_closed_set": 1,
+ "pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
@@ -239,7 +239,7 @@
"reached_target": true
}
],
- "nodes_expanded": 269,
+ "nodes_expanded": 253,
"routed_net_ids": [
"net_04",
"net_06",
@@ -255,56 +255,56 @@
"total_dynamic_collisions": 54
},
{
- "completed_nets": 5,
- "conflict_edges": 4,
- "congestion_candidate_ids": 1868,
- "congestion_check_calls": 980,
- "congestion_exact_pair_checks": 1539,
+ "completed_nets": 4,
+ "conflict_edges": 5,
+ "congestion_candidate_ids": 1928,
+ "congestion_check_calls": 993,
+ "congestion_exact_pair_checks": 1571,
"congestion_penalty": 196.0,
"iteration": 2,
"net_attempts": [
{
- "congestion_check_calls": 26,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_05",
- "nodes_expanded": 4,
- "pruned_closed_set": 1,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 356,
- "guidance_seed_present": true,
- "net_id": "net_02",
- "nodes_expanded": 104,
- "pruned_closed_set": 32,
- "pruned_cost": 36,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 27,
- "guidance_seed_present": true,
- "net_id": "net_04",
- "nodes_expanded": 4,
+ "nodes_expanded": 3,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 236,
+ "congestion_check_calls": 399,
"guidance_seed_present": true,
- "net_id": "net_01",
- "nodes_expanded": 54,
- "pruned_closed_set": 15,
+ "net_id": "net_02",
+ "nodes_expanded": 120,
+ "pruned_closed_set": 31,
+ "pruned_cost": 47,
+ "pruned_hard_collision": 0,
+ "reached_target": true
+ },
+ {
+ "congestion_check_calls": 20,
+ "guidance_seed_present": true,
+ "net_id": "net_04",
+ "nodes_expanded": 3,
+ "pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 69,
+ "congestion_check_calls": 275,
+ "guidance_seed_present": true,
+ "net_id": "net_01",
+ "nodes_expanded": 63,
+ "pruned_closed_set": 15,
+ "pruned_cost": 3,
+ "pruned_hard_collision": 0,
+ "reached_target": true
+ },
+ {
+ "congestion_check_calls": 68,
"guidance_seed_present": true,
"net_id": "net_08",
"nodes_expanded": 16,
@@ -317,7 +317,7 @@
"congestion_check_calls": 59,
"guidance_seed_present": true,
"net_id": "net_09",
- "nodes_expanded": 14,
+ "nodes_expanded": 16,
"pruned_closed_set": 4,
"pruned_cost": 0,
"pruned_hard_collision": 0,
@@ -354,17 +354,17 @@
"reached_target": true
},
{
- "congestion_check_calls": 109,
+ "congestion_check_calls": 54,
"guidance_seed_present": true,
"net_id": "net_00",
- "nodes_expanded": 28,
- "pruned_closed_set": 6,
+ "nodes_expanded": 12,
+ "pruned_closed_set": 2,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
}
],
- "nodes_expanded": 244,
+ "nodes_expanded": 253,
"routed_net_ids": [
"net_05",
"net_02",
@@ -377,39 +377,39 @@
"net_07",
"net_00"
],
- "total_dynamic_collisions": 18
+ "total_dynamic_collisions": 22
},
{
- "completed_nets": 2,
- "conflict_edges": 4,
- "congestion_candidate_ids": 977,
- "congestion_check_calls": 483,
- "congestion_exact_pair_checks": 749,
+ "completed_nets": 6,
+ "conflict_edges": 2,
+ "congestion_candidate_ids": 852,
+ "congestion_check_calls": 437,
+ "congestion_exact_pair_checks": 698,
"congestion_penalty": 274.4,
"iteration": 3,
"net_attempts": [
{
- "congestion_check_calls": 28,
+ "congestion_check_calls": 79,
"guidance_seed_present": true,
"net_id": "net_02",
- "nodes_expanded": 7,
- "pruned_closed_set": 1,
+ "nodes_expanded": 15,
+ "pruned_closed_set": 4,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 104,
+ "congestion_check_calls": 68,
"guidance_seed_present": true,
"net_id": "net_01",
- "nodes_expanded": 17,
- "pruned_closed_set": 6,
+ "nodes_expanded": 20,
+ "pruned_closed_set": 3,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 49,
+ "congestion_check_calls": 34,
"guidance_seed_present": true,
"net_id": "net_09",
"nodes_expanded": 11,
@@ -419,10 +419,10 @@
"reached_target": true
},
{
- "congestion_check_calls": 51,
+ "congestion_check_calls": 73,
"guidance_seed_present": true,
"net_id": "net_00",
- "nodes_expanded": 11,
+ "nodes_expanded": 14,
"pruned_closed_set": 1,
"pruned_cost": 0,
"pruned_hard_collision": 0,
@@ -439,57 +439,57 @@
"reached_target": true
},
{
- "congestion_check_calls": 26,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_05",
- "nodes_expanded": 4,
- "pruned_closed_set": 1,
+ "nodes_expanded": 3,
+ "pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 27,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_04",
- "nodes_expanded": 4,
+ "nodes_expanded": 3,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 37,
+ "congestion_check_calls": 35,
"guidance_seed_present": true,
"net_id": "net_06",
- "nodes_expanded": 9,
+ "nodes_expanded": 8,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 38,
+ "congestion_check_calls": 22,
"guidance_seed_present": true,
"net_id": "net_03",
- "nodes_expanded": 9,
+ "nodes_expanded": 6,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 93,
+ "congestion_check_calls": 56,
"guidance_seed_present": true,
"net_id": "net_08",
- "nodes_expanded": 16,
- "pruned_closed_set": 5,
+ "nodes_expanded": 13,
+ "pruned_closed_set": 4,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
}
],
- "nodes_expanded": 95,
+ "nodes_expanded": 100,
"routed_net_ids": [
"net_02",
"net_01",
@@ -502,77 +502,17 @@
"net_03",
"net_08"
],
- "total_dynamic_collisions": 20
+ "total_dynamic_collisions": 10
},
{
"completed_nets": 6,
"conflict_edges": 2,
- "congestion_candidate_ids": 1370,
- "congestion_check_calls": 703,
- "congestion_exact_pair_checks": 1137,
+ "congestion_candidate_ids": 627,
+ "congestion_check_calls": 332,
+ "congestion_exact_pair_checks": 513,
"congestion_penalty": 384.15999999999997,
"iteration": 4,
"net_attempts": [
- {
- "congestion_check_calls": 26,
- "guidance_seed_present": true,
- "net_id": "net_00",
- "nodes_expanded": 9,
- "pruned_closed_set": 1,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 187,
- "guidance_seed_present": true,
- "net_id": "net_06",
- "nodes_expanded": 50,
- "pruned_closed_set": 8,
- "pruned_cost": 18,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 26,
- "guidance_seed_present": true,
- "net_id": "net_09",
- "nodes_expanded": 9,
- "pruned_closed_set": 1,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 26,
- "guidance_seed_present": true,
- "net_id": "net_05",
- "nodes_expanded": 4,
- "pruned_closed_set": 1,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 46,
- "guidance_seed_present": true,
- "net_id": "net_08",
- "nodes_expanded": 12,
- "pruned_closed_set": 4,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 255,
- "guidance_seed_present": true,
- "net_id": "net_03",
- "nodes_expanded": 80,
- "pruned_closed_set": 10,
- "pruned_cost": 40,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
{
"congestion_check_calls": 30,
"guidance_seed_present": true,
@@ -584,183 +524,118 @@
"reached_target": true
},
{
- "congestion_check_calls": 32,
+ "congestion_check_calls": 179,
"guidance_seed_present": true,
- "net_id": "net_02",
- "nodes_expanded": 8,
+ "net_id": "net_06",
+ "nodes_expanded": 46,
+ "pruned_closed_set": 7,
+ "pruned_cost": 15,
+ "pruned_hard_collision": 0,
+ "reached_target": true
+ },
+ {
+ "congestion_check_calls": 43,
+ "guidance_seed_present": true,
+ "net_id": "net_00",
+ "nodes_expanded": 10,
"pruned_closed_set": 1,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 27,
- "guidance_seed_present": true,
- "net_id": "net_04",
- "nodes_expanded": 5,
- "pruned_closed_set": 0,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 48,
+ "congestion_check_calls": 80,
"guidance_seed_present": true,
"net_id": "net_01",
- "nodes_expanded": 12,
- "pruned_closed_set": 4,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- }
- ],
- "nodes_expanded": 196,
- "routed_net_ids": [
- "net_00",
- "net_06",
- "net_09",
- "net_05",
- "net_08",
- "net_03",
- "net_07",
- "net_02",
- "net_04",
- "net_01"
- ],
- "total_dynamic_collisions": 10
- },
- {
- "completed_nets": 6,
- "conflict_edges": 2,
- "congestion_candidate_ids": 417,
- "congestion_check_calls": 171,
- "congestion_exact_pair_checks": 285,
- "congestion_penalty": 537.824,
- "iteration": 5,
- "net_attempts": [
- {
- "congestion_check_calls": 85,
- "guidance_seed_present": true,
- "net_id": "net_07",
- "nodes_expanded": 16,
+ "nodes_expanded": 18,
"pruned_closed_set": 3,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
- },
- {
- "congestion_check_calls": 86,
- "guidance_seed_present": true,
- "net_id": "net_02",
- "nodes_expanded": 17,
- "pruned_closed_set": 4,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 0,
- "guidance_seed_present": true,
- "net_id": "net_06",
- "nodes_expanded": 0,
- "pruned_closed_set": 0,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
- },
- {
- "congestion_check_calls": 0,
- "guidance_seed_present": true,
- "net_id": "net_03",
- "nodes_expanded": 0,
- "pruned_closed_set": 0,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "reached_target": true
}
],
- "nodes_expanded": 33,
+ "nodes_expanded": 81,
"routed_net_ids": [
"net_07",
- "net_02",
"net_06",
- "net_03"
+ "net_00",
+ "net_01"
],
"total_dynamic_collisions": 10
}
],
"metrics": {
- "congestion_cache_hits": 24,
- "congestion_cache_misses": 3411,
- "congestion_candidate_ids": 7213,
- "congestion_candidate_nets": 7410,
- "congestion_candidate_precheck_hits": 1677,
- "congestion_candidate_precheck_misses": 1795,
- "congestion_candidate_precheck_skips": 37,
- "congestion_check_calls": 3411,
- "congestion_exact_pair_checks": 5860,
- "congestion_grid_net_cache_hits": 1676,
- "congestion_grid_net_cache_misses": 3276,
- "congestion_grid_span_cache_hits": 1517,
- "congestion_grid_span_cache_misses": 1637,
+ "congestion_cache_hits": 31,
+ "congestion_cache_misses": 2736,
+ "congestion_candidate_ids": 5785,
+ "congestion_candidate_nets": 6163,
+ "congestion_candidate_precheck_hits": 1383,
+ "congestion_candidate_precheck_misses": 1418,
+ "congestion_candidate_precheck_skips": 34,
+ "congestion_check_calls": 2736,
+ "congestion_exact_pair_checks": 4780,
+ "congestion_grid_net_cache_hits": 1356,
+ "congestion_grid_net_cache_misses": 2608,
+ "congestion_grid_span_cache_hits": 1247,
+ "congestion_grid_span_cache_misses": 1308,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
- "congestion_net_envelope_cache_hits": 1801,
- "congestion_net_envelope_cache_misses": 3433,
- "congestion_presence_cache_hits": 1857,
- "congestion_presence_cache_misses": 2075,
- "congestion_presence_skips": 460,
- "danger_map_cache_hits": 13605,
- "danger_map_cache_misses": 6252,
- "danger_map_lookup_calls": 19857,
- "danger_map_query_calls": 6252,
- "danger_map_total_ns": 182546071,
+ "congestion_net_envelope_cache_hits": 1452,
+ "congestion_net_envelope_cache_misses": 2720,
+ "congestion_presence_cache_hits": 1541,
+ "congestion_presence_cache_misses": 1642,
+ "congestion_presence_skips": 382,
+ "danger_map_cache_hits": 11547,
+ "danger_map_cache_misses": 6063,
+ "danger_map_lookup_calls": 17610,
+ "danger_map_query_calls": 6063,
+ "danger_map_total_ns": 171226180,
"dynamic_grid_rebuilds": 0,
- "dynamic_path_objects_added": 430,
- "dynamic_path_objects_removed": 384,
+ "dynamic_path_objects_added": 399,
+ "dynamic_path_objects_removed": 351,
"dynamic_tree_rebuilds": 0,
- "guidance_bonus_applied": 3275.0,
- "guidance_bonus_applied_bend90": 1075.0,
- "guidance_bonus_applied_sbend": 200.0,
- "guidance_bonus_applied_straight": 2000.0,
- "guidance_match_moves": 131,
- "guidance_match_moves_bend90": 43,
- "guidance_match_moves_sbend": 8,
- "guidance_match_moves_straight": 80,
+ "guidance_bonus_applied": 6750.0,
+ "guidance_bonus_applied_bend90": 2250.0,
+ "guidance_bonus_applied_sbend": 375.0,
+ "guidance_bonus_applied_straight": 4125.0,
+ "guidance_match_moves": 108,
+ "guidance_match_moves_bend90": 36,
+ "guidance_match_moves_sbend": 6,
+ "guidance_match_moves_straight": 66,
"hard_collision_cache_hits": 0,
- "iteration_conflict_edges": 40,
- "iteration_conflicting_nets": 39,
- "iteration_reverified_nets": 60,
- "iteration_reverify_calls": 6,
- "late_phase_capped_fallbacks": 2,
- "late_phase_capped_nets": 2,
- "move_cache_abs_hits": 1831,
- "move_cache_abs_misses": 5516,
- "move_cache_rel_hits": 4926,
- "move_cache_rel_misses": 590,
- "moves_added": 6594,
- "moves_generated": 7347,
+ "iteration_conflict_edges": 37,
+ "iteration_conflicting_nets": 32,
+ "iteration_reverified_nets": 50,
+ "iteration_reverify_calls": 5,
+ "late_phase_capped_fallbacks": 0,
+ "late_phase_capped_nets": 0,
+ "move_cache_abs_hits": 1200,
+ "move_cache_abs_misses": 5338,
+ "move_cache_rel_hits": 4768,
+ "move_cache_rel_misses": 570,
+ "moves_added": 5853,
+ "moves_generated": 6538,
"nets_carried_forward": 6,
- "nets_reached_target": 52,
- "nets_routed": 54,
- "nodes_expanded": 1408,
+ "nets_reached_target": 44,
+ "nets_routed": 44,
+ "nodes_expanded": 1258,
"pair_local_search_accepts": 2,
- "pair_local_search_attempts": 3,
- "pair_local_search_nodes_expanded": 42,
+ "pair_local_search_attempts": 2,
+ "pair_local_search_nodes_expanded": 68,
"pair_local_search_pairs_considered": 2,
"path_cost_calls": 0,
- "pruned_closed_set": 414,
- "pruned_cost": 339,
+ "pruned_closed_set": 374,
+ "pruned_cost": 311,
"pruned_hard_collision": 0,
- "ray_cast_calls": 4577,
- "ray_cast_calls_expand_forward": 1356,
- "ray_cast_calls_expand_snap": 36,
+ "ray_cast_calls": 4310,
+ "ray_cast_calls_expand_forward": 1214,
+ "ray_cast_calls_expand_snap": 39,
"ray_cast_calls_other": 0,
- "ray_cast_calls_straight_static": 3179,
+ "ray_cast_calls_straight_static": 3051,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 6,
- "ray_cast_candidate_bounds": 162,
+ "ray_cast_candidate_bounds": 159,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 10,
"refinement_candidate_side_extents": 0,
@@ -770,18 +645,18 @@
"refinement_dynamic_bounds_checked": 0,
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
- "route_iterations": 6,
- "score_component_calls": 6958,
- "score_component_total_ns": 206527340,
+ "route_iterations": 5,
+ "score_component_calls": 6181,
+ "score_component_total_ns": 191650546,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
- "static_safe_cache_hits": 1778,
+ "static_safe_cache_hits": 1170,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 1638,
- "verify_dynamic_exact_pair_checks": 507,
- "verify_path_report_calls": 152,
- "verify_static_buffer_ops": 699,
+ "verify_dynamic_candidate_nets": 1822,
+ "verify_dynamic_exact_pair_checks": 504,
+ "verify_path_report_calls": 164,
+ "verify_static_buffer_ops": 779,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 1,
@@ -792,7 +667,7 @@
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 6,
"visibility_tangent_candidate_ray_tests": 6,
- "visibility_tangent_candidate_scans": 1356,
+ "visibility_tangent_candidate_scans": 1214,
"warm_start_paths_built": 0,
"warm_start_paths_used": 0
},
@@ -933,9 +808,9 @@
{
"completed_nets": 1,
"conflict_edges": 13,
- "congestion_candidate_ids": 2807,
- "congestion_check_calls": 1037,
- "congestion_exact_pair_checks": 2205,
+ "congestion_candidate_ids": 2562,
+ "congestion_check_calls": 961,
+ "congestion_exact_pair_checks": 2032,
"congestion_penalty": 140.0,
"iteration": 1,
"net_attempts": [
@@ -980,10 +855,10 @@
"reached_target": true
},
{
- "congestion_check_calls": 27,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_04",
- "nodes_expanded": 4,
+ "nodes_expanded": 3,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
@@ -1000,32 +875,32 @@
"reached_target": true
},
{
- "congestion_check_calls": 363,
+ "congestion_check_calls": 372,
"guidance_seed_present": true,
"net_id": "net_03",
- "nodes_expanded": 110,
+ "nodes_expanded": 117,
"pruned_closed_set": 19,
- "pruned_cost": 42,
+ "pruned_cost": 47,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 29,
+ "congestion_check_calls": 27,
"guidance_seed_present": true,
"net_id": "net_05",
"nodes_expanded": 5,
- "pruned_closed_set": 1,
+ "pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 160,
+ "congestion_check_calls": 84,
"guidance_seed_present": true,
"net_id": "net_02",
- "nodes_expanded": 38,
- "pruned_closed_set": 5,
- "pruned_cost": 8,
+ "nodes_expanded": 20,
+ "pruned_closed_set": 2,
+ "pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
@@ -1040,7 +915,7 @@
"reached_target": true
}
],
- "nodes_expanded": 281,
+ "nodes_expanded": 269,
"routed_net_ids": [
"net_09",
"net_08",
@@ -1058,18 +933,18 @@
{
"completed_nets": 4,
"conflict_edges": 3,
- "congestion_candidate_ids": 1678,
- "congestion_check_calls": 697,
- "congestion_exact_pair_checks": 1289,
+ "congestion_candidate_ids": 1610,
+ "congestion_check_calls": 643,
+ "congestion_exact_pair_checks": 1224,
"congestion_penalty": 196.0,
"iteration": 2,
"net_attempts": [
{
- "congestion_check_calls": 117,
+ "congestion_check_calls": 121,
"guidance_seed_present": true,
"net_id": "net_08",
- "nodes_expanded": 25,
- "pruned_closed_set": 8,
+ "nodes_expanded": 26,
+ "pruned_closed_set": 9,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
@@ -1085,7 +960,7 @@
"reached_target": true
},
{
- "congestion_check_calls": 93,
+ "congestion_check_calls": 92,
"guidance_seed_present": true,
"net_id": "net_01",
"nodes_expanded": 20,
@@ -1095,21 +970,21 @@
"reached_target": true
},
{
- "congestion_check_calls": 170,
+ "congestion_check_calls": 121,
"guidance_seed_present": true,
"net_id": "net_06",
- "nodes_expanded": 48,
- "pruned_closed_set": 2,
- "pruned_cost": 17,
+ "nodes_expanded": 29,
+ "pruned_closed_set": 0,
+ "pruned_cost": 5,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 60,
+ "congestion_check_calls": 58,
"guidance_seed_present": true,
"net_id": "net_02",
"nodes_expanded": 13,
- "pruned_closed_set": 2,
+ "pruned_closed_set": 1,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
@@ -1118,28 +993,28 @@
"congestion_check_calls": 72,
"guidance_seed_present": true,
"net_id": "net_09",
- "nodes_expanded": 13,
+ "nodes_expanded": 15,
"pruned_closed_set": 4,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 43,
+ "congestion_check_calls": 50,
"guidance_seed_present": true,
"net_id": "net_00",
- "nodes_expanded": 12,
+ "nodes_expanded": 13,
"pruned_closed_set": 3,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 26,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_05",
- "nodes_expanded": 4,
- "pruned_closed_set": 1,
+ "nodes_expanded": 3,
+ "pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
@@ -1155,17 +1030,17 @@
"reached_target": true
},
{
- "congestion_check_calls": 27,
+ "congestion_check_calls": 20,
"guidance_seed_present": true,
"net_id": "net_04",
- "nodes_expanded": 4,
+ "nodes_expanded": 3,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
}
],
- "nodes_expanded": 157,
+ "nodes_expanded": 140,
"routed_net_ids": [
"net_08",
"net_07",
@@ -1183,17 +1058,17 @@
{
"completed_nets": 4,
"conflict_edges": 3,
- "congestion_candidate_ids": 610,
- "congestion_check_calls": 277,
- "congestion_exact_pair_checks": 455,
+ "congestion_candidate_ids": 557,
+ "congestion_check_calls": 250,
+ "congestion_exact_pair_checks": 428,
"congestion_penalty": 274.4,
"iteration": 3,
"net_attempts": [
{
- "congestion_check_calls": 38,
+ "congestion_check_calls": 36,
"guidance_seed_present": true,
"net_id": "net_03",
- "nodes_expanded": 9,
+ "nodes_expanded": 8,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
@@ -1230,27 +1105,27 @@
"reached_target": true
},
{
- "congestion_check_calls": 93,
+ "congestion_check_calls": 70,
"guidance_seed_present": true,
"net_id": "net_08",
- "nodes_expanded": 16,
- "pruned_closed_set": 5,
+ "nodes_expanded": 13,
+ "pruned_closed_set": 4,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 37,
+ "congestion_check_calls": 35,
"guidance_seed_present": true,
"net_id": "net_06",
- "nodes_expanded": 9,
+ "nodes_expanded": 8,
"pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"reached_target": true
}
],
- "nodes_expanded": 59,
+ "nodes_expanded": 54,
"routed_net_ids": [
"net_03",
"net_07",
@@ -1264,9 +1139,9 @@
{
"completed_nets": 6,
"conflict_edges": 2,
- "congestion_candidate_ids": 1201,
- "congestion_check_calls": 584,
- "congestion_exact_pair_checks": 958,
+ "congestion_candidate_ids": 1025,
+ "congestion_check_calls": 505,
+ "congestion_exact_pair_checks": 829,
"congestion_penalty": 384.15999999999997,
"iteration": 4,
"net_attempts": [
@@ -1291,22 +1166,22 @@
"reached_target": true
},
{
- "congestion_check_calls": 195,
+ "congestion_check_calls": 179,
"guidance_seed_present": true,
"net_id": "net_06",
- "nodes_expanded": 51,
- "pruned_closed_set": 8,
- "pruned_cost": 18,
+ "nodes_expanded": 46,
+ "pruned_closed_set": 7,
+ "pruned_cost": 15,
"pruned_hard_collision": 0,
"reached_target": true
},
{
- "congestion_check_calls": 255,
+ "congestion_check_calls": 192,
"guidance_seed_present": true,
"net_id": "net_03",
- "nodes_expanded": 80,
- "pruned_closed_set": 10,
- "pruned_cost": 40,
+ "nodes_expanded": 54,
+ "pruned_closed_set": 7,
+ "pruned_cost": 21,
"pruned_hard_collision": 0,
"reached_target": true
},
@@ -1331,7 +1206,7 @@
"reached_target": true
}
],
- "nodes_expanded": 167,
+ "nodes_expanded": 136,
"routed_net_ids": [
"net_07",
"net_02",
@@ -1404,40 +1279,40 @@
],
"metrics": {
"congestion_cache_hits": 8,
- "congestion_cache_misses": 2766,
- "congestion_candidate_ids": 6715,
- "congestion_candidate_nets": 6315,
- "congestion_candidate_precheck_hits": 1342,
- "congestion_candidate_precheck_misses": 1509,
- "congestion_candidate_precheck_skips": 77,
- "congestion_check_calls": 2766,
- "congestion_exact_pair_checks": 5194,
- "congestion_grid_net_cache_hits": 1366,
- "congestion_grid_net_cache_misses": 2753,
- "congestion_grid_span_cache_hits": 1230,
- "congestion_grid_span_cache_misses": 1404,
+ "congestion_cache_misses": 2530,
+ "congestion_candidate_ids": 6173,
+ "congestion_candidate_nets": 5869,
+ "congestion_candidate_precheck_hits": 1152,
+ "congestion_candidate_precheck_misses": 1460,
+ "congestion_candidate_precheck_skips": 74,
+ "congestion_check_calls": 2530,
+ "congestion_exact_pair_checks": 4800,
+ "congestion_grid_net_cache_hits": 1192,
+ "congestion_grid_net_cache_misses": 2676,
+ "congestion_grid_span_cache_hits": 1065,
+ "congestion_grid_span_cache_misses": 1366,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
- "congestion_net_envelope_cache_hits": 1435,
- "congestion_net_envelope_cache_misses": 2856,
- "congestion_presence_cache_hits": 1498,
- "congestion_presence_cache_misses": 1717,
- "congestion_presence_skips": 364,
- "danger_map_cache_hits": 12083,
- "danger_map_cache_misses": 5623,
- "danger_map_lookup_calls": 17706,
- "danger_map_query_calls": 5623,
- "danger_map_total_ns": 154640823,
+ "congestion_net_envelope_cache_hits": 1234,
+ "congestion_net_envelope_cache_misses": 2769,
+ "congestion_presence_cache_hits": 1302,
+ "congestion_presence_cache_misses": 1664,
+ "congestion_presence_skips": 354,
+ "danger_map_cache_hits": 11485,
+ "danger_map_cache_misses": 5474,
+ "danger_map_lookup_calls": 16959,
+ "danger_map_query_calls": 5474,
+ "danger_map_total_ns": 145721703,
"dynamic_grid_rebuilds": 0,
"dynamic_path_objects_added": 397,
"dynamic_path_objects_removed": 350,
"dynamic_tree_rebuilds": 0,
- "guidance_bonus_applied": 3000.0,
- "guidance_bonus_applied_bend90": 1150.0,
- "guidance_bonus_applied_sbend": 100.0,
- "guidance_bonus_applied_straight": 1750.0,
- "guidance_match_moves": 120,
- "guidance_match_moves_bend90": 46,
+ "guidance_bonus_applied": 7562.5,
+ "guidance_bonus_applied_bend90": 2937.5,
+ "guidance_bonus_applied_sbend": 250.0,
+ "guidance_bonus_applied_straight": 4375.0,
+ "guidance_match_moves": 121,
+ "guidance_match_moves_bend90": 47,
"guidance_match_moves_sbend": 4,
"guidance_match_moves_straight": 70,
"hard_collision_cache_hits": 0,
@@ -1447,33 +1322,33 @@
"iteration_reverify_calls": 6,
"late_phase_capped_fallbacks": 2,
"late_phase_capped_nets": 2,
- "move_cache_abs_hits": 1479,
- "move_cache_abs_misses": 5117,
- "move_cache_rel_hits": 4529,
- "move_cache_rel_misses": 588,
- "moves_added": 5884,
- "moves_generated": 6596,
+ "move_cache_abs_hits": 1304,
+ "move_cache_abs_misses": 4997,
+ "move_cache_rel_hits": 4419,
+ "move_cache_rel_misses": 578,
+ "moves_added": 5638,
+ "moves_generated": 6301,
"nets_carried_forward": 14,
"nets_reached_target": 44,
"nets_routed": 46,
- "nodes_expanded": 1268,
+ "nodes_expanded": 1203,
"pair_local_search_accepts": 2,
"pair_local_search_attempts": 3,
- "pair_local_search_nodes_expanded": 42,
+ "pair_local_search_nodes_expanded": 39,
"pair_local_search_pairs_considered": 2,
"path_cost_calls": 0,
- "pruned_closed_set": 366,
- "pruned_cost": 346,
+ "pruned_closed_set": 354,
+ "pruned_cost": 309,
"pruned_hard_collision": 0,
- "ray_cast_calls": 4200,
- "ray_cast_calls_expand_forward": 1224,
+ "ray_cast_calls": 4059,
+ "ray_cast_calls_expand_forward": 1159,
"ray_cast_calls_expand_snap": 13,
"ray_cast_calls_other": 0,
- "ray_cast_calls_straight_static": 2957,
+ "ray_cast_calls_straight_static": 2881,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 6,
- "ray_cast_candidate_bounds": 167,
+ "ray_cast_candidate_bounds": 170,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 10,
"refinement_candidate_side_extents": 0,
@@ -1484,17 +1359,17 @@
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
"route_iterations": 6,
- "score_component_calls": 6248,
- "score_component_total_ns": 176194432,
+ "score_component_calls": 5962,
+ "score_component_total_ns": 164785883,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
- "static_safe_cache_hits": 1444,
+ "static_safe_cache_hits": 1276,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 1543,
- "verify_dynamic_exact_pair_checks": 511,
- "verify_path_report_calls": 144,
- "verify_static_buffer_ops": 666,
+ "verify_dynamic_candidate_nets": 1884,
+ "verify_dynamic_exact_pair_checks": 557,
+ "verify_path_report_calls": 174,
+ "verify_static_buffer_ops": 805,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 1,
@@ -1505,7 +1380,7 @@
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 6,
"visibility_tangent_candidate_ray_tests": 6,
- "visibility_tangent_candidate_scans": 1224,
+ "visibility_tangent_candidate_scans": 1159,
"warm_start_paths_built": 0,
"warm_start_paths_used": 0
},
diff --git a/archive/routing/iteration_trace.md b/archive/routing/iteration_trace.md
index a546383..54e4967 100644
--- a/archive/routing/iteration_trace.md
+++ b/archive/routing/iteration_trace.md
@@ -1,6 +1,6 @@
# Iteration Trace
-Generated at 2026-11-26T21:47:40-08:00 by `scripts/record_iteration_trace.py`.
+Generated at 2026-04-02T18:51:01-07:00 by `scripts/record_iteration_trace.py`.
## example_07_large_scale_routing_no_warm_start
@@ -9,37 +9,36 @@ Results: 10 valid / 10 reached / 10 total.
| Iteration | Penalty | Routed Nets | Completed | Conflict Edges | Dynamic Collisions | Nodes | Congestion Checks | Candidate Ids | Exact Pairs |
| --: | --: | --: | --: | --: | --: | --: | --: | --: | --: |
| 0 | 100.0 | 10 | 1 | 16 | 50 | 571 | 0 | 0 | 0 |
-| 1 | 140.0 | 10 | 2 | 12 | 54 | 269 | 1074 | 2581 | 2150 |
-| 2 | 196.0 | 10 | 5 | 4 | 18 | 244 | 980 | 1868 | 1539 |
-| 3 | 274.4 | 10 | 2 | 4 | 20 | 95 | 483 | 977 | 749 |
-| 4 | 384.2 | 10 | 6 | 2 | 10 | 196 | 703 | 1370 | 1137 |
-| 5 | 537.8 | 4 | 6 | 2 | 10 | 33 | 171 | 417 | 285 |
+| 1 | 140.0 | 10 | 2 | 12 | 54 | 253 | 974 | 2378 | 1998 |
+| 2 | 196.0 | 10 | 4 | 5 | 22 | 253 | 993 | 1928 | 1571 |
+| 3 | 274.4 | 10 | 6 | 2 | 10 | 100 | 437 | 852 | 698 |
+| 4 | 384.2 | 4 | 6 | 2 | 10 | 81 | 332 | 627 | 513 |
Top nets by iteration-attributed nodes expanded:
-- `net_09`: 249
-- `net_03`: 217
-- `net_00`: 213
-- `net_08`: 159
-- `net_02`: 158
-- `net_06`: 151
-- `net_01`: 129
-- `net_07`: 91
-- `net_04`: 21
-- `net_05`: 20
+- `net_09`: 242
+- `net_00`: 201
+- `net_02`: 157
+- `net_06`: 155
+- `net_01`: 147
+- `net_08`: 144
+- `net_03`: 141
+- `net_07`: 45
+- `net_04`: 13
+- `net_05`: 13
Top nets by iteration-attributed congestion checks:
-- `net_03`: 687
-- `net_06`: 545
-- `net_02`: 538
-- `net_01`: 433
-- `net_07`: 358
-- `net_08`: 254
-- `net_00`: 219
-- `net_09`: 165
-- `net_04`: 108
-- `net_05`: 104
+- `net_06`: 569
+- `net_02`: 514
+- `net_01`: 468
+- `net_03`: 425
+- `net_00`: 203
+- `net_08`: 170
+- `net_07`: 143
+- `net_09`: 124
+- `net_04`: 60
+- `net_05`: 60
## example_07_large_scale_routing_no_warm_start_seed43
@@ -48,35 +47,35 @@ Results: 10 valid / 10 reached / 10 total.
| Iteration | Penalty | Routed Nets | Completed | Conflict Edges | Dynamic Collisions | Nodes | Congestion Checks | Candidate Ids | Exact Pairs |
| --: | --: | --: | --: | --: | --: | --: | --: | --: | --: |
| 0 | 100.0 | 10 | 1 | 16 | 50 | 571 | 0 | 0 | 0 |
-| 1 | 140.0 | 10 | 1 | 13 | 53 | 281 | 1037 | 2807 | 2205 |
-| 2 | 196.0 | 10 | 4 | 3 | 15 | 157 | 697 | 1678 | 1289 |
-| 3 | 274.4 | 6 | 4 | 3 | 15 | 59 | 277 | 610 | 455 |
-| 4 | 384.2 | 6 | 6 | 2 | 10 | 167 | 584 | 1201 | 958 |
+| 1 | 140.0 | 10 | 1 | 13 | 53 | 269 | 961 | 2562 | 2032 |
+| 2 | 196.0 | 10 | 4 | 3 | 15 | 140 | 643 | 1610 | 1224 |
+| 3 | 274.4 | 6 | 4 | 3 | 15 | 54 | 250 | 557 | 428 |
+| 4 | 384.2 | 6 | 6 | 2 | 10 | 136 | 505 | 1025 | 829 |
| 5 | 537.8 | 4 | 6 | 2 | 10 | 33 | 171 | 419 | 287 |
Top nets by iteration-attributed nodes expanded:
-- `net_09`: 248
-- `net_03`: 219
-- `net_00`: 176
-- `net_08`: 168
+- `net_09`: 250
+- `net_03`: 199
+- `net_00`: 177
+- `net_08`: 166
- `net_07`: 140
-- `net_06`: 130
-- `net_02`: 97
+- `net_06`: 105
+- `net_02`: 79
- `net_01`: 65
-- `net_05`: 13
-- `net_04`: 12
+- `net_05`: 12
+- `net_04`: 10
Top nets by iteration-attributed congestion checks:
-- `net_03`: 695
+- `net_03`: 639
- `net_07`: 454
-- `net_06`: 449
-- `net_02`: 368
-- `net_08`: 302
+- `net_06`: 382
+- `net_02`: 290
+- `net_08`: 283
- `net_09`: 178
-- `net_01`: 136
-- `net_00`: 75
-- `net_05`: 55
-- `net_04`: 54
+- `net_01`: 135
+- `net_00`: 82
+- `net_05`: 47
+- `net_04`: 40
diff --git a/archive/routing/performance.md b/archive/routing/performance.md
index c0673a0..3a9fb37 100644
--- a/archive/routing/performance.md
+++ b/archive/routing/performance.md
@@ -1,21 +1,23 @@
# Performance Baseline
-Generated on 2026-11-26 by `scripts/record_performance_baseline.py`.
+Generated on 2026-04-02 by `scripts/record_performance_baseline.py`.
The full machine-readable snapshot is in [performance_baseline.json](performance_baseline.json).
Use `scripts/diff_performance_baseline.py` to compare a fresh run against that snapshot.
+The default table below intentionally excludes the heavier performance-only no-warm `example_07` canaries. Use `scripts/record_iteration_trace.py` and `scripts/record_pre_pair_frontier_trace.py` to inspect the late negotiated-congestion basin and pair-local handoff behavior for those scenarios.
+
| Scenario | Duration (s) | Total | Valid | Reached | Iter | Nets Routed | Nodes | Ray Casts | Moves Gen | Moves Added | Dyn Tree | Visibility Builds | Congestion Checks | Verify Calls |
| :-- | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: |
-| example_01_simple_route | 0.0043 | 1 | 1 | 1 | 1 | 1 | 2 | 10 | 11 | 7 | 0 | 0 | 0 | 4 |
-| example_02_congestion_resolution | 0.2541 | 3 | 3 | 3 | 1 | 3 | 366 | 1164 | 1413 | 668 | 0 | 0 | 0 | 16 |
-| example_03_locked_paths | 0.1476 | 2 | 2 | 2 | 2 | 2 | 191 | 657 | 904 | 307 | 0 | 0 | 0 | 10 |
-| example_04_sbends_and_radii | 0.0222 | 2 | 2 | 2 | 1 | 2 | 15 | 70 | 123 | 65 | 0 | 0 | 0 | 8 |
-| example_05_orientation_stress | 0.1878 | 3 | 3 | 3 | 2 | 5 | 284 | 1237 | 1617 | 673 | 0 | 0 | 151 | 17 |
-| example_06_bend_collision_models | 0.1732 | 3 | 3 | 3 | 3 | 3 | 240 | 682 | 1026 | 629 | 0 | 0 | 0 | 12 |
-| example_07_large_scale_routing | 0.1869 | 10 | 10 | 10 | 1 | 10 | 78 | 383 | 372 | 227 | 0 | 0 | 0 | 40 |
-| example_08_custom_bend_geometry | 0.0154 | 2 | 2 | 2 | 2 | 2 | 18 | 56 | 78 | 56 | 0 | 0 | 0 | 8 |
-| example_09_unroutable_best_effort | 0.0053 | 1 | 0 | 0 | 1 | 1 | 3 | 13 | 16 | 10 | 0 | 0 | 0 | 1 |
+| example_01_simple_route | 0.0037 | 1 | 1 | 1 | 1 | 1 | 2 | 10 | 11 | 7 | 0 | 0 | 0 | 5 |
+| example_02_congestion_resolution | 0.3361 | 3 | 3 | 3 | 1 | 3 | 366 | 1164 | 1413 | 668 | 0 | 0 | 0 | 41 |
+| example_03_locked_paths | 0.1877 | 2 | 2 | 2 | 2 | 2 | 191 | 657 | 904 | 307 | 0 | 0 | 0 | 18 |
+| example_04_sbends_and_radii | 0.0269 | 2 | 2 | 2 | 1 | 2 | 15 | 70 | 123 | 65 | 0 | 0 | 0 | 10 |
+| example_05_orientation_stress | 0.2311 | 3 | 3 | 3 | 2 | 5 | 297 | 1274 | 1680 | 689 | 0 | 0 | 146 | 20 |
+| example_06_bend_collision_models | 0.1988 | 3 | 3 | 3 | 3 | 3 | 240 | 682 | 1026 | 629 | 0 | 0 | 0 | 15 |
+| example_07_large_scale_routing | 0.2088 | 10 | 10 | 10 | 1 | 10 | 78 | 383 | 372 | 227 | 0 | 0 | 0 | 50 |
+| example_08_custom_bend_geometry | 0.0177 | 2 | 2 | 2 | 2 | 2 | 18 | 56 | 78 | 56 | 0 | 0 | 0 | 10 |
+| example_09_unroutable_best_effort | 0.0057 | 1 | 0 | 0 | 1 | 1 | 3 | 13 | 16 | 10 | 0 | 0 | 0 | 1 |
## Full Counter Set
diff --git a/archive/routing/performance_baseline.json b/archive/routing/performance_baseline.json
index 698456a..952600d 100644
--- a/archive/routing/performance_baseline.json
+++ b/archive/routing/performance_baseline.json
@@ -1,9 +1,9 @@
{
- "generated_on": "2026-11-26",
+ "generated_on": "2026-04-02",
"generator": "scripts/record_performance_baseline.py",
"scenarios": [
{
- "duration_s": 0.004303620080463588,
+ "duration_s": 0.003715757979080081,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -87,7 +87,7 @@
"refinement_windows_considered": 0,
"route_iterations": 1,
"score_component_calls": 11,
- "score_component_total_ns": 16362,
+ "score_component_total_ns": 16864,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 0,
"static_safe_cache_hits": 1,
@@ -95,7 +95,7 @@
"timeout_events": 0,
"verify_dynamic_candidate_nets": 0,
"verify_dynamic_exact_pair_checks": 0,
- "verify_path_report_calls": 4,
+ "verify_path_report_calls": 5,
"verify_static_buffer_ops": 0,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
@@ -117,7 +117,7 @@
"valid_results": 1
},
{
- "duration_s": 0.2540899380110204,
+ "duration_s": 0.33605348505079746,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -177,7 +177,7 @@
"pair_local_search_attempts": 0,
"pair_local_search_nodes_expanded": 0,
"pair_local_search_pairs_considered": 0,
- "path_cost_calls": 30,
+ "path_cost_calls": 14,
"pruned_closed_set": 157,
"pruned_cost": 208,
"pruned_hard_collision": 380,
@@ -194,22 +194,22 @@
"refine_path_calls": 3,
"refinement_candidate_side_extents": 26,
"refinement_candidates_accepted": 2,
- "refinement_candidates_built": 2,
- "refinement_candidates_verified": 2,
+ "refinement_candidates_built": 26,
+ "refinement_candidates_verified": 26,
"refinement_dynamic_bounds_checked": 20,
"refinement_static_bounds_checked": 0,
- "refinement_windows_considered": 4,
+ "refinement_windows_considered": 10,
"route_iterations": 1,
- "score_component_calls": 1088,
- "score_component_total_ns": 1136950,
+ "score_component_calls": 976,
+ "score_component_total_ns": 1109505,
"static_net_tree_rebuilds": 3,
"static_raw_tree_rebuilds": 0,
"static_safe_cache_hits": 1,
"static_tree_rebuilds": 2,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 14,
- "verify_dynamic_exact_pair_checks": 12,
- "verify_path_report_calls": 16,
+ "verify_dynamic_candidate_nets": 92,
+ "verify_dynamic_exact_pair_checks": 90,
+ "verify_path_report_calls": 41,
"verify_static_buffer_ops": 0,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
@@ -231,7 +231,7 @@
"valid_results": 3
},
{
- "duration_s": 0.14755904604680836,
+ "duration_s": 0.18771230895072222,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -291,7 +291,7 @@
"pair_local_search_attempts": 0,
"pair_local_search_nodes_expanded": 0,
"pair_local_search_pairs_considered": 0,
- "path_cost_calls": 10,
+ "path_cost_calls": 9,
"pruned_closed_set": 97,
"pruned_cost": 140,
"pruned_hard_collision": 181,
@@ -308,23 +308,23 @@
"refine_path_calls": 2,
"refinement_candidate_side_extents": 8,
"refinement_candidates_accepted": 1,
- "refinement_candidates_built": 1,
- "refinement_candidates_verified": 1,
- "refinement_dynamic_bounds_checked": 0,
+ "refinement_candidates_built": 8,
+ "refinement_candidates_verified": 8,
+ "refinement_dynamic_bounds_checked": 2,
"refinement_static_bounds_checked": 2,
"refinement_windows_considered": 2,
"route_iterations": 2,
- "score_component_calls": 510,
- "score_component_total_ns": 550707,
+ "score_component_calls": 504,
+ "score_component_total_ns": 546567,
"static_net_tree_rebuilds": 2,
"static_raw_tree_rebuilds": 1,
"static_safe_cache_hits": 1,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 0,
- "verify_dynamic_exact_pair_checks": 0,
- "verify_path_report_calls": 10,
- "verify_static_buffer_ops": 48,
+ "verify_dynamic_candidate_nets": 10,
+ "verify_dynamic_exact_pair_checks": 10,
+ "verify_path_report_calls": 18,
+ "verify_static_buffer_ops": 90,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 2,
@@ -345,7 +345,7 @@
"valid_results": 2
},
{
- "duration_s": 0.022167235030792654,
+ "duration_s": 0.026945222169160843,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -429,15 +429,15 @@
"refinement_windows_considered": 0,
"route_iterations": 1,
"score_component_calls": 90,
- "score_component_total_ns": 98717,
+ "score_component_total_ns": 97710,
"static_net_tree_rebuilds": 2,
"static_raw_tree_rebuilds": 0,
"static_safe_cache_hits": 1,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 9,
+ "verify_dynamic_candidate_nets": 12,
"verify_dynamic_exact_pair_checks": 0,
- "verify_path_report_calls": 8,
+ "verify_path_report_calls": 10,
"verify_static_buffer_ops": 0,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
@@ -459,28 +459,28 @@
"valid_results": 2
},
{
- "duration_s": 0.18780142499599606,
+ "duration_s": 0.23108969815075397,
"metrics": {
- "congestion_cache_hits": 1,
- "congestion_cache_misses": 151,
- "congestion_candidate_ids": 19,
- "congestion_candidate_nets": 15,
- "congestion_candidate_precheck_hits": 133,
- "congestion_candidate_precheck_misses": 19,
+ "congestion_cache_hits": 3,
+ "congestion_cache_misses": 146,
+ "congestion_candidate_ids": 32,
+ "congestion_candidate_nets": 23,
+ "congestion_candidate_precheck_hits": 129,
+ "congestion_candidate_precheck_misses": 20,
"congestion_candidate_precheck_skips": 0,
- "congestion_check_calls": 151,
- "congestion_exact_pair_checks": 18,
- "congestion_grid_net_cache_hits": 12,
- "congestion_grid_net_cache_misses": 22,
- "congestion_grid_span_cache_hits": 11,
- "congestion_grid_span_cache_misses": 4,
+ "congestion_check_calls": 146,
+ "congestion_exact_pair_checks": 30,
+ "congestion_grid_net_cache_hits": 16,
+ "congestion_grid_net_cache_misses": 26,
+ "congestion_grid_span_cache_hits": 15,
+ "congestion_grid_span_cache_misses": 7,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
- "congestion_net_envelope_cache_hits": 133,
- "congestion_net_envelope_cache_misses": 37,
- "congestion_presence_cache_hits": 181,
- "congestion_presence_cache_misses": 26,
- "congestion_presence_skips": 55,
+ "congestion_net_envelope_cache_hits": 127,
+ "congestion_net_envelope_cache_misses": 39,
+ "congestion_presence_cache_hits": 196,
+ "congestion_presence_cache_misses": 27,
+ "congestion_presence_skips": 74,
"danger_map_cache_hits": 0,
"danger_map_cache_misses": 0,
"danger_map_lookup_calls": 0,
@@ -490,12 +490,12 @@
"dynamic_path_objects_added": 48,
"dynamic_path_objects_removed": 36,
"dynamic_tree_rebuilds": 0,
- "guidance_bonus_applied": 100.0,
- "guidance_bonus_applied_bend90": 87.5,
+ "guidance_bonus_applied": 562.5,
+ "guidance_bonus_applied_bend90": 500.0,
"guidance_bonus_applied_sbend": 0.0,
- "guidance_bonus_applied_straight": 12.5,
- "guidance_match_moves": 8,
- "guidance_match_moves_bend90": 7,
+ "guidance_bonus_applied_straight": 62.5,
+ "guidance_match_moves": 9,
+ "guidance_match_moves_bend90": 8,
"guidance_match_moves_sbend": 0,
"guidance_match_moves_straight": 1,
"hard_collision_cache_hits": 0,
@@ -505,29 +505,29 @@
"iteration_reverify_calls": 2,
"late_phase_capped_fallbacks": 0,
"late_phase_capped_nets": 0,
- "move_cache_abs_hits": 249,
- "move_cache_abs_misses": 1368,
- "move_cache_rel_hits": 1266,
+ "move_cache_abs_hits": 374,
+ "move_cache_abs_misses": 1306,
+ "move_cache_rel_hits": 1204,
"move_cache_rel_misses": 102,
- "moves_added": 673,
- "moves_generated": 1617,
+ "moves_added": 689,
+ "moves_generated": 1680,
"nets_carried_forward": 1,
"nets_reached_target": 5,
"nets_routed": 5,
- "nodes_expanded": 284,
+ "nodes_expanded": 297,
"pair_local_search_accepts": 0,
"pair_local_search_attempts": 0,
"pair_local_search_nodes_expanded": 0,
"pair_local_search_pairs_considered": 0,
"path_cost_calls": 2,
- "pruned_closed_set": 140,
- "pruned_cost": 505,
+ "pruned_closed_set": 159,
+ "pruned_cost": 533,
"pruned_hard_collision": 14,
- "ray_cast_calls": 1237,
- "ray_cast_calls_expand_forward": 279,
+ "ray_cast_calls": 1274,
+ "ray_cast_calls_expand_forward": 292,
"ray_cast_calls_expand_snap": 2,
"ray_cast_calls_other": 0,
- "ray_cast_calls_straight_static": 947,
+ "ray_cast_calls_straight_static": 971,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 9,
@@ -542,16 +542,16 @@
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
"route_iterations": 2,
- "score_component_calls": 1190,
- "score_component_total_ns": 1157917,
+ "score_component_calls": 1234,
+ "score_component_total_ns": 1223569,
"static_net_tree_rebuilds": 3,
"static_raw_tree_rebuilds": 0,
- "static_safe_cache_hits": 2,
+ "static_safe_cache_hits": 8,
"static_tree_rebuilds": 1,
"timeout_events": 0,
"verify_dynamic_candidate_nets": 8,
"verify_dynamic_exact_pair_checks": 12,
- "verify_path_report_calls": 17,
+ "verify_path_report_calls": 20,
"verify_static_buffer_ops": 0,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
@@ -563,7 +563,7 @@
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 70,
"visibility_tangent_candidate_ray_tests": 9,
- "visibility_tangent_candidate_scans": 279,
+ "visibility_tangent_candidate_scans": 292,
"warm_start_paths_built": 2,
"warm_start_paths_used": 2
},
@@ -573,7 +573,7 @@
"valid_results": 3
},
{
- "duration_s": 0.17324819299392402,
+ "duration_s": 0.19879506202414632,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -599,7 +599,7 @@
"danger_map_cache_misses": 731,
"danger_map_lookup_calls": 1914,
"danger_map_query_calls": 731,
- "danger_map_total_ns": 18539700,
+ "danger_map_total_ns": 19050142,
"dynamic_grid_rebuilds": 0,
"dynamic_path_objects_added": 54,
"dynamic_path_objects_removed": 36,
@@ -645,7 +645,7 @@
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 34,
- "ray_cast_candidate_bounds": 88,
+ "ray_cast_candidate_bounds": 97,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 3,
"refinement_candidate_side_extents": 0,
@@ -657,7 +657,7 @@
"refinement_windows_considered": 0,
"route_iterations": 3,
"score_component_calls": 842,
- "score_component_total_ns": 20771160,
+ "score_component_total_ns": 21353240,
"static_net_tree_rebuilds": 3,
"static_raw_tree_rebuilds": 3,
"static_safe_cache_hits": 141,
@@ -665,8 +665,8 @@
"timeout_events": 0,
"verify_dynamic_candidate_nets": 0,
"verify_dynamic_exact_pair_checks": 0,
- "verify_path_report_calls": 12,
- "verify_static_buffer_ops": 72,
+ "verify_path_report_calls": 15,
+ "verify_static_buffer_ops": 90,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 3,
@@ -687,7 +687,7 @@
"valid_results": 3
},
{
- "duration_s": 0.18685018795076758,
+ "duration_s": 0.20880168909206986,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -713,7 +713,7 @@
"danger_map_cache_misses": 448,
"danger_map_lookup_calls": 681,
"danger_map_query_calls": 448,
- "danger_map_total_ns": 10856837,
+ "danger_map_total_ns": 11025527,
"dynamic_grid_rebuilds": 0,
"dynamic_path_objects_added": 132,
"dynamic_path_objects_removed": 88,
@@ -771,16 +771,16 @@
"refinement_windows_considered": 0,
"route_iterations": 1,
"score_component_calls": 291,
- "score_component_total_ns": 11698395,
+ "score_component_total_ns": 11875928,
"static_net_tree_rebuilds": 10,
"static_raw_tree_rebuilds": 1,
"static_safe_cache_hits": 6,
"static_tree_rebuilds": 10,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 370,
- "verify_dynamic_exact_pair_checks": 56,
- "verify_path_report_calls": 40,
- "verify_static_buffer_ops": 176,
+ "verify_dynamic_candidate_nets": 476,
+ "verify_dynamic_exact_pair_checks": 72,
+ "verify_path_report_calls": 50,
+ "verify_static_buffer_ops": 220,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 10,
@@ -801,7 +801,7 @@
"valid_results": 10
},
{
- "duration_s": 0.0154108009301126,
+ "duration_s": 0.017696003895252943,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -885,7 +885,7 @@
"refinement_windows_considered": 0,
"route_iterations": 2,
"score_component_calls": 72,
- "score_component_total_ns": 82036,
+ "score_component_total_ns": 87742,
"static_net_tree_rebuilds": 2,
"static_raw_tree_rebuilds": 0,
"static_safe_cache_hits": 2,
@@ -893,7 +893,7 @@
"timeout_events": 0,
"verify_dynamic_candidate_nets": 0,
"verify_dynamic_exact_pair_checks": 0,
- "verify_path_report_calls": 8,
+ "verify_path_report_calls": 10,
"verify_static_buffer_ops": 0,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
@@ -915,7 +915,7 @@
"valid_results": 2
},
{
- "duration_s": 0.005300503107719123,
+ "duration_s": 0.005660973023623228,
"metrics": {
"congestion_cache_hits": 0,
"congestion_cache_misses": 0,
@@ -941,7 +941,7 @@
"danger_map_cache_misses": 20,
"danger_map_lookup_calls": 30,
"danger_map_query_calls": 20,
- "danger_map_total_ns": 510754,
+ "danger_map_total_ns": 515133,
"dynamic_grid_rebuilds": 0,
"dynamic_path_objects_added": 2,
"dynamic_path_objects_removed": 1,
@@ -999,7 +999,7 @@
"refinement_windows_considered": 0,
"route_iterations": 1,
"score_component_calls": 14,
- "score_component_total_ns": 551521,
+ "score_component_total_ns": 554809,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
"static_safe_cache_hits": 0,
diff --git a/archive/routing/pre_pair_frontier_trace.json b/archive/routing/pre_pair_frontier_trace.json
index 72db90d..42d83c6 100644
--- a/archive/routing/pre_pair_frontier_trace.json
+++ b/archive/routing/pre_pair_frontier_trace.json
@@ -1,80 +1,80 @@
{
- "generated_at": "2026-11-26T21:47:45-08:00",
+ "generated_at": "2026-04-02T18:51:01-07:00",
"generator": "scripts/record_pre_pair_frontier_trace.py",
"scenarios": [
{
"metrics": {
- "congestion_cache_hits": 24,
- "congestion_cache_misses": 3411,
- "congestion_candidate_ids": 7213,
- "congestion_candidate_nets": 7410,
- "congestion_candidate_precheck_hits": 1677,
- "congestion_candidate_precheck_misses": 1795,
- "congestion_candidate_precheck_skips": 37,
- "congestion_check_calls": 3411,
- "congestion_exact_pair_checks": 5860,
- "congestion_grid_net_cache_hits": 1676,
- "congestion_grid_net_cache_misses": 3276,
- "congestion_grid_span_cache_hits": 1517,
- "congestion_grid_span_cache_misses": 1637,
+ "congestion_cache_hits": 31,
+ "congestion_cache_misses": 2736,
+ "congestion_candidate_ids": 5785,
+ "congestion_candidate_nets": 6163,
+ "congestion_candidate_precheck_hits": 1383,
+ "congestion_candidate_precheck_misses": 1418,
+ "congestion_candidate_precheck_skips": 34,
+ "congestion_check_calls": 2736,
+ "congestion_exact_pair_checks": 4780,
+ "congestion_grid_net_cache_hits": 1356,
+ "congestion_grid_net_cache_misses": 2608,
+ "congestion_grid_span_cache_hits": 1247,
+ "congestion_grid_span_cache_misses": 1308,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
- "congestion_net_envelope_cache_hits": 1801,
- "congestion_net_envelope_cache_misses": 3433,
- "congestion_presence_cache_hits": 1857,
- "congestion_presence_cache_misses": 2075,
- "congestion_presence_skips": 460,
- "danger_map_cache_hits": 13605,
- "danger_map_cache_misses": 6252,
- "danger_map_lookup_calls": 19857,
- "danger_map_query_calls": 6252,
- "danger_map_total_ns": 182509223,
+ "congestion_net_envelope_cache_hits": 1452,
+ "congestion_net_envelope_cache_misses": 2720,
+ "congestion_presence_cache_hits": 1541,
+ "congestion_presence_cache_misses": 1642,
+ "congestion_presence_skips": 382,
+ "danger_map_cache_hits": 11547,
+ "danger_map_cache_misses": 6063,
+ "danger_map_lookup_calls": 17610,
+ "danger_map_query_calls": 6063,
+ "danger_map_total_ns": 171779571,
"dynamic_grid_rebuilds": 0,
- "dynamic_path_objects_added": 430,
- "dynamic_path_objects_removed": 384,
+ "dynamic_path_objects_added": 399,
+ "dynamic_path_objects_removed": 351,
"dynamic_tree_rebuilds": 0,
- "guidance_bonus_applied": 3275.0,
- "guidance_bonus_applied_bend90": 1075.0,
- "guidance_bonus_applied_sbend": 200.0,
- "guidance_bonus_applied_straight": 2000.0,
- "guidance_match_moves": 131,
- "guidance_match_moves_bend90": 43,
- "guidance_match_moves_sbend": 8,
- "guidance_match_moves_straight": 80,
+ "guidance_bonus_applied": 6750.0,
+ "guidance_bonus_applied_bend90": 2250.0,
+ "guidance_bonus_applied_sbend": 375.0,
+ "guidance_bonus_applied_straight": 4125.0,
+ "guidance_match_moves": 108,
+ "guidance_match_moves_bend90": 36,
+ "guidance_match_moves_sbend": 6,
+ "guidance_match_moves_straight": 66,
"hard_collision_cache_hits": 0,
- "iteration_conflict_edges": 40,
- "iteration_conflicting_nets": 39,
- "iteration_reverified_nets": 60,
- "iteration_reverify_calls": 6,
- "late_phase_capped_fallbacks": 2,
- "late_phase_capped_nets": 2,
- "move_cache_abs_hits": 1831,
- "move_cache_abs_misses": 5516,
- "move_cache_rel_hits": 4926,
- "move_cache_rel_misses": 590,
- "moves_added": 6594,
- "moves_generated": 7347,
+ "iteration_conflict_edges": 37,
+ "iteration_conflicting_nets": 32,
+ "iteration_reverified_nets": 50,
+ "iteration_reverify_calls": 5,
+ "late_phase_capped_fallbacks": 0,
+ "late_phase_capped_nets": 0,
+ "move_cache_abs_hits": 1200,
+ "move_cache_abs_misses": 5338,
+ "move_cache_rel_hits": 4768,
+ "move_cache_rel_misses": 570,
+ "moves_added": 5853,
+ "moves_generated": 6538,
"nets_carried_forward": 6,
- "nets_reached_target": 52,
- "nets_routed": 54,
- "nodes_expanded": 1408,
+ "nets_reached_target": 44,
+ "nets_routed": 44,
+ "nodes_expanded": 1258,
"pair_local_search_accepts": 2,
- "pair_local_search_attempts": 3,
- "pair_local_search_nodes_expanded": 42,
+ "pair_local_search_attempts": 2,
+ "pair_local_search_nodes_expanded": 68,
"pair_local_search_pairs_considered": 2,
"path_cost_calls": 0,
- "pruned_closed_set": 414,
- "pruned_cost": 339,
+ "pruned_closed_set": 374,
+ "pruned_cost": 311,
"pruned_hard_collision": 0,
- "ray_cast_calls": 4577,
- "ray_cast_calls_expand_forward": 1356,
- "ray_cast_calls_expand_snap": 36,
+ "ray_cast_calls": 4310,
+ "ray_cast_calls_expand_forward": 1214,
+ "ray_cast_calls_expand_snap": 39,
"ray_cast_calls_other": 0,
- "ray_cast_calls_straight_static": 3179,
+ "ray_cast_calls_straight_static": 3051,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 6,
- "ray_cast_candidate_bounds": 162,
+ "ray_cast_candidate_bounds": 159,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 10,
"refinement_candidate_side_extents": 0,
@@ -84,18 +84,18 @@
"refinement_dynamic_bounds_checked": 0,
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
- "route_iterations": 6,
- "score_component_calls": 6958,
- "score_component_total_ns": 206697616,
+ "route_iterations": 5,
+ "score_component_calls": 6181,
+ "score_component_total_ns": 192508906,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
- "static_safe_cache_hits": 1778,
+ "static_safe_cache_hits": 1170,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 1638,
- "verify_dynamic_exact_pair_checks": 507,
- "verify_path_report_calls": 152,
- "verify_static_buffer_ops": 699,
+ "verify_dynamic_candidate_nets": 1822,
+ "verify_dynamic_exact_pair_checks": 504,
+ "verify_path_report_calls": 164,
+ "verify_static_buffer_ops": 779,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 1,
@@ -106,7 +106,7 @@
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 6,
"visibility_tangent_candidate_ray_tests": 6,
- "visibility_tangent_candidate_scans": 1356,
+ "visibility_tangent_candidate_scans": 1214,
"warm_start_paths_built": 0,
"warm_start_paths_used": 0
},
@@ -114,18 +114,18 @@
"pre_pair_frontier_trace": {
"conflict_edges": [
[
- "net_02",
- "net_03"
+ "net_01",
+ "net_02"
],
[
"net_06",
"net_07"
]
],
- "iteration": 5,
+ "iteration": 4,
"nets": [
{
- "congestion_check_calls": 85,
+ "congestion_check_calls": 30,
"frontier": {
"hotspot_bounds": [
[
@@ -142,129 +142,21 @@
]
],
"net_id": "net_07",
- "pruned_closed_set": 2,
+ "pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"pruned_self_collision": 0,
- "samples": [
- {
- "end_state": [
- 850,
- 520,
- 0
- ],
- "hotspot_index": 0,
- "move_type": "straight",
- "parent_state": [
- 525,
- 520,
- 0
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 850,
- 520,
- 0
- ],
- "hotspot_index": 0,
- "move_type": "straight",
- "parent_state": [
- 763,
- 520,
- 0
- ],
- "reason": "closed_set"
- }
- ]
+ "samples": []
},
"guidance_seed_present": true,
"net_id": "net_07",
- "nodes_expanded": 16,
- "pruned_closed_set": 3,
+ "nodes_expanded": 7,
+ "pruned_closed_set": 1,
"pruned_cost": 0,
"pruned_hard_collision": 0
},
{
- "congestion_check_calls": 86,
- "frontier": {
- "hotspot_bounds": [
- [
- 826.3396407947511,
- 418.0,
- 917.3906878342618,
- 507.1148801363561
- ],
- [
- 884.0,
- 402.0,
- 916.0,
- 435.0
- ]
- ],
- "net_id": "net_02",
- "pruned_closed_set": 3,
- "pruned_cost": 0,
- "pruned_hard_collision": 0,
- "pruned_self_collision": 0,
- "samples": [
- {
- "end_state": [
- 850,
- 470,
- 0
- ],
- "hotspot_index": 0,
- "move_type": "straight",
- "parent_state": [
- 525,
- 470,
- 0
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 850,
- 470,
- 0
- ],
- "hotspot_index": 0,
- "move_type": "straight",
- "parent_state": [
- 763,
- 470,
- 0
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 470,
- 0
- ],
- "hotspot_index": 0,
- "move_type": "straight",
- "parent_state": [
- 881,
- 470,
- 0
- ],
- "reason": "closed_set"
- }
- ]
- },
- "guidance_seed_present": true,
- "net_id": "net_02",
- "nodes_expanded": 17,
- "pruned_closed_set": 4,
- "pruned_cost": 0,
- "pruned_hard_collision": 0
- },
- {
- "congestion_check_calls": 0,
+ "congestion_check_calls": 179,
"frontier": {
"hotspot_bounds": [
[
@@ -287,11 +179,26 @@
]
],
"net_id": "net_06",
- "pruned_closed_set": 10,
+ "pruned_closed_set": 5,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"pruned_self_collision": 0,
"samples": [
+ {
+ "end_state": [
+ 900,
+ 510,
+ 0
+ ],
+ "hotspot_index": 0,
+ "move_type": "straight",
+ "parent_state": [
+ 525,
+ 510,
+ 0
+ ],
+ "reason": "closed_set"
+ },
{
"end_state": [
850,
@@ -307,6 +214,21 @@
],
"reason": "closed_set"
},
+ {
+ "end_state": [
+ 900,
+ 510,
+ 0
+ ],
+ "hotspot_index": 0,
+ "move_type": "straight",
+ "parent_state": [
+ 763,
+ 510,
+ 0
+ ],
+ "reason": "closed_set"
+ },
{
"end_state": [
850,
@@ -336,405 +258,90 @@
0
],
"reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 638,
- 270
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 895,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 895,
- 638,
- 270
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 880,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 880,
- 638,
- 270
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 827,
- 270
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 832,
- 270
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 780,
- 270
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 785,
- 270
- ],
- "reason": "closed_set"
}
]
},
"guidance_seed_present": true,
"net_id": "net_06",
- "nodes_expanded": 0,
- "pruned_closed_set": 0,
+ "nodes_expanded": 46,
+ "pruned_closed_set": 7,
+ "pruned_cost": 15,
+ "pruned_hard_collision": 0
+ },
+ {
+ "congestion_check_calls": 43,
+ "frontier": {
+ "hotspot_bounds": [
+ [
+ 506.3396407947511,
+ 398.0,
+ 597.3906878342618,
+ 487.1148801363561
+ ],
+ [
+ 564.0,
+ 224.0,
+ 596.0,
+ 415.0
+ ]
+ ],
+ "net_id": "net_00",
+ "pruned_closed_set": 0,
+ "pruned_cost": 0,
+ "pruned_hard_collision": 0,
+ "pruned_self_collision": 0,
+ "samples": []
+ },
+ "guidance_seed_present": true,
+ "net_id": "net_00",
+ "nodes_expanded": 10,
+ "pruned_closed_set": 1,
"pruned_cost": 0,
"pruned_hard_collision": 0
},
{
- "congestion_check_calls": 0,
+ "congestion_check_calls": 80,
"frontier": {
"hotspot_bounds": [
[
- 826.3396407947511,
- 418.0,
- 917.3906878342618,
- 507.1148801363561
+ 506.3396407947511,
+ 398.0,
+ 597.3906878342618,
+ 487.1148801363561
],
[
- 884.0,
- 408.0,
- 916.2379632934325,
- 445.0
+ 564.0,
+ 388.0,
+ 596.2379632934325,
+ 425.0
],
[
- 883.7620367065675,
- 347.71498824645397,
- 916.0,
- 429.0
+ 563.7620367065675,
+ 169.71498824645388,
+ 596.0,
+ 251.0
]
],
- "net_id": "net_03",
- "pruned_closed_set": 16,
+ "net_id": "net_01",
+ "pruned_closed_set": 0,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"pruned_self_collision": 0,
- "samples": [
- {
- "end_state": [
- 850,
- 480,
- 0
- ],
- "hotspot_index": 0,
- "move_type": "straight",
- "parent_state": [
- 525,
- 480,
- 0
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 850,
- 480,
- 0
- ],
- "hotspot_index": 0,
- "move_type": "straight",
- "parent_state": [
- 763,
- 480,
- 0
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 362,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 895,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 895,
- 362,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 880,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 880,
- 362,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 896,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 896,
- 362,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 891,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 891,
- 362,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 886,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 886,
- 362,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 882,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 882,
- 362,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 1000,
- 380,
- 0
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 868,
- 380,
- 0
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 995,
- 380,
- 0
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 868,
- 380,
- 0
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 163,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 158,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 267,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 215,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 210,
- 90
- ],
- "reason": "closed_set"
- }
- ]
+ "samples": []
},
"guidance_seed_present": true,
- "net_id": "net_03",
- "nodes_expanded": 0,
- "pruned_closed_set": 0,
+ "net_id": "net_01",
+ "nodes_expanded": 18,
+ "pruned_closed_set": 3,
"pruned_cost": 0,
"pruned_hard_collision": 0
}
],
"routed_net_ids": [
"net_07",
- "net_02",
"net_06",
- "net_03"
+ "net_00",
+ "net_01"
]
},
"summary": {
@@ -746,40 +353,40 @@
{
"metrics": {
"congestion_cache_hits": 8,
- "congestion_cache_misses": 2766,
- "congestion_candidate_ids": 6715,
- "congestion_candidate_nets": 6315,
- "congestion_candidate_precheck_hits": 1342,
- "congestion_candidate_precheck_misses": 1509,
- "congestion_candidate_precheck_skips": 77,
- "congestion_check_calls": 2766,
- "congestion_exact_pair_checks": 5194,
- "congestion_grid_net_cache_hits": 1366,
- "congestion_grid_net_cache_misses": 2753,
- "congestion_grid_span_cache_hits": 1230,
- "congestion_grid_span_cache_misses": 1404,
+ "congestion_cache_misses": 2530,
+ "congestion_candidate_ids": 6173,
+ "congestion_candidate_nets": 5869,
+ "congestion_candidate_precheck_hits": 1152,
+ "congestion_candidate_precheck_misses": 1460,
+ "congestion_candidate_precheck_skips": 74,
+ "congestion_check_calls": 2530,
+ "congestion_exact_pair_checks": 4800,
+ "congestion_grid_net_cache_hits": 1192,
+ "congestion_grid_net_cache_misses": 2676,
+ "congestion_grid_span_cache_hits": 1065,
+ "congestion_grid_span_cache_misses": 1366,
"congestion_lazy_requeues": 0,
"congestion_lazy_resolutions": 0,
- "congestion_net_envelope_cache_hits": 1435,
- "congestion_net_envelope_cache_misses": 2856,
- "congestion_presence_cache_hits": 1498,
- "congestion_presence_cache_misses": 1717,
- "congestion_presence_skips": 364,
- "danger_map_cache_hits": 12083,
- "danger_map_cache_misses": 5623,
- "danger_map_lookup_calls": 17706,
- "danger_map_query_calls": 5623,
- "danger_map_total_ns": 159397726,
+ "congestion_net_envelope_cache_hits": 1234,
+ "congestion_net_envelope_cache_misses": 2769,
+ "congestion_presence_cache_hits": 1302,
+ "congestion_presence_cache_misses": 1664,
+ "congestion_presence_skips": 354,
+ "danger_map_cache_hits": 11485,
+ "danger_map_cache_misses": 5474,
+ "danger_map_lookup_calls": 16959,
+ "danger_map_query_calls": 5474,
+ "danger_map_total_ns": 143896014,
"dynamic_grid_rebuilds": 0,
"dynamic_path_objects_added": 397,
"dynamic_path_objects_removed": 350,
"dynamic_tree_rebuilds": 0,
- "guidance_bonus_applied": 3000.0,
- "guidance_bonus_applied_bend90": 1150.0,
- "guidance_bonus_applied_sbend": 100.0,
- "guidance_bonus_applied_straight": 1750.0,
- "guidance_match_moves": 120,
- "guidance_match_moves_bend90": 46,
+ "guidance_bonus_applied": 7562.5,
+ "guidance_bonus_applied_bend90": 2937.5,
+ "guidance_bonus_applied_sbend": 250.0,
+ "guidance_bonus_applied_straight": 4375.0,
+ "guidance_match_moves": 121,
+ "guidance_match_moves_bend90": 47,
"guidance_match_moves_sbend": 4,
"guidance_match_moves_straight": 70,
"hard_collision_cache_hits": 0,
@@ -789,33 +396,33 @@
"iteration_reverify_calls": 6,
"late_phase_capped_fallbacks": 2,
"late_phase_capped_nets": 2,
- "move_cache_abs_hits": 1479,
- "move_cache_abs_misses": 5117,
- "move_cache_rel_hits": 4529,
- "move_cache_rel_misses": 588,
- "moves_added": 5884,
- "moves_generated": 6596,
+ "move_cache_abs_hits": 1304,
+ "move_cache_abs_misses": 4997,
+ "move_cache_rel_hits": 4419,
+ "move_cache_rel_misses": 578,
+ "moves_added": 5638,
+ "moves_generated": 6301,
"nets_carried_forward": 14,
"nets_reached_target": 44,
"nets_routed": 46,
- "nodes_expanded": 1268,
+ "nodes_expanded": 1203,
"pair_local_search_accepts": 2,
"pair_local_search_attempts": 3,
- "pair_local_search_nodes_expanded": 42,
+ "pair_local_search_nodes_expanded": 39,
"pair_local_search_pairs_considered": 2,
"path_cost_calls": 0,
- "pruned_closed_set": 366,
- "pruned_cost": 346,
+ "pruned_closed_set": 354,
+ "pruned_cost": 309,
"pruned_hard_collision": 0,
- "ray_cast_calls": 4200,
- "ray_cast_calls_expand_forward": 1224,
+ "ray_cast_calls": 4059,
+ "ray_cast_calls_expand_forward": 1159,
"ray_cast_calls_expand_snap": 13,
"ray_cast_calls_other": 0,
- "ray_cast_calls_straight_static": 2957,
+ "ray_cast_calls_straight_static": 2881,
"ray_cast_calls_visibility_build": 0,
"ray_cast_calls_visibility_query": 0,
"ray_cast_calls_visibility_tangent": 6,
- "ray_cast_candidate_bounds": 167,
+ "ray_cast_candidate_bounds": 170,
"ray_cast_exact_geometry_checks": 0,
"refine_path_calls": 10,
"refinement_candidate_side_extents": 0,
@@ -826,17 +433,17 @@
"refinement_static_bounds_checked": 0,
"refinement_windows_considered": 0,
"route_iterations": 6,
- "score_component_calls": 6248,
- "score_component_total_ns": 181369777,
+ "score_component_calls": 5962,
+ "score_component_total_ns": 163113517,
"static_net_tree_rebuilds": 1,
"static_raw_tree_rebuilds": 1,
- "static_safe_cache_hits": 1444,
+ "static_safe_cache_hits": 1276,
"static_tree_rebuilds": 1,
"timeout_events": 0,
- "verify_dynamic_candidate_nets": 1543,
- "verify_dynamic_exact_pair_checks": 511,
- "verify_path_report_calls": 144,
- "verify_static_buffer_ops": 666,
+ "verify_dynamic_candidate_nets": 1884,
+ "verify_dynamic_exact_pair_checks": 557,
+ "verify_path_report_calls": 174,
+ "verify_static_buffer_ops": 805,
"visibility_builds": 0,
"visibility_corner_hits_exact": 0,
"visibility_corner_index_builds": 1,
@@ -847,7 +454,7 @@
"visibility_point_queries": 0,
"visibility_tangent_candidate_corner_checks": 6,
"visibility_tangent_candidate_ray_tests": 6,
- "visibility_tangent_candidate_scans": 1224,
+ "visibility_tangent_candidate_scans": 1159,
"warm_start_paths_built": 0,
"warm_start_paths_used": 0
},
@@ -1028,7 +635,7 @@
]
],
"net_id": "net_06",
- "pruned_closed_set": 10,
+ "pruned_closed_set": 8,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"pruned_self_collision": 0,
@@ -1152,36 +759,6 @@
270
],
"reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 780,
- 270
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 633,
- 270
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 785,
- 270
- ],
- "reason": "closed_set"
}
]
},
@@ -1216,7 +793,7 @@
]
],
"net_id": "net_03",
- "pruned_closed_set": 14,
+ "pruned_closed_set": 12,
"pruned_cost": 0,
"pruned_hard_collision": 0,
"pruned_self_collision": 0,
@@ -1400,36 +977,6 @@
90
],
"reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 215,
- 90
- ],
- "reason": "closed_set"
- },
- {
- "end_state": [
- 900,
- 367,
- 90
- ],
- "hotspot_index": 2,
- "move_type": "straight",
- "parent_state": [
- 900,
- 210,
- 90
- ],
- "reason": "closed_set"
}
]
},
diff --git a/archive/routing/pre_pair_frontier_trace.md b/archive/routing/pre_pair_frontier_trace.md
index e07ab16..a760f82 100644
--- a/archive/routing/pre_pair_frontier_trace.md
+++ b/archive/routing/pre_pair_frontier_trace.md
@@ -1,25 +1,25 @@
# Pre-Pair Frontier Trace
-Generated at 2026-11-26T21:47:45-08:00 by `scripts/record_pre_pair_frontier_trace.py`.
+Generated at 2026-04-02T18:51:01-07:00 by `scripts/record_pre_pair_frontier_trace.py`.
## example_07_large_scale_routing_no_warm_start
Results: 10 valid / 10 reached / 10 total.
-Captured iteration: `5`
+Captured iteration: `4`
-Conflict edges: `(('net_02', 'net_03'), ('net_06', 'net_07'))`
+Conflict edges: `(('net_01', 'net_02'), ('net_06', 'net_07'))`
| Net | Nodes | Checks | Closed-Set | Cost | Hard Collision | Guidance Seed | Frontier Samples |
| :-- | --: | --: | --: | --: | --: | :--: | --: |
-| net_07 | 16 | 85 | 3 | 0 | 0 | yes | 2 |
-| net_02 | 17 | 86 | 4 | 0 | 0 | yes | 3 |
-| net_06 | 0 | 0 | 0 | 0 | 0 | yes | 10 |
-| net_03 | 0 | 0 | 0 | 0 | 0 | yes | 16 |
+| net_07 | 7 | 30 | 1 | 0 | 0 | yes | 0 |
+| net_06 | 46 | 179 | 7 | 15 | 0 | yes | 5 |
+| net_00 | 10 | 43 | 1 | 0 | 0 | yes | 0 |
+| net_01 | 18 | 80 | 3 | 0 | 0 | yes | 0 |
Frontier prune totals by reason:
-- `closed_set`: 31
+- `closed_set`: 5
- `hard_collision`: 0
- `self_collision`: 0
- `cost`: 0
@@ -36,12 +36,12 @@ Conflict edges: `(('net_02', 'net_03'), ('net_06', 'net_07'))`
| :-- | --: | --: | --: | --: | --: | :--: | --: |
| net_07 | 16 | 85 | 3 | 0 | 0 | yes | 2 |
| net_02 | 17 | 86 | 4 | 0 | 0 | yes | 3 |
-| net_06 | 0 | 0 | 0 | 0 | 0 | yes | 10 |
-| net_03 | 0 | 0 | 0 | 0 | 0 | yes | 14 |
+| net_06 | 0 | 0 | 0 | 0 | 0 | yes | 8 |
+| net_03 | 0 | 0 | 0 | 0 | 0 | yes | 12 |
Frontier prune totals by reason:
-- `closed_set`: 29
+- `closed_set`: 25
- `hard_collision`: 0
- `self_collision`: 0
- `cost`: 0
diff --git a/archive/routing/simplification-results.md b/archive/routing/simplification-results.md
deleted file mode 100644
index 515b217..0000000
--- a/archive/routing/simplification-results.md
+++ /dev/null
@@ -1,66 +0,0 @@
-# Routing simplification results
-
-These checks compare the November 27, 2026 implementation with `6608e18`. The [routing simplification plan](../../plans/routing-simplification.md) defines the implementation batches and the questions each prototype tested.
-
-## Changes implemented
-
-| Plan items | Decision and verification |
-| --- | --- |
-| 1 | Reuse the live index when the last completed iteration is also the best. Timeout, an earlier winner, and a callback that edits results each exercised restoration. The change alone avoided 9,201 insertions and 9,201 removals on the public-default corpus. |
-| 2–3 | Share the layout rank and stable Manhattan net order. Tests cover each ranking criterion, an empty first review, the pair-length tolerance, mixed headings, equal distances, and alternate lock order. |
-| 4–6 | Represent pair targets directly and roll back only rejected installed candidates. Candidate selection uses net-level conflicts. Rejected local searches, reversed attempts, disjoint targets, and the two-pair limit were checked. |
-| 7–8 | Share incumbent guidance in frontier replay and remove the unused visibility wrapper. Individual trace flags reproduced the same samples and component indices on the explicit worker runs. Exact and tangent visibility tests passed. |
-| 10 | Replace only the pair under repair. The 27 explicit-worker comparisons avoided 740 insertions and 740 removals, from runs that include both fan-out seeds under five diagnostics settings. They matched paths and trace payloads through multiple repairs. |
-| 11 | Reuse the best iteration's review when its geometry is still installed and no restored trace needs a capture. The earlier-winner test still performs the restored review. Final verification still supplies partial-path reports and frontier overlap details. The corpus saved 1,589 report calls, 15,582 static buffers, 32,877 dynamic candidate nets, and 13,352 dynamic exact pair checks. |
-| 12 | Check for four bends before taking a path out of the index for refinement. Straight and S-bend tests confirm the installed paths stay in place. Bend-heavy fixtures kept their candidate counts and paths. Across both corpus profiles, this saved 416 refinement calls and 2,510 insertions and removals each. |
-| 14 | Sample obstacle boundaries only when an enabled objective uses proximity. Bounds checks stay available. The mixed-weight test uses zero search danger and nonzero refinement danger. Pair workers use their search objective and the active greedy weight. Both profiles and the custom-bend cases matched exactly. |
-| 17–20 | Reuse the prepared joint-lane problem and the common perimeter residual worker. Joint-lane lock order, skipped IDs, corridor counts, seeded IDs, and stage records matched. The forced perimeter check matched 61 stage records, including 22 residual searches and a verified two-net result on Terminal-Bench Pair. The shared objective constructor preserves each world's obstacle inputs. The containment check accepts flush ports and rejects a custom physical protrusion even when its proxy fits. The trace fixtures use the same result assembly as production. |
-| 21–23 | Derive the ordinary scenario runs from the snapshot registry. Repeated selectors preserve registry order across recording and comparison, including a performance-only scenario against an older baseline. The public locked-path example matches both original path reports and the generated plot pixel for pixel. Fixture semantics stayed stable. |
-
-## Prototypes kept out of production
-
-| Item | Trial | Result and decision |
-| --- | --- | --- |
-| 9 | Explicit no-warm-start fan-out with 8 nets at seeds 41 and 44 and 10 nets at seed 43, plus mutable callbacks, caller seeds, and partial paths. | Three capped incumbents saved 15 insertions and removals each. No capped fallback ran in the two automatic corpus profiles. The hot path keeps its existing sequence. |
-| 13 | Seeded alternating doglegs, return shelf, and detour under both corpus profiles, with 108 proposals near the improvement threshold. | Choices, costs, and built and accepted candidates matched. The prototype saved 1,330 component scores in six runs. Across 11 interleaved public-default repeats, the median changed from 431.2 to 430.3 ms on the doglegs, 35.1 to 34.1 ms on the return shelf, and 11.3 to 11.3 ms on the detour. Keep the simpler scoring loop. |
-| 15 | A cold, bounded cache of 512 physical clearance buffers, keyed by polygon and clearance. Five interleaved public-default runs per case. | The buffer counts fell on all four cases. The largest retained geometry payload was 474 kB in WKB, before object and native memory overhead. The additional cache state has a modest end-to-end payoff. Keep the direct verification path. |
-| 16 | Bypass each congestion precheck separately on offset gates, obstructed crossings, the splitter tree, and ten-net fan-out at seed 42. Five interleaved runs per case. | Skipping the grid presence check changed the fan-out expansion sequence. Skipping the candidate check added 37 congestion checks there and left the exact pair count at 5,860. The splitter tree and fan-out median gains were about 1–2%. Keep both filters. |
-
-### Static verification measurements
-
-| Public-default fixture | Buffer calls before → cache | Median before → cache | Retained input and buffer WKB |
-| --- | ---: | ---: | ---: |
-| PIC splitter tree | 1,255 → 145 | 5,258 → 5,167 ms | 474 kB |
-| Alternating doglegs | 1,695 → 873 | 464 → 438 ms | 437 kB |
-| Obstructed crossing approaches | 158 → 20 | 392 → 386 ms | 20 kB |
-| Custom physical bend | 36 → 9 | 32.2 → 31.5 ms | 1.9 kB |
-
-The cache trial preserved the mitred-corner distance check. The clearance and collision suites passed with the cache active, including boundary touching.
-
-### Congestion precheck measurements
-
-| Fixture | Grid presence rejections | Candidate rejections after presence | Mean presence / candidate query time |
-| --- | ---: | ---: | ---: |
-| Offset gates | 0 | 0 | No congestion queries |
-| Obstructed crossing approaches | 425 | 0 | 1.42 / 2.54 µs |
-| PIC splitter tree | 2,101 | 0 | 2.78 / 11.37 µs |
-| Fan-out at seed 42 | 460 | 37 | 2.34 / 14.66 µs |
-
-Query timings include cache hits and misses. In the fan-out run the envelope lookup averaged 11.28 µs and the grid-net lookup averaged 3.22 µs, inclusive of their own checks. Removing the presence filter moved work into the candidate filter and increased full congestion checks from 3,411 to 3,530. Exact tests still distinguish frozen conflicts, soft overlap, and boundary contact.
-
-## Triggers for broader changes
-
-**24. Residual routing.** The direct probe uses locked physical geometry and emits placeholders for disconnected IDs. A connected incumbent retry uses the same prepared residual for ordinary seeding and joint-lane recovery. The joint trial needs a seeded layout check before it can win. A disconnected incumbent instead passes movable seeds on the whole original problem. Perimeter recovery holds one local route, adds it back to the result, and verifies the whole candidate when complete. Residual dogleg generation also holds the incumbents, then checks a whole seeded layout. These flows now share preparation where their inputs match. A broader interface can wait for a recovery case that duplicates the seed merge or the whole-layout check.
-
-**25. Collision queries.** The candidate lookup and exact overlap are already distinct steps. Candidate collection feeds both soft counts and frozen blocking, while final verification checks physical geometry and optionally records component pairs. The precheck measurements show an expansion-order dependency, and the buffer measurements show a limited benefit from adding state. Keep the current lookup boundary around `DynamicPathIndex`. Revisit it when profiling shows that the exact-test work or cache invalidation can be isolated without changing reroute work.
-
-**26. Public options.** Keep the five routing modes and the six option groups. Constructors, benchmark profiles, and option serialization depend on the four bend geometry fields. A legacy polygon can define both proxy and physical geometry, and an explicit custom proxy keeps the standard arc unless a physical geometry is provided. The geometry overrides and the serialized benchmark cases are covered by tests. Revisit grouping with a caller-facing change that can document those cases and migrate existing constructors and fixture presets.
-
-## Combined verification
-
-- Both profiles verified 433 of 437 nets across 67 boards and reached each board's bound. Overloaded Gate verified 3/4 across a three-track cut. LiDAR Clements verified 3/6 with three disjoint fixed-port conflicts. The unseeded Terminal-Bench export verified 9/9 and passed the pinned upstream geometry and cost checker.
-- The 134 corpus, 20 retry-holdout, and 20 focused callback and diagnostic comparisons matched their recorded paths, verified IDs, costs, stages, bounds, and trace payloads. The 27 explicit-worker comparisons also matched, including guide and seed reports and both fan-out seeds.
-- The expected stable counter differences were `dynamic_path_objects_added`, `dynamic_path_objects_removed`, `verify_path_report_calls`, `verify_static_buffer_ops`, `verify_dynamic_candidate_nets`, `verify_dynamic_exact_pair_checks`, and `refine_path_calls`. The public-default corpus avoided 11,461 insertions and removals each across the combined changes.
-- The complete correctness suite passed 385 tests. The separate opt-in run passed all 11 example performance tests.
-
-The parity capture command and counter allowance syntax are in the [verification section of the plan](../../plans/routing-simplification.md#verification-and-sequencing).
diff --git a/docs/architecture.md b/docs/architecture.md
index a68c873..6b4d52c 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -1,52 +1,48 @@
# Router architecture
-An explicit routing mode runs one worker. Automatic routing can run several and compare their results. To follow how the worker gets its obstacles, locks, and seed hints, start at [`route_once()`](../inire/router/_stack.py#L71).
+Start with the stage that chooses the route, then inspect the worker that produced it. The public `route()` entry point runs one worker for an explicit mode. Automatic mode can run several. Each worker sees the obstacles, locks, and seed hints passed to it. [Public API](user/api-reference.md) · [Worker setup](../inire/router/_stack.py)
## Automatic routing

-Follow the left column down while the run is below its coverage target. Move right to selection when a verified candidate reaches that target or the attempts run out. Custom physical bends, polygonal proxies, and layouts routed without constrained triangulation take a lattice-only path.
+The diagram shows the usual sequence for arc bends. A verified layout can reach the routing target early. When attempts run out, selection keeps the best verified coverage found. Custom physical bends, polygonal proxies, or missing constrained triangulation take a lattice-only path.
-1. **Set the coverage target.** Each disjoint pair of incompatible fixed ports rules out one route. At supported rectangular cuts, compute how many paths of the narrowest width can fit through the openings. To change which cuts can establish an upper bound, start with [`cut_capacity()`](../inire/router/_capacity.py#L27).
-2. **Try constructive planners.** Bundles assign ordered tracks through barriers. Column schedules place turns between openings. Compact planners fit short connections between constrained ports. Each produces seeds whose physical geometry the worker checks.
-3. **Start with a small search budget.** Lock verified straight links and search for the remaining nets. A different lock order or a small unlocked probe can free room for a turn. Promising guide and column attempts can run first.
-4. **Decide what to keep fixed.** If the remaining ports are connected, route around the locked geometry. If the locks disconnect them, pass the incumbents as movable seeds. A joint retry can assign different lanes through a shared portal. If recovery stalls, seed and lattice attempts can search the whole layout, with a final lattice retry up to the caller's ceiling.
-5. **Select a verified layout.** Prefer greater coverage and compare cost on identical verified net sets. A complete locked layout or an improving joint retry must pass its whole-layout check before selection. To see how a refined candidate must preserve the verified net set, follow [the refinement handoff](../inire/router/_automatic.py#L581).
-
-The near-port attempt uses up to 100 nodes per search and two congestion iterations with the arc proxy. Alternate proxies use the configured iteration limit because a later shallow iteration can find a cheaper path. Wider lookahead uses up to 500 nodes per search and the configured iteration limit. Follow the caps and early exits in [the initial search trials](../inire/router/_automatic.py#L480).
+1. **Establish a stopping target.** Each disjoint pair of incompatible fixed ports rules out one route. For supported rectangular cuts, the capacity check uses the narrowest guide to bound how many paths fit through each opening. Reaching one of these bounds can justify stopping with partial coverage. Keep those bounds separate from estimates such as corridor occupancy or a failed attempt. [Capacity checks](../inire/router/_capacity.py)
+2. **Exploit layout structure before search.** Bundles place ordered tracks through barriers. Column schedules assign tracks to openings and stagger turns between them. Compact planners fit local connections between constrained ports. A schedule supplies seeds to the ordinary verifier. This lets the planner make cheap geometric proposals while the verifier checks the resulting physical paths. [Bundles](../inire/router/_bundle.py) · [Columns](../inire/router/_columns.py) · [Compact planners](../inire/router/_compact.py)
+3. **Probe cheaply before spending the wider budget.** Direct trials can lock verified straight links and search for the remaining nets. A change in lock order or a small unlocked probe can free a nearby turn. The near-port stage uses up to 100 nodes per search and two congestion iterations for the arc proxy. Alternate proxies use the configured iteration limit because another shallow iteration can find a path the wider retry misses or finds at higher cost. The wider lookahead uses up to 500 nodes and the configured iteration limit. Both respect smaller caller limits. Guide and column attempts can precede the probe when the geometry makes them promising. [Stage order](../inire/router/_automatic.py) · [Direct trials](../inire/router/_routing_policy.py)
+4. **Choose what to keep fixed.** If the remaining ports are still connected with verified paths locked, route the unresolved nets around those paths. If locks disconnect the residual, use movable seed hints so the next search can move an incumbent. A residual with several nets sharing a portal can benefit from a different lane assignment. When those attempts stall, seed and lattice workers can search the whole layout. A final lattice retry can use the caller's ceiling. [Residual routing](../inire/router/_automatic.py) · [Corridors and lanes](topological-routing.md#corridor-planning-and-realization)
+5. **Accept a checked layout.** Compare verified coverage first. Cost breaks ties between candidates with identical verified IDs. A complete locked layout or an improving joint retry must pass its required whole-layout check before selection. Refinement is also a candidate replacement and must preserve the verified ID set. [Trial selection](../inire/router/_routing_policy.py)
### Example of a poor lock
1. A straight trunk in `stress-retry-straight-decoy` fits on its own. Once locked, it divides the board and blocks two perpendicular nets.
2. The probe can keep the branches and lower rail. A four-turn dogleg completes the trunk around them before wider search.
-3. If you change lock ordering or acceptance, run the [single-case benchmark command](benchmarks.md#run-a-benchmark) with `--case stress-retry-straight-decoy`. Check that all four nets still verify and compare which stage finishes the trunk.
+3. If you change lock ordering or acceptance, check that all four nets still verify together. [Fixture](../inire/tests/stress_routing_benchmarks.py) · [Choose a benchmark](benchmarks.md#choose-a-case)
## Detailed search and congestion
-- **Build and admit moves.** Weighted A* searches snapped positions and headings. Rays, visible corners, and corridor waypoints propose straight endpoints. Admission checks clearance, cost, and state dominance. To understand which endpoints a net can reach within the same node budget, start with [move generation](../inire/router/_astar_moves.py).
+- **Build and admit moves.** Weighted A* searches snapped positions and headings. Rays, visible corners, and corridor waypoints propose straight endpoints. Admission checks clearance, cost, and state dominance. A move-generation change can help a net reach its target at the same node budget. [Moves](../inire/router/_astar_moves.py) · [Admission](../inire/router/_astar_admission.py) · [Search](../inire/router/_search.py)
-- **Recheck the installed set.** The driver raises the overlap penalty when successive routes collide. After an iteration it verifies the installed paths, since a later route can collide with one completed earlier. It ranks snapshots by completed nets, then by conflicts and dynamic collisions. To see when it reroutes just the conflicting nets, read [`next_reroute_net_ids()`](../inire/router/_congestion_policy.py#L93).
+- **Recheck the installed set.** The congestion driver replaces paths in routing order and raises the overlap penalty between unresolved iterations. A later route can collide with one completed earlier, so the driver verifies the installed set. It ranks snapshots by completed nets, then by conflicts and dynamic collisions. [Routing loop](../inire/router/_router.py) · [Congestion policy](../inire/router/_congestion_policy.py)
-- **Repair a small conflict set.** The driver restores its best iteration and verifies it once for diagnostics and target selection. Pair-local search keeps the geometry outside an eligible pair fixed and can try either routing order. The driver checks replacements in the live world. To compare the restored set with the repaired paths, [follow a late conflict](routing-diagnostics.md#follow-a-late-conflict-into-pair-local-repair).
+- **Repair a small conflict set.** Late iterations can focus on conflicting nets. The driver restores its best iteration before attempting pair-local repair. It keeps the geometry outside an eligible pair fixed, can try either routing order, and checks the proposed replacement in the live world. [Pair-local search](../inire/router/_pair_local.py) · [Read an iteration trace](routing-diagnostics.md#traces)
## Geometry and refinement
-Search proxies help reject candidates cheaply. Final verification checks physical clearance, self-collisions, and automatic board containment. A mitred buffer can flag a candidate near a corner even when physical distance meets clearance. The exact distance check resolves those cases. To test changes to the broad phase, use the boundary-touching and custom-shape cases in the [collision tests](../inire/tests/test_collision.py).
+Search proxies help reject candidates cheaply. Final verification checks physical clearance, self-collisions, and automatic board containment. A mitred obstacle buffer can flag a candidate near a corner even when the physical distance meets clearance. The exact distance check resolves those cases. When changing a broad phase, keep boundary-touching and custom-shape fixtures alongside ordinary rectangle cases. [Collision world](../inire/geometry/collision.py) · [Collision tests](../inire/tests/test_collision.py)
-When expansion counts are similar but routing time rises, inspect ray casts for repeated visibility queries and exact pair checks for an overly broad dynamic lookup. The [metrics guide](routing-diagnostics.md#route-metrics) maps those questions to counters.
+Use timings to decide which geometry work to inspect. Ray counts can point to repeated visibility queries. Congestion candidate counts and exact pair checks can reveal an overly broad dynamic lookup. Compare checks at similar expansion counts before changing the index. [Geometry workload diagnostics](routing-diagnostics.md#route-metrics)
-Refinement scores replacement windows before constructing their polygons. Finite budgets above one window prioritize bend-ended windows to give expensive turns an early chance to be replaced. One-window and unlimited runs try the longest windows first. Local checks rely on the rest of the route and the other installed paths being valid. Final verification checks the installed result.
+Refinement looks for cheaper replacements in windows of a completed path. With a finite budget above one window, it prioritizes bend-ended windows so it can try removing expensive turns early. One-window and unlimited runs use longest-first ordering. Candidate scoring precedes polygon construction. A local replacement check relies on the unchanged route and other paths still being valid in the current world. The final check covers the installed result. [Refiner](../inire/router/refiner.py)
## Validate a change
-| If you change | What to check | Where to start |
-| --- | --- | --- |
-| Stage order or budgets | Which stage wins and whether work reappears in a later attempt. Include tight passages and preplaced crossings. | [Automatic routing](../inire/router/_automatic.py) |
-| Locks or candidate acceptance | The verified IDs and their paths after the complete layout is checked. | [Direct trials and selection](../inire/router/_routing_policy.py) |
-| 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) |
-| Collision or caching | Clearance and boundary decisions for both physical and proxy shapes. Compare candidate counts and exact checks along with time. | [Collision world](../inire/geometry/collision.py) |
-| Pair-local repair | Coverage and conflict edges before repair, plus the final installed geometry. | [Pair-local search](../inire/router/_pair_local.py) |
-| Cost or refinement | Per-net costs on equal verified ID sets and validity after the final check. | [Path refinement](../inire/router/refiner.py) |
+| Change | What to demonstrate |
+| --- | --- |
+| Stage order, locks, or budgets | Which attempt wins, which net IDs and paths it keeps, and whether skipped work reappears in a later attempt. Include tight passages and preplaced crossings. |
+| Collision or cache behavior | Identical clearance and boundary decisions for physical and proxy shapes. Compare candidate counts and exact checks along with time. |
+| Congestion, seeds, or pair-local repair | Coverage and conflict evolution at iteration boundaries, plus the final installed geometry after repair. |
+| Cost or refinement | Equal verified ID sets before comparing per-net lengths or costs. Check that the improvement survives whole-layout verification. |
Use [benchmark profiles](benchmarks.md#choose-a-profile) for policy comparisons and [exact parity](routing-diagnostics.md#reproduce-and-compare) for behavior-preserving changes.
diff --git a/docs/benchmark-fixtures.md b/docs/benchmark-fixtures.md
index 9abeb27..bbc5f2f 100644
--- a/docs/benchmark-fixtures.md
+++ b/docs/benchmark-fixtures.md
@@ -1,20 +1,16 @@
# Benchmark fixtures
-Start with a board that exercises the behavior you want to measure. Use the [case guide](benchmarks.md#choose-a-case) to select it or the [corpus registry](../inire/tests/routing_corpus.py) to find its groups and effective profile settings.
+Use the checked-in inputs to repeat a routing comparison offline. The fixture catalogue gives the geometry, options, and expected bound for each case. [Choose a case and profile](benchmarks.md#choose-a-case) · [Fixture catalogue](../inire/tests/routing_corpus.py)
## Automatic nine-net Terminal-Bench routing
-Use `terminal-bench-point-terminals` to test heading inference and ordered tracks through shared openings. The bundle planner reserves room for the outer return and bend tangencies. Use `terminal-bench` to test automatic routing with fixed headings.
-
-To measure the bundle planner on the unseeded point-terminal input, export its routes.
+Use this as a check on ordered placement and heading inference. The upstream task supplies point terminals, so `bundle` mode can infer headings and reserve room for the outer return and bend tangencies. The export command starts from the unseeded input. Its nine routes passed the pinned checker below the upstream cost limit. Use the fixed-heading `terminal-bench` fixture to check automatic routing when the headings are part of the input. [Bundle planner](../inire/router/_bundle.py) · [Pinned upstream task](https://github.com/harbor-framework/terminal-bench/tree/249d125b59c0a5352d9e132195cfead6d81446be/tasks/photonic-waveguide-routing)
```sh
python -m scripts.route_terminal_bench --output /tmp/inire-terminal-bench.json
```
-The export should report nine verified routes. The upstream input is board 1 in the [pinned layout specification](https://raw.githubusercontent.com/harbor-framework/terminal-bench/249d125b59c0a5352d9e132195cfead6d81446be/tasks/photonic-waveguide-routing/environment/layout_spec.json). The unseeded export passed the pinned checker's cost and geometry requirements.
-
-To verify a known layout or compare lane assignments, pass `--reference-lane-plan` or `--single-bottom-track` to replay the [authored lane plans](../inire/tests/terminal_bench_lane_plan.py). Use the unseeded command above for planner coverage and timing.
+The export CLI's `--reference-lane-plan` and `--single-bottom-track` flags replay authored layouts for comparison. Use the unseeded export to measure the planner and the reference flags to check feasibility or compare lane assignments. [Reference plan](../inire/tests/terminal_bench_lane_plan.py)
## Preplaced crossings
@@ -22,20 +18,13 @@ To verify a known layout or compare lane assignments, pass `--reference-lane-pla
- `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).
+Use unseeded runs to evaluate routing policy. The fixture witnesses are checked independently for geometry and clearance. [Crossing definitions](../inire/tests/routing_crossing_benchmarks.py)
## Imported fixtures
-The importer converts placed device outlines to keepouts with port openings and snaps optical ports to a 0.1 µm grid. The six converted layouts exercise routing between fixed devices. To inspect their ports and keepouts, open the [checked-in fixture data](../inire/tests/data/external_routing_benchmarks.json).
+The six fixed-placement cases run offline from [converted inputs](../inire/tests/data/external_routing_benchmarks.json). Optical ports snap to a 0.1 µm grid. Device outlines become keepouts with access cutouts. PIC Routing Benchmark contributes splitter-tree, ring-modulator, and MZM cases. LiDAR contributes a toy layout and subsets of the Clements and MRR weight-bank layouts. These fixtures exercise waveguide routing between fixed devices. [PIC data and CC BY 4.0 attribution](https://huggingface.co/datasets/FLYR/pic-benchmark/blob/0c1f445792926d97fae01893c89e96b8a9393800/pic-benchmark/README.md) · [LiDAR source](https://github.com/ScopeX-ASU/LiDAR/tree/4e7004d32b0b80d959553797fb30f0737513de0c/src/picroute/benchmarks) · [LiDAR license](../inire/tests/data/LiDAR-LICENSE.txt)
-| Cases | Pinned source | License |
-| --- | --- | --- |
-| Splitter tree, ring modulator, and MZM | [FLYR PIC Routing Benchmark archive](https://huggingface.co/datasets/FLYR/pic-benchmark/resolve/0c1f445792926d97fae01893c89e96b8a9393800/pic-benchmark.zip) | FLYR's bundled `LICENSE` specifies [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/). |
-| Toy layout and subsets of the Clements and MRR weight-bank layouts | [LiDAR benchmark inputs](https://github.com/ScopeX-ASU/LiDAR/tree/4e7004d32b0b80d959553797fb30f0737513de0c/src/picroute/benchmarks) | [ScopeX@ASU's MIT license](../inire/tests/data/LiDAR-LICENSE.txt). |
-
-### Regenerate the converted inputs
-
-The importer checks both archive hashes before converting geometry. It uses PyYAML to read the layout files. Generate a scratch copy and compare it with the checked-in fixture data.
+The importer checks both pinned archive hashes. It requires PyYAML when regenerating the fixtures.
```sh
mkdir -p /tmp/inire-external-routing
@@ -45,8 +34,5 @@ curl -fL 'https://codeload.github.com/ScopeX-ASU/LiDAR/tar.gz/4e7004d32b0b80d959
-o /tmp/inire-external-routing/lidar.tar.gz
uv run --with 'pyyaml==6.0.3' python -m scripts.import_external_routing_benchmarks \
--pic-archive /tmp/inire-external-routing/pic-benchmark.zip \
- --lidar-archive /tmp/inire-external-routing/lidar.tar.gz \
- --output /tmp/inire-external-routing/fixtures.json
-cmp inire/tests/data/external_routing_benchmarks.json \
- /tmp/inire-external-routing/fixtures.json
+ --lidar-archive /tmp/inire-external-routing/lidar.tar.gz
```
diff --git a/docs/benchmark-results.md b/docs/benchmark-results.md
index 3f13a74..92815c4 100644
--- a/docs/benchmark-results.md
+++ b/docs/benchmark-results.md
@@ -1,14 +1,12 @@
# Benchmark results
-Use these measurements when changing the automatic probe budget or retry order. The [benchmark guide](benchmarks.md) explains how to select workloads and compare your results.
+Use these measurements to understand the current probe policy and choose follow-up retry experiments. [Run a fresh benchmark](benchmarks.md)
## Near-port probe and retry experiments
-The November 26, 2026 comparison used the regression corpus and retry holdouts under the `public-defaults` and `corpus-regression` profiles. Against the full configured probe budget, a two-iteration cap reduced public-default corpus expansions by 23%. Verified paths and costs matched on both board sets. Check these individual cases before changing the cap again.
+Results recorded on November 26, 2026. The probe decision compared the two-iteration cap with the full configured probe budget. The retry experiments used the pre-cap policy.
-- The splitter tree benefited from fewer repeated shallow searches.
-- The mixed port bank did more work because the shorter probe passed its last net to the wider retry.
-- A one-iteration cap increased the cost of a crossing approach. The clipped-proxy case needed the original probe budget to find its cheaper route, so the current cap applies to the arc proxy. See the [automatic stage sequence](architecture.md#automatic-routing).
+The two-iteration probe cuts repeated shallow searches on layouts such as the splitter tree. It reduced public-default expansion counts by 23% on the regression corpus with identical paths there and on the holdouts. The mixed port-bank case did more work because the shorter probe passed the last net to the wider retry. Test both stages when changing the cap. A one-iteration cap increased the cost of a crossing approach, and the clipped-proxy regression required the original probe budget to keep its cheaper route. These are reasons to check path quality and proxy geometry as well as total expansions. [Probe budget in the policy](architecture.md#automatic-routing)
```sh
python -m scripts.benchmark_retry_order --case corpus --case retry-holdout \
@@ -17,9 +15,9 @@ python -m scripts.benchmark_retry_order --case corpus --case retry-holdout \
### Early and late retries
-The November 26, 2026 retry experiments used the pre-cap baseline. Failed early retries added work before the ordinary fallback. In one holdout, early incumbent recovery selected a higher-cost path at the same coverage. When comparing a change to retry order, measure the cost of failed attempts as well as the successful recoveries. For the trigger conditions and older driver, see the [archived retry measurements](../archive/routing/README.md#reproduce-probe-and-retry-experiments).
+Early retries can save time when they replace a more expensive stage. Their failures add work before the ordinary fallback. The holdout runs found both effects and a case where early incumbent recovery selected a higher-cost path at the same coverage. Review failed-retry time and common-net cost when deciding whether an early exit is worth using. The archived experiments include the trigger counts and the original commands. [Experiment archive](#experiment-archive)
-In the `public-defaults` holdout sweep, `late-residual-3000` recovered the last net on two crossing boards and a return shelf while preserving the previously verified paths. It requires room in the caller's budget and connected ports with the incumbents locked. Use the current comparison below to measure the cost of that extra attempt.
+The experimental `late-residual-3000` policy tests a different question. Can a wider search recover the last net while keeping the rest fixed? It requires room in the caller's budget and skips attempts whose locks disconnect the remaining ports. In the pre-cap holdout sweep it completed the last net on two crossing boards and a return shelf, with all previously verified paths intact. Use the experiment to measure the cost of completing one more net after the normal policy stalls.
```sh
python -m scripts.benchmark_retry_order --case retry-holdout --profile public-defaults \
@@ -29,4 +27,4 @@ python -m scripts.benchmark_retry_order --case retry-holdout --profile public-de
## Experiment archive
-To recover the recorded expansion counts or rerun an earlier driver, follow the revision and command listed with the [archived probe and retry experiments](../archive/routing/README.md#reproduce-probe-and-retry-experiments).
+Use `git show ea5cfe7:docs/topological-routing.md` for the original retry experiments, budget sweeps, and manual Terminal-Bench lane comparisons. Use `git show 2b02c6e:docs/topological-routing.md` for the measured probe and holdout tables. For retired policies, check out `ea5cfe7` in a separate worktree to run the matching driver. [Routing development archive](../archive/routing/README.md)
diff --git a/docs/benchmarks.md b/docs/benchmarks.md
index 5ca0164..d028936 100644
--- a/docs/benchmarks.md
+++ b/docs/benchmarks.md
@@ -5,26 +5,29 @@
From the repository root, run the overloaded-gate fixture with the regression profile.
```sh
-python -m scripts.compare_topological_routing \
+python -m \
+scripts.compare_topological_routing \
--case overloaded-gate \
--profile corpus-regression \
--mode automatic
```
-Expect `3/4 valid` and a report of three tracks for four nets crossing the cut. The run reached the geometric bound. When trying another setting, check the bound and verified IDs before comparing cost. For a case whose bound comes from fixed ports, use `--case lidar-clements-8x8`.
+- **Coverage.** Expect `3/4 valid`. The capacity report gives three tracks across the cut. This run reached the geometric bound.
+- **Path quality.** Compare the verified net IDs before comparing weighted length or native objective cost.
+- **Work.** Read A* expansions and median time together. The report can show work spent planning and verifying even when it reports zero expansions.
## Choose a case
| If you are changing | Use `--case` |
| --- | --- |
| Overall coverage | `corpus` runs the regression suite. |
-| Ordered tracks, shared gates, and barrier layouts | `all` exercises the original layouts, including fixed-heading Terminal-Bench. |
-| Seeds, custom bend geometry, and fallback behavior | `broad` includes caller seeds, custom bends, imported layouts, and held-out boards. |
+| Ordered tracks, shared gates, and barrier layouts | `all` selects the original fixture group. |
+| Seeds, custom bend geometry, and fallback behavior | `broad` includes caller seeds, custom bends, imported layouts, and the first holdout set. |
| Ports on placed devices | `crossings` exercises external legs to preplaced crossing cells. |
| Lock ordering, tight turns, and competing passages | `stress` runs known-feasible folded returns, competing locks, and shared passages. |
| A retry tuned on the regression corpus | `retry-holdout` tests related but separate return shelves, bypasses, and competing trunks. |
-Run `python -m scripts.compare_topological_routing --list` to find individual case names. Start with a fixture that exhibits the behavior you're changing, then check the rest of the corpus and relevant holdouts. For upstream sources and regeneration commands, see [Benchmark fixtures](benchmark-fixtures.md).
+Run `python -m scripts.compare_topological_routing --list` to find individual case names. Select a fixture that exhibits the behavior under study, then use the corpus and relevant holdouts to check generalization. [Fixture sources and reproduction](benchmark-fixtures.md)
## Choose a profile
@@ -39,7 +42,8 @@ The two budget profiles use benchmark weights for automatic candidate selection.
### Run the full regression corpus
```sh
-python -m scripts.compare_topological_routing \
+python -m \
+scripts.compare_topological_routing \
--case corpus \
--profile corpus-regression \
--mode automatic --repeat 3 \
@@ -49,7 +53,8 @@ python -m scripts.compare_topological_routing \
### Compare routing modes
```sh
-python -m scripts.compare_topological_routing \
+python -m \
+scripts.compare_topological_routing \
--case offset-gates \
--profile matched-budget \
--mode off --mode guide \
@@ -58,12 +63,13 @@ python -m scripts.compare_topological_routing \
--json /tmp/inire-modes.json
```
-At 100 nodes per search, `off` stops short. Guide and seed both finish the same net at the same cost. Guide takes 4 expansions. Seed takes 37, all in seed search. If seed work increases after a change, inspect how the [corridor is realized as a path](topological-routing.md#corridor-planning-and-realization).
+At this budget, guide mode completes the offset net with no corridor seed. Seed mode also completes it at the same cost. Use this comparison to check corridor hints before tuning seed allocation. [How corridors are built](topological-routing.md)
### Test a retry on holdouts
```sh
-python -m scripts.benchmark_retry_order \
+python -m \
+scripts.benchmark_retry_order \
--case retry-holdout \
--profile public-defaults \
--policy baseline \
@@ -72,10 +78,10 @@ python -m scripts.benchmark_retry_order \
--json /tmp/inire-residual.json
```
-Check which holdouts gained a verified net, then compare previously verified paths and time spent on failed attempts. To see a case where an earlier retry increased cost at the same coverage, read the [retry results](benchmark-results.md#early-and-late-retries).
+Inspect verified IDs, paths, and time spent inside failed attempts. [Prior retry decisions and measurements](benchmark-results.md)
## Compare the results
1. **Coverage and bounds.** Check verified IDs, requested nets, and any bound. The overloaded gate exercises passage capacity. The imported LiDAR Clements layout exercises fixed-port conflicts. Verify any feasibility witness separately from the timed run.
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. Compare costs on identical verified IDs, and report coverage changes separately.
-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. To locate work that moved to a different stage, use the [automatic reports](routing-diagnostics.md#automatic-reports).
+3. **Search and time.** Compare expansions and repeated wall times at the same settings. Inspect individual slow cases and unsuccessful attempts. Use the stage and trace information to explain where the work moved. [Diagnostics and exact parity](routing-diagnostics.md)
diff --git a/docs/development.md b/docs/development.md
index b9fd39a..621dbf5 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -2,31 +2,19 @@
## Choose a task
-- Measure a single case, compare modes, or run the regression corpus with the [benchmark CLI](benchmarks.md).
-- Find where to change planner selection, locks, search, or verification in the [architecture guide](architecture.md).
-- Investigate coverage, route quality, or runtime using the [routing diagnostics](routing-diagnostics.md).
-- Check the caller contract before changing an option or result field in the [public API reference](user/api-reference.md).
+- **[Benchmarks](benchmarks.md)** runs a single case, the regression corpus, or a mode comparison.
+- **[Architecture](architecture.md)** explains planner selection, locks, search, and verification. Start here to find where a behavior change belongs.
+- **[Diagnostics](routing-diagnostics.md)** connects symptoms to stage reports, counters, and traces.
+- **[Public API reference](user/api-reference.md)** gives the caller contract for compatibility checks.
## 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, capture both revisions and run an [exact parity comparison](routing-diagnostics.md#reproduce-and-compare). Include callbacks or traces if the change affects them.
-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.
+1. Run `uv sync` to install development dependencies. Activate `.venv` or prefix the commands with `uv run`.
+2. Run `python -m pytest` for the correctness suite. Use `python -m pytest -m "not routing_corpus"` for a shorter local check.
+3. For a routing change, use the [benchmark profiles](benchmarks.md#choose-a-profile) or [exact parity instructions](routing-diagnostics.md#reproduce-and-compare) to compare coverage, geometry, and work.
-### Check a documentation figure
-
-Run `python -m scripts.render_documentation_figures --output-dir /tmp/inire-figures` to preview changes. Compare the port labels, keepouts, path, and caption against the published example. Run the script without `--output-dir` to regenerate the figures in `docs/figures`.
-
-### Refresh the advanced example gallery
-
-After changing a stress fixture or the nine-net board, export the inputs again and regenerate the [advanced example figures](../examples/advanced.md). The exporter checks that the saved data reproduces the benchmark geometry and public-default options.
-
-```sh
-python -m scripts.export_advanced_examples
-python examples/advanced_layouts.py --output-dir docs/figures
-```
+For documentation figures, run `python -m scripts.render_documentation_figures` from the repository root. It writes the route plots and planner diagram under `docs/figures`. Pass `--output-dir` to render a scratch copy for comparison.
## Development history
-To recover the inputs, metrics, or rationale behind an earlier routing decision, use the [routing development archive](../archive/routing/README.md).
+See the [routing development archive](../archive/routing/README.md) for old plans, optimization logs, and recorded trace and performance data.
diff --git a/docs/figures/example-stress-crossing-off-lattice-slot.png b/docs/figures/example-stress-crossing-off-lattice-slot.png
deleted file mode 100644
index a13a44f..0000000
Binary files a/docs/figures/example-stress-crossing-off-lattice-slot.png and /dev/null differ
diff --git a/docs/figures/example-stress-crossings-shared-outside-detour.png b/docs/figures/example-stress-crossings-shared-outside-detour.png
deleted file mode 100644
index 97f309e..0000000
Binary files a/docs/figures/example-stress-crossings-shared-outside-detour.png and /dev/null differ
diff --git a/docs/figures/example-stress-passage-split-merge.png b/docs/figures/example-stress-passage-split-merge.png
deleted file mode 100644
index cc1684b..0000000
Binary files a/docs/figures/example-stress-passage-split-merge.png and /dev/null differ
diff --git a/docs/figures/example-stress-passage-width-key.png b/docs/figures/example-stress-passage-width-key.png
deleted file mode 100644
index 33e900a..0000000
Binary files a/docs/figures/example-stress-passage-width-key.png and /dev/null differ
diff --git a/docs/figures/example-stress-refine-alternating-doglegs.png b/docs/figures/example-stress-refine-alternating-doglegs.png
deleted file mode 100644
index b36e8df..0000000
Binary files a/docs/figures/example-stress-refine-alternating-doglegs.png and /dev/null differ
diff --git a/docs/figures/example-stress-refine-return-shelf.png b/docs/figures/example-stress-refine-return-shelf.png
deleted file mode 100644
index a52d505..0000000
Binary files a/docs/figures/example-stress-refine-return-shelf.png and /dev/null differ
diff --git a/docs/figures/example-stress-retry-compact-shift-bank.png b/docs/figures/example-stress-retry-compact-shift-bank.png
deleted file mode 100644
index ccda395..0000000
Binary files a/docs/figures/example-stress-retry-compact-shift-bank.png and /dev/null differ
diff --git a/docs/figures/example-stress-retry-mixed-port-bank.png b/docs/figures/example-stress-retry-mixed-port-bank.png
deleted file mode 100644
index 8c76fa7..0000000
Binary files a/docs/figures/example-stress-retry-mixed-port-bank.png and /dev/null differ
diff --git a/docs/figures/example-stress-retry-straight-decoy.png b/docs/figures/example-stress-retry-straight-decoy.png
deleted file mode 100644
index f39e82d..0000000
Binary files a/docs/figures/example-stress-retry-straight-decoy.png and /dev/null differ
diff --git a/docs/figures/example-stress-sbend-competing-slots.png b/docs/figures/example-stress-sbend-competing-slots.png
deleted file mode 100644
index 1f0d55e..0000000
Binary files a/docs/figures/example-stress-sbend-competing-slots.png and /dev/null differ
diff --git a/docs/figures/example-terminal-bench-point-terminals.png b/docs/figures/example-terminal-bench-point-terminals.png
deleted file mode 100644
index ac742ac..0000000
Binary files a/docs/figures/example-terminal-bench-point-terminals.png and /dev/null differ
diff --git a/docs/figures/example-terminal-bench.png b/docs/figures/example-terminal-bench.png
deleted file mode 100644
index 73cbf10..0000000
Binary files a/docs/figures/example-terminal-bench.png and /dev/null differ
diff --git a/docs/figures/placed-crossing.png b/docs/figures/placed-crossing.png
index 604caa0..703b7da 100644
Binary files a/docs/figures/placed-crossing.png and b/docs/figures/placed-crossing.png differ
diff --git a/docs/routing-diagnostics.md b/docs/routing-diagnostics.md
index a723571..48fc4a2 100644
--- a/docs/routing-diagnostics.md
+++ b/docs/routing-diagnostics.md
@@ -1,14 +1,14 @@
# Routing diagnostics and metrics
-Use these reports to investigate a change in planner selection, coverage, or runtime. To troubleshoot a layout you want to route, start with the [user guide](user/tune-and-troubleshoot.md).
+Start with the symptom. For layout or option changes, use the [user troubleshooting guide](user/tune-and-troubleshoot.md).
## Automatic reports
-- **A net is missing.** Compare the verified count with `max_routed`. If the count falls short of the bound, read `stages` for skipped or locked nets and look for the attempt where coverage stopped increasing. To see a run that reaches its bound of three routes out of four, try the [overloaded-gate benchmark](benchmarks.md#run-a-benchmark).
+- **A net is missing.** Compare the verified count with `max_routed`. In `overloaded-gate`, `capacity_limit.cut_x` locates the cut that fits three of four requested routes. Below the bound, read `stages` for skipped or locked nets and for the attempt where coverage stopped increasing. [Run the overloaded-gate fixture](benchmarks.md#run-a-benchmark)
-- **The chosen route changed.** Start at `stages[selected_stage]`. The `planner` identifies the source of the proposal and `mode` identifies the worker, so a bundle seed can be checked by an `off` worker. Use `planner_rejections` for constructive candidates that never reached selection.
+- **The chosen route changed.** Start at `stages[selected_stage]`. The `planner` identifies the source of the proposal and `mode` identifies the worker, so a bundle seed can be checked by an `off` worker. Use `planner_rejections` for constructive candidates that never reached selection. [Report definitions](../inire/results.py)
-- **The run slowed down.** Group exclusive `timings` by policy and operation, including failed attempts. `duration_s` also includes orchestration. Use `run.metrics` and stage data for work across attempts. Detailed traces, corridor reports, and expanded states describe the selected attempt when present.
+- **The run slowed down.** Group exclusive `timings` by policy and operation, including failed attempts. `duration_s` also includes orchestration. Detailed traces, corridor reports, and expanded states describe the selected attempt when present. Check `run.metrics` and stage data for work across attempts. [Benchmark profiles](benchmarks.md#choose-a-profile)
## Route metrics
@@ -22,7 +22,7 @@ Pair each counter with a question about the work. Use a repeated wall-time compa
| Refinement takes longer | Compare `refinement_windows_considered`, `refinement_candidates_verified`, and `refinement_candidates_accepted`. Check whether the added windows buy a better path before enlarging the default budget. |
| Attempts reach targets while verified coverage stays flat | Compare `iteration_conflict_edges` and `nets_carried_forward`. Inspect pair-local attempts and accepts after congestion stops. `pair_local_search_nodes_expanded` counts searches that returned a locally valid pair, so consult the attempt count to see failed searches. |
-`nets_routed` and `nets_reached_target` count attempts. Use `result.is_valid` or `verified_net_ids` to count final successes. Duration counters ending in `_total_ns` can vary between identical runs. For the full field list, see the [`RouteMetrics` definition](../inire/results.py).
+`nets_routed` and `nets_reached_target` count attempts. To count final successes use `result.is_valid` or `verified_net_ids`. Fields ending in `_total_ns` measure durations and can vary between identical runs. Use the counter schema for exact field names and the example snapshot to investigate earlier observations. [Counter schema](../inire/results.py) · [Historical example snapshot](../archive/routing/performance.md) · [Snapshot JSON](../archive/routing/performance_baseline.json)
## Traces
@@ -31,34 +31,25 @@ Enable the `DiagnosticsOptions` flag for the question you want to answer.
| Question | Flag and result |
| --- | --- |
| Which net consumed an iteration's budget? | `capture_iteration_trace` records `iteration_trace`. Inspect per-net `net_attempts` for expansions, pruning, congestion calls, and seed usage. |
-| Which two routes overlap after re-verification? | `capture_conflict_trace` records the conflicting net IDs and the indices of their overlapping path components. |
+| Which two routes overlap after re-verification? | `capture_conflict_trace` records `conflict_trace`. Use the dynamic conflict edges to find the pair and the component indices to locate the overlap. |
| What pruning occurred near the final overlap? | `capture_frontier_trace` records `frontier_trace` for reached-but-colliding nets. Inspect the states and prune reasons sampled in that area. The diagnostic replay leaves the selected route fixed. |
| What did the last unresolved iteration hand to pair-local repair? | `capture_pre_pair_frontier_trace` records `pre_pair_frontier_trace`. Check reroute order, conflict edges, and per-net attempt work immediately before repair. |
| Where did the router explore? | `capture_expanded` records `expanded_nodes` for plotting. See the [fan-out example](../examples/07_large_scale_routing.py). |
-### Find overlapping components
-
-1. Enable `capture_conflict_trace` in the run's `DiagnosticsOptions`. In the returned `run.conflict_trace`, use the entry whose `stage` is `"final"` to inspect the paths the run returned.
-2. Find the two net IDs in `conflict_edges`. In the matching `nets` entry, read `component_conflicts` for `self_component_index`, `other_net_id`, and `other_component_index`.
-3. Index each net's `path` in `run.results_by_net` using those zero-based indices. Plot the components' `physical_geometry` on the board and check their spacing against the required clearance. See whether both components compete for the same opening.
-
-For an earlier stage such as `restored_best`, read the net and component indices from that entry. The final paths may have changed during repair.
-
### Follow a late conflict into pair-local repair
-Capture the conflict trace for fan-out with warm starts disabled. The best congestion iteration leaves two disjoint pairs of nets competing for space.
+Capture the no-warm-start fan-out scenario from the repository root.
```sh
-python -m scripts.record_conflict_trace \
- --scenario example_07_large_scale_routing_no_warm_start \
- --output-dir /tmp/inire-trace
+python -m scripts.record_iteration_trace --scenario example_07_large_scale_routing_no_warm_start \
+ --include-performance-only --output-dir /tmp/inire-trace
```
-1. Open `conflict_trace.json` and find `restored_best`. Six nets are complete and the conflict edges are `net_02` with `net_03` and `net_06` with `net_07`. For example, the entry for `net_02` reports that its component 1 overlaps component 1 of `net_03`. See the stage summary in the [recorded conflict trace](../archive/routing/conflict_trace.md#example_07_large_scale_routing_no_warm_start).
-2. Compare with `final`. All ten nets verified and the conflict edges are empty. The staged trace shows that repair resolved conflicts remaining after the congestion iterations.
-3. To compare expansions and congestion work in the iterations leading up to repair, substitute `scripts.record_iteration_trace` in the command. If you need the reroute order and per-net work immediately before repair, substitute `scripts.record_pre_pair_frontier_trace` and compare with the [recorded pre-pair trace](../archive/routing/pre_pair_frontier_trace.md).
+1. Open the generated `iteration_trace.md`. Compare the last iteration's completed count and conflict edges with the final result summary. In the recorded example, the last iteration had six completed nets and two conflict edges.
+2. Inspect the final result and pair-local counters in `iteration_trace.json`. All ten nets verified after repair in the recorded run. The last congestion iteration alone misses this improvement.
+3. To see which paths overlapped, capture the same scenario with `scripts.record_conflict_trace`. Compare `restored_best` with `final`. Use the pre-pair trace to investigate reroute order and per-net work before repair. [Recorded iteration trace](../archive/routing/iteration_trace.md#example_07_large_scale_routing_no_warm_start) · [Conflict trace](../archive/routing/conflict_trace.md) · [Pre-pair trace](../archive/routing/pre_pair_frontier_trace.md)
-Use the returned result to count final successes. For live progress during routing, pass an [`iteration_callback`](user/api-reference.md#route-a-problem).
+Use an `iteration_callback` for live progress across automatic attempts and the final result for coverage. [Callback API](user/api-reference.md#route-a-problem)
## Reproduce and compare
@@ -73,10 +64,6 @@ python -m scripts.routing_benchmark_parity capture /tmp/routing-after.json --cas
python -m scripts.routing_benchmark_parity compare /tmp/routing-before.json /tmp/routing-after.json
```
-Select a built-in trace case by name with `--scenario`. Use `--output-dir` to write the capture in a scratch directory.
+Use `scripts.record_iteration_trace` and `scripts.record_pre_pair_frontier_trace` to inspect a late conflict. Use `scripts.record_conflict_trace` and `scripts.record_frontier_trace` to locate an overlap and inspect rejected moves near it. Pass `--output-dir /tmp/inire-trace` for a scratch capture. The trace writers support `--scenario` for an individual built-in case and `--include-performance-only` for the heavier cases.
-### Check timing and counters
-
-- Run the isolated timing gates with `INIRE_RUN_PERFORMANCE=1 python -m pytest -q inire/tests/test_example_performance.py`.
-- Record a snapshot with `python -m scripts.record_performance_baseline --output-dir /tmp/inire-baseline`. For the resulting coverage, timing, and counter summary, see the [example baseline](../archive/routing/performance.md).
-- Compare a fresh run with `python -m scripts.diff_performance_baseline`. Use `--metric` to focus on specific work or `--baseline` to override the [default baseline JSON](../archive/routing/performance_baseline.json).
+For isolated timing gates, run `INIRE_RUN_PERFORMANCE=1 python -m pytest -q inire/tests/test_example_performance.py`. Use `scripts.record_performance_baseline` with `--output-dir` to record a snapshot. Use `scripts.diff_performance_baseline` to compare a fresh run with the archived baseline, or pass `--baseline` to select a different snapshot. Use `--metric` to select counters. [Routing development archive](../archive/routing/README.md)
diff --git a/docs/topological-routing.md b/docs/topological-routing.md
index 1e25cb8..5fcb57d 100644
--- a/docs/topological-routing.md
+++ b/docs/topological-routing.md
@@ -2,46 +2,32 @@
# Topological routing
-Guide mode helps detailed search choose a passage through free space. Seed mode also tries to build a physical path through the passage before detailed search starts.
+Guide mode suggests routes through connected free space. Seed mode also tries to realize those suggestions as physical paths. [Run corridor benchmarks](benchmarks.md#compare-routing-modes)
## Corridor planning and realization

-In offset gates, a route must change height between two openings. Read the panels from top to bottom. The highlighted triangle edges show the chosen portals, the dashed line joins the suggested crossing points, and the solid S-bend shows where detailed search fits a physical turn.
+The offset-gates fixture has two openings at different heights. The mesh highlights the portals used by the chosen corridor. The dashed lane remains angular, while detailed guide-mode search fits an S-bend between the openings. [Reproduce the mode comparison](benchmarks.md#compare-routing-modes)
-1. **Find connected space for centerlines.** Inset the board by half the widest net's width and expand obstacles by that half-width plus clearance. A short lead tries to attach each terminal to the constrained Delaunay mesh along its heading. The common padding can exclude passages that a narrower net can still use in lattice search.
+1. **Find connected space for centerlines.** Inset the board by half the widest net's width and expand obstacles by that half-width plus clearance. Shared edges of a constrained Delaunay triangulation act as portals. A short lead tries to attach each terminal to the mesh along its heading. Using the widest net gives the planner a common representation. Narrower nets may still find a path in lattice search through a passage this mesh excludes.
+2. **Choose a passage and a lane.** Rank portal sequences by distance, occupancy, and estimated overflow. Use lane samples and estimated turn room to select where to cross each portal without crowding another net's access. A different lane through the same portal can make space for a turn. Joint retries use that distinction to revise a shared passage assignment.
+3. **Turn the sketch into a path.** Guide mode adds soft costs and move suggestions, so detailed search can leave an awkward corridor. Seed mode first tries to find a physical path inside a corridor and verifies it against obstacles and earlier seeds. It gives the first corridor at least half the per-net budget when there are alternatives. Later detailed iterations can move an incumbent or try another guide. Final verification checks the actual routed geometry.
-
+## When a corridor does not lead to a route
- A portal is an edge shared by adjacent free-space triangles. For an earlier representation of a route by its crossings of triangle edges, see Section III-A and Figure 1 of [Hama and Etoh's curvilinear detailed-routing paper](https://www.cecs.uci.edu/~papers/compendium94-03/papers/1998/aspdac98/pdffiles/06c_3.pdf).
+- **No corridor reported.** Inspect `run.topology` from an explicit guide or seed run. Check snapped port access, mesh padding, and which passages remain connected.
+- **A corridor exists but seed search stalls.** Check terminal headings and the turn room around each chosen portal.
+- **Seeds reach their targets and the final routes overlap.** Inspect lane order and congestion before adding seed nodes. [Mesh and lane allocation](../inire/router/_topology.py) · [Trace guide](routing-diagnostics.md#traces)
-2. **Choose a passage and a lane.** Rank portal sequences by distance, occupancy, and estimated overflow. Along each chosen portal, sample crossing points and rank them by turn room and access reserved for other nets. A joint retry can move nets to different lanes through the same opening to make room for a turn. To change how candidate points are ranked, inspect [`assign_lanes()`](../inire/router/_topology.py#L214).
+For the design background on routing through shared triangle edges and on constraints specific to photonic waveguides, see the earlier detailed-routing work. [Curvilinear detailed routing](https://websrv.cecs.uci.edu/~papers/compendium94-03/papers/1998/aspdac98/pdffiles/06c_3.pdf) · [LiDAR 2.0](https://scopex-asu.github.io/files/publications/PD_TCAD2025_LiDARv2.pdf)
-3. **Turn the sketch into a path.** Guide mode uses the corridor to suggest moves and add a soft cost, so search can leave it to make a turn. Seed mode first searches inside a corridor and checks any seed against obstacles and earlier seeds. With alternatives, the first corridor gets at least half the per-net seed budget. Later detailed iterations can move an incumbent or use another guide. Final verification checks the installed geometry.
+## Moved benchmark sections
- A passage can be connected in the mesh and leave too little room to bend onto the target port's heading. For the bend-radius and port-alignment rules that constrain the physical route, see Section II-B of [LiDAR 2.0](https://arxiv.org/html/2505.17239v1#S2.SS2).
-
-
-
-## Diagnose a missing or colliding route
-
-In an explicit guide or seed run, check `run.topology.corridor_counts` and `seeded_net_ids` when the worker returns a topology report.
-
-- **No corridor is reported for the net.** Check that the snapped port can launch into free space along its heading. Inspect the keepouts and the padding at the suspected opening to see whether that passage is connected in the mesh.
-- **A corridor exists and the path stops short.** Look at the next turn from the end of the partial path. Compare the available space with the allowed radii and arrival heading. If the geometry fits, vary the [per-net seed budget](user/api-reference.md#topologyoptions) and compare whether seed mode reaches the target.
-- **The paths reach their ports and overlap.** Use the [conflict trace](routing-diagnostics.md#find-overlapping-components) to identify the nets and the overlapping components. Locate those components on the board. If both nets compete for the same opening, inspect their lane order and available turn room before increasing the seed budget.
-
-
-
-## Reproduce a routing comparison
-
-
-
-On offset gates, guide and seed can finish at the same cost. To see whether the seed saves search work at a shared node budget, compare expansions and seeded IDs in the [matched-budget example](benchmarks.md#compare-routing-modes).
-
-### Benchmark fixtures and prior runs
-
-- To repeat the comparison on a different geometry, pick a layout from the [benchmark case guide](benchmarks.md#choose-a-case).
-- For pinned inputs and regeneration commands, see the [Terminal-Bench and imported fixtures](benchmark-fixtures.md).
-- For measured changes to probe limits or retry order and the commands that produced them, see the [prior experiments](benchmark-results.md#near-port-probe-and-retry-experiments).
+- [Choose a benchmark case](benchmarks.md#choose-a-case)
+- [Compare routing modes](benchmarks.md#compare-routing-modes)
+- [Probe and retry measurements](benchmark-results.md#near-port-probe-and-retry-experiments)
+- [Early and late retries](benchmark-results.md#early-and-late-retries)
+- [Reproduce Terminal-Bench routing](benchmark-fixtures.md#automatic-nine-net-terminal-bench-routing)
+- [Sources and regeneration](benchmark-fixtures.md#imported-fixtures)
+- [Find the archived measurements and scripts](benchmark-results.md#experiment-archive)
diff --git a/docs/user/api-reference.md b/docs/user/api-reference.md
index a6abd96..0001e5c 100644
--- a/docs/user/api-reference.md
+++ b/docs/user/api-reference.md
@@ -1,6 +1,6 @@
# Public API reference
-Import these types from `inire`. To see how the inputs fit together in a runnable design, start with the [layout guide](route-a-layout.md#define-the-inputs).
+Import the types on this page from `inire`. The [layout guide](route-a-layout.md) shows how to assemble a problem and the [tuning guide](tune-and-troubleshoot.md) explains which settings to try.
## Route a problem
@@ -12,27 +12,22 @@ Omitting `options` uses `RoutingOptions()`. To observe live congestion iteration
## Layout inputs
-### Ports and nets
-
-- `Port(x, y, r)` snaps coordinates to the integer grid and normalizes the heading `r` in degrees. Heading 0 points east and 90 points north. The heading must be a multiple of 90 after rounding.
+- `Port(x, y, r)` snaps coordinates to the integer grid and normalizes the heading in degrees. Heading 0 points east and 90 points north. The heading must be a multiple of 90 after rounding.
- `NetSpec(net_id, start, target, width=2.0)` uses a unique ID and two ports. The target heading is the direction of arrival.
+- `RoutingProblem` describes one routing layer. Use one unit for distances, coordinates, widths, and radii.
-### RoutingProblem
-
-The fields below appear in constructor order. Use one layout unit for coordinates, widths, distances, and radii.
-
-| Field | Default | Meaning |
-| --- | --- | --- |
-| `bounds` | Required | Board rectangle as `(xmin, ymin, xmax, ymax)`. |
-| `nets` | `()` | Sequence of `NetSpec` objects with unique IDs. |
-| `static_obstacles` | `()` | Shapely polygons that define keepouts. |
-| `initial_paths` | Empty mapping | Net IDs mapped to `PathSeed` objects. |
-| `clearance` | `2.0` | Required spacing between physical shapes. |
-| `safety_zone_radius` | `0.0021` | Tolerance for very small obstacle intersections at ports during search. |
+| Input | Meaning |
+| --- | --- |
+| `bounds` | Board outline as `(xmin, ymin, xmax, ymax)`. |
+| `nets` | `NetSpec(net_id, start, target, width=2.0)` objects with unique IDs and `Port(x, y, r)` terminals. Defaults to an empty tuple. |
+| `static_obstacles` | Shapely polygons for keepouts. Defaults to an empty tuple. |
+| `initial_paths` | Mapping from net IDs to `PathSeed` objects. Defaults to an empty mapping. |
+| `clearance` | Required spacing between physical shapes. Defaults to `2.0`. |
+| `safety_zone_radius` | Tolerance for very small obstacle intersections at ports during search. Defaults to `0.0021`. |
## Path seeds
-`PathSeed(segments)` holds an ordered tuple of `StraightSeed(length)`, `Bend90Seed(radius, direction)`, and `SBendSeed(offset, radius)` moves. Bend directions are `"CW"` and `"CCW"`. A seed is materialized from the net's current start port using its width and the run's geometry options. For a workflow that starts from an existing route, see [Reuse an existing route](route-a-layout.md#reuse-an-existing-route).
+`PathSeed(segments)` holds an ordered tuple of `StraightSeed(length)`, `Bend90Seed(radius, direction)`, and `SBendSeed(offset, radius)` moves. Bend directions are `"CW"` and `"CCW"`. A seed is materialized from the net's current start port using its width and the run's geometry options. [Seed and lock workflows](route-a-layout.md#reuse-an-existing-route)
## Results
@@ -41,13 +36,12 @@ The fields below appear in constructor order. Use one layout unit for coordinate
| `RoutingRunResult.results_by_net` | A mapping from net ID to `RoutingResult`. |
| `RoutingResult.is_valid` and `outcome` | Final validity and a status of `completed`, `colliding`, `partial`, or `unroutable`. |
| `RoutingResult.path` | Ordered path components from the source to the last reached state. An unroutable result has an empty path. |
-| `RoutingResult.reached_target` | Whether the path reached the target port with its required heading. |
-| `RoutingResult.report` | `total_length` in layout units plus static, dynamic, and self-collision counts. `out_of_bounds` records a board containment failure when checked. |
+| `RoutingResult.reached_target` and `report` | Arrival status, physical length, and collision details. |
| `RoutingResult.locked_geometry` and `as_seed()` | Physical polygons for export or fixed obstacles, and the move sequence for reuse as a seed. |
| `RoutingRunResult.automatic` | In automatic mode, the selected planner, verified IDs, stage history, and any capacity or port-conflict bound. `None` for explicit modes. |
| `RoutingRunResult.topology` and `metrics` | Corridor counts and seed work when reported by the selected worker, plus work counters across the run. |
-To read a route's polygons and write them to a test file, follow the [geometry export steps](route-a-layout.md#export-verified-geometry).
+See [how to read the result](tune-and-troubleshoot.md#read-the-result) for export checks and [developer diagnostics](../routing-diagnostics.md) for reports and traces.
## Options and defaults
@@ -115,8 +109,6 @@ Increase the iteration limit when later reroutes might resolve conflicts. Adjust
### TopologyOptions
-For a layout that repeatedly stops short at an opening, `guide` can suggest a passage while letting search choose where to turn. To compare this with realizing a physical starting path in `seed`, see the [routing mode choices](tune-and-troubleshoot.md#choose-a-routing-mode).
-
| Field | Default | Effect |
| --- | --- | --- |
| `mode` | `"automatic"` | Select a [routing mode](tune-and-troubleshoot.md#choose-a-routing-mode). |
@@ -129,14 +121,4 @@ For a layout that repeatedly stops short at an opening, `guide` can suggest a pa
### DiagnosticsOptions
-The flags default to `False`.
-
-| Flag | Use it to |
-| --- | --- |
-| `capture_expanded` | Plot the states explored by search. |
-| `capture_iteration_trace` | Attribute search work to individual nets and iterations. |
-| `capture_conflict_trace` | Find overlapping pairs of routes. |
-| `capture_frontier_trace` | Examine pruning near a final overlap. |
-| `capture_pre_pair_frontier_trace` | Inspect the routing state before pair-local repair. |
-
-For the corresponding result fields and a worked trace, see the [developer diagnostics](../routing-diagnostics.md#traces).
+The flags default to `False`. Use `capture_expanded` to plot explored states or `capture_iteration_trace` to attribute search work per net and iteration. For clearance conflicts, `capture_conflict_trace` reports overlapping pairs, `capture_frontier_trace` examines prunes near final hotspots, and `capture_pre_pair_frontier_trace` examines the state before pair-local repair. [Trace fields and examples](../routing-diagnostics.md#traces)
diff --git a/docs/user/route-a-layout.md b/docs/user/route-a-layout.md
index 9e0f7d6..aeaa6f7 100644
--- a/docs/user/route-a-layout.md
+++ b/docs/user/route-a-layout.md
@@ -1,14 +1,14 @@
# Route a layout
-To get a result you can experiment with, run the [single-net quick start](../../README.md#route-a-net). To route your own design, set up the board and connections in the order below.
+Start with the [first route](../../README.md#route-a-net), then replace the example ports and add your layout's constraints.
## Define the inputs
1. **Choose a coordinate unit.** Inire snaps port coordinates to an integer grid. Choose a unit fine enough to preserve narrow gaps, and use it for widths, radii, clearance, and bounds too.
2. **Set source and target headings.** Heading 0 points east and 90 points north. The source heading points along the launch. The target heading points along the arrival. If your device library labels the target port with its outward heading, reverse it by 180 degrees.
-3. **Add a net for each connection.** Give each `NetSpec` a unique ID and the guide width. Use your process's allowed bend radii in [`SearchOptions`](api-reference.md#searchoptions).
-4. **Set the board and keepouts.** Pass the board rectangle as `bounds`, Shapely polygons as `static_obstacles`, and the required physical spacing as `clearance`. For the defaults and accepted inputs, see [`RoutingProblem`](api-reference.md#routingproblem).
-5. **Route and check.** Call `route(problem, options=options)` with automatic mode for a general layout. Before exporting, [check each net's result](tune-and-troubleshoot.md#read-the-result).
+3. **Add a net for each connection.** Give each `NetSpec` a unique ID and the guide width. Set your process limits through `SearchOptions` and choose the required clearance on `RoutingProblem`.
+4. **Add keepouts.** Supply Shapely polygons in `static_obstacles` and use `bounds` for the board rectangle. Leave enough access at the ports for the guide and its permitted bends. [Input fields](api-reference.md#layout-inputs)
+5. **Run and check.** Call `route(problem, options=options)` and check each `result.is_valid`. Start with automatic mode for general layouts. [Read the result](tune-and-troubleshoot.md#read-the-result)
@@ -20,9 +20,9 @@ To get a result you can experiment with, run the [single-net quick start](../../

-The dashed outlines show the full footprints of crossings A and B. The shaded keepouts leave a port opening on each facing edge. The external waveguide leaves A at `(80, 75)` and enters B at `(260, 115)`. Both arrows point east.
+Dashed outlines show the complete device footprints. Shading shows the keepouts passed to Inire. The external route connects the two port markers. The arrow at each marker shows the heading.
-Each opening is 12 units wide. A straight approach of width 2 with clearance 4 on each side needs `2 + 2 * 4 = 10` units between keepout edges. Leave extra room for any turn near a port, and check the opening after snapping the port to the grid.
+Inire applies `clearance` around the supplied keepout polygons. A straight approach of width `w` between two keepout edges needs at least `w + 2 * clearance` of open width. Leave room for any turn near the port and check the opening after snapping the port to the grid.
```python
from shapely.geometry import box
@@ -57,61 +57,40 @@ problem = RoutingProblem(
search = SearchOptions(
bend_radii=(25,), sbend_radii=(25,),
)
-options = RoutingOptions(search=search)
-run = route(problem, options=options)
+opts = RoutingOptions(search=search)
+run = route(problem, options=opts)
result = run.results_by_net[net_id]
assert result.is_valid
```
Before export, check the port joins and clearance against the actual placed-cell geometry. Inire verifies the external route against the keepouts you supplied.
-## Export verified geometry
-
-Use `result.locked_geometry` to pass a verified net's physical polygons to a layout writer. For a test file, continue from the quick start or the crossing example and write the polygons as WKT in the layout's coordinate unit.
-
-```python
-from pathlib import Path
-
-from shapely.geometry import GeometryCollection
-
-if not result.is_valid:
- raise ValueError(f"{result.net_id}: {result.outcome}")
-
-geometry = GeometryCollection(result.locked_geometry)
-Path("route.wkt").write_text(geometry.wkt + "\n", encoding="utf-8")
-```
-
-For a multi-net layout, apply the validity check to every net you intend to export. If a route is short or colliding, use its outcome to choose the [next troubleshooting check](tune-and-troubleshoot.md#read-the-result).
-
## Reuse an existing route
-- **Give the router a route it can move.** Put `result.as_seed()` in `initial_paths` under the net's ID. A seed uses the current start port, width, and geometry settings. A partial seed can suggest an approach. To build a hint from turns and straights, see the [path seed reference](api-reference.md#path-seeds).
+- **Give the router a route it can move.** Put `result.as_seed()` in `initial_paths` under the net's ID. A seed uses the current start port, width, and geometry settings. A partial seed can suggest an approach.
- **Hold a route fixed.** Add `result.locked_geometry` to `static_obstacles` while routing other nets. The next run applies its own clearance.
-Route a straight net, then use its polygons as keepouts in a second routing problem. The second net has to detour around one end of the fixed route.
+To reuse the verified routes from a first problem as fixed obstacles, add them to a second problem that contains the remaining nets.
```python
-from inire import (
- NetSpec, Port, RoutingOptions,
- RoutingProblem, SearchOptions, route,
-)
+from dataclasses import replace
+from inire import route
-bounds = (0, -50, 100, 50)
-options = RoutingOptions(search=SearchOptions(bend_radii=(10,)))
-first = RoutingProblem(
- bounds=bounds,
- nets=(NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0)),),
+first = route(first_problem)
+locked = tuple(
+ polygon
+ for result in first.results_by_net.values()
+ if result.is_valid
+ for polygon in result.locked_geometry
)
-fixed = route(first, options=options).results_by_net["fixed"]
-assert fixed.is_valid
-
-second = RoutingProblem(
- bounds=bounds,
- nets=(NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90)),),
- static_obstacles=fixed.locked_geometry,
+obstacles = (
+ next_problem.static_obstacles
+ + locked
)
-detour = route(second, options=options).results_by_net["detour"]
-assert detour.is_valid
+second = route(replace(
+ next_problem,
+ static_obstacles=obstacles,
+))
```
-To compare the two paths on a plot, see the [fixed-route example](../../examples/README.md#route-around-fixed-geometry).
+See the [locked-path example](../../examples/README.md#route-around-fixed-geometry) for the resulting detour and the [seed reference](api-reference.md#path-seeds) for building a hint by hand.
diff --git a/docs/user/tune-and-troubleshoot.md b/docs/user/tune-and-troubleshoot.md
index 7e103fc..3013a2c 100644
--- a/docs/user/tune-and-troubleshoot.md
+++ b/docs/user/tune-and-troubleshoot.md
@@ -1,27 +1,27 @@
# Tune and troubleshoot a route
-Start with the net's outcome. It tells you whether to examine the port approach, an overlap, or the search budget.
+Check whether the layout can fit the connection before spending more search time. Start with the per-net result and change one setting at a time.
## Read the result
| `result.outcome` | What to inspect |
| --- | --- |
-| `completed` | The path reached its target and passed verification. Read its length in `report.total_length` and follow the [geometry export steps](route-a-layout.md#export-verified-geometry). |
-| `colliding` | The path reached its target. Check the collision counts in `result.report` to see whether it overlaps a keepout, another route, or itself. For automatic routing, also check `report.out_of_bounds`. |
-| `partial` | Locate `result.path[-1].end_port` on the board and check the next turn and radius. If that approach fits, compare search limits. |
-| `unroutable` | The path is empty. Check the launch heading and room for the first straight or bend. |
+| `completed` | The path reached its target and passed verification. Use `locked_geometry` for physical polygons and `report.total_length` for length. |
+| `colliding` | The path reached its target. Read `report` for static, dynamic, or self-collisions and any automatic board containment failure. |
+| `partial` | Inspect where the path ends. Check the next turn, available radius, and search limit. |
+| `unroutable` | No path was returned. Check the launch heading and room for the first straight or bend. |
-Check `is_valid` before exporting. With explicit `off`, `guide`, or `seed` mode, also check that the physical polygons fit the board if your export requires containment. Automatic mode includes that check in candidate verification.
+Check `is_valid` before exporting. With explicit `off`, `guide`, or `seed` mode, also check that the physical polygons fit the board if your export requires containment. Automatic mode includes that check in candidate verification. [Result fields](api-reference.md#results)
## Why a net stopped short
-1. **Check whether automatic routing hit a bound.** Compare the verified count with `run.automatic.max_routed`. If the count reaches a bound below the requested total, use `capacity_limit` to locate the passage to widen or `port_conflicts` to find the ports to move.
-2. **Check the next approach.** Follow a partial route from its endpoint toward the target. Check the width, clearance, allowed turns, and final heading against the physical layout. When none of the allowed bends fits, change the port approach or the available space.
-3. **Compare two search limits.** If the geometry looks feasible, rerun with a larger `search.node_limit` and compare the path endpoint and verified count. The limit applies per search. One run can search the same net several times. Look up the default and related fields in [`SearchOptions`](api-reference.md#searchoptions).
+1. **Check for a geometric bound.** In an automatic run, `max_routed` is an upper bound. If it is below the requested count, read `capacity_limit` or `port_conflicts` to see where to widen a passage or move a port. A result below the bound can still leave feasible nets unfinished.
+2. **Check the port and turn geometry.** For static or self-collisions, inspect physical clearance and bend room. For dynamic collisions, inspect the routes that compete for the same space.
+3. **Check the search budget.** If the verified count is below the bound and the geometry looks feasible, try raising a small `search.node_limit`. The limit is per search. A run can try the same net several times.

-At three nodes per search the dashed path ends before the first keepout. At 500 the solid path clears the obstacles and reaches the target with the required westbound heading. To reproduce the comparison, change `node_limit` from 3 to 500 in a copy of the [best-effort example](../../examples/09_unroutable_best_effort.py).
+Both runs use the best-effort example's ports, obstacles, radii, and iteration settings. At three nodes per search, the dashed path stops before the obstacles. At 500, the solid path reaches the westbound target. [Runnable best-effort example](../../examples/09_unroutable_best_effort.py)
## Choose a routing mode
@@ -37,15 +37,15 @@ Set `TopologyOptions(mode=...)` and pass it as `topology` in `RoutingOptions`.
- Guide and seed modes require constrained triangulation from Shapely 2.1 with GEOS 3.10 or newer. Caller-supplied seeds take precedence, and nets without a corridor can use ordinary lattice search.
- Enable `infer_terminal_headings` for point terminals with flexible headings. Preserve fixed headings when a device requires a specific arrival direction.
-- In automatic mode, smaller initial budgets make the first attempts cheaper. If coverage remains below the bound, a lattice fallback can use your configured ceiling. Automatic also uses lattice for custom bend geometry or when constrained triangulation is unavailable.
+- In automatic mode, smaller initial budgets make the first attempts cheaper. If coverage remains below the bound, a lattice fallback can use your configured ceiling. Automatic also uses lattice for custom bend geometry or when constrained triangulation is unavailable. [Automatic stage order](../architecture.md#automatic-routing)
## Choose the next setting
| Observation | Next comparison |
| --- | --- |
-| Multiple routes reach their ports and collide with one another | Change `net_order` or `max_iterations` one at a time. Compare which nets remain unresolved. See the accepted values in [`CongestionOptions`](api-reference.md#congestionoptions). |
-| Valid routes use too many small bends | Increase `bend_penalty`. Compare bend counts and physical lengths to see whether a straighter path needs a longer detour. See [`ObjectiveWeights`](api-reference.md#objectiveweights). |
-| Refinement dominates runtime | Try `max_windows_per_net=1`. Compare runtime, cost, and verified paths before adopting the smaller limit. See [`RefinementOptions`](api-reference.md#refinementoptions). |
+| Multiple routes reach their ports and collide with one another | Try a different `congestion.net_order` or allow more `max_iterations`. Compare the unresolved IDs. |
+| Valid routes use too many small bends | Increase `objective.bend_penalty`. Compare bend counts and physical lengths to see whether a straighter path needs a longer detour. |
+| Refinement dominates runtime | Try `refinement.max_windows_per_net=1`. Compare the verified paths and cost before adopting the smaller limit. |
For a shorter refinement pass, derive the new settings from the `options` already used for the layout.
@@ -62,3 +62,5 @@ faster_refinement = replace(
)
run = route(problem, options=faster_refinement)
```
+
+[Option defaults](api-reference.md#options-and-defaults) · [Deeper diagnostics](../routing-diagnostics.md)
diff --git a/examples/03_locked_paths.py b/examples/03_locked_paths.py
index 987ba73..b00741f 100644
--- a/examples/03_locked_paths.py
+++ b/examples/03_locked_paths.py
@@ -1,4 +1,7 @@
-from inire import NetSpec, ObjectiveWeights, Port, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
+from inire import NetSpec, Port, RoutingOptions, RoutingProblem, SearchOptions
+from inire.router._astar_types import AStarContext
+from inire.router._router import PathFinder
+from inire.router._stack import build_routing_stack
from inire.utils.visualization import plot_routing_results
@@ -6,33 +9,34 @@ def main() -> None:
print("Running Example 03: Locked Paths...")
bounds = (0, -50, 100, 50)
- options = RoutingOptions(
- search=SearchOptions(bend_radii=(10.0,)),
- # Isolate the lattice detour and use the fixed net only for clearance checks.
- objective=ObjectiveWeights(danger_weight=0.0),
- topology=TopologyOptions(mode="off"),
- )
-
print("Routing initial net...")
- problem_a = RoutingProblem(
- bounds=bounds,
- nets=(NetSpec("netA", Port(10, 0, 0), Port(90, 0, 0)),),
+ stack = build_routing_stack(
+ problem=RoutingProblem(
+ bounds=bounds,
+ nets=(NetSpec("netA", Port(10, 0, 0), Port(90, 0, 0), width=2.0),),
+ ),
+ options=RoutingOptions(search=SearchOptions(bend_radii=(10.0,))),
)
- results_a = route(problem_a, options=options).results_by_net
- fixed = results_a["netA"]
- assert fixed.is_valid
+ engine = stack.world
+ evaluator = stack.evaluator
+ results_a = stack.finder.route_all()
print("Routing detour net around locked path...")
- problem_b = RoutingProblem(
- bounds=bounds,
- nets=(NetSpec("netB", Port(50, -20, 90), Port(50, 20, 90)),),
- static_obstacles=fixed.locked_geometry,
- )
- results_b = route(problem_b, options=options).results_by_net
- assert results_b["netB"].is_valid
+ for polygon in results_a["netA"].locked_geometry:
+ engine.add_static_obstacle(polygon)
+ results_b = PathFinder(
+ AStarContext(
+ evaluator,
+ RoutingProblem(
+ bounds=bounds,
+ nets=(NetSpec("netB", Port(50, -20, 90), Port(50, 20, 90), width=2.0),),
+ ),
+ RoutingOptions(search=SearchOptions(bend_radii=(10.0,))),
+ ),
+ ).route_all()
results = {**results_a, **results_b}
- fig, _ax = plot_routing_results(results, [], bounds)
+ fig, ax = plot_routing_results(results, [], bounds)
fig.savefig("examples/03_locked_paths.png")
print("Saved plot to examples/03_locked_paths.png")
diff --git a/examples/09_unroutable_best_effort.py b/examples/09_unroutable_best_effort.py
index bde5684..227f5bf 100644
--- a/examples/09_unroutable_best_effort.py
+++ b/examples/09_unroutable_best_effort.py
@@ -29,12 +29,13 @@ def main() -> None:
congestion=CongestionOptions(warm_start_enabled=False, max_iterations=1),
)
- print(f"Routing with a node limit of {options.search.node_limit} per search.")
+ print("Routing with a deliberately tiny node budget (should return a partial path)...")
run = route(problem, options=options)
result = run.results_by_net["budget_limited_net"]
- print(f"Outcome: {result.outcome}")
- if result.outcome == "partial":
- print(f"Partial path contains {len(result.path)} segments.")
+ if not result.reached_target:
+ print(f"Target not reached as expected. Partial path length: {len(result.path)} segments.")
+ else:
+ print("The route unexpectedly reached the target. Increase difficulty or reduce the node budget further.")
fig, _ax = plot_routing_results(
run.results_by_net,
diff --git a/examples/README.md b/examples/README.md
index 04c90b7..87f734b 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -1,6 +1,6 @@
# Routing examples
-After [installing Inire](../README.md#install), run the scripts from the repository root. They save PNGs in the examples directory by default.
+Run these scripts from the repository root after [installation](../README.md#install). Each script saves a PNG alongside its source.
```sh
python examples/01_simple_route.py
@@ -8,39 +8,28 @@ python examples/01_simple_route.py
## Start with a connection
-| Script | What to look for | Preview |
-| --- | --- | --- |
-| [Simple route](01_simple_route.py) | One path leaves and enters its ports travelling east. | [Quick-start figure](../README.md#route-a-net) |
-| [Port orientations](05_orientation_stress.py) | Perpendicular and opposing headings require different approaches, even for nearby ports. | [Port approaches](05_orientation_stress.png) |
+- [Simple route](01_simple_route.py) connects one pair of ports and checks validity. For copyable code and its plot, use the [README quick start](../README.md#route-a-net).
+- [Port orientations](05_orientation_stress.py) explores routes with perpendicular or opposing headings. [Plot](05_orientation_stress.png)
## Route around fixed geometry

-The second route loops around the left end of the fixed straight. To reproduce the detour, run [`03_locked_paths.py`](03_locked_paths.py). To supply your own fixed polygons, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route).
+The first route runs straight. The second must turn around its left end to reach the other side. Run the [locked-path example](03_locked_paths.py), or use the [public API workflow](../docs/user/route-a-layout.md#reuse-an-existing-route) to pass fixed polygons into another run.
## Fit bends to available room

-Follow the short offset to see a single S-bend. The larger shift has room for a pair of right-angle bends.
+The short path fits a small offset with an S-bend. The longer path has room for a pair of right-angle bends. Run [S-bends and radii](04_sbends_and_radii.py) to see both geometries.
-| Script | What to look for | Preview |
-| --- | --- | --- |
-| [S-bends and radii](04_sbends_and_radii.py) | The shapes used for a short offset and for a larger shift. | Compare the two paths in the figure above. |
-| [Bend proxies](06_bend_collision_models.py) | How an arc, a box proxy for an arc, and a custom physical bend affect the route. | [Bend model comparison](06_bend_collision_models.png) |
-| [Custom bends](08_custom_bend_geometry.py) | A route whose search proxy and physical bend use different polygons. | [Custom bend overlay](08_custom_bend_geometry.png) |
+- [Bend proxies](06_bend_collision_models.py) compares an arc, a box proxy for an arc, and a custom physical bend. [Plot](06_bend_collision_models.png)
+- [Custom bends](08_custom_bend_geometry.py) provides separate physical and proxy polygons. [Plot](08_custom_bend_geometry.png)
## Diagnose congestion or an incomplete route
-| Script | What to look for | Preview |
-| --- | --- | --- |
-| [Congestion resolution](02_congestion_resolution.py) | How rerouting separates nets competing for the same space. | [Separated routes](02_congestion_resolution.png) |
-| [Best-effort result](09_unroutable_best_effort.py) | Where a path stops with a small node budget. Try `node_limit=500` to complete it. | [Budget comparison](../docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short) |
-| [Fan-out](07_large_scale_routing.py) | How search states cluster around a bottleneck. The example adjusts the heuristic between iterations through the internal worker. | [Fan-out search overlay](07_large_scale_routing.png) |
+- [Congestion resolution](02_congestion_resolution.py) separates nets that compete for the same space. [Plot](02_congestion_resolution.png)
+- [Best-effort result](09_unroutable_best_effort.py) stops after a tiny search budget. Try `node_limit=500` and compare the two outcomes on the [troubleshooting page](../docs/user/tune-and-troubleshoot.md#why-a-net-stopped-short).
+- [Fan-out](07_large_scale_routing.py) overlays search states around a bottleneck. This advanced example adjusts the heuristic between iterations through the internal worker. [Plot](07_large_scale_routing.png)
-In the bend overlays, the dashed outline shows what search uses to screen candidate moves. The solid outline shows the physical bend you can measure for clearance. To interpret an incomplete or colliding path, read `result.outcome` using the [result guide](../docs/user/tune-and-troubleshoot.md#read-the-result).
-
-## Route a challenging layout
-
-Compare each board's inputs with its verified routes in the [advanced gallery](advanced.md). It covers mixed widths, competing passages, preplaced crossings, and both heading configurations of the nine-net Terminal-Bench board.
+In plots with a physical overlay, dashed outlines show search proxies and solid outlines show physical geometry. Use the physical outlines to inspect clearance and `result.outcome` to interpret red paths. [Result guide](../docs/user/tune-and-troubleshoot.md#read-the-result)
diff --git a/examples/advanced-layouts.json b/examples/advanced-layouts.json
deleted file mode 100644
index a13506c..0000000
--- a/examples/advanced-layouts.json
+++ /dev/null
@@ -1,253 +0,0 @@
-{
- "stress-refine-alternating-doglegs": {
- "bounds": [0, 0, 1080, 410],
- "clearance": 5,
- "bend_radii": [20, 24],
- "sbend_radii": [20],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((379 0, 379 238, 284 238, 284 0, 379 0))",
- "POLYGON ((682 139, 682 410, 594 410, 594 139, 682 139))"
- ],
- "nets": [
- ["track_0", [34, 147, 0], [1030, 173, 0], 2],
- ["track_1", [34, 164, 0], [1030, 190, 0], 4],
- ["track_2", [34, 181, 0], [1030, 207, 0], 3]
- ]
- },
- "stress-refine-return-shelf": {
- "bounds": [0, 0, 790, 480],
- "clearance": 5,
- "bend_radii": [20, 27],
- "sbend_radii": [20],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((502 320, 502 480, 428 480, 428 320, 502 320))",
- "POLYGON ((340 145, 340 168, 250 168, 250 145, 340 145))"
- ],
- "nets": [
- ["folded_return", [640, 155, 0], [555, 230, 0], 2],
- ["shelf_edge", [201, 272, 0], [595, 272, 0], 4],
- ["lower_return", [585, 178, 180], [64, 178, 180], 2],
- ["east_shelf", [675, 438, 180], [610, 438, 180], 2]
- ]
- },
- "stress-retry-straight-decoy": {
- "bounds": [0, 0, 760, 440],
- "clearance": 5,
- "bend_radii": [20],
- "sbend_radii": [20],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((15 222, 15 238, 0 238, 0 222, 15 222))",
- "POLYGON ((760 222, 760 238, 745 238, 745 222, 760 222))",
- "POLYGON ((282 114, 282 186, 216 186, 216 114, 282 114))",
- "POLYGON ((539 114, 539 199, 463 199, 463 114, 539 114))"
- ],
- "nets": [
- ["trunk", [25, 230, 0], [735, 230, 0], 4],
- ["branch_west", [326, 144, 90], [326, 339, 90], 2],
- ["branch_east", [398, 358, 270], [398, 170, 270], 3],
- ["lower_rail", [58, 79, 0], [708, 79, 0], 2]
- ]
- },
- "stress-retry-compact-shift-bank": {
- "bounds": [0, 0, 720, 720],
- "clearance": 5,
- "bend_radii": [20],
- "sbend_radii": [20],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((720 230, 720 242, 0 242, 0 230, 720 230))",
- "POLYGON ((720 389, 720 401, 0 401, 0 389, 720 389))",
- "POLYGON ((720 549, 720 561, 0 561, 0 549, 720 549))",
- "POLYGON ((202 96, 202 158, 113 158, 113 96, 202 96))",
- "POLYGON ((345 264, 345 298, 258 298, 258 264, 345 264))",
- "POLYGON ((447 426, 447 460, 337 460, 337 426, 447 426))",
- "POLYGON ((402 581, 402 616, 285 616, 285 581, 402 581))"
- ],
- "nets": [
- ["short", [45, 117, 0], [111, 202, 0], 3],
- ["middle", [33, 274, 0], [650, 347, 0], 4],
- ["upper", [56, 445, 0], [670, 513, 0], 2],
- ["top", [63, 598, 0], [630, 669, 0], 2]
- ]
- },
- "stress-retry-mixed-port-bank": {
- "bounds": [0, 0, 680, 540],
- "clearance": 5,
- "bend_radii": [20],
- "sbend_radii": [20],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((194 53, 194 131, 133 131, 133 53, 194 53))",
- "POLYGON ((498 221, 498 291, 452 291, 452 221, 498 221))",
- "POLYGON ((624 171, 624 230, 564 230, 564 171, 624 171))",
- "POLYGON ((190 185, 339 175, 353 218, 315 283, 199 290, 190 185))",
- "POLYGON ((348 302, 348 337, 256 337, 256 302, 348 302))",
- "POLYGON ((310 408, 310 443, 108 443, 108 408, 310 408))"
- ],
- "nets": [
- ["east_compact", [40, 75, 0], [115, 158, 0], 3],
- ["west_compact", [590, 261, 180], [516, 182, 180], 4],
- ["turning_exit", [290, 50, 90], [437, 113, 0], 2],
- ["upper_shift", [40, 315, 0], [450, 395, 0], 2],
- ["return", [535, 475, 180], [60, 475, 180], 2]
- ]
- },
- "stress-passage-width-key": {
- "bounds": [0, 0, 1210, 720],
- "clearance": 5,
- "bend_radii": [20],
- "sbend_radii": [20],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((492 0, 492 246, 440 246, 440 0, 492 0))",
- "POLYGON ((492 260, 492 340, 440 340, 440 260, 492 260))",
- "POLYGON ((492 443, 492 720, 440 720, 440 443, 492 443))"
- ],
- "nets": [
- ["lane_0", [1190, 498, 180], [30, 64, 180], 2],
- ["lane_1", [30, 81, 0], [1190, 515, 0], 7],
- ["lane_2", [1190, 533, 180], [30, 99, 180], 4],
- ["lane_3", [30, 118, 0], [1190, 551, 0], 8],
- ["lane_4", [30, 135, 0], [1190, 569, 0], 5],
- ["lane_5", [1190, 587, 180], [30, 153, 180], 6]
- ]
- },
- "stress-passage-split-merge": {
- "bounds": [0, 0, 1710, 880],
- "clearance": 5,
- "bend_radii": [20],
- "sbend_radii": [20],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((470 0, 470 243, 422 243, 422 0, 470 0))",
- "POLYGON ((470 293, 470 374, 422 374, 422 293, 470 293))",
- "POLYGON ((470 439, 470 880, 422 880, 422 439, 470 439))",
- "POLYGON ((982 0, 982 523, 930 523, 930 0, 982 0))",
- "POLYGON ((982 618, 982 880, 930 880, 930 618, 982 618))"
- ],
- "nets": [
- ["lane_0", [1670, 679, 180], [30, 53, 180], 3],
- ["lane_1", [30, 70, 0], [1670, 697, 0], 5],
- ["lane_2", [30, 87, 0], [1670, 716, 0], 2],
- ["lane_3", [1670, 734, 180], [30, 105, 180], 4],
- ["lane_4", [30, 123, 0], [1670, 752, 0], 6],
- ["lane_5", [1670, 772, 180], [30, 141, 180], 3]
- ]
- },
- "stress-sbend-competing-slots": {
- "bounds": [0, 0, 450, 320],
- "clearance": 4,
- "bend_radii": [25],
- "sbend_radii": [25],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((120 130, 120 135, 104 135, 104 130, 120 130))",
- "POLYGON ((358 166, 358 154, 370 154, 370 140, 356 140, 356 152, 344 152, 344 140, 330 140, 330 154, 342 154, 342 166, 330 166, 330 180, 344 180, 344 168, 356 168, 356 180, 370 180, 370 166, 358 166))"
- ],
- "nets": [
- ["lower_east", [35, 112, 0], [235, 132, 0], 3],
- ["upper_west", [235, 141, 180], [35, 121, 180], 3],
- ["south_access", [330, 52, 90], [350, 146, 90], 2],
- ["north_access", [350, 174, 90], [330, 284, 90], 2]
- ]
- },
- "stress-crossing-off-lattice-slot": {
- "bounds": [0, 0, 500, 460],
- "clearance": 4,
- "bend_radii": [6, 15],
- "sbend_radii": [25],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((268 236, 268 224, 280 224, 280 210, 266 210, 266 222, 254 222, 254 210, 240 210, 240 224, 252 224, 252 236, 240 236, 240 250, 254 250, 254 238, 266 238, 266 250, 280 250, 280 236, 268 236))",
- "POLYGON ((273 272, 273 317, 245 317, 245 272, 273 272))",
- "POLYGON ((176 193, 176 214, 145 214, 145 193, 176 193))"
- ],
- "nets": [
- ["west_odd_shift", [34, 213, 0], [246, 230, 0], 2],
- ["east_exact_shift", [274, 230, 0], [465, 250, 0], 2],
- ["north_pocket", [260, 244, 90], [260, 429, 90], 3],
- ["south_exact_shift", [240, 30, 90], [260, 216, 90], 2]
- ]
- },
- "stress-crossings-shared-outside-detour": {
- "bounds": [0, 0, 625, 397],
- "clearance": 4,
- "bend_radii": [20],
- "sbend_radii": [25],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((228 186, 228 174, 240 174, 240 160, 226 160, 226 172, 214 172, 214 160, 200 160, 200 174, 212 174, 212 186, 200 186, 200 200, 214 200, 214 188, 226 188, 226 200, 240 200, 240 186, 228 186))",
- "POLYGON ((363 186, 363 174, 375 174, 375 160, 361 160, 361 172, 349 172, 349 160, 335 160, 335 174, 347 174, 347 186, 335 186, 335 200, 349 200, 349 188, 361 188, 361 200, 375 200, 375 186, 363 186))",
- "POLYGON ((415 69, 415 81, 160 81, 160 69, 415 69))",
- "POLYGON ((144 216, 144 261, 102 261, 102 216, 144 216))"
- ],
- "nets": [
- ["west_link", [32, 160, 0], [206, 180, 0], 2],
- ["device_link", [234, 180, 0], [341, 180, 0], 2],
- ["east_link", [369, 180, 0], [581, 200, 0], 2],
- ["west_south", [220, 87, 90], [220, 166, 90], 2],
- ["east_south", [355, 166, 270], [355, 90, 270], 2],
- ["west_north", [220, 194, 90], [200, 317, 90], 2],
- ["east_north", [375, 315, 270], [355, 194, 270], 2],
- ["outside_lower", [35, 130, 0], [590, 130, 0], 4],
- ["outside_upper", [589, 353, 180], [33, 353, 180], 2]
- ]
- },
- "terminal-bench": {
- "bounds": [0, 0, 2500, 1000],
- "clearance": 6.0,
- "bend_radii": [50.0],
- "sbend_radii": [50.0],
- "infer_terminal_headings": false,
- "keepouts": [
- "POLYGON ((550 80, 550 480, 450 480, 450 80, 550 80))",
- "POLYGON ((550 520, 550 920, 450 920, 450 520, 550 520))",
- "POLYGON ((2010 130, 2010 491.5, 1910 491.5, 1910 130, 2010 130))",
- "POLYGON ((2010 510, 2010 851.5, 1910 851.5, 1910 510, 2010 510))",
- "POLYGON ((1040 680, 1040 983, 940 983, 940 680, 1040 680))",
- "POLYGON ((1080 50, 1080 475, 980 475, 980 50, 1080 50))",
- "POLYGON ((1537 18, 1537 620, 1350 620, 1350 18, 1537 18))"
- ],
- "nets": [
- ["net_00", [12, 460, 0], [2412, 150, 0], 2.0],
- ["net_01", [12, 470, 0], [2412, 250, 0], 2.0],
- ["net_02", [12, 480, 0], [2412, 350, 0], 2.0],
- ["net_03", [12, 490, 0], [902, 900, 0], 2.0],
- ["net_04", [12, 500, 0], [2412, 500, 0], 2.0],
- ["net_05", [12, 510, 0], [2412, 650, 0], 2.0],
- ["net_06", [12, 520, 0], [2412, 750, 0], 2.0],
- ["net_07", [12, 530, 0], [2412, 850, 0], 2.0],
- ["net_08", [12, 450, 0], [1112, 991, 0], 2.0]
- ]
- },
- "terminal-bench-point-terminals": {
- "bounds": [0, 0, 2500, 1000],
- "clearance": 6.0,
- "bend_radii": [50.0],
- "sbend_radii": [50.0],
- "infer_terminal_headings": true,
- "keepouts": [
- "POLYGON ((550 80, 550 480, 450 480, 450 80, 550 80))",
- "POLYGON ((550 520, 550 920, 450 920, 450 520, 550 520))",
- "POLYGON ((2010 130, 2010 491.5, 1910 491.5, 1910 130, 2010 130))",
- "POLYGON ((2010 510, 2010 851.5, 1910 851.5, 1910 510, 2010 510))",
- "POLYGON ((1040 680, 1040 983, 940 983, 940 680, 1040 680))",
- "POLYGON ((1080 50, 1080 475, 980 475, 980 50, 1080 50))",
- "POLYGON ((1537 18, 1537 620, 1350 620, 1350 18, 1537 18))"
- ],
- "nets": [
- ["net_00", [12, 460, 0], [2412, 150, 0], 2.0],
- ["net_01", [12, 470, 0], [2412, 250, 0], 2.0],
- ["net_02", [12, 480, 0], [2412, 350, 0], 2.0],
- ["net_03", [12, 490, 0], [902, 900, 0], 2.0],
- ["net_04", [12, 500, 0], [2412, 500, 0], 2.0],
- ["net_05", [12, 510, 0], [2412, 650, 0], 2.0],
- ["net_06", [12, 520, 0], [2412, 750, 0], 2.0],
- ["net_07", [12, 530, 0], [2412, 850, 0], 2.0],
- ["net_08", [12, 450, 0], [1112, 991, 0], 2.0]
- ]
- }
-}
diff --git a/examples/advanced.md b/examples/advanced.md
deleted file mode 100644
index 45fe5ca..0000000
--- a/examples/advanced.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# Advanced routing examples
-
-These layouts exercise the same geometry as the stress tests and the nine-net Terminal-Bench cases. Each run starts with the board, keepouts, and ports. Inire computes all the plotted paths from those inputs.
-
-- [Competing passages](#competing-passages) for mixed widths and opposing headings.
-- [Bend and return room](#bend-and-return-room) for alternating detours, short shifts, and branches.
-- [Placed crossings](#placed-crossings) for access slots and external detours.
-- [Nine-net Terminal-Bench board](#nine-net-terminal-bench-board) for fixed and inferred headings on the same input.
-
-## Run a layout
-
-Select a case by its name below. Repeat `--case` to draw several layouts, or omit it to draw all twelve.
-
-```sh
-python examples/advanced_layouts.py \
- --case stress-crossings-shared-outside-detour \
- --case terminal-bench \
- --output-dir /tmp/inire-advanced-routes
-```
-
-The [input file](advanced-layouts.json) gives each board's bounds, polygon keepouts in WKT, clearance, and allowed bend and S-bend radii. Each net row contains its ID, source port, target port, and width. Ports are `[x, y, heading_in_degrees]`. The [example script](advanced_layouts.py) builds the `RoutingProblem` and calls `route()` in automatic mode.
-
-In the figures, gray shapes are keepouts. Open circles mark sources and filled squares mark targets. Arrows indicate the direction of travel at those ports. The result panel draws the physical waveguides and reports the number of nets that passed verification.
-
-## Competing passages
-
-### Mixed widths at a slit
-
-In `stress-passage-width-key`, the 2-unit-wide lane uses the lower slit with 5 units of clearance. The other five routes share the upper opening, including nets travelling in the opposite direction.
-
-
-
-### Staggered openings and one shared passage
-
-In `stress-passage-split-merge`, the first wall offers two openings for three tracks each. The routes turn between the walls to enter the second opening as a six-track bank.
-
-
-
-## Bend and return room
-
-### Alternating doglegs
-
-In `stress-refine-alternating-doglegs`, three eastbound nets pass above a wall rising from the bottom and then below a wall hanging from the top. The staggered turns preserve clearance for three different guide widths.
-
-
-
-### Folded return near a shelf
-
-In `stress-refine-return-shelf`, the folded net's target lies west of its source and requires eastbound arrival. Follow its loop below the two neighboring routes in the result panel.
-
-
-
-### Trunk that detours around branches
-
-In `stress-retry-straight-decoy`, the straight line between the trunk's ports would cut across both perpendicular branches. The router sends the trunk below the branch ports and above the lower rail.
-
-
-
-### Short shifts on separate rows
-
-In `stress-retry-compact-shift-bank`, walls divide the board into four rows. The lowest net has only 66 units of forward travel for an 85-unit lateral shift. Its turns fit beside the keepout on that row.
-
-
-
-### Mixed port bank
-
-In `stress-retry-mixed-port-bank`, two compact shifts launch in opposite directions around different keepouts. The lower middle net turns from northbound to eastbound, and the top link runs west.
-
-
-
-## Placed crossings
-
-The crossing cells are already placed. The board supplies keepouts with slots at their ports, and each routed net represents an external connection. To set up the keepouts for your own devices, follow the [placed crossing walkthrough](../docs/user/route-a-layout.md#route-between-placed-crossings).
-
-### Opposed S-bends beside a crossing
-
-In `stress-sbend-competing-slots`, two links make 20-unit lateral shifts while travelling in opposite directions. Their S-bends fit on opposite sides of the small central keepout while two separate links reach the crossing's north and south ports.
-
-
-
-### Odd offset and a short launch pocket
-
-In `stress-crossing-off-lattice-slot`, the west approach must shift by 17 units and land on a recessed port. It uses a pair of 90-degree bends. The north link turns in a short pocket beside a keepout before straightening toward its target.
-
-
-
-### Two crossings with an outside detour
-
-In `stress-crossings-shared-outside-detour`, a straight external link joins the two devices. The long lower route bends around the entire south approach bank, leaving both short vertical links in place.
-
-
-
-## Nine-net Terminal-Bench board
-
-The board has seven keepouts and nine connections out of a tight west-side launch bank. Both examples use 2-unit-wide waveguides, clearance 6, and radius 50 for bends and S-bends. For the upstream board pin and the waypoint export command, see the [Terminal-Bench fixture guide](../docs/benchmark-fixtures.md#automatic-nine-net-terminal-bench-routing).
-
-### Fixed eastbound headings
-
-In `terminal-bench`, both headings on every net are fixed eastbound. Follow `net_08` from the low end of the launch bank around the board. It makes a final turnaround to arrive eastbound at its target near the top edge.
-
-
-
-### Point terminals
-
-In `terminal-bench-point-terminals`, heading inference can change the initial zero headings supplied to `Port`. The setup shows the terminal positions, and the result shows the inferred headings. `net_08` arrives westbound from the east and saves the final turnaround.
-
-
diff --git a/examples/advanced_layouts.py b/examples/advanced_layouts.py
deleted file mode 100644
index 80ef578..0000000
--- a/examples/advanced_layouts.py
+++ /dev/null
@@ -1,131 +0,0 @@
-"""Route and plot the advanced layouts with Inire's public API."""
-
-from __future__ import annotations
-
-import os
-from argparse import ArgumentParser
-from json import loads
-from math import cos, radians, sin
-from pathlib import Path
-from typing import TYPE_CHECKING
-
-import matplotlib
-from shapely import from_wkt, union_all
-from shapely.geometry import box
-from shapely.plotting import plot_polygon
-
-from inire import NetSpec, Port, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
-
-if "MPLBACKEND" not in os.environ:
- matplotlib.use("Agg")
-
-from matplotlib import pyplot as plt # noqa: E402
-from matplotlib.lines import Line2D # noqa: E402
-
-if TYPE_CHECKING:
- from matplotlib.axes import Axes
-
- from inire import RoutingRunResult
-
-INPUTS = Path(__file__).with_name("advanced-layouts.json")
-COLORS = ("#007189", "#af511b", "#654a99", "#427326", "#b73c62", "#975b2d", "#2f569a", "#734359", "#328179")
-
-
-def build_problem(layout: dict) -> tuple[RoutingProblem, RoutingOptions]:
- """Create the board, connections, and geometry options from a layout entry."""
- problem = RoutingProblem(
- bounds=tuple(layout["bounds"]),
- static_obstacles=tuple(from_wkt(shape) for shape in layout["keepouts"]),
- nets=tuple(NetSpec(name, Port(*start), Port(*target), width) for name, start, target, width in layout["nets"]),
- clearance=layout["clearance"],
- )
- options = RoutingOptions(
- search=SearchOptions(bend_radii=tuple(layout["bend_radii"]), sbend_radii=tuple(layout["sbend_radii"])),
- topology=TopologyOptions(infer_terminal_headings=layout["infer_terminal_headings"]),
- )
- return problem, options
-
-
-def _draw_board(ax: Axes, problem: RoutingProblem) -> None:
- x0, y0, x1, y1 = problem.bounds
- margin = (x1 - x0) * 0.025
- ax.set(xlim=(x0 - margin, x1 + margin), ylim=(y0 - margin, y1 + margin), aspect="equal")
- ax.set_axis_off()
- plot_polygon(box(*problem.bounds), ax=ax, add_points=False, facecolor="#fbfcfd", edgecolor="#9caeb6", linewidth=0.8)
- for shape in problem.static_obstacles:
- plot_polygon(shape, ax=ax, add_points=False, facecolor="#d4dde2", edgecolor="#758892", linewidth=0.8)
-
-
-def _draw_ports(ax: Axes, start: Port, target: Port, color: str, arrow_length: float) -> None:
- if arrow_length:
- ports = (start, target)
- ax.quiver(
- [p.x for p in ports], [p.y for p in ports],
- [arrow_length * cos(radians(p.r)) for p in ports], [arrow_length * sin(radians(p.r)) for p in ports],
- color=color, scale=1, scale_units="xy", angles="xy", width=0.0025, zorder=4,
- )
- ax.scatter(start.x, start.y, s=19, marker="o", facecolors="white", edgecolors=color, linewidths=1.0, zorder=5)
- ax.scatter(target.x, target.y, s=16, marker="s", color=color, linewidths=0.6, zorder=5)
-
-
-def _plot_case(problem: RoutingProblem, options: RoutingOptions, run: RoutingRunResult, output: Path) -> None:
- ratio = (problem.bounds[3] - problem.bounds[1]) / (problem.bounds[2] - problem.bounds[0])
- stacked = ratio < 0.45
- fig, (setup, result) = plt.subplots(
- 2 if stacked else 1, 1 if stacked else 2,
- figsize=(9.6, (19.2 if stacked else 4.8) * ratio + 1.2),
- layout="constrained",
- )
- for panel in (setup, result):
- _draw_board(panel, problem)
- verified = sum(route_result.is_valid for route_result in run.results_by_net.values())
- setup.set_title("Setup", loc="left", fontsize=13, color="#193447", fontweight="bold")
- result.set_title(f"Result · {verified}/{len(problem.nets)} verified", loc="left", fontsize=13, color="#193447", fontweight="bold")
- inferred = options.topology.infer_terminal_headings
- arrow_length = (problem.bounds[2] - problem.bounds[0]) * 0.025
- legend = []
-
- for index, net in enumerate(problem.nets):
- color = COLORS[index % len(COLORS)]
- legend.append(Line2D([], [], color=color, linewidth=2, label=net.net_id))
- routed = run.results_by_net[net.net_id]
- _draw_ports(setup, net.start, net.target, color, 0 if inferred else arrow_length)
-
- if routed.path:
- plot_polygon(
- union_all(routed.locked_geometry), ax=result, add_points=False, facecolor=color, edgecolor=color,
- linewidth=0.55, linestyle="-" if routed.is_valid else "--", alpha=1 if routed.is_valid else 0.35, zorder=3,
- )
- start, target = (routed.path[0].start_port, routed.path[-1].end_port) if inferred and routed.is_valid else (net.start, net.target)
- _draw_ports(result, start, target, color, arrow_length if not inferred or routed.is_valid else 0)
-
- columns = 5 if stacked else 4
- fig.legend(handles=legend, loc="outside lower center", ncols=columns, fontsize=8.5, frameon=False)
- fig.savefig(output, dpi=150, facecolor="white")
- plt.close(fig)
-
-
-def main() -> int:
- layouts = loads(INPUTS.read_text(encoding="utf-8"))
- parser = ArgumentParser(description=__doc__)
- parser.add_argument("--case", action="append", choices=layouts, help="Layout to route. Repeat to select several. Defaults to all.")
- parser.add_argument("--output-dir", type=Path, default=INPUTS.parent, help="Directory for the setup and result PNGs.")
- args = parser.parse_args()
- args.output_dir.mkdir(parents=True, exist_ok=True)
-
- all_verified = True
- for name in dict.fromkeys(args.case or layouts):
- problem, options = build_problem(layouts[name])
- run = route(problem, options=options)
- valid = sum(result.is_valid for result in run.results_by_net.values())
- print(f"{name}: {valid}/{len(problem.nets)} verified")
- if valid != len(problem.nets):
- all_verified = False
- print(" " + ", ".join(f"{res.net_id}: {res.outcome}" for res in run.results_by_net.values() if not res.is_valid))
- _plot_case(problem, options, run, args.output_dir / f"example-{name}.png")
-
- return 0 if all_verified else 1
-
-
-if __name__ == "__main__":
- raise SystemExit(main())
diff --git a/inire/geometry/collision.py b/inire/geometry/collision.py
index db72927..dd6f166 100644
--- a/inire/geometry/collision.py
+++ b/inire/geometry/collision.py
@@ -142,6 +142,12 @@ class RoutingWorld:
def _ensure_static_raw_tree(self) -> None:
self._static_obstacles.ensure_raw_tree()
+ def _ensure_dynamic_tree(self) -> None:
+ self._dynamic_paths.ensure_tree()
+
+ def _ensure_dynamic_grid(self) -> None:
+ self._dynamic_paths.ensure_grid()
+
def add_path(
self,
net_id: str,
@@ -343,6 +349,10 @@ class RoutingWorld:
if not dynamic_paths.dilated:
return {}
+ self._ensure_dynamic_grid()
+ if not dynamic_paths.grid:
+ return {}
+
candidates_by_net: dict[str, dict[int, set[int]]] = {}
for test_geometry_index, test_bounds in enumerate(result.dilated_bounds):
if not self._has_possible_congestion_in_grid(test_bounds, net_id):
@@ -397,16 +407,16 @@ class RoutingWorld:
net_id: str,
) -> bool:
gx_min, gy_min, gx_max, gy_max = grid_cell_span(bounds, self.grid_cell_size)
- cells = self._dynamic_paths.grid_net_obj_ids
+ dynamic_paths = self._dynamic_paths
if gx_min == gx_max and gy_min == gy_max:
- members = cells.get((gx_min, gy_min))
- return bool(members and (len(members) > 1 or net_id not in members))
+ net_counts = dynamic_paths.grid_net_counts.get((gx_min, gy_min))
+ return bool(net_counts and (len(net_counts) > 1 or net_id not in net_counts))
for gx in range(gx_min, gx_max + 1):
for gy in range(gy_min, gy_max + 1):
- members = cells.get((gx, gy))
- if members and (len(members) > 1 or net_id not in members):
+ net_counts = dynamic_paths.grid_net_counts.get((gx, gy))
+ if net_counts and (len(net_counts) > 1 or net_id not in net_counts):
return True
return False
@@ -420,6 +430,10 @@ class RoutingWorld:
if not dynamic_paths.dilated:
return False
+ self._ensure_dynamic_grid()
+ if not dynamic_paths.grid:
+ return False
+
for bounds in result.dilated_bounds:
gx_min, gy_min, gx_max, gy_max = grid_cell_span(bounds, self.grid_cell_size)
cache_key = (net_id, gx_min, gy_min, gx_max, gy_max)
diff --git a/inire/geometry/components.py b/inire/geometry/components.py
index 958af15..031911c 100644
--- a/inire/geometry/components.py
+++ b/inire/geometry/components.py
@@ -14,7 +14,7 @@ from inire.seeds import Bend90Seed, PathSegmentSeed, SBendSeed, StraightSeed
from .primitives import Port, rotation_matrix2
if TYPE_CHECKING:
- from collections.abc import Iterable, Sequence
+ from collections.abc import Sequence
from numpy.typing import NDArray
@@ -25,11 +25,6 @@ BendCollisionModel = BendCollisionModelName | Polygon
BendPhysicalGeometry = Literal["arc"] | Polygon
-def path_within_board(path: Iterable[ComponentResult], board: Polygon) -> bool:
- """Check containment of the physical geometry, including boundary contact."""
- return all(board.covers(shape) for component in path for shape in component.physical_geometry)
-
-
def _normalize_length(value: float) -> float:
return float(value)
diff --git a/inire/geometry/dynamic_path_index.py b/inire/geometry/dynamic_path_index.py
index 778bbef..a0807f8 100644
--- a/inire/geometry/dynamic_path_index.py
+++ b/inire/geometry/dynamic_path_index.py
@@ -1,10 +1,13 @@
from __future__ import annotations
+from contextlib import suppress
from typing import TYPE_CHECKING
+import numpy
import rtree
+from shapely.strtree import STRtree
-from inire.geometry.index_helpers import iter_grid_cells
+from inire.geometry.index_helpers import build_index_payload, iter_grid_cells
if TYPE_CHECKING:
from collections.abc import Sequence
@@ -26,10 +29,16 @@ class DynamicPathIndex:
"net_envelopes",
"net_envelope_obj_ids",
"net_envelope_obj_to_net",
+ "tree",
+ "obj_ids",
+ "grid",
"grid_net_obj_ids",
+ "grid_net_counts",
"obj_cells",
"net_to_obj_ids",
"id_counter",
+ "net_ids_array",
+ "bounds_array",
)
def __init__(self, engine: RoutingWorld) -> None:
@@ -43,10 +52,16 @@ class DynamicPathIndex:
self.net_envelopes: dict[str, tuple[float, float, float, float]] = {}
self.net_envelope_obj_ids: dict[str, int] = {}
self.net_envelope_obj_to_net: dict[int, str] = {}
+ self.tree: STRtree | None = None
+ self.obj_ids: numpy.ndarray = numpy.array([], dtype=numpy.int32)
+ self.grid: dict[tuple[int, int], list[int]] = {}
self.grid_net_obj_ids: dict[tuple[int, int], dict[str, set[int]]] = {}
+ self.grid_net_counts: dict[tuple[int, int], dict[str, int]] = {}
self.obj_cells: dict[int, tuple[tuple[int, int], ...]] = {}
self.net_to_obj_ids: dict[str, set[int]] = {}
self.id_counter = 0
+ self.net_ids_array = numpy.array([], dtype=object)
+ self.bounds_array = numpy.array([], dtype=numpy.float64).reshape(0, 4)
def _combine_net_bounds(self, obj_ids: set[int]) -> tuple[float, float, float, float]:
first_obj_id = next(iter(obj_ids))
@@ -89,6 +104,34 @@ class DynamicPathIndex:
return
self._set_net_envelope(net_id, self._combine_net_bounds(obj_ids))
+ def invalidate_queries(self) -> None:
+ self.tree = None
+ self.grid = {}
+ self.grid_net_obj_ids = {}
+ self.grid_net_counts = {}
+ self.obj_cells = {}
+
+ def ensure_tree(self) -> None:
+ if self.tree is None and self.dilated:
+ if self.engine.metrics is not None:
+ self.engine.metrics.total_dynamic_tree_rebuilds += 1
+ ids, geometries, bounds_array = build_index_payload(self.dilated)
+ self.tree = STRtree(geometries)
+ self.obj_ids = numpy.array(ids, dtype=numpy.int32)
+ self.bounds_array = bounds_array
+ net_ids = [self.geometries[obj_id][0] for obj_id in self.obj_ids]
+ self.net_ids_array = numpy.array(net_ids, dtype=object)
+
+ def ensure_grid(self) -> None:
+ if self.grid or not self.dilated:
+ return
+
+ if self.engine.metrics is not None:
+ self.engine.metrics.total_dynamic_grid_rebuilds += 1
+ cell_size = self.engine.grid_cell_size
+ for obj_id, polygon in self.dilated.items():
+ self._register_grid_membership(obj_id, self.geometries[obj_id][0], polygon.bounds, cell_size=cell_size)
+
def _register_grid_membership(
self,
obj_id: int,
@@ -100,17 +143,39 @@ class DynamicPathIndex:
cells = tuple(iter_grid_cells(bounds, cell_size))
self.obj_cells[obj_id] = cells
for cell in cells:
- self.grid_net_obj_ids.setdefault(cell, {}).setdefault(net_id, set()).add(obj_id)
+ self.grid.setdefault(cell, []).append(obj_id)
+ net_obj_ids = self.grid_net_obj_ids.setdefault(cell, {})
+ net_obj_ids.setdefault(net_id, set()).add(obj_id)
+ net_counts = self.grid_net_counts.setdefault(cell, {})
+ net_counts[net_id] = net_counts.get(net_id, 0) + 1
def _unregister_grid_membership(self, obj_id: int, net_id: str) -> None:
- for cell in self.obj_cells.pop(obj_id):
- net_obj_ids = self.grid_net_obj_ids[cell]
- member_ids = net_obj_ids[net_id]
- member_ids.remove(obj_id)
- if not member_ids:
- del net_obj_ids[net_id]
- if not net_obj_ids:
- del self.grid_net_obj_ids[cell]
+ cells = self.obj_cells.pop(obj_id, ())
+ for cell in cells:
+ obj_ids = self.grid.get(cell)
+ if obj_ids is not None:
+ with suppress(ValueError):
+ obj_ids.remove(obj_id)
+ if not obj_ids:
+ self.grid.pop(cell, None)
+ net_obj_ids = self.grid_net_obj_ids.get(cell)
+ if net_obj_ids is not None:
+ member_ids = net_obj_ids.get(net_id)
+ if member_ids is not None:
+ member_ids.discard(obj_id)
+ if not member_ids:
+ net_obj_ids.pop(net_id, None)
+ if not net_obj_ids:
+ self.grid_net_obj_ids.pop(cell, None)
+ net_counts = self.grid_net_counts.get(cell)
+ if net_counts is not None:
+ remaining = net_counts.get(net_id, 0) - 1
+ if remaining > 0:
+ net_counts[net_id] = remaining
+ else:
+ net_counts.pop(net_id, None)
+ if not net_counts:
+ self.grid_net_counts.pop(cell, None)
def add_path(
self,
@@ -135,6 +200,7 @@ class DynamicPathIndex:
self.net_to_obj_ids.setdefault(net_id, set()).add(obj_id)
self._register_grid_membership(obj_id, net_id, dilated_bounds, cell_size=cell_size)
self._refresh_net_envelope(net_id)
+ self.tree = None
def remove_path(self, net_id: str) -> None:
to_remove = list(self.net_to_obj_ids.get(net_id, ()))
@@ -163,3 +229,4 @@ class DynamicPathIndex:
self.net_to_obj_ids.pop(net_id, None)
for net_id in affected_nets:
self._refresh_net_envelope(net_id)
+ self.tree = None
diff --git a/inire/router/_automatic.py b/inire/router/_automatic.py
index 03c8d4b..156c2d3 100644
--- a/inire/router/_automatic.py
+++ b/inire/router/_automatic.py
@@ -14,13 +14,13 @@ from shapely.geometry import box
from inire.constants import TOLERANCE_LINEAR
from inire.geometry.collision import RoutingWorld
+from inire.geometry.primitives import port_local_coordinates
from inire.model import resolve_bend_geometry
from inire.results import AutomaticRoutingReport, RoutingStage, RoutingTiming, _planner_for_mode, _sum_route_metrics
from inire.router._bundle import ordered_bundle_terminal_headings, plan_ordered_bundle
from inire.router._capacity import cut_capacity, port_conflicts
from inire.router._columns import column_jog_candidates, column_seed_candidates
from inire.router._compact import compact_port_seed_set, short_shift_seed_set
-from inire.router._congestion_policy import ordered_nets
from inire.router._perimeter import (
bundle_turnaround_candidates,
perimeter_detour_candidates,
@@ -34,14 +34,14 @@ from inire.router._routing_policy import (
_disconnected_nets,
_is_short_shift,
_residual_problem,
- _route_prepared_residual,
_route_residual,
_trial,
)
from inire.router._seed_materialization import materialize_path_seed
from inire.router._stack import route_once
from inire.router._topology import plan_corridors
-from inire.router.cost import build_native_cost_evaluator, weighted_path_length
+from inire.router.cost import CostEvaluator, weighted_path_length
+from inire.router.danger_map import DangerMap
from inire.seeds import SBendSeed
if TYPE_CHECKING:
@@ -54,7 +54,6 @@ if TYPE_CHECKING:
from inire.results import RouteMetrics, RoutingOperation, RoutingResult, RoutingRunResult
from inire.router._routing_policy import Trial
from inire.router._topology import Corridor
- from inire.router.cost import CostEvaluator
from inire.seeds import PathSeed
@@ -149,7 +148,19 @@ class _AutomaticRun:
if self.length_weights is not None:
return weighted_path_length(result.path, self.length_weights)
if self.evaluator is None:
- self.evaluator = build_native_cost_evaluator(self.problem, self.options.objective)
+ objective = self.options.objective
+ danger = None
+ if objective.danger_weight and self.problem.static_obstacles:
+ danger = DangerMap(bounds=self.problem.bounds)
+ danger.precompute(list(self.problem.static_obstacles))
+ self.evaluator = CostEvaluator(
+ RoutingWorld(clearance=self.problem.clearance),
+ danger,
+ unit_length_cost=objective.unit_length_cost,
+ bend_penalty=objective.bend_penalty,
+ sbend_penalty=objective.sbend_penalty,
+ danger_weight=objective.danger_weight,
+ )
return self.evaluator.path_cost(result.path[0].start_port, result.path)
def _trial(self, run: RoutingRunResult, stage: RoutingStage) -> Trial:
@@ -332,20 +343,27 @@ class _AutomaticRun:
if not candidate.valid_costs:
continue
chosen = candidate.run.results_by_net[net.net_id]
- policy = "perimeter-residual"
- guide = replace(options, congestion=replace(options.congestion, max_iterations=1))
- run, stage = _route_residual(
+ residual = replace(
problem,
- guide,
- LockPlan({net.net_id: chosen}),
- residual_mode="guide",
- run_route=partial(self._run, policy=policy),
+ nets=tuple(other for other in problem.nets if other != net),
+ static_obstacles=problem.static_obstacles + chosen.locked_geometry,
)
- stage = replace(stage, kind=policy, policy=policy, planner="perimeter")
- trials.append(self._trial(run, stage))
+ guide = replace(options, topology=replace(options.topology, mode="guide"), congestion=replace(options.congestion, max_iterations=1))
+ run = self._run(residual, options=guide, policy="perimeter-residual")
+ combined = {net.net_id: chosen, **run.results_by_net}
+ stage = RoutingStage(
+ "guide",
+ (net.net_id,),
+ run.metrics.nodes_expanded,
+ options.search.node_limit,
+ kind="perimeter-residual",
+ policy="perimeter-residual",
+ planner="perimeter",
+ )
+ trials.append(self._trial(replace(run, results_by_net=combined), stage))
if len(trials[-1].valid_costs) == len(problem.nets):
trials[-1] = replace(trials[-1], selection="requires-layout-check")
- seeds = {net_id: result.as_seed() for net_id, result in run.results_by_net.items()}
+ seeds = {net_id: result.as_seed() for net_id, result in combined.items()}
trials.append(self._verify(replace(problem, initial_paths=seeds), "perimeter"))
if len(trials[-1].valid_costs) == len(problem.nets):
break
@@ -373,8 +391,7 @@ class _AutomaticRun:
policy = "incumbent-residual"
locks = LockPlan(retained)
- residual = _residual_problem(problem, locks)
- run, stage = _route_prepared_residual(residual, options, locks, residual_mode="seed", run_route=partial(self._run, policy=policy))
+ run, stage = _route_residual(problem, options, "direct-seed", locks, run_route=partial(self._run, policy=policy))
stage = replace(stage, kind=policy, policy=policy, retry_reason="Residual terminals remain connected with the incumbents locked")
trial = self._trial(run, stage)
if len(trial.valid_costs) == len(problem.nets):
@@ -384,7 +401,7 @@ class _AutomaticRun:
dogleg = self._residual_dogleg_trial(options, _best_trial([best, trial]))
if dogleg is not None:
return [trial, dogleg]
- joint = self._joint_lane_trial(residual, options, locks, trial)
+ joint = self._joint_lane_trial(options, locks, trial)
if joint is not None:
trials.append(replace(joint, selection="requires-layout-check"))
if joint.improves_on(_best_trial([best, trial])):
@@ -535,12 +552,20 @@ class _AutomaticRun:
stage = RoutingStage("seed", (), run.metrics.nodes_expanded, options.search.node_limit, policy="seed-fallback")
trials.append(self._trial(run, stage))
- def _joint_lane_trial(self, residual: RoutingProblem, options: RoutingOptions, locks: LockPlan, previous: Trial) -> Trial | None:
+ def _joint_lane_trial(self, options: RoutingOptions, locks: LockPlan, previous: Trial) -> Trial | None:
+ residual = _residual_problem(self.problem, locks)
if len(residual.nets) < 2:
return None
policy = "joint-portal-lanes"
unresolved = frozenset(net.net_id for net in residual.nets if net.net_id not in previous.valid_costs)
- nets = ordered_nets(residual.nets, options.congestion.net_order)
+ order = options.congestion.net_order
+ nets = residual.nets
+ if order != "user":
+ nets = tuple(sorted(
+ nets,
+ key=lambda net: sum(map(abs, port_local_coordinates(net.start, net.target.x, net.target.y))),
+ reverse=order == "longest",
+ ))
with self._time("plan", planner="corridor-seed", mode="seed", policy=policy):
corridors = plan_corridors(
residual.bounds,
@@ -554,8 +579,8 @@ class _AutomaticRun:
if not corridors:
return None
retry = replace(options, congestion=replace(options.congestion, max_iterations=min(3, options.congestion.max_iterations)))
- run, stage = _route_prepared_residual(
- residual, retry, locks, residual_mode="seed", run_route=partial(self._run, policy=policy, corridors=corridors)
+ run, stage = _route_residual(
+ self.problem, retry, "direct-seed", locks, run_route=partial(self._run, policy=policy, corridors=corridors)
)
stage = replace(
stage,
diff --git a/inire/router/_congestion_policy.py b/inire/router/_congestion_policy.py
index 0e9d2b9..1bd0153 100644
--- a/inire/router/_congestion_policy.py
+++ b/inire/router/_congestion_policy.py
@@ -6,21 +6,12 @@ from dataclasses import dataclass
from typing import TYPE_CHECKING
if TYPE_CHECKING:
- from collections.abc import Iterable, Mapping, Sequence, Set
+ from collections.abc import Mapping, Sequence, Set
from inire.geometry.collision import PathVerificationDetail
- from inire.model import NetOrder, NetSpec
from inire.results import RoutingResult
-def ordered_nets(nets: Iterable[NetSpec], order: NetOrder) -> list[NetSpec]:
- """Apply the requested net order, retaining input order for ties."""
- ordered = list(nets)
- if order != "user":
- ordered.sort(key=lambda net: abs(net.target.x - net.start.x) + abs(net.target.y - net.start.y), reverse=order == "longest")
- return ordered
-
-
@dataclass(slots=True)
class IterationReview:
conflicting_nets: set[str]
@@ -28,11 +19,6 @@ class IterationReview:
completed_net_ids: set[str]
total_dynamic_collisions: int
- @property
- def rank(self) -> tuple[int, int, int]:
- """Order verified layouts by completed nets, conflict edges, then collisions."""
- return -len(self.completed_net_ids), len(self.conflict_edges), self.total_dynamic_collisions
-
def review_verified_results(
results: Mapping[str, RoutingResult],
@@ -69,7 +55,7 @@ def reroute_plan(
reroute_net_ids: Set[str],
recent_attempt_work: Mapping[str, int],
*,
- best_conflict_edges: int | None,
+ best_conflict_edges: int,
results: Mapping[str, RoutingResult],
) -> tuple[list[str], set[str]]:
routed_net_ids = [net_id for net_id in ordered_net_ids if net_id in reroute_net_ids]
@@ -78,12 +64,7 @@ def reroute_plan(
order_index = {net_id: idx for idx, net_id in enumerate(ordered_net_ids)}
routed_net_ids.sort(key=lambda net_id: (recent_attempt_work.get(net_id, 0), order_index[net_id]))
- if (
- len(routed_net_ids) != 4
- or best_conflict_edges is None
- or best_conflict_edges > 2
- or not all_results_reached_target(ordered_net_ids, results)
- ):
+ if len(routed_net_ids) != 4 or best_conflict_edges > 2 or not all_results_reached_target(ordered_net_ids, results):
return routed_net_ids, set()
heaviest = sorted(routed_net_ids, key=lambda net_id: (-recent_attempt_work.get(net_id, 0), order_index[net_id]))[:2]
@@ -104,10 +85,10 @@ def next_reroute_net_ids(
return set(ordered_net_ids)
-def reached_pair_local_plateau(*, improved: bool, all_reached_target: bool, best_conflict_edges: int | None) -> bool:
+def reached_pair_local_plateau(*, improved: bool, all_reached_target: bool, best_conflict_edges: int) -> bool:
# A non-improving iteration with at most two remaining conflicts is
# enough to hand the reached-target layout to bounded pair-local repair.
- return not improved and all_reached_target and best_conflict_edges is not None and best_conflict_edges <= 2
+ return not improved and all_reached_target and best_conflict_edges <= 2
def repeated_conflict_count(current_edges: int, previous_edges: int, previous_repeats: int) -> int:
diff --git a/inire/router/_pair_local.py b/inire/router/_pair_local.py
index cae6117..8fe23f3 100644
--- a/inire/router/_pair_local.py
+++ b/inire/router/_pair_local.py
@@ -27,6 +27,7 @@ def _build_pair_local_context(
lock_partial_paths: bool,
) -> AStarContext:
problem = context.problem
+ objective = context.options.objective
live_world = context.cost_evaluator.collision_engine
static_obstacles = tuple(live_world.iter_static_geometries())
world = RoutingWorld(clearance=live_world.clearance, safety_zone_radius=live_world.safety_zone_radius)
@@ -43,13 +44,15 @@ def _build_pair_local_context(
world.add_static_obstacle(polygon)
danger_map = DangerMap(bounds=problem.bounds)
- if context.options.objective.danger_weight:
- danger_map.precompute(list(static_obstacles))
- evaluator = CostEvaluator.from_objective(
+ danger_map.precompute(list(static_obstacles))
+ evaluator = CostEvaluator(
world,
danger_map,
- context.options.objective,
+ unit_length_cost=objective.unit_length_cost,
greedy_h_weight=context.cost_evaluator.greedy_h_weight,
+ bend_penalty=objective.bend_penalty,
+ sbend_penalty=objective.sbend_penalty,
+ danger_weight=objective.danger_weight,
)
return AStarContext(
evaluator,
diff --git a/inire/router/_router.py b/inire/router/_router.py
index 01a4f1d..53bf2f6 100644
--- a/inire/router/_router.py
+++ b/inire/router/_router.py
@@ -6,7 +6,7 @@ from contextlib import contextmanager, nullcontext
from dataclasses import dataclass, field
from typing import TYPE_CHECKING
-from inire.model import resolve_bend_geometry
+from inire.model import NetOrder, NetSpec, resolve_bend_geometry
from inire.results import (
ConflictTraceEntry,
FrontierPruneSample,
@@ -24,7 +24,6 @@ from inire.router._congestion_policy import (
IterationReview as _IterationReview,
all_results_reached_target,
next_reroute_net_ids,
- ordered_nets,
reached_pair_local_plateau,
repeated_conflict_count,
reroute_plan,
@@ -44,7 +43,6 @@ if TYPE_CHECKING:
from inire.geometry.collision import PathVerificationDetail
from inire.geometry.components import ComponentResult
- from inire.model import NetSpec
from inire.results import ConflictTraceStage, RoutingOperation
from inire.router._topology import Corridor
@@ -62,17 +60,19 @@ class _RoutingState:
initial_paths: dict[str, tuple[ComponentResult, ...]] | None
accumulated_expanded_nodes: list[tuple[int, int, int]]
best_results: dict[str, RoutingResult]
- best_is_installed: bool
- best_review: _IterationReview | None
+ best_completed_nets: int
+ best_conflict_edges: int
+ best_dynamic_collisions: int
last_conflict_edge_count: int
repeated_conflict_count: int
recent_attempt_work: dict[str, int]
pre_pair_candidate: _PrePairCandidate | None
corridors: dict[str, tuple[Corridor, ...]] = field(default_factory=dict)
- @property
- def best_conflict_edges(self) -> int | None:
- return len(self.best_review.conflict_edges) if self.best_review is not None else None
+
+@dataclass(frozen=True, slots=True)
+class _PairLocalTarget:
+ net_ids: tuple[str, str]
@dataclass(frozen=True, slots=True)
@@ -168,6 +168,21 @@ class PathFinder:
component_indexes=component_indexes,
)
+ def _routing_order(
+ self,
+ net_specs: dict[str, NetSpec],
+ order: NetOrder,
+ ) -> list[str]:
+ ordered_net_ids = list(net_specs.keys())
+ if order == "user":
+ return ordered_net_ids
+ ordered_net_ids.sort(
+ key=lambda net_id: abs(net_specs[net_id].target.x - net_specs[net_id].start.x)
+ + abs(net_specs[net_id].target.y - net_specs[net_id].start.y),
+ reverse=(order == "longest"),
+ )
+ return ordered_net_ids
+
@contextmanager
def _temporary_path_reservations(self) -> Iterator[Callable[[Sequence[ComponentResult]], None]]:
world = self.context.cost_evaluator.collision_engine
@@ -187,20 +202,22 @@ class PathFinder:
def _build_greedy_warm_start_paths(
self,
- state: _RoutingState,
+ net_specs: dict[str, NetSpec],
+ order: NetOrder,
+ corridors: dict[str, tuple[Corridor, ...]],
) -> dict[str, tuple[ComponentResult, ...]]:
greedy_paths: dict[str, tuple[ComponentResult, ...]] = {}
greedy_node_limit = min(self.context.options.search.node_limit, 2000)
with self._temporary_path_reservations() as reserve:
- for net_id in state.ordered_net_ids:
- net = state.net_specs[net_id]
+ for net_id in self._routing_order(net_specs, order):
+ net = net_specs[net_id]
h_start = self.context.cost_evaluator.h_manhattan(
net.start,
net.target,
min_bend_radius=self.context.min_bend_radius,
)
max_cost_limit = max(h_start * 3.0, 2000.0)
- candidates = state.corridors.get(net_id, ())
+ candidates = corridors.get(net_id, ())
run_config = SearchRunConfig.from_options(
self.context.options,
skip_congestion=True,
@@ -307,7 +324,7 @@ class PathFinder:
num_nets = len(net_specs)
state = _RoutingState(
net_specs=net_specs,
- ordered_net_ids=[net.net_id for net in ordered_nets(net_specs.values(), congestion.net_order)],
+ ordered_net_ids=self._routing_order(net_specs, congestion.net_order),
results={},
needs_self_collision_check=set(),
start_time=time.monotonic(),
@@ -315,8 +332,9 @@ class PathFinder:
initial_paths=initial_paths,
accumulated_expanded_nodes=[],
best_results={},
- best_is_installed=False,
- best_review=None,
+ best_completed_nets=-1,
+ best_conflict_edges=10**9,
+ best_dynamic_collisions=10**9,
last_conflict_edge_count=0,
repeated_conflict_count=0,
recent_attempt_work={},
@@ -324,7 +342,7 @@ class PathFinder:
)
self._prepare_topology(state, corridors)
if state.initial_paths is None and congestion.warm_start_enabled:
- state.initial_paths = self._build_greedy_warm_start_paths(state)
+ state.initial_paths = self._build_greedy_warm_start_paths(net_specs, congestion.net_order, state.corridors)
if state.corridors and state.initial_paths and congestion.max_iterations > 0:
world = self.context.cost_evaluator.collision_engine
for net_id, path in state.initial_paths.items():
@@ -356,26 +374,29 @@ class PathFinder:
)
return initial_paths
- def _replace_installed_paths(
- self, state: _RoutingState, results: dict[str, RoutingResult], *, net_ids: Sequence[str] | None = None
- ) -> None:
- ordered_net_ids = state.ordered_net_ids if net_ids is None else net_ids
- for net_id in ordered_net_ids:
+ def _replace_installed_paths(self, state: _RoutingState, results: dict[str, RoutingResult]) -> None:
+ for net_id in state.ordered_net_ids:
self.context.cost_evaluator.collision_engine.remove_path(net_id)
- for net_id in ordered_net_ids:
+ for net_id in state.ordered_net_ids:
result = results.get(net_id)
if result and result.path and (result.reached_target or not state.corridors):
self._install_path(net_id, result.path)
- def _review_restored_best(self, state: _RoutingState) -> _IterationReview:
- diagnostics = self.context.options.diagnostics
+ def _analyze_restored_best(
+ self,
+ state: _RoutingState,
+ ) -> tuple[dict[str, PathVerificationDetail], _IterationReview]:
+ capture_component_conflicts = (
+ self.context.options.diagnostics.capture_conflict_trace
+ or self.context.options.diagnostics.capture_pre_pair_frontier_trace
+ )
state.results, details_by_net, review = self._analyze_results(
state.ordered_net_ids,
state.results,
- capture_component_conflicts=diagnostics.capture_conflict_trace or diagnostics.capture_pre_pair_frontier_trace,
+ capture_component_conflicts=capture_component_conflicts,
count_iteration_metrics=False,
)
- if diagnostics.capture_conflict_trace:
+ if self.context.options.diagnostics.capture_conflict_trace:
self._capture_conflict_trace_entry(
state,
stage="restored_best",
@@ -384,20 +405,38 @@ class PathFinder:
details_by_net=details_by_net,
review=review,
)
- if diagnostics.capture_pre_pair_frontier_trace:
+ if self.context.options.diagnostics.capture_pre_pair_frontier_trace:
self.pre_pair_frontier_trace = self._materialize_pre_pair_frontier_trace(
state,
state.results,
details_by_net,
)
- return review
+ return details_by_net, review
def _update_best_iteration(self, state: _RoutingState, review: _IterationReview) -> bool:
- if state.best_review is not None and review.rank >= state.best_review.rank:
+ completed_nets = len(review.completed_net_ids)
+ conflict_edges = len(review.conflict_edges)
+ dynamic_collisions = review.total_dynamic_collisions
+ is_better = (
+ completed_nets > state.best_completed_nets
+ or (
+ completed_nets == state.best_completed_nets
+ and (
+ conflict_edges < state.best_conflict_edges
+ or (
+ conflict_edges == state.best_conflict_edges
+ and dynamic_collisions < state.best_dynamic_collisions
+ )
+ )
+ )
+ )
+ if not is_better:
return False
state.best_results = dict(state.results)
- state.best_review = review
+ state.best_completed_nets = completed_nets
+ state.best_conflict_edges = conflict_edges
+ state.best_dynamic_collisions = dynamic_collisions
return True
def _restore_best_iteration(self, state: _RoutingState) -> None:
@@ -524,7 +563,8 @@ class PathFinder:
pruned_cost=0,
)
- guidance_seed, guidance_bonus = incumbent_guidance(result, self.context.options.objective.bend_penalty)
+ guidance_seed = result.as_seed().segments if result.path else None
+ guidance_bonus = max(10.0, self.context.options.objective.bend_penalty * 0.25) if guidance_seed else 0.0
collector = FrontierTraceCollector(hotspot_bounds=hotspot_bounds)
run_config = SearchRunConfig.from_options(
self.context.options,
@@ -645,9 +685,18 @@ class PathFinder:
incumbent_results: dict[str, RoutingResult],
incumbent_review: _IterationReview,
) -> bool:
- candidate_rank, incumbent_rank = candidate_review.rank, incumbent_review.rank
- if candidate_rank != incumbent_rank:
- return candidate_rank < incumbent_rank
+ candidate_completed = len(candidate_review.completed_net_ids)
+ incumbent_completed = len(incumbent_review.completed_net_ids)
+ if candidate_completed != incumbent_completed:
+ return candidate_completed > incumbent_completed
+
+ candidate_edges = len(candidate_review.conflict_edges)
+ incumbent_edges = len(incumbent_review.conflict_edges)
+ if candidate_edges != incumbent_edges:
+ return candidate_edges < incumbent_edges
+
+ if candidate_review.total_dynamic_collisions != incumbent_review.total_dynamic_collisions:
+ return candidate_review.total_dynamic_collisions < incumbent_review.total_dynamic_collisions
candidate_length = sum(
result.report.total_length
@@ -663,17 +712,20 @@ class PathFinder:
return candidate_length < incumbent_length
return False
+ def _pair_local_attempt_orders(self, target: _PairLocalTarget) -> tuple[tuple[str, str], tuple[str, str]]:
+ return target.net_ids, target.net_ids[::-1]
+
def _collect_pair_local_targets(
self,
state: _RoutingState,
results: dict[str, RoutingResult],
review: _IterationReview,
- ) -> list[tuple[str, str]]:
+ ) -> list[_PairLocalTarget]:
if not review.conflict_edges:
return []
order_index = {net_id: idx for idx, net_id in enumerate(state.ordered_net_ids)}
seen_net_ids: set[str] = set()
- targets: list[tuple[str, str]] = []
+ targets: list[_PairLocalTarget] = []
for left_net_id, right_net_id in sorted(review.conflict_edges):
if left_net_id in seen_net_ids or right_net_id in seen_net_ids:
return []
@@ -687,8 +739,8 @@ class PathFinder:
):
continue
seen_net_ids.update((left_net_id, right_net_id))
- targets.append((left_net_id, right_net_id))
- targets.sort(key=lambda pair: min(order_index[pair[0]], order_index[pair[1]]))
+ targets.append(_PairLocalTarget(net_ids=(left_net_id, right_net_id)))
+ targets.sort(key=lambda target: min(order_index[target.net_ids[0]], order_index[target.net_ids[1]]))
return targets
def _materialize_pre_pair_frontier_trace(
@@ -761,17 +813,15 @@ class PathFinder:
def _apply_pair_local_candidate(
self,
state: _RoutingState,
- replacements: dict[str, RoutingResult],
+ candidate_results: dict[str, RoutingResult],
+ incumbent_results: dict[str, RoutingResult],
incumbent_review: _IterationReview,
) -> tuple[bool, _IterationReview]:
- incumbent_results = state.results
- candidate_results = {**incumbent_results, **replacements}
- changed_net_ids = [net_id for net_id in state.ordered_net_ids if net_id in replacements]
- self._replace_installed_paths(state, candidate_results, net_ids=changed_net_ids)
- candidate_results, _, candidate_review = self._analyze_results(
+ self._replace_installed_paths(state, candidate_results)
+ candidate_results, _candidate_details_by_net, candidate_review = self._analyze_results(
state.ordered_net_ids,
candidate_results,
- capture_component_conflicts=False,
+ capture_component_conflicts=True,
count_iteration_metrics=False,
)
if self._whole_set_is_better(
@@ -784,19 +834,20 @@ class PathFinder:
state.results = candidate_results
return True, candidate_review
- self._replace_installed_paths(state, incumbent_results, net_ids=changed_net_ids)
+ self._replace_installed_paths(state, incumbent_results)
return False, incumbent_review
def _run_pair_local_target(
self,
state: _RoutingState,
- target: tuple[str, str],
+ target: _PairLocalTarget,
review: _IterationReview,
) -> _IterationReview:
- incumbent_results = state.results
+ incumbent_results = dict(state.results)
+ incumbent_review = review
ordered_nets = tuple(state.net_specs[net_id] for net_id in state.ordered_net_ids)
self.metrics.total_pair_local_search_pairs_considered += 1
- for pair_order in (target, (target[1], target[0])):
+ for pair_order in self._pair_local_attempt_orders(target):
self.metrics.total_pair_local_search_attempts += 1
candidate = search_pair_candidate(
self.context,
@@ -812,15 +863,24 @@ class PathFinder:
self.metrics.total_pair_local_search_nodes_expanded += nodes_expanded
accepted, next_review = self._apply_pair_local_candidate(
state,
- replacements,
- review,
+ {**incumbent_results, **replacements},
+ incumbent_results,
+ incumbent_review,
)
if accepted:
return next_review
- return review
+ state.results = incumbent_results
+ self._replace_installed_paths(state, incumbent_results)
+ return incumbent_review
- def _run_pair_local_search(self, state: _RoutingState, review: _IterationReview) -> None:
+ def _run_pair_local_search(self, state: _RoutingState) -> None:
+ state.results, _details_by_net, review = self._analyze_results(
+ state.ordered_net_ids,
+ state.results,
+ capture_component_conflicts=True,
+ count_iteration_metrics=False,
+ )
targets = self._collect_pair_local_targets(state, state.results, review)
if not targets:
return
@@ -950,7 +1010,6 @@ class PathFinder:
iteration_before = {}
attempt_traces: list[IterationNetAttemptTrace] = []
attempt_work: dict[str, int] = {}
- capture_attempts = diagnostics.capture_iteration_trace or diagnostics.capture_pre_pair_frontier_trace
if diagnostics.capture_iteration_trace:
iteration_before = self._capture_metric_totals(_ITERATION_TRACE_TOTALS)
@@ -959,9 +1018,7 @@ class PathFinder:
self.metrics.total_timeout_events += 1
return None
- work_before = self.metrics.total_nodes_expanded + self.metrics.total_congestion_check_calls
- if capture_attempts:
- attempt_before = self._capture_metric_totals(_ATTEMPT_TRACE_TOTALS)
+ attempt_before = self._capture_metric_totals(_ATTEMPT_TRACE_TOTALS)
node_limit_override = None
incumbent_fallback = None
if net_id in capped_net_ids:
@@ -975,26 +1032,23 @@ class PathFinder:
incumbent_fallback=incumbent_fallback,
)
state.results[net_id] = result
- work_after = self.metrics.total_nodes_expanded + self.metrics.total_congestion_check_calls
- attempt_work[net_id] = work_after - work_before
- if capture_attempts:
- attempt_after = self._capture_metric_totals(_ATTEMPT_TRACE_TOTALS)
- deltas = self._metric_deltas(attempt_before, attempt_after)
- attempt_traces.append(
- net_attempt_trace(net_id, deltas, reached_target=result.reached_target, guidance_seed_present=guidance_seed_present)
- )
+ attempt_after = self._capture_metric_totals(_ATTEMPT_TRACE_TOTALS)
+ deltas = self._metric_deltas(attempt_before, attempt_after)
+ attempt_work[net_id] = deltas["nodes_expanded"] + deltas["congestion_check_calls"]
+ attempt_traces.append(
+ net_attempt_trace(net_id, deltas, reached_target=result.reached_target, guidance_seed_present=guidance_seed_present)
+ )
state.recent_attempt_work = attempt_work
review = self._reverify_iteration_results(state)
- if diagnostics.capture_pre_pair_frontier_trace:
- self._update_pre_pair_candidate(
- state,
- iteration=iteration,
- reroute_net_ids=reroute_net_ids,
- routed_net_ids=routed_net_ids,
- attempt_traces=attempt_traces,
- review=review,
- )
+ self._update_pre_pair_candidate(
+ state,
+ iteration=iteration,
+ reroute_net_ids=reroute_net_ids,
+ routed_net_ids=routed_net_ids,
+ attempt_traces=attempt_traces,
+ review=review,
+ )
if diagnostics.capture_iteration_trace:
iteration_after = self._capture_metric_totals(_ITERATION_TRACE_TOTALS)
deltas = self._metric_deltas(iteration_before, iteration_after)
@@ -1040,7 +1094,6 @@ class PathFinder:
if review is None:
return True
improved = self._update_best_iteration(state, review)
- state.best_is_installed = improved
if not any(
result.outcome in {"colliding", "partial", "unroutable"}
for result in state.results.values()
@@ -1068,7 +1121,7 @@ class PathFinder:
for net_id in state.ordered_net_ids:
result = state.results.get(net_id)
- if not result or not result.is_valid or not self.refiner.has_refinement_bends(result.path):
+ if not result or not result.path or result.outcome in {"colliding", "partial", "unroutable"}:
continue
net = state.net_specs[net_id]
self.metrics.total_refine_path_calls += 1
@@ -1138,20 +1191,11 @@ class PathFinder:
state = self._prepare_state(corridors)
timed_out = self._run_iterations(state, iteration_callback)
self.accumulated_expanded_nodes = list(state.accumulated_expanded_nodes)
- # A partial iteration or a callback can leave the index out of sync with the saved results.
- best_is_live = not timed_out and iteration_callback is None and state.best_is_installed
- if not best_is_live:
- self._restore_best_iteration(state)
+ self._restore_best_iteration(state)
+ self._analyze_restored_best(state)
- diagnostics = self.context.options.diagnostics
- capture_restored = diagnostics.capture_conflict_trace or diagnostics.capture_pre_pair_frontier_trace
- if not timed_out or capture_restored:
- review = state.best_review if best_is_live and not capture_restored else None
- if review is None:
- review = self._review_restored_best(state)
- if not timed_out:
- self._run_pair_local_search(state, review)
if not timed_out:
+ self._run_pair_local_search(state)
with phase_timer("refine") if phase_timer is not None and self.context.options.refinement.enabled else nullcontext():
self._refine_results(state)
with phase_timer("verify") if phase_timer is not None else nullcontext():
diff --git a/inire/router/_routing_policy.py b/inire/router/_routing_policy.py
index 2e49cb6..198b1ae 100644
--- a/inire/router/_routing_policy.py
+++ b/inire/router/_routing_policy.py
@@ -10,11 +10,10 @@ from shapely.geometry import Point
from inire.constants import TOLERANCE_LINEAR
from inire.geometry.collision import RoutingWorld
-from inire.geometry.components import Straight, path_within_board
+from inire.geometry.components import Straight
from inire.geometry.primitives import port_local_coordinates
from inire.model import resolve_bend_geometry
from inire.results import RoutingResult, RoutingStage
-from inire.router._congestion_policy import ordered_nets
from inire.router._stack import route_once
if TYPE_CHECKING:
@@ -34,6 +33,33 @@ class RouteCall(Protocol):
def __call__(self, problem: RoutingProblem, *, options: RoutingOptions) -> RoutingRunResult: ...
+@dataclass(frozen=True, slots=True)
+class _DirectPolicy:
+ residual_mode: Literal["guide", "seed"] | None = None
+ check_connectivity: bool = False
+ reorder_disconnected: bool = False
+ split_budget: bool = False
+ probe: Literal["first", "near-port", "after"] | None = None
+ retry_unresolved: bool = False
+
+
+_LOOKAHEAD_RETRY = _DirectPolicy(check_connectivity=True, reorder_disconnected=True, split_budget=True)
+_DIRECT_POLICY_SETTINGS = {
+ "direct-guide": _DirectPolicy(residual_mode="guide"),
+ "direct-seed": _DirectPolicy(residual_mode="seed"),
+ "direct-adaptive": _DirectPolicy(),
+ "direct-adaptive-retry": _DirectPolicy(retry_unresolved=True),
+ "direct-cull": _DirectPolicy(check_connectivity=True),
+ "direct-lookahead": _DirectPolicy(check_connectivity=True, reorder_disconnected=True),
+ "direct-budgeted-retry": _DirectPolicy(split_budget=True),
+ "direct-lookahead-retry": _LOOKAHEAD_RETRY,
+ "direct-probe-first": replace(_LOOKAHEAD_RETRY, probe="first"),
+ "direct-probe-near-port": replace(_LOOKAHEAD_RETRY, probe="near-port"),
+ "direct-probe-after": replace(_LOOKAHEAD_RETRY, probe="after"),
+}
+DIRECT_POLICIES = tuple(_DIRECT_POLICY_SETTINGS)
+
+
@dataclass(frozen=True, slots=True)
class LockPlan:
direct: dict[str, RoutingResult]
@@ -86,7 +112,10 @@ def _direct_paths(
world = RoutingWorld(clearance=problem.clearance, safety_zone_radius=problem.safety_zone_radius)
for obstacle in problem.static_obstacles:
world.add_static_obstacle(obstacle)
- ordered = ordered_nets(problem.nets, options.congestion.net_order)
+ ordered = list(problem.nets)
+ order = options.congestion.net_order
+ if order != "user":
+ ordered.sort(key=lambda net: sum(map(abs, port_local_coordinates(net.start, net.target.x, net.target.y))), reverse=order == "longest")
if priority:
ordered.sort(key=lambda net: net.net_id not in priority)
@@ -96,7 +125,7 @@ def _direct_paths(
if net.start.r != net.target.r or forward <= 0 or lateral:
continue
component = Straight.generate(net.start, forward, net.width, dilation=problem.clearance / 2)
- if not path_within_board((component,), board):
+ if any(not board.covers(shape) for shape in component.physical_geometry):
continue
report = world.verify_path_report(net.net_id, (component,))
if report.is_valid:
@@ -147,48 +176,15 @@ def _plan_locks(
problem: RoutingProblem,
board: Polygon,
options: RoutingOptions,
+ policy: _DirectPolicy,
*,
- check_connectivity: bool = True,
priority: frozenset[str] = frozenset(),
) -> LockPlan:
direct = _direct_paths(problem, board, options, priority=priority)
- disconnected = _disconnected_nets(problem, board, options, direct) if direct and check_connectivity else frozenset()
+ disconnected = _disconnected_nets(problem, board, options, direct) if direct and policy.check_connectivity else frozenset()
return LockPlan(direct, disconnected)
-def _prefer_connected_locks(problem: RoutingProblem, board: Polygon, options: RoutingOptions, locks: LockPlan) -> LockPlan:
- if not locks.disconnected:
- return locks
- candidate = _plan_locks(problem, board, options, priority=locks.disconnected)
- return candidate if len(candidate.disconnected) < len(locks.disconnected) else locks
-
-
-def _alternate_locks(
- problem: RoutingProblem,
- board: Polygon,
- options: RoutingOptions,
- locks: LockPlan,
- *,
- check_connectivity: bool = True,
-) -> LockPlan | None:
- if not 0 < len(locks.direct) < len(problem.nets) or options.search.node_limit <= 1:
- return None
- priority = frozenset(net.net_id for net in problem.nets if net.net_id not in locks.direct)
- candidate = _plan_locks(problem, board, options, check_connectivity=check_connectivity, priority=priority)
- if candidate.direct.keys() != locks.direct.keys() and len(candidate.disconnected) <= len(locks.disconnected):
- return candidate
- return None
-
-
-def _split_search_budget(options: RoutingOptions, probe_limit: int) -> tuple[RoutingOptions, RoutingOptions]:
- remaining = options.search.node_limit - probe_limit
- first_limit = remaining // 2
- return (
- replace(options, search=replace(options.search, node_limit=first_limit)),
- replace(options, search=replace(options.search, node_limit=remaining - first_limit)),
- )
-
-
def _residual_problem(problem: RoutingProblem, locks: LockPlan) -> RoutingProblem:
if not locks.direct and not locks.disconnected:
return problem
@@ -200,26 +196,15 @@ def _residual_problem(problem: RoutingProblem, locks: LockPlan) -> RoutingProble
def _route_residual(
problem: RoutingProblem,
options: RoutingOptions,
+ policy: str,
locks: LockPlan,
*,
- residual_mode: Literal["guide", "seed"] | None = None,
- run_route: RouteCall = route_once,
-) -> tuple[RoutingRunResult, RoutingStage]:
- return _route_prepared_residual(
- _residual_problem(problem, locks), options, locks, residual_mode=residual_mode, run_route=run_route
- )
-
-
-def _route_prepared_residual(
- problem: RoutingProblem,
- options: RoutingOptions,
- locks: LockPlan,
- *,
- residual_mode: Literal["guide", "seed"] | None = None,
run_route: RouteCall = route_once,
) -> tuple[RoutingRunResult, RoutingStage]:
direct = locks.direct
+ problem = _residual_problem(problem, locks)
residual = problem.nets
+ residual_mode = _DIRECT_POLICY_SETTINGS[policy].residual_mode
if not residual:
mode = "off"
elif residual_mode is not None:
@@ -242,11 +227,15 @@ def _route_prepared_residual(
)
-def _trial(run: RoutingRunResult, stage: RoutingStage, board: Polygon, *, score: Scorer) -> Trial:
+def _length(result: RoutingResult) -> float:
+ return sum(component.length for component in result.path)
+
+
+def _trial(run: RoutingRunResult, stage: RoutingStage, board: Polygon, *, score: Scorer = _length) -> Trial:
outside = tuple(
net_id
for net_id, result in run.results_by_net.items()
- if result.report.out_of_bounds or not path_within_board(result.path, board)
+ if result.report.out_of_bounds or any(not board.covers(shape) for shape in result.locked_geometry)
)
if outside:
results = dict(run.results_by_net)
@@ -303,33 +292,65 @@ def _direct_trials(
options: RoutingOptions,
strategy: str,
*,
- check_trial: CheckTrial,
run_route: RouteCall = route_once,
+ score: Scorer = _length,
+ check_trial: CheckTrial | None = None,
) -> list[Trial]:
def check(run: RoutingRunResult, stage: RoutingStage) -> Trial:
- return check_trial(run, replace(stage, policy=strategy))
+ stage = replace(stage, policy=strategy)
+ return _trial(run, stage, board, score=score) if check_trial is None else check_trial(run, stage)
- locks = _prefer_connected_locks(problem, board, options, _plan_locks(problem, board, options))
- retry_locks = _alternate_locks(problem, board, options, locks)
- first_options = options
- retry_options = options
+ policy = _DIRECT_POLICY_SETTINGS[strategy]
+ locks = _plan_locks(problem, board, options, policy)
+ if locks.disconnected and policy.reorder_disconnected:
+ candidate = _plan_locks(problem, board, options, policy, priority=locks.disconnected)
+ if len(candidate.disconnected) < len(locks.disconnected):
+ locks = candidate
+
+ first_options = retry_options = options
+ retry_locks = None
probe_limit = 0
- if retry_locks is not None:
- if strategy == "direct-probe-near-port" and _lock_near_new_port(problem, options, locks, retry_locks):
- probe_limit = min(32, options.search.node_limit // 3)
- first_options, retry_options = _split_search_budget(options, probe_limit)
+ can_reorder = 0 < len(locks.direct) < len(problem.nets)
+ if can_reorder and policy.split_budget and options.search.node_limit > 1:
+ priority = frozenset(net.net_id for net in problem.nets if net.net_id not in locks.direct)
+ candidate = _plan_locks(problem, board, options, policy, priority=priority)
+ if candidate.direct.keys() != locks.direct.keys() and len(candidate.disconnected) <= len(locks.disconnected):
+ retry_locks = candidate
+ limit = options.search.node_limit
+ if policy.probe is not None and (
+ policy.probe != "near-port" or _lock_near_new_port(problem, options, locks, retry_locks)
+ ):
+ probe_limit = min(32, limit // 3)
+ remaining = limit - probe_limit
+ first_limit = remaining // 2
+ first_options = replace(options, search=replace(options.search, node_limit=first_limit))
+ retry_options = replace(options, search=replace(options.search, node_limit=remaining - first_limit))
trials = []
- if probe_limit:
+ if probe_limit and policy.probe in ("first", "near-port"):
probe = _lattice_probe(problem, options, probe_limit, run_route=run_route, check_trial=check)
trials.append(probe)
if len(probe.valid_costs) == len(problem.nets):
return trials
- first = check(*_route_residual(problem, first_options, locks, run_route=run_route))
+ first = check(*_route_residual(problem, first_options, strategy, locks, run_route=run_route))
trials.append(first)
- if retry_locks is not None and len(first.valid_costs) < len(problem.nets):
- trials.append(check(*_route_residual(problem, retry_options, retry_locks, run_route=run_route)))
+ if len(first.valid_costs) == len(problem.nets):
+ return trials
+
+ if probe_limit and policy.probe == "after":
+ probe = _lattice_probe(problem, options, probe_limit, run_route=run_route, check_trial=check)
+ trials.append(probe)
+ if len(probe.valid_costs) == len(problem.nets):
+ return trials
+
+ if policy.retry_unresolved and can_reorder:
+ unresolved = frozenset(first.run.results_by_net.keys() - first.valid_costs.keys())
+ candidate = _plan_locks(problem, board, options, policy, priority=unresolved)
+ if candidate.direct.keys() != locks.direct.keys():
+ retry_locks = candidate
+ if retry_locks is not None:
+ trials.append(check(*_route_residual(problem, retry_options, strategy, retry_locks, run_route=run_route)))
return trials
diff --git a/inire/router/_stack.py b/inire/router/_stack.py
index 0beae41..69d75d4 100644
--- a/inire/router/_stack.py
+++ b/inire/router/_stack.py
@@ -6,7 +6,6 @@ from typing import TYPE_CHECKING
from shapely.geometry import box
from inire.geometry.collision import RoutingWorld
-from inire.geometry.components import path_within_board
from inire.results import RoutingRunResult
from inire.router._astar_types import AStarContext
from inire.router._router import PathFinder
@@ -45,17 +44,17 @@ def build_routing_stack(problem: RoutingProblem, options: RoutingOptions) -> Rou
world.add_static_obstacle(obstacle)
danger_map = DangerMap(bounds=problem.bounds)
- refinement = options.refinement
- if options.objective.danger_weight or (
- refinement.enabled and refinement.objective is not None and refinement.objective.danger_weight
- ):
- danger_map.precompute(list(problem.static_obstacles))
+ danger_map.precompute(list(problem.static_obstacles))
- evaluator = CostEvaluator.from_objective(
+ objective = options.objective
+ evaluator = CostEvaluator(
world,
danger_map,
- options.objective,
+ unit_length_cost=objective.unit_length_cost,
greedy_h_weight=options.search.greedy_h_weight,
+ bend_penalty=objective.bend_penalty,
+ sbend_penalty=objective.sbend_penalty,
+ danger_weight=objective.danger_weight,
)
context = AStarContext(evaluator, problem, options)
finder = PathFinder(context)
@@ -85,13 +84,9 @@ def route_once(
if options.topology.mode == "bundle":
board = box(*problem.bounds)
for result in results.values():
- if not result.is_valid or not path_within_board(result.path, board):
+ if not result.is_valid or any(not board.covers(shape) for shape in result.locked_geometry):
raise ValueError(f"Bundle schedule failed geometric verification for {result.net_id}")
- return collect_worker_result(finder, results)
-
-
-def collect_worker_result(finder: PathFinder, results: dict[str, RoutingResult]) -> RoutingRunResult:
return RoutingRunResult(
results_by_net=results,
metrics=finder.metrics.snapshot(),
diff --git a/inire/router/cost.py b/inire/router/cost.py
index f7f2ba0..b18391d 100644
--- a/inire/router/cost.py
+++ b/inire/router/cost.py
@@ -6,17 +6,16 @@ from typing import TYPE_CHECKING
import numpy as np
from inire.constants import TOLERANCE_LINEAR
-from inire.geometry.collision import RoutingWorld
from inire.model import ObjectiveWeights
-from inire.router.danger_map import DangerMap
if TYPE_CHECKING:
from collections.abc import Iterable, Mapping, Sequence
from typing import Protocol
+ from inire.geometry.collision import RoutingWorld
from inire.geometry.components import MoveKind
from inire.geometry.primitives import Port
- from inire.model import RoutingProblem
+ from inire.router.danger_map import DangerMap
class ScoreableMove(Protocol):
@property
@@ -70,25 +69,6 @@ class CostEvaluator:
self._target_cos = 1.0
self._target_sin = 0.0
- @classmethod
- def from_objective(
- cls,
- world: RoutingWorld,
- danger_map: DangerMap | None,
- objective: ObjectiveWeights,
- *,
- greedy_h_weight: float = 1.5,
- ) -> CostEvaluator:
- return cls(
- world,
- danger_map,
- unit_length_cost=objective.unit_length_cost,
- greedy_h_weight=greedy_h_weight,
- bend_penalty=objective.bend_penalty,
- sbend_penalty=objective.sbend_penalty,
- danger_weight=objective.danger_weight,
- )
-
@property
def default_weights(self) -> ObjectiveWeights:
return self._search_weights
@@ -239,12 +219,3 @@ class CostEvaluator:
)
current_port = component.end_port
return total
-
-
-def build_native_cost_evaluator(problem: RoutingProblem, objective: ObjectiveWeights) -> CostEvaluator:
- """Score candidate paths using the original layout's obstacles and objective."""
- danger = None
- if objective.danger_weight and problem.static_obstacles:
- danger = DangerMap(bounds=problem.bounds)
- danger.precompute(list(problem.static_obstacles))
- return CostEvaluator.from_objective(RoutingWorld(clearance=problem.clearance), danger, objective)
diff --git a/inire/router/refiner.py b/inire/router/refiner.py
index a674060..4383770 100644
--- a/inire/router/refiner.py
+++ b/inire/router/refiner.py
@@ -313,10 +313,6 @@ class PathRefiner:
return None
return best_path, best_candidate_cost
- @staticmethod
- def has_refinement_bends(path: Sequence[ComponentResult]) -> bool:
- return len(path) >= 4 and sum(component.move_type == "bend90" for component in path) >= 4
-
def refine_path(
self,
net_id: str,
@@ -324,10 +320,16 @@ class PathRefiner:
net_width: float,
path: Sequence[ComponentResult],
) -> list[ComponentResult]:
- if not self.has_refinement_bends(path):
+ if not path:
return list(path)
- best_path = list(path)
+ path = list(path)
+
+ bend_count = sum(1 for comp in path if comp.move_type == "bend90")
+ if bend_count < 4:
+ return path
+
+ best_path = path
best_cost = self.score_path(start, path)
remaining = self.context.options.refinement.max_windows_per_net
incumbent_valid = None
diff --git a/inire/router/visibility.py b/inire/router/visibility.py
index 8d107bf..ea4b610 100644
--- a/inire/router/visibility.py
+++ b/inire/router/visibility.py
@@ -56,6 +56,9 @@ class VisibilityManager:
if self._corner_graph_version != static_version:
self._build_corner_graph()
+ def _ensure_current(self) -> None:
+ self.ensure_corner_graph_current()
+
def _build_corner_index(self) -> None:
if self.collision_engine.metrics is not None:
self.collision_engine.metrics.total_visibility_corner_index_builds += 1
diff --git a/inire/tests/direct_routing_policies.py b/inire/tests/direct_routing_policies.py
deleted file mode 100644
index 8820c68..0000000
--- a/inire/tests/direct_routing_policies.py
+++ /dev/null
@@ -1,109 +0,0 @@
-"""Direct routing policies available through the benchmark CLI."""
-
-from __future__ import annotations
-
-from dataclasses import dataclass, replace
-from functools import partial
-from typing import TYPE_CHECKING
-
-from inire.router._routing_policy import (
- _alternate_locks,
- _direct_trials,
- _lattice_probe,
- _plan_locks,
- _prefer_connected_locks,
- _route_residual,
- _split_search_budget,
- _trial,
-)
-from inire.router._stack import route_once
-from inire.tests.routing_corpus import benchmark_weighted_length
-
-if TYPE_CHECKING:
- from typing import Literal
-
- from shapely.geometry import Polygon
-
- from inire import RoutingOptions, RoutingProblem, RoutingRunResult, RoutingStage
- from inire.router._routing_policy import LockPlan, Trial
-
-
-@dataclass(frozen=True, slots=True)
-class _DirectExperiment:
- residual_mode: Literal["guide", "seed"] | None = None
- check_connectivity: bool = False
- reorder_disconnected: bool = False
- split_budget: bool = False
- probe: Literal["first", "after"] | None = None
- retry_unresolved: bool = False
-
-
-_LOOKAHEAD = _DirectExperiment(check_connectivity=True, reorder_disconnected=True)
-# The two None entries use the shipped retry sequence.
-_EXPERIMENTS = {
- "direct-guide": _DirectExperiment(residual_mode="guide"),
- "direct-seed": _DirectExperiment(residual_mode="seed"),
- "direct-adaptive": _DirectExperiment(),
- "direct-adaptive-retry": _DirectExperiment(retry_unresolved=True),
- "direct-cull": _DirectExperiment(check_connectivity=True),
- "direct-lookahead": _LOOKAHEAD,
- "direct-budgeted-retry": _DirectExperiment(split_budget=True),
- "direct-lookahead-retry": None,
- "direct-probe-first": replace(_LOOKAHEAD, split_budget=True, probe="first"),
- "direct-probe-near-port": None,
- "direct-probe-after": replace(_LOOKAHEAD, split_budget=True, probe="after"),
-}
-DIRECT_POLICIES = tuple(_EXPERIMENTS)
-
-
-def direct_trials(problem: RoutingProblem, board: Polygon, options: RoutingOptions, strategy: str) -> list[Trial]:
- experiment = _EXPERIMENTS[strategy]
- summarize = partial(_trial, board=board, score=benchmark_weighted_length)
- if experiment is None:
- return _direct_trials(problem, board, options, strategy, check_trial=summarize)
-
- def check(run: RoutingRunResult, stage: RoutingStage) -> Trial:
- return summarize(run, replace(stage, policy=strategy))
-
- def run_residual(worker: RoutingOptions, locks: LockPlan) -> Trial:
- return check(*_route_residual(problem, worker, locks, residual_mode=experiment.residual_mode))
-
- plan = partial(_plan_locks, problem, board, options, check_connectivity=experiment.check_connectivity)
- locks = plan()
- if experiment.reorder_disconnected:
- locks = _prefer_connected_locks(problem, board, options, locks)
-
- first_options = options
- retry_options = options
- retry_locks = None
- probe_limit = 0
- if experiment.split_budget:
- retry_locks = _alternate_locks(problem, board, options, locks, check_connectivity=experiment.check_connectivity)
- if retry_locks is not None:
- probe_limit = min(32, options.search.node_limit // 3) if experiment.probe else 0
- first_options, retry_options = _split_search_budget(options, probe_limit)
-
- trials = []
- if probe_limit and experiment.probe == "first":
- trials.append(_lattice_probe(problem, options, probe_limit, run_route=route_once, check_trial=check))
- if len(trials[-1].valid_costs) == len(problem.nets):
- return trials
-
- first = run_residual(first_options, locks)
- trials.append(first)
- if len(first.valid_costs) == len(problem.nets):
- return trials
-
- if probe_limit and experiment.probe == "after":
- trials.append(_lattice_probe(problem, options, probe_limit, run_route=route_once, check_trial=check))
- if len(trials[-1].valid_costs) == len(problem.nets):
- return trials
-
- if experiment.retry_unresolved and 0 < len(locks.direct) < len(problem.nets):
- unresolved = frozenset(first.run.results_by_net.keys() - first.valid_costs.keys())
- candidate = plan(priority=unresolved)
- if candidate.direct.keys() != locks.direct.keys():
- retry_locks = candidate
- if retry_locks is not None:
- trials.append(run_residual(retry_options, retry_locks))
- return trials
diff --git a/inire/tests/example_scenarios.py b/inire/tests/example_scenarios.py
index e28fd60..9489d98 100644
--- a/inire/tests/example_scenarios.py
+++ b/inire/tests/example_scenarios.py
@@ -1,6 +1,6 @@
from __future__ import annotations
-from dataclasses import dataclass, replace
+from dataclasses import dataclass
from functools import partial
from time import perf_counter
from typing import TYPE_CHECKING
@@ -13,6 +13,7 @@ from inire import (
DiagnosticsOptions,
NetSpec,
ObjectiveWeights,
+ RefinementOptions,
RoutingOptions,
RoutingProblem,
RoutingResult,
@@ -20,20 +21,25 @@ from inire import (
SearchOptions,
route,
)
+from inire.geometry.collision import RoutingWorld
from inire.geometry.primitives import Port
from inire.results import RouteMetrics, _sum_route_metrics
-from inire.router._stack import build_routing_stack, collect_worker_result
+from inire.router._astar_types import AStarContext, AStarMetrics
+from inire.router._router import PathFinder
+from inire.router.cost import CostEvaluator
+from inire.router.danger_map import DangerMap
from inire.tests.routing_corpus import SNAPSHOT_CASES, profile_options
from inire.tests.terminal_bench_scenario import terminal_bench_options, terminal_bench_problem
if TYPE_CHECKING:
- from collections.abc import Iterable
-
- from inire.router._astar_types import AStarMetrics
- from inire.router._router import PathFinder
- from inire.router.cost import CostEvaluator
from inire.tests.routing_benchmark_case import BenchmarkCase
+_SEARCH_FIELDS = set(SearchOptions.__dataclass_fields__)
+_CONGESTION_FIELDS = set(CongestionOptions.__dataclass_fields__)
+_REFINEMENT_FIELDS = set(RefinementOptions.__dataclass_fields__)
+_DIAGNOSTICS_FIELDS = set(DiagnosticsOptions.__dataclass_fields__)
+_OBJECTIVE_FIELDS = set(ObjectiveWeights.__dataclass_fields__)
+
ScenarioOutcome = tuple[float, int, int, int]
ScenarioRun = Callable[[], ScenarioOutcome]
ScenarioSnapshotRun = Callable[[], "ScenarioSnapshot"]
@@ -58,6 +64,15 @@ class ScenarioSnapshot:
)
+def _summarize(results: dict[str, RoutingResult], duration_s: float) -> ScenarioOutcome:
+ return (
+ duration_s,
+ len(results),
+ sum(1 for result in results.values() if result.is_valid),
+ sum(1 for result in results.values() if result.reached_target),
+ )
+
+
def _make_snapshot(
name: str,
results: dict[str, RoutingResult],
@@ -74,137 +89,312 @@ def _make_snapshot(
)
-def _snapshot_worker(name: str, pathfinder: PathFinder) -> ScenarioSnapshot:
- start = perf_counter()
- results = pathfinder.route_all()
- return _make_snapshot(name, results, perf_counter() - start, pathfinder.metrics.snapshot())
+def _make_run_result(
+ results: dict[str, RoutingResult],
+ pathfinder: PathFinder,
+) -> RoutingRunResult:
+ return RoutingRunResult(
+ results_by_net=results,
+ metrics=pathfinder.metrics.snapshot(),
+ expanded_nodes=tuple(pathfinder.accumulated_expanded_nodes),
+ conflict_trace=tuple(pathfinder.conflict_trace),
+ frontier_trace=tuple(pathfinder.frontier_trace),
+ pre_pair_frontier_trace=pathfinder.pre_pair_frontier_trace,
+ iteration_trace=tuple(pathfinder.iteration_trace),
+ )
+
+
+def _build_evaluator(
+ bounds: tuple[float, float, float, float],
+ *,
+ clearance: float = 2.0,
+ obstacles: list[Polygon] | None = None,
+ bend_penalty: float = 50.0,
+ sbend_penalty: float = 150.0,
+) -> CostEvaluator:
+ static_obstacles = obstacles or []
+ engine = RoutingWorld(clearance=clearance)
+ for obstacle in static_obstacles:
+ engine.add_static_obstacle(obstacle)
+
+ danger_map = DangerMap(bounds=bounds)
+ danger_map.precompute(static_obstacles)
+ return CostEvaluator(engine, danger_map, bend_penalty=bend_penalty, sbend_penalty=sbend_penalty)
+
+
+def _net_specs(
+ netlist: dict[str, tuple[Port, Port]],
+ widths: dict[str, float],
+) -> tuple[NetSpec, ...]:
+ return tuple(
+ NetSpec(net_id=net_id, start=start, target=target, width=widths.get(net_id, 2.0))
+ for net_id, (start, target) in netlist.items()
+ )
+
+
+def _build_options(**overrides: object) -> RoutingOptions:
+ search_overrides = {key: value for key, value in overrides.items() if key in _SEARCH_FIELDS}
+ congestion_overrides = {key: value for key, value in overrides.items() if key in _CONGESTION_FIELDS}
+ refinement_overrides = {key: value for key, value in overrides.items() if key in _REFINEMENT_FIELDS}
+ diagnostics_overrides = {key: value for key, value in overrides.items() if key in _DIAGNOSTICS_FIELDS}
+ objective_overrides = {key: value for key, value in overrides.items() if key in _OBJECTIVE_FIELDS}
+ return RoutingOptions(
+ search=SearchOptions(**search_overrides),
+ congestion=CongestionOptions(**congestion_overrides),
+ refinement=RefinementOptions(**refinement_overrides),
+ diagnostics=DiagnosticsOptions(**diagnostics_overrides),
+ objective=ObjectiveWeights(**objective_overrides),
+ )
+
+
+def _build_pathfinder(
+ evaluator: CostEvaluator,
+ *,
+ bounds: tuple[float, float, float, float],
+ nets: tuple[NetSpec, ...],
+ metrics: AStarMetrics | None = None,
+ **request_kwargs: object,
+) -> PathFinder:
+ resolved_metrics = AStarMetrics() if metrics is None else metrics
+ return PathFinder(
+ AStarContext(
+ evaluator,
+ RoutingProblem(bounds=bounds, nets=nets),
+ _build_options(**request_kwargs),
+ metrics=resolved_metrics,
+ ),
+ metrics=resolved_metrics,
+ )
+
+
+def _build_routing_stack(
+ *,
+ bounds: tuple[float, float, float, float],
+ netlist: dict[str, tuple[Port, Port]],
+ widths: dict[str, float],
+ clearance: float = 2.0,
+ obstacles: list[Polygon] | None = None,
+ evaluator_kwargs: dict[str, float] | None = None,
+ request_kwargs: dict[str, object] | None = None,
+) -> tuple[RoutingWorld, CostEvaluator, AStarMetrics, object]:
+ static_obstacles = obstacles or []
+ engine = RoutingWorld(clearance=clearance)
+ for obstacle in static_obstacles:
+ engine.add_static_obstacle(obstacle)
+
+ danger_map = DangerMap(bounds=bounds)
+ danger_map.precompute(static_obstacles)
+
+ evaluator = CostEvaluator(engine, danger_map, **(evaluator_kwargs or {}))
+ metrics = AStarMetrics()
+ pathfinder = _build_pathfinder(
+ evaluator,
+ bounds=bounds,
+ nets=_net_specs(netlist, widths),
+ metrics=metrics,
+ **(request_kwargs or {}),
+ )
+ return engine, evaluator, metrics, pathfinder
def snapshot_example_01() -> ScenarioSnapshot:
- problem = RoutingProblem(
+ netlist = {"net1": (Port(10, 50, 0), Port(90, 50, 0))}
+ widths = {"net1": 2.0}
+ _, _, _, pathfinder = _build_routing_stack(
bounds=(0, 0, 100, 100),
- nets=(NetSpec("net1", Port(10, 50, 0), Port(90, 50, 0)),),
+ netlist=netlist,
+ widths=widths,
+ request_kwargs={"bend_radii": [10.0]},
)
- options = RoutingOptions(search=SearchOptions(bend_radii=(10.0,)))
- return _snapshot_worker("example_01_simple_route", build_routing_stack(problem, options).finder)
+ t0 = perf_counter()
+ results = pathfinder.route_all()
+ t1 = perf_counter()
+ return _make_snapshot("example_01_simple_route", results, t1 - t0, pathfinder.metrics.snapshot())
+
+
+def run_example_01() -> ScenarioOutcome:
+ return snapshot_example_01().as_outcome()
def snapshot_example_02() -> ScenarioSnapshot:
- problem = RoutingProblem(
+ netlist = {
+ "horizontal": (Port(10, 50, 0), Port(90, 50, 0)),
+ "vertical_up": (Port(45, 10, 90), Port(45, 90, 90)),
+ "vertical_down": (Port(55, 90, 270), Port(55, 10, 270)),
+ }
+ widths = dict.fromkeys(netlist, 2.0)
+ _, _, _, pathfinder = _build_routing_stack(
bounds=(0, 0, 100, 100),
- nets=(
- NetSpec("horizontal", Port(10, 50, 0), Port(90, 50, 0)),
- NetSpec("vertical_up", Port(45, 10, 90), Port(45, 90, 90)),
- NetSpec("vertical_down", Port(55, 90, 270), Port(55, 10, 270)),
- ),
+ netlist=netlist,
+ widths=widths,
+ evaluator_kwargs={
+ "greedy_h_weight": 1.5,
+ "bend_penalty": 50.0,
+ "sbend_penalty": 150.0,
+ },
+ request_kwargs={
+ "bend_radii": [10.0],
+ "sbend_radii": [10.0],
+ "base_penalty": 1000.0,
+ },
)
- options = RoutingOptions(
- search=SearchOptions(bend_radii=(10.0,), sbend_radii=(10.0,)),
- objective=ObjectiveWeights(bend_penalty=50.0, sbend_penalty=150.0),
- congestion=CongestionOptions(base_penalty=1000.0),
- )
- return _snapshot_worker("example_02_congestion_resolution", build_routing_stack(problem, options).finder)
+ t0 = perf_counter()
+ results = pathfinder.route_all()
+ t1 = perf_counter()
+ return _make_snapshot("example_02_congestion_resolution", results, t1 - t0, pathfinder.metrics.snapshot())
+
+
+def run_example_02() -> ScenarioOutcome:
+ return snapshot_example_02().as_outcome()
def snapshot_example_03() -> ScenarioSnapshot:
- problem_a = RoutingProblem(
+ netlist_a = {"netA": (Port(10, 0, 0), Port(90, 0, 0))}
+ widths_a = {"netA": 2.0}
+ engine, evaluator, _, pathfinder = _build_routing_stack(
bounds=(0, -50, 100, 50),
- nets=(NetSpec("netA", Port(10, 0, 0), Port(90, 0, 0)),),
+ netlist=netlist_a,
+ widths=widths_a,
+ request_kwargs={"bend_radii": [10.0]},
)
- options = RoutingOptions(
- search=SearchOptions(bend_radii=(10.0,)),
- objective=ObjectiveWeights(danger_weight=0.0),
- )
- finder_a = build_routing_stack(problem_a, options).finder
t0 = perf_counter()
- results_a = finder_a.route_all()
- problem_b = RoutingProblem(
- bounds=problem_a.bounds,
- nets=(NetSpec("netB", Port(50, -20, 90), Port(50, 20, 90)),),
- static_obstacles=results_a["netA"].locked_geometry,
+ results_a = pathfinder.route_all()
+ metrics_a = pathfinder.metrics.snapshot()
+ for polygon in results_a["netA"].locked_geometry:
+ engine.add_static_obstacle(polygon)
+ pathfinder_b = _build_pathfinder(
+ evaluator,
+ bounds=(0, -50, 100, 50),
+ nets=_net_specs({"netB": (Port(50, -20, 90), Port(50, 20, 90))}, {"netB": 2.0}),
+ bend_radii=[10.0],
)
- finder_b = build_routing_stack(problem_b, options).finder
- results_b = finder_b.route_all()
+ results_b = pathfinder_b.route_all()
t1 = perf_counter()
- combined_metrics = _sum_route_metrics((finder_a.metrics.snapshot(), finder_b.metrics.snapshot()))
+ combined_metrics = _sum_route_metrics((metrics_a, pathfinder_b.metrics.snapshot()))
return _make_snapshot("example_03_locked_paths", {**results_a, **results_b}, t1 - t0, combined_metrics)
+def run_example_03() -> ScenarioOutcome:
+ return snapshot_example_03().as_outcome()
+
+
def snapshot_example_04() -> ScenarioSnapshot:
- problem = RoutingProblem(
+ netlist = {
+ "sbend_only": (Port(10, 50, 0), Port(60, 55, 0)),
+ "multi_radii": (Port(10, 10, 0), Port(90, 90, 0)),
+ }
+ widths = {"sbend_only": 2.0, "multi_radii": 2.0}
+ _, _, _, pathfinder = _build_routing_stack(
bounds=(0, 0, 100, 100),
- nets=(
- NetSpec("sbend_only", Port(10, 50, 0), Port(60, 55, 0)),
- NetSpec("multi_radii", Port(10, 10, 0), Port(90, 90, 0)),
- ),
+ netlist=netlist,
+ widths=widths,
+ evaluator_kwargs={
+ "unit_length_cost": 1.0,
+ "bend_penalty": 10.0,
+ "sbend_penalty": 20.0,
+ },
+ request_kwargs={
+ "node_limit": 50000,
+ "bend_radii": [10.0, 30.0],
+ "sbend_offsets": [5.0],
+ },
)
- options = RoutingOptions(
- search=SearchOptions(node_limit=50_000, bend_radii=(10.0, 30.0), sbend_offsets=(5.0,)),
- objective=ObjectiveWeights(bend_penalty=10.0, sbend_penalty=20.0),
- )
- return _snapshot_worker("example_04_sbends_and_radii", build_routing_stack(problem, options).finder)
+ t0 = perf_counter()
+ results = pathfinder.route_all()
+ t1 = perf_counter()
+ return _make_snapshot("example_04_sbends_and_radii", results, t1 - t0, pathfinder.metrics.snapshot())
-def _build_example_05_worker(diagnostics: DiagnosticsOptions) -> PathFinder:
- problem = RoutingProblem(
- bounds=(0, 0, 200, 200),
- nets=(
- NetSpec("u_turn", Port(50, 50, 0), Port(50, 70, 180)),
- NetSpec("loop", Port(100, 100, 90), Port(100, 80, 270)),
- NetSpec("zig_zag", Port(20, 150, 0), Port(180, 150, 0)),
- ),
- )
- options = RoutingOptions(
- search=SearchOptions(bend_radii=(20.0,)),
- objective=ObjectiveWeights(bend_penalty=50.0, sbend_penalty=100.0),
- diagnostics=diagnostics,
- )
- return build_routing_stack(problem, options).finder
+def run_example_04() -> ScenarioOutcome:
+ return snapshot_example_04().as_outcome()
def snapshot_example_05() -> ScenarioSnapshot:
- return _snapshot_worker("example_05_orientation_stress", _build_example_05_worker(DiagnosticsOptions()))
+ netlist = {
+ "u_turn": (Port(50, 50, 0), Port(50, 70, 180)),
+ "loop": (Port(100, 100, 90), Port(100, 80, 270)),
+ "zig_zag": (Port(20, 150, 0), Port(180, 150, 0)),
+ }
+ widths = dict.fromkeys(netlist, 2.0)
+ _, _, _, pathfinder = _build_routing_stack(
+ bounds=(0, 0, 200, 200),
+ netlist=netlist,
+ widths=widths,
+ evaluator_kwargs={"bend_penalty": 50.0},
+ request_kwargs={"bend_radii": [20.0]},
+ )
+ t0 = perf_counter()
+ results = pathfinder.route_all()
+ t1 = perf_counter()
+ return _make_snapshot("example_05_orientation_stress", results, t1 - t0, pathfinder.metrics.snapshot())
+
+
+def run_example_05() -> ScenarioOutcome:
+ return snapshot_example_05().as_outcome()
def trace_example_05() -> RoutingRunResult:
- pathfinder = _build_example_05_worker(DiagnosticsOptions(capture_conflict_trace=True, capture_frontier_trace=True))
+ netlist = {
+ "u_turn": (Port(50, 50, 0), Port(50, 70, 180)),
+ "loop": (Port(100, 100, 90), Port(100, 80, 270)),
+ "zig_zag": (Port(20, 150, 0), Port(180, 150, 0)),
+ }
+ widths = dict.fromkeys(netlist, 2.0)
+ _, _, _, pathfinder = _build_routing_stack(
+ bounds=(0, 0, 200, 200),
+ netlist=netlist,
+ widths=widths,
+ evaluator_kwargs={"bend_penalty": 50.0},
+ request_kwargs={"bend_radii": [20.0], "capture_conflict_trace": True, "capture_frontier_trace": True},
+ )
results = pathfinder.route_all()
- return collect_worker_result(pathfinder, results)
+ return _make_run_result(results, pathfinder)
def snapshot_example_06() -> ScenarioSnapshot:
bounds = (-20, -20, 170, 170)
- obstacles = (
+ obstacles = [
box(40, 110, 60, 130),
box(40, 60, 60, 80),
box(40, 10, 60, 30),
- )
+ ]
custom_physical = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)])
- search = SearchOptions(bend_radii=(10.0,))
- options = RoutingOptions(
- objective=ObjectiveWeights(bend_penalty=50.0, sbend_penalty=150.0),
- congestion=CongestionOptions(use_tiered_strategy=False),
- )
- scenarios = (
- (NetSpec("arc_model", Port(10, 120, 0), Port(90, 140, 90)), search),
- (NetSpec("bbox_model", Port(10, 70, 0), Port(90, 90, 90)), replace(search, bend_collision_type="bbox")),
+ scenarios = [
(
- NetSpec("custom_geometry", Port(10, 20, 0), Port(90, 40, 90)),
- replace(search, bend_physical_geometry=custom_physical, bend_proxy_geometry=custom_physical),
+ _build_evaluator(bounds, obstacles=obstacles),
+ {"arc_model": (Port(10, 120, 0), Port(90, 140, 90))},
+ {"arc_model": 2.0},
+ {"bend_radii": [10.0], "bend_collision_type": "arc", "use_tiered_strategy": False},
+ ),
+ (
+ _build_evaluator(bounds, obstacles=obstacles),
+ {"bbox_model": (Port(10, 70, 0), Port(90, 90, 90))},
+ {"bbox_model": 2.0},
+ {"bend_radii": [10.0], "bend_collision_type": "bbox", "use_tiered_strategy": False},
+ ),
+ (
+ _build_evaluator(bounds, obstacles=obstacles),
+ {"custom_geometry": (Port(10, 20, 0), Port(90, 40, 90))},
+ {"custom_geometry": 2.0},
+ {
+ "bend_radii": [10.0],
+ "bend_physical_geometry": custom_physical,
+ "bend_proxy_geometry": custom_physical,
+ "use_tiered_strategy": False,
+ },
),
- )
- finders = [
- build_routing_stack(
- RoutingProblem(bounds=bounds, nets=(net,), static_obstacles=obstacles),
- replace(options, search=scenario_search),
- ).finder
- for net, scenario_search in scenarios
]
t0 = perf_counter()
combined_results: dict[str, RoutingResult] = {}
route_metrics: list[RouteMetrics] = []
- for pathfinder in finders:
+ for evaluator, netlist, net_widths, request_kwargs in scenarios:
+ pathfinder = _build_pathfinder(
+ evaluator,
+ bounds=bounds,
+ nets=_net_specs(netlist, net_widths),
+ **request_kwargs,
+ )
combined_results.update(pathfinder.route_all())
route_metrics.append(pathfinder.metrics.snapshot())
t1 = perf_counter()
@@ -216,6 +406,10 @@ def snapshot_example_06() -> ScenarioSnapshot:
)
+def run_example_06() -> ScenarioOutcome:
+ return snapshot_example_06().as_outcome()
+
+
def snapshot_example_07() -> ScenarioSnapshot:
return _snapshot_example_07_variant(
"example_07_large_scale_routing",
@@ -261,59 +455,54 @@ def _build_example_07_variant_stack(
capture_pre_pair_frontier_trace: bool = False,
) -> tuple[CostEvaluator, AStarMetrics, PathFinder]:
bounds = (0, 0, 1000, 1000)
- obstacles = (
+ obstacles = [
box(450, 0, 550, 400),
box(450, 600, 550, 1000),
- )
+ ]
start_x = 50
start_y_base = 500 - (num_nets * 10.0) / 2.0
end_x = 950
end_y_base = 100
end_y_pitch = 800.0 / (num_nets - 1)
- nets = []
+ netlist = {}
for index in range(num_nets):
sy = int(round(start_y_base + index * 10.0))
ey = int(round(end_y_base + index * end_y_pitch))
- nets.append(NetSpec(f"net_{index:02d}", Port(start_x, sy, 0), Port(end_x, ey, 0)))
- problem = RoutingProblem(
+ netlist[f"net_{index:02d}"] = (Port(start_x, sy, 0), Port(end_x, ey, 0))
+ widths = dict.fromkeys(netlist, 2.0)
+ _, evaluator, metrics, pathfinder = _build_routing_stack(
bounds=bounds,
- nets=tuple(nets),
- static_obstacles=obstacles,
+ netlist=netlist,
+ widths=widths,
clearance=6.0,
+ obstacles=obstacles,
+ evaluator_kwargs={
+ "greedy_h_weight": 1.5,
+ "unit_length_cost": 0.1,
+ "bend_penalty": 100.0,
+ "sbend_penalty": 400.0,
+ },
+ request_kwargs={
+ "node_limit": 2000000,
+ "bend_radii": [50.0],
+ "sbend_radii": [50.0],
+ "bend_clip_margin": 10.0,
+ "max_iterations": 15,
+ "base_penalty": 100.0,
+ "multiplier": 1.4,
+ "net_order": "shortest",
+ "capture_expanded": True,
+ "capture_conflict_trace": capture_conflict_trace,
+ "capture_frontier_trace": capture_frontier_trace,
+ "capture_iteration_trace": capture_iteration_trace,
+ "capture_pre_pair_frontier_trace": capture_pre_pair_frontier_trace,
+ "shuffle_nets": True,
+ "seed": seed,
+ "warm_start_enabled": warm_start_enabled,
+ },
)
- options = RoutingOptions(
- search=SearchOptions(
- node_limit=2_000_000,
- bend_radii=(50.0,),
- sbend_radii=(50.0,),
- greedy_h_weight=1.5,
- bend_clip_margin=10.0,
- ),
- objective=ObjectiveWeights(
- unit_length_cost=0.1,
- bend_penalty=100.0,
- sbend_penalty=400.0,
- ),
- congestion=CongestionOptions(
- max_iterations=15,
- base_penalty=100.0,
- multiplier=1.4,
- net_order="shortest",
- shuffle_nets=True,
- seed=seed,
- warm_start_enabled=warm_start_enabled,
- ),
- diagnostics=DiagnosticsOptions(
- capture_expanded=True,
- capture_conflict_trace=capture_conflict_trace,
- capture_frontier_trace=capture_frontier_trace,
- capture_iteration_trace=capture_iteration_trace,
- capture_pre_pair_frontier_trace=capture_pre_pair_frontier_trace,
- ),
- )
- stack = build_routing_stack(problem, options)
- return stack.evaluator, stack.finder.metrics, stack.finder
+ return evaluator, metrics, pathfinder
def _run_example_07_variant(
@@ -343,7 +532,7 @@ def _run_example_07_variant(
metrics.reset_per_route()
results = pathfinder.route_all(iteration_callback=iteration_callback)
- return collect_worker_result(pathfinder, results)
+ return _make_run_result(results, pathfinder)
def _snapshot_example_07_variant(
@@ -378,27 +567,41 @@ def _trace_example_07_variant(
)
-def _build_example_08_workers() -> tuple[PathFinder, PathFinder]:
- net = NetSpec("standard_arc", Port(20, 20, 0), Port(100, 100, 90))
- problem = RoutingProblem(bounds=(0, 0, 150, 150), nets=(net,))
- options = RoutingOptions(
- search=SearchOptions(bend_radii=(10.0,), sbend_radii=()),
- objective=ObjectiveWeights(bend_penalty=50.0, sbend_penalty=150.0),
- congestion=CongestionOptions(max_iterations=1, use_tiered_strategy=False),
- )
- custom_physical = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)])
- custom_problem = replace(problem, nets=(replace(net, net_id="custom_geometry_and_proxy"),))
- custom_options = replace(
- options,
- search=replace(options.search, bend_physical_geometry=custom_physical, bend_proxy_geometry=box(0, -11, 11, 0)),
- )
- return build_routing_stack(problem, options).finder, build_routing_stack(custom_problem, custom_options).finder
+def run_example_07() -> ScenarioOutcome:
+ return snapshot_example_07().as_outcome()
def snapshot_example_08() -> ScenarioSnapshot:
+ bounds = (0, 0, 150, 150)
+ netlist = {"standard_arc": (Port(20, 20, 0), Port(100, 100, 90))}
+ widths = {"standard_arc": 2.0}
+ custom_physical = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)])
+ custom_proxy = box(0, -11, 11, 0)
+
t0 = perf_counter()
- pathfinder_std, pathfinder_custom = _build_example_08_workers()
+ pathfinder_std = _build_pathfinder(
+ _build_evaluator(bounds),
+ bounds=bounds,
+ nets=_net_specs(netlist, widths),
+ bend_radii=[10.0],
+ sbend_radii=[],
+ max_iterations=1,
+ use_tiered_strategy=False,
+ metrics=AStarMetrics(),
+ )
results_std = pathfinder_std.route_all()
+ pathfinder_custom = _build_pathfinder(
+ _build_evaluator(bounds),
+ bounds=bounds,
+ nets=_net_specs({"custom_geometry_and_proxy": netlist["standard_arc"]}, {"custom_geometry_and_proxy": 2.0}),
+ bend_radii=[10.0],
+ bend_physical_geometry=custom_physical,
+ bend_proxy_geometry=custom_proxy,
+ sbend_radii=[],
+ max_iterations=1,
+ use_tiered_strategy=False,
+ metrics=AStarMetrics(),
+ )
results_custom = pathfinder_custom.route_all()
t1 = perf_counter()
combined_metrics = _sum_route_metrics((pathfinder_std.metrics.snapshot(), pathfinder_custom.metrics.snapshot()))
@@ -410,18 +613,33 @@ def snapshot_example_08() -> ScenarioSnapshot:
)
+def run_example_08() -> ScenarioOutcome:
+ return snapshot_example_08().as_outcome()
+
+
def snapshot_example_09() -> ScenarioSnapshot:
- problem = RoutingProblem(
+ obstacles = [
+ box(35, 35, 45, 65),
+ box(55, 35, 65, 65),
+ ]
+ netlist = {"budget_limited_net": (Port(10, 50, 0), Port(85, 60, 180))}
+ widths = {"budget_limited_net": 2.0}
+ _, _, _, pathfinder = _build_routing_stack(
bounds=(0, 0, 100, 100),
- nets=(NetSpec("budget_limited_net", Port(10, 50, 0), Port(85, 60, 180)),),
- static_obstacles=(box(35, 35, 45, 65), box(55, 35, 65, 65)),
+ netlist=netlist,
+ widths=widths,
+ obstacles=obstacles,
+ evaluator_kwargs={"bend_penalty": 50.0, "sbend_penalty": 150.0},
+ request_kwargs={"node_limit": 3, "bend_radii": [10.0], "warm_start_enabled": False, "max_iterations": 1},
)
- options = RoutingOptions(
- search=SearchOptions(node_limit=3, bend_radii=(10.0,)),
- objective=ObjectiveWeights(bend_penalty=50.0, sbend_penalty=150.0),
- congestion=CongestionOptions(warm_start_enabled=False, max_iterations=1),
- )
- return _snapshot_worker("example_09_unroutable_best_effort", build_routing_stack(problem, options).finder)
+ t0 = perf_counter()
+ results = pathfinder.route_all()
+ t1 = perf_counter()
+ return _make_snapshot("example_09_unroutable_best_effort", results, t1 - t0, pathfinder.metrics.snapshot())
+
+
+def run_example_09() -> ScenarioOutcome:
+ return snapshot_example_09().as_outcome()
def snapshot_terminal_bench_pr345() -> ScenarioSnapshot:
@@ -437,6 +655,18 @@ def _snapshot_routing_benchmark(case: BenchmarkCase) -> ScenarioSnapshot:
return _make_snapshot(f"routing_benchmark_{case.name.replace('-', '_')}", run.results_by_net, perf_counter() - start, run.metrics)
+SCENARIOS: tuple[tuple[str, ScenarioRun], ...] = (
+ ("example_01_simple_route", run_example_01),
+ ("example_02_congestion_resolution", run_example_02),
+ ("example_03_locked_paths", run_example_03),
+ ("example_04_sbends_and_radii", run_example_04),
+ ("example_05_orientation_stress", run_example_05),
+ ("example_06_bend_collision_models", run_example_06),
+ ("example_07_large_scale_routing", run_example_07),
+ ("example_08_custom_bend_geometry", run_example_08),
+ ("example_09_unroutable_best_effort", run_example_09),
+)
+
SCENARIO_SNAPSHOTS: tuple[tuple[str, ScenarioSnapshotRun], ...] = (
("example_01_simple_route", snapshot_example_01),
("example_02_congestion_resolution", snapshot_example_02),
@@ -449,15 +679,6 @@ SCENARIO_SNAPSHOTS: tuple[tuple[str, ScenarioSnapshotRun], ...] = (
("example_09_unroutable_best_effort", snapshot_example_09),
)
-
-def _snapshot_outcome(capture: ScenarioSnapshotRun) -> ScenarioOutcome:
- return capture().as_outcome()
-
-
-SCENARIOS: tuple[tuple[str, ScenarioRun], ...] = tuple(
- (name, partial(_snapshot_outcome, capture)) for name, capture in SCENARIO_SNAPSHOTS
-)
-
PERFORMANCE_SCENARIO_SNAPSHOTS: tuple[tuple[str, ScenarioSnapshotRun], ...] = (
("example_07_large_scale_routing_no_warm_start", snapshot_example_07_no_warm_start),
("example_07_large_scale_routing_no_warm_start_seed43", snapshot_example_07_no_warm_start_seed43),
@@ -479,13 +700,5 @@ TRACE_PERFORMANCE_SCENARIO_RUNS: tuple[tuple[str, TraceScenarioRun], ...] = (
)
-def capture_scenario_snapshots(
- selected_scenarios: Iterable[str] | None = None,
- *,
- include_performance_only: bool = False,
-) -> tuple[ScenarioSnapshot, ...]:
- registry = SCENARIO_SNAPSHOTS
- if include_performance_only:
- registry += PERFORMANCE_SCENARIO_SNAPSHOTS
- allowed = None if selected_scenarios is None else set(selected_scenarios)
- return tuple(capture() for name, capture in registry if allowed is None or name in allowed)
+def capture_all_scenario_snapshots() -> tuple[ScenarioSnapshot, ...]:
+ return tuple(run() for _, run in SCENARIO_SNAPSHOTS)
diff --git a/inire/tests/routing_corpus.py b/inire/tests/routing_corpus.py
index 210aa5d..351f779 100644
--- a/inire/tests/routing_corpus.py
+++ b/inire/tests/routing_corpus.py
@@ -6,7 +6,9 @@ from dataclasses import replace
from typing import TYPE_CHECKING
from inire import RoutingOptions
-from inire.router.cost import build_native_cost_evaluator, weighted_path_length
+from inire.geometry.collision import RoutingWorld
+from inire.router.cost import CostEvaluator, weighted_path_length
+from inire.router.danger_map import DangerMap
from inire.tests.retry_holdout_benchmarks import RETRY_HOLDOUT_CASES
from inire.tests.routing_benchmarks import (
BENCHMARK_CASES,
@@ -122,7 +124,20 @@ def native_verified_costs(
results: dict[str, RoutingResult],
verified_net_ids: Iterable[str],
) -> dict[str, float]:
- scorer = build_native_cost_evaluator(case.problem, options.objective)
+ objective = options.objective
+ problem = case.problem
+ danger = None
+ if objective.danger_weight and problem.static_obstacles:
+ danger = DangerMap(bounds=problem.bounds)
+ danger.precompute(list(problem.static_obstacles))
+ scorer = CostEvaluator(
+ RoutingWorld(clearance=problem.clearance),
+ danger,
+ unit_length_cost=objective.unit_length_cost,
+ bend_penalty=objective.bend_penalty,
+ sbend_penalty=objective.sbend_penalty,
+ danger_weight=objective.danger_weight,
+ )
costs = {}
for net_id in verified_net_ids:
path = results[net_id].path
diff --git a/inire/tests/test_api.py b/inire/tests/test_api.py
index 936b7b5..46a0d76 100644
--- a/inire/tests/test_api.py
+++ b/inire/tests/test_api.py
@@ -234,34 +234,6 @@ def test_iteration_callback_observes_reverified_conflicts() -> None:
assert results["vertical"].outcome == "colliding"
-@pytest.mark.parametrize("mutate_results", [False, True])
-def test_installed_best_iteration_respects_callback_edits(mutate_results: bool) -> None:
- problem = RoutingProblem(
- bounds=(0, 0, 100, 100),
- nets=(NetSpec("net", Port(10, 50, 0), Port(90, 50, 0)),),
- )
- options = RoutingOptions(
- congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False),
- refinement=RefinementOptions(enabled=False),
- topology=TopologyOptions(mode="off"),
- )
- world = RoutingWorld(clearance=problem.clearance)
- finder = PathFinder(AStarContext(CostEvaluator(world, DangerMap(bounds=problem.bounds)), problem, options))
-
- def callback(_iteration, results):
- assert results["net"].is_valid
- results["net"] = RoutingResult("net", ())
-
- results = finder.route_all(iteration_callback=callback if mutate_results else None)
-
- assert results["net"].is_valid is not mutate_results
- assert world.has_dynamic_paths() is not mutate_results
- assert finder.metrics.snapshot().dynamic_path_objects_added == 1
- assert finder.metrics.snapshot().dynamic_path_objects_removed == int(mutate_results)
- if not mutate_results:
- assert finder.metrics.snapshot().verify_path_report_calls == 3
-
-
def test_capture_conflict_trace_preserves_route_outputs() -> None:
problem = RoutingProblem(
bounds=(0, 0, 100, 100),
@@ -291,7 +263,7 @@ def test_capture_conflict_trace_preserves_route_outputs() -> None:
assert [entry.stage for entry in run_with_trace.conflict_trace] == ["iteration", "restored_best", "final"]
-def test_capture_iteration_trace_preserves_route_outputs(monkeypatch) -> None:
+def test_capture_iteration_trace_preserves_route_outputs() -> None:
problem = RoutingProblem(
bounds=(0, 0, 100, 100),
nets=(
@@ -304,12 +276,7 @@ def test_capture_iteration_trace_preserves_route_outputs(monkeypatch) -> None:
refinement=RefinementOptions(enabled=False),
)
- def unexpected_attempt_trace(*_args, **_kwargs):
- pytest.fail("Routing built an attempt trace with diagnostics disabled")
-
- with monkeypatch.context() as patch:
- patch.setattr(router_module, "net_attempt_trace", unexpected_attempt_trace)
- run_without_trace = route(problem, options=base_options)
+ run_without_trace = route(problem, options=base_options)
run_with_trace = route(
problem,
options=RoutingOptions(
@@ -552,7 +519,7 @@ def test_reverify_iterations_limit_late_reroutes_to_conflicting_nets(monkeypatch
monkeypatch.setattr(PathFinder, "_run_iteration", fake_run_iteration)
monkeypatch.setattr(PathFinder, "_verify_results", lambda self, state: (dict(state.results), {}))
- monkeypatch.setattr(PathFinder, "_run_pair_local_search", lambda self, state, review: None)
+ monkeypatch.setattr(PathFinder, "_run_pair_local_search", lambda self, state: None)
results = pathfinder.route_all()
@@ -633,7 +600,7 @@ def test_run_iteration_caps_two_heaviest_late_phase_nets(monkeypatch: pytest.Mon
net_id: RoutingResult(net_id=net_id, path=(Straight.generate(spec.start, 80.0, 2.0, dilation=1.0),), reached_target=True)
for net_id, spec in state.net_specs.items()
}
- state.best_review = _IterationReview({"netA", "netB", "netC", "netD"}, {("netA", "netB"), ("netC", "netD")}, {"netE"}, 4)
+ state.best_conflict_edges = 2
state.recent_attempt_work = {"netA": 20, "netB": 40, "netC": 400, "netD": 220}
incumbents = dict(state.results)
caps_by_net: dict[str, tuple[int | None, RoutingResult | None]] = {}
@@ -765,92 +732,6 @@ def test_route_all_restores_best_iteration_snapshot(monkeypatch: pytest.MonkeyPa
assert results["netA"].outcome == "completed"
assert results["netB"].outcome == "unroutable"
- assert evaluator.collision_engine.has_dynamic_paths()
- assert pathfinder.metrics.snapshot().verify_path_report_calls == 1
-
-
-def test_first_iteration_and_pair_length_tie_break() -> None:
- problem = RoutingProblem(bounds=(0, 0, 100, 100))
- options = RoutingOptions(congestion=CongestionOptions(warm_start_enabled=False), topology=TopologyOptions(mode="off"))
- evaluator = CostEvaluator(RoutingWorld(clearance=2.0), DangerMap(bounds=problem.bounds))
- finder = PathFinder(AStarContext(evaluator, problem, options))
- state = finder._prepare_state()
- review = _IterationReview(set(), set(), set(), 0)
-
- assert finder._update_best_iteration(state, review)
- assert not finder._update_best_iteration(state, review)
-
- def results(length):
- return {"a": RoutingResult("a", (), reached_target=True, report=RoutingReport(total_length=length))}
-
- incumbent = results(10.0)
- assert not finder._whole_set_is_better(results(10.0 - 0.5e-6), review, incumbent, review)
- assert finder._whole_set_is_better(results(10.0 - 2e-6), review, incumbent, review)
-
-
-def test_pair_repair_limits_disjoint_targets_in_routing_order(monkeypatch: pytest.MonkeyPatch) -> None:
- problem = RoutingProblem(
- bounds=(0, 0, 100, 100),
- nets=tuple(NetSpec(net_id, Port(10, i * 10, 0), Port(90, i * 10, 0)) for i, net_id in enumerate("cdbaef", 1)),
- )
- options = RoutingOptions(congestion=CongestionOptions(warm_start_enabled=False), topology=TopologyOptions(mode="off"))
- world = RoutingWorld(clearance=problem.clearance)
- finder = PathFinder(AStarContext(CostEvaluator(world, DangerMap(bounds=problem.bounds)), problem, options))
- state = finder._prepare_state()
- state.results = {net_id: RoutingResult(net_id, (), reached_target=True) for net_id in state.ordered_net_ids}
- review = _IterationReview(set(state.ordered_net_ids), {("a", "b"), ("c", "d"), ("e", "f")}, set(), 6)
- visited = []
-
- def repair(_finder, _state, pair, current_review):
- visited.append(pair)
- return current_review
-
- monkeypatch.setattr(PathFinder, "_run_pair_local_target", repair)
- finder._run_pair_local_search(state, review)
- assert visited == [("c", "d"), ("a", "b")]
-
- visited.clear()
- review.conflict_edges.add(("b", "c"))
- finder._run_pair_local_search(state, review)
- assert not visited
-
-
-@pytest.mark.parametrize("candidate_reaches_live_check", [False, True])
-def test_rejected_pair_keeps_original_index_for_reverse_attempt(monkeypatch: pytest.MonkeyPatch, candidate_reaches_live_check: bool) -> None:
- problem = RoutingProblem(
- bounds=(0, 0, 100, 100),
- nets=tuple(NetSpec(net_id, Port(10, y, 0), Port(90, y, 0)) for net_id, y in (("a", 20), ("b", 40), ("c", 60))),
- )
- options = RoutingOptions(congestion=CongestionOptions(warm_start_enabled=False), topology=TopologyOptions(mode="off"))
- world = RoutingWorld(clearance=problem.clearance)
- finder = PathFinder(AStarContext(CostEvaluator(world, DangerMap(bounds=problem.bounds)), problem, options))
- state = finder._prepare_state()
- for net in problem.nets:
- path = (Straight.generate(net.start, 80, net.width, dilation=1.0),)
- finder._install_path(net.net_id, path)
- state.results[net.net_id] = RoutingResult(net.net_id, path, reached_target=True, report=world.verify_path_report(net.net_id, path))
- initial_bounds = sorted(world.iter_dynamic_path_bounds(problem.bounds))
- incumbent = dict(state.results)
- review = _IterationReview(set(), set(), set(incumbent), 0)
- attempted = []
-
- def search(_context, _ordered, _results, pair_order, **_kwargs):
- attempted.append(pair_order)
- assert sorted(world.iter_dynamic_path_bounds(problem.bounds)) == initial_bounds
- if candidate_reaches_live_check and pair_order == ("a", "b"):
- return {"a": RoutingResult("a", incumbent["b"].path, reached_target=True), "b": incumbent["b"]}, 0
- return None
-
- monkeypatch.setattr(router_module, "search_pair_candidate", search)
- assert finder._run_pair_local_target(state, ("a", "b"), review) is review
-
- assert attempted == [("a", "b"), ("b", "a")]
- assert state.results == incumbent
- assert sorted(world.iter_dynamic_path_bounds(problem.bounds)) == initial_bounds
- assert all(world.verify_path_report(net_id, result.path) == result.report for net_id, result in incumbent.items())
- metrics = finder.metrics.snapshot()
- assert metrics.dynamic_path_objects_added == 3 + 4 * candidate_reaches_live_check
- assert metrics.dynamic_path_objects_removed == 4 * candidate_reaches_live_check
def test_route_all_restores_best_iteration_snapshot_on_timeout(monkeypatch: pytest.MonkeyPatch) -> None:
@@ -885,7 +766,6 @@ def test_route_all_restores_best_iteration_snapshot_on_timeout(monkeypatch: pyte
total_dynamic_collisions=0,
),
)
- state.best_is_installed = True
state.results = {"netA": worse_result}
return True
@@ -895,7 +775,6 @@ def test_route_all_restores_best_iteration_snapshot_on_timeout(monkeypatch: pyte
results = pathfinder.route_all()
assert results["netA"].outcome == "completed"
- assert evaluator.collision_engine.has_dynamic_paths()
def test_capture_conflict_trace_records_restored_best_stage(monkeypatch: pytest.MonkeyPatch) -> None:
diff --git a/inire/tests/test_astar.py b/inire/tests/test_astar.py
index 42db8b6..87e9393 100644
--- a/inire/tests/test_astar.py
+++ b/inire/tests/test_astar.py
@@ -2,7 +2,7 @@ import math
import pytest
from shapely.geometry import Polygon
-from inire import CongestionOptions, NetSpec, ObjectiveWeights, RefinementOptions, RoutingProblem, RoutingOptions, RoutingResult, SearchOptions
+from inire import CongestionOptions, NetSpec, RoutingProblem, RoutingOptions, RoutingResult, SearchOptions
from inire.geometry.components import Bend90, Straight
from inire.geometry.collision import RoutingWorld
from inire.geometry.primitives import Port
@@ -14,7 +14,6 @@ from inire.router._astar_moves import (
)
from inire.router._pair_local import _build_pair_local_context
from inire.router._search import route_astar
-from inire.router._stack import build_routing_stack
from inire.router.cost import CostEvaluator
from inire.router.danger_map import DangerMap
from inire.seeds import StraightSeed
@@ -274,31 +273,6 @@ def test_pair_local_context_clones_live_static_obstacles() -> None:
assert next(iter(local_context.problem.static_obstacles)).equals(obstacle)
-@pytest.mark.parametrize(
- ("search_danger", "refinement_enabled", "expected_tree"),
- [(0.0, False, False), (0.0, True, True), (1.0, False, True)],
-)
-def test_worker_samples_proximity_only_for_objectives_it_uses(search_danger, refinement_enabled, expected_tree) -> None:
- obstacle = Polygon([(20, -8), (40, -8), (40, -5), (20, -5)])
- net = NetSpec("pair_a", Port(10, 0, 0), Port(50, 0, 0))
- problem = RoutingProblem(bounds=BOUNDS, nets=(net,), static_obstacles=(obstacle,))
- options = RoutingOptions(
- objective=ObjectiveWeights(danger_weight=search_danger),
- refinement=RefinementOptions(enabled=refinement_enabled, objective=ObjectiveWeights(danger_weight=1.0)),
- )
- stack = build_routing_stack(problem, options)
- local = _build_pair_local_context(stack.context, problem.nets, {}, ("pair_a", "pair_b"), lock_partial_paths=True)
-
- assert (stack.danger_map.tree is not None) == expected_tree
- assert (local.cost_evaluator.danger_map.tree is not None) == bool(search_danger)
- outside = Straight.generate(net.start, 200, net.width)
- assert stack.evaluator.score_component(outside, start_port=net.start) == 1e15
- assert local.cost_evaluator.score_component(outside, start_port=net.start) == 1e15
- if refinement_enabled:
- move = Straight.generate(net.start, 40, net.width)
- assert stack.finder.refiner.score_path(net.start, (move,)) > stack.evaluator.score_component(move, start_port=net.start)
-
-
def test_route_astar_bend_collision_override_does_not_persist(basic_evaluator: CostEvaluator) -> None:
context = _build_context(basic_evaluator, bounds=BOUNDS, bend_radii=(10.0,), bend_collision_type="arc")
diff --git a/inire/tests/test_collision.py b/inire/tests/test_collision.py
index 711d6bf..02ed644 100644
--- a/inire/tests/test_collision.py
+++ b/inire/tests/test_collision.py
@@ -335,7 +335,7 @@ def test_dynamic_grid_updates_incrementally_on_add_and_remove() -> None:
dynamic_paths = engine._dynamic_paths
assert dynamic_paths.net_to_obj_ids["netA"]
assert dynamic_paths.net_to_obj_ids["netB"]
- assert dynamic_paths.grid_net_obj_ids
+ assert dynamic_paths.grid
assert engine.metrics.total_dynamic_grid_rebuilds == 0
engine.remove_path("netA")
diff --git a/inire/tests/test_congestion_policy.py b/inire/tests/test_congestion_policy.py
index 4d71a99..26a3cfc 100644
--- a/inire/tests/test_congestion_policy.py
+++ b/inire/tests/test_congestion_policy.py
@@ -1,42 +1,13 @@
-from itertools import pairwise
-
-from inire import NetSpec, Port
from inire.results import RoutingResult
from inire.router._congestion_policy import (
IterationReview,
next_reroute_net_ids,
- ordered_nets,
reached_pair_local_plateau,
repeated_conflict_count,
reroute_plan,
)
-def test_net_order_keeps_equal_distances_stable_across_headings() -> None:
- east = NetSpec("east", Port(0, 0, 0), Port(30, 0, 0))
- west = NetSpec("west", Port(50, 30, 180), Port(30, 20, 270))
- north = NetSpec("north", Port(0, 50, 90), Port(30, 70, 0))
- south = NetSpec("south", Port(20, 120, 270), Port(20, 110, 270))
- nets = (east, south, west, north)
-
- assert ordered_nets(nets, "user") == list(nets)
- assert ordered_nets(nets, "shortest") == [south, east, west, north]
- assert ordered_nets(nets, "longest") == [north, east, west, south]
-
-
-def test_layout_rank_prefers_coverage_then_edges_then_collisions() -> None:
- one_edge = {("a", "b")}
- two_edges = {("a", "b"), ("b", "c")}
- ranked = [
- IterationReview({"a", "b", "c"}, two_edges, {"d", "e"}, 6),
- IterationReview({"a", "b"}, one_edge, {"d"}, 5),
- IterationReview({"a", "b"}, one_edge, {"d"}, 8),
- IterationReview({"a", "b", "c"}, two_edges, {"d"}, 4),
- ]
-
- assert all(better.rank < worse.rank for better, worse in pairwise(ranked))
-
-
def test_reroute_plan_caps_only_heavy_nets_in_the_final_conflict_regime() -> None:
ordered = ("a", "b", "c", "d", "e")
results = {net_id: RoutingResult(net_id, (), reached_target=True) for net_id in ordered}
@@ -45,7 +16,6 @@ def test_reroute_plan_caps_only_heavy_nets_in_the_final_conflict_regime() -> Non
assert reroute_plan(ordered, reroute, last_work, best_conflict_edges=2, results=results) == (["d", "b", "a", "c"], {"a", "c"})
assert reroute_plan(ordered, reroute, last_work, best_conflict_edges=3, results=results) == (["d", "b", "a", "c"], set())
- assert reroute_plan(ordered, reroute, last_work, best_conflict_edges=None, results=results) == (["d", "b", "a", "c"], set())
assert reroute_plan(ordered, set(ordered), last_work, best_conflict_edges=2, results=results) == (list(ordered), set())
diff --git a/inire/tests/test_example_regressions.py b/inire/tests/test_example_regressions.py
index 6099783..c7a10d9 100644
--- a/inire/tests/test_example_regressions.py
+++ b/inire/tests/test_example_regressions.py
@@ -16,8 +16,10 @@ from inire.router._stack import build_routing_stack
from inire.seeds import Bend90Seed, PathSeed, StraightSeed
from inire.tests.example_scenarios import (
SCENARIOS,
- _build_example_07_variant_stack,
- _build_example_08_workers,
+ _build_evaluator,
+ _build_pathfinder,
+ _net_specs,
+ AStarMetrics,
snapshot_example_05,
snapshot_example_07_no_warm_start,
trace_example_07_no_warm_start,
@@ -50,15 +52,6 @@ def test_example_05_avoids_dynamic_tree_rebuilds() -> None:
assert snapshot.metrics.dynamic_tree_rebuilds == 0
-def test_example_07_variant_uses_one_configuration() -> None:
- evaluator, _, finder = _build_example_07_variant_stack(num_nets=10, seed=42, warm_start_enabled=False)
- world = evaluator.collision_engine
-
- assert finder.context.options.objective == evaluator.default_weights
- assert finder.context.problem.clearance == world.clearance == 6.0
- assert finder.context.problem.static_obstacles == tuple(world.iter_static_geometries())
-
-
def test_example_07_no_warm_start_canary_improves_validity() -> None:
snapshot = snapshot_example_07_no_warm_start()
@@ -269,10 +262,34 @@ def test_custom_proxy_without_physical_geometry_warns_and_keeps_arc_geometry() -
def test_example_08_custom_geometry_runs_in_separate_sessions() -> None:
- standard_worker, custom_worker = _build_example_08_workers()
- assert standard_worker.context.cost_evaluator.collision_engine is not custom_worker.context.cost_evaluator.collision_engine
- standard = standard_worker.route_all()
- custom = custom_worker.route_all()
+ bounds = (0, 0, 150, 150)
+ netlist = {"standard_arc": (Port(20, 20, 0), Port(100, 100, 90))}
+ widths = {"standard_arc": 2.0}
+ custom_physical = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)])
+ custom_proxy = box(0, -11, 11, 0)
+
+ standard = _build_pathfinder(
+ _build_evaluator(bounds),
+ bounds=bounds,
+ nets=_net_specs(netlist, widths),
+ bend_radii=[10.0],
+ sbend_radii=[],
+ max_iterations=1,
+ use_tiered_strategy=False,
+ metrics=AStarMetrics(),
+ ).route_all()
+ custom = _build_pathfinder(
+ _build_evaluator(bounds),
+ bounds=bounds,
+ nets=_net_specs({"custom_geometry_and_proxy": netlist["standard_arc"]}, {"custom_geometry_and_proxy": 2.0}),
+ bend_radii=[10.0],
+ bend_physical_geometry=custom_physical,
+ bend_proxy_geometry=custom_proxy,
+ sbend_radii=[],
+ max_iterations=1,
+ use_tiered_strategy=False,
+ metrics=AStarMetrics(),
+ ).route_all()
assert standard["standard_arc"].is_valid
assert standard["standard_arc"].reached_target
diff --git a/inire/tests/test_performance_reporting.py b/inire/tests/test_performance_reporting.py
index e0c5c56..9ded29a 100644
--- a/inire/tests/test_performance_reporting.py
+++ b/inire/tests/test_performance_reporting.py
@@ -244,6 +244,7 @@ def test_record_conflict_trace_script_supports_performance_only_scenario(tmp_pat
str(script_path),
"--output-dir",
str(tmp_path),
+ "--include-performance-only",
"--scenario",
"example_07_large_scale_routing_no_warm_start",
],
@@ -285,6 +286,7 @@ def test_record_iteration_trace_script_writes_selected_scenario(tmp_path: Path)
[
sys.executable,
str(script_path),
+ "--include-performance-only",
"--scenario",
"example_07_large_scale_routing_no_warm_start",
"--output-dir",
@@ -308,6 +310,7 @@ def test_record_pre_pair_frontier_trace_script_writes_selected_scenario(tmp_path
[
sys.executable,
str(script_path),
+ "--include-performance-only",
"--scenario",
"example_07_large_scale_routing_no_warm_start",
"--output-dir",
diff --git a/inire/tests/test_refinements.py b/inire/tests/test_refinements.py
index e346813..56ce7a4 100644
--- a/inire/tests/test_refinements.py
+++ b/inire/tests/test_refinements.py
@@ -1,6 +1,4 @@
-import pytest
-
-from inire import CongestionOptions, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
+from inire import RoutingOptions, RoutingProblem, SearchOptions
from inire.geometry.collision import RoutingWorld
from inire.geometry.components import Bend90
from inire.geometry.primitives import Port
@@ -49,26 +47,6 @@ def test_arc_resolution_sagitta() -> None:
assert pts_fine > pts_coarse
-@pytest.mark.parametrize(("offset", "move_type"), [(0, "straight"), (5, "sbend")])
-def test_refinement_leaves_simple_paths_installed(offset: int, move_type: str) -> None:
- problem = RoutingProblem(
- bounds=(0, 0, 120, 120),
- nets=(NetSpec("out", Port(10, 50, 0), Port(110, 50 + offset, 0)),),
- )
- options = RoutingOptions(
- search=SearchOptions(bend_radii=(10.0,), sbend_radii=(10.0,)),
- congestion=CongestionOptions(warm_start_enabled=False),
- topology=TopologyOptions(mode="off"),
- )
-
- run = route(problem, options=options)
-
- assert run.results_by_net["out"].is_valid
- assert run.results_by_net["out"].path[-1].move_type == move_type
- assert run.metrics.refine_path_calls == 0
- assert run.metrics.dynamic_path_objects_removed == 0
-
-
def test_locked_routes() -> None:
engine = RoutingWorld(clearance=2.0)
danger_map = DangerMap(bounds=(0, -50, 100, 50))
diff --git a/inire/tests/test_routing_benchmarks.py b/inire/tests/test_routing_benchmarks.py
index 0ca6770..95c63f2 100644
--- a/inire/tests/test_routing_benchmarks.py
+++ b/inire/tests/test_routing_benchmarks.py
@@ -572,24 +572,6 @@ def test_paired_perimeters_respect_the_supplied_detour() -> None:
assert run.results_by_net[net_id].as_seed() == seed
-def test_perimeter_residual_preserves_its_lock_and_verifies_the_layout(monkeypatch: pytest.MonkeyPatch) -> None:
- (case,) = CASE_GROUPS["terminal-bench-pair"]
- options = automatic_options(profile_options(case, "corpus-regression"), "corpus-regression")
- planner = _AutomaticRun(case.problem, options, None)
- monkeypatch.setattr(_AutomaticRun, "_paired_perimeter", lambda *_args: None)
-
- trials = planner._perimeter_trials(options)
-
- residual = [trial for trial in trials if trial.stage.kind == "perimeter-residual"]
- assert residual
- assert all(trial.stage.mode == "guide" and len(trial.stage.direct_net_ids) == 1 for trial in residual)
- assert all(not trial.stage.skipped_net_ids for trial in residual)
- assert residual[-1].selection == "requires-layout-check"
- assert trials[-1].selectable
- assert trials[-1].stage.kind == "perimeter"
- assert set(trials[-1].valid_costs) == {net.net_id for net in case.problem.nets}
-
-
@pytest.mark.parametrize("name", ["fallback-custom-proxy", "fallback-custom-physical"])
def test_automatic_preserves_custom_bend_geometry(name: str) -> None:
case = next(case for case in FALLBACK_BENCHMARK_CASES if case.name == name)
diff --git a/inire/tests/trace_recording.py b/inire/tests/trace_recording.py
index 6b7483a..5e86dde 100644
--- a/inire/tests/trace_recording.py
+++ b/inire/tests/trace_recording.py
@@ -43,6 +43,7 @@ def record_trace(
) -> None:
parser = ArgumentParser(description=f"Record {name.replace('_', '-')} artifacts for selected trace scenarios.")
parser.add_argument("--scenario", action="append", help="Trace scenario name. Repeat to select multiple scenarios.")
+ parser.add_argument("--include-performance-only", action="store_true", help="Accept performance-only scenario names.")
parser.add_argument("--output-dir", type=Path, help=f"Directory for {name}.json and {name}.md. Defaults to /archive/routing.")
args = parser.parse_args()
diff --git a/plans/documentation-improvements.md b/plans/documentation-improvements.md
deleted file mode 100644
index 06ccd41..0000000
--- a/plans/documentation-improvements.md
+++ /dev/null
@@ -1,87 +0,0 @@
-# Documentation improvement plan
-
-Make each section answer a question its reader came to solve. A link should help the reader take the next step, find a needed detail, or verify a claim made in the text. A heading sets the scope for the material under it. Start with the corridor page, then apply the same review to the user guides, developer workflows, benchmark pages, and examples.
-
-The existing [user guide](../DOCS.md) and [developer guide](../docs/development.md) provide the starting points. Continue using the user pages for layout tasks and the API contract, the developer pages for implementation and investigation, and the [routing archive](../archive/routing/README.md) for plans, captures, and development history.
-
-## Review sections and links together
-
-1. **Read the heading on its own.** Identify the question it promises to answer and who will ask it. Check every paragraph, figure, and link against that question. Move a source pointer to the mechanism it explains, a benchmark command to the measurement workflow, and a dated investigation to the archive.
-2. **Give the reader a usable answer in the section.** For troubleshooting, name an observable symptom, explain what to inspect, and show how that evidence changes the next action. For an algorithm, explain its inputs, decision, and output before pointing to the implementation. For a reference, put the field, default, and effect where the reader can scan them together.
-3. **Give each link a job in the sentence or table.** Name the command, subsection, implementation decision, or finding that the reader will reach. Place a citation immediately after the claim it supports. Use a table for source and license lookup when the columns make the relationship clear. Remove links whose destination adds no information the reader can use there.
-4. **Check the landing point.** Follow the link from the rendered page. A trace link should land on the relevant flag and how to read its output. A source link should reach the function or section that implements the behavior. A paper should come with the specific concept and section it supports. Preserve useful heading anchors and send inbound links directly to the section that now owns the material.
-5. **Tighten the layout after the content is in the right place.** Use numbered steps for a procedure, bullets for independent symptoms or choices, and tables for repeatable lookups. Use a short paragraph to explain why a choice follows from the evidence. Keep an illustration when it shows geometry or a state change the reader would otherwise have to infer.
-
-| Reader needs | Link placement |
-| --- | --- |
-| Find an overlapping component | In the troubleshooting step that says which overlap fields to inspect and how to use them. |
-| Change how lanes are assigned | Beside the explanation of how the corridor planner chooses a crossing position. |
-| Read the research behind triangle-edge routing | At the claim about representing a route by a sequence of shared-edge crossings. |
-| Compare guide and seed on the same board | In the benchmark procedure with the case, profile, and expected comparison. |
-| Reproduce an earlier experiment | Beside the dated result that depends on it, with the matching code revision and command in the experiment record. |
-
-## Rewrite corridor troubleshooting
-
-The heading **When a corridor does not lead to a route** fits a missing corridor or a search that stalls. Paths that reach their ports and overlap also need a decision about verification and congestion. Use **Diagnose a missing or colliding route** and keep the existing heading anchor for bookmarks. Divide the actions by observed result.
-
-| Symptom | What the reader should check |
-| --- | --- |
-| No corridor reported | Check that the port can enter free space along its heading after snapping. Inspect the keepouts and the mesh padding at the suspected opening. |
-| A corridor exists and the path stops short | Locate the first turn the path needs to make. Compare its available room with the allowed radii, then test the seed budget if the geometry fits. |
-| The paths reach their ports and overlap | Find the pair and component indices in the conflict trace. Compare the overlap with the layout to see whether the nets compete for the same opening. |
-
-Proposed copy for the third symptom.
-
-> **The paths reach their ports and overlap.** Use the [conflict trace](../docs/routing-diagnostics.md#traces) to identify the nets and the overlapping components. Locate those components on the board. If both nets compete for the same opening, inspect their lane order and available turn room before increasing the seed budget.
-
-The conflict trace belongs in this step because it identifies the pair and where to look on the board. Put the implementation pointer under **Choose a passage and a lane** in the algorithm section. Give maintainers a reason to follow it, such as checking how crossing positions are sampled or how reservations affect another net's access. Point to the [mesh lane assignment](../inire/router/_topology.py#L214).
-
-Use `run.topology` to check corridor counts and seeded net IDs when the selected worker reports them. The geometry and component indices supply the location of an overlap. Verify the finished wording against the [topology result fields](../inire/results.py).
-
-## Explain why the research citations belong
-
-Replace the generic introduction to earlier detailed-routing work with two specific references. Put the first beside the description of portals and the second beside the explanation of why a connected passage still needs a realizable waveguide. Each note should make sense to a developer who reads it and continues through the guide without opening the paper.
-
-Proposed copy for the shared-edge representation.
-
-> A portal is a shared edge between adjacent free-space triangles. For an earlier representation of a route by its crossings of triangle edges, see Section III-A and Figure 1 of [Hama and Etoh's curvilinear detailed-routing paper](https://www.cecs.uci.edu/~papers/compendium94-03/papers/1998/aspdac98/pdffiles/06c_3.pdf).
-
-Proposed copy for physical constraints.
-
-> A passage can be connected in the mesh and leave too little room to bend onto the target port's heading. For the bend-radius and port-alignment rules that constrain the physical route, see Section II-B of [LiDAR 2.0](https://arxiv.org/html/2505.17239v1#S2.SS2).
-
-Use the first citation for the historical representation and the second for the photonic design constraints. Explain Inire's lane sampling, allowed bend geometry, and preplaced crossing workflow from Inire's own code and examples. In the benchmark fixture guide, keep the LiDAR dataset source and license beside the cases they document.
-
-## Review the user path
-
-| Page | What to improve | Reader check |
-| --- | --- | --- |
-| [README](../README.md) | Keep installation and the runnable connection close together. Identify the expected length and why the two headings are eastbound. Use the end of the quick start to lead into the layout workflow. | A new user can run a route and recognize success from the printed value and figure. |
-| [User guide index](../DOCS.md) | Group navigation around describing a layout, checking a result, changing a setting, and looking up an API field. Put commonly used reference links next to the tasks that need them. | A user with a partial route or a port-heading question can choose a destination from the link text. |
-| [Layout guide](../docs/user/route-a-layout.md) | Walk through coordinates, arrival headings, physical keepouts, and valid output in the order users supply them. In the placed-crossing example, label the two finite footprints, local port openings, and external net. Use the real opening width and clearance to explain why the approach fits. | A user can substitute their own crossing footprints and route between ports without needing a benchmark fixture. |
-| [Tuning and troubleshooting](../docs/user/tune-and-troubleshoot.md) | Lead with the observed outcome and the next check. Connect each adjustment to an observable difference in coverage, cost, or work. Place the reference link at the setting whose accepted values the user needs. | A user can distinguish a capacity limit, a clearance problem, and a route that needs more search. |
-| [API reference](../docs/user/api-reference.md) | Give canonical signatures, units, defaults, and result fields. Use a short use case for any option whose effect is hard to infer. Send readers to the worked workflow where they need a runnable example. | A user can look up an option or interpret a status without reading implementation code. |
-| [Examples gallery](../examples/README.md) | Show what to notice in each selected image and link its runnable source separately in the example table. Caption the difference between a physical route and a search proxy where both are drawn. | A reader can choose a relevant script and tell what its output demonstrates. |
-
-## Review the developer path
-
-| Page | What to improve | Reader check |
-| --- | --- | --- |
-| [Developer guide](../docs/development.md) | Route contributors to the task they need to perform. Put environment setup, correctness checks, and parity in the change workflow. Link archive material from the task where it matters. | A contributor can choose the right check for a policy change or a cleanup. |
-| [Architecture](../docs/architecture.md) | Explain the planner and worker decisions in execution order. Attach code pointers to the invariants they implement, such as preserving verified IDs during refinement. Use the architecture diagram to explain decisions and stop conditions. | A maintainer can find where to change lock order, bounds, or route acceptance and knows what to verify. |
-| [Topological routing](../docs/topological-routing.md) | Apply the troubleshooting and citation rewrites above. Use the three-panel figure to distinguish the portal sequence, lane suggestion, and verified physical path. Place the mode comparison link with its explanation of what a developer can learn from that run. | A developer can explain why a corridor can exist while seed realization or final routing still falls short. |
-| [Diagnostics](../docs/routing-diagnostics.md) | Move from a symptom to a field or a trace, then show what evidence to compare. In the fan-out walkthrough, identify the restored conflict and the final verified count. Keep detailed field lookups and scratch capture commands near their use. | A developer can collect a trace, identify the conflicting components, and tell what changed after repair. |
-| [Benchmarks](../docs/benchmarks.md) | Keep the first command and expected report at the top. Describe what each case or profile isolates and put the next comparison beside the example output. | A developer can run a case, compare the same verified net set, and choose a holdout for a retry. |
-| [Benchmark fixtures](../docs/benchmark-fixtures.md) | Put provenance, license terms, source pins, and regeneration under their relevant fixture family. State what unseeded routing and a reference path each establish. | A developer can reproduce the input and explain whether a run measures routing policy or checks a feasibility witness. |
-| [Benchmark results](../docs/benchmark-results.md) | Lead with the decision each measurement informs. Record its profile, baseline, and date near the finding. Put historical run detail beside the linked archive entry. | A developer can tell which decision the result supports and where to recover the original run. |
-| [Archive index](../archive/routing/README.md) | Describe the purpose of each group of historical plans, captures, and baselines. Link to the current capture workflow where a maintainer needs to reproduce results. | A developer can find the corresponding raw record and identify the workflow for a fresh capture. |
-
-## Order of work and acceptance
-
-1. Edit the corridor page first. Review its headings, the three troubleshooting actions, the placement of the lane implementation link, and the two citations together. Keep the original symptom heading's anchor and verify inbound navigation from architecture and benchmarks.
-2. Follow the new-user path from the README to an exported path, then repeat it with an incomplete route. Walk through a placed crossing with finite keepouts and verify that the diagram, code, and explanation use the same ports and clearances.
-3. Follow the developer path from a behavior change to the relevant algorithm, a benchmark case, and a diagnostic capture. Audit the references so that historical evidence, source code, and runnable instructions appear where they serve that workflow.
-4. Read the rendered pages at desktop and narrow widths. Review the heading outline first, then read each linked sentence and open its destination. Check local links, figures, legacy anchors, source pins, and the accessibility of cited sections. Check that figure captions explain what to inspect and that color has a label or line-style counterpart.
-5. Run the published quick start, locked-path and placed-crossing snippets, overloaded-gate smoke run, offset-gates comparison, and one fan-out diagnostic capture. Use scratch outputs for the commands. Verify the stated results and check field names and defaults against the implementation.
-
-During review, read the sentence or task as though the link were plain text. It should still tell the reader what to do or understand. The destination should deliver the named detail, evidence, or command.
diff --git a/plans/routing-simplification.md b/plans/routing-simplification.md
deleted file mode 100644
index 33cc0ab..0000000
--- a/plans/routing-simplification.md
+++ /dev/null
@@ -1,96 +0,0 @@
-# Routing simplification plan
-
-Reduce the amount of routing state we rebuild and the number of places that define the same policy. Start with three changes that have a small implementation scope and clear parity checks. Prototype the changes that can affect geometry ordering, cost comparisons, or search work. Keep the public routing modes, defaults, and result fields stable through these batches.
-
-The baseline is `6608e18`. Its two regression profiles verified 433 of 437 nets across 67 boards, reached every board's routing bound, and completed Terminal-Bench at 9/9. The earlier refactor covers the existing boundaries for the search, diagnostics, and planners. Use the [historical routing refactor plan](../archive/routing/routing-refactor-plan.md) for the rationale behind those boundaries.
-
-The implementation, parity checks, and decisions on each prototype are recorded in the [simplification results](../archive/routing/simplification-results.md).
-
-## First implementation batch
-
-1. **Reuse the installed paths when the last iteration is already the best.** Skip reinstalling geometry when the live index is known to represent the saved result set. Preserve full restoration after a timeout, when an earlier iteration won, and when an iteration callback is present. Exercise all three cases, including a callback that modifies the result mapping. Start with [best-iteration restoration](../inire/router/_router.py#L403).
-
- An in-memory prototype passed all 134 corpus and 20 diagnostic comparisons after allowing changes in the two path-object counters. It avoided 9,201 removals and 9,201 insertions across the 67 public-default boards.
-
-2. **Use one layout ranking key.** Iteration selection and pair-local repair both prefer more completed nets, then fewer conflict edges, then fewer dynamic collisions. Put those criteria in one comparison key. Preserve the path-length tie-break and its tolerance in pair-local repair. Check all three tie-breaks and the first recorded iteration before comparing the corpus. Start with [iteration selection](../inire/router/_router.py#L395).
-
-3. **Use one stable net ordering helper.** Lattice routing, direct locking, and joint-lane recovery each implement Manhattan-distance ordering for `shortest` and `longest`. Share the sort while preserving input order for equal distances and the subsequent priority pass for direct locks. Focus the initial check on mixed headings, equal-distance nets, and alternate lock order. Compare planner stages as well as paths. Start with the [direct lock planner](../inire/router/_routing_policy.py#L77).
-
-## Small routing and diagnostic cleanups
-
-4. **Represent a pair of conflicting nets as two IDs.** Replace the single-field pair target class and its order helper with the existing pair of IDs. Keep the order in which targets are visited and the forward and reverse attempts. Verify the two-pair limit and disjoint-edge rule in [pair target selection](../inire/router/_router.py#L666).
-
-5. **Restore the incumbent once after a rejected pair replacement.** An unsuccessful pair search runs in a local world. The live-world candidate check already restores the incumbent on rejection. Exercise both failure paths before removing the unconditional final reinstall. Check the live index, reports, and path-object counters after a rejection followed by a second attempt. Start with [pair replacement and rollback](../inire/router/_router.py#L761).
-
-6. **Collect component overlaps when a report consumes them.** Pair-local candidate selection reads net-level conflicts and validity. Check whether its live-world verification can omit component details while leaving the restored and final trace captures intact. Compare exact conflict payloads with each capture flag enabled on its own. Start with [pair candidate verification](../inire/router/_router.py#L761).
-
-7. **Share incumbent guidance in frontier replay.** Frontier replay selects reached paths and computes the same seed and bonus used for reroute guidance. Use the shared helper at that call site once the replay preconditions are confirmed. Compare sampled prune reasons and verify that the diagnostic run still leaves the selected route and production counters intact. Start with [incumbent guidance](../inire/router/_search.py#L18).
-
-8. **Remove the unused visibility wrapper.** Delete `_ensure_current` after checking the named corner-index and corner-graph entry points. Run the visibility tests for exact and tangent modes and preserve the distinction between index-only preparation and graph construction. See the [visibility manager](../inire/router/visibility.py#L49).
-
-## Prototypes for installed geometry and verification
-
-9. **Keep a capped incumbent installed when the next attempt will carry it forward.** The late capped branch removes the old geometry before immediately installing the incumbent again. Prototype moving that decision ahead of index mutation when the installed path is known. Exercise late caps, partial results, caller seeds, and mutable callback results. The fallback counters and per-net trace should still describe the same attempt. Start with [routing one net](../inire/router/_router.py#L831).
-
-10. **Keep unchanged nets in the index during pair repair.** A replacement for two nets currently rebuilds the installed set. Prototype a narrower replace and rollback for the two changed nets. Compare component indices and candidate order in conflict reports, especially with several components per net. Check rejected repairs and a successful repair followed by another pair. Accept the change if the local update stays simpler than managing the full rebuild and measurably reduces work. See [installed-path replacement](../inire/router/_router.py#L359).
-
-11. **Reuse verified reports when the geometry and net set match.** Compare the iteration review, restored review, and final verifier. Identify where the same paths and obstacle state are checked again without an intervening repair or refinement. Preserve the final reports for partial paths and the extra details needed for frontier replay. Measure verification calls and exact checks on a clean worker run and a worker that restores an earlier iteration. Start with the [final verification path](../inire/router/_router.py#L1087).
-
-12. **Skip refinement setup for paths that cannot supply a window.** The driver removes a path before the refiner checks whether it has enough bends. Check eligibility before removing geometry, using the same rule in direct refiner calls. Compare index updates and `refine_path_calls` on straight, S-bend, and bend-heavy fixtures. Preserve the geometry seen by a real refinement attempt. See [refinement eligibility](../inire/router/refiner.py#L317).
-
-## Prototypes for scoring and collision work
-
-13. **Score the changed portion of a refinement window.** Candidate scoring currently walks the prefix, replacement, and suffix for each proposal. Test whether the unchanged portions can be reused for the first cost comparison. Preserve the definitive score after materializing geometry and check floating-point ties near the improvement threshold. Compare candidates built and accepted, path cost, and score calls on long foldbacks and alternating doglegs. Start with [refinement window scoring](../inire/router/refiner.py#L267).
-
-14. **Build the proximity tree only when a worker can use it.** Keep the board bounds check available. Skip boundary sampling when the search objective and any enabled refinement objective both have zero danger weight. For pair-local search, check the objective it actually uses. Exercise a run with zero search danger weight and nonzero refinement danger weight, and verify that custom bends and bounds behave as before. Start with [worker initialization](../inire/router/_stack.py#L34).
-
-15. **Measure reuse of static clearance buffers.** Repeated physical verification buffers component polygons against the same clearance. Profile the buffer calls on a dense static layout and compare a small reuse experiment with its retained memory. Account for clearance, the geometry used for verification, and the exact distance check at mitred corners. Keep boundary touching and custom physical bends in the comparison. See [static path verification](../inire/geometry/collision.py#L659).
-
-16. **Measure overlap between the congestion prechecks.** Count how often grid presence and envelope checks reject a candidate before exact tests, and how much each cached query costs. Test removal or consolidation of one layer on sparse and congested layouts where that layer contributes little. Preserve frozen-net blocking and conflict counts. If pruning pays for the extra state, record the cases that depend on it. Start with [dynamic congestion queries](../inire/geometry/collision.py#L334).
-
-## Worker and planner setup
-
-17. **Prepare the joint-lane residual once.** Joint-lane recovery builds a residual board for corridor planning and reconstructs it for search. Pass the prepared nets and keepouts through both operations. Compare skipped IDs, lock order, topology reports, and stage labels on the joint-lane regression test. Use the same preparation for perimeter recovery only where its inputs and result merge match. Start with [joint-lane recovery](../inire/router/_automatic.py#L538).
-
-18. **Share worker objective initialization where the inputs match.** The ordinary worker and pair-local worker each pass the same objective fields into the evaluator. A shared constructor can lift that mapping out of both paths. Keep each worker's obstacle set explicit, including the distinction between polygons used as locks and polygons used for proximity costs. Preserve the current greedy weight during pair repair. Compare the fan-out callbacks and pair-local traces. See the [pair-local context](../inire/router/_pair_local.py#L21).
-
-19. **Share the physical containment predicate.** Automatic trial selection and explicit bundle routing both check whether the board covers the returned path polygons. Reuse that check while retaining each caller's error or report handling. Verify designs with flush ports, a shape extending beyond the board, and a custom physical bend. Start with [automatic trial validation](../inire/router/_routing_policy.py#L245).
-
-20. **Assemble worker results in one place.** The stack and example trace fixture both read the pathfinder's metrics, traces, and results into `RoutingRunResult`. Reuse the production assembly path and check how topology data is populated. Keep fan-out's iteration callback on its existing worker. Compare example traces and explicit guide and seed results before removing the fixture formatter. Start with [worker result assembly](../inire/router/_stack.py#L94).
-
-## Benchmark and example tooling
-
-21. **Derive the example runs and snapshots from one registry.** Each ordinary scenario has a run wrapper that calls its snapshot and converts the result. Share the fixture names and order between the outcome tests and the snapshot command. Preserve the timing boundaries and check every existing scenario name. Keep the heavier and trace entries available through their current selectors. Start with the [example scenario registry](../inire/tests/example_scenarios.py#L440).
-
-22. **Share snapshot selection between recording and comparison.** Both commands select the same registry, filter by scenario, and run the selected captures. Reuse that selection and execution logic with the existing snapshot objects. Let each command keep its output schema. Check repeated `--scenario`, the working `--include-performance-only` flag, and comparison against older baselines. Start with [performance baseline recording](../scripts/record_performance_baseline.py#L13).
-
-23. **Use the public fixed-route workflow in the locked-path example.** The example script adds a static copy of the first route to a world that still has the path installed. Route the second net with a fresh problem whose keepouts include the first route's physical polygons, as the benchmark fixture now does. Compare exact paths and the rendered plot. Explain any scoring setting needed to reproduce the detour. See the [locked-path example](../examples/03_locked_paths.py).
-
-## Larger changes with a specific trigger
-
-24. **Consolidate residual routing around a new recovery case.** Item 17 addresses one repeated construction. A broader interface pays off when another planner needs shared logic for frozen paths, movable seeds, or joining an unresolved result. First inventory which stages require a complete layout check and how they report skipped and unresolved IDs. Design around a concrete duplicate operation and test it across the affected planners. Use the [residual routing policy](../inire/router/_routing_policy.py#L192) as the starting point.
-
-25. **Split collision queries along a demonstrated boundary.** Use the candidate and exact-test profiles from items 15 and 16 to identify a useful separation between lookup, exact overlap, or ray casting. Keep the hot-path call count, physical clearance, proxy geometry, and cache invalidation visible. Exercise visibility modes, rotated ports, crossing approaches, and custom polygons. Begin with the [collision query code](../inire/geometry/collision.py).
-
-26. **Revisit public option grouping when an API change is warranted.** Consider consolidating legacy bend geometry options and grouping planner-specific fields when a caller-facing change gives that work a purpose. Inventory existing constructors, custom polygon behavior, serialized benchmark options, and documentation. Plan migration before changing defaults or removing names. Start with the [public option definitions](../inire/model.py).
-
-## Verification and sequencing
-
-1. Capture the current corpus with `scripts.routing_benchmark_parity capture` before starting items 1 through 3. Use both `corpus-regression` and `public-defaults`. Add a focused capture with `--callbacks` and `--diagnostics` for Terminal-Bench, obstructed crossings, the mixed port bank, and a fixture with caller seeds. Include the two no-warm-start fan-out seeds for pair repair.
-2. Land items 1 through 3 as independently reviewable changes. Then group items 4 through 8 by the behavior they exercise. Tooling items 20 through 23 can proceed on their own because they have focused scenario and script checks.
-3. Run the related tests and exact parity for each routing change. Compare verified IDs, paths, native and benchmark costs, selected stage, stage order, bounds, callbacks, traces, and stable counters. List intentional counter differences by name in the comparison. Use `overloaded-gate` and `lidar-clements-8x8` to check that expected geometric bounds still explain incomplete coverage.
-4. Prototype items 9 through 16 separately so any route or counter difference has one likely cause. Record the fixture, profile, counts, and result for each trial. For a speed claim, run repeated wall-time measurements with matching options and worker count, and examine both the median and individual slow boards.
-5. Run the full test suite and the opt-in example performance tests before combining the routing changes. Refresh an archived example baseline when fixture semantics change. Keep exploratory measurements in scratch output until they support an implementation decision.
-
-For item 1, take the first capture at the baseline revision and the second at the candidate revision.
-
-```sh
-python -m scripts.routing_benchmark_parity capture /tmp/inire-simplification-before.json --case corpus --jobs 4
-python -m scripts.routing_benchmark_parity capture /tmp/inire-simplification-after.json --case corpus --jobs 4
-python -m scripts.routing_benchmark_parity compare \
- /tmp/inire-simplification-before.json /tmp/inire-simplification-after.json \
- --allow-counter-change dynamic_path_objects_added \
- --allow-counter-change dynamic_path_objects_removed
-```
-
-For the stable comparison fields and diagnostic capture options, use the [exact parity workflow](../docs/routing-diagnostics.md#reproduce-and-compare).
diff --git a/scripts/benchmark_retry_order.py b/scripts/benchmark_retry_order.py
index 1042b1e..11f30e1 100644
--- a/scripts/benchmark_retry_order.py
+++ b/scripts/benchmark_retry_order.py
@@ -155,7 +155,7 @@ class _RetryExperiment(_AutomaticRun):
topology=replace(options.topology, seed_node_limit=max(limit, options.topology.seed_node_limit)),
congestion=replace(options.congestion, max_iterations=min(2, options.congestion.max_iterations)),
)
- run, stage = _route_residual(self.problem, retry, LockPlan(retained), residual_mode="seed", run_route=partial(self._run, policy=policy))
+ run, stage = _route_residual(self.problem, retry, "direct-seed", LockPlan(retained), run_route=partial(self._run, policy=policy))
trial = self._trial(run, replace(stage, kind=policy, policy=policy, incumbent_net_ids=tuple(retained)))
trials = [replace(trial, selection="requires-layout-check")]
complete = False
diff --git a/scripts/compare_topological_routing.py b/scripts/compare_topological_routing.py
index fd0cb1b..783c905 100644
--- a/scripts/compare_topological_routing.py
+++ b/scripts/compare_topological_routing.py
@@ -17,10 +17,9 @@ import shapely
from shapely.geometry import box, mapping
from inire import RoutingOptions, RoutingStage, route
-from inire.router._routing_policy import _best_trial
+from inire.router._routing_policy import DIRECT_POLICIES, _best_trial
+from inire.router._routing_policy import _direct_trials as _run_direct_trials
from inire.router._routing_policy import _trial as _summarize_trial
-from inire.tests.direct_routing_policies import DIRECT_POLICIES
-from inire.tests.direct_routing_policies import direct_trials as _direct_trials
from inire.tests.routing_corpus import (
AUTOMATIC_POLICIES,
CASE_GROUPS,
@@ -68,6 +67,7 @@ class RunSample:
_trial = partial(_summarize_trial, score=benchmark_weighted_length)
+_direct_trials = partial(_run_direct_trials, score=benchmark_weighted_length)
def _mode_options(options: RoutingOptions, strategy: str, profile: str = "matched-budget") -> RoutingOptions:
diff --git a/scripts/diff_performance_baseline.py b/scripts/diff_performance_baseline.py
index 4fd9eff..f2b9cd6 100644
--- a/scripts/diff_performance_baseline.py
+++ b/scripts/diff_performance_baseline.py
@@ -7,8 +7,8 @@ from dataclasses import asdict
from datetime import datetime
from pathlib import Path
+from inire.tests.example_scenarios import PERFORMANCE_SCENARIO_SNAPSHOTS, SCENARIO_SNAPSHOTS
from inire.results import RouteMetrics
-from inire.tests.example_scenarios import capture_scenario_snapshots
SUMMARY_KEYS = (
@@ -26,6 +26,12 @@ SUMMARY_KEYS = (
)
+def _snapshot_registry(include_performance_only: bool) -> tuple[tuple[str, object], ...]:
+ if not include_performance_only:
+ return SCENARIO_SNAPSHOTS
+ return SCENARIO_SNAPSHOTS + PERFORMANCE_SCENARIO_SNAPSHOTS
+
+
def _available_metric_names() -> tuple[str, ...]:
return (
"duration_s",
@@ -41,8 +47,13 @@ def _current_snapshots(
*,
include_performance_only: bool,
) -> dict[str, dict[str, object]]:
- snapshots = capture_scenario_snapshots(selected_scenarios, include_performance_only=include_performance_only)
- return {snapshot.name: asdict(snapshot) for snapshot in snapshots}
+ allowed = None if selected_scenarios is None else set(selected_scenarios)
+ snapshots: dict[str, dict[str, object]] = {}
+ for name, run in _snapshot_registry(include_performance_only):
+ if allowed is not None and name not in allowed:
+ continue
+ snapshots[name] = asdict(run())
+ return snapshots
def _load_baseline(path: Path, selected_scenarios: tuple[str, ...] | None) -> dict[str, dict[str, object]]:
diff --git a/scripts/export_advanced_examples.py b/scripts/export_advanced_examples.py
deleted file mode 100644
index 80504fa..0000000
--- a/scripts/export_advanced_examples.py
+++ /dev/null
@@ -1,49 +0,0 @@
-"""Export the advanced example inputs from the canonical benchmark fixtures."""
-
-from argparse import ArgumentParser
-from json import dumps
-from pathlib import Path
-
-from examples.advanced_layouts import INPUTS, build_problem
-from inire.tests.routing_corpus import CASE_GROUPS, profile_options
-from inire.tests.stress_routing_benchmarks import STRESS_BENCHMARK_CASES
-
-
-def main() -> None:
- parser = ArgumentParser(description=__doc__)
- parser.add_argument("--output", type=Path, default=INPUTS)
- args = parser.parse_args()
-
- cases = (*STRESS_BENCHMARK_CASES, *CASE_GROUPS["terminal-bench"], *CASE_GROUPS["terminal-bench-point-terminals"])
- entries = []
- for case in cases:
- problem = case.problem
- options = profile_options(case, "public-defaults")
- data = {
- "bounds": list(problem.bounds),
- "clearance": problem.clearance,
- "bend_radii": list(options.search.bend_radii),
- "sbend_radii": list(options.search.sbend_radii),
- "infer_terminal_headings": options.topology.infer_terminal_headings,
- "keepouts": [polygon.wkt for polygon in problem.static_obstacles],
- "nets": [(net.net_id, net.start.as_tuple(), net.target.as_tuple(), net.width) for net in problem.nets],
- }
- rebuilt, settings = build_problem(data)
- if problem != rebuilt or options != settings:
- raise ValueError(f"The advanced example no longer reproduces fixture {case.name}")
-
- # Keep ports and each net on one line so the input file is easy to scan.
- lines = [f" {dumps(case.name)}: {{"]
- for field in ("bounds", "clearance", "bend_radii", "sbend_radii", "infer_terminal_headings"):
- lines.append(f" {dumps(field)}: {dumps(data[field])},")
- for field in ("keepouts", "nets"):
- values = ",\n".join(f" {dumps(value)}" for value in data[field])
- comma = "," if field == "keepouts" else ""
- lines.append(f" {dumps(field)}: [\n{values}\n ]{comma}")
- entries.append("\n".join((*lines, " }")))
-
- args.output.write_text("{\n" + ",\n".join(entries) + "\n}\n", encoding="utf-8")
-
-
-if __name__ == "__main__":
- main()
diff --git a/scripts/record_performance_baseline.py b/scripts/record_performance_baseline.py
index 6a01fcf..c8cb64a 100644
--- a/scripts/record_performance_baseline.py
+++ b/scripts/record_performance_baseline.py
@@ -7,7 +7,27 @@ from dataclasses import asdict
from datetime import date
from pathlib import Path
-from inire.tests.example_scenarios import capture_scenario_snapshots
+from inire.tests.example_scenarios import PERFORMANCE_SCENARIO_SNAPSHOTS, SCENARIO_SNAPSHOTS
+
+
+SUMMARY_METRICS = (
+ "route_iterations",
+ "nets_routed",
+ "nodes_expanded",
+ "ray_cast_calls",
+ "moves_generated",
+ "moves_added",
+ "dynamic_tree_rebuilds",
+ "visibility_builds",
+ "congestion_check_calls",
+ "verify_path_report_calls",
+)
+
+
+def _snapshot_registry(include_performance_only: bool) -> tuple[tuple[str, object], ...]:
+ if not include_performance_only:
+ return SCENARIO_SNAPSHOTS
+ return SCENARIO_SNAPSHOTS + PERFORMANCE_SCENARIO_SNAPSHOTS
def _build_payload(
@@ -15,7 +35,12 @@ def _build_payload(
*,
include_performance_only: bool = False,
) -> dict[str, object]:
- snapshots = capture_scenario_snapshots(selected_scenarios, include_performance_only=include_performance_only)
+ allowed = None if selected_scenarios is None else set(selected_scenarios)
+ snapshots = []
+ for name, run in _snapshot_registry(include_performance_only):
+ if allowed is not None and name not in allowed:
+ continue
+ snapshots.append(run())
return {
"generated_on": date.today().isoformat(),
"generator": "scripts/record_performance_baseline.py",
diff --git a/scripts/render_documentation_figures.py b/scripts/render_documentation_figures.py
index 8d4ac91..b4c0c1b 100644
--- a/scripts/render_documentation_figures.py
+++ b/scripts/render_documentation_figures.py
@@ -123,14 +123,10 @@ def _placed_crossing(directory: Path) -> None:
_heading(ax, port, 10)
ax.text(port.x + dx, port.y + dy, label, color=INK, fontsize=10, ha="left" if dx > 0 else "right")
- for label, opening, label_position in (
- ("A port opening", (76, 79), (94, 117)),
- ("B port opening", (263, 111), (219, 77)),
- ):
- ax.annotate(
- label, xy=opening, xytext=label_position, color=INK, fontsize=10,
- arrowprops={"arrowstyle": "->", "color": MUTED}, zorder=8,
- )
+ ax.annotate(
+ "Port access opening", xy=(76, 79), xytext=(94, 117), color=INK, fontsize=10,
+ arrowprops={"arrowstyle": "->", "color": MUTED}, zorder=8,
+ )
ax.annotate(
"External waveguide", xy=(154, 75), xytext=(168, 47), color=ROUTE, fontsize=10,
arrowprops={"arrowstyle": "->", "color": ROUTE},