diff --git a/DOCS.md b/DOCS.md index 0c5d480..2268d67 100644 --- a/DOCS.md +++ b/DOCS.md @@ -22,8 +22,7 @@ If you're new to Inire, start with the [single-net quick start](README.md#route- ## Check and improve a route - [Check the result](docs/user/tune-and-troubleshoot.md#read-the-result) to see whether each net reached its target port and passed verification. -- [Save a placement recipe](docs/user/route-a-layout.md#save-a-placement-recipe) to place the verified components in your layout. -- [Route with process constraints](docs/user/fabrication.md) for placed ports, process layers, authored lengths, and coplanar waveguides. +- [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. diff --git a/README.md b/README.md index e339b54..51ab66d 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ else: ![A short solid waveguide connects the start at (50, 100) and target at (250, 100). Both port arrows point east.](docs/figures/first-route.png) -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 `result.as_seed()` to [save the placement recipe](docs/user/route-a-layout.md#save-a-placement-recipe). +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). ## Route your own layout diff --git a/docs/architecture.md b/docs/architecture.md index f1fde16..5c08884 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -1,6 +1,6 @@ # Router architecture -An explicit mode starts one worker with that mode’s settings. Guide and seed can retry with zero guidance cost. Automatic routing can try several combinations of obstacles, locks, and starting paths. All modes use the same worker and assign iteration indices across attempts. See [`route_once()`](../inire/router/_stack.py#L65). +An explicit routing mode runs one worker with that mode's settings. Automatic routing can run several workers with different obstacles, locks, or starting paths, then select a result. To see what a single worker receives and returns, start at [`route_once()`](../inire/router/_stack.py#L71). Follow one complete run from board input through planning, verification, and plotting in [Complex-routing example 1](complex-routing-example-1.md). @@ -8,15 +8,15 @@ Follow one complete run from board input through planning, verification, and plo ![Automatic routing sets a target for the number of verified nets and tries several ways to reach it. The router selects and optionally refines its best layout before returning a result for each net.](figures/automatic-stages.png) -Follow the left column down while the number of verified nets is below the target. The router selects a layout when an attempt reaches that target or the attempts run out. It uses lattice search directly for custom physical bends or polygonal proxies. If constructive planning falls short and constrained triangulation is unavailable, it continues with lattice search. +Follow the left column down while the number of verified nets is below the target. The router selects a layout when an attempt reaches that target or the attempts run out. It uses lattice search directly for custom physical bends, polygonal proxies, or a run without constrained triangulation. -1. **Set the coverage target.** A pair of nets with aligned terminal faces that violate clearance can supply at most one route. At zero clearance, faces that touch also conflict. Count such pairs using each net at most once. For rectangular keepouts, also bound the number of paths that can cross a vertical cut by packing tracks at the narrowest requested width. To see how the openings are counted, start with [`cut_capacity()`](../inire/router/_capacity.py#L28). +1. **Set the coverage target.** A pair of nets with fixed ports that are too close can supply at most one route. Count such pairs using each net at most once. For rectangular keepouts, also bound the number of paths that can cross a vertical cut by packing tracks at the narrowest requested width. To see how the openings are counted, 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 previously verified paths as seeds that can move. A joint retry can assign different lanes through a shared opening. If recovery stalls, seed and lattice attempts can search the whole layout. The final lattice retry can use the caller's full node limit. -5. **Select a verified layout.** Prefer more verified nets and compare cost when the verified net IDs match. A completed `incumbent-residual` trial or an improving `joint-portal-lanes` trial must pass another check with the original keepouts before it can win. Refinement can replace the selected layout only if it preserves the verified net IDs. See [the refinement handoff](../inire/router/_automatic.py#L610). +5. **Select a verified layout.** Prefer more verified nets and compare cost when the verified net IDs match. A completed `incumbent-residual` trial or an improving `joint-portal-lanes` trial must pass another check with the original keepouts before it can win. Refinement can replace the selected layout only if it preserves the verified net IDs. See [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#L509). +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). ### Example of a poor lock @@ -26,29 +26,21 @@ The near-port attempt uses up to 100 nodes per search and two congestion iterati ## Detailed search and congestion -- **Build and admit moves.** Weighted A* searches snapped positions and headings. Rays, visible corners, and corridor waypoints propose straight endpoints. If a ray blocks a launch, a flat-ended trace scan checks for room to move. An aligned target goes directly to admission, which checks the straight's rectangular footprint for clearance. A long lead can use consecutive straights when a single forward scan cannot cover it. Search releases turns away from a distant target when preferred moves run out or the reserved share of the expansion budget begins. Searches with up to 16 expansions consider these turns immediately. Larger searches release them with at least one tenth of the budget left, rounded down with a minimum of one expansion. S-bends can follow each other when the configured moves permit it. Admission also checks cost and state dominance. [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. To understand which endpoints a net can reach within the same node budget, start with [move generation](../inire/router/_astar_moves.py). - The closed set groups states by snapped position and heading. Arrivals with different final straight lengths, seed progress, or occupied path geometry can offer different continuations. This pruning keeps the search bounded in practice and can discard an alternative history. A regression test demonstrates different straight proposals from equal-cost arrivals at one port. - -- **Recheck the installed set.** Paths that reach their targets and pass geometry checks against themselves, the board, and keepouts participate in congestion. Partial and geometrically invalid paths remain available for diagnosis. After an iteration the driver 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. A narrowed retry includes every net that still fails verification. [`next_reroute_net_ids()`](../inire/router/_congestion_policy.py#L99) +- **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). - **Repair a small conflict set.** The driver returns to the best iteration and can reuse its verification when those paths are still installed and restored-stage traces are disabled. If the conflicts form separate pairs, the router can try repairing up to two of them. It holds the other paths fixed, tries both routing orders as needed, and checks proposed replacements against the installed layout. For a worked trace, [follow a late conflict](routing-diagnostics.md#follow-a-late-conflict-into-pair-local-repair). ## Geometry and refinement -A result carries the requested and effective net specs. The effective net records the resolved ports for replaying the move sequence after heading inference. Fixed routes carry their owner and physical polygons into the same collision world used by search and verification. The world applies distinct-net clearance to fixed geometry, and planners see fixed routes alongside keepouts. Routing preserves the vertices of imported polygons and clears their GEOS precision metadata so geometric operations use full coordinate precision. [Placement recipes](user/route-a-layout.md#save-a-placement-recipe) - -Search, seed replay, and refinement share analytic endpoint and circular sampling calculations. Preparation rejects oversized sampling requests before allocating the outline. Verification uses the materialized polygons for exact containment and clearance. - -Zero-node replay checks each complete path against the board, itself, and fixed geometry before adding eligible paths to the collision index. A second pass adds cross-net conflicts to those reports. Iteration review and final reporting reuse the results while the indexed routes stay the same. - -Search uses proxies to check moves and estimate congestion. Verification rejects invalid polygons and checks each port for a finite-width face with material on the correct side. It checks for overlap within components and unintended contact between components, and checks the route against keepouts, other nets, and the board rectangle in every routing mode. Search and seed materialization use the same custom S-bend outline when one is configured. A circular S-bend with a fractional forward span ends with a short tangent extension to the next grid point, keeping the requested radius. Boundary contact with the board is allowed. +Search uses proxies to check moves and estimate congestion. Verification rejects invalid polygons and checks each port for a finite-width face with material on the correct side. It checks adjacent components for overlap and checks the route against keepouts, other nets, and the board rectangle in every routing mode. Refinement uses the same configured bend geometry as search and seed materialization. A circular S-bend with a fractional forward span ends with a short tangent extension to the next grid point, keeping the requested radius. Boundary contact with the board is allowed. At a keepout corner, a mitred clearance buffer can reach farther than the specified clearance. Verification checks the actual distance before counting these hits as collisions. For an example with a corner close to the required clearance, see the [mitred-corner test](../inire/tests/test_collision.py#L146). -Dynamic congestion queries use a grid for small spans and an R-tree for large spans. 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. +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. -Refinement tries replacing sections of routes with at least four 90-degree bends. It indexes endpoints by heading and forward position to find eligible sections, then scores proposed detours before constructing their polygons. With a finite budget above one, it tries sections with bends at both ends first. With a budget of one or no window limit, it starts with the longest eligible section by component count. It can check just the replacement when the original route is valid against the installed geometry. Final verification checks the entire updated route. Automatic refinement also rechecks retained partial paths against the updated layout. +Refinement tries replacing sections of routes with at least four 90-degree bends. It scores proposed detours before constructing their polygons. With a finite budget above one, it tries sections with bends at both ends first. With a budget of one or no window limit, it starts with the longest section by component count. It can check just the replacement when the original route is valid against the installed geometry. Final verification checks the entire updated route. ## Validate a change diff --git a/docs/complex-routing-example-1.md b/docs/complex-routing-example-1.md index 5be9c9f..55b6ba5 100644 --- a/docs/complex-routing-example-1.md +++ b/docs/complex-routing-example-1.md @@ -14,7 +14,7 @@ Origin. The problem uses board 1 from Terminal-Bench pull request 345. [Pinned l `build_problem()` reads the example entry into a `RoutingProblem` and `RoutingOptions`. The board is 2,500 by 1,000 units with seven rectangular keepouts and nine nets. The guides are 2 units wide, the clearance is 6, and both kinds of bends use radius 50. The fixed-heading case starts with no seeds and requires each net to launch and arrive heading east. [Example inputs](../examples/advanced-layouts.json) · [Problem builder](../examples/advanced_layouts.py#L34) -`route()` dispatches to automatic routing. The router checks whether any aligned terminal pairs are too close and whether a vertical cut has fewer tracks than nets that need to cross it. The board passes both checks, so automatic asks the constructive planners to verify all nine nets. [Automatic entry point](../inire/router/_automatic.py#L641) · [Capacity checks](../inire/router/_capacity.py#L28) +`route()` dispatches to automatic routing. The router checks whether any aligned terminal pairs are too close and whether a vertical cut has fewer tracks than nets that need to cross it. The board passes both checks, so automatic asks the constructive planners to verify all nine nets. [Automatic entry point](../inire/router/_automatic.py#L597) · [Capacity checks](../inire/router/_capacity.py#L27) ![The nine input nets surround seven rectangular keepouts. A cut at x = 500 has openings at the bottom, center, and top of the board.](figures/complex-routing-example-1-input.png) @@ -32,7 +32,7 @@ The dots mark waypoints in the proposed seeds. The lower inset shows the two con ## 3. Fit the required eastbound arrival -Automatic routing compares the bundle's inferred headings with the input. Only `net_08` differs. Its initial bundle arrives from the east heading west. The turnaround planner adjusts the upper shelf route `net_07` and brings `net_08` back below it. Near the target, `net_08` rises west of `x = 1112` and takes a final right turn to arrive heading east. The planner recompiles the two changed seeds and submits the full set for verification. [Constructive planner dispatch](../inire/router/_automatic.py#L228) · [Turnaround candidates](../inire/router/_perimeter.py#L103) +Automatic routing compares the bundle's inferred headings with the input. Only `net_08` differs. Its initial bundle arrives from the east heading west. The turnaround planner adjusts the upper shelf route `net_07` and brings `net_08` back below it. Near the target, `net_08` rises west of `x = 1112` and takes a final right turn to arrive heading east. The planner recompiles the two changed seeds and submits the full set for verification. [Constructive planner dispatch](../inire/router/_automatic.py#L202) · [Turnaround candidates](../inire/router/_perimeter.py#L103) ![Two views show the materialized shelf and return paths. In the initial plan net_08 arrives westbound. In the turnaround candidate it passes below the shelf, rises left of the target, and arrives eastbound.](figures/complex-routing-example-1-turnaround.png) @@ -40,13 +40,13 @@ The arrow above each red target square shows the arrival heading. ## 4. Verify the seeds and refine the layout -The first `bundle-turnaround` candidate verifies all nine nets. Automatic routing runs a worker in mode `off` for one verification pass with a zero-node search limit and refinement disabled. The worker materializes each seed into physical polygons, installs the paths, and rechecks the installed layout for port joins, board containment, and collisions. The full coverage lets automatic routing skip its search trials. [Seeded worker setup](../inire/router/_automatic.py#L173) · [Seed installation](../inire/router/_router.py#L877) · [Physical verification](../inire/geometry/collision.py#L708) +The first `bundle-turnaround` candidate verifies all nine nets. Automatic routing runs a worker in mode `off` for one iteration with a one-node search limit and refinement disabled. The worker materializes each seed into physical polygons, installs the paths, and rechecks the installed layout for port joins, board containment, and collisions. Every net has a complete seed, so the worker records zero A* expansions. The full coverage lets automatic routing skip its search trials. [Seeded worker setup](../inire/router/_automatic.py#L165) · [Seed installation](../inire/router/_router.py#L819) · [Physical verification](../inire/geometry/collision.py#L656) ![The upper panel shows the physical paths of the first four nets in installation order. The lower panel shows all nine paths after verification.](figures/complex-routing-example-1-verification.png) The upper panel reconstructs the first four installed paths from the worker's verified seeds. The lower panel shows the full set checked together. -Automatic then replays the verified seeds in a worker with refinement enabled. The refiner tries replacing sections with at least four 90-degree bends and verifies the resulting layout. In this run, refinement changes `net_05` and `net_07` and keeps all nine nets verified. The refined layout wins on the configured objective, which includes component penalties as well as length. [Refinement handoff](../inire/router/_automatic.py#L610) · [Trial comparison](../inire/router/_routing_policy.py#L45) +Automatic then replays the verified seeds in a worker with refinement enabled. The refiner tries replacing sections with at least four 90-degree bends and verifies the resulting layout. In this run, refinement changes `net_05` and `net_07` and keeps all nine nets verified. The refined layout wins on the configured objective, which includes component penalties as well as length. [Refinement handoff](../inire/router/_automatic.py#L580) · [Trial comparison](../inire/router/_routing_policy.py#L44) ![The refined net_07 stays near the top edge longer and descends close to its target. Its earlier approach is dashed, and the outer return remains visible below it.](figures/complex-routing-example-1-refinement.png) @@ -67,32 +67,6 @@ python -m scripts.compare_topological_routing \ To see how heading inference changes the route, rerun the gallery command with `--case complex-routing-example-1-point-terminals`. Automatic accepts the westbound arrival for `net_08`, verifies the original `bundle` plan, and then refines it. Both stages again verify nine nets with zero A* expansions. [Point-terminal figure](../examples/advanced.md#point-terminals) · [Waypoint export command](benchmark-fixtures.md#complex-routing-example-1) -## Compare all routing modes - -These runs use the same nine-net board with a 100-node limit per search, one congestion iteration, warm start disabled, and refinement disabled. The table compares a run with triangulation available against a run with that capability disabled. Each mode keeps the input headings except `bundle`, which uses `infer_terminal_headings=True` so `net_08` can arrive westbound. Explicit `bundle` with the original fixed eastbound headings raises a heading mismatch for that net. - -| Mode | With triangulation available | Without triangulation | -| --- | --- | --- | -| `automatic` | 9/9 verified. The turnaround plan completes the layout without building a mesh. | 9/9 verified through the same turnaround plan. Automatic uses lattice search if constructive planning leaves work. | -| `off` | 0/9 verified at this budget. The worker runs lattice search directly. | Same search and result. | -| `guide` | 1/9 verified. The worker builds a mesh and suggests corridors to lattice search. | Raises a dependency error when planning corridors. | -| `seed` | 1/9 verified. The worker builds a mesh and searches for starting paths inside the corridors before its routing iteration. | Raises a dependency error when planning corridors. | -| `bundle` | 9/9 verified. The worker builds and verifies ordered tracks directly from the board geometry. | Same plan and result. | - -![Five panels show route outcomes at the same search budget. Automatic and bundle verify all nine nets. Off, guide, and seed leave partial paths.](figures/complex-routing-example-1-modes.png) - -### Triangulation support - -Corridor planning uses Shapely's constrained Delaunay triangulation to keep triangle edges inside free space and respect keepout boundaries. It requires **Shapely 2.1 or later and GEOS 3.10 or later**. On supported platforms a Shapely wheel bundles GEOS. In a pip environment, use `python -m pip install --upgrade "shapely>=2.1"`. A source build needs a compatible system GEOS. [Shapely triangulation reference](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html) · [Shapely installation guide](https://shapely.readthedocs.io/en/2.1.2/installation.html) - -Check the versions in the environment that runs Inire. - -```sh -python -c 'import shapely; print(shapely.__version__, shapely.geos_version_string)' -``` - -Inire supports Shapely 2.0.7 for lattice routing and constructive plans. With a compatible backend, automatic already uses triangulation whenever it needs corridor search. Here the ordered bundle and turnaround cover all nine nets, so automatic can move directly to verification. Explicit `guide` and `seed` also verify supplied paths without a mesh when `node_limit=0`. - ## Compare a guide-mode search The successful bundle run above reaches verification before the corridor search. To see that search's working model, the figure generator runs `net_08` by itself in guide mode on the same board. The left panel shows the actual triangulation, corridor cells in green, and the guide through them as a dashed line. The right panel zooms in on the expanded positions and physical partial path returned when A* reaches its 12-node budget. [Corridor planning](topological-routing.md#corridor-planning-and-realization) diff --git a/docs/development.md b/docs/development.md index 2228eeb..8a021a2 100644 --- a/docs/development.md +++ b/docs/development.md @@ -9,8 +9,6 @@ ## Check a change -The wheel contains the runtime package. Repository tests and benchmark fixtures are available in the source distribution. Build both locally with `uv build`. For release smoke checks, import and route from the wheel outside the checkout with NumPy 1.26 and NumPy 2.x on Python 3.11, using Shapely 2.0.7 in both environments. Automatic routing falls back to lattice search on Shapely 2.0.7. Guide and seed search require Shapely 2.1 and a GEOS build with constrained triangulation. - 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. diff --git a/docs/figures/complex-routing-example-1-modes.png b/docs/figures/complex-routing-example-1-modes.png deleted file mode 100644 index a1ba44b..0000000 Binary files a/docs/figures/complex-routing-example-1-modes.png and /dev/null differ diff --git a/docs/figures/partial-and-complete.png b/docs/figures/partial-and-complete.png index 449b08c..e878742 100644 Binary files a/docs/figures/partial-and-complete.png and b/docs/figures/partial-and-complete.png differ diff --git a/docs/figures/placed-crossing.png b/docs/figures/placed-crossing.png index 351a55b..604caa0 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 a658d7b..6f716b8 100644 --- a/docs/routing-diagnostics.md +++ b/docs/routing-diagnostics.md @@ -24,16 +24,10 @@ Pair each counter with a question about the work. Use a repeated wall-time compa `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). -Exact corner visibility uses cached local queries. Track them with `visibility_corner_queries_exact` and `visibility_point_cache_hits`. The legacy graph counters `visibility_builds` and `visibility_corner_pairs_checked` report zero, as do `ray_cast_calls_visibility_build` and `ray_cast_calls_visibility_query`. - -Search bounds the two move caches by entries and polygon coordinates. It drops the corresponding static-admission keys when evicting positioned moves. An unusually large live frontier drops dominated nodes and retains the best 40,000 entries once it exceeds 50,000. Check `frontier_trim_events` and `frontier_nodes_discarded` when diagnosing a large failed attempt. - ## Traces Enable the `DiagnosticsOptions` flag for the question you want to answer. -Returned traces describe the selected attempt. Numbered entries use the same run-wide indices as progress callbacks. A timed-out iteration can consume an index without calling back. Work counters include all attempts. Reroute scheduling tracks its own effort from node expansions and uncached congestion queries. - | 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. | diff --git a/docs/topological-routing.md b/docs/topological-routing.md index ea1242a..8f3dcf9 100644 --- a/docs/topological-routing.md +++ b/docs/topological-routing.md @@ -10,13 +10,13 @@ Guide mode suggests where a path can pass through free space and lets detailed s In the offset-gates example, the two openings are at different heights. The top panel highlights the proposed sequence of triangle edges to cross. In the middle panel, the dashed line joins suggested crossing points. In the bottom panel, the solid route uses an S-bend to change height between the openings. -1. **Find connected space for centerlines.** Inset the board by half the widest guide's width and expand obstacles by that half-width plus clearance. To connect a port to the mesh, try a short straight along its departure or arrival heading, or use the port position itself. A lead from a flush port can cross the inset boundary when its flat-ended footprint fits inside the board and clears the keepouts. If the shared mesh finds no passage for a narrower net, retry with padding for its width. +1. **Find connected space for centerlines.** Inset the board by half the widest guide's width and expand obstacles by that half-width plus clearance. To connect a port to the mesh, try a short straight along its departure or arrival heading, or use the port position itself. The common padding can exclude openings that a narrower net can still use in lattice search. 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). -2. **Choose a passage and a lane.** Rank a sequence of portals by distance and how many other nets want to use the same edges. A lane is a suggested position along an edge where a net can cross into the next triangle. Rank those positions by turn room and the lanes reserved for other nets. A joint retry can change the lane positions for several nets at the same opening. To see how the positions are scored, inspect [`assign_lanes()`](../inire/router/_topology.py#L247). +2. **Choose a passage and a lane.** Rank a sequence of portals by distance and how many other nets want to use the same edges. A lane is a suggested position along an edge where a net can cross into the next triangle. Rank those positions by turn room and the lanes reserved for other nets. A joint retry can change the lane positions for several nets at the same opening. To see how the positions are scored, inspect [`assign_lanes()`](../inire/router/_topology.py#L214). 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. diff --git a/docs/user/api-reference.md b/docs/user/api-reference.md index 8526bbd..c72f406 100644 --- a/docs/user/api-reference.md +++ b/docs/user/api-reference.md @@ -8,16 +8,14 @@ Import these types from `inire`. To see how the inputs fit together in a runnabl route(problem, *, options=None, iteration_callback=None) -> RoutingRunResult ``` -Omitting `options` uses `RoutingOptions()`. To observe progress, pass a callable accepting `(index, results_by_net)`. Each call receives a snapshot of the nets in one completed congestion iteration. Indices increase across attempts. An iteration that times out can consume an index without calling back. Automatic mode uses the same planner order with or without a callback. Check the returned result for final coverage, including on runs that finish without a callback. - -For a zero-node attempt that completes its replay iteration, the callback receives the verified results after any refinement. +Omitting `options` uses `RoutingOptions()`. To observe progress, pass a callable accepting `(index, results_by_net)`. Each call receives a snapshot of the nets in one completed congestion iteration. Automatic mode keeps increasing the index across attempts and uses the same planner order with or without a callback. Check the returned result for final coverage, including on runs that finish without a callback. ## Layout inputs ### Ports and nets - `Port(x, y, r)` rounds coordinates to integers. The heading `r` is in degrees, with 0 east, 90 north, 180 west, and 270 south. The rounded angle must be a multiple of 90 and is wrapped to the range 0–359. -- `NetSpec(net_id, start, target, width=2.0)` uses a unique string ID, two ports, and a finite positive width. Set the start heading to the direction of departure and the target heading to the direction of arrival. If both snapped ports are identical, connect the placed ports directly and omit that net from the routing problem. +- `NetSpec(net_id, start, target, width=2.0)` uses a unique ID, two ports, and a finite positive width. Set the start heading to the direction of departure and the target heading to the direction of arrival. ### RoutingProblem @@ -27,12 +25,10 @@ The fields below appear in constructor order. Use one layout unit for coordinate | --- | --- | --- | | `bounds` | Required | Finite board rectangle as `(xmin, ymin, xmax, ymax)`, with each minimum below its maximum. | | `nets` | `()` | Sequence of `NetSpec` objects with unique IDs. Duplicate IDs raise `ValueError`. | -| `static_obstacles` | `()` | Valid, nonempty Shapely `Polygon` objects in board coordinates that define routing keepouts. Coordinates may be fractional. | -| `initial_paths` | Empty mapping | A read-only snapshot of net IDs mapped to `PathSeed` objects. Supply a new mapping to change seeds. | -| `clearance` | `2.0` | Finite, nonnegative spacing required between distinct nets and between a net and a keepout. At zero clearance, distinct nets must still be disjoint, including at vertices. Boundary contact with a keepout is allowed. | -| `safety_zone_radius` | `0.0021` | Tolerance for small keepout intersections at a move's endpoints during search. | -| `self_clearance` | `0.0` | Optional spacing within one net. Applies between components when the intervening centerline is at least this long. Adjacent joins and components immediately on either side of one bend are exempt. Unintended contact is always checked. | -| `fixed_routes` | `()` | Completed or imported net geometry supplied as `FixedRoute(net_id, polygons)`. Search and verification check clearance to fixed routes using the physical outlines. IDs must be unique across fixed and active nets. | +| `static_obstacles` | `()` | Valid, nonempty Shapely `Polygon` objects that define keepouts. | +| `initial_paths` | Empty mapping | Net IDs mapped to `PathSeed` objects. | +| `clearance` | `2.0` | Finite, nonnegative spacing required between physical shapes. | +| `safety_zone_radius` | `0.0021` | Tolerance for small obstacle intersections at a move's endpoints during search. | ## Path seeds @@ -42,20 +38,16 @@ The fields below appear in constructor order. Use one layout unit for coordinate | Value | Read it for | | --- | --- | -| `RoutingRunResult.results_by_net` | A read-only mapping from net ID to `RoutingResult`. Use `dict(run.results_by_net)` to make an editable copy. | +| `RoutingRunResult.results_by_net` | A mapping from net ID to `RoutingResult`. | | `RoutingResult.is_valid` and `outcome` | `is_valid` is true when the outcome is `completed`. Read `outcome` to distinguish success, a failed geometry check (`colliding`), a path that stopped short (`partial`), or an empty path (`unroutable`). | -| `RoutingResult.requested_net` and `effective_net` | The net as supplied and the net used by the worker, including resolved headings. | -| `RoutingResult.path` | Ordered path components from the source to the last reached state. Each component carries its move specification and placed start and end ports. An unroutable result has an empty path. | +| `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 position and heading. With heading inference, the check uses the chosen heading. Read `is_valid` for the result of geometry verification. | -| `RoutingResult.report` | `total_length` in layout units plus static, dynamic, and self-collision counts. `out_of_bounds` flags geometry outside the board. `discontinuous` flags missing or point-only joins, including at terminal faces. `invalid_geometry` flags invalid or empty physical polygons. `seed_error` identifies a supplied bend that cannot carry the net's width or cannot be safely materialized. `terminal_error` identifies an inaccessible start or target face. | -| `RoutingResult.as_seed()` | The ordered moves for [saving a placement recipe](route-a-layout.md#save-a-placement-recipe) or replaying a path. | -| `RoutingResult.locked_geometry` | Physical polygons checked during routing. Use these to inspect the route or [reserve a completed net](route-a-layout.md#reuse-an-existing-route). | +| `RoutingResult.report` | `total_length` in layout units plus static, dynamic, and self-collision counts. `out_of_bounds` flags geometry outside the board. `discontinuous` flags missing or point-only joins, including at terminal faces. `invalid_geometry` flags invalid or empty physical polygons. | +| `RoutingResult.locked_geometry` and `as_seed()` | Physical polygons and the sequence of moves, respectively. Check validity before exporting polygons or using them as keepouts. | | `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. | -Check `is_valid` and keep the effective net and geometry settings with each placement recipe. [Placement workflow](route-a-layout.md#save-a-placement-recipe) - -For structured logging, `dataclasses.asdict(run)` preserves the per-net fields. Choose how to encode the Shapely polygons when writing JSON. +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). ## Options and defaults @@ -74,38 +66,26 @@ For structured logging, `dataclasses.asdict(run)` preserves the per-net fields. | Field | Default | Effect | | --- | --- | --- | -| `node_limit` | `1_000_000` | Nonnegative integer per-search expansion ceiling. Automatic uses smaller budgets for its initial stages. Zero skips search and corridor preparation and verifies supplied seeds in one pass if congestion iterations are enabled. Disable refinement to inspect the unchanged seed geometry. | +| `node_limit` | `1_000_000` | Per-search expansion ceiling. Automatic uses smaller budgets for its initial stages. | | `min_straight_length` | `5.0` | Finite, nonnegative minimum length for regular forward moves in lattice search. | | `max_straight_length` | `2000.0` | Finite, positive maximum distance for the forward scan in lattice search. | -| `greedy_h_weight` | `1.5` | Finite, nonnegative weight on the estimated cost still needed to reach the target. Lower values give more influence to the cost of the path so far. | +| `greedy_h_weight` | `1.5` | Weight on the estimated cost still needed to reach the target. Lower values give more influence to the cost of the path so far. | | `bend_radii` | `(50.0, 100.0)` | Finite, positive radii permitted for 90-degree bends in search and seeds. Each move needs a radius of at least half its net width. Fractional radii retain their curvature and extend both tangents to the next grid point. An empty list disables 90-degree bends. | | `sbend_radii` | `(10.0,)` | Finite, positive radii permitted for S-bends in search and seeds, subject to the same width requirement. An empty list disables S-bends. | | `sbend_offsets` | `None` | `None` lets the router choose signed lateral offsets. An explicit list restricts routing and seeds to those offsets after rounding to the grid. An empty list disables S-bends. | | `bend_collision_type` | `"arc"` | Search proxy, one of `"arc"`, `"bbox"`, or `"clipped_bbox"`. The legacy polygon form defines both shapes unless split geometry is supplied. | -| `bend_proxy_geometry` | `None` | Override the bend proxy. A polygon applies to 90-degree bends. A custom polygon proxy by itself keeps the standard physical arc and emits a warning. | -| `bend_physical_geometry` | `None` | Override 90-degree bend geometry with `"arc"` or a polygon. A custom physical polygon also supplies the default proxy when the collision type is `"arc"`. Define the polygon relative to the arc center and include both tangent extensions for a fractional radius. | +| `bend_proxy_geometry` | `None` | Override the proxy. A custom polygon proxy by itself keeps the standard physical arc and emits a warning. | +| `bend_physical_geometry` | `None` | Override the physical geometry with `"arc"` or a polygon. A custom physical polygon also supplies the default proxy when the collision type is `"arc"`. Custom polygons for fractional 90-degree bends are positioned relative to the arc center and must include both tangent extensions. | | `bend_clip_margin` | `None` | Optional legacy shrink margin for `"clipped_bbox"`. The default uses an eight-point proxy for each arc and extends it along any grid tangents. | -| `visibility_guidance` | `"tangent_corner"` | Choose tangent candidates, local visibility tests from indexed corners with `"exact_corner"`, or no visibility suggestions with `"off"`. | -| `sbend_outlines` | `()` | Complete custom S-bend polygons, supplied as `SBendOutline(offset, radius, width, polygon)` entries. Each entry applies to its signed offset, radius, and net width. | -| `proximity_range` | `10.0` | Obstacle proximity scoring range in layout units. Scale it with the coordinates when changing units. Large perimeters use an exact boundary index once the sample budget is reached. | -| `bend_physical_length` | `None` | Optional authored centerline length for the shared custom 90-degree template, including tangent extensions. Search, refinement, and reports use it when supplied. | -| `distance_heuristic_weight` | `1.0` | Finite, nonnegative multiplier for the remaining-distance term only. Increase it to favor progress toward the target relative to estimated turn penalties. The routed path's objective stays the same. | - -A custom S-bend outline uses local coordinates. Its input face is centered at `(0, 0)`, its output face at `(span, offset)`, and both ports face east. Use the same grid span as `SBendSeed(offset, radius)`, including any tangent extension to reach the output face. For example, an offset of `40` with radius `50` has its output at `(80, 40)`. The router rotates and translates the entire outline and uses it for collision checks and seed replay. Supply a separate outline to customize the opposite offset. Width matching allows a relative difference of `1e-12` to account for floating-point conversions. An ambiguous match raises an error. Unmatched moves use the circular S-bend. Set `SBendOutline.length` to use a process-specific centerline length for scoring, refinement, and reporting. The default is the nominal circular length. Automatic mode uses lattice search when a registered outline matches a net width. Bundle mode requires circular bends for its nets. - -When migrating a half-arc template, supply the complete outline through `sbend_outlines` and keep `bend_physical_geometry` for custom 90-degree bends. Both terminal faces of each custom polygon must be centered on their ports and match the routed width. A custom 90-degree template is shared across nets, so it can only be used by nets whose width matches its faces. Replay an `SBendSeed` with the same outlines and bend settings to recover its physical geometry. - -When a net can use a custom outline, search checks the geometry of each candidate move at its terminals. Seed replay verifies the materialized faces. - -Circular bends approximate the outer edge within a sagitta of 0.01 layout units. The router also sizes the subdivision for the outer edge of a clearance-expanded circular proxy. A generated circular arc that needs more than 250,000 subdivisions is rejected before sampling. Use coarser layout units if the required radii exceed this limit. +| `visibility_guidance` | `"tangent_corner"` | Choose tangent candidates, exact corner visibility with `"exact_corner"`, or no visibility suggestions with `"off"`. | ### ObjectiveWeights -The search objective scores path length, components, and proximity. All weights must be finite and nonnegative. Increasing a component penalty makes routes with more of that component less attractive. Refinement can use its own objective. +The search objective scores path length, components, and proximity. Increasing a component penalty makes routes with more of that component less attractive. Refinement can use its own objective. | Field | Default | Effect | | --- | --- | --- | -| `unit_length_cost` | `1.0` | Cost per unit of path length, including estimated remaining distance in lattice and corridor search. At zero, the estimate still includes configured turning penalties. | +| `unit_length_cost` | `1.0` | Cost per unit of path length. | | `bend_penalty` | `250.0` | Additional cost of a 90-degree bend. Smaller radii incur a larger surcharge when this penalty is positive. | | `sbend_penalty` | `500.0` | Additional cost of an S-bend. | | `danger_weight` | `1.0` | Weight of the obstacle proximity cost. | @@ -116,9 +96,9 @@ Increase the iteration limit when later reroutes might resolve conflicts. Adjust | Field | Default | Effect | | --- | --- | --- | -| `max_iterations` | `10` | Nonnegative integer maximum for congestion iterations per attempt. Automatic's initial probe may use fewer. Zero skips warm-start and corridor searches. | -| `base_penalty` | `100.0` | Finite, nonnegative initial penalty for overlapping other routes. | -| `multiplier` | `1.5` | Finite, nonnegative penalty multiplier between unresolved iterations. | +| `max_iterations` | `10` | Maximum congestion iterations per attempt. Automatic's initial probe may use fewer. Zero skips warm-start and corridor searches. | +| `base_penalty` | `100.0` | Initial penalty for overlapping other routes. | +| `multiplier` | `1.5` | Scale the penalty between unresolved iterations. | | `use_tiered_strategy` | `True` | Allow a cheaper bend proxy in the first iteration when applicable. | | `net_order` | `"user"` | Start from input order or sort by the sum of the horizontal and vertical distances between ports with `"shortest"` or `"longest"`. | | `warm_start_enabled` | `True` | Build greedy seeds before congestion iterations. | @@ -130,7 +110,7 @@ Increase the iteration limit when later reroutes might resolve conflicts. Adjust | Field | Default | Effect | | --- | --- | --- | | `enabled` | `True` | Try geometric improvements after routing. | -| `objective` | `None` | Use another `ObjectiveWeights` value for refinement, or reuse the search objective. When set, automatic mode uses this objective to compare a verified refinement with its incumbent on the same net set. `automatic_length_weights` still applies to planner selection. | +| `objective` | `None` | Use another `ObjectiveWeights` value for refinement, or reuse the search objective. | | `max_windows_per_net` | `4` | Maximum number of path sections to try replacing per net across improvement rounds. Use `1` for a shorter pass or `None` to remove this limit. | ### TopologyOptions @@ -141,7 +121,7 @@ For a layout that repeatedly stops short at an opening, `guide` can suggest a pa | --- | --- | --- | | `mode` | `"automatic"` | Select a [routing mode](tune-and-troubleshoot.md#choose-a-routing-mode). | | `max_corridors` | `3` | Maximum proposed passages per net. | -| `guide_strength` | `0.75` | Maximum added guidance cost per unit length. Explicit guide and seed runs with at least two configured congestion iterations may try one additional iteration from the start with zero guidance cost. The retry retains corridor move proposals and wins only with higher verified coverage. | +| `guide_strength` | `0.75` | Maximum added guidance cost per unit length. Zero keeps the suggested moves without adding cost. | | `seed_node_limit` | `600` | Total seed-search expansions per net, capped by the active search limit. | | `infer_terminal_headings` | `False` | Let automatic or bundle mode choose headings for supported layouts with flexible port directions. Automatic preserves caller headings when initial paths are supplied. | | `automatic_cost` | `"selective"` | Try a second column-planning pass based on route cost when the first pass chains short S-bends. Use `"always"` to try both passes or `"never"` to plan by span alone. | diff --git a/docs/user/fabrication.md b/docs/user/fabrication.md deleted file mode 100644 index c04acc3..0000000 --- a/docs/user/fabrication.md +++ /dev/null @@ -1,85 +0,0 @@ -# Route with process constraints - -Inire checks routed-path continuity, board containment, and clearance for the geometry in the routing problem. Use the placed-cell and process data for port compatibility, layer assignment, and length tolerances. Keep that context with each [placement recipe](route-a-layout.md#save-a-placement-recipe) when assembling the layout. - -## Check placed optical ports - -Read the physical widths from the placed devices' port metadata. `PlacedPort.connect` checks both declared widths before constructing the constant-width net. - -```python -from inire import Port -from inire.layout import PlacedPort - -source = PlacedPort(Port(10000, 10000, 0), width=500) -taper_input = PlacedPort(Port(70000, 10000, 0), width=500) -net = source.connect("source_to_taper", taper_input) -``` - -For a 3,000 nm target, place the 40 µm taper with its 500 nm face at `taper_input` and its 3,000 nm face abutting the target. Use routing keepouts with local openings for the terminal leads. When you assemble the layout, place the verified route against the device ports and check the physical joins. [EBeam taper cell](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/gds/EBeam/ebeam_routing_taper_te1550_w%3D500nm_to_w%3D3000nm_L%3D40um.gds) - -## Preserve length-sensitive paths - -Keep the original placement and authored length when rerouting one arm of an interferometer. Compare the replacement to the tolerance supplied by the circuit designer. For a matched pair, compare the signed difference between the two arm lengths before and after the replacement. - -```python -from inire.layout import preserves_length - -# Lengths are in the same units as the routing layout. -placement = original_placement -if preserves_length(replacement, authored_length, length_tolerance): - placement = (replacement.effective_net, replacement.as_seed(), options.search) -``` - -An authored 286.770 µm path in the Raymond MZI array can be replaced geometrically by a 127.208 µm route. If the circuit uses process-specific Bézier bends, supply the measured centerline length with the custom bend template and use the same setting for search and replay. The length check retains the original placement when the replacement falls outside the circuit tolerance. [Raymond MZI layout](https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/EBeam_hannahraymond_MZIv21.gds) · [Custom bend lengths](api-reference.md#searchoptions) - -## Keep layers and process profiles with the nets - -Each `RoutingProblem` represents one collision plane. Group independent layers by layer and datatype and keep that pair with the placement recipes. Add projected keepouts from other layers when the process requires cross-layer spacing. Keep intentional transitions between layers as placed circuit devices. - -```python -from inire import RoutingProblem, route -from inire.layout import partition_layers - -placements_by_layer = {} -for layer, nets in partition_layers([((1, 0), silicon_net), ((4, 0), nitride_net)]).items(): - plane = RoutingProblem( - bounds, nets, static_obstacles=keepouts_by_layer[layer], clearance=clearance_by_layer[layer], - ) - options = options_by_layer[layer] - run = route(plane, options=options) - placements = {} - for net_id, result in run.results_by_net.items(): - if not result.is_valid: - raise ValueError(f"Route {net_id!r} ended with outcome {result.outcome!r}") - placements[net_id] = (result.effective_net, result.as_seed(), options.search) - placements_by_layer[layer] = placements -``` - -For different bend rules on the same layer, supply each group's allowed radii in `SearchOptions`. `route_profiles` applies those options to search, seed replay, and refinement, and reserves the verified groups in the order supplied. In the QFoundry example, the flux line can use 15 µm radius while the feedline requires at least 50 µm although both have a 15.5 µm signal width and 7 µm gaps. [QFoundry process profiles](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/waveguides.xml#L21-L64) - -```python -from inire import RoutingProblem -from inire.layout import route_profiles - -cpw_plane = RoutingProblem( - bounds, (flux_net, feed_net), static_obstacles=cpw_keepouts, clearance=ground_strip_width, -) -profiles = [ - ((flux_net.net_id,), flux_options), - ((feed_net.net_id,), feed_options), -] -results = route_profiles(cpw_plane, profiles) -placements = {} -for net_ids, options in profiles: - for net_id in net_ids: - result = results[net_id] - if not result.is_valid: - raise ValueError(f"Route {net_id!r} ended with outcome {result.outcome!r}") - placements[net_id] = (result.effective_net, result.as_seed(), options.search) -``` - -## Route a coplanar waveguide envelope - -For a 15.5 µm signal with a 7 µm gap on each side, route with a width of 29.5 µm. Use the required ground-strip width as the clearance between envelopes. Save the verified placement recipe for your component library. To verify the same path at the signal width, replay its seed with a 15.5 µm net using the same effective ports and bend rules. - -A 3 µm minimum ground strip rejects parallel tracks at 28 µm and 32 µm pitches. A 36 µm pitch leaves a 6.5 µm strip between their envelopes. diff --git a/docs/user/route-a-layout.md b/docs/user/route-a-layout.md index d3d0bed..408161b 100644 --- a/docs/user/route-a-layout.md +++ b/docs/user/route-a-layout.md @@ -8,14 +8,14 @@ To get a result you can experiment with, run the [single-net quick start](../../ 2. **Set source and target headings.** A heading is the direction the waveguide travels as it leaves its source or enters its target. Heading 0 points east and 90 points north. If a device labels a target port by the direction it faces outward, reverse that heading by 180 degrees. For example, a waveguide entering a west-facing port travels east, so its target heading is 0. 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)`. Automatic mode is the default. Before using a placement recipe, [check the net's result](tune-and-troubleshoot.md#read-the-result). +5. **Route and check.** Call `route(problem, options=options)`. Automatic mode is the default. Before exporting, [check each net's result](tune-and-troubleshoot.md#read-the-result). ## Route between placed crossings 1. **Place the crossing cells.** Keep each cell's physical footprint and internal connections in your layout. Get the port positions and headings in board coordinates after applying placement and rotation. -2. **Reserve routing keepouts around the cells.** Use the device's routing keepout if supplied. Otherwise, start from its footprint and make local openings at the ports you're connecting. Keep the full physical cell in your layout. +2. **Reserve routing keepouts around the cells.** Use the device's routing keepout if supplied. Otherwise, start from its footprint and make local openings at the ports you're connecting. Keep the full physical cell in the exported layout. 3. **Route the external connections.** Give Inire one net per connection between devices. The example connects A's east port to B's west port. B's arrival heading points east into the cell. ![Two rectangular crossing cells at different heights. A waveguide runs from the opening on A's right edge to the opening on B's left edge. Both port arrows point east.](../figures/placed-crossing.png) @@ -63,83 +63,55 @@ result = run.results_by_net[net_id] assert result.is_valid ``` -When assembling the layout, check the port joins and clearance against the actual placed-cell geometry. Inire verifies the external route against the keepouts you supplied. +Before export, check the port joins and clearance against the actual placed-cell geometry. Inire verifies the external route against the keepouts you supplied. -For declared port widths and transition cells, see [Check placed optical ports](fabrication.md#check-placed-optical-ports). +## Export verified geometry -## Save a placement recipe - -After checking `result.is_valid`, use `result.as_seed()` to get the ordered moves. Keep the effective net, the component settings, and your coordinate unit with the recipe. The effective net records the resolved terminal positions and headings and the route width. +Use `result.locked_geometry` to pass a verified net's physical polygons to a layout writer. To inspect the coordinates in a text file, continue from the quick start or the crossing example and write the polygons as well-known text (WKT). Keep track of your coordinate unit when importing the file into another tool. ```python -if not result.is_valid: - raise ValueError(f"Route {result.net_id!r} ended with outcome {result.outcome!r}") +from pathlib import Path -placement = (result.effective_net, result.as_seed(), options.search) +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") ``` -The example uses the `options` from the crossing example. If you called `route(problem)`, use `RoutingOptions().search`. - -Place the first move at the effective start port and each subsequent move at the previous move's end port. For explicit placements, read the `move_spec`, `start_port`, and `end_port` of each component in `result.path`. Use the same width, radii, tangent extensions, and custom outlines that the router checked. - -Your layout tool realizes the components and writes the layout. Choose widths and clearance with enough margin for any downstream rounding. Inire's verification describes the supplied geometry in routing units. Use `result.locked_geometry` to inspect the polygons it checked or reserve them in a later routing run. +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. Search can follow a partial seed from the first iteration and can leave it to find another approach. To build a hint from turns and straights, see the [path seed reference](api-reference.md#path-seeds). -- **Hold a route fixed.** Check `result.is_valid`, then use `FixedRoute.from_result(result)` and pass it in `fixed_routes` alongside the remaining nets. The next run respects it as a distinct net, including at zero clearance. +- **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). +- **Hold a route fixed.** Check `result.is_valid`, then add `result.locked_geometry` to `static_obstacles` while routing other nets. The next run applies its own clearance to those polygons. -When terminal headings are inferred, use the effective net with the saved moves to replay the same placement. +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. ```python -from dataclasses import replace - -from inire import RefinementOptions, TopologyOptions, route - -chosen = route(problem, options=options) -verified_nets = [] -seeds = {} -for net in problem.nets: - result = chosen.results_by_net[net.net_id] - if result.is_valid: - verified_nets.append(result.effective_net) - seeds[net.net_id] = result.as_seed() - -replay = route( - replace(problem, nets=tuple(verified_nets), initial_paths=seeds), - options=replace( - options, - search=replace(options.search, node_limit=0), - topology=TopologyOptions(mode="off"), - refinement=RefinementOptions(enabled=False), - ), +from inire import ( + NetSpec, Port, RoutingOptions, + RoutingProblem, SearchOptions, route, ) -for net in verified_nets: - result = replay.results_by_net[net.net_id] - assert result.is_valid - assert result.locked_geometry == chosen.results_by_net[net.net_id].locked_geometry -``` - -Route a straight net, then reserve it while routing another net on the same layer. The second net has to detour around one end of the fixed route. - -```python -from dataclasses import replace - -from inire import FixedRoute, NetSpec, Port, RoutingOptions, RoutingProblem, SearchOptions, route bounds = (0, -50, 100, 50) options = RoutingOptions(search=SearchOptions(bend_radii=(10,))) -fixed_net = NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0)) -detour_net = NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90)) -problem = RoutingProblem(bounds=bounds, nets=(fixed_net, detour_net), clearance=0) -fixed = route(replace(problem, nets=(fixed_net,)), options=options).results_by_net["fixed"] +first = RoutingProblem( + bounds=bounds, + nets=(NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0)),), +) +fixed = route(first, options=options).results_by_net["fixed"] +assert fixed.is_valid -remaining = replace(problem, nets=(detour_net,), fixed_routes=(FixedRoute.from_result(fixed),)) -detour = route(remaining, options=options).results_by_net["detour"] +second = RoutingProblem( + bounds=bounds, + nets=(NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90)),), + static_obstacles=fixed.locked_geometry, +) +detour = route(second, options=options).results_by_net["detour"] assert detour.is_valid -detour_placement = (detour.effective_net, detour.as_seed(), options.search) ``` -For imported metal or waveguide polygons that belong to an existing net, use `FixedRoute("existing_net", imported_polygons)`. Supply polygons in board coordinates. For other artwork that blocks routing, use `static_obstacles`. - To compare the two paths on a plot, see the [fixed-route example](../../examples/README.md#route-around-fixed-geometry). diff --git a/docs/user/tune-and-troubleshoot.md b/docs/user/tune-and-troubleshoot.md index 2e95589..c157fee 100644 --- a/docs/user/tune-and-troubleshoot.md +++ b/docs/user/tune-and-troubleshoot.md @@ -6,12 +6,12 @@ Start with `run.results_by_net[net_id].outcome`. It distinguishes a path that st | `result.outcome` | What to inspect | | --- | --- | -| `completed` | The path reached its target and passed verification. Read its length in `report.total_length` and [save its placement recipe](route-a-layout.md#save-a-placement-recipe). | +| `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 and failed verification. Check `result.report` for keepout clearance, conflicts with another route, self-overlap, invalid geometry, a bad join, or geometry outside the board. | | `partial` | Read the position and heading of `result.path[-1].end_port`. Check room for the path to continue from that heading. If the next turn fits, compare search limits. | | `unroutable` | The path is empty. Check the launch heading and room for the first straight or bend. | -Check `is_valid` before placing a result. Every routing mode checks that the physical polygons fit within the board. +Check `is_valid` before exporting. Every routing mode checks that the physical polygons fit within the board. ## Why a net stopped short @@ -35,9 +35,9 @@ Set `TopologyOptions(mode=...)` and pass it as `topology` in `RoutingOptions`. ### Mode requirements -- Guide and seed modes need Shapely 2.1 or later with GEOS 3.10 or later when planning corridors. Nets that receive no corridor can use ordinary lattice search. A caller-supplied seed takes precedence over a generated one. Set `node_limit=0` to verify supplied seeds without planning corridors. [Constrained triangulation requirements](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html) +- In guide and seed modes, nets without a corridor can use ordinary lattice search. A caller-supplied seed takes precedence over a generated one. These modes require Shapely 2.1 or later with GEOS 3.10 or later for [constrained triangulation](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html). - Use `infer_terminal_headings` with automatic or bundle mode if your ports may change direction and the layout supports bundle planning. Compare fixed and flexible headings in [complex-routing example 1](../../examples/advanced.md#complex-routing-example-1). -- Automatic mode starts with smaller budgets and can retry with your configured ceiling if coverage remains below the bound. It runs lattice search directly for custom physical bends or polygonal search proxies. With no triangulation available, it tries the constructive planners before falling back to lattice search. [Example with all five modes](../complex-routing-example-1.md#compare-all-routing-modes) +- Automatic mode starts with smaller budgets and can retry with your configured ceiling if coverage remains below the bound. It runs lattice search directly for custom physical bends or polygonal search proxies, or when constrained triangulation is unavailable. ## Choose the next setting diff --git a/examples/03_locked_paths.py b/examples/03_locked_paths.py index a7b9a19..987ba73 100644 --- a/examples/03_locked_paths.py +++ b/examples/03_locked_paths.py @@ -1,6 +1,4 @@ -from dataclasses import replace - -from inire import FixedRoute, NetSpec, ObjectiveWeights, Port, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route +from inire import NetSpec, ObjectiveWeights, Port, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route from inire.utils.visualization import plot_routing_results @@ -10,28 +8,31 @@ def main() -> None: bounds = (0, -50, 100, 50) options = RoutingOptions( search=SearchOptions(bend_radii=(10.0,)), - # Isolate the lattice detour. + # 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...") - fixed_net = NetSpec("netA", Port(10, 0, 0), Port(90, 0, 0)) - detour_net = NetSpec("netB", Port(50, -20, 90), Port(50, 20, 90)) - problem = RoutingProblem(bounds, (fixed_net, detour_net)) - fixed = route(replace(problem, nets=(fixed_net,)), options=options).results_by_net["netA"] + problem_a = RoutingProblem( + bounds=bounds, + nets=(NetSpec("netA", Port(10, 0, 0), Port(90, 0, 0)),), + ) + results_a = route(problem_a, options=options).results_by_net + fixed = results_a["netA"] assert fixed.is_valid print("Routing detour net around locked path...") - remaining = replace(problem, nets=(detour_net,), fixed_routes=(FixedRoute.from_result(fixed),)) - run = route(remaining, options=options) - detour = run.results_by_net[detour_net.net_id] - if not detour.is_valid: - raise ValueError(detour.report) - print("Detour net", detour.effective_net) - print("Placement recipe", detour.as_seed()) + 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 - fig, _ax = plot_routing_results({fixed.net_id: fixed, **run.results_by_net}, [], bounds) + results = {**results_a, **results_b} + 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/07_large_scale_routing.py b/examples/07_large_scale_routing.py index 2541be5..92098fb 100644 --- a/examples/07_large_scale_routing.py +++ b/examples/07_large_scale_routing.py @@ -3,15 +3,10 @@ import time from shapely.geometry import box from inire import ( - CongestionOptions, - DiagnosticsOptions, NetSpec, - ObjectiveWeights, Port, - RoutingOptions, RoutingProblem, RoutingResult, - SearchOptions, ) from inire.router._stack import build_routing_stack from inire.utils.visualization import plot_expanded_nodes, plot_routing_results @@ -45,6 +40,8 @@ def main() -> None: static_obstacles=tuple(obstacles), clearance=6.0, ) + from inire import CongestionOptions, DiagnosticsOptions, ObjectiveWeights, RoutingOptions, SearchOptions + options = RoutingOptions( search=SearchOptions( node_limit=2_000_000, @@ -52,7 +49,6 @@ def main() -> None: sbend_radii=(50.0,), greedy_h_weight=1.5, bend_clip_margin=10.0, - distance_heuristic_weight=10.0, ), objective=ObjectiveWeights( unit_length_cost=0.1, diff --git a/examples/README.md b/examples/README.md index b3a865f..d59e038 100644 --- a/examples/README.md +++ b/examples/README.md @@ -20,7 +20,7 @@ After [installing Inire](../README.md#install), run the example scripts with Pyt ![A second waveguide makes a U-shaped detour around the left end of a fixed straight waveguide.](03_locked_paths.png) -The first call routes a straight waveguide. `FixedRoute.from_result()` reserves its exact polygons, so the new connection detours around one end of the fixed route. Run [`03_locked_paths.py`](03_locked_paths.py) to plot the detour and print its resolved net and placement recipe. To hold a route fixed in your own design, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route). +The first call routes a straight waveguide. The second uses its polygons as keepouts, so the new connection passes to the left of the fixed route. Run [`03_locked_paths.py`](03_locked_paths.py) to reproduce the detour. To hold a route fixed in your own design, follow the [route reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route). diff --git a/inire/__init__.py b/inire/__init__.py index efbc659..5d84ef5 100644 --- a/inire/__init__.py +++ b/inire/__init__.py @@ -2,19 +2,16 @@ inire Wave-router """ from collections.abc import Callable -from dataclasses import replace from .geometry.primitives import Port as Port # noqa: PLC0414 from .model import ( CongestionOptions as CongestionOptions, - FixedRoute as FixedRoute, DiagnosticsOptions as DiagnosticsOptions, NetSpec as NetSpec, ObjectiveWeights as ObjectiveWeights, RefinementOptions as RefinementOptions, RoutingOptions as RoutingOptions, RoutingProblem as RoutingProblem, - SBendOutline as SBendOutline, SearchOptions as SearchOptions, TopologyOptions as TopologyOptions, ) # noqa: PLC0414 @@ -49,46 +46,20 @@ def route( iteration_callback: Callable[[int, dict[str, RoutingResult]], None] | None = None, ) -> RoutingRunResult: resolved_options = RoutingOptions() if options is None else options - for net in problem.nets: - if net.start == net.target: - raise ValueError(f"Net {net.net_id!r} has coincident ports after grid snapping; connect the placed ports directly") - if problem.initial_paths: - net_ids = {net.net_id for net in problem.nets} - for net_id, seed in problem.initial_paths.items(): - if net_id not in net_ids: - raise ValueError(f"Initial path provided for unknown net: {net_id}") - error = resolved_options.search.seed_geometry_error(seed) - if error is not None: - raise ValueError(f"Initial path for {net_id!r} {error}") - requested = {net.net_id: net for net in problem.nets} - - def attach_requested(results: dict[str, RoutingResult]) -> dict[str, RoutingResult]: - return { - key: replace(result, requested_net=requested[key], effective_net=result.effective_net or requested[key]) - for key, result in results.items() - } - - def notify(iteration: int, results: dict[str, RoutingResult]) -> None: - assert iteration_callback is not None - iteration_callback(iteration, attach_requested(results)) - - callback = notify if iteration_callback is not None else None if resolved_options.topology.mode == "automatic": from .router._automatic import route_automatic # noqa: PLC0415 - run = route_automatic(problem, resolved_options, callback) - else: - from .router._stack import route_explicit # noqa: PLC0415 + return route_automatic(problem, resolved_options, iteration_callback) - run = route_explicit(problem, options=resolved_options, iteration_callback=callback) - return replace(run, results_by_net=attach_requested(run.results_by_net)) + from .router._stack import route_once # noqa: PLC0415 + + return route_once(problem, options=resolved_options, iteration_callback=iteration_callback) __all__ = [ "AutomaticRoutingReport", "Bend90Seed", "CapacityLimit", "CongestionOptions", - "FixedRoute", "ComponentConflictTrace", "ConflictTraceEntry", "DiagnosticsOptions", @@ -110,7 +81,6 @@ __all__ = [ "RoutingRunResult", "RoutingStage", "RoutingTiming", - "SBendOutline", "SBendSeed", "SearchOptions", "StraightSeed", diff --git a/inire/_snapshot.py b/inire/_snapshot.py deleted file mode 100644 index eed5a9b..0000000 --- a/inire/_snapshot.py +++ /dev/null @@ -1,38 +0,0 @@ -"""Read-only, insertion-ordered snapshots of public mappings.""" - -from __future__ import annotations - -from typing import Never, Self, TYPE_CHECKING, TypeVar - -if TYPE_CHECKING: - from collections.abc import Iterable, Mapping - -_K = TypeVar("_K") -_V = TypeVar("_V") - - -class _Snapshot(dict[_K, _V]): - """A read-only dict that dataclasses.asdict can traverse.""" - - __slots__ = () - - def __new__(cls, source: Mapping[_K, _V] | Iterable[tuple[_K, _V]]) -> Self: - result = super().__new__(cls) - dict.update(result, source) - return result - - def __init__(self, _source: Mapping[_K, _V] | Iterable[tuple[_K, _V]]) -> None: - # Populate only at allocation so reinitialization cannot change a snapshot. - pass - - def _read_only(self, *_args: object, **_kwargs: object) -> Never: - raise TypeError("Snapshot mappings are read-only") - - __setitem__ = __delitem__ = __ior__ = clear = pop = popitem = setdefault = update = _read_only - - def __reduce__(self) -> tuple[type[_Snapshot[_K, _V]], tuple[dict[_K, _V]]]: - return type(self), (dict(self),) - - -def snapshot(source: Mapping[_K, _V]) -> Mapping[_K, _V]: - return source if isinstance(source, _Snapshot) else _Snapshot(source) diff --git a/inire/geometry/collision.py b/inire/geometry/collision.py index e3eee20..a5dc88c 100644 --- a/inire/geometry/collision.py +++ b/inire/geometry/collision.py @@ -1,6 +1,6 @@ from __future__ import annotations -from dataclasses import dataclass, replace +from dataclasses import dataclass from typing import TYPE_CHECKING import numpy @@ -10,8 +10,7 @@ from inire.constants import TOLERANCE_LINEAR from inire.geometry.component_overlap import count_path_self_collisions from inire.geometry.components import check_path_geometry, path_within_board from inire.geometry.dynamic_path_index import DynamicPathIndex -from inire.geometry.index_helpers import floating_polygon, grid_cell_span -from inire.geometry.primitives import rotate_cardinal +from inire.geometry.index_helpers import grid_cell_span from inire.results import RoutingReport from inire.geometry.static_obstacle_index import StaticObstacleIndex @@ -24,7 +23,6 @@ if TYPE_CHECKING: from inire.geometry.components import ComponentResult from inire.geometry.primitives import Port - from inire.model import RoutingProblem _RAY_CAST_CACHE_LIMIT = 8192 @@ -52,18 +50,11 @@ def _has_non_touching_overlap(left: BaseGeometry, right: BaseGeometry) -> bool: return left.intersects(right) and not left.touches(right) -def _clearance_limit(clearance: float) -> float: - return clearance - TOLERANCE_LINEAR * min(1.0, clearance) - - def _violates_clearance(left: BaseGeometry, right: BaseGeometry, clearance: float) -> bool: if clearance <= 0: return _has_non_touching_overlap(left, right) - return left.distance(right) < _clearance_limit(clearance) - - -def _violates_net_clearance(left: BaseGeometry, right: BaseGeometry, clearance: float) -> bool: - return _violates_clearance(left, right, clearance) if clearance else left.intersects(right) + tolerance = TOLERANCE_LINEAR * min(1.0, clearance) + return left.distance(right) < clearance - tolerance def _span_to_bounds( @@ -101,7 +92,6 @@ class RoutingWorld: __slots__ = ( "clearance", - "self_clearance", "safety_zone_radius", "board", "grid_cell_size", @@ -116,33 +106,16 @@ class RoutingWorld: safety_zone_radius: float = 0.0021, *, board: Polygon | None = None, - self_clearance: float = 0.0, ) -> None: self.clearance = clearance - self.self_clearance = self_clearance self.safety_zone_radius = safety_zone_radius - self.board = floating_polygon(board) if board is not None else None + self.board = board self.grid_cell_size = 50.0 self.metrics = None self._static_obstacles = StaticObstacleIndex(self) self._dynamic_paths = DynamicPathIndex(self) - @classmethod - def from_problem(cls, problem: RoutingProblem, *, board: Polygon | None = None) -> RoutingWorld: - world = cls( - clearance=problem.clearance, - safety_zone_radius=problem.safety_zone_radius, - board=box(*problem.bounds) if board is None else board, - self_clearance=problem.self_clearance, - ) - for obstacle in problem.static_obstacles: - world.add_static_obstacle(obstacle) - for fixed in problem.fixed_routes: - for polygon in fixed.polygons: - world.add_static_obstacle(polygon, owner=fixed.net_id) - return world - def get_static_version(self) -> int: return self._static_obstacles.version @@ -167,12 +140,8 @@ class RoutingWorld: for obj_id in self._dynamic_paths.index.intersection(query_bounds): yield self._dynamic_paths.geometries[obj_id][1].bounds - def iter_static_entries(self) -> Iterable[tuple[Polygon, str | None]]: - index = self._static_obstacles - return ((polygon, index.owners.get(key)) for key, polygon in index.geometries.items()) - - def add_static_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None, *, owner: str | None = None) -> int: - return self._static_obstacles.add_obstacle(polygon, dilated_geometry, owner=owner) + def add_static_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None) -> int: + return self._static_obstacles.add_obstacle(polygon, dilated_geometry=dilated_geometry) def remove_static_obstacle(self, obj_id: int) -> None: self._static_obstacles.remove_obstacle(obj_id) @@ -180,43 +149,13 @@ class RoutingWorld: def _ensure_static_tree(self) -> None: self._static_obstacles.ensure_tree() - def corner_segment_visible(self, start: tuple[float, float], end: tuple[float, float]) -> bool: - """Allow endpoint contact while testing the open segment against keepouts.""" - self._ensure_static_tree() - tree = self._static_obstacles.tree - if tree is None: - return True - segment = LineString((start, end)) - return all(segment.relate_pattern(tree.geometries[index], "FF*******") for index in tree.query(segment)) + def _ensure_net_static_tree(self, net_width: float) -> STRtree: + return self._static_obstacles.ensure_net_tree(net_width) def _ensure_static_raw_tree(self) -> None: self._static_obstacles.ensure_raw_tree() - def terminal_issue(self, port: Port, width: float) -> str | None: - dx, dy = rotate_cardinal(0, width / 2, int(port.r)) - bounds = (port.x - abs(dx), port.y - abs(dy), port.x + abs(dx), port.y + abs(dy)) - if self.board is not None: - x0, y0, x1, y1 = self.board.bounds - if bounds[0] < x0 or bounds[1] < y0 or bounds[2] > x1 or bounds[3] > y1: - return "face extends outside the routing board" - self._ensure_static_raw_tree() - tree = self._static_obstacles.raw_tree - if tree is None: - return None - clearance = self.clearance - candidates = tree.query(box(bounds[0] - clearance, bounds[1] - clearance, bounds[2] + clearance, bounds[3] + clearance)) - if not len(candidates): - return None - face = LineString(((port.x - dx, port.y - dy), (port.x + dx, port.y + dy))) - for index in candidates: - keepout = tree.geometries[index] - if (clearance or self._static_obstacles.raw_owners[index] is not None) and _violates_net_clearance(face, keepout, clearance): - return "face violates keepout clearance" - if not clearance and not face.relate_pattern(keepout, "F**F*****"): - return "face enters a keepout" - return None - - def add_path_geometry( + def add_path( self, net_id: str, geometry: Sequence[Polygon], @@ -225,8 +164,7 @@ class RoutingWorld: *, physical_geometry: Sequence[tuple[int, Polygon]] | None = None, ) -> None: - """Add prepared path polygons and their component indexes.""" - self._dynamic_paths.add_path_geometry( + self._dynamic_paths.add_path( net_id, geometry, dilated_geometry=dilated_geometry, @@ -234,8 +172,7 @@ class RoutingWorld: physical_geometry=physical_geometry, ) - def add_route(self, net_id: str, path: Sequence[ComponentResult]) -> None: - """Validate and index the polygons of a route's components.""" + def install_path(self, net_id: str, path: Sequence[ComponentResult]) -> None: if any(not component.physical_checks[0] for component in path): return proxies: list[Polygon] = [] @@ -245,7 +182,7 @@ class RoutingWorld: proxies.extend(component.collision_geometry) dilated_proxies.extend(component.dilated_collision_geometry) physical_geometry.extend((component_index, polygon) for polygon in component.physical_geometry) - self.add_path_geometry(net_id, proxies, dilated_proxies, physical_geometry=physical_geometry) + self.add_path(net_id, proxies, dilated_proxies, physical_geometry=physical_geometry) def remove_path(self, net_id: str) -> None: self._dynamic_paths.remove_path(net_id) @@ -253,13 +190,42 @@ class RoutingWorld: def has_dynamic_paths(self) -> bool: return bool(self._dynamic_paths.geometries) + def check_move_straight_static(self, start_port: Port, length: float, net_width: float) -> bool: + reach = self.ray_cast( + start_port, + start_port.r, + max_dist=length + 0.01, + net_width=net_width, + caller="straight_static", + ) + return reach < length - 0.001 + + def _is_in_safety_zone_fast(self, idx: int, start_port: Port | None, end_port: Port | None) -> bool: + bounds_array = self._static_obstacles.bounds_array + if bounds_array is None: + return False + bounds = bounds_array[idx] + safety_zone = self.safety_zone_radius + if ( + start_port + and bounds[0] - safety_zone <= start_port.x <= bounds[2] + safety_zone + and bounds[1] - safety_zone <= start_port.y <= bounds[3] + safety_zone + ): + return True + return bool( + end_port + and bounds[0] - safety_zone <= end_port.x <= bounds[2] + safety_zone + and bounds[1] - safety_zone <= end_port.y <= bounds[3] + safety_zone + ) + def _is_in_safety_zone( self, geometry: Polygon, - raw_obstacle: Polygon, + obj_id: int, start_port: Port | None, end_port: Port | None, ) -> bool: + raw_obstacle = self._static_obstacles.geometries[obj_id] safety_zone = self.safety_zone_radius obstacle_bounds = raw_obstacle.bounds @@ -306,27 +272,53 @@ class RoutingWorld: start_port: Port | None = None, end_port: Port | None = None, ) -> bool: - self._ensure_static_raw_tree() - tree = self._static_obstacles.raw_tree - if tree is None: + # TODO: If static buffering becomes net-width-specific, add dedicated + # width-aware geometry/index handling instead of reviving dead args here. + static_obstacles = self._static_obstacles + if not static_obstacles.dilated: return False - clearance = self.clearance - left, bottom, right, top = result.total_bounds - if self._static_obstacles.owners: - x0, y0, x1, y1 = result.total_physical_bounds - left, bottom, right, top = min(left, x0), min(bottom, y0), max(right, x1), max(top, y1) - # The broad phase must include both the keepout proxy and the physical outline. - hits = tree.query(box(left - clearance, bottom - clearance, right + clearance, top + clearance)) - obstacles = tree.geometries + self._ensure_static_tree() + tree = static_obstacles.tree + bounds_array = static_obstacles.bounds_array + if tree is None or bounds_array is None: + return False + + hits = tree.query(box(*result.total_dilated_bounds)) + if hits.size == 0: + return False + + move_poly_bounds = result.dilated_bounds for hit_idx in hits: - obstacle = obstacles[hit_idx] - if self._static_obstacles.raw_owners[hit_idx] is not None: - if any(_violates_net_clearance(polygon, obstacle, clearance) for polygon in result.physical_geometry): + obstacle_bounds = bounds_array[hit_idx] + poly_hits_obstacle_aabb = False + for poly_bounds in move_poly_bounds: + if ( + poly_bounds[0] < obstacle_bounds[2] + and poly_bounds[2] > obstacle_bounds[0] + and poly_bounds[1] < obstacle_bounds[3] + and poly_bounds[3] > obstacle_bounds[1] + ): + poly_hits_obstacle_aabb = True + break + + if not poly_hits_obstacle_aabb: + continue + + obj_id = static_obstacles.obj_ids[hit_idx] + if self._is_in_safety_zone_fast(hit_idx, start_port, end_port): + collision_found = False + for polygon in result.collision_geometry: + if not self._is_in_safety_zone(polygon, obj_id, start_port, end_port): + collision_found = True + break + if collision_found: return True continue - for polygon in result.collision_geometry: - if _violates_clearance(polygon, obstacle, clearance) and not self._is_in_safety_zone(polygon, obstacle, start_port, end_port): + + static_obstacle = static_obstacles.dilated[obj_id] + for polygon in result.dilated_collision_geometry: + if polygon.intersects(static_obstacle) and not polygon.touches(static_obstacle): return True return False @@ -367,41 +359,6 @@ class RoutingWorld: return DynamicCongestionDetail(soft_overlap_count=real_hits_count) - def check_physical_move_congestion( - self, - result: ComponentResult, - net_id: str, - *, - frozen_net_ids: frozenset[str] = frozenset(), - ) -> DynamicCongestionDetail: - """Use physical clearance when admitting a move with a hard obstacle.""" - metrics = self.metrics - if metrics is not None: - metrics.total_congestion_check_calls += 1 - hits = set() - for polygon in result.physical_geometry: - candidates = self._physical_candidates(net_id, polygon) - if metrics is not None and candidates: - metrics.total_congestion_candidate_nets += len({other_net_id for other_net_id, _, _ in candidates}) - metrics.total_congestion_candidate_ids += len(candidates) - for other_net_id, _index, other in candidates: - if other_net_id in hits: - continue - if metrics is not None: - metrics.total_congestion_exact_pair_checks += 1 - if not _violates_net_clearance(polygon, other, self.clearance): - continue - if other_net_id in frozen_net_ids: - return DynamicCongestionDetail(soft_overlap_count=len(hits), hits_frozen_net=True) - hits.add(other_net_id) - return DynamicCongestionDetail(soft_overlap_count=len(hits)) - - def _physical_candidates(self, net_id: str, polygon: Polygon) -> list[tuple[str, int, Polygon]]: - minx, miny, maxx, maxy = polygon.bounds - clearance = self.clearance - bounds = (minx - clearance, miny - clearance, maxx + clearance, maxy + clearance) - return self._dynamic_paths.physical_candidates(net_id, bounds) - def _collect_congestion_candidates( self, result: ComponentResult, @@ -467,13 +424,8 @@ class RoutingWorld: bounds: tuple[float, float, float, float], net_id: str, ) -> bool: - span = grid_cell_span(bounds, self.grid_cell_size) - dynamic_paths = self._dynamic_paths - if dynamic_paths.uses_tree_for_span(span): - span_bounds = _span_to_bounds(*span, self.grid_cell_size) - return next(dynamic_paths.tree_candidates(net_id, span_bounds), None) is not None - gx_min, gy_min, gx_max, gy_max = span - cells = dynamic_paths.grid_net_obj_ids + gx_min, gy_min, gx_max, gy_max = grid_cell_span(bounds, self.grid_cell_size) + cells = self._dynamic_paths.grid_net_obj_ids if gx_min == gx_max and gy_min == gy_max: members = cells.get((gx_min, gy_min)) @@ -565,8 +517,8 @@ class RoutingWorld: net_id: str, broad_phase_cache: dict[tuple[str, int, int, int, int], dict[str, tuple[int, ...]]] | None, ) -> dict[str, tuple[int, ...]]: - span = grid_cell_span(bounds, self.grid_cell_size) - cache_key = (net_id, *span) + 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) if broad_phase_cache is not None and cache_key in broad_phase_cache: if self.metrics is not None: self.metrics.total_congestion_grid_span_cache_hits += 1 @@ -577,18 +529,12 @@ class RoutingWorld: dynamic_paths = self._dynamic_paths candidates_by_net: dict[str, set[int]] = {} - if dynamic_paths.uses_tree_for_span(span): - span_bounds = _span_to_bounds(*span, self.grid_cell_size) - for other_net_id, obj_id in dynamic_paths.tree_candidates(net_id, span_bounds): - candidates_by_net.setdefault(other_net_id, set()).add(obj_id) - else: - gx_min, gy_min, gx_max, gy_max = span - for gx in range(gx_min, gx_max + 1): - for gy in range(gy_min, gy_max + 1): - for other_net_id, obj_ids in dynamic_paths.grid_net_obj_ids.get((gx, gy), {}).items(): - if other_net_id == net_id: - continue - candidates_by_net.setdefault(other_net_id, set()).update(obj_ids) + for gx in range(gx_min, gx_max + 1): + for gy in range(gy_min, gy_max + 1): + for other_net_id, obj_ids in dynamic_paths.grid_net_obj_ids.get((gx, gy), {}).items(): + if other_net_id == net_id: + continue + candidates_by_net.setdefault(other_net_id, set()).update(obj_ids) frozen = { other_net_id: tuple(sorted(obj_ids)) @@ -604,8 +550,8 @@ class RoutingWorld: net_id: str, grid_net_cache: dict[tuple[str, int, int, int, int], tuple[str, ...]] | None, ) -> tuple[str, ...]: - span = grid_cell_span(bounds, self.grid_cell_size) - cache_key = (net_id, *span) + 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) if grid_net_cache is not None and cache_key in grid_net_cache: if self.metrics is not None: self.metrics.total_congestion_grid_net_cache_hits += 1 @@ -615,17 +561,12 @@ class RoutingWorld: self.metrics.total_congestion_grid_net_cache_misses += 1 dynamic_paths = self._dynamic_paths - if dynamic_paths.uses_tree_for_span(span): - span_bounds = _span_to_bounds(*span, self.grid_cell_size) - candidate_net_ids = {other_net_id for other_net_id, _ in dynamic_paths.tree_candidates(net_id, span_bounds)} - else: - gx_min, gy_min, gx_max, gy_max = span - candidate_net_ids = set() - for gx in range(gx_min, gx_max + 1): - for gy in range(gy_min, gy_max + 1): - for other_net_id in dynamic_paths.grid_net_obj_ids.get((gx, gy), {}): - if other_net_id != net_id: - candidate_net_ids.add(other_net_id) + candidate_net_ids: set[str] = set() + for gx in range(gx_min, gx_max + 1): + for gy in range(gy_min, gy_max + 1): + for other_net_id in dynamic_paths.grid_net_obj_ids.get((gx, gy), {}): + if other_net_id != net_id: + candidate_net_ids.add(other_net_id) frozen = tuple(sorted(candidate_net_ids)) if grid_net_cache is not None: @@ -691,10 +632,11 @@ class RoutingWorld: grid_net_cache: dict[tuple[str, int, int, int, int], tuple[str, ...]] | None = None, broad_phase_cache: dict[tuple[str, int, int, int, int], dict[str, tuple[int, ...]]] | None = None, ) -> DynamicCongestionDetail: - if not self.clearance or frozen_net_ids: - return self.check_physical_move_congestion(result, net_id, frozen_net_ids=frozen_net_ids) if self.metrics is not None: self.metrics.total_congestion_check_calls += 1 + dynamic_paths = self._dynamic_paths + if not dynamic_paths.geometries: + return DynamicCongestionDetail() candidates_by_net = self._collect_congestion_candidates( result, @@ -703,21 +645,35 @@ class RoutingWorld: grid_net_cache, broad_phase_cache, ) + if not candidates_by_net: + return DynamicCongestionDetail() return self._check_real_congestion( result, candidates_by_net, frozen_net_ids=frozen_net_ids, ) - def verify_path_geometry(self, components: Sequence[ComponentResult]) -> RoutingReport: - """Check continuity, self-spacing, the board, and static obstacles.""" + def verify_path_details( + self, + net_id: str, + components: Sequence[ComponentResult], + *, + capture_component_conflicts: bool = False, + ) -> PathVerificationDetail: + if self.metrics is not None: + self.metrics.total_verify_path_report_calls += 1 static_collision_count = 0 + dynamic_collision_count = 0 total_length = sum(component.length for component in components) valid_geometry, continuous = check_path_geometry(components) if not valid_geometry: - return RoutingReport(total_length=total_length, invalid_geometry=True) + return PathVerificationDetail(RoutingReport(total_length=total_length, invalid_geometry=True)) + conflicting_net_ids: set[str] = set() + component_conflicts: set[tuple[int, str, int]] = set() static_obstacles = self._static_obstacles + dynamic_paths = self._dynamic_paths + self._ensure_static_raw_tree() if static_obstacles.raw_tree is not None: raw_geometries = static_obstacles.raw_tree.geometries @@ -732,44 +688,17 @@ class RoutingWorld: # A mitre may extend past the physical clearance # radius at a component corner. Check the distance # before counting an overlap with that broad phase. - violates = _violates_net_clearance if static_obstacles.raw_owners[hit_idx] is not None else _violates_clearance - if violates(polygon, obstacle, self.clearance): + if _violates_clearance(polygon, obstacle, self.clearance): static_collision_count += 1 - return RoutingReport( - static_collision_count=static_collision_count, - self_collision_count=count_path_self_collisions(components, self.self_clearance), - total_length=total_length, - out_of_bounds=self.board is not None and not path_within_board(components, self.board), - discontinuous=not continuous, - ) - - def verify_path_details( - self, - net_id: str, - components: Sequence[ComponentResult], - *, - capture_component_conflicts: bool = False, - include_invalid_dynamic: bool = True, - geometry_report: RoutingReport | None = None, - ) -> PathVerificationDetail: - """Check the full path, optionally reusing its report against unchanged static geometry.""" - if self.metrics is not None: - self.metrics.total_verify_path_report_calls += 1 - report = self.verify_path_geometry(components) if geometry_report is None else geometry_report - dynamic_collision_count = 0 - conflicting_net_ids: set[str] = set() - component_conflicts: set[tuple[int, str, int]] = set() - - if ( - not report.invalid_geometry - and (include_invalid_dynamic or not report.intrinsic_collision_count) - and self._dynamic_paths.has_physical_paths() - ): + if dynamic_paths.has_physical_paths(): + clearance = max(0.0, self.clearance) for component_index, component in enumerate(components): component_hits: set[str] = set() for polygon in component.physical_geometry: - candidates = self._physical_candidates(net_id, polygon) + minx, miny, maxx, maxy = polygon.bounds + bounds = (minx - clearance, miny - clearance, maxx + clearance, maxy + clearance) + candidates = dynamic_paths.physical_candidates(str(net_id), bounds) if self.metrics is not None: self.metrics.total_verify_dynamic_candidate_nets += len({candidate[0] for candidate in candidates}) polygon_hits: set[str] = set() @@ -778,7 +707,7 @@ class RoutingWorld: continue if self.metrics is not None: self.metrics.total_verify_dynamic_exact_pair_checks += 1 - if _violates_net_clearance(polygon, other, self.clearance): + if _violates_clearance(polygon, other, clearance): polygon_hits.add(hit_net_id) if capture_component_conflicts: component_conflicts.add((component_index, hit_net_id, hit_component_index)) @@ -786,10 +715,15 @@ class RoutingWorld: dynamic_collision_count += len(component_hits) conflicting_net_ids.update(component_hits) - if dynamic_collision_count != report.dynamic_collision_count: - report = replace(report, dynamic_collision_count=dynamic_collision_count) return PathVerificationDetail( - report=report, + report=RoutingReport( + static_collision_count=static_collision_count, + dynamic_collision_count=dynamic_collision_count, + self_collision_count=count_path_self_collisions(components), + total_length=total_length, + out_of_bounds=self.board is not None and not path_within_board(components, self.board), + discontinuous=not continuous, + ), conflicting_net_ids=tuple(sorted(conflicting_net_ids)), component_conflicts=tuple(sorted(component_conflicts)), ) @@ -813,6 +747,10 @@ class RoutingWorld: self.metrics.total_ray_cast_calls_expand_snap += 1 elif caller == "expand_forward": self.metrics.total_ray_cast_calls_expand_forward += 1 + elif caller == "visibility_build": + self.metrics.total_ray_cast_calls_visibility_build += 1 + elif caller == "visibility_query": + self.metrics.total_ray_cast_calls_visibility_query += 1 elif caller == "visibility_tangent": self.metrics.total_ray_cast_calls_visibility_tangent += 1 else: @@ -835,37 +773,6 @@ class RoutingWorld: cache[key] = reach return reach - def straight_reach(self, origin: Port, max_dist: float, net_width: float) -> float: - """Find where a fixed-width, flat-ended trace first enters a keepout.""" - self._ensure_static_raw_tree() - tree = self._static_obstacles.raw_tree - if tree is None: - return max_dist - - dx, dy = rotate_cardinal(max_dist, 0, int(origin.r)) - half_x, half_y = (0.0, net_width / 2) if dx else (net_width / 2, 0.0) - left, right = sorted((origin.x, origin.x + dx)) - bottom, top = sorted((origin.y, origin.y + dy)) - left, bottom, right, top = left - half_x, bottom - half_y, right + half_x, top + half_y - strip = box(left, bottom, right, top) - clearance = self.clearance - padding = clearance - TOLERANCE_LINEAR * min(1.0, clearance) - candidates = tree.query(box(left - padding, bottom - padding, right + padding, top + padding)) - - axis = 0 if dx else 1 - start = origin.x if dx else origin.y - direction = 1 if (dx or dy) > 0 else -1 - face = axis if direction > 0 else axis + 2 - reach = max_dist - obstacles = tree.geometries - for index in candidates: - obstacle = obstacles[index] - keepout = obstacle.buffer(padding) if padding > 0 else obstacle - overlap = keepout.intersection(strip) - if overlap.area: - reach = min(reach, direction * (overlap.bounds[face] - start)) - return reach - def _cast_static_ray( self, origin: Port, @@ -885,7 +792,10 @@ class RoutingWorld: min_y, max_y = sorted([origin.y, origin.y + dy]) if net_width is not None: - tree, is_rect_array, bounds_array = static_obstacles.ensure_net_tree(net_width) + tree = self._ensure_net_static_tree(net_width) + key = (round(net_width, 4), round(self.clearance, 4)) + is_rect_array = static_obstacles.net_specific_is_rect[key] + bounds_array = static_obstacles.net_specific_bounds[key] else: self._ensure_static_tree() tree = static_obstacles.tree diff --git a/inire/geometry/component_overlap.py b/inire/geometry/component_overlap.py index fb517ec..ae6ef5c 100644 --- a/inire/geometry/component_overlap.py +++ b/inire/geometry/component_overlap.py @@ -1,13 +1,11 @@ from __future__ import annotations -from itertools import accumulate, combinations from typing import TYPE_CHECKING from shapely.geometry import box from shapely.strtree import STRtree from inire.constants import TOLERANCE_LINEAR -from inire.geometry.components import components_join if TYPE_CHECKING: from collections.abc import Sequence @@ -22,7 +20,6 @@ def components_overlap( prefer_actual: bool = False, *, at_join: bool = False, - clearance: float = 0.0, ) -> bool: polygons_a: Sequence[Polygon] polygons_b: Sequence[Polygon] @@ -37,92 +34,41 @@ def components_overlap( bounds_a = component_a.total_bounds bounds_b = component_b.total_bounds - if ( - bounds_a[0] > bounds_b[2] + clearance - or bounds_a[2] + clearance < bounds_b[0] - or bounds_a[1] > bounds_b[3] + clearance - or bounds_a[3] + clearance < bounds_b[1] + if not ( + bounds_a[0] < bounds_b[2] + and bounds_a[2] > bounds_b[0] + and bounds_a[1] < bounds_b[3] + and bounds_a[3] > bounds_b[1] ): return False - if at_join: - port_a, port_b = component_a.end_port, component_b.start_port - axis = 0 if port_a.r % 180 == 0 else 1 - normal, lateral = (port_a.x, port_a.y) if axis == 0 else (port_a.y, port_a.x) - face_a = _face_span(component_a, arrival=True) - face_b = _face_span(component_b, arrival=False) - if port_a != port_b or face_a is None or face_b is None: - at_join = False - else: - lo = lateral + max(face_a[0], face_b[0]) - hi = lateral + min(face_a[1], face_b[1]) - for polygon_a in polygons_a: for polygon_b in polygons_b: if at_join: # Sampling a bend can leave sub-tolerance slivers at its shared face. overlap = polygon_a.intersection(polygon_b) - if not overlap.is_empty: + if overlap.area > 0: + port = component_a.end_port + axis, position = (0, port.x) if port.r % 180 == 0 else (1, port.y) bounds = overlap.bounds - if ( - bounds[axis] < normal - TOLERANCE_LINEAR - or bounds[axis + 2] > normal + TOLERANCE_LINEAR - or bounds[1 - axis] < lo - TOLERANCE_LINEAR - or bounds[3 - axis] > hi + TOLERANCE_LINEAR - ): + if bounds[axis] < position - TOLERANCE_LINEAR or bounds[axis + 2] > position + TOLERANCE_LINEAR: return True - elif ( - (polygon_a.intersects(polygon_b) and (prefer_actual or not polygon_a.touches(polygon_b))) - or (clearance and polygon_a.distance(polygon_b) < clearance - TOLERANCE_LINEAR * min(1.0, clearance)) - ): + elif polygon_a.intersects(polygon_b) and not polygon_a.touches(polygon_b): return True return False -def _face_span(component: ComponentResult, *, arrival: bool) -> tuple[float, float] | None: - if component.standard_faces and component.width is not None: - return -component.width / 2, component.width / 2 - face = component.port_faces[int(arrival)] - return (face[0], face[1]) if face is not None else None - - -def invalid_component_join(left: ComponentResult, right: ComponentResult) -> bool: - return not components_join(left, right) or components_overlap(left, right, prefer_actual=True, at_join=True) - - -def count_path_self_collisions(components: Sequence[ComponentResult], clearance: float = 0.0) -> int: - internal_collisions = 0 - for component in components: - for left, right in combinations(component.physical_geometry, 2): - overlap = left.intersection(right) - # A reflected S-bend seam can contain a rounding sliver. - if overlap.area and not overlap.buffer(-TOLERANCE_LINEAR / 2).is_empty: - internal_collisions += 1 +def count_path_self_collisions(components: Sequence[ComponentResult]) -> int: if len(components) < 2: - return internal_collisions + return 0 envelopes = [ component.physical_geometry[0] if len(component.physical_geometry) == 1 else box(*component.total_physical_bounds) for component in components ] index = STRtree(envelopes) - distances = list(accumulate((component.length for component in components), initial=0.0)) if clearance else () - - def envelope_with_clearance(i: int) -> Polygon: - if not clearance: - return envelopes[i] - x0, y0, x1, y1 = components[i].total_physical_bounds - return box(x0 - clearance, y0 - clearance, x1 + clearance, y1 + clearance) - - def spacing(i: int, other: int) -> float: - if not distances or distances[other] - distances[i + 1] < clearance - TOLERANCE_LINEAR: - return 0.0 - if other == i + 2 and components[i + 1].move_type != "straight": - return 0.0 # Keep the geometry local to one continuous bend together. - return clearance - - return internal_collisions + sum( - components_overlap(component, components[other], prefer_actual=True, at_join=other == i + 1, clearance=spacing(i, other)) - for i, component in enumerate(components) - for other in index.query(envelope_with_clearance(i)) + return sum( + components_overlap(component, components[other], prefer_actual=True, at_join=other == i + 1) + for i, (component, envelope) in enumerate(zip(components, envelopes, strict=True)) + for other in index.query(envelope) if other > i ) diff --git a/inire/geometry/components.py b/inire/geometry/components.py index d8e5c45..f2df049 100644 --- a/inire/geometry/components.py +++ b/inire/geometry/components.py @@ -1,12 +1,11 @@ from __future__ import annotations -from dataclasses import dataclass, field, replace +from dataclasses import dataclass, field from itertools import pairwise -from math import asin, ceil, isfinite, pi, radians, sqrt +from math import ceil, pi from typing import TYPE_CHECKING, Literal import numpy -from shapely import get_num_coordinates, snap, transform from shapely.affinity import rotate as shapely_rotate from shapely.affinity import scale as shapely_scale from shapely.affinity import translate as shapely_translate @@ -15,7 +14,7 @@ from shapely.geometry import Polygon, box from inire.constants import TOLERANCE_ANGULAR, TOLERANCE_LINEAR from inire.geometry.sbend import sbend_grid_span, sbend_span from inire.seeds import Bend90Seed, PathSegmentSeed, SBendSeed, StraightSeed -from .primitives import Port, rotate_cardinal, rotation_matrix2 +from .primitives import Port, rotation_matrix2 if TYPE_CHECKING: from collections.abc import Iterable, Sequence @@ -34,79 +33,35 @@ def path_within_board(path: Iterable[ComponentResult], board: Polygon) -> bool: return all(board.covers(shape) for component in path for shape in component.physical_geometry) -PortFace = tuple[float, float, float, float] - - -def _port_face(polygon: Polygon, port: Port, *, arrival: bool) -> PortFace | None: +def _has_port_face(polygon: Polygon, port: Port, *, arrival: bool) -> bool: """Find a centered port face with material on the required side.""" axis = 0 if port.r % 180 == 0 else 1 position = (port.x, port.y) exterior = polygon.exterior coordinates = numpy.asarray(exterior.coords) - normal = coordinates[:, axis] - position[axis] - on_plane = numpy.abs(normal) <= TOLERANCE_LINEAR + on_plane = numpy.abs(coordinates[:, axis] - position[axis]) <= TOLERANCE_LINEAR lateral = coordinates[:, 1 - axis] - position[1 - axis] lower = numpy.minimum(lateral[:-1], lateral[1:]) upper = numpy.maximum(lateral[:-1], lateral[1:]) + at_port = on_plane[:-1] & on_plane[1:] & (lower <= TOLERANCE_LINEAR) & (upper >= -TOLERANCE_LINEAR) # The interior is left of a counterclockwise exterior edge. forward = 1 if port.r < 180 else -1 inward = forward if not arrival else -forward left = (lateral[1:] - lateral[:-1]) * (1 if axis == 1 else -1) interior = left if exterior.is_ccw else -left - edges = numpy.flatnonzero(on_plane[:-1] & on_plane[1:] & (interior * inward > 0)) - intervals = sorted((lower[i], upper[i], min(normal[i:i + 2]), max(normal[i:i + 2])) for i in edges) - spans: list[PortFace] = [] - for lo, hi, near, far in intervals: - if spans and lo <= spans[-1][1]: - prev_lo, prev_hi, prev_near, prev_far = spans[-1] - spans[-1] = prev_lo, max(prev_hi, hi), min(prev_near, near), max(prev_far, far) - else: - spans.append((lo, hi, near, far)) - return next((span for span in spans if span[0] < 0 < span[1]), None) - - -def _face_matches_width(face: PortFace | None, width: float | None) -> bool: - return face is not None and ( - width is None or max(abs(face[0] + width / 2), abs(face[1] - width / 2)) <= TOLERANCE_LINEAR - ) - - -def _has_port_face(polygon: Polygon, port: Port, *, arrival: bool, width: float) -> bool: - return _face_matches_width(_port_face(polygon, port, arrival=arrival), width) - - -def _shares_face(left: Polygon, right: Polygon) -> bool: - if left.intersection(right).length > TOLERANCE_LINEAR: - return True - # Separately transformed outlines can differ by rounding at the shared edge. - snapped = snap(right, left, TOLERANCE_LINEAR) - return snapped.is_valid and left.intersection(snapped).length > TOLERANCE_LINEAR + at_port &= interior * inward > 0 + return bool(numpy.any(at_port & (lower < 0)) and numpy.any(at_port & (upper > 0))) def check_path_geometry(path: Sequence[ComponentResult]) -> tuple[bool, bool]: """Return polygon validity and physical continuity for a path.""" - continuous = True + continuous = all(a.end_port == b.start_port for a, b in pairwise(path)) for component in path: valid, connected = component.physical_checks if not valid: return False, False continuous = continuous and connected - return True, continuous and all(components_join(a, b) for a, b in pairwise(path)) - - -def components_join(left: ComponentResult, right: ComponentResult) -> bool: - if left.end_port != right.start_port: - return False - if left.standard_faces and right.standard_faces: - return True - a, b = left.port_faces[1], right.port_faces[0] - return ( - _face_matches_width(a, left.width) - and _face_matches_width(b, right.width) - and a is not None and b is not None - and min(a[1], b[1]) > max(a[0], b[0]) - and max(abs(a[2] - b[3]), abs(a[3] - b[2])) <= TOLERANCE_LINEAR - ) + return True, continuous def bend_fits_width(radius: float, width: float) -> bool: @@ -122,37 +77,9 @@ def _normalize_length(value: float) -> float: return float(value) -class ComponentPreparationError(ValueError): - """A move cannot safely be materialized.""" - - -def component_endpoint(start: Port, kind: MoveKind, parameters: tuple) -> Port: - if kind == "straight": - forward, lateral, turn = _normalize_length(parameters[0]), 0, 0 - elif kind == "bend90": - radius, direction = parameters - sign = 1 if direction == "CCW" else -1 - forward = bend90_grid_span(radius) - lateral, turn = sign * forward, sign * 90 - else: - lateral, radius = parameters - try: - forward = sbend_grid_span(lateral, radius) - except (ValueError, OverflowError) as exc: - raise ComponentPreparationError("has an unrepresentable S-bend span") from exc - turn = 0 - dx, dy = rotate_cardinal(forward, lateral, int(start.r)) - return start.translate(dx, dy, turn) - - -def check_component_endpoint( - start: Port, kind: MoveKind, parameters: tuple, bounds: tuple[float, float, float, float], -) -> None: - end = component_endpoint(start, kind, parameters) - xmin, ymin, xmax, ymax = bounds - tol = TOLERANCE_LINEAR - if not (xmin - tol <= end.x <= xmax + tol and ymin - tol <= end.y <= ymax + tol): - raise ComponentPreparationError("has an endpoint outside the routing board") +def _advance_port(start: Port, rotation: NDArray[numpy.int32], forward: float, lateral: float = 0.0, turn: int = 0) -> Port: + dx, dy = rotation @ numpy.array((forward, lateral)) + return Port(start.x + dx, start.y + dy, start.r + turn) def _bend90_length(radius: float) -> float: @@ -170,16 +97,12 @@ class ComponentResult: physical_geometry: Sequence[Polygon] dilated_collision_geometry: Sequence[Polygon] dilated_physical_geometry: Sequence[Polygon] - width: float | None = None - standard_faces: bool = False _bounds: tuple[tuple[float, float, float, float], ...] = field(init=False, repr=False) _total_bounds: tuple[float, float, float, float] = field(init=False, repr=False) _dilated_bounds: tuple[tuple[float, float, float, float], ...] = field(init=False, repr=False) _total_dilated_bounds: tuple[float, float, float, float] = field(init=False, repr=False) _total_physical_bounds: tuple[float, float, float, float] | None = field(init=False, repr=False, compare=False, default=None) _physical_checks: tuple[bool, bool] | None = field(init=False, repr=False, compare=False, default=None) - _port_faces: tuple[PortFace | None, PortFace | None] | None = field(init=False, repr=False, compare=False, default=None) - _coordinate_count: int | None = field(init=False, repr=False, compare=False, default=None) def __post_init__(self) -> None: collision_geometry = tuple(self.collision_geometry) @@ -230,31 +153,6 @@ class ComponentResult: def bend_radius(self) -> float | None: return self.move_spec.radius if isinstance(self.move_spec, Bend90Seed) else None - @property - def coordinate_count(self) -> int: - count = self._coordinate_count - if count is None: - polygons = { - id(polygon): polygon - for group in (self.physical_geometry, self.collision_geometry, self.dilated_physical_geometry, self.dilated_collision_geometry) - for polygon in group - } - count = sum(int(get_num_coordinates(polygon)) for polygon in polygons.values()) - object.__setattr__(self, "_coordinate_count", count) - return count - - @property - def port_faces(self) -> tuple[PortFace | None, PortFace | None]: - if self._port_faces is None: - shapes = self.physical_geometry - faces = ( - _port_face(shapes[0], self.start_port, arrival=False), - _port_face(shapes[-1], self.end_port, arrival=True), - ) if shapes else (None, None) - object.__setattr__(self, "_port_faces", faces) - return faces - return self._port_faces - @property def physical_checks(self) -> tuple[bool, bool]: if self._physical_checks is None: @@ -262,8 +160,9 @@ class ComponentResult: valid = bool(shapes) and all(not shape.is_empty and shape.is_valid for shape in shapes) connected = ( valid - and (self.standard_faces or all(_face_matches_width(face, self.width) for face in self.port_faces)) - and all(_shares_face(a, b) for a, b in pairwise(shapes)) + and _has_port_face(shapes[0], self.start_port, arrival=False) + and _has_port_face(shapes[-1], self.end_port, arrival=True) + and all(a.intersection(b).length > TOLERANCE_LINEAR for a, b in pairwise(shapes)) ) object.__setattr__(self, "_physical_checks", (valid, connected)) return valid, connected @@ -271,25 +170,20 @@ class ComponentResult: def translate(self, dx: int | float, dy: int | float) -> ComponentResult: # The collision and physical views often reference the same polygons. - polygons = { - id(polygon): polygon - for geometry in ( - self.collision_geometry, self.physical_geometry, - self.dilated_collision_geometry, self.dilated_physical_geometry, - ) - for polygon in geometry - } - if len(polygons) > 1 and (self.standard_faces or all(not polygon.has_z for polygon in polygons.values())): - offset = numpy.array((dx, dy)) - shifted = transform(list(polygons.values()), lambda coordinates: coordinates + offset) - translated = dict(zip(polygons, shifted, strict=True)) - else: - translated = {key: shapely_translate(polygon, dx, dy) for key, polygon in polygons.items()} + translated: dict[int, Polygon] = {} def translate_geometry(polygons: Sequence[Polygon]) -> tuple[Polygon, ...]: - return tuple(translated[id(polygon)] for polygon in polygons) + geometry = [] + for polygon in polygons: + key = id(polygon) + shifted = translated.get(key) + if shifted is None: + shifted = shapely_translate(polygon, dx, dy) + translated[key] = shifted + geometry.append(shifted) + return tuple(geometry) - result = ComponentResult( + return ComponentResult( start_port=self.start_port.translate(dx, dy), collision_geometry=translate_geometry(self.collision_geometry), end_port=self.end_port.translate(dx, dy), @@ -299,16 +193,10 @@ class ComponentResult: physical_geometry=translate_geometry(self.physical_geometry), dilated_collision_geometry=translate_geometry(self.dilated_collision_geometry), dilated_physical_geometry=translate_geometry(self.dilated_physical_geometry), - width=self.width, - standard_faces=self.standard_faces, ) - object.__setattr__(result, "_coordinate_count", self._coordinate_count) - return result def _combine_bounds(bounds_list: list[tuple[float, float, float, float]]) -> tuple[float, float, float, float]: - if len(bounds_list) == 1: - return bounds_list[0] arr = numpy.asarray(bounds_list, dtype=numpy.float64) return ( float(arr[:, 0].min()), @@ -319,49 +207,14 @@ def _combine_bounds(bounds_list: list[tuple[float, float, float, float]]) -> tup def _get_num_segments(radius: float, angle_deg: float, sagitta: float = 0.01) -> int: - if not isfinite(radius) or not isfinite(angle_deg): - raise ComponentPreparationError("has an unrepresentable circular arc") if radius <= 0: return 1 - if not numpy.isfinite(sagitta) or sagitta <= 0: - raise ValueError("Arc sagitta must be finite and positive") - theta_max = 4 * asin(min(1.0, sqrt(sagitta) / sqrt(radius) / sqrt(2.0))) - subdivisions = radians(abs(angle_deg)) / theta_max - if subdivisions > 250_000: - raise ComponentPreparationError("exceeds 250,000 subdivisions for one circular arc") - return max(8, ceil(subdivisions)) - - -def _arc_samples( - radius: float, width: float, angle: float, sagitta: float, dilation: float, *, sample_dilation: bool, -) -> tuple[int, int | None]: - physical = _get_num_segments(radius + width / 2, angle, sagitta) - dilated = None - if sample_dilation and dilation > 0 and bend_fits_width(radius, width + 2 * dilation): - dilated = _get_num_segments(radius + (width + 2 * dilation) / 2, angle, sagitta) - return physical, dilated - - -def _sbend_angle(offset: float, radius: float) -> float: - return 2 * asin(sqrt(abs(offset) / radius) / 2) - - -def prepare_component_sampling( - kind: MoveKind, parameters: tuple, width: float, *, - collision_type: BendCollisionModel, physical_geometry_type: BendPhysicalGeometry, - dilation: float, sbend_outline: Polygon | None = None, sagitta: float = 0.01, -) -> tuple[int, int | None]: - if kind == "bend90": - radius = parameters[0] - custom_physical = isinstance(physical_geometry_type, Polygon) - if custom_physical and isinstance(collision_type, Polygon): - return 0, None - return _arc_samples(radius, width, 90, sagitta, dilation, sample_dilation=not custom_physical or collision_type == "arc") - if kind == "sbend" and sbend_outline is None: - offset, radius = parameters - angle = float(numpy.degrees(_sbend_angle(offset, radius))) - return _arc_samples(radius, width, angle, sagitta, dilation, sample_dilation=True) - return 0, None + ratio = max(0.0, min(1.0, 1.0 - sagitta / radius)) + theta_max = 2.0 * numpy.arccos(ratio) + if theta_max < TOLERANCE_ANGULAR: + return 16 + num = int(numpy.ceil(numpy.radians(abs(angle_deg)) / theta_max)) + return max(8, num) def _get_arc_polygons( @@ -369,16 +222,18 @@ def _get_arc_polygons( radius: float, width: float, ts: tuple[float, float], - num_segments: int, + sagitta: float = 0.01, dilation: float = 0.0, *, port_faces: tuple[Port, Port] | None = None, ) -> list[Polygon]: t_start, t_end = numpy.radians(ts[0]), numpy.radians(ts[1]) + num_segments = _get_num_segments(radius, abs(ts[1] - ts[0]), sagitta) + angles = numpy.linspace(t_start, t_end, num_segments + 1) + cx, cy = cxy inner_radius = radius - width / 2.0 - dilation outer_radius = radius + width / 2.0 + dilation - angles = numpy.linspace(t_start, t_end, num_segments + 1) cos_a = numpy.cos(angles) sin_a = numpy.sin(angles) @@ -504,7 +359,7 @@ class Straight: ) -> ComponentResult: rot2 = rotation_matrix2(start_port.r) length_f = _normalize_length(length) - end_port = component_endpoint(start_port, "straight", (length_f,)) + end_port = _advance_port(start_port, rot2, length_f) half_w = width / 2.0 pts = numpy.array(((0.0, half_w), (length_f, half_w), (length_f, -half_w), (0.0, -half_w))) @@ -536,8 +391,6 @@ class Straight: physical_geometry=geometry, dilated_collision_geometry=dilated_geometry, dilated_physical_geometry=dilated_geometry, - width=width, - standard_faces=length_f > 0 and length_f.is_integer(), ) @@ -564,40 +417,54 @@ class Bend90: center_local = numpy.array((tangent_length, sign * radius)) center_xy = (rot2 @ center_local) + numpy.array((start_port.x, start_port.y)) center = (float(center_xy[0]), float(center_xy[1])) - end_port = component_endpoint(start_port, "bend90", (radius, direction)) + end_port = _advance_port(start_port, rot2, grid_span, sign * grid_span, sign * 90) start_theta = start_port.r - sign * 90 end_theta = start_port.r ts = (float(start_theta), float(end_theta)) port_faces = (start_port, end_port) - custom_physical = isinstance(physical_geometry_type, Polygon) - segments, dilated_segments = prepare_component_sampling( - "bend90", (radius, direction), width, collision_type=collision_type, - physical_geometry_type=physical_geometry_type, dilation=dilation, sagitta=sagitta, + arc_polys = _get_arc_polygons(center, radius, width, ts, sagitta, port_faces=port_faces) + collision_polys = _apply_collision_model( + arc_polys[0], + collision_type, + radius, + width, + center, + ts, + clip_margin=clip_margin, + rotation_deg=float(start_port.r), + mirror_y=(sign < 0), + tangent_extensions=(tangent_length, tangent_length), ) - arc_polys = [] - if segments: - arc_polys = _get_arc_polygons(center, radius, width, ts, segments, port_faces=port_faces) - if isinstance(collision_type, Polygon): - collision_polys = [_transform_custom_collision_polygon(collision_type, center, float(start_port.r), mirror_y=(sign < 0))] - else: - collision_polys = _apply_collision_model( - arc_polys[0], collision_type, radius, width, center, ts, clip_margin=clip_margin, - rotation_deg=float(start_port.r), mirror_y=(sign < 0), tangent_extensions=(tangent_length, tangent_length), - ) if isinstance(physical_geometry_type, Polygon): - physical_geometry = [_transform_custom_collision_polygon( - physical_geometry_type, center, float(start_port.r), mirror_y=(sign < 0), - )] + physical_geometry = _apply_collision_model( + arc_polys[0], + physical_geometry_type, + radius, + width, + center, + ts, + rotation_deg=float(start_port.r), + mirror_y=(sign < 0), + ) else: physical_geometry = arc_polys dilated_arcs = arc_polys - if dilated_segments is not None: - dilated_arcs = _get_arc_polygons(center, radius, width, ts, dilated_segments, dilation=dilation, port_faces=port_faces) - elif dilation > 0 and (not custom_physical or collision_type == "arc"): - dilated_arcs = _buffer_geometry(arc_polys, dilation) + if dilation > 0 and (physical_geometry is arc_polys or collision_type == "arc"): + if bend_fits_width(radius, width + 2 * dilation): + dilated_arcs = _get_arc_polygons( + center, + radius, + width, + ts, + sagitta, + dilation=dilation, + port_faces=port_faces, + ) + else: + dilated_arcs = _buffer_geometry(arc_polys, dilation) dilated_physical_geometry = dilated_arcs if physical_geometry is arc_polys else _buffer_geometry(physical_geometry, dilation) dilated_collision_geometry = dilated_arcs if collision_type == "arc" else _buffer_geometry(collision_polys, dilation) @@ -611,8 +478,6 @@ class Bend90: physical_geometry=physical_geometry, dilated_collision_geometry=dilated_collision_geometry, dilated_physical_geometry=dilated_physical_geometry, - width=width, - standard_faces=physical_geometry is arc_polys, ) @@ -627,12 +492,12 @@ class SBend: span: float, grid_span: int, width: float, - num_segments: int, + sagitta: float, ) -> list[Polygon]: # Reflect the first arc about the midpoint and reverse it to get the # second arc. Reuse the midpoint and its normal for both polygons. sign = 1 if offset > 0 else -1 - angles = numpy.linspace(0, theta, num_segments + 1) + angles = numpy.linspace(0, theta, _get_num_segments(radius, float(numpy.degrees(theta)), sagitta) + 1) sin, cos = numpy.sin(angles), numpy.cos(angles) first = numpy.column_stack((radius * sin, sign * radius * (1 - cos))) first[-1] = (span / 2, offset / 2) @@ -663,8 +528,8 @@ class SBend: radius: float, width: float, sagitta: float = 0.01, - collision_type: BendCollisionModelName = "arc", - outline: Polygon | None = None, + collision_type: BendCollisionModel = "arc", + physical_geometry_type: BendPhysicalGeometry = "arc", clip_margin: float | None = None, dilation: float = 0.0, ) -> ComponentResult: @@ -674,52 +539,87 @@ class SBend: raise ValueError("Bend radius must be at least half the net width") sign = 1 if offset >= 0 else -1 - theta = _sbend_angle(offset, radius) - end_port = component_endpoint(start_port, "sbend", (offset, radius)) + theta = numpy.arccos(1.0 - abs(offset) / (2.0 * radius)) dx = sbend_span(offset, radius) grid_span = sbend_grid_span(offset, radius) tail = grid_span - dx - rot2 = rotation_matrix2(start_port.r) + theta_deg = float(numpy.degrees(theta)) - if outline is not None: - physical = _transform_custom_collision_polygon(outline, (start_port.x, start_port.y), start_port.r, mirror_y=False) - physical_geometry = geometry = [physical] - dilated_physical_geometry = dilated_collision_geometry = _buffer_geometry(physical_geometry, dilation) + rot2 = rotation_matrix2(start_port.r) + end_port = _advance_port(start_port, rot2, grid_span, offset) + + c1_local = numpy.array((0.0, sign * radius)) + c2_local = numpy.array((dx, offset - sign * radius)) + c1_xy = (rot2 @ c1_local) + numpy.array((start_port.x, start_port.y)) + c2_xy = (rot2 @ c2_local) + numpy.array((start_port.x, start_port.y)) + + ts1 = (float(start_port.r - sign * 90), float(start_port.r - sign * 90 + sign * theta_deg)) + second_base = start_port.r + (90 if sign > 0 else 270) + ts2 = (float(second_base + sign * theta_deg), float(second_base)) + + actual_geometry = SBend._arcs(start_port, rot2, radius, offset, theta, dx, grid_span, width, sagitta) + arc1, arc2 = actual_geometry + geometry = [ + _apply_collision_model( + arc1, + collision_type, + radius, + width, + (float(c1_xy[0]), float(c1_xy[1])), + ts1, + clip_margin=clip_margin, + rotation_deg=float(start_port.r), + mirror_y=(sign < 0), + )[0], + _apply_collision_model( + arc2, + collision_type, + radius, + width, + (float(c2_xy[0]), float(c2_xy[1])), + ts2, + clip_margin=clip_margin, + rotation_deg=float(start_port.r), + mirror_y=(sign > 0), + tangent_extensions=(0, tail if tail > TOLERANCE_LINEAR else 0), + )[0], + ] + + if isinstance(physical_geometry_type, Polygon): + physical_geometry = [ + _apply_collision_model( + arc1, + physical_geometry_type, + radius, + width, + (float(c1_xy[0]), float(c1_xy[1])), + ts1, + rotation_deg=float(start_port.r), + mirror_y=(sign < 0), + )[0], + _apply_collision_model( + arc2, + physical_geometry_type, + radius, + width, + (float(c2_xy[0]), float(c2_xy[1])), + ts2, + rotation_deg=float(start_port.r), + mirror_y=(sign > 0), + )[0], + ] else: - theta_deg = float(numpy.degrees(theta)) - segments, dilated_segments = prepare_component_sampling( - "sbend", (offset, radius), width, collision_type=collision_type, - physical_geometry_type="arc", dilation=dilation, sagitta=sagitta, - ) - physical_geometry = SBend._arcs(start_port, rot2, radius, offset, theta, dx, grid_span, width, segments) - if dilated_segments is not None: - dilated_physical_geometry = SBend._arcs( - start_port, rot2, radius, offset, theta, dx, grid_span, width + 2 * dilation, dilated_segments, + physical_geometry = actual_geometry + dilated_arcs = actual_geometry + if dilation > 0 and (physical_geometry is actual_geometry or collision_type == "arc"): + if bend_fits_width(radius, width + 2 * dilation): + dilated_arcs = SBend._arcs( + start_port, rot2, radius, offset, theta, dx, grid_span, width + 2 * dilation, sagitta, ) else: - dilated_physical_geometry = _buffer_geometry(physical_geometry, dilation) - if collision_type == "arc": - geometry, dilated_collision_geometry = physical_geometry, dilated_physical_geometry - else: - if not isinstance(collision_type, str): - raise TypeError("Custom S-bend geometry requires a complete outline") - origin = numpy.array((start_port.x, start_port.y)) - center1 = rot2 @ numpy.array((0.0, sign * radius)) + origin - center2 = rot2 @ numpy.array((dx, offset - sign * radius)) + origin - center1_xy = (float(center1[0]), float(center1[1])) - center2_xy = (float(center2[0]), float(center2[1])) - ts1 = (float(start_port.r - sign * 90), float(start_port.r - sign * 90 + sign * theta_deg)) - second_base = start_port.r + (90 if sign > 0 else 270) - ts2 = (float(second_base + sign * theta_deg), float(second_base)) - arc1, arc2 = physical_geometry - geometry = [ - _apply_collision_model(arc1, collision_type, radius, width, center1_xy, ts1, clip_margin=clip_margin)[0], - _apply_collision_model( - arc2, collision_type, radius, width, center2_xy, ts2, clip_margin=clip_margin, - tangent_extensions=(0, tail if tail > TOLERANCE_LINEAR else 0), - )[0], - ] - dilated_collision_geometry = _buffer_geometry(geometry, dilation) + dilated_arcs = _buffer_geometry(actual_geometry, dilation) + dilated_physical_geometry = dilated_arcs if physical_geometry is actual_geometry else _buffer_geometry(physical_geometry, dilation) + dilated_collision_geometry = dilated_arcs if collision_type == "arc" else _buffer_geometry(geometry, dilation) return ComponentResult( start_port=start_port, @@ -731,8 +631,6 @@ class SBend: physical_geometry=physical_geometry, dilated_collision_geometry=dilated_collision_geometry, dilated_physical_geometry=dilated_physical_geometry, - width=width, - standard_faces=outline is None, ) @@ -746,23 +644,15 @@ def build_component( physical_geometry_type: BendPhysicalGeometry, clip_margin: float | None, dilation: float, - sbend_outline: Polygon | None = None, - physical_length: float | None = None, - bounds: tuple[float, float, float, float] | None = None, ) -> ComponentResult: - if bounds is not None: - check_component_endpoint(start, kind, parameters, bounds) if kind == "straight": return Straight.generate(start, parameters[0], width, dilation=dilation) if kind == "bend90": - component = Bend90.generate( + return Bend90.generate( start, parameters[0], width, parameters[1], collision_type=collision_type, physical_geometry_type=physical_geometry_type, clip_margin=clip_margin, dilation=dilation, ) - else: - component = SBend.generate( - start, parameters[0], parameters[1], width, - collision_type="arc" if isinstance(collision_type, Polygon) else collision_type, - outline=sbend_outline, clip_margin=clip_margin, dilation=dilation, - ) - return replace(component, length=physical_length) if physical_length is not None else component + return SBend.generate( + start, parameters[0], parameters[1], width, + collision_type=collision_type, physical_geometry_type=physical_geometry_type, clip_margin=clip_margin, dilation=dilation, + ) diff --git a/inire/geometry/dynamic_path_index.py b/inire/geometry/dynamic_path_index.py index 52618de..7ba78a6 100644 --- a/inire/geometry/dynamic_path_index.py +++ b/inire/geometry/dynamic_path_index.py @@ -4,19 +4,16 @@ from typing import TYPE_CHECKING import rtree -from inire.geometry.index_helpers import grid_cell_count, grid_cell_span, iter_grid_cells +from inire.geometry.index_helpers import iter_grid_cells if TYPE_CHECKING: - from collections.abc import Iterator, Sequence + from collections.abc import Sequence from shapely.geometry import Polygon from inire.geometry.collision import RoutingWorld -_MAX_GRID_CELLS = 1024 - - class DynamicPathIndex: """Index search proxies and physical polygons for installed paths.""" @@ -108,16 +105,13 @@ class DynamicPathIndex: *, cell_size: float, ) -> None: - span = grid_cell_span(bounds, cell_size) - if grid_cell_count(span) > _MAX_GRID_CELLS: - return - cells = tuple(iter_grid_cells(span)) + 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) def _unregister_grid_membership(self, obj_id: int, net_id: str) -> None: - for cell in self.obj_cells.pop(obj_id, ()): + 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) @@ -126,16 +120,7 @@ class DynamicPathIndex: if not net_obj_ids: del self.grid_net_obj_ids[cell] - def uses_tree_for_span(self, span: tuple[int, int, int, int]) -> bool: - return len(self.obj_cells) != len(self.dilated) or grid_cell_count(span) > _MAX_GRID_CELLS - - def tree_candidates(self, net_id: str, bounds: tuple[float, float, float, float]) -> Iterator[tuple[str, int]]: - for obj_id in self.index.intersection(bounds): - other_net_id = self.geometries[obj_id][0] - if other_net_id != net_id: - yield other_net_id, obj_id - - def add_path_geometry( + def add_path( self, net_id: str, geometry: Sequence[Polygon], diff --git a/inire/geometry/index_helpers.py b/inire/geometry/index_helpers.py index fc86b68..201dafe 100644 --- a/inire/geometry/index_helpers.py +++ b/inire/geometry/index_helpers.py @@ -4,21 +4,12 @@ import math from typing import TYPE_CHECKING import numpy -from shapely import get_precision, set_precision if TYPE_CHECKING: from collections.abc import Iterator, Mapping - from shapely.geometry import Polygon from shapely.geometry.base import BaseGeometry -def floating_polygon(polygon: Polygon) -> Polygon: - """Clear the GEOS precision model without moving any vertices.""" - if get_precision(polygon): - return set_precision(polygon, 0, mode="pointwise") - return polygon - - def build_index_payload( geometries: Mapping[int, BaseGeometry], ) -> tuple[list[int], list[BaseGeometry], numpy.ndarray]: @@ -42,13 +33,11 @@ def grid_cell_span( ) -def grid_cell_count(span: tuple[int, int, int, int]) -> int: - gx_min, gy_min, gx_max, gy_max = span - return (gx_max - gx_min + 1) * (gy_max - gy_min + 1) - - -def iter_grid_cells(span: tuple[int, int, int, int]) -> Iterator[tuple[int, int]]: - gx_min, gy_min, gx_max, gy_max = span +def iter_grid_cells( + bounds: tuple[float, float, float, float], + cell_size: float, +) -> Iterator[tuple[int, int]]: + gx_min, gy_min, gx_max, gy_max = grid_cell_span(bounds, cell_size) for gx in range(gx_min, gx_max + 1): for gy in range(gy_min, gy_max + 1): yield (gx, gy) diff --git a/inire/geometry/sbend.py b/inire/geometry/sbend.py index fa61f48..11448e3 100644 --- a/inire/geometry/sbend.py +++ b/inire/geometry/sbend.py @@ -1,16 +1,13 @@ """S-bend dimensions on the routing grid.""" -from math import ceil, isfinite, isqrt, sqrt +from math import ceil, isqrt, sqrt from inire.constants import TOLERANCE_LINEAR def sbend_span(offset: float, radius: float) -> float: offset = abs(offset) - squared = offset * (4 * radius - offset) - if isfinite(squared): - return sqrt(squared) - return sqrt(offset) * sqrt(radius) * sqrt(4 - offset / radius) + return sqrt(offset * (4 * radius - offset)) def sbend_grid_span(offset: float, radius: float) -> int: diff --git a/inire/geometry/static_obstacle_index.py b/inire/geometry/static_obstacle_index.py index 99fd153..2a9cea4 100644 --- a/inire/geometry/static_obstacle_index.py +++ b/inire/geometry/static_obstacle_index.py @@ -7,7 +7,7 @@ import rtree from shapely.strtree import STRtree from inire.constants import TOLERANCE_LINEAR -from inire.geometry.index_helpers import build_index_payload, floating_polygon, is_axis_aligned_rect +from inire.geometry.index_helpers import build_index_payload, is_axis_aligned_rect if TYPE_CHECKING: from shapely.geometry import Polygon @@ -27,9 +27,9 @@ class StaticObstacleIndex: "bounds_array", "is_rect_array", "raw_tree", - "raw_owners", - "owners", "net_specific_trees", + "net_specific_is_rect", + "net_specific_bounds", "ray_cast_cache", "id_counter", "version", @@ -46,26 +46,23 @@ class StaticObstacleIndex: self.bounds_array: numpy.ndarray | None = None self.is_rect_array: numpy.ndarray | None = None self.raw_tree: STRtree | None = None - self.raw_owners: tuple[str | None, ...] = () - self.owners: dict[int, str] = {} - self.net_specific_trees: dict[tuple[float, float], tuple[STRtree, numpy.ndarray, numpy.ndarray]] = {} + self.net_specific_trees: dict[tuple[float, float], STRtree] = {} + self.net_specific_is_rect: dict[tuple[float, float], numpy.ndarray] = {} + self.net_specific_bounds: dict[tuple[float, float], numpy.ndarray] = {} self.ray_cast_cache: dict[tuple[float, float, float, float, float | None, float, type, type, type, type], float] = {} self.id_counter = 0 self.version = 0 - def add_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None, *, owner: str | None = None) -> int: + def add_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None) -> int: obj_id = self.id_counter self.id_counter += 1 - polygon = floating_polygon(polygon) if dilated_geometry is not None: - dilated = floating_polygon(dilated_geometry) + dilated = dilated_geometry else: dilated = polygon.buffer(self.engine.clearance / 2.0, join_style="mitre") self.geometries[obj_id] = polygon - if owner is not None: - self.owners[obj_id] = owner self.dilated[obj_id] = dilated self.is_rect[obj_id] = is_axis_aligned_rect(dilated) self.index.insert(obj_id, dilated.bounds) @@ -79,7 +76,6 @@ class StaticObstacleIndex: bounds = self.dilated[obj_id].bounds self.index.delete(obj_id, bounds) del self.geometries[obj_id] - self.owners.pop(obj_id, None) del self.dilated[obj_id] del self.is_rect[obj_id] self.invalidate_caches() @@ -90,8 +86,9 @@ class StaticObstacleIndex: self.is_rect_array = None self.obj_ids = [] self.raw_tree = None - self.raw_owners = () self.net_specific_trees.clear() + self.net_specific_is_rect.clear() + self.net_specific_bounds.clear() self.ray_cast_cache.clear() self.version += 1 @@ -103,15 +100,14 @@ class StaticObstacleIndex: self.tree = STRtree(geometries) self.is_rect_array = numpy.array([self.is_rect[i] for i in self.obj_ids]) - def ensure_net_tree(self, net_width: float) -> tuple[STRtree, numpy.ndarray, numpy.ndarray]: - width, clearance = float(net_width), float(self.engine.clearance) - key = (width, clearance) + def ensure_net_tree(self, net_width: float) -> STRtree: + key = (round(net_width, 4), round(self.engine.clearance, 4)) if key in self.net_specific_trees: return self.net_specific_trees[key] if self.engine.metrics is not None: self.engine.metrics.total_static_net_tree_rebuilds += 1 - total_dilation = width / 2.0 + clearance + total_dilation = net_width / 2.0 + self.engine.clearance # A ray grazing the clearance boundary can still place a legal straight. total_dilation -= TOLERANCE_LINEAR * min(1.0, total_dilation) geometries = [] @@ -125,13 +121,14 @@ class StaticObstacleIndex: bounds_list.append(dilated.bounds) is_rect_list.append(is_axis_aligned_rect(dilated)) - payload = (STRtree(geometries), numpy.array(is_rect_list, dtype=bool), numpy.array(bounds_list, dtype=numpy.float64)) - self.net_specific_trees[key] = payload - return payload + tree = STRtree(geometries) + self.net_specific_trees[key] = tree + self.net_specific_is_rect[key] = numpy.array(is_rect_list, dtype=bool) + self.net_specific_bounds[key] = numpy.array(bounds_list, dtype=numpy.float64) + return tree def ensure_raw_tree(self) -> None: if self.raw_tree is None and self.geometries: if self.engine.metrics is not None: self.engine.metrics.total_static_raw_tree_rebuilds += 1 self.raw_tree = STRtree(list(self.geometries.values())) - self.raw_owners = tuple(self.owners.get(key) for key in self.geometries) diff --git a/inire/layout.py b/inire/layout.py deleted file mode 100644 index 9ba8b03..0000000 --- a/inire/layout.py +++ /dev/null @@ -1,80 +0,0 @@ -"""Routing helpers for placed ports, authored lengths, and process profiles.""" - -from __future__ import annotations - -from dataclasses import dataclass, replace -from math import fsum, isfinite -from typing import TYPE_CHECKING - -from inire import route -from inire.constants import TOLERANCE_LINEAR -from inire.model import FixedRoute, NetSpec - -if TYPE_CHECKING: - from collections.abc import Iterable - - from inire.geometry.primitives import Port - from inire.model import RoutingOptions, RoutingProblem - from inire.results import RoutingResult - - -@dataclass(frozen=True, slots=True) -class PlacedPort: - port: Port - width: float - - def __post_init__(self) -> None: - if not isfinite(self.width) or self.width <= 0: - raise ValueError("Placed port width must be finite and positive") - - def connect(self, net_id: str, target: PlacedPort) -> NetSpec: - if abs(self.width - target.width) > TOLERANCE_LINEAR: - raise ValueError(f"Net {net_id!r} joins widths {self.width:g} and {target.width:g}; place a transition first") - return NetSpec(net_id, self.port, target.port, self.width) - - -def preserves_length(result: RoutingResult, authored_length: float, tolerance: float) -> bool: - """Check the recorded length of a verified replacement against an authored length.""" - if not isfinite(authored_length) or authored_length <= 0 or not isfinite(tolerance) or tolerance < 0: - raise ValueError("Authored length must be finite and positive and tolerance finite and nonnegative") - return result.is_valid and abs(fsum(component.length for component in result.path) - authored_length) <= tolerance - - -def partition_layers(nets_with_layers: Iterable[tuple[tuple[int, int], NetSpec]]) -> dict[tuple[int, int], tuple[NetSpec, ...]]: - """Group nets by layout layer and datatype while retaining their input order.""" - layers: dict[tuple[int, int], list[NetSpec]] = {} - seen = set() - for layer, net in nets_with_layers: - if net.net_id in seen: - raise ValueError(f"Duplicate net ID across layout layers: {net.net_id!r}") - seen.add(net.net_id) - layers.setdefault(layer, []).append(net) - return {layer: tuple(nets) for layer, nets in layers.items()} - - -def route_profiles( - problem: RoutingProblem, - profiles: Iterable[tuple[Iterable[str], RoutingOptions]], -) -> dict[str, RoutingResult]: - """Route each group on the same layer and reserve earlier verified geometry.""" - groups = tuple((tuple(net_ids), options) for net_ids, options in profiles) - net_by_id = {net.net_id: net for net in problem.nets} - assigned = [net_id for net_ids, _ in groups for net_id in net_ids] - if len(set(assigned)) != len(assigned) or set(assigned) != net_by_id.keys(): - raise ValueError("Process profiles must assign every net to exactly one group") - if unknown := problem.initial_paths.keys() - net_by_id.keys(): - raise ValueError(f"Initial paths provided for unknown nets: {', '.join(sorted(unknown))}") - - results: dict[str, RoutingResult] = {} - reservations: list[FixedRoute] = [] - for net_ids, options in groups: - grouped = replace( - problem, - nets=tuple(net_by_id[net_id] for net_id in net_ids), - initial_paths={net_id: problem.initial_paths[net_id] for net_id in net_ids if net_id in problem.initial_paths}, - fixed_routes=problem.fixed_routes + tuple(reservations), - ) - current = route(grouped, options=options).results_by_net - results.update(current) - reservations.extend(FixedRoute.from_result(result) for result in current.values() if result.is_valid) - return {net_id: results[net_id] for net_id in net_by_id} diff --git a/inire/model.py b/inire/model.py index 913620c..36fbd14 100644 --- a/inire/model.py +++ b/inire/model.py @@ -2,45 +2,21 @@ from __future__ import annotations import warnings from dataclasses import dataclass, field -from math import isclose, isfinite -from numbers import Integral +from math import isfinite from typing import TYPE_CHECKING, Literal from shapely.geometry import Polygon - -from inire._snapshot import snapshot -from inire.geometry.components import _has_port_face, bend_fits_width -from inire.geometry.index_helpers import floating_polygon -from inire.geometry.primitives import Port -from inire.geometry.sbend import sbend_grid_span from inire.seeds import Bend90Seed, PathSeed, SBendSeed if TYPE_CHECKING: - from collections.abc import Iterable, Iterator, Mapping - from inire.geometry.components import BendCollisionModel, BendPhysicalGeometry - from inire.results import RoutingResult + from inire.geometry.primitives import Port NetOrder = Literal["user", "shortest", "longest"] VisibilityGuidance = Literal["off", "exact_corner", "tangent_corner"] -def _require_budget(name: str, value: int, *, minimum: int = 0) -> None: - if isinstance(value, bool) or not isinstance(value, Integral) or value < minimum: - description = "positive" if minimum else "nonnegative" - raise ValueError(f"{name} must be a {description} integer") - - -def _require_nonnegative(name: str, value: float) -> None: - if not isfinite(value) or value < 0: - raise ValueError(f"{name} must be finite and nonnegative") - - -def _outline_width_matches(left: float, right: float) -> bool: - return isclose(left, right, rel_tol=1e-12) - - @dataclass(frozen=True, slots=True) class NetSpec: net_id: str @@ -49,8 +25,6 @@ class NetSpec: width: float = 2.0 def __post_init__(self) -> None: - if not isinstance(self.net_id, str): - raise TypeError(f"Net ID must be a string, got {self.net_id!r}") if not isfinite(self.width) or self.width <= 0: raise ValueError(f"Net {self.net_id!r} width must be finite and positive") @@ -62,37 +36,6 @@ class ObjectiveWeights: sbend_penalty: float = 500.0 danger_weight: float = 1.0 - def __post_init__(self) -> None: - for name in ("unit_length_cost", "bend_penalty", "sbend_penalty", "danger_weight"): - _require_nonnegative(name, getattr(self, name)) - - -@dataclass(frozen=True, slots=True) -class SBendOutline: - """Complete S-bend polygon in the frame of an east-facing input port at the origin.""" - - offset: float - radius: float - width: float - polygon: Polygon - length: float | None = None - - def __post_init__(self) -> None: - seed = SBendSeed(self.offset, self.radius) - if not isfinite(self.width) or self.width <= 0 or not bend_fits_width(seed.radius, self.width): - raise ValueError("S-bend outline needs a finite positive width no greater than twice its radius") - if self.length is not None and (not isfinite(self.length) or self.length <= 0): - raise ValueError("S-bend outline length must be finite and positive") - if not isinstance(self.polygon, Polygon) or self.polygon.is_empty or not self.polygon.is_valid: - raise ValueError("S-bend outline must be a valid, nonempty Polygon") - end = Port(sbend_grid_span(seed.offset, seed.radius), seed.offset, 0) - if not _has_port_face(self.polygon, Port(0, 0, 0), arrival=False, width=self.width) or not _has_port_face( - self.polygon, end, arrival=True, width=self.width, - ): - raise ValueError(f"S-bend outline needs east-facing port faces of width {self.width} at (0, 0) and ({end.x}, {end.y})") - object.__setattr__(self, "offset", seed.offset) - object.__setattr__(self, "radius", seed.radius) - @dataclass(frozen=True, slots=True) class SearchOptions: @@ -108,23 +51,8 @@ class SearchOptions: bend_physical_geometry: BendPhysicalGeometry | None = None bend_clip_margin: float | None = None visibility_guidance: VisibilityGuidance = "tangent_corner" - sbend_outlines: tuple[SBendOutline, ...] = () - proximity_range: float = 10.0 - bend_physical_length: float | None = None - distance_heuristic_weight: float = 1.0 def __post_init__(self) -> None: - _require_budget("node_limit", self.node_limit) - _require_nonnegative("greedy_h_weight", self.greedy_h_weight) - _require_nonnegative("distance_heuristic_weight", self.distance_heuristic_weight) - if not isfinite(self.proximity_range) or self.proximity_range <= 0: - raise ValueError("proximity_range must be finite and positive") - if self.bend_physical_length is not None: - _, physical = resolve_bend_geometry(self) - if physical == "arc" or not isfinite(self.bend_physical_length) or self.bend_physical_length <= 0: - raise ValueError("bend_physical_length needs custom physical geometry and a finite positive length") - if self.visibility_guidance not in ("off", "exact_corner", "tangent_corner"): - raise ValueError(f"Unknown visibility_guidance: {self.visibility_guidance!r}") for field_name in ("bend_radii", "sbend_radii"): radii = tuple(getattr(self, field_name)) if any(not isfinite(radius) or radius <= 0 for radius in radii): @@ -139,19 +67,6 @@ class SearchOptions: if any(not isfinite(offset) for offset in offsets): raise ValueError("S-bend offsets must be finite") object.__setattr__(self, "sbend_offsets", tuple(round(offset) for offset in offsets)) - outlines = tuple(self.sbend_outlines) - outline_widths: dict[tuple[float, float], list[float]] = {} - for outline in outlines: - if not isinstance(outline, SBendOutline): - raise TypeError("sbend_outlines must contain SBendOutline entries") - if outline.radius not in self.sbend_radii or not self.allows_sbend_offset(outline.offset): - raise ValueError("S-bend outline must use a configured radius and offset") - key = outline.offset, outline.radius - widths = outline_widths.setdefault(key, []) - if any(_outline_width_matches(width, outline.width) for width in widths): - raise ValueError(f"Duplicate S-bend outline for offset {outline.offset}, radius {outline.radius}, width {outline.width}") - widths.append(outline.width) - object.__setattr__(self, "sbend_outlines", outlines) for geometry in (self.bend_collision_type, self.bend_proxy_geometry, self.bend_physical_geometry): if isinstance(geometry, Polygon) and (geometry.is_empty or not geometry.is_valid): raise ValueError("Custom bend geometry must be a valid, nonempty polygon") @@ -164,22 +79,6 @@ class SearchOptions: def allows_sbend_offset(self, offset: float) -> bool: return self.sbend_offsets is None or offset in self.sbend_offsets - def sbend_outlines_for_width(self, width: float) -> Iterator[SBendOutline]: - return (outline for outline in self.sbend_outlines if _outline_width_matches(outline.width, width)) - - def has_applicable_sbend_outline(self, widths: Iterable[float]) -> bool: - return bool(self.sbend_outlines) and any(next(self.sbend_outlines_for_width(width), None) is not None for width in widths) - - def sbend_template(self, offset: float, radius: float, width: float) -> SBendOutline | None: - matches = [outline for outline in self.sbend_outlines_for_width(width) if (outline.offset, outline.radius) == (offset, radius)] - if len(matches) > 1: - raise ValueError(f"Ambiguous S-bend outlines for offset {offset}, radius {radius}, width {width}") - return matches[0] if matches else None - - def sbend_outline(self, offset: float, radius: float, width: float) -> Polygon | None: - template = self.sbend_template(offset, radius, width) - return template.polygon if template is not None else None - def seed_geometry_error(self, seed: PathSeed) -> str | None: for segment in seed.segments: if isinstance(segment, Bend90Seed) and segment.radius not in self.bend_radii: @@ -228,13 +127,6 @@ class CongestionOptions: shuffle_nets: bool = False seed: int | None = None - def __post_init__(self) -> None: - _require_budget("max_iterations", self.max_iterations) - _require_nonnegative("base_penalty", self.base_penalty) - _require_nonnegative("multiplier", self.multiplier) - if self.net_order not in ("user", "shortest", "longest"): - raise ValueError(f"Unknown net_order: {self.net_order!r}") - @dataclass(frozen=True, slots=True) class RefinementOptions: @@ -270,10 +162,12 @@ class TopologyOptions: def __post_init__(self) -> None: if self.mode not in ("off", "guide", "seed", "bundle", "automatic"): raise ValueError(f"Unknown topology mode: {self.mode!r}") - _require_budget("max_corridors", self.max_corridors, minimum=1) + if not isinstance(self.max_corridors, int) or self.max_corridors < 1: + raise ValueError("max_corridors must be a positive integer") if not isfinite(self.guide_strength) or self.guide_strength < 0: raise ValueError("guide_strength must be finite and nonnegative") - _require_budget("seed_node_limit", self.seed_node_limit, minimum=1) + if not isinstance(self.seed_node_limit, int) or self.seed_node_limit < 1: + raise ValueError("seed_node_limit must be a positive integer") if self.automatic_cost not in ("selective", "always", "never"): raise ValueError(f"Unknown automatic cost policy: {self.automatic_cost!r}") if self.automatic_length_weights is not None: @@ -293,42 +187,14 @@ class RoutingOptions: topology: TopologyOptions = field(default_factory=TopologyOptions) -@dataclass(frozen=True, slots=True) -class FixedRoute: - """Physical polygons belonging to a completed or imported net.""" - - net_id: str - polygons: tuple[Polygon, ...] - - def __post_init__(self) -> None: - if not isinstance(self.net_id, str): - raise TypeError("Fixed route ID must be a string") - polygons = tuple(self.polygons) - if not polygons or any(not isinstance(shape, Polygon) or shape.is_empty or not shape.is_valid for shape in polygons): - raise ValueError("Fixed routes require nonempty, valid Polygon geometry") - object.__setattr__(self, "polygons", tuple(floating_polygon(polygon) for polygon in polygons)) - - @classmethod - def from_result(cls, result: RoutingResult) -> FixedRoute: - if not result.is_valid: - raise ValueError(f"Fixed route {result.net_id!r} must be completed and verified") - return cls(result.net_id, result.locked_geometry) - - @dataclass(frozen=True, slots=True) class RoutingProblem: bounds: tuple[float, float, float, float] nets: tuple[NetSpec, ...] = () static_obstacles: tuple[Polygon, ...] = () - initial_paths: Mapping[str, PathSeed] = field(default_factory=dict) + initial_paths: dict[str, PathSeed] = field(default_factory=dict) clearance: float = 2.0 safety_zone_radius: float = 0.0021 - self_clearance: float = 0.0 - fixed_routes: tuple[FixedRoute, ...] = () - - @property - def _blocking_polygons(self) -> tuple[Polygon, ...]: - return self.static_obstacles + tuple(shape for route in self.fixed_routes for shape in route.polygons) def __post_init__(self) -> None: bounds = tuple(self.bounds) @@ -336,7 +202,6 @@ class RoutingProblem: raise ValueError("Routing bounds must be finite with minimums below maximums") if not isfinite(self.clearance) or self.clearance < 0: raise ValueError("Routing clearance must be finite and nonnegative") - _require_nonnegative("self_clearance", self.self_clearance) object.__setattr__(self, "bounds", bounds) nets = tuple(self.nets) seen: set[str] = set() @@ -345,22 +210,14 @@ class RoutingProblem: raise ValueError(f"Duplicate net ID: {net.net_id!r}") seen.add(net.net_id) object.__setattr__(self, "nets", nets) - fixed_routes = tuple(self.fixed_routes) - for fixed in fixed_routes: - if not isinstance(fixed, FixedRoute): - raise TypeError("fixed_routes must contain FixedRoute entries") - if fixed.net_id in seen: - raise ValueError(f"Duplicate active or fixed net ID: {fixed.net_id!r}") - seen.add(fixed.net_id) - object.__setattr__(self, "fixed_routes", fixed_routes) obstacles = tuple(self.static_obstacles) for index, obstacle in enumerate(obstacles): if not isinstance(obstacle, Polygon): raise TypeError(f"static_obstacles[{index}] must be a Shapely Polygon") if obstacle.is_empty or not obstacle.is_valid: raise ValueError(f"static_obstacles[{index}] must be nonempty and valid") - object.__setattr__(self, "static_obstacles", tuple(floating_polygon(obstacle) for obstacle in obstacles)) - initial_paths = snapshot(self.initial_paths) + object.__setattr__(self, "static_obstacles", obstacles) + initial_paths = dict(self.initial_paths) if any(not isinstance(seed, PathSeed) for seed in initial_paths.values()): raise TypeError("RoutingProblem.initial_paths values must be PathSeed instances") object.__setattr__( diff --git a/inire/results.py b/inire/results.py index d809f05..56233f3 100644 --- a/inire/results.py +++ b/inire/results.py @@ -3,16 +3,14 @@ from __future__ import annotations from dataclasses import dataclass, field, fields from typing import TYPE_CHECKING, Literal -from inire._snapshot import snapshot from inire.seeds import PathSeed if TYPE_CHECKING: - from collections.abc import Iterable, Mapping + from collections.abc import Iterable from shapely.geometry import Polygon from inire.geometry.components import ComponentResult - from inire.model import NetSpec RoutingOutcome = Literal["completed", "colliding", "partial", "unroutable"] @@ -29,23 +27,17 @@ class RoutingReport: out_of_bounds: bool = False discontinuous: bool = False invalid_geometry: bool = False - seed_error: str | None = None - terminal_error: str | None = None @property - def intrinsic_collision_count(self) -> int: + def collision_count(self) -> int: return ( - self.static_collision_count + self.self_collision_count + self.static_collision_count + self.dynamic_collision_count + self.self_collision_count + int(self.out_of_bounds) + int(self.discontinuous) + int(self.invalid_geometry) ) - @property - def collision_count(self) -> int: - return self.intrinsic_collision_count + self.dynamic_collision_count - @property def is_valid(self) -> bool: - return self.collision_count == 0 and self.terminal_error is None + return self.collision_count == 0 @dataclass(frozen=True, slots=True) @@ -156,8 +148,6 @@ class RouteMetrics: warm_start_paths_used: int refine_path_calls: int timeout_events: int - frontier_trim_events: int - frontier_nodes_discarded: int iteration_reverify_calls: int iteration_reverified_nets: int iteration_conflicting_nets: int @@ -263,8 +253,6 @@ class RoutingResult: path: tuple[ComponentResult, ...] reached_target: bool = False report: RoutingReport = field(default_factory=RoutingReport) - requested_net: NetSpec | None = field(default=None, kw_only=True, compare=False) - effective_net: NetSpec | None = field(default=None, kw_only=True, compare=False) def __post_init__(self) -> None: object.__setattr__(self, "path", tuple(self.path)) @@ -279,7 +267,7 @@ class RoutingResult: return "unroutable" if not self.reached_target: return "partial" - if not self.report.is_valid: + if self.report.collision_count > 0: return "colliding" return "completed" @@ -382,7 +370,7 @@ class AutomaticRoutingReport: @dataclass(frozen=True, slots=True) class RoutingRunResult: - results_by_net: Mapping[str, RoutingResult] + results_by_net: dict[str, RoutingResult] metrics: RouteMetrics expanded_nodes: tuple[tuple[int, int, int], ...] = () conflict_trace: tuple[ConflictTraceEntry, ...] = () @@ -391,6 +379,3 @@ class RoutingRunResult: iteration_trace: tuple[IterationTraceEntry, ...] = () topology: TopologyReport | None = None automatic: AutomaticRoutingReport | None = None - - def __post_init__(self) -> None: - object.__setattr__(self, "results_by_net", snapshot(self.results_by_net)) diff --git a/inire/router/_astar_admission.py b/inire/router/_astar_admission.py index 5e2fc2f..fbc793b 100644 --- a/inire/router/_astar_admission.py +++ b/inire/router/_astar_admission.py @@ -6,8 +6,7 @@ from typing import TYPE_CHECKING from shapely.geometry import Polygon from inire.constants import TOLERANCE_LINEAR -from inire.geometry.component_overlap import invalid_component_join -from inire.geometry.components import build_component, check_component_endpoint, path_within_board +from inire.geometry.components import build_component, path_within_board from inire.geometry.primitives import Port from inire.router.refiner import component_hits_ancestor_chain @@ -37,9 +36,6 @@ def process_move( coll_key = id(coll_type) if isinstance(coll_type, Polygon) else coll_type physical_type = config.bend_physical_geometry physical_key = id(physical_type) if isinstance(physical_type, Polygon) else physical_type - search = context.options.search - template = search.sbend_template(params[0], params[1], net_width) if move_class == "sbend" and search.sbend_outlines else None - outline = template.polygon if template else None self_dilation = context.cost_evaluator.collision_engine.clearance / 2.0 abs_key = ( @@ -49,7 +45,6 @@ def process_move( net_width, coll_key, physical_key, - id(outline) if outline is not None else None, self_dilation, ) if abs_key in context.move_cache_abs: @@ -57,6 +52,7 @@ def process_move( res = context.move_cache_abs[abs_key] else: context.metrics.total_move_cache_abs_misses += 1 + context.check_cache_eviction() base_port = Port(0, 0, cp.r) rel_key = ( cp.r, @@ -65,7 +61,6 @@ def process_move( net_width, coll_key, physical_key, - id(outline) if outline is not None else None, self_dilation, ) if rel_key in context.move_cache_rel: @@ -74,10 +69,6 @@ def process_move( else: context.metrics.total_move_cache_rel_misses += 1 try: - board = context.cost_evaluator.collision_engine.board - # The terminal center must fit before we allocate a tessellated outline. - if board is not None and move_class != "straight": - check_component_endpoint(cp, move_class, params, board.bounds) res_rel = build_component( base_port, net_width, @@ -87,19 +78,18 @@ def process_move( physical_geometry_type=physical_type, clip_margin=config.bend_clip_margin, dilation=self_dilation, - sbend_outline=outline, - physical_length=search.bend_physical_length if move_class == "bend90" else (template.length if template else None), ) except ValueError: return - context.cache_move(rel_key, res_rel, relative=True) + context.move_cache_rel[rel_key] = res_rel res = res_rel.translate(cp.x, cp.y) - context.cache_move(abs_key, res, relative=False) + context.move_cache_abs[abs_key] = res add_node( parent, res, target, + net_width, net_id, open_set, closed_set, @@ -116,6 +106,7 @@ def add_node( parent: AStarNode, result: ComponentResult, target: Port, + net_width: float, net_id: str, open_set: list[AStarNode], closed_set: dict[tuple[int, int, int], float], @@ -154,34 +145,22 @@ def add_node( context.metrics.total_static_safe_cache_hits += 1 else: ce = context.cost_evaluator.collision_engine - danger = context.cost_evaluator.danger_map - collision_found = ( - (ce.board is not None and not path_within_board((result,), ce.board)) - or (ce.board is None and danger is not None and not danger.is_within_bounds(end_p.x, end_p.y)) - or ce.check_move_static(result, start_port=parent_p, end_port=end_p) - ) + if ce.board is not None and not path_within_board((result,), ce.board): + collision_found = True + elif move_type == "straight": + collision_found = ce.check_move_straight_static(parent_p, result.length, net_width=net_width) + else: + collision_found = ce.check_move_static(result, start_port=parent_p, end_port=end_p) if collision_found: - if cache_key in context.move_cache_abs: - context.hard_collision_set.add(cache_key) + context.hard_collision_set.add(cache_key) if frontier_trace is not None: frontier_trace.record("hard_collision", move_type, parent.port.as_tuple(), state, result.total_dilated_bounds) metrics.pruned_hard_collision += 1 metrics.total_pruned_hard_collision += 1 return - if cache_key in context.move_cache_abs: - context.static_safe_cache.add(cache_key) + context.static_safe_cache.add(cache_key) - predecessor = parent.component_result - self_clearance = context.cost_evaluator.collision_engine.self_clearance - if ( - (not result.standard_faces and not all(result.physical_checks)) - or ((config.self_collision_check or self_clearance) and component_hits_ancestor_chain(result, parent, self_clearance)) - or ( - not (config.self_collision_check or self_clearance) and predecessor is not None - and not (predecessor.standard_faces and result.standard_faces) - and invalid_component_join(predecessor, result) - ) - ): + if config.self_collision_check and component_hits_ancestor_chain(result, parent): if frontier_trace is not None: frontier_trace.record("self_collision", move_type, parent.port.as_tuple(), state, result.total_dilated_bounds) return @@ -223,6 +202,13 @@ def add_node( metrics.pruned_cost += 1 metrics.total_pruned_cost += 1 return + if move_cost > 1e12: + if frontier_trace is not None: + frontier_trace.record("cost", move_type, parent.port.as_tuple(), state, result.total_dilated_bounds) + metrics.pruned_cost += 1 + metrics.total_pruned_cost += 1 + return + if context.congestion_penalty >= 0 and state in closed_set and closed_set[state] <= parent.g_cost + move_cost + TOLERANCE_LINEAR: if frontier_trace is not None: frontier_trace.record("closed_set", move_type, parent.port.as_tuple(), state, result.total_dilated_bounds) @@ -231,14 +217,9 @@ def add_node( return total_overlaps = 0 - ce = context.cost_evaluator.collision_engine - if not config.skip_congestion and ce.has_dynamic_paths(): - if config.hard_congestion or not ce.clearance: - if cache_key not in congestion.overlaps: - metrics.reroute_work += 1 - congestion.overlaps[cache_key] = ce.check_physical_move_congestion(result, net_id).soft_overlap_count - total_overlaps = congestion.overlaps[cache_key] - elif ce.has_possible_move_congestion(result, net_id, congestion.presence): + if not config.skip_congestion and context.cost_evaluator.collision_engine.has_dynamic_paths(): + ce = context.cost_evaluator.collision_engine + if ce.has_possible_move_congestion(result, net_id, congestion.presence): if ce.has_candidate_move_congestion( result, net_id, @@ -251,7 +232,6 @@ def add_node( total_overlaps = congestion.overlaps[cache_key] else: context.metrics.total_congestion_cache_misses += 1 - metrics.reroute_work += 1 total_overlaps = ce.check_move_congestion( result, net_id, diff --git a/inire/router/_astar_moves.py b/inire/router/_astar_moves.py index a0654bd..9af8176 100644 --- a/inire/router/_astar_moves.py +++ b/inire/router/_astar_moves.py @@ -8,11 +8,10 @@ from inire.geometry.components import bend_fits_width, bend90_grid_span from inire.geometry.sbend import sbend_grid_span from ._astar_admission import process_move -from ._seed_materialization import seed_move if TYPE_CHECKING: + from inire.geometry.components import MoveKind from inire.geometry.primitives import Port - from inire.seeds import BendDirection from ._astar_types import AStarContext, AStarMetrics, AStarNode, CongestionCaches, SearchRunConfig @@ -46,10 +45,7 @@ def _sbend_forward_span(offset: float, radius: float) -> float | None: abs_offset = abs(offset) if abs_offset <= TOLERANCE_LINEAR or radius <= 0 or abs_offset >= 2.0 * radius: return None - try: - return sbend_grid_span(offset, radius) - except OverflowError: - return None + return sbend_grid_span(offset, radius) def _visible_straight_candidates( @@ -151,6 +147,16 @@ def _visible_straight_candidates( return sorted(tangent_candidates, reverse=True) +def _previous_move_metadata(node: AStarNode) -> tuple[MoveKind | None, float | None]: + result = node.component_result + if result is None: + return None, None + move_type = result.move_type + if move_type == "straight": + return move_type, result.length + return move_type, None + + def expand_moves( current: AStarNode, target: Port, @@ -162,19 +168,10 @@ def expand_moves( metrics: AStarMetrics, congestion: CongestionCaches, config: SearchRunConfig, - deferred_turns: list[tuple[AStarNode, float, BendDirection]] | None, ) -> None: search_options = context.options.search - scan_limit = search_options.max_straight_length cp = current.port - previous = current.component_result - seed_index = current.seed_index if config.propose_guidance_moves else None - prev_straight_length = previous.length if seed_index is None and previous is not None and previous.move_type == "straight" else None - seed = config.guidance_seed - if seed is not None and seed_index is not None and seed_index < len(seed): - kind, parameters = seed_move(seed[seed_index]) - process_move(current, target, net_width, net_id, open_set, closed_set, context, metrics, congestion, config, kind, parameters) - + prev_move_type, prev_straight_length = _previous_move_metadata(current) dx_t = target.x - cp.x dy_t = target.y - cp.y dist_sq = dx_t * dx_t + dy_t * dy_t @@ -193,43 +190,39 @@ def expand_moves( dx_local = proj_t dy_local = perp_t - collision = context.cost_evaluator.collision_engine - if ( - proj_t > 0 and abs(perp_t) < TOLERANCE_LINEAR and cp.r == target.r - and ( - prev_straight_length is None - or proj_t < prev_straight_length - TOLERANCE_LINEAR - or prev_straight_length + proj_t > scan_limit + TOLERANCE_LINEAR - ) - ): - process_move( - current, - target, - net_width, - net_id, - open_set, - closed_set, - context, - metrics, - congestion, - config, - "straight", - (int(round(proj_t)),), + if proj_t > 0 and abs(perp_t) < 1e-6 and cp.r == target.r: + max_reach = context.cost_evaluator.collision_engine.ray_cast( + cp, + cp.r, + proj_t + 1.0, + net_width=net_width, + caller="expand_snap", ) + if max_reach >= proj_t - 0.01 and ( + prev_straight_length is None or proj_t < prev_straight_length - TOLERANCE_LINEAR + ): + process_move( + current, + target, + net_width, + net_id, + open_set, + closed_set, + context, + metrics, + congestion, + config, + "straight", + (int(round(proj_t)),), + ) - max_reach = collision.ray_cast( + max_reach = context.cost_evaluator.collision_engine.ray_cast( cp, cp.r, - scan_limit, + search_options.max_straight_length, net_width=net_width, caller="expand_forward", ) - short_launch = (previous is None or previous.move_type != "straight") and max_reach < max(1, math.ceil(search_options.min_straight_length)) - sbend_only = not search_options.bend_radii and bool(search_options.sbend_radii) - if short_launch or (sbend_only and max_reach < scan_limit): - # Radius around the ray can block a launch at an otherwise clear port face. - reach = collision.straight_reach(cp, scan_limit, net_width) - max_reach = max(max_reach, math.floor(reach + TOLERANCE_LINEAR)) if _should_cap_straights_to_bounds(context): max_reach = min(max_reach, _distance_to_bounds_in_heading(cp, context.problem.bounds)) candidate_lengths = [ @@ -262,8 +255,6 @@ def expand_moves( if sbend_span is None: continue candidate_lengths.extend((dx_local - sbend_span, dx_local - 2.0 * sbend_span)) - if not bend_spans: - candidate_lengths.append(max_reach - sbend_span) guide_offsets: set[int] = set() if config.corridor is not None: @@ -282,11 +273,7 @@ def expand_moves( for length in _quantized_lengths(candidate_lengths, max_reach): if length < search_options.min_straight_length: continue - if ( - prev_straight_length is not None - and length >= prev_straight_length - TOLERANCE_LINEAR - and prev_straight_length + length <= scan_limit + TOLERANCE_LINEAR - ): + if prev_straight_length is not None and length >= prev_straight_length - TOLERANCE_LINEAR: continue process_move( current, @@ -306,17 +293,17 @@ def expand_moves( angle_to_target = 0.0 if dx_t != 0 or dy_t != 0: angle_to_target = float((round((180.0 / math.pi) * math.atan2(dy_t, dx_t)) + 360.0) % 360.0) - prefer_toward_target = deferred_turns is not None and not config.restrict_to_corridor and dist_sq >= 150 * 150 + allow_backwards = config.restrict_to_corridor or dist_sq < 150 * 150 for radius in search_options.bend_radii: if not bend_fits_width(radius, net_width): continue for direction in ("CW", "CCW"): - if prefer_toward_target and deferred_turns is not None: - heading = (cp.r + (90 if direction == "CCW" else -90)) % 360 - difference = (angle_to_target - heading + 180.0) % 360.0 - 180.0 - if abs(difference) > 135.0: - deferred_turns.append((current, radius, direction)) + if not allow_backwards: + turn = 90 if direction == "CCW" else -90 + new_ori = (cp.r + turn) % 360 + new_diff = (angle_to_target - new_ori + 180.0) % 360.0 - 180.0 + if abs(new_diff) > 135.0: continue process_move( current, @@ -334,37 +321,13 @@ def expand_moves( ) max_sbend_r = max(search_options.sbend_radii) if search_options.sbend_radii else 0.0 - if not bend_fits_width(max_sbend_r, net_width): + if not bend_fits_width(max_sbend_r, net_width) or prev_move_type == "sbend": return explicit_offsets = search_options.sbend_offsets offsets = set(explicit_offsets) if explicit_offsets is not None else guide_offsets - if search_options.sbend_outlines: - offsets.update(outline.offset for outline in search_options.sbend_outlines_for_width(net_width)) - if explicit_offsets is None and target.r == cp.r and dx_local > 0 and dy_local: - if dx_local <= 4 * max_sbend_r and abs(dy_local) < 2 * max_sbend_r: - offsets.add(round(dy_local)) - elif abs(dy_local) >= 2 * max_sbend_r: - for radius in search_options.sbend_radii: - max_offset = math.ceil(2 * radius) - 1 - if max_offset <= 0 or not bend_fits_width(radius, net_width): - continue - count = math.ceil(abs(dy_local) / max_offset) - if count <= 4: - offset = round(dy_local / count) - span = _sbend_forward_span(offset, radius) - if span is not None and span * count <= dx_local + count - 1: - offsets.add(offset) - elif explicit_offsets is None and dx_local > 0 and (target.r - cp.r) % 180 == 90: - # Position just before the final quarter turn, including its two tangent spans. - turn = 1 if (target.r - cp.r) % 360 == 90 else -1 - for span in bend_spans: - offset = round(dy_local - turn * span) - for radius in search_options.sbend_radii: - forward = _sbend_forward_span(offset, radius) - if forward is not None and forward <= dx_local - span: - offsets.add(offset) - break + if explicit_offsets is None and target.r == cp.r and 0 < dx_local <= 4 * max_sbend_r and 0 < abs(dy_local) < 2 * max_sbend_r: + offsets.add(round(dy_local)) for offset in sorted(offsets): if offset == 0: @@ -376,9 +339,9 @@ def expand_moves( current, target, net_width, - net_id, - open_set, - closed_set, + net_id, + open_set, + closed_set, context, metrics, congestion, diff --git a/inire/router/_astar_types.py b/inire/router/_astar_types.py index c649be8..8f4fbc3 100644 --- a/inire/router/_astar_types.py +++ b/inire/router/_astar_types.py @@ -1,6 +1,5 @@ from __future__ import annotations -from collections import OrderedDict from dataclasses import dataclass, field from operator import attrgetter from typing import TYPE_CHECKING, get_type_hints @@ -10,8 +9,6 @@ from inire.results import RouteMetrics from inire.router.visibility import VisibilityManager if TYPE_CHECKING: - from collections.abc import Callable - from inire.geometry.components import BendCollisionModel, BendPhysicalGeometry, ComponentResult from inire.geometry.primitives import Port from inire.model import RoutingOptions, RoutingProblem @@ -97,16 +94,12 @@ class SearchRunConfig: corridor_strength: float = 0.0 restrict_to_corridor: bool = False hard_congestion: bool = False - propose_guidance_moves: bool = False - expired: Callable[[], bool] | None = field(default=None, repr=False, compare=False) def estimate_remaining_cost(self, current: Port, target: Port, context: AStarContext) -> float: evaluator = context.cost_evaluator cost = evaluator.h_manhattan(current, target, min_bend_radius=context.min_bend_radius) if self.restrict_to_corridor and self.corridor is not None and current != target: - distance_weight = evaluator.default_weights.unit_length_cost * evaluator.distance_heuristic_weight - distance_cost = self.corridor.remaining(current) * distance_weight - return 0.4 * cost + 0.6 * evaluator.greedy_h_weight * distance_cost + return 0.4 * cost + 0.6 * evaluator.greedy_h_weight * self.corridor.remaining(current) return cost @classmethod @@ -128,8 +121,6 @@ class SearchRunConfig: corridor_strength: float = 0.0, restrict_to_corridor: bool = False, hard_congestion: bool = False, - propose_guidance_moves: bool = False, - expired: Callable[[], bool] | None = None, ) -> SearchRunConfig: search = options.search bend_collision_type, bend_physical_geometry = resolve_bend_geometry( @@ -153,8 +144,6 @@ class SearchRunConfig: corridor_strength=corridor_strength, restrict_to_corridor=restrict_to_corridor, hard_congestion=hard_congestion, - propose_guidance_moves=propose_guidance_moves, - expired=expired, ) @@ -162,10 +151,14 @@ class AStarNode: __slots__ = ( "port", "g_cost", + "h_cost", "fh_cost", "parent", "component_result", + "base_move_cost", + "cache_key", "seed_index", + "congestion_resolved", ) def __init__( @@ -176,14 +169,21 @@ class AStarNode: parent: AStarNode | None = None, component_result: ComponentResult | None = None, *, + base_move_cost: float = 0.0, + cache_key: tuple | None = None, seed_index: int | None = None, + congestion_resolved: bool = True, ) -> None: self.port = port self.g_cost = g_cost + self.h_cost = h_cost self.fh_cost = (g_cost + h_cost, h_cost) self.parent = parent self.component_result = component_result + self.base_move_cost = base_move_cost + self.cache_key = cache_key self.seed_index = seed_index + self.congestion_resolved = congestion_resolved def __lt__(self, other: AStarNode) -> bool: return self.fh_cost < other.fh_cost @@ -197,14 +197,13 @@ _READ_TOTALS = attrgetter(*(name for name, _ in _TOTAL_COUNTERS)) class AStarMetrics: - __slots__ = (*(name for name, _ in _TOTAL_COUNTERS), *_PER_SEARCH_COUNTERS, "last_expanded_nodes", "reroute_work") + __slots__ = (*(name for name, _ in _TOTAL_COUNTERS), *_PER_SEARCH_COUNTERS, "last_expanded_nodes") def __init__(self) -> None: self.reset_totals() self.reset_per_route() def reset_totals(self) -> None: - self.reroute_work = 0 for name, default in _TOTAL_COUNTERS: setattr(self, name, default) @@ -232,8 +231,6 @@ class AStarContext: "hard_collision_set", "static_safe_cache", "static_cache_version", - "_relative_coordinates", - "_absolute_coordinates", ) def __init__( @@ -242,7 +239,7 @@ class AStarContext: problem: RoutingProblem, options: RoutingOptions, metrics: AStarMetrics | None = None, - max_cache_size: int = 8192, + max_cache_size: int = 1000000, ) -> None: self.cost_evaluator = cost_evaluator self.metrics = metrics if metrics is not None else AStarMetrics() @@ -252,10 +249,8 @@ class AStarContext: self.options = options self.min_bend_radius = min(self.options.search.bend_radii, default=50.0) self.visibility_manager = VisibilityManager(self.cost_evaluator.collision_engine) - self.move_cache_rel: OrderedDict[tuple, ComponentResult] = OrderedDict() - self.move_cache_abs: OrderedDict[tuple, ComponentResult] = OrderedDict() - self._relative_coordinates = 0 - self._absolute_coordinates = 0 + self.move_cache_rel: dict[tuple, ComponentResult] = {} + self.move_cache_abs: dict[tuple, ComponentResult] = {} self.hard_collision_set: set[tuple] = set() self.static_safe_cache: set[tuple] = set() self.static_cache_version = self.cost_evaluator.collision_engine.get_static_version() @@ -271,21 +266,16 @@ class AStarContext: if self.static_cache_version != current_version: self.clear_static_caches() - def cache_move(self, key: tuple, result: ComponentResult, *, relative: bool) -> None: - cache = self.move_cache_rel if relative else self.move_cache_abs - total = self._relative_coordinates if relative else self._absolute_coordinates - coordinate_limit = 500_000 if relative else 1_000_000 - if result.coordinate_count > coordinate_limit or not self.max_cache_size: + def _evict_cache(self, cache: dict[tuple, ComponentResult]) -> None: + if len(cache) <= self.max_cache_size * 1.2: return - cache[key] = result - total += result.coordinate_count - while len(cache) > self.max_cache_size or total > coordinate_limit: - removed_key, removed = cache.popitem(last=False) - total -= removed.coordinate_count - if not relative: - self.hard_collision_set.discard(removed_key) - self.static_safe_cache.discard(removed_key) - if relative: - self._relative_coordinates = total - else: - self._absolute_coordinates = total + + num_to_evict = max(1, int(len(cache) * 0.25)) + for idx, key in enumerate(tuple(cache.keys())): + if idx >= num_to_evict: + break + del cache[key] + + def check_cache_eviction(self) -> None: + self._evict_cache(self.move_cache_rel) + self._evict_cache(self.move_cache_abs) diff --git a/inire/router/_automatic.py b/inire/router/_automatic.py index c7123af..d6f0627 100644 --- a/inire/router/_automatic.py +++ b/inire/router/_automatic.py @@ -14,8 +14,8 @@ from shapely.geometry import box from inire.constants import TOLERANCE_LINEAR from inire.geometry.collision import RoutingWorld -from inire.model import FixedRoute, resolve_bend_geometry -from inire.results import AutomaticRoutingReport, RoutingStage, RoutingTiming, _planner_for_mode +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 @@ -39,9 +39,9 @@ from inire.router._routing_policy import ( _route_residual, _trial, ) -from inire.router._seed_materialization import materialize_path_seed, seed_preparation_error -from inire.router._stack import RoutingAttempts -from inire.router._topology import constrained_triangulation_available, plan_corridors +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.seeds import SBendSeed @@ -52,7 +52,7 @@ if TYPE_CHECKING: from shapely.geometry.base import BaseGeometry from inire.model import NetSpec, RoutingOptions, RoutingProblem - from inire.results import RoutingOperation, RoutingResult, RoutingRunResult + 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 @@ -84,14 +84,14 @@ class _AutomaticRun: options: RoutingOptions, iteration_callback: Callable[[int, dict[str, RoutingResult]], None] | None, ) -> None: - if any(not seed.segments for seed in problem.initial_paths.values()): - problem = replace(problem, initial_paths={net_id: seed for net_id, seed in problem.initial_paths.items() if seed.segments}) self.raw_problem = problem self.problem = problem self.options = options self.board = box(*problem.bounds) - self.attempts = RoutingAttempts(iteration_callback) + self.metrics: list[RouteMetrics] = [] self.timings: list[RoutingTiming] = [] + self.iteration_callback = iteration_callback + self.callback_index = 0 self.cost_pass_performed = False self.evaluator: CostEvaluator | None = None weights = options.topology.automatic_length_weights @@ -128,47 +128,39 @@ class _AutomaticRun: policy: str | None = None, corridors: dict[str, tuple[Corridor, ...]] | None = None, ) -> RoutingRunResult: + def notify(_iteration: int, results: dict[str, RoutingResult]) -> None: + assert self.iteration_callback is not None + self.iteration_callback(self.callback_index, results) + self.callback_index += 1 + mode = options.topology.mode time_operation = partial(self._time, planner=planner or _planner_for_mode(mode), mode=mode, policy=policy) with time_operation(operation): - return self.attempts.run( + run = route_once( problem, options=options, + iteration_callback=notify if self.iteration_callback else None, phase_timer=time_operation, corridors=corridors, ) + self.metrics.append(run.metrics) + return run def _selection_cost(self, result: RoutingResult) -> float: - if not self.options.search.node_limit: - # Verification-only runs have a single candidate to report. - return 0.0 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, proximity_range=self.options.search.proximity_range, - ) + self.evaluator = build_native_cost_evaluator(self.problem, self.options.objective) return self.evaluator.path_cost(result.path[0].start_port, result.path) def _trial(self, run: RoutingRunResult, stage: RoutingStage) -> Trial: with self._time("verify", planner=stage.planner, mode=stage.mode, policy=stage.policy): return _trial(run, stage, score=self._selection_cost) - def _seeded_problem(self, trial: Trial, *, include_unresolved: bool = False) -> RoutingProblem: - seeds = { - net_id: result.as_seed() for net_id, result in trial.run.results_by_net.items() - if result.path and (include_unresolved or net_id in trial.valid_costs) - } - nets = [] - for net in self.problem.nets: - if net.net_id not in seeds: - continue - result = trial.run.results_by_net[net.net_id] - nets.append(replace( - net, start=result.path[0].start_port, - target=result.path[-1].end_port if result.reached_target else net.target, - )) - return replace(self.problem, nets=tuple(nets), initial_paths=seeds) + def _seeded_problem(self, trial: Trial) -> RoutingProblem: + seeds = {net_id: trial.run.results_by_net[net_id].as_seed() for net_id in trial.valid_costs} + nets = tuple(net for net in self.problem.nets if net.net_id in seeds) + return replace(self.problem, nets=nets, initial_paths=seeds) def _seeded_attempt( self, @@ -178,16 +170,14 @@ class _AutomaticRun: kind: str, policy: str | None, operation: Literal["verify", "refine"], - node_limit: int = 1, ) -> tuple[RoutingRunResult, RoutingStage]: options = self.options refinement = options.refinement if operation == "verify": refinement = replace(refinement, enabled=False) - node_limit = 0 worker = replace( options, - search=replace(options.search, node_limit=node_limit), + search=replace(options.search, node_limit=1), topology=replace(options.topology, mode="off"), congestion=replace(options.congestion, max_iterations=1), refinement=refinement, @@ -205,48 +195,29 @@ class _AutomaticRun: ) return run, stage - def _verify( - self, problem: RoutingProblem, planner: str, *, - kind: str | None = None, policy: str | None = None, preserve_hints: bool = False, - ) -> Trial: - def verify(candidate: RoutingProblem) -> Trial: - run, stage = self._seeded_attempt(candidate, planner, kind=kind or planner, policy=policy, operation="verify") - return self._trial(run, stage) - - if preserve_hints and self.problem.initial_paths: - active_ids = {net.net_id for net in problem.nets} - hints = {net_id: seed for net_id, seed in self.problem.initial_paths.items() if net_id in active_ids} - merged = {**problem.initial_paths, **hints} - if merged != problem.initial_paths: - incumbent = verify(replace(problem, initial_paths=merged)) - if len(incumbent.valid_costs) == len(problem.nets): - return incumbent - candidate = verify(problem) - return candidate if candidate.improves_on(incumbent) else incumbent - return verify(problem) + def _verify(self, problem: RoutingProblem, planner: str, *, kind: str | None = None, policy: str | None = None) -> Trial: + run, stage = self._seeded_attempt(problem, planner, kind=kind or planner, policy=policy, operation="verify") + return self._trial(run, stage) def _constructive_trials(self) -> tuple[list[Trial], tuple[str, ...]]: - options = self.options - problem = replace(self.problem, initial_paths={}) if self.problem.initial_paths else self.problem - verify = partial(self._verify, preserve_hints=True) + problem, options = self.problem, self.options trials: list[Trial] = [] rejections = [] try: with self._time("plan", planner="bundle"): - raw = replace(self.raw_problem, initial_paths={}) if self.raw_problem.initial_paths else self.raw_problem - bundle = plan_ordered_bundle(raw, options.search, infer_terminal_headings=True) + bundle = plan_ordered_bundle(self.raw_problem, options.search, infer_terminal_headings=True) except ValueError as exc: rejections.append(str(exc)) else: if bundle.nets == problem.nets: - trials.append(verify(bundle, "bundle")) + trials.append(self._verify(bundle, "bundle")) if len(trials[-1].valid_costs) == len(problem.nets): return trials, () rejections.append("Bundle candidate failed geometric verification") elif not options.topology.infer_terminal_headings: with self._time("plan", planner="bundle-turnaround"): for candidate in bundle_turnaround_candidates(problem, bundle, options.search): - trials.append(verify(candidate, "bundle-turnaround")) + trials.append(self._verify(candidate, "bundle-turnaround")) if len(trials[-1].valid_costs) == len(problem.nets): return trials, () rejections.append("No geometrically verified turnaround matched the terminal headings") @@ -254,40 +225,40 @@ class _AutomaticRun: with self._time("plan", planner="compact-port-jogs"): compact = compact_port_seed_set(problem, options.search) if compact is not None: - trials.append(verify(replace(problem, initial_paths=compact), "compact-port-jogs")) + trials.append(self._verify(replace(problem, initial_paths=compact), "compact-port-jogs")) if len(trials[-1].valid_costs) == len(problem.nets): return trials, tuple(rejections) - span_trial = self._column_trial(False, trials, problem=problem) + span_trial = self._column_trial(False, trials) if span_trial is None: rejections.append("Span scoring found no verified column layout") policy = options.topology.automatic_cost if policy == "always" or (policy == "selective" and span_trial is not None and _has_fragmented_shifts(span_trial)): self.cost_pass_performed = True - if self._column_trial(True, trials, problem=problem) is None: + if self._column_trial(True, trials) is None: rejections.append("Cost scoring found no verified column layout") if not trials or len(_best_trial(trials).valid_costs) < len(problem.nets): planner = "local-sbend" with self._time("plan", planner=planner): shifts = short_shift_seed_set(problem, options.search, self._selection_cost) if shifts is not None: - trial = verify(replace(problem, initial_paths=shifts), planner) + trial = self._verify(replace(problem, initial_paths=shifts), planner) complete = len(trial.valid_costs) == len(problem.nets) trials.append(trial if complete else replace(trial, selection="incomplete-layout")) if not complete: rejections.append("Local S-bend layout failed full verification") return trials, tuple(rejections) - def _column_trial(self, weighted: bool, trials: list[Trial], *, problem: RoutingProblem) -> Trial | None: + def _column_trial(self, weighted: bool, trials: list[Trial]) -> Trial | None: objective = self.options.objective weights = self.length_weights or dict.fromkeys(("straight", "bend90", "sbend"), objective.unit_length_cost) penalty = 0.0 if self.length_weights is not None else objective.sbend_penalty policy = "weighted" if weighted else "span" kind = "column-cost" if weighted else "column-span" with self._time("plan", planner="column", policy=policy): - candidates = column_seed_candidates(problem, self.options.search, weights, weighted=weighted, sbend_penalty=penalty) + candidates = column_seed_candidates(self.problem, self.options.search, weights, weighted=weighted, sbend_penalty=penalty) for seeds in islice(candidates, 8): - trial = self._verify(replace(problem, initial_paths=seeds), "column", kind=kind, policy=policy, preserve_hints=True) + trial = self._verify(replace(self.problem, initial_paths=seeds), "column", kind=kind, policy=policy) trials.append(trial) if len(trial.valid_costs) == len(self.problem.nets): return trial @@ -297,14 +268,14 @@ class _AutomaticRun: problem, options = self.problem, self.options if len(problem.nets) != 2: return - world = RoutingWorld.from_problem(problem, board=self.board) + world = RoutingWorld(clearance=problem.clearance, safety_zone_radius=problem.safety_zone_radius, board=self.board) + for obstacle in problem.static_obstacles: + world.add_static_obstacle(obstacle) def footprints(net: NetSpec, seeds: Iterable[PathSeed]) -> list[tuple[PathSeed, BaseGeometry]]: choices = [] for seed in seeds: - path = materialize_path_seed( - seed, start=net.start, net_width=net.width, search=options.search, clearance=problem.clearance, bounds=problem.bounds, - ) + path = materialize_path_seed(seed, start=net.start, net_width=net.width, search=options.search, clearance=problem.clearance) if not path or path[-1].end_port != net.target or not world.verify_path_report(net.net_id, path).is_valid: continue footprint = shapely.union_all([shape for component in path for shape in component.physical_geometry]) @@ -327,9 +298,8 @@ class _AutomaticRun: if net.net_id in problem.initial_paths or not links[1 - index]: continue peer_link = links[1 - index][0] - peer = problem.nets[1 - index] - fixed = FixedRoute(peer.net_id, tuple(shapely.get_parts(peer_link[1]))) - reserved = replace(problem, nets=(net,), initial_paths={}, fixed_routes=(*problem.fixed_routes, fixed)) + obstacles = problem.static_obstacles + tuple(shapely.get_parts(peer_link[1])) + reserved = replace(problem, nets=(net,), initial_paths={}, static_obstacles=obstacles) detours = footprints(net, (seed for _, seed in islice(perimeter_detour_candidates(reserved, options.search), 16))) reserved_pairs = product(detours, (peer_link,)) if index == 0 else product((peer_link,), detours) pairs = chain(pairs, reserved_pairs) @@ -573,7 +543,7 @@ class _AutomaticRun: with self._time("plan", planner="corridor-seed", mode="seed", policy=policy): corridors = plan_corridors( residual.bounds, - residual._blocking_polygons, + residual.static_obstacles, nets, clearance=residual.clearance, bend_radius=min(options.search.bend_radii, default=0.0), @@ -607,36 +577,22 @@ class _AutomaticRun: ) trials.append(self._trial(run, stage)) - def _refine(self, trials: list[Trial]) -> Trial | None: + def _refine(self, trials: list[Trial]) -> None: best = _best_trial(trials) if not self.options.refinement.enabled or not best.valid_costs: - return None - has_unresolved_paths = any(result.path and not result.is_valid for result in best.run.results_by_net.values()) + return run, stage = self._seeded_attempt( - self._seeded_problem(best, include_unresolved=has_unresolved_paths), + self._seeded_problem(best), best.stage.planner, kind="refinement", policy=best.stage.policy, operation="refine", - node_limit=0 if has_unresolved_paths else 1, ) - # Any carried-over result without a replayed seed has no path to recheck. + # Keep reports for unresolved routes when merging the refined subset. results = {**best.run.results_by_net, **run.results_by_net} - refined = self._trial(replace(run, results_by_net=results), stage).as_replacement_for(best) + refined = self._trial(replace(run, results_by_net=results), stage) # Only a whole verified replacement of the incumbent can win. - trials.append(refined) - objective = self.options.refinement.objective - if objective is None: - return None - if not refined.selectable: - return best - evaluator = build_native_cost_evaluator(self.problem, objective, proximity_range=self.options.search.proximity_range) - - def cost(trial: Trial) -> float: - paths = (trial.run.results_by_net[net_id].path for net_id in trial.valid_costs) - return sum(evaluator.path_cost(path[0].start_port, path) for path in paths) - - return refined if cost(refined) < cost(best) else best + trials.append(refined.as_replacement_for(best)) def execute(self) -> RoutingRunResult: started = perf_counter() @@ -647,14 +603,12 @@ class _AutomaticRun: rejections = () target = len(self.problem.nets) trials: list[Trial] = [] - refinement_choice = None if not self.problem.nets or options.search.node_limit <= 0 or options.congestion.max_iterations <= 0: self._lattice_fallback(trials, options, "No automatic search requested") - elif ( - isinstance(proxy, shapely.Polygon) or physical != "arc" - or options.search.has_applicable_sbend_outline(net.width for net in self.problem.nets) - ): + elif isinstance(proxy, shapely.Polygon) or physical != "arc": self._lattice_fallback(trials, options, "Custom bend geometry uses lattice routing") + elif not hasattr(shapely, "constrained_delaunay_triangles") or shapely.geos_version < (3, 10): + self._lattice_fallback(trials, options, "Constrained triangulation is unavailable") else: with self._time("plan"): if options.topology.infer_terminal_headings and not self.problem.initial_paths: @@ -668,14 +622,10 @@ class _AutomaticRun: if not cut and not conflicts: trials, rejections = self._constructive_trials() if not any(trial.selectable for trial in trials) or len(_best_trial(trials).valid_costs) < target: - if constrained_triangulation_available(): - self._search_trials(trials, target) - else: - worker = replace(options, refinement=replace(options.refinement, enabled=False)) - self._lattice_fallback(trials, worker, "Constrained triangulation is unavailable") - refinement_choice = self._refine(trials) - best = refinement_choice or _best_trial(trials) - metrics = self.attempts.metrics() + self._search_trials(trials, target) + self._refine(trials) + best = _best_trial(trials) + metrics = _sum_route_metrics(self.metrics) report = AutomaticRoutingReport( tuple(trial.stage for trial in trials), next(i for i, trial in enumerate(trials) if trial is best), @@ -687,21 +637,7 @@ class _AutomaticRun: timings=tuple(self.timings), duration_s=perf_counter() - started, ) - results = best.run.results_by_net - if options.congestion.max_iterations and self.raw_problem.initial_paths: - results = dict(results) - for net in self.raw_problem.nets: - seed = self.raw_problem.initial_paths.get(net.net_id) - result = results[net.net_id] - if seed is None or result.report.seed_error is not None: - continue - error = seed_preparation_error( - seed, start=net.start, net_width=net.width, search=options.search, clearance=self.raw_problem.clearance, - ) - if error: - report_with_error = replace(result.report, seed_error=f"Initial path for {net.net_id!r} {error}") - results[net.net_id] = replace(result, report=report_with_error) - return replace(complete_final_conflict_trace(replace(best.run, results_by_net=results)), metrics=metrics, automatic=report) + return replace(complete_final_conflict_trace(best.run), metrics=metrics, automatic=report) def route_automatic( diff --git a/inire/router/_bundle.py b/inire/router/_bundle.py index 239e266..5a5781b 100644 --- a/inire/router/_bundle.py +++ b/inire/router/_bundle.py @@ -45,7 +45,7 @@ class _Shift: def _identify_layout(problem: RoutingProblem, margin: float) -> _Layout: columns: dict[tuple[float, float], list[Bounds]] = defaultdict(list) - for obstacle in problem._blocking_polygons: + for obstacle in problem.static_obstacles: if not obstacle.equals(box(*obstacle.bounds)): raise ValueError("Bundle routing requires axis-aligned rectangular obstacles") x0, y0, x1, y1 = obstacle.bounds @@ -218,11 +218,7 @@ def plan_ordered_bundle(problem: RoutingProblem, search: SearchOptions, *, infer return problem _, physical_geometry = resolve_bend_geometry(search) bend = min(search.bend_radii, default=0.0) - if ( - not isfinite(bend) or bend <= 0 or bend != int(bend) or bend not in search.sbend_radii - or physical_geometry != "arc" - or search.has_applicable_sbend_outline(net.width for net in problem.nets) - ): + if not isfinite(bend) or bend <= 0 or bend != int(bend) or bend not in search.sbend_radii or physical_geometry != "arc": raise ValueError("Bundle routing needs a common integer radius for circular bends and S-bends") radius = int(bend) width = problem.nets[0].width diff --git a/inire/router/_capacity.py b/inire/router/_capacity.py index 564b370..1810964 100644 --- a/inire/router/_capacity.py +++ b/inire/router/_capacity.py @@ -2,15 +2,13 @@ from __future__ import annotations -from itertools import pairwise +from itertools import combinations, pairwise from math import floor, isfinite from typing import TYPE_CHECKING from shapely.geometry import box -from shapely.strtree import STRtree from inire.constants import TOLERANCE_LINEAR -from inire.geometry.collision import _clearance_limit from inire.geometry.intervals import open_intervals from inire.model import resolve_bend_geometry from inire.results import CapacityLimit @@ -20,8 +18,8 @@ if TYPE_CHECKING: def _rectangular_obstacle_bounds(problem: RoutingProblem) -> tuple[tuple[float, float, float, float], ...] | None: - bounds = tuple(tuple(shape.bounds) for shape in problem._blocking_polygons) - if any(shape.is_empty or not shape.equals(box(*extent)) for shape, extent in zip(problem._blocking_polygons, bounds, strict=True)): + bounds = tuple(tuple(shape.bounds) for shape in problem.static_obstacles) + if any(shape.is_empty or not shape.equals(box(*extent)) for shape, extent in zip(problem.static_obstacles, bounds, strict=True)): return None return bounds @@ -64,53 +62,24 @@ def cut_capacity(problem: RoutingProblem, options: RoutingOptions) -> CapacityLi def port_conflicts(problem: RoutingProblem, options: RoutingOptions) -> tuple[tuple[str, str], ...]: """Find disjoint fixed-heading terminal pairs with insufficient optical clearance.""" _, physical_geometry = resolve_bend_geometry(options.search) - if physical_geometry != "arc": + if physical_geometry != "arc" or problem.clearance <= TOLERANCE_LINEAR: return () aligned: dict[tuple[int, int], list[tuple[str, float, float]]] = {} for net in problem.nets: - half_width = net.width / 2 for port in (net.start, net.target): axis = port.r % 180 longitudinal, lateral = (port.x, port.y) if axis == 0 else (port.y, port.x) - aligned.setdefault((axis, longitudinal), []).append((net.net_id, lateral - half_width, lateral + half_width)) + aligned.setdefault((axis, longitudinal), []).append((net.net_id, lateral, net.width)) # Each disjoint conflict pair forces at least one route to be omitted. # A terminal's physical cross-section is fixed by its heading and width. pairs = [] matched = set() - for bank in aligned.values(): - ports = [port for port in bank if port[0] not in matched] - if len(ports) < 2: - continue - pairs.extend(_match_bank(ports, problem.clearance, matched)) + for ports in aligned.values(): + for (a, y1, w1), (b, y2, w2) in combinations(ports, 2): + if a == b or a in matched or b in matched: + continue + gap = abs(y1 - y2) - (w1 + w2) / 2 + if gap < problem.clearance - TOLERANCE_LINEAR: + pairs.append((a, b)) + matched.update((a, b)) return tuple(pairs) - - -def _match_bank(ports: list[tuple[str, float, float]], clearance: float, matched: set[str]) -> list[tuple[str, str]]: - separation = _clearance_limit(clearance) - padding = separation / 2 - spans = [box(low - padding, 0, high + padding, 1) for _, low, high in ports] - index = STRtree(spans) - - def conflicts(i: int, j: int) -> bool: - a, low_a, high_a = ports[i] - b, low_b, high_b = ports[j] - if a == b or b in matched: - return False - gap = max(low_a, low_b) - min(high_a, high_b) - # Distinct conductors cannot share a point even at zero clearance. - return gap < separation if clearance else gap <= 0 - - pairs = [] - for i, (a, _, _) in enumerate(ports): - if a in matched: - continue - # Dense banks usually match consecutive terminals in input order. - j = i + 1 if i + 1 < len(ports) and conflicts(i, i + 1) else min( - (j for j in index.query(spans[i]) if j > i and conflicts(i, j)), default=None, - ) - if j is None: - continue - b = ports[j][0] - pairs.append((a, b)) - matched.update((a, b)) - return pairs diff --git a/inire/router/_columns.py b/inire/router/_columns.py index 306f2c3..a20673d 100644 --- a/inire/router/_columns.py +++ b/inire/router/_columns.py @@ -68,7 +68,7 @@ def _columns(problem: RoutingProblem, start: int, finish: int) -> tuple[_Column, # A bounding rectangle only reserves extra space in this candidate # planner. Capacity proofs still require the actual rectangular obstacles. extents: dict[Window, list[Gap]] = defaultdict(list) - for obstacle in problem._blocking_polygons: + for obstacle in problem.static_obstacles: if obstacle.is_empty: continue left, bottom, right, top = obstacle.bounds diff --git a/inire/router/_compact.py b/inire/router/_compact.py index 8a76794..a36d09c 100644 --- a/inire/router/_compact.py +++ b/inire/router/_compact.py @@ -47,7 +47,7 @@ def _shift_positions( available: int, ) -> list[int]: positions = {i * available // 8 for i in range(9)} - for obstacle in problem._blocking_polygons: + for obstacle in problem.static_obstacles: if obstacle.is_empty: continue low, high = sorted(sign * (y - origin) - radius for y in (obstacle.bounds[1], obstacle.bounds[3])) @@ -140,7 +140,7 @@ def _verified_candidates( seeds: Iterable[PathSeed], ) -> Iterator[tuple[PathSeed, BaseGeometry, tuple[ComponentResult, ...]]]: for seed in seeds: - path = materialize_path_seed(seed, start=net.start, net_width=net.width, search=search, clearance=world.clearance, bounds=board.bounds) + path = materialize_path_seed(seed, start=net.start, net_width=net.width, search=search, clearance=world.clearance) if not path or path[-1].end_port != net.target or not world.verify_path_report(net.net_id, path).is_valid: continue footprint = union_all([polygon for component in path for polygon in component.physical_geometry]) @@ -156,8 +156,10 @@ def compact_port_seed_set(problem: RoutingProblem, search: SearchOptions) -> dic return None if any(net.start.r != 0 or net.target.r != 0 or not 0 < net.target.x - net.start.x <= 4 * radii[-1] for net in problem.nets): return None + world = RoutingWorld(clearance=problem.clearance, safety_zone_radius=problem.safety_zone_radius) + for obstacle in problem.static_obstacles: + world.add_static_obstacle(obstacle) board = box(*problem.bounds) - world = RoutingWorld.from_problem(problem, board=board) candidates = {} for net in problem.nets: jogs = islice(_candidate_jogs(net, problem, search, radii), 512) @@ -207,8 +209,10 @@ def short_shift_seed_set(problem: RoutingProblem, search: SearchOptions, score: if not all(seeds_by_net): return None + world = RoutingWorld(clearance=problem.clearance, safety_zone_radius=problem.safety_zone_radius) + for obstacle in problem.static_obstacles: + world.add_static_obstacle(obstacle) board = box(*problem.bounds) - world = RoutingWorld.from_problem(problem, board=board) candidates = {} for net, seeds in zip(problem.nets, seeds_by_net, strict=True): ranked = [ diff --git a/inire/router/_congestion_policy.py b/inire/router/_congestion_policy.py index cf8c9f1..0e9d2b9 100644 --- a/inire/router/_congestion_policy.py +++ b/inire/router/_congestion_policy.py @@ -3,7 +3,7 @@ from __future__ import annotations from dataclasses import dataclass -from typing import TYPE_CHECKING, TypeGuard +from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import Iterable, Mapping, Sequence, Set @@ -64,10 +64,6 @@ def all_results_reached_target(ordered_net_ids: Sequence[str], results: Mapping[ return len(results) == len(ordered_net_ids) and all(result.reached_target for result in results.values()) -def can_reserve(result: RoutingResult | None) -> TypeGuard[RoutingResult]: - return bool(result and result.path and result.reached_target and not result.report.intrinsic_collision_count) - - def reroute_plan( ordered_net_ids: Sequence[str], reroute_net_ids: Set[str], @@ -91,9 +87,7 @@ def reroute_plan( 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] - return routed_net_ids, { - net_id for net_id in heaviest if recent_attempt_work.get(net_id, 0) >= 200 and not results[net_id].report.intrinsic_collision_count - } + return routed_net_ids, {net_id for net_id in heaviest if recent_attempt_work.get(net_id, 0) >= 200} def next_reroute_net_ids( @@ -103,7 +97,9 @@ def next_reroute_net_ids( all_reached_target: bool, has_corridors: bool, ) -> set[str]: - if has_corridors or (all_reached_target and 0 < len(review.conflict_edges) <= 3): + if all_reached_target and 0 < len(review.conflict_edges) <= 3: + return set(review.conflicting_nets) + if has_corridors: return set(ordered_net_ids).difference(review.completed_net_ids) return set(ordered_net_ids) diff --git a/inire/router/_pair_local.py b/inire/router/_pair_local.py index 74650a5..08a5d88 100644 --- a/inire/router/_pair_local.py +++ b/inire/router/_pair_local.py @@ -2,18 +2,18 @@ from __future__ import annotations -from dataclasses import replace from typing import TYPE_CHECKING from inire.geometry.collision import RoutingWorld +from inire.model import RoutingProblem from inire.results import RoutingResult from inire.router._astar_types import AStarContext, AStarMetrics, SearchRunConfig -from inire.router._congestion_policy import can_reserve from inire.router._search import incumbent_guidance, route_astar -from inire.router.cost import CostEvaluator, proximity_map +from inire.router.cost import CostEvaluator +from inire.router.danger_map import DangerMap if TYPE_CHECKING: - from collections.abc import Callable, Mapping, Set + from collections.abc import Mapping, Set from inire.model import NetSpec @@ -23,41 +23,42 @@ def _build_pair_local_context( ordered_nets: tuple[NetSpec, ...], incumbent_results: Mapping[str, RoutingResult], pair_order: tuple[str, str], + *, + lock_partial_paths: bool, ) -> AStarContext: problem = context.problem live_world = context.cost_evaluator.collision_engine - static_entries = tuple(live_world.iter_static_entries()) - world = RoutingWorld( - clearance=live_world.clearance, safety_zone_radius=live_world.safety_zone_radius, board=live_world.board, - self_clearance=live_world.self_clearance, - ) - for obstacle, owner in static_entries: - world.add_static_obstacle(obstacle, owner=owner) + static_obstacles = tuple(live_world.iter_static_geometries()) + world = RoutingWorld(clearance=live_world.clearance, safety_zone_radius=live_world.safety_zone_radius, board=live_world.board) + for obstacle in static_obstacles: + world.add_static_obstacle(obstacle) for net in ordered_nets: if net.net_id in pair_order: continue result = incumbent_results.get(net.net_id) - if not can_reserve(result): + if result is None or not result.path or (not lock_partial_paths and not result.reached_target): continue for component in result.path: for polygon in component.physical_geometry: - world.add_static_obstacle(polygon, owner=net.net_id) + world.add_static_obstacle(polygon) - danger_map = proximity_map(problem, context.options.search.proximity_range) + danger_map = DangerMap(bounds=problem.bounds) if context.options.objective.danger_weight: - danger_map.precompute([obstacle for obstacle, _ in static_entries]) + danger_map.precompute(list(static_obstacles)) evaluator = CostEvaluator.from_objective( world, danger_map, context.options.objective, greedy_h_weight=context.cost_evaluator.greedy_h_weight, - distance_heuristic_weight=context.cost_evaluator.distance_heuristic_weight, ) return AStarContext( evaluator, - replace( - problem, nets=ordered_nets, initial_paths={}, - static_obstacles=tuple(obstacle for obstacle, owner in static_entries if owner is None), + RoutingProblem( + bounds=problem.bounds, + nets=ordered_nets, + static_obstacles=static_obstacles, + clearance=problem.clearance, + safety_zone_radius=problem.safety_zone_radius, ), context.options, metrics=AStarMetrics(), @@ -71,10 +72,10 @@ def search_pair_candidate( pair_order: tuple[str, str], *, needs_self_collision_check: Set[str], - expired: Callable[[], bool] | None = None, + lock_partial_paths: bool, ) -> tuple[dict[str, RoutingResult], int] | None: """Return both locally verified replacements and their search work.""" - local = _build_pair_local_context(context, ordered_nets, incumbent_results, pair_order) + local = _build_pair_local_context(context, ordered_nets, incumbent_results, pair_order, lock_partial_paths=lock_partial_paths) world = local.cost_evaluator.collision_engine options = local.options nets = {net.net_id: net for net in ordered_nets} @@ -90,7 +91,6 @@ def search_pair_candidate( guidance_seed=guidance_seed, guidance_bonus=guidance_bonus, node_limit=options.search.node_limit, - expired=expired, ) path = route_astar( net.start, @@ -110,7 +110,7 @@ def search_pair_candidate( replacements[net_id] = RoutingResult(net_id, tuple(path), reached_target=True, report=report) for component in path: for polygon in component.physical_geometry: - world.add_static_obstacle(polygon, owner=net_id) + world.add_static_obstacle(polygon) local.clear_static_caches() return replacements, local.metrics.total_nodes_expanded diff --git a/inire/router/_perimeter.py b/inire/router/_perimeter.py index 2306a34..d800e7d 100644 --- a/inire/router/_perimeter.py +++ b/inire/router/_perimeter.py @@ -48,7 +48,7 @@ def residual_dogleg_candidates(problem: RoutingProblem, search: SearchOptions) - pad = problem.clearance + half_width _, floor_y, _, ceiling_y = extent(problem.bounds) obstacles = [] - for shape in problem._blocking_polygons: + for shape in problem.static_obstacles: if shape.is_empty: continue a, b, c, d = extent(shape.bounds) @@ -126,8 +126,7 @@ def bundle_turnaround_candidates( def points_for(net: NetSpec) -> tuple[XY, ...]: path = materialize_path_seed( - proposal.initial_paths[net.net_id], start=net.start, net_width=net.width, search=search, clearance=problem.clearance, - bounds=problem.bounds, + proposal.initial_paths[net.net_id], start=net.start, net_width=net.width, search=search, clearance=problem.clearance ) return tuple((round(x), round(y)) for x, y in export_waypoints(path or ())) @@ -238,7 +237,7 @@ def perimeter_detour_candidates(problem: RoutingProblem, search: SearchOptions) bend = min(search.bend_radii, default=0.0) if problem.initial_paths or physical_geometry != "arc" or not isfinite(bend) or bend <= 0 or bend != int(bend): return - obstacles = tuple(shape.bounds for shape in problem._blocking_polygons if not shape.is_empty) + obstacles = tuple(shape.bounds for shape in problem.static_obstacles if not shape.is_empty) radius = int(bend) for net in problem.nets: if net.start.r != 0 or net.target.r != 0: diff --git a/inire/router/_route_traces.py b/inire/router/_route_traces.py index 46f74ec..0abef8b 100644 --- a/inire/router/_route_traces.py +++ b/inire/router/_route_traces.py @@ -67,17 +67,14 @@ def conflict_trace_entry( def complete_final_conflict_trace(run: RoutingRunResult) -> RoutingRunResult: - """Sync the selected final trace with the assembled results.""" + """Include routes supplied by other workers in the selected final trace.""" if not run.conflict_trace or run.conflict_trace[-1].stage != "final": return run final = run.conflict_trace[-1] traced = {trace.net_id: trace for trace in final.nets} for net_id, result in run.results_by_net.items(): - entry = traced.get(net_id) - if entry is None: + if net_id not in traced: traced[net_id] = NetConflictTrace(net_id, result.outcome, result.reached_target, result.report) - elif entry.report != result.report: - traced[net_id] = replace(entry, outcome=result.outcome, reached_target=result.reached_target, report=result.report) completed = tuple(sorted(net_id for net_id, result in run.results_by_net.items() if result.is_valid)) final = replace(final, completed_net_ids=completed, nets=tuple(traced.values())) return replace(run, conflict_trace=(*run.conflict_trace[:-1], final)) diff --git a/inire/router/_router.py b/inire/router/_router.py index 90b830a..dcedf52 100644 --- a/inire/router/_router.py +++ b/inire/router/_router.py @@ -3,8 +3,7 @@ from __future__ import annotations import random import time from contextlib import contextmanager, nullcontext -from dataclasses import dataclass, field, replace -from functools import partial +from dataclasses import dataclass, field from typing import TYPE_CHECKING from shapely import shortest_line @@ -26,7 +25,6 @@ from inire.router._astar_types import AStarContext, AStarMetrics, FrontierTraceC from inire.router._congestion_policy import ( IterationReview as _IterationReview, all_results_reached_target, - can_reserve, next_reroute_net_ids, ordered_nets, reached_pair_local_plateau, @@ -36,8 +34,8 @@ from inire.router._congestion_policy import ( ) from inire.router._pair_local import search_pair_candidate from inire.router._route_traces import conflict_trace_entry, iteration_trace_entry, net_attempt_trace -from inire.router._search import incumbent_guidance, path_guidance, route_astar -from inire.router._seed_materialization import materialize_path_seed, SeedMaterializationError, seed_width_error +from inire.router._search import incumbent_guidance, route_astar +from inire.router._seed_materialization import materialize_path_seed from inire.router.refiner import PathRefiner if TYPE_CHECKING: @@ -64,17 +62,13 @@ class _RoutingState: initial_paths: dict[str, tuple[ComponentResult, ...]] | None accumulated_expanded_nodes: list[tuple[int, int, int]] best_results: dict[str, RoutingResult] - best_is_indexed: bool + best_is_installed: bool best_review: _IterationReview | None 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) - seed_errors: dict[str, str] = field(default_factory=dict) - terminal_errors: dict[str, str] = field(default_factory=dict) - replay_details: dict[str, PathVerificationDetail] | None = None - timed_out: bool = False @property def best_conflict_edges(self) -> int | None: @@ -116,7 +110,6 @@ class PathFinder: "pre_pair_frontier_trace", "iteration_trace", "topology_report", - "iteration_offset", ) def __init__( @@ -137,7 +130,6 @@ class PathFinder: self.pre_pair_frontier_trace: PrePairFrontierTraceEntry | None = None self.iteration_trace: list[IterationTraceEntry] = [] self.topology_report: TopologyReport | None = None - self.iteration_offset = 0 def _metric_total(self, metric_name: str) -> int: return int(getattr(self.metrics, f"total_{metric_name}")) @@ -148,6 +140,9 @@ class PathFinder: def _metric_deltas(self, before: dict[str, int], after: dict[str, int]) -> dict[str, int]: return {metric_name: after[metric_name] - before[metric_name] for metric_name in before} + def _has_incumbent_fallback(self, result: RoutingResult | None) -> bool: + return bool(result and result.reached_target and result.path) + def _restore_incumbent_fallback( self, net_id: str, @@ -155,21 +150,21 @@ class PathFinder: guidance_seed_present: bool, ) -> tuple[RoutingResult, bool]: self.metrics.total_late_phase_capped_fallbacks += 1 - self._add_route(net_id, result.path) + self._install_path(net_id, result.path) return result, guidance_seed_present - def _add_route(self, net_id: str, path: Sequence[ComponentResult]) -> None: - self.context.cost_evaluator.collision_engine.add_route(net_id, path) + def _install_path(self, net_id: str, path: Sequence[ComponentResult]) -> None: + self.context.cost_evaluator.collision_engine.install_path(net_id, path) @contextmanager - def _temporary_path_reservations(self) -> Iterator[Callable[[str, Sequence[ComponentResult]], None]]: + def _temporary_path_reservations(self) -> Iterator[Callable[[Sequence[ComponentResult]], None]]: world = self.context.cost_evaluator.collision_engine temporary: list[int] = [] - def reserve(net_id: str, path: Sequence[ComponentResult]) -> None: + def reserve(path: Sequence[ComponentResult]) -> None: for component in path: for shape in component.physical_geometry: - temporary.append(world.add_static_obstacle(shape, owner=net_id)) + temporary.append(world.add_static_obstacle(shape)) try: yield reserve @@ -184,20 +179,8 @@ class PathFinder: ) -> dict[str, tuple[ComponentResult, ...]]: greedy_paths: dict[str, tuple[ComponentResult, ...]] = {} greedy_node_limit = min(self.context.options.search.node_limit, 2000) - world = self.context.cost_evaluator.collision_engine - existing = state.initial_paths or {} - expired = partial(self._expired, state) with self._temporary_path_reservations() as reserve: - for net_id, path in existing.items(): - if path[-1].end_port == state.net_specs[net_id].target and world.verify_path_report(net_id, path).is_valid: - reserve(net_id, path) - if existing: - self.context.clear_static_caches() for net_id in state.ordered_net_ids: - if expired(): - break - if net_id in existing or net_id in state.terminal_errors: - continue net = state.net_specs[net_id] h_start = self.context.cost_evaluator.h_manhattan( net.start, @@ -214,7 +197,6 @@ class PathFinder: node_limit=greedy_node_limit, corridor=candidates[0] if candidates else None, corridor_strength=self.context.options.topology.guide_strength, - expired=expired, ) path = route_astar( net.start, @@ -225,11 +207,11 @@ class PathFinder: net_id=net_id, config=run_config, ) - if not path or world.verify_path_report(net_id, path).intrinsic_collision_count: + if not path: continue self.metrics.total_warm_start_paths_built += 1 greedy_paths[net_id] = tuple(path) - reserve(net_id, path) + reserve(path) self.context.clear_static_caches() return greedy_paths @@ -238,17 +220,12 @@ class PathFinder: world = self.context.cost_evaluator.collision_engine existing = state.initial_paths or {} seeds: dict[str, tuple[ComponentResult, ...]] = {} - preserved = set() - expired = partial(self._expired, state) with self._temporary_path_reservations() as reserve: for net_id, path in existing.items(): if path and path[-1].end_port == state.net_specs[net_id].target and world.verify_path_report(net_id, path).is_valid: - reserve(net_id, path) - preserved.add(net_id) + reserve(path) for net_id in state.ordered_net_ids: - if expired(): - break - if net_id in preserved or net_id in state.terminal_errors: + if net_id in existing: continue net = state.net_specs[net_id] candidates = state.corridors.get(net_id, ()) @@ -267,14 +244,13 @@ class PathFinder: self_collision_check=True, corridor=corridor, restrict_to_corridor=True, - expired=expired, ) path = route_astar(net.start, net.target, net.width, self.context, metrics=self.metrics, net_id=net_id, config=config) remaining -= self.metrics.nodes_expanded if path and path[-1].end_port == net.target and world.verify_path_report(net_id, path).is_valid: seeds[net_id] = tuple(path) self.metrics.total_warm_start_paths_built += 1 - reserve(net_id, path) + reserve(path) break return seeds @@ -295,7 +271,7 @@ class PathFinder: corridors = plan_corridors( self.context.problem.bounds, world.iter_static_geometries(), - [state.net_specs[net_id] for net_id in state.ordered_net_ids if net_id not in state.terminal_errors], + [state.net_specs[net_id] for net_id in state.ordered_net_ids], clearance=world.clearance, bend_radius=min(self.context.options.search.bend_radii, default=0.0), limit=topology.max_corridors, @@ -311,9 +287,10 @@ class PathFinder: seed_nodes_expanded=self.metrics.total_nodes_expanded - before, ) - def _prepare_state(self, corridors: dict[str, tuple[Corridor, ...]] | None = None, *, started_at: float | None = None) -> _RoutingState: + def _prepare_state(self, corridors: dict[str, tuple[Corridor, ...]] | None = None) -> _RoutingState: problem = self.context.problem congestion = self.context.options.congestion + initial_paths = self._materialize_problem_initial_paths() net_specs = {net.net_id: net for net in problem.nets} num_nets = len(net_specs) state = _RoutingState( @@ -321,50 +298,23 @@ class PathFinder: ordered_net_ids=[net.net_id for net in ordered_nets(net_specs.values(), congestion.net_order)], results={}, needs_self_collision_check=set(), - start_time=time.monotonic() if started_at is None else started_at, + start_time=time.monotonic(), timeout_s=max(60.0, 10.0 * num_nets * congestion.max_iterations), - initial_paths=None, + initial_paths=initial_paths, accumulated_expanded_nodes=[], best_results={}, - best_is_indexed=False, + best_is_installed=False, best_review=None, last_conflict_edge_count=0, repeated_conflict_count=0, recent_attempt_work={}, pre_pair_candidate=None, ) - self._materialize_problem_initial_paths(state) - if congestion.max_iterations: - world = self.context.cost_evaluator.collision_engine - search = self.context.options.search - _, physical_bend = resolve_bend_geometry(search) - custom_bend_radius = max(search.bend_radii, default=0.0) if physical_bend != "arc" else 0.0 - initial_paths = state.initial_paths or {} - for net_id, net in net_specs.items(): - # Custom moves can have faces offset from the nominal port plane. - if search.node_limit and (custom_bend_radius >= net.width / 2 or search.has_applicable_sbend_outline((net.width,))): - continue - path = initial_paths.get(net_id) - materialized_ports = (path[0].start_port, path[-1].end_port) if path else () - for name, port in (("start", net.start), ("target", net.target)): - # Verification checks the physical faces of a materialized seed. - if port in materialized_ports: - continue - issue = world.terminal_issue(port, net.width) - if issue is not None: - state.terminal_errors[net_id] = f"{name} port {port.as_tuple()} {issue}" - break - if congestion.max_iterations <= 0 or (self.context.options.search.node_limit <= 0 and self.context.options.topology.mode != "bundle"): - return state - if self._expired(state): + if congestion.max_iterations <= 0: return state self._prepare_topology(state, corridors) - if self._expired(state): - return state - if congestion.warm_start_enabled and len(state.initial_paths or ()) < len(net_specs): - greedy = self._build_greedy_warm_start_paths(state) - if greedy: - state.initial_paths = {**(state.initial_paths or {}), **greedy} + if state.initial_paths is None and congestion.warm_start_enabled: + state.initial_paths = self._build_greedy_warm_start_paths(state) if state.corridors and state.initial_paths: world = self.context.cost_evaluator.collision_engine for net_id, path in state.initial_paths.items(): @@ -372,71 +322,54 @@ class PathFinder: continue report = world.verify_path_report(net_id, path) if report.is_valid: - self._add_route(net_id, path) + self._install_path(net_id, path) state.results[net_id] = RoutingResult(net_id, path, reached_target=True, report=report) return state - def _expired(self, state: _RoutingState) -> bool: - if not state.timed_out and time.monotonic() - state.start_time >= state.timeout_s: - state.timed_out = True - self.metrics.total_timeout_events += 1 - return state.timed_out - - def _materialize_problem_initial_paths(self, state: _RoutingState) -> None: + def _materialize_problem_initial_paths(self) -> dict[str, tuple[ComponentResult, ...]] | None: if not self.context.problem.initial_paths: - return + return None search = self.context.options.search + net_specs = {net.net_id: net for net in self.context.problem.nets} initial_paths: dict[str, tuple[ComponentResult, ...]] = {} for net_id, seed in self.context.problem.initial_paths.items(): - if net_id not in state.net_specs: + if net_id not in net_specs: raise ValueError(f"Initial path provided for unknown net: {net_id}") error = search.seed_geometry_error(seed) if error is not None: raise ValueError(f"Initial path for {net_id!r} {error}") - net = state.net_specs[net_id] - try: - path = materialize_path_seed( - seed, - start=net.start, - net_width=net.width, - search=search, - diagnostic=True, - clearance=self.context.cost_evaluator.collision_engine.clearance, - ) - except SeedMaterializationError as exc: - state.seed_errors[net_id] = f"Initial path for {net_id!r} {exc}" - continue - if path is None: - state.seed_errors[net_id] = f"Initial path for {net_id!r} {seed_width_error(seed, net.width)}" - elif path: + net = net_specs[net_id] + path = materialize_path_seed( + seed, + start=net.start, + net_width=net.width, + search=search, + clearance=self.context.cost_evaluator.collision_engine.clearance, + ) + if path is not None: initial_paths[net_id] = path - state.initial_paths = initial_paths or None + return initial_paths or None - def _replace_indexed_routes( + def _replace_installed_paths( self, state: _RoutingState, results: dict[str, RoutingResult], *, net_ids: Sequence[str] | None = None ) -> None: - state.replay_details = None ordered_net_ids = state.ordered_net_ids if net_ids is None else net_ids for net_id in ordered_net_ids: self.context.cost_evaluator.collision_engine.remove_path(net_id) for net_id in ordered_net_ids: result = results.get(net_id) - if can_reserve(result): - self._add_route(net_id, result.path) + 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 - details_by_net = state.replay_details - if details_by_net is None: - 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, - count_iteration_metrics=False, - ) - else: - review = review_verified_results(state.results, details_by_net) + 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, + count_iteration_metrics=False, + ) if diagnostics.capture_conflict_trace: self._capture_conflict_trace_entry( state, @@ -466,7 +399,7 @@ class PathFinder: if not state.best_results: return state.results = dict(state.best_results) - self._replace_indexed_routes(state, state.results) + self._replace_installed_paths(state, state.results) def _capture_conflict_trace_entry( self, @@ -556,7 +489,7 @@ class PathFinder: yield scratch_metrics finally: if path: - self._add_route(net_id, path) + self._install_path(net_id, path) finally: context.metrics, world.metrics = context_metrics, world_metrics if danger_map is not None: @@ -593,8 +526,7 @@ class PathFinder: ) net = state.net_specs[net_id] - installed_path = result.path if can_reserve(result) else () - with self._frontier_replay(net_id, installed_path) as scratch_metrics: + with self._frontier_replay(net_id, result.path) as scratch_metrics: route_astar( net.start, net.target, @@ -636,7 +568,6 @@ class PathFinder: self.metrics.total_iteration_reverify_calls += 1 analyzed_results = dict(results) details_by_net: dict[str, PathVerificationDetail] = {} - replay = self.context.options.search.node_limit == 0 for net_id in ordered_net_ids: result = results.get(net_id) @@ -649,8 +580,6 @@ class PathFinder: net_id, result.path, capture_component_conflicts=capture_component_conflicts, - include_invalid_dynamic=False, - geometry_report=result.report if replay else None, ) details_by_net[net_id] = detail analyzed_results[net_id] = RoutingResult( @@ -826,7 +755,7 @@ class PathFinder: 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_indexed_routes(state, candidate_results, net_ids=changed_net_ids) + self._replace_installed_paths(state, candidate_results, net_ids=changed_net_ids) candidate_results, _, candidate_review = self._analyze_results( state.ordered_net_ids, candidate_results, @@ -843,7 +772,7 @@ class PathFinder: state.results = candidate_results return True, candidate_review - self._replace_indexed_routes(state, incumbent_results, net_ids=changed_net_ids) + self._replace_installed_paths(state, incumbent_results, net_ids=changed_net_ids) return False, incumbent_review def _run_pair_local_target( @@ -856,8 +785,6 @@ class PathFinder: 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])): - if self._expired(state): - break self.metrics.total_pair_local_search_attempts += 1 candidate = search_pair_candidate( self.context, @@ -865,7 +792,7 @@ class PathFinder: incumbent_results, pair_order, needs_self_collision_check=state.needs_self_collision_check, - expired=partial(self._expired, state), + lock_partial_paths=not state.corridors, ) if candidate is None: continue @@ -882,17 +809,12 @@ class PathFinder: return review def _run_pair_local_search(self, state: _RoutingState, review: _IterationReview) -> None: - if not self.context.options.search.node_limit: - return targets = self._collect_pair_local_targets(state, state.results, review) if not targets: return - initial_edges = len(review.conflict_edges) for target in targets[:2]: review = self._run_pair_local_target(state, target, review) - if len(targets) > 2 and len(review.conflict_edges) == initial_edges - 2: - self._run_pair_local_target(state, targets[2], review) def _route_net_once( self, @@ -913,25 +835,9 @@ class PathFinder: self.context.cost_evaluator.collision_engine.remove_path(net_id) guidance_seed_present = False - terminal_error = state.terminal_errors.get(net_id) - initial_path = state.initial_paths.get(net_id) if state.initial_paths else None - initial_arrives = bool(initial_path and initial_path[-1].end_port == net.target) - seed_intrinsic_ok = ( - initial_arrives and initial_path is not None - and ( - not search.node_limit or self.context.options.topology.mode == "off" - or not self.context.cost_evaluator.collision_engine.verify_path_details( - net_id, initial_path, include_invalid_dynamic=False, - ).report.intrinsic_collision_count - ) - ) if iteration == 0 else False - if terminal_error: - path: Sequence[ComponentResult] | None = initial_path - elif iteration == 0 and initial_path is not None and (seed_intrinsic_ok or search.node_limit <= 0): + if iteration == 0 and state.initial_paths and net_id in state.initial_paths: self.metrics.total_warm_start_paths_used += 1 - path = initial_path - elif search.node_limit == 0: - path = None + path: Sequence[ComponentResult] | None = state.initial_paths[net_id] else: coll_model, _ = resolve_bend_geometry(search) skip_congestion = False @@ -940,18 +846,13 @@ class PathFinder: skip_congestion = True if coll_model == "arc": coll_model = "clipped_bbox" - if iteration > 0: + elif iteration > 0: guidance_seed, guidance_bonus = incumbent_guidance( state.results.get(net_id), self.context.options.objective.bend_penalty ) - use_prefix = not guidance_seed and bool(initial_path and not initial_arrives) - if use_prefix and initial_path: - guidance_seed, guidance_bonus = path_guidance(initial_path, self.context.options.objective.bend_penalty) - if iteration == 0: - self.metrics.total_warm_start_paths_used += 1 - guidance_seed_present = guidance_seed is not None + guidance_seed_present = guidance_seed is not None - if node_limit_override is not None and can_reserve(incumbent_fallback): + if node_limit_override is not None and self._has_incumbent_fallback(incumbent_fallback): return self._restore_incumbent_fallback(net_id, incumbent_fallback, guidance_seed_present) corridors = state.corridors.get(net_id, ()) @@ -962,14 +863,12 @@ class PathFinder: store_expanded=diagnostics.capture_expanded, guidance_seed=guidance_seed, guidance_bonus=guidance_bonus, - propose_guidance_moves=use_prefix, skip_congestion=skip_congestion, self_collision_check=(net_id in state.needs_self_collision_check), node_limit=search.node_limit if node_limit_override is None else node_limit_override, corridor=corridors[iteration] if iteration < len(corridors) else None, corridor_strength=self.context.options.topology.guide_strength / (iteration + 1), hard_congestion=bool(state.corridors) and iteration == 0, - expired=partial(self._expired, state), ) path = route_astar( net.start, @@ -983,40 +882,31 @@ class PathFinder: if diagnostics.capture_expanded and self.metrics.last_expanded_nodes: state.accumulated_expanded_nodes.extend(self.metrics.last_expanded_nodes) - if ( - (initial_arrives and iteration == 0 and (not path or path[-1].end_port != net.target)) - or (not path and use_prefix) - ): - path = initial_path if not path: - if can_reserve(incumbent_fallback): + if self._has_incumbent_fallback(incumbent_fallback): return self._restore_incumbent_fallback(net_id, incumbent_fallback, guidance_seed_present) - return RoutingResult(net_id=net_id, path=(), report=RoutingReport(terminal_error=terminal_error)), guidance_seed_present + return RoutingResult(net_id=net_id, path=(), reached_target=False), guidance_seed_present reached_target = path[-1].end_port == net.target - if not reached_target and can_reserve(incumbent_fallback): + if not reached_target and self._has_incumbent_fallback(incumbent_fallback): return self._restore_incumbent_fallback(net_id, incumbent_fallback, guidance_seed_present) if reached_target: self.metrics.total_nets_reached_target += 1 - world = self.context.cost_evaluator.collision_engine - if search.node_limit: - report = world.verify_path_details(net_id, path, include_invalid_dynamic=False).report - else: - report = world.verify_path_geometry(path) - if not report.intrinsic_collision_count: - self._add_route(net_id, path) + report = None + if reached_target or not state.corridors: + self._install_path(net_id, path) + if reached_target: + report = self.context.cost_evaluator.collision_engine.verify_path_report(net_id, path) if report.self_collision_count > 0: state.needs_self_collision_check.add(net_id) - else: - report = RoutingReport(terminal_error=terminal_error) return ( RoutingResult( net_id=net_id, path=tuple(path), reached_target=reached_target, - report=report, + report=RoutingReport() if report is None else report, ), guidance_seed_present, ) @@ -1036,7 +926,6 @@ class PathFinder: iteration_seed = (congestion.seed + iteration) if congestion.seed is not None else None random.Random(iteration_seed).shuffle(state.ordered_net_ids) - trace_iteration = self.iteration_offset + iteration iteration_penalty = self.context.congestion_penalty routed_net_ids, capped_net_ids = reroute_plan( state.ordered_net_ids, @@ -1054,10 +943,11 @@ class PathFinder: iteration_before = self._capture_metric_totals(_ITERATION_TRACE_TOTALS) for net_id in routed_net_ids: - if self._expired(state): - break + if time.monotonic() - state.start_time > state.timeout_s: + self.metrics.total_timeout_events += 1 + return None - work_before = self.metrics.reroute_work + 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) node_limit_override = None @@ -1073,7 +963,7 @@ class PathFinder: incumbent_fallback=incumbent_fallback, ) state.results[net_id] = result - work_after = self.metrics.reroute_work + 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) @@ -1082,14 +972,12 @@ class PathFinder: net_attempt_trace(net_id, deltas, reached_target=result.reached_target, guidance_seed_present=guidance_seed_present) ) - if self._expired(state) and not state.results: - return None 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=trace_iteration, + iteration=iteration, reroute_net_ids=reroute_net_ids, routed_net_ids=routed_net_ids, attempt_traces=attempt_traces, @@ -1099,32 +987,24 @@ class PathFinder: iteration_after = self._capture_metric_totals(_ITERATION_TRACE_TOTALS) deltas = self._metric_deltas(iteration_before, iteration_after) self.iteration_trace.append( - iteration_trace_entry(trace_iteration, iteration_penalty, routed_net_ids, review, deltas, attempt_traces) + iteration_trace_entry(iteration, iteration_penalty, routed_net_ids, review, deltas, attempt_traces) ) - if iteration_callback and not state.timed_out: - iteration_callback(trace_iteration, dict(state.results)) + if iteration_callback: + iteration_callback(iteration, dict(state.results)) return review def _reverify_iteration_results(self, state: _RoutingState) -> _IterationReview: - diagnostics = self.context.options.diagnostics - replay = self.context.options.search.node_limit == 0 and not state.timed_out - capture_conflicts = diagnostics.capture_conflict_trace or ( - replay and (diagnostics.capture_frontier_trace or diagnostics.capture_pre_pair_frontier_trace) - ) state.results, details_by_net, review = self._analyze_results( state.ordered_net_ids, state.results, - capture_component_conflicts=capture_conflicts, + capture_component_conflicts=self.context.options.diagnostics.capture_conflict_trace, count_iteration_metrics=True, ) - if replay: - # Replay has one iteration. These details describe the whole indexed layout. - state.replay_details = details_by_net self._capture_conflict_trace_entry( state, stage="iteration", - iteration=self.iteration_offset + self.metrics.total_route_iterations - 1, + iteration=self.metrics.total_route_iterations - 1, results=state.results, details_by_net=details_by_net, review=review, @@ -1138,8 +1018,7 @@ class PathFinder: ) -> bool: congestion = self.context.options.congestion reroute_net_ids = set(state.ordered_net_ids) - rounds = congestion.max_iterations if self.context.options.search.node_limit else min(1, congestion.max_iterations) - for iteration in range(rounds): + for iteration in range(congestion.max_iterations): review = self._run_iteration( state, iteration, @@ -1149,9 +1028,7 @@ class PathFinder: if review is None: return True improved = self._update_best_iteration(state, review) - state.best_is_indexed = improved - if state.timed_out: - return True + state.best_is_installed = improved if not any( result.outcome in {"colliding", "partial", "unroutable"} for result in state.results.values() @@ -1174,77 +1051,48 @@ class PathFinder: return False def _refine_results(self, state: _RoutingState) -> None: - options = self.context.options - if not options.refinement.enabled or not state.results: + if not self.context.options.refinement.enabled or not state.results: return - replay = options.search.node_limit == 0 - proximity_ready = not replay - world = self.context.cost_evaluator.collision_engine for net_id in state.ordered_net_ids: - if self._expired(state): - break result = state.results.get(net_id) if not result or not result.is_valid or not self.refiner.has_refinement_bends(result.path): continue - if not proximity_ready: - evaluator = self.context.cost_evaluator - weights = options.refinement.objective or options.objective - if evaluator.danger_map is not None and weights.danger_weight: - evaluator.danger_map.precompute(self.context.problem._blocking_polygons) - proximity_ready = True net = state.net_specs[net_id] self.metrics.total_refine_path_calls += 1 - world.remove_path(net_id) - refined_path = tuple(self.refiner.refine_path(net_id, net.start, net.width, result.path)) - self._add_route(net_id, refined_path) - report = result.report - if replay and refined_path != result.path: - state.replay_details = None - report = world.verify_path_geometry(refined_path) + self.context.cost_evaluator.collision_engine.remove_path(net_id) + refined_path = self.refiner.refine_path(net_id, net.start, net.width, result.path) + self._install_path(net_id, refined_path) + # Defer full verification until _verify_results() so we do not + # verify the same refined path twice in one route_all() call. state.results[net_id] = RoutingResult( net_id=net_id, - path=refined_path, + path=tuple(refined_path), reached_target=result.reached_target, - report=report, + report=result.report, ) def _verify_results(self, state: _RoutingState) -> tuple[dict[str, RoutingResult], dict[str, PathVerificationDetail]]: diagnostics = self.context.options.diagnostics final_results: dict[str, RoutingResult] = {} details_by_net: dict[str, PathVerificationDetail] = {} - replay = self.context.options.search.node_limit == 0 - replay_details = state.replay_details or {} for net in self.context.problem.nets: result = state.results.get(net.net_id) - seed_error = state.seed_errors.get(net.net_id) if self.context.options.congestion.max_iterations else None - terminal_error = state.terminal_errors.get(net.net_id) if not result or not result.path: - final_results[net.net_id] = RoutingResult( - net_id=net.net_id, path=(), reached_target=False, - report=RoutingReport(invalid_geometry=seed_error is not None, seed_error=seed_error, terminal_error=terminal_error), - ) + final_results[net.net_id] = RoutingResult(net_id=net.net_id, path=(), reached_target=False) continue - detail = replay_details.get(net.net_id) - if detail is None: - capture_conflicts = diagnostics.capture_conflict_trace or (diagnostics.capture_frontier_trace and result.reached_target) - detail = self.context.cost_evaluator.collision_engine.verify_path_details( - net.net_id, - result.path, - capture_component_conflicts=capture_conflicts, - include_invalid_dynamic=False, - geometry_report=result.report if replay and result.reached_target else None, - ) - report = detail.report - if seed_error or terminal_error: - report = replace(report, seed_error=seed_error, terminal_error=terminal_error) - detail = replace(detail, report=report) + capture_conflicts = diagnostics.capture_conflict_trace or (diagnostics.capture_frontier_trace and result.reached_target) + detail = self.context.cost_evaluator.collision_engine.verify_path_details( + net.net_id, + result.path, + capture_component_conflicts=capture_conflicts, + ) details_by_net[net.net_id] = detail final_results[net.net_id] = RoutingResult( net_id=net.net_id, path=result.path, reached_target=result.reached_target, - report=report, + report=detail.report, ) if diagnostics.capture_conflict_trace: review = review_verified_results(final_results, details_by_net) @@ -1264,10 +1112,7 @@ class PathFinder: iteration_callback: Callable[[int, dict[str, RoutingResult]], None] | None = None, phase_timer: PhaseTimer | None = None, corridors: dict[str, tuple[Corridor, ...]] | None = None, - started_at: float | None = None, - iteration_offset: int = 0, ) -> dict[str, RoutingResult]: - self.iteration_offset = iteration_offset self.context.congestion_penalty = self.context.options.congestion.base_penalty self.accumulated_expanded_nodes = [] self.conflict_trace = [] @@ -1278,12 +1123,11 @@ class PathFinder: self.metrics.reset_totals() self.metrics.reset_per_route() - state = self._prepare_state(corridors, started_at=started_at) - replay = self.context.options.search.node_limit == 0 - timed_out = self._run_iterations(state, None if replay else iteration_callback) + 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 can leave the index out of sync with the saved results. - best_is_live = not timed_out and state.best_is_indexed + best_is_live = not timed_out and state.best_is_installed if not best_is_live: self._restore_best_iteration(state) @@ -1295,13 +1139,10 @@ class PathFinder: review = self._review_restored_best(state) if not timed_out: self._run_pair_local_search(state, review) - if not timed_out and not self._expired(state): + if not timed_out: 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(): final_results, details_by_net = self._verify_results(state) - if not self._expired(state): - self._capture_frontier_trace(state, final_results, details_by_net) - if replay and iteration_callback is not None and not timed_out and self.metrics.total_route_iterations: - iteration_callback(self.iteration_offset, {net_id: final_results[net_id] for net_id in state.ordered_net_ids}) + self._capture_frontier_trace(state, final_results, details_by_net) return final_results diff --git a/inire/router/_routing_policy.py b/inire/router/_routing_policy.py index a234a7b..6f1dcda 100644 --- a/inire/router/_routing_policy.py +++ b/inire/router/_routing_policy.py @@ -12,10 +12,9 @@ from inire.constants import TOLERANCE_LINEAR from inire.geometry.collision import RoutingWorld from inire.geometry.components import Straight from inire.geometry.primitives import port_local_coordinates -from inire.model import FixedRoute, resolve_bend_geometry +from inire.model import resolve_bend_geometry from inire.results import RoutingResult, RoutingStage from inire.router._congestion_policy import ordered_nets -from inire.router._seed_materialization import materialize_path_seed from inire.router._stack import route_once if TYPE_CHECKING: @@ -82,35 +81,25 @@ def _direct_paths( *, priority: frozenset[str] = frozenset(), ) -> dict[str, RoutingResult]: - world = RoutingWorld.from_problem(problem, board=board) + if problem.initial_paths: + return {} + world = RoutingWorld(clearance=problem.clearance, safety_zone_radius=problem.safety_zone_radius, board=board) + for obstacle in problem.static_obstacles: + world.add_static_obstacle(obstacle) ordered = ordered_nets(problem.nets, options.congestion.net_order) if priority: ordered.sort(key=lambda net: net.net_id not in priority) paths = {} for net in ordered: - seed = problem.initial_paths.get(net.net_id) - if seed is None or options.search.seed_geometry_error(seed): - continue - path = materialize_path_seed( - seed, start=net.start, net_width=net.width, search=options.search, clearance=problem.clearance, bounds=problem.bounds, - ) - if path and path[-1].end_port == net.target: - report = world.verify_path_report(net.net_id, path) - if report.is_valid: - paths[net.net_id] = RoutingResult(net.net_id, path, reached_target=True, report=report, effective_net=net) - world.add_route(net.net_id, path) - for net in ordered: - if net.net_id in problem.initial_paths: - continue forward, lateral = port_local_coordinates(net.start, net.target.x, net.target.y) 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) report = world.verify_path_report(net.net_id, (component,)) if report.is_valid: - paths[net.net_id] = RoutingResult(net.net_id, (component,), reached_target=True, report=report, effective_net=net) - world.add_route(net.net_id, (component,)) + paths[net.net_id] = RoutingResult(net.net_id, (component,), reached_target=True, report=report) + world.install_path(net.net_id, (component,)) return paths @@ -127,7 +116,7 @@ def _disconnected_nets( residual = [net for net in problem.nets if net.net_id not in direct] if not residual: return frozenset() - obstacles = problem._blocking_polygons + tuple(shape for result in direct.values() for shape in result.locked_geometry) + obstacles = problem.static_obstacles + tuple(shape for result in direct.values() for shape in result.locked_geometry) by_width: dict[float, list[NetSpec]] = {} for net in residual: by_width.setdefault(net.width, []).append(net) @@ -202,11 +191,8 @@ def _residual_problem(problem: RoutingProblem, locks: LockPlan) -> RoutingProble if not locks.direct and not locks.disconnected: return problem residual = tuple(net for net in problem.nets if net.net_id not in locks.direct and net.net_id not in locks.disconnected) - locked = tuple(FixedRoute.from_result(result) for result in locks.direct.values()) - initial_paths = {net.net_id: problem.initial_paths[net.net_id] for net in residual if net.net_id in problem.initial_paths} - return replace( - problem, nets=residual, initial_paths=initial_paths, fixed_routes=problem.fixed_routes + locked, - ) + locked = tuple(shape for result in locks.direct.values() for shape in result.locked_geometry) + return replace(problem, nets=residual, static_obstacles=problem.static_obstacles + locked) def _route_residual( diff --git a/inire/router/_search.py b/inire/router/_search.py index e5405d5..440bf72 100644 --- a/inire/router/_search.py +++ b/inire/router/_search.py @@ -1,22 +1,18 @@ from __future__ import annotations import heapq -from math import inf from typing import TYPE_CHECKING from inire.constants import TOLERANCE_LINEAR -from ._astar_admission import process_move from ._astar_moves import expand_moves as _expand_moves from ._astar_types import AStarContext, AStarMetrics, AStarNode as _AStarNode, CongestionCaches, SearchRunConfig if TYPE_CHECKING: - from collections.abc import Sequence - from inire.geometry.components import ComponentResult from inire.geometry.primitives import Port from inire.results import RoutingResult - from inire.seeds import BendDirection, PathSegmentSeed + from inire.seeds import PathSegmentSeed def incumbent_guidance( @@ -25,11 +21,7 @@ def incumbent_guidance( ) -> tuple[tuple[PathSegmentSeed, ...] | None, float]: if result is None or not result.reached_target or not result.path: return None, 0.0 - return path_guidance(result.path, bend_penalty) - - -def path_guidance(path: Sequence[ComponentResult], bend_penalty: float) -> tuple[tuple[PathSegmentSeed, ...], float]: - return tuple(component.move_spec for component in path), max(10.0, bend_penalty * 0.25) + return result.as_seed().segments, max(10.0, bend_penalty * 0.25) def _reconstruct_path(end_node: _AStarNode) -> list[ComponentResult]: @@ -41,11 +33,6 @@ def _reconstruct_path(end_node: _AStarNode) -> list[ComponentResult]: return path[::-1] -def _distance_to_terminal(port: Port, target: Port) -> tuple[float, float]: - turn = (port.r - target.r) % 360 - return abs(port.x - target.x) + abs(port.y - target.y), min(turn, 360 - turn) - - def route_astar( start: Port, target: Port, @@ -64,7 +51,6 @@ def route_astar( context.cost_evaluator.set_target(target) open_set: list[_AStarNode] = [] closed_set: dict[tuple[int, int, int], float] = {} - deferred_turns: list[tuple[_AStarNode, float, BendDirection]] = [] congestion = CongestionCaches() start_node = _AStarNode( @@ -75,41 +61,11 @@ def route_astar( ) heapq.heappush(open_set, start_node) best_node = start_node - best_distance = _distance_to_terminal(start, target) nodes_expanded = 0 - # A short forward scan has to piece together progress one local move at a - # time. Give the preferred frontier more room when long straights are available. - scan_spans = context.options.search.max_straight_length / max(1.0, context.min_bend_radius) - preferred = 2 * min(scan_spans, config.node_limit) ** 2 - if config.node_limit <= 16: - release_turns_at = 0 - else: - reserved = max(1, config.node_limit // 10) - release_turns_at = min(config.node_limit - reserved, max(config.node_limit // 20, preferred)) - while open_set or deferred_turns: - if nodes_expanded >= config.node_limit or (config.expired is not None and nodes_expanded % 32 == 0 and config.expired()): + while open_set: + if nodes_expanded >= config.node_limit: return _reconstruct_path(best_node) if config.return_partial else None - if deferred_turns and (not open_set or nodes_expanded >= release_turns_at): - for index, (parent, radius, direction) in enumerate(deferred_turns): - if config.expired is not None and index % 32 == 0 and config.expired(): - return _reconstruct_path(best_node) if config.return_partial else None - process_move( - parent, target, net_width, net_id, open_set, closed_set, context, metrics, congestion, config, "bend90", (radius, direction) - ) - deferred_turns.clear() - if not open_set: - break - if len(open_set) > 50_000: - retained = heapq.nsmallest( - 40_000, - (node for node in open_set if closed_set.get(node.port.as_tuple(), inf) > node.g_cost + TOLERANCE_LINEAR), - ) - metrics.total_frontier_trim_events += 1 - metrics.total_frontier_nodes_discarded += len(open_set) - len(retained) - open_set = retained - if not open_set: - continue current = heapq.heappop(open_set) if config.max_cost is not None and current.fh_cost[0] > config.max_cost: @@ -117,23 +73,19 @@ def route_astar( metrics.total_pruned_cost += 1 continue + if current.h_cost < best_node.h_cost: + best_node = current + state = current.port.as_tuple() if state in closed_set and closed_set[state] <= current.g_cost + TOLERANCE_LINEAR: continue - if current.port == target and config.expired is not None and config.expired(): - return _reconstruct_path(best_node) if config.return_partial else None closed_set[state] = current.g_cost - if config.return_partial: - distance = _distance_to_terminal(current.port, target) - if distance < best_distance: - best_node, best_distance = current, distance if config.store_expanded: metrics.last_expanded_nodes.append(state) nodes_expanded += 1 metrics.total_nodes_expanded += 1 - metrics.reroute_work += 1 metrics.nodes_expanded += 1 if current.port == target: @@ -150,7 +102,6 @@ def route_astar( metrics, congestion, config=config, - deferred_turns=deferred_turns if nodes_expanded <= release_turns_at else None, ) return _reconstruct_path(best_node) if config.return_partial else None diff --git a/inire/router/_seed_materialization.py b/inire/router/_seed_materialization.py index 39afcb6..131f850 100644 --- a/inire/router/_seed_materialization.py +++ b/inire/router/_seed_materialization.py @@ -2,54 +2,15 @@ from __future__ import annotations from typing import TYPE_CHECKING -from inire.geometry.components import ( - ComponentPreparationError, bend_fits_width, build_component, component_endpoint, prepare_component_sampling, -) +from inire.geometry.components import bend_fits_width, build_component from inire.model import resolve_bend_geometry from inire.seeds import Bend90Seed, SBendSeed, StraightSeed if TYPE_CHECKING: - from inire.geometry.components import ComponentResult, MoveKind + from inire.geometry.components import ComponentResult from inire.geometry.primitives import Port from inire.model import SearchOptions - from inire.seeds import PathSeed, PathSegmentSeed - - -def seed_move(segment: PathSegmentSeed) -> tuple[MoveKind, tuple]: - if isinstance(segment, StraightSeed): - return "straight", (max(1, round(segment.length)),) - if isinstance(segment, Bend90Seed): - return "bend90", (segment.radius, segment.direction) - if isinstance(segment, SBendSeed): - return "sbend", (segment.offset, segment.radius) - raise TypeError(f"Unsupported seed segment: {type(segment)!r}") - - -def seed_width_error(seed: PathSeed, net_width: float) -> str | None: - for index, segment in enumerate(seed.segments, start=1): - if isinstance(segment, (Bend90Seed, SBendSeed)) and not bend_fits_width(segment.radius, net_width): - return f"segment {index} ({type(segment).__name__}) needs radius at least {net_width / 2:g}, got {segment.radius:g}" - return None - - -def seed_preparation_error(seed: PathSeed, *, start: Port, net_width: float, search: SearchOptions, clearance: float) -> str | None: - proxy, physical = resolve_bend_geometry(search) - for index, segment in enumerate(seed.segments, start=1): - kind, parameters = seed_move(segment) - template = search.sbend_template(segment.offset, segment.radius, net_width) if isinstance(segment, SBendSeed) else None - try: - start = component_endpoint(start, kind, parameters) - prepare_component_sampling( - kind, parameters, net_width, collision_type=proxy, physical_geometry_type=physical, - dilation=clearance / 2, sbend_outline=template.polygon if template is not None else None, - ) - except (ComponentPreparationError, OverflowError) as exc: - return f"segment {index} ({type(segment).__name__}) {exc}" - return None - - -class SeedMaterializationError(ValueError): - """A supplied seed cannot be materialized.""" + from inire.seeds import PathSeed def materialize_path_seed( @@ -59,44 +20,35 @@ def materialize_path_seed( net_width: float, search: SearchOptions, clearance: float, - bounds: tuple[float, float, float, float] | None = None, - diagnostic: bool = False, ) -> tuple[ComponentResult, ...] | None: - if seed_width_error(seed, net_width) is not None: + if any(isinstance(segment, (Bend90Seed, SBendSeed)) and not bend_fits_width(segment.radius, net_width) for segment in seed.segments): return None - if diagnostic: - error = seed_preparation_error(seed, start=start, net_width=net_width, search=search, clearance=clearance) - if error is not None: - raise SeedMaterializationError(error) - path: list[ComponentResult] = [] current = start dilation = clearance / 2.0 bend_collision_type, bend_physical_geometry = resolve_bend_geometry(search) bend_clip_margin = search.bend_clip_margin - for index, segment in enumerate(seed.segments, start=1): - kind, parameters = seed_move(segment) - template = search.sbend_template(segment.offset, segment.radius, net_width) if isinstance(segment, SBendSeed) else None - try: - component = build_component( - current, - net_width, - kind, - parameters, - collision_type=bend_collision_type, - physical_geometry_type=bend_physical_geometry, - clip_margin=bend_clip_margin, - dilation=dilation, - sbend_outline=template.polygon if template is not None else None, - bounds=None if diagnostic else bounds, - physical_length=search.bend_physical_length if kind == "bend90" else (template.length if template else None), - ) - except (ComponentPreparationError, OverflowError) as exc: - if diagnostic: - raise SeedMaterializationError(f"segment {index} ({type(segment).__name__}) {exc}") from exc - return None + for segment in seed.segments: + if isinstance(segment, StraightSeed): + kind, parameters = "straight", (max(1, round(segment.length)),) + elif isinstance(segment, Bend90Seed): + kind, parameters = "bend90", (segment.radius, segment.direction) + elif isinstance(segment, SBendSeed): + kind, parameters = "sbend", (segment.offset, segment.radius) + else: + raise TypeError(f"Unsupported seed segment: {type(segment)!r}") + component = build_component( + current, + net_width, + kind, + parameters, + collision_type=bend_collision_type, + physical_geometry_type=bend_physical_geometry, + clip_margin=bend_clip_margin, + dilation=dilation, + ) path.append(component) current = component.end_port return tuple(path) diff --git a/inire/router/_stack.py b/inire/router/_stack.py index 21f1d7d..b4cfc62 100644 --- a/inire/router/_stack.py +++ b/inire/router/_stack.py @@ -1,23 +1,24 @@ from __future__ import annotations -import time -from dataclasses import dataclass, replace +from dataclasses import dataclass from typing import TYPE_CHECKING +from shapely.geometry import box + from inire.geometry.collision import RoutingWorld -from inire.results import RoutingRunResult, _sum_route_metrics +from inire.results import RoutingRunResult from inire.router._astar_types import AStarContext from inire.router._router import PathFinder -from inire.router.cost import CostEvaluator, proximity_map +from inire.router.cost import CostEvaluator +from inire.router.danger_map import DangerMap if TYPE_CHECKING: from collections.abc import Callable from inire.model import RoutingOptions, RoutingProblem - from inire.results import RouteMetrics, RoutingResult + from inire.results import RoutingResult from inire.router._router import PhaseTimer from inire.router._topology import Corridor - from inire.router.danger_map import DangerMap @dataclass(frozen=True, slots=True) @@ -35,21 +36,26 @@ def build_routing_stack(problem: RoutingProblem, options: RoutingOptions) -> Rou problem = plan_ordered_bundle(problem, options.search, infer_terminal_headings=options.topology.infer_terminal_headings) - world = RoutingWorld.from_problem(problem) + world = RoutingWorld( + clearance=problem.clearance, + safety_zone_radius=problem.safety_zone_radius, + board=box(*problem.bounds), + ) + for obstacle in problem.static_obstacles: + world.add_static_obstacle(obstacle) - danger_map = proximity_map(problem, options.search.proximity_range) + danger_map = DangerMap(bounds=problem.bounds) refinement = options.refinement - if options.search.node_limit > 0 and options.congestion.max_iterations > 0 and ( + if options.congestion.max_iterations > 0 and ( options.objective.danger_weight or (refinement.enabled and refinement.objective is not None and refinement.objective.danger_weight) ): - danger_map.precompute(problem._blocking_polygons) + danger_map.precompute(list(problem.static_obstacles)) evaluator = CostEvaluator.from_objective( world, danger_map, options.objective, greedy_h_weight=options.search.greedy_h_weight, - distance_heuristic_weight=options.search.distance_heuristic_weight, ) context = AStarContext(evaluator, problem, options) finder = PathFinder(context) @@ -69,28 +75,13 @@ def route_once( iteration_callback: Callable[[int, dict[str, RoutingResult]], None] | None = None, phase_timer: PhaseTimer | None = None, corridors: dict[str, tuple[Corridor, ...]] | None = None, - iteration_offset: int = 0, ) -> RoutingRunResult: """Run one explicitly selected routing mode and capture its diagnostics.""" if options.topology.mode == "automatic": raise ValueError("A single routing attempt requires an explicit planner mode") - started_at = time.monotonic() finder = build_routing_stack(problem, options).finder - effective = {net.net_id: net for net in finder.context.problem.nets} - - def attach_effective(results: dict[str, RoutingResult]) -> dict[str, RoutingResult]: - return {key: replace(result, effective_net=effective[key]) for key, result in results.items()} - - def notify(iteration: int, results: dict[str, RoutingResult]) -> None: - assert iteration_callback is not None - iteration_callback(iteration, attach_effective(results)) - - callback = notify if iteration_callback is not None else None - results = finder.route_all( - iteration_callback=callback, phase_timer=phase_timer, corridors=corridors, started_at=started_at, iteration_offset=iteration_offset, - ) - results = attach_effective(results) + results = finder.route_all(iteration_callback=iteration_callback, phase_timer=phase_timer, corridors=corridors) if options.topology.mode == "bundle": for result in results.values(): if not result.is_valid: @@ -110,59 +101,3 @@ def collect_worker_result(finder: PathFinder, results: dict[str, RoutingResult]) iteration_trace=tuple(finder.iteration_trace), topology=finder.topology_report, ) - - -class RoutingAttempts: - """Coordinate workers without retaining diagnostic data from discarded runs.""" - - def __init__(self, callback: Callable[[int, dict[str, RoutingResult]], None] | None) -> None: - self.callback = callback - self.iterations = 0 - self.samples: list[RouteMetrics] = [] - - def run( - self, - problem: RoutingProblem, - *, - options: RoutingOptions, - phase_timer: PhaseTimer | None = None, - corridors: dict[str, tuple[Corridor, ...]] | None = None, - ) -> RoutingRunResult: - result = route_once( - problem, options=options, iteration_callback=self.callback, phase_timer=phase_timer, - corridors=corridors, iteration_offset=self.iterations, - ) - self.iterations += result.metrics.route_iterations - self.samples.append(result.metrics) - return result - - def metrics(self) -> RouteMetrics: - return _sum_route_metrics(self.samples) - - -def route_explicit( - problem: RoutingProblem, - *, - options: RoutingOptions, - iteration_callback: Callable[[int, dict[str, RoutingResult]], None] | None = None, -) -> RoutingRunResult: - attempts = RoutingAttempts(iteration_callback) - with_guidance = attempts.run(problem, options=options) - topology = options.topology - if ( - topology.mode not in ("guide", "seed") or not topology.guide_strength - or not options.search.node_limit or options.congestion.max_iterations < 2 - or with_guidance.metrics.timeout_events or not with_guidance.topology or not with_guidance.topology.corridor_counts - or all(result.is_valid for result in with_guidance.results_by_net.values()) - ): - return with_guidance - - retry = replace( - options, topology=replace(topology, guide_strength=0.0), - congestion=replace(options.congestion, max_iterations=1), - ) - without_guidance = attempts.run(problem, options=retry) - old_count = sum(result.is_valid for result in with_guidance.results_by_net.values()) - new_count = sum(result.is_valid for result in without_guidance.results_by_net.values()) - selected = without_guidance if new_count > old_count else with_guidance - return replace(selected, metrics=attempts.metrics()) diff --git a/inire/router/_topology.py b/inire/router/_topology.py index 50b1d3b..9713d8d 100644 --- a/inire/router/_topology.py +++ b/inire/router/_topology.py @@ -11,10 +11,6 @@ from typing import TYPE_CHECKING import shapely from shapely.geometry import LineString, Point, box -from inire.constants import TOLERANCE_LINEAR -from inire.geometry.collision import _violates_clearance -from inire.geometry.index_helpers import is_axis_aligned_rect - if TYPE_CHECKING: from collections.abc import Iterable, Sequence @@ -93,31 +89,17 @@ def _edge(a: int, b: int) -> Edge: return (a, b) if a < b else (b, a) -def constrained_triangulation_available() -> bool: - return callable(getattr(shapely, "constrained_delaunay_triangles", None)) and shapely.geos_version >= (3, 10) - - class _Mesh: - def __init__( - self, board: Polygon, obstacles: Iterable[Polygon], margin: float, clearance: float, *, relief: float = 0.0, round_joins: bool = False, - ) -> None: - if not constrained_triangulation_available(): + def __init__(self, board: Polygon, obstacles: Iterable[Polygon], margin: float, clearance: float) -> None: + triangulate = getattr(shapely, "constrained_delaunay_triangles", None) + if triangulate is None: raise RuntimeError("Topological routing requires Shapely 2.1 and GEOS 3.10 or newer") self.pitch = max(1.0, 2 * margin + clearance) - self.board = board - self.margin = margin - self.clearance = clearance - self.keepouts = shapely.STRtree(tuple(obstacles)) - padding = max(0.0, margin + clearance - relief) - padded = shapely.union_all([ - shape.buffer(padding, join_style="round" if round_joins and not is_axis_aligned_rect(shape) else "mitre") - for shape in self.keepouts.geometries - ]) - self.inset = board.buffer(-margin) - self.free = self.inset.difference(padded) + obstacles = shapely.union_all([shape.buffer(margin + clearance, join_style="mitre") for shape in obstacles]) + self.free = board.buffer(-margin).difference(obstacles) self.boundary = self.free.boundary - self.cells: tuple[Polygon, ...] = tuple(shapely.constrained_delaunay_triangles(self.free).geoms) + self.cells: tuple[Polygon, ...] = tuple(triangulate(self.free).geoms) self.index = shapely.STRtree(self.cells) self.portals: dict[Edge, _Portal] = {} self.neighbors: list[list[int]] = [[] for _ in self.cells] @@ -147,38 +129,15 @@ class _Mesh: def endpoint(self, port: Port, direction: int, lead_length: float) -> _Endpoint | None: x, y, rotation = port.as_tuple() dx, dy = HEADINGS[rotation // 90] - point = Point(x, y) - inset_port = self.inset.covers(point) - lengths = (lead_length, lead_length / 2, 1.0, 0.0) - if not inset_port and self.board.covers(point) and not self.inset.is_empty: - axis = 0 if dx else 1 - heading_sign = direction * (dx or dy) - entry = (self.inset.bounds[axis if heading_sign > 0 else axis + 2] - (x, y)[axis]) * heading_sign - if entry > 0: - lengths = tuple(max(length, entry) for length in lengths if length > 0) - for length in lengths: + for length in (lead_length, lead_length / 2, 1.0, 0.0): lead = (x + dx * length * direction, y + dy * length * direction) + if length and not self.free.covers(LineString(((x, y), lead))): + continue cells = self.index.query(Point(lead), predicate="covered_by") - if not len(cells): - continue - if length and not self._lead_is_clear(LineString(((x, y), lead)), inset_port=inset_port): - continue - return _Endpoint((x, y), lead, int(min(cells))) + if len(cells): + return _Endpoint((x, y), lead, int(min(cells))) return None - def _lead_is_clear(self, centerline: LineString, *, inset_port: bool) -> bool: - if inset_port: - return bool(self.free.covers(centerline)) - # At the board edge, only the portion inside the inset belongs to the mesh. - # The entire straight still needs a legal flat-ended footprint. - footprint = centerline.buffer(self.margin, cap_style="flat") - if not self.board.covers(footprint) or not self.free.covers(centerline.intersection(self.inset)): - return False - left, bottom, right, top = footprint.bounds - gap = self.clearance - nearby = self.keepouts.query(box(left - gap, bottom - gap, right + gap, top + gap)) - return not any(_violates_clearance(footprint, self.keepouts.geometries[index], gap) for index in nearby) - def _crossing_cost(self, edge: Edge, demand: dict[Edge, int]) -> float: count = len(self.portals[edge].lanes) load = demand.get(edge, 0) @@ -452,43 +411,9 @@ def plan_corridors( return {} board = box(*bounds) - keepouts = tuple(obstacles) - - def plan_group(group: Sequence[NetSpec], width: float, *, recover: bool = False) -> tuple[dict[str, tuple[Corridor, ...]], BaseGeometry]: - mesh = _Mesh(board, keepouts, width / 2, clearance, relief=8 * TOLERANCE_LINEAR if recover else 0.0, round_joins=recover) - endpoints, leads = _endpoint_access(mesh, group, bend_radius) - assignments = _plan_lane_assignments( - mesh, group, endpoints, leads, bend_radius=bend_radius, limit=limit, joint_net_ids=joint_net_ids - ) - return _build_corridors(mesh, board, group, assignments, bend_radius), mesh.free - - widest = max(net.width for net in nets) - guides, shared_space = plan_group(nets, widest) - if joint_net_ids: - return guides - - # Keep shared assignments and add routes through passages opened by the narrower margin. - by_width: dict[float, list[NetSpec]] = {} - for net in nets: - by_width.setdefault(net.width, []).append(net) - for width, group in by_width.items(): - if width < widest: - narrow, _ = plan_group(group, width) - for net_id, corridors in narrow.items(): - if net_id not in guides: - guides[net_id] = corridors - continue - alternate = next( - (c for c in corridors if c.centerline.difference(shared_space).length > widest + 2 * clearance), - None, - ) - if alternate is not None: - first, *rest = guides[net_id] - guides[net_id] = (first, alternate, *rest)[:limit] - missing = [net for net in group if net.net_id not in guides] - if missing and keepouts: - # Exact-clearance passages can collapse to a line before triangulation. - # This affects only candidate guidance. Move admission checks the original shapes. - recovered, _ = plan_group(missing, width, recover=True) - guides.update(recovered) - return {net.net_id: guides[net.net_id] for net in nets if net.net_id in guides} + mesh = _Mesh(board, obstacles, max(net.width for net in nets) / 2, clearance) + endpoints, leads = _endpoint_access(mesh, nets, bend_radius) + assignments = _plan_lane_assignments( + mesh, nets, endpoints, leads, bend_radius=bend_radius, limit=limit, joint_net_ids=joint_net_ids + ) + return _build_corridors(mesh, board, nets, assignments, bend_radius) diff --git a/inire/router/cost.py b/inire/router/cost.py index 5a37a25..6782a0c 100644 --- a/inire/router/cost.py +++ b/inire/router/cost.py @@ -3,9 +3,10 @@ from __future__ import annotations from time import perf_counter_ns from typing import TYPE_CHECKING +import numpy as np + from inire.constants import TOLERANCE_LINEAR from inire.geometry.collision import RoutingWorld -from inire.geometry.primitives import rotate_cardinal from inire.model import ObjectiveWeights from inire.router.danger_map import DangerMap @@ -38,7 +39,6 @@ class CostEvaluator: "danger_map", "_search_weights", "_greedy_h_weight", - "distance_heuristic_weight", "_target_x", "_target_y", "_target_r", @@ -55,7 +55,6 @@ class CostEvaluator: bend_penalty: float = 250.0, sbend_penalty: float | None = None, danger_weight: float = 1.0, - distance_heuristic_weight: float = 1.0, ) -> None: actual_sbend_penalty = 2.0 * bend_penalty if sbend_penalty is None else sbend_penalty self.collision_engine = collision_engine @@ -67,7 +66,6 @@ class CostEvaluator: danger_weight=danger_weight, ) self._greedy_h_weight = float(greedy_h_weight) - self.distance_heuristic_weight = distance_heuristic_weight self._target_x = 0.0 self._target_y = 0.0 self._target_r = 0 @@ -82,7 +80,6 @@ class CostEvaluator: objective: ObjectiveWeights, *, greedy_h_weight: float = 1.5, - distance_heuristic_weight: float = 1.0, ) -> CostEvaluator: return cls( world, @@ -92,7 +89,6 @@ class CostEvaluator: bend_penalty=objective.bend_penalty, sbend_penalty=objective.sbend_penalty, danger_weight=objective.danger_weight, - distance_heuristic_weight=distance_heuristic_weight, ) @property @@ -114,7 +110,9 @@ class CostEvaluator: self._target_x = target.x self._target_y = target.y self._target_r = int(target.r) - self._target_cos, self._target_sin = rotate_cardinal(1.0, 0.0, int(target.r)) + rad = np.radians(target.r) + self._target_cos = np.cos(rad) + self._target_sin = np.sin(rad) def h_manhattan( self, @@ -145,7 +143,14 @@ class CostEvaluator: if side_proj < 0 or (side_proj < min_bend_radius and perp_dist > 0): penalty += 2 * bp - c_cos, c_sin = rotate_cardinal(1.0, 0.0, int(curr_r)) + if curr_r == 0: + c_cos, c_sin = 1.0, 0.0 + elif curr_r == 90: + c_cos, c_sin = 0.0, 1.0 + elif curr_r == 180: + c_cos, c_sin = -1.0, 0.0 + else: + c_cos, c_sin = 0.0, -1.0 move_proj = v_dx * c_cos + v_dy * c_sin if move_proj < 0: @@ -153,8 +158,7 @@ class CostEvaluator: if diff == 0 and perp_dist > 0: penalty += 2 * bp - distance_cost = dist * (self._search_weights.unit_length_cost * self.distance_heuristic_weight) - return self._greedy_h_weight * (distance_cost + penalty) + return self._greedy_h_weight * (dist + penalty) def score_component( self, @@ -182,7 +186,7 @@ class CostEvaluator: ) # Skip danger sampling entirely when there are no static obstacles in the KD-tree. - if danger_map is not None and active_weights.danger_weight and danger_map.has_data: + if danger_map is not None and active_weights.danger_weight and danger_map.tree is not None: cost_s = danger_map.get_cost(start_port.x, start_port.y) if start_port else 0.0 cost_e = danger_map.get_cost(end_port.x, end_port.y) if start_port: @@ -236,17 +240,10 @@ class CostEvaluator: return total -def proximity_map(problem: RoutingProblem, proximity_range: float) -> DangerMap: - return DangerMap( - bounds=problem.bounds, resolution=proximity_range / 2 or proximity_range, safety_threshold=proximity_range, - cost_distance_range=proximity_range, - ) - - -def build_native_cost_evaluator(problem: RoutingProblem, objective: ObjectiveWeights, *, proximity_range: float = 10.0) -> CostEvaluator: +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._blocking_polygons: - danger = proximity_map(problem, proximity_range) - danger.precompute(problem._blocking_polygons) + 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/danger_map.py b/inire/router/danger_map.py index f45bc6e..163539b 100644 --- a/inire/router/danger_map.py +++ b/inire/router/danger_map.py @@ -1,81 +1,28 @@ from __future__ import annotations from collections import OrderedDict -from itertools import chain, islice, pairwise -from math import ceil, floor, hypot, isfinite +from itertools import chain from time import perf_counter_ns from typing import TYPE_CHECKING import numpy -import shapely from scipy.spatial import cKDTree -from shapely.geometry import Point, box -from shapely.strtree import STRtree +from shapely.geometry import box if TYPE_CHECKING: - from collections.abc import Iterable, Iterator - - from shapely.geometry import LinearRing, Polygon - from numpy.typing import NDArray + from shapely.geometry import Polygon from inire.router._astar_types import AStarMetrics _COST_CACHE_SIZE = 100000 -_MAX_SAMPLES = 20000 - - -def _clip_segment( - start: tuple[float, float], - end: tuple[float, float], - bounds: tuple[float, float, float, float], -) -> tuple[float, float] | None: - low, high = 0.0, 1.0 - for axis in (0, 1): - origin = start[axis] - step = end[axis] - origin - minimum, maximum = bounds[axis], bounds[axis + 2] - if not step: - if not minimum <= origin <= maximum: - return None - continue - enter, leave = sorted(((minimum - origin) / step, (maximum - origin) / step)) - low, high = max(low, enter), min(high, leave) - return (low, high) if low <= high else None - - -def _sample_ring( - ring: LinearRing, - bounds: tuple[float, float, float, float], - resolution: float, -) -> Iterator[tuple[float, float]]: - distance = 0.0 - next_sample = 0 - last_sample = ceil(ring.length / resolution) - 1 - for start, end in pairwise(ring.coords): - dx, dy = end[0] - start[0], end[1] - start[1] - length = hypot(dx, dy) - clipped = _clip_segment(start, end, bounds) - if length and clipped is not None: - low, high = clipped - first = max(next_sample, ceil((distance + low * length) / resolution)) - last = min(last_sample, floor((distance + high * length) / resolution)) - for index in range(first, last + 1): - fraction = (index * resolution - distance) / length - yield (start[0] + fraction * dx, start[1] + fraction * dy) - if first <= last: - next_sample = last + 1 - distance += length class DangerMap: """ A proximity cost evaluator using a KD-Tree of obstacle boundary points. - Samples the part of the obstacle perimeter within range of the design. + Scales with obstacle perimeter rather than design area. """ - __slots__ = ( - "minx", "miny", "maxx", "maxy", "resolution", "safety_threshold", "k", "tree", - "_boundary_tree", "_cost_distance_range", "_cost_cache", "metrics", - ) + __slots__ = ('minx', 'miny', 'maxx', 'maxy', 'resolution', 'safety_threshold', 'k', 'tree', '_cost_cache', 'metrics') def __init__( self, @@ -83,8 +30,6 @@ class DangerMap: resolution: float = 5.0, safety_threshold: float = 10.0, k: float = 1.0, - *, - cost_distance_range: float = 10.0, ) -> None: """ Initialize the Danger Map. @@ -100,49 +45,34 @@ class DangerMap: self.safety_threshold = safety_threshold self.k = k self.tree: cKDTree | None = None - self._boundary_tree: STRtree | None = None - self._cost_distance_range = cost_distance_range self._cost_cache: OrderedDict[tuple[int, int], float] = OrderedDict() self.metrics: AStarMetrics | None = None - def precompute(self, obstacles: Iterable[Polygon]) -> None: + def precompute(self, obstacles: list[Polygon]) -> None: """ Pre-compute the proximity tree by sampling obstacle boundaries. """ reach = self.safety_threshold - bounds = (self.minx - reach, self.miny - reach, self.maxx + reach, self.maxy + reach) - window = box(*bounds) - rings = [ - ring for poly in obstacles for ring in chain((poly.exterior,), poly.interiors) - if window.intersects(ring) - ] - if any(not isfinite(ring.length / self.resolution) for ring in rings): + window = box(self.minx - reach, self.miny - reach, self.maxx + reach, self.maxy + reach) + all_points = [] + for poly in obstacles: + for ring in chain((poly.exterior,), poly.interiors): + if not window.intersects(ring): + continue + length = ring.length + dist = 0.0 + while dist < length: + pt = ring.interpolate(dist) + all_points.append((pt.x, pt.y)) + dist += self.resolution + + if all_points: + self.tree = cKDTree(numpy.array(all_points)) + else: self.tree = None - self._boundary_tree = STRtree(rings) - self._cost_cache.clear() - return - points = list(islice(chain.from_iterable(_sample_ring(ring, bounds, self.resolution) for ring in rings), _MAX_SAMPLES + 1)) - self.tree = cKDTree(numpy.array(points)) if 0 < len(points) <= _MAX_SAMPLES else None - self._boundary_tree = STRtree(rings) if len(points) > _MAX_SAMPLES else None self._cost_cache.clear() - @property - def has_data(self) -> bool: - return self.tree is not None or self._boundary_tree is not None - - def costs_at_points(self, coordinates: NDArray[numpy.float64]) -> NDArray[numpy.float64]: - distances = numpy.full(len(coordinates), numpy.inf) - if self.tree is not None: - distances, _ = self.tree.query(coordinates, distance_upper_bound=self.safety_threshold) - elif self._boundary_tree is not None: - indices, measured = self._boundary_tree.query_nearest( - shapely.points(coordinates), max_distance=self.safety_threshold, return_distance=True, all_matches=False, - ) - distances[indices[0]] = measured - safe = numpy.maximum(0.1, 10 * (distances / self._cost_distance_range)) - return numpy.where(distances < self.safety_threshold, self.k / safe ** 2, 0.0) - def is_within_bounds(self, x: float, y: float) -> bool: """ Check if a coordinate is within the design bounds. @@ -183,19 +113,12 @@ class DangerMap: qy = qy_milli / 1000.0 if not self.is_within_bounds(qx, qy): return 1e15 - if not self.has_data: + if self.tree is None: return 0.0 if self.metrics is not None: self.metrics.total_danger_map_query_calls += 1 - if self.tree is not None: - dist, _ = self.tree.query([qx, qy], distance_upper_bound=self.safety_threshold) - else: - assert self._boundary_tree is not None - _, distances = self._boundary_tree.query_nearest( - Point(qx, qy), max_distance=self.safety_threshold, return_distance=True, all_matches=False, - ) - dist = distances[0] if len(distances) else numpy.inf + dist, _ = self.tree.query([qx, qy], distance_upper_bound=self.safety_threshold) if dist >= self.safety_threshold: return 0.0 - safe_dist = max(10 * (dist / self._cost_distance_range), 0.1) + safe_dist = max(dist, 0.1) return float(self.k / (safe_dist ** 2)) diff --git a/inire/router/refiner.py b/inire/router/refiner.py index e3ff6dc..b376913 100644 --- a/inire/router/refiner.py +++ b/inire/router/refiner.py @@ -1,18 +1,12 @@ from __future__ import annotations -from bisect import bisect_left from dataclasses import dataclass -from heapq import merge from itertools import accumulate, chain -from math import inf from typing import TYPE_CHECKING, Any -from inire.constants import TOLERANCE_LINEAR -from inire.geometry.component_overlap import components_overlap, invalid_component_join -from inire.geometry.components import ( - _bend90_length, bend_fits_width, bend90_grid_span, build_component, component_endpoint, ComponentPreparationError, -) -from inire.geometry.primitives import port_local_coordinates +from inire.geometry.component_overlap import components_overlap +from inire.geometry.components import _advance_port, _bend90_length, bend_fits_width, bend90_grid_span, build_component +from inire.geometry.primitives import port_local_coordinates, rotation_matrix2 from inire.model import resolve_bend_geometry if TYPE_CHECKING: @@ -35,56 +29,12 @@ class _DoglegMove: bend_radius: float | None = None -def _forward_position(port: Port) -> float: - axis = port.y if port.r % 180 else port.x - return axis if port.r < 180 else -axis - - -class _WindowEnds: - """Find the last sufficiently forward endpoint in a prefix of the path.""" - - def __init__(self, indices: list[int], ports: Sequence[Port]) -> None: - self.indices = indices - self._size = 1 << (len(indices) - 1).bit_length() - self._maxima = [-inf] * (2 * self._size) - self._maxima[self._size : self._size + len(indices)] = [_forward_position(ports[index]) for index in indices] - for node in range(self._size - 1, 0, -1): - self._maxima[node] = max(self._maxima[2 * node], self._maxima[2 * node + 1]) - - def rightmost(self, stop: int, minimum: float) -> int | None: - if not stop: - return None - node = self._size + stop - 1 - if self._maxima[node] >= minimum: - return stop - 1 - # Earlier leaves lie in left siblings of the path back to the root. - while node > 1: - if node % 2 and self._maxima[node - 1] >= minimum: - node -= 1 - while node < self._size: - right = 2 * node + 1 - node = right if self._maxima[right] >= minimum else right - 1 - return node - self._size - node //= 2 - return None - - -def component_hits_ancestor_chain(component: ComponentResult, parent_node: Any, clearance: float = 0.0) -> bool: +def component_hits_ancestor_chain(component: ComponentResult, parent_node: Any) -> bool: current = parent_node - between = 0.0 - previous_move = parent_node.component_result if parent_node else None while current and current.parent: ancestor_component = current.component_result - if ancestor_component: - if current is parent_node: - if invalid_component_join(ancestor_component, component): - return True - else: - single_bend = current is parent_node.parent and previous_move is not None and previous_move.move_type != "straight" - spacing = clearance if not single_bend and between >= clearance - TOLERANCE_LINEAR else 0.0 - if components_overlap(ancestor_component, component, prefer_actual=True, clearance=spacing): - return True - between += ancestor_component.length + if ancestor_component and components_overlap(component, ancestor_component): + return True current = current.parent return False @@ -241,7 +191,7 @@ class PathRefiner: if 0.01 < forward_length < min_straight - 0.01: return None - bend_length = self.context.options.search.bend_physical_length or _bend90_length(radius) + bend_length = _bend90_length(radius) moves: list[_DoglegMove] = [] curr = start for sign, straight_len in ( @@ -250,12 +200,11 @@ class PathRefiner: (-first_sign, second_straight), (first_sign, 0.0), ): - direction = "CCW" if sign > 0 else "CW" - curr = component_endpoint(curr, "bend90", (radius, direction)) - moves.append(_DoglegMove(curr, bend_length, "bend90", direction, bend_radius=radius)) + curr = _advance_port(curr, rotation_matrix2(curr.r), span, sign * span, sign * 90) + moves.append(_DoglegMove(curr, bend_length, "bend90", "CCW" if sign > 0 else "CW", bend_radius=radius)) if straight_len > 0.01: length = float(straight_len) - curr = component_endpoint(curr, "straight", (length,)) + curr = _advance_port(curr, rotation_matrix2(curr.r), length) moves.append(_DoglegMove(curr, length, "straight")) return moves if curr == target else None @@ -265,14 +214,11 @@ class PathRefiner: dilation = self.collision_engine.clearance / 2.0 path = [] port = start - board = self.collision_engine.board - bounds = None if board is None else board.bounds for move in moves: parameters = (move.length,) if move.direction is None else (radius, move.direction) component = build_component( port, width, move.move_type, parameters, collision_type=proxy, physical_geometry_type=physical, clip_margin=search.bend_clip_margin, dilation=dilation, - physical_length=search.bend_physical_length if move.move_type == "bend90" else None, bounds=bounds, ) path.append(component) port = component.end_port @@ -285,13 +231,11 @@ class PathRefiner: prefix: list[ComponentResult], suffix: list[ComponentResult], ) -> bool: - if self.collision_engine.self_clearance: - return self.collision_engine.verify_path_report(net_id, (*prefix, *replacement, *suffix)).is_valid if not self.collision_engine.verify_path_report(net_id, replacement).is_valid: return False - if prefix and invalid_component_join(prefix[-1], replacement[0]): + if prefix and components_overlap(prefix[-1], replacement[0], prefer_actual=True, at_join=True): return False - if suffix and invalid_component_join(replacement[-1], suffix[0]): + if suffix and components_overlap(replacement[-1], suffix[0], prefer_actual=True, at_join=True): return False # The verified incumbent's prefix and suffix remain separated by # several components. Only pairs involving a replacement can change. @@ -304,40 +248,28 @@ class PathRefiner: def _iter_refinement_windows(self, start: Port, path: Sequence[ComponentResult]) -> Iterator[tuple[int, int]]: ports = self._path_ports(start, path) - min_forward = 4 * bend90_grid_span(min(self.context.options.search.bend_radii, default=0.0)) + min_bend_span = bend90_grid_span(min(self.context.options.search.bend_radii, default=0.0)) bends = [component.move_type == "bend90" for component in path] bend_counts = tuple(accumulate(bends, initial=0)) limit = self.context.options.refinement.max_windows_per_net # Keep the original order for a single attempt and for unlimited refinement. - prioritize_bend_edges = limit is not None and limit > 1 - edge_counts = (2, 1, 0) if prioritize_bend_edges else (None,) - by_heading: dict[tuple[int | float, int | None], list[int]] = {} - for end, port in enumerate(ports[1:], start=1): - if bend_counts[end] >= 4: - edge = int(bends[end - 1]) if prioritize_bend_edges else None - by_heading.setdefault((port.r, edge), []).append(end) - candidates = {key: _WindowEnds(indices, ports) for key, indices in by_heading.items()} - - def from_start(index: int, edge_count: int | None) -> Iterator[tuple[int, int, int]]: - end_edge = edge_count - int(bends[index]) if edge_count is not None else None - ends = candidates.get((ports[index].r, end_edge)) - if ends is None: - return - minimum_end = bisect_left(bend_counts, bend_counts[index] + 4) - minimum_position = _forward_position(ports[index]) + min_forward - stop = len(ends.indices) - while (slot := ends.rightmost(stop, minimum_position)) is not None: - end = ends.indices[slot] - if end < minimum_end: - break - yield index - end, index, end - stop = slot + edge_counts = (2, 1, 0) if limit is not None and limit > 1 else (None,) for edge_count in edge_counts: - windows = (from_start(index, edge_count) for index, count in enumerate(bend_counts[:-1]) if count <= bend_counts[-1] - 4) - # Each stream is longest-first, so the merge only needs one pending window per start. - for _, start_idx, end_idx in merge(*windows): - yield start_idx, end_idx + for window_size in range(len(path), 3, -1): + for start_idx in range(len(path) - window_size + 1): + end_idx = start_idx + window_size + if bend_counts[end_idx] - bend_counts[start_idx] < 4: + continue + if edge_count is not None and bends[start_idx] + bends[end_idx - 1] != edge_count: + continue + window_start = ports[start_idx] + window_end = ports[end_idx] + if window_start.r != window_end.r: + continue + local_dx, _ = port_local_coordinates(window_start, window_end.x, window_end.y) + if local_dx >= 4 * min_bend_span: + yield start_idx, end_idx def _try_refine_window( self, @@ -368,10 +300,7 @@ class PathRefiner: moves = self._dogleg_moves(window_start, window_end, radius, side_extent) if moves is None or not self.score_path(scoring_start, [*prefix, *moves, *suffix]) + 1e-6 < best_candidate_cost: continue - try: - replacement = self._build_dogleg(window_start, net_width, radius, moves) - except (ComponentPreparationError, OverflowError): - continue + replacement = self._build_dogleg(window_start, net_width, radius, moves) self.context.metrics.total_refinement_candidates_built += 1 candidate_path = [*prefix, *replacement, *suffix] candidate_cost = self.score_path(scoring_start, candidate_path) diff --git a/inire/router/visibility.py b/inire/router/visibility.py index 3cd1ca4..8d107bf 100644 --- a/inire/router/visibility.py +++ b/inire/router/visibility.py @@ -1,6 +1,6 @@ from __future__ import annotations -from math import hypot +import numpy from typing import TYPE_CHECKING import rtree @@ -9,47 +9,61 @@ if TYPE_CHECKING: from inire.geometry.collision import RoutingWorld from inire.geometry.primitives import Port +from inire.geometry.primitives import Port + class VisibilityManager: - """Index static obstacle corners and query them for sparse A* moves.""" + """ + Manages corners of static obstacles for sparse A* / Visibility Graph jumps. + """ __slots__ = ( "collision_engine", "corners", - "_exact_corners", "corner_index", + "_corner_graph", "_point_visibility_cache", "_corner_index_version", + "_corner_graph_version", ) def __init__(self, collision_engine: RoutingWorld) -> None: self.collision_engine = collision_engine self.corners: list[tuple[float, float]] = [] - self._exact_corners: list[tuple[float, float]] = [] self.corner_index = rtree.index.Index() - self._point_visibility_cache: dict[tuple[float, float, float], list[tuple[float, float, float]]] = {} + self._corner_graph: dict[int, list[tuple[float, float, float]]] = {} + self._point_visibility_cache: dict[tuple[int, int, int], list[tuple[float, float, float]]] = {} self._corner_index_version = -1 + self._corner_graph_version = -1 def clear_cache(self) -> None: """ Reset all static visibility data. """ self.corners = [] - self._exact_corners = [] self.corner_index = rtree.index.Index() + self._corner_graph = {} self._point_visibility_cache = {} self._corner_index_version = -1 + self._corner_graph_version = -1 def ensure_corner_index_current(self) -> None: if self._corner_index_version != self.collision_engine.get_static_version(): self._build_corner_index() + def ensure_corner_graph_current(self) -> None: + self.ensure_corner_index_current() + static_version = self.collision_engine.get_static_version() + if self._corner_graph_version != static_version: + self._build_corner_graph() + def _build_corner_index(self) -> None: if self.collision_engine.metrics is not None: self.collision_engine.metrics.total_visibility_corner_index_builds += 1 self.corners = [] - self._exact_corners = [] self.corner_index = rtree.index.Index() + self._corner_graph = {} self._point_visibility_cache = {} + self._corner_graph_version = -1 self._corner_index_version = self.collision_engine.get_static_version() raw_corners = [] for poly in self.collision_engine.iter_static_dilated_geometries(): @@ -72,11 +86,45 @@ class VisibilityManager: if (sx, sy) not in seen: seen.add((sx, sy)) self.corners.append((sx, sy)) - self._exact_corners.append((x, y)) for i, (x, y) in enumerate(self.corners): self.corner_index.insert(i, (x, y, x, y)) + def _build_corner_graph(self) -> None: + """ + Pre-compute corner-to-corner visibility from the current corner index. + """ + self.ensure_corner_index_current() + if self.collision_engine.metrics is not None: + self.collision_engine.metrics.total_visibility_builds += 1 + self._corner_graph = {} + self._corner_graph_version = self.collision_engine.get_static_version() + + if not self.corners: + return + + # Pre-compute visibility graph between corners + num_corners = len(self.corners) + if num_corners > 200: + # Limit pre-computation if too many corners + return + + for i in range(num_corners): + self._corner_graph[i] = [] + p1 = Port(self.corners[i][0], self.corners[i][1], 0) + for j in range(num_corners): + if i == j: + continue + if self.collision_engine.metrics is not None: + self.collision_engine.metrics.total_visibility_corner_pairs_checked += 1 + cx, cy = self.corners[j] + dx, dy = cx - p1.x, cy - p1.y + dist = numpy.sqrt(dx**2 + dy**2) + angle = numpy.degrees(numpy.arctan2(dy, dx)) + reach = self.collision_engine.ray_cast(p1, angle, max_dist=dist + 0.05, caller="visibility_build") + if reach >= dist - 0.01: + self._corner_graph[i].append((cx, cy, dist)) + def _corner_idx_at(self, origin: Port) -> int | None: self.ensure_corner_index_current() ox, oy = round(origin.x, 3), round(origin.y, 3) @@ -130,49 +178,66 @@ class VisibilityManager: return sorted(candidate_ids) - def get_corner_visibility(self, origin: Port, max_dist: float = 1000.0) -> list[tuple[float, float, float]]: - """Return visible neighbors when the origin is at an indexed corner.""" - metrics = self.collision_engine.metrics - if metrics is not None: - metrics.total_visibility_corner_queries_exact += 1 + def get_point_visibility(self, origin: Port, max_dist: float = 1000.0) -> list[tuple[float, float, float]]: + """ + Find visible corners from an arbitrary point. + This may perform direct ray-cast scans and is not intended for hot search paths. + """ + if self.collision_engine.metrics is not None: + self.collision_engine.metrics.total_visibility_point_queries += 1 + self.ensure_corner_index_current() if max_dist < 0: return [] corner_idx = self._corner_idx_at(origin) - if corner_idx is None: - return [] - if metrics is not None: - metrics.total_visibility_corner_hits_exact += 1 - metrics.total_visibility_point_queries += 1 + if corner_idx is not None: + self.ensure_corner_graph_current() + if corner_idx is not None and corner_idx in self._corner_graph: + return [corner for corner in self._corner_graph[corner_idx] if corner[2] <= max_dist] - start = self._exact_corners[corner_idx] - cache_key = (*start, max_dist) + ox, oy = round(origin.x, 3), round(origin.y, 3) + cache_key = (int(ox * 1000), int(oy * 1000), int(round(max_dist * 1000))) if cache_key in self._point_visibility_cache: - if metrics is not None: - metrics.total_visibility_point_cache_hits += 1 + if self.collision_engine.metrics is not None: + self.collision_engine.metrics.total_visibility_point_cache_hits += 1 return self._point_visibility_cache[cache_key] - if metrics is not None: - metrics.total_visibility_point_cache_misses += 1 + if self.collision_engine.metrics is not None: + self.collision_engine.metrics.total_visibility_point_cache_misses += 1 - # The index stores rounded corner coordinates. Filter by exact distance below. - reach = max_dist + 0.001 - x, y = start - bounds = (x - reach, y - reach, x + reach, y + reach) - candidates = sorted(self.corner_index.intersection(bounds)) + bounds = (origin.x - max_dist, origin.y - max_dist, origin.x + max_dist, origin.y + max_dist) + candidates = list(self.corner_index.intersection(bounds)) visible = [] for i in candidates: - end = self._exact_corners[i] - dist = hypot(end[0] - x, end[1] - y) + cx, cy = self.corners[i] + dx, dy = cx - origin.x, cy - origin.y + dist = numpy.sqrt(dx**2 + dy**2) - if dist == 0 or dist > max_dist: + if dist > max_dist or dist < 1e-3: continue - if self.collision_engine.corner_segment_visible(start, end): - cx, cy = self.corners[i] + angle = numpy.degrees(numpy.arctan2(dy, dx)) + reach = self.collision_engine.ray_cast(origin, angle, max_dist=dist + 0.05, caller="visibility_query") + if reach >= dist - 0.01: visible.append((cx, cy, dist)) - if len(self._point_visibility_cache) >= 4096: - self._point_visibility_cache.clear() self._point_visibility_cache[cache_key] = visible return visible + + def get_corner_visibility(self, origin: Port, max_dist: float = 1000.0) -> list[tuple[float, float, float]]: + """ + Return precomputed visibility only when the origin is already at a known corner. + This avoids the expensive arbitrary-point visibility scan in hot search paths. + """ + if self.collision_engine.metrics is not None: + self.collision_engine.metrics.total_visibility_corner_queries_exact += 1 + self.ensure_corner_graph_current() + if max_dist < 0: + return [] + + corner_idx = self._corner_idx_at(origin) + if corner_idx is not None and corner_idx in self._corner_graph: + if self.collision_engine.metrics is not None: + self.collision_engine.metrics.total_visibility_corner_hits_exact += 1 + return [corner for corner in self._corner_graph[corner_idx] if corner[2] <= max_dist] + return [] diff --git a/inire/tests/data/crow_launch_cases.json b/inire/tests/data/crow_launch_cases.json deleted file mode 100644 index 35700cc..0000000 --- a/inire/tests/data/crow_launch_cases.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "layout": "https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/masihb_crow1_mzi_v1.gds", - "units": "1 nm", - "keepout_construction": "Crop original silicon to the removed guide footprint bounds plus 12000 nm on all sides, subtract the selected guide, then open rectangular port notches by 72 nm in the longitudinal direction and by half the port width plus 72 nm laterally on each side of its center.", - "cases": [ - {"id":2,"start":[49700,-267710,270],"target":[50180,-308570,180],"bounds":[37450.0,-320820.0,77620.0,-255710.0],"width":500,"keepouts":[[[[37450.0,-312772.76096213603],[37450.0,-304367.23903786397],[50108.0,-308297.6434572448],[50108.0,-308842.3565427552],[37450.0,-312772.76096213603]],[]],[[[49450.0,-266309.0],[49451.0,-266299.0],[49451.0,-266297.0],[49452.0,-266286.0],[49452.0,-266285.0],[49453.0,-266273.0],[49453.0,-266271.0],[49454.0,-266257.0],[49454.0,-266255.0],[49455.0,-266236.0],[49455.0,-266193.0],[49454.0,-266178.0],[49454.0,-266176.0],[49453.0,-266166.0],[49453.0,-266165.0],[49450.0,-266143.0],[49447.0,-266127.0],[49446.0,-266123.0],[49445.0,-266118.0],[49442.0,-266106.0],[49437.0,-266088.0],[49434.0,-266078.0],[49415.0,-266021.0],[49410.0,-266007.0],[49401.0,-265980.0],[49396.0,-265964.0],[49390.0,-265944.0],[49389.0,-265940.0],[49388.0,-265937.0],[49387.0,-265933.0],[49386.0,-265930.0],[49385.0,-265926.0],[49384.0,-265923.0],[49383.0,-265919.0],[49379.0,-265905.0],[49378.0,-265901.0],[49377.0,-265898.0],[49376.0,-265894.0],[49368.0,-265866.0],[49362.0,-265846.0],[49349.0,-265807.0],[49347.0,-265802.0],[49346.0,-265799.0],[49344.0,-265794.0],[49343.0,-265791.0],[49339.0,-265781.0],[49338.0,-265779.0],[49333.0,-265767.0],[49331.0,-265763.0],[49326.0,-265752.0],[49322.0,-265744.0],[49315.0,-265731.0],[49311.0,-265724.0],[49305.0,-265714.0],[49303.0,-265711.0],[49300.0,-265706.0],[49296.0,-265700.0],[49289.0,-265690.0],[49280.0,-265678.0],[49272.0,-265668.0],[49271.0,-265667.0],[49267.0,-265662.0],[49260.0,-265654.0],[49221.0,-265615.0],[49212.0,-265607.0],[49210.0,-265605.0],[49193.0,-265590.0],[49187.0,-265585.0],[49186.0,-265584.0],[49180.0,-265579.0],[49179.0,-265578.0],[49173.0,-265573.0],[49172.0,-265572.0],[49166.0,-265567.0],[49165.0,-265566.0],[49159.0,-265561.0],[49158.0,-265560.0],[49152.0,-265555.0],[49143.0,-265547.0],[49137.0,-265542.0],[49135.0,-265540.0],[49119.0,-265526.0],[49117.0,-265524.0],[49106.0,-265514.0],[49081.0,-265489.0],[49072.0,-265479.0],[49067.0,-265473.0],[49066.0,-265472.0],[49062.0,-265467.0],[49053.0,-265455.0],[49046.0,-265445.0],[49038.0,-265432.0],[49034.0,-265425.0],[49026.0,-265409.0],[49023.0,-265402.0],[49022.0,-265400.0],[49017.0,-265387.0],[49012.0,-265372.0],[49008.0,-265357.0],[49006.0,-265348.0],[49004.0,-265338.0],[49002.0,-265326.0],[49002.0,-265325.0],[49001.0,-265319.0],[49001.0,-265318.0],[48999.0,-265301.0],[48999.0,-265299.0],[48998.0,-265288.0],[48998.0,-265285.0],[48997.0,-265267.0],[48997.0,-265220.0],[48998.0,-265194.0],[48998.0,-265190.0],[48999.0,-265170.0],[48999.0,-265166.0],[49000.0,-265145.0],[49000.0,-265141.0],[49001.0,-265114.0],[49001.0,-265005.0],[49000.0,-264979.0],[49000.0,-264975.0],[48999.0,-264955.0],[48999.0,-264952.0],[48998.0,-264933.0],[48998.0,-264929.0],[48997.0,-264907.0],[48997.0,-264848.0],[48998.0,-264832.0],[48998.0,-264830.0],[48999.0,-264820.0],[48999.0,-264819.0],[49001.0,-264802.0],[49002.0,-264795.0],[49004.0,-264783.0],[49008.0,-264763.0],[49010.0,-264754.0],[49015.0,-264734.0],[49016.0,-264731.0],[49019.0,-264720.0],[49020.0,-264717.0],[49021.0,-264713.0],[49023.0,-264707.0],[49026.0,-264697.0],[49031.0,-264682.0],[49035.0,-264671.0],[49037.0,-264665.0],[49047.0,-264638.0],[49049.0,-264633.0],[49050.0,-264630.0],[49054.0,-264620.0],[49055.0,-264617.0],[49061.0,-264602.0],[49062.0,-264599.0],[49066.0,-264589.0],[49067.0,-264586.0],[49069.0,-264581.0],[49070.0,-264578.0],[49072.0,-264573.0],[49073.0,-264570.0],[49075.0,-264565.0],[49083.0,-264542.0],[49091.0,-264516.0],[49097.0,-264492.0],[49100.0,-264477.0],[49101.0,-264471.0],[49101.0,-264470.0],[49102.0,-264464.0],[49103.0,-264456.0],[49103.0,-264455.0],[49104.0,-264446.0],[49104.0,-264445.0],[49105.0,-264433.0],[49105.0,-264377.0],[49104.0,-264361.0],[49104.0,-264359.0],[49103.0,-264347.0],[49103.0,-264345.0],[49102.0,-264334.0],[49102.0,-264333.0],[49101.0,-264322.0],[49101.0,-264321.0],[49100.0,-264311.0],[49100.0,-264310.0],[49100.0,-264266.0],[49099.0,-264166.0],[49099.0,-264154.0],[49098.0,-264103.0],[49098.0,-264093.0],[49097.0,-264054.0],[49097.0,-264047.0],[49096.0,-264013.0],[49096.0,-264008.0],[49095.0,-263976.0],[49095.0,-263974.0],[49094.0,-263945.0],[49094.0,-263940.0],[49093.0,-263913.0],[49093.0,-263911.0],[49092.0,-263886.0],[49092.0,-263884.0],[49091.0,-263862.0],[49091.0,-263860.0],[49090.0,-263838.0],[49090.0,-263835.0],[49089.0,-263814.0],[49089.0,-263811.0],[49088.0,-263792.0],[49088.0,-263789.0],[49087.0,-263770.0],[49087.0,-263768.0],[49084.0,-263712.0],[49084.0,-263710.0],[49080.0,-263640.0],[49080.0,-263639.0],[49078.0,-263608.0],[49078.0,-263606.0],[49071.0,-263502.0],[49070.0,-263490.0],[49070.0,-263488.0],[49066.0,-263435.0],[49062.0,-263387.0],[49062.0,-263385.0],[49060.0,-263361.0],[49057.0,-263328.0],[49055.0,-263304.0],[49043.0,-263178.0],[49035.0,-263102.0],[49022.0,-262987.0],[49015.0,-262929.0],[49014.0,-262922.0],[49004.0,-262843.0],[49002.0,-262829.0],[49000.0,-262813.0],[48994.0,-262769.0],[48976.0,-262644.0],[48962.0,-262553.0],[48959.0,-262535.0],[48958.0,-262528.0],[48955.0,-262510.0],[48954.0,-262503.0],[48939.0,-262413.0],[48937.0,-262402.0],[48934.0,-262384.0],[48930.0,-262362.0],[48928.0,-262350.0],[48904.0,-262219.0],[48897.0,-262182.0],[48888.0,-262136.0],[48874.0,-262066.0],[48866.0,-262027.0],[48864.0,-262018.0],[48861.0,-262003.0],[48860.0,-261999.0],[48836.0,-261887.0],[48835.0,-261883.0],[48828.0,-261851.0],[48827.0,-261847.0],[48826.0,-261842.0],[48809.0,-261768.0],[48771.0,-261609.0],[48754.0,-261541.0],[48744.0,-261502.0],[48726.0,-261433.0],[48702.0,-261344.0],[48686.0,-261286.0],[48659.0,-261191.0],[48646.0,-261146.0],[48642.0,-261133.0],[48624.0,-261072.0],[48599.0,-260990.0],[48597.0,-260984.0],[48590.0,-260961.0],[48566.0,-260885.0],[48546.0,-260823.0],[48498.0,-260679.0],[48491.0,-260659.0],[48486.0,-260644.0],[48481.0,-260630.0],[48469.0,-260595.0],[48432.0,-260491.0],[48405.0,-260417.0],[48377.0,-260342.0],[48375.0,-260337.0],[48371.0,-260326.0],[48350.0,-260271.0],[48346.0,-260261.0],[48344.0,-260255.0],[47490.0,-258045.0],[47489.0,-258043.0],[47476.0,-258009.0],[47472.0,-257999.0],[47434.0,-257898.0],[47405.0,-257819.0],[47382.0,-257755.0],[47342.0,-257641.0],[47338.0,-257629.0],[47331.0,-257609.0],[47324.0,-257588.0],[47310.0,-257547.0],[47277.0,-257447.0],[47258.0,-257388.0],[47228.0,-257293.0],[47202.0,-257208.0],[47173.0,-257110.0],[47172.0,-257107.0],[47168.0,-257093.0],[47167.0,-257090.0],[47155.0,-257048.0],[47152.0,-257038.0],[47140.0,-256995.0],[47137.0,-256985.0],[47107.0,-256876.0],[47105.0,-256868.0],[47100.0,-256850.0],[47098.0,-256842.0],[47096.0,-256835.0],[47094.0,-256827.0],[47087.0,-256801.0],[47066.0,-256720.0],[47035.0,-256596.0],[47030.0,-256575.0],[47026.0,-256559.0],[47019.0,-256529.0],[47012.0,-256500.0],[46997.0,-256435.0],[46982.0,-256369.0],[46979.0,-256355.0],[46974.0,-256333.0],[46955.0,-256245.0],[46938.0,-256163.0],[46916.0,-256053.0],[46915.0,-256047.0],[46910.0,-256022.0],[46909.0,-256016.0],[46897.0,-255953.0],[46896.0,-255947.0],[46890.0,-255915.0],[46874.0,-255825.0],[46871.0,-255807.0],[46870.0,-255802.0],[46863.0,-255760.0],[46861.0,-255749.0],[46854.641304347824,-255710.0],[47361.545454545456,-255710.0],[47363.0,-255718.0],[47366.0,-255736.0],[47370.0,-255758.0],[47372.0,-255770.0],[47395.0,-255896.0],[47403.0,-255938.0],[47412.0,-255984.0],[47426.0,-256054.0],[47434.0,-256093.0],[47436.0,-256102.0],[47439.0,-256117.0],[47440.0,-256121.0],[47445.0,-256145.0],[47462.0,-256224.0],[47465.0,-256237.0],[47472.0,-256269.0],[47473.0,-256273.0],[47474.0,-256278.0],[47490.0,-256348.0],[47529.0,-256511.0],[47546.0,-256579.0],[47574.0,-256687.0],[47604.0,-256798.0],[47625.0,-256873.0],[47654.0,-256974.0],[47658.0,-256987.0],[47670.0,-257028.0],[47701.0,-257130.0],[47703.0,-257136.0],[47706.0,-257146.0],[47734.0,-257235.0],[47754.0,-257297.0],[47802.0,-257441.0],[47809.0,-257461.0],[47814.0,-257476.0],[47819.0,-257490.0],[47831.0,-257525.0],[47859.0,-257604.0],[47880.0,-257662.0],[47923.0,-257778.0],[47925.0,-257783.0],[47929.0,-257794.0],[47950.0,-257849.0],[47954.0,-257859.0],[47956.0,-257865.0],[48810.0,-260075.0],[48811.0,-260077.0],[48824.0,-260111.0],[48828.0,-260121.0],[48866.0,-260222.0],[48887.0,-260279.0],[48918.0,-260365.0],[48929.0,-260396.0],[48958.0,-260479.0],[48962.0,-260491.0],[48969.0,-260511.0],[48976.0,-260532.0],[48990.0,-260573.0],[49023.0,-260673.0],[49042.0,-260732.0],[49072.0,-260827.0],[49101.0,-260922.0],[49128.0,-261013.0],[49132.0,-261027.0],[49133.0,-261030.0],[49145.0,-261072.0],[49148.0,-261082.0],[49160.0,-261125.0],[49163.0,-261135.0],[49193.0,-261244.0],[49195.0,-261252.0],[49200.0,-261270.0],[49202.0,-261278.0],[49204.0,-261285.0],[49206.0,-261293.0],[49213.0,-261319.0],[49234.0,-261400.0],[49265.0,-261524.0],[49270.0,-261545.0],[49274.0,-261561.0],[49288.0,-261620.0],[49293.0,-261642.0],[49295.0,-261650.0],[49318.0,-261751.0],[49321.0,-261765.0],[49324.0,-261778.0],[49345.0,-261875.0],[49362.0,-261957.0],[49384.0,-262067.0],[49385.0,-262073.0],[49390.0,-262098.0],[49391.0,-262104.0],[49410.0,-262205.0],[49423.0,-262278.0],[49429.0,-262313.0],[49430.0,-262318.0],[49437.0,-262360.0],[49439.0,-262371.0],[49454.0,-262463.0],[49466.0,-262540.0],[49478.0,-262621.0],[49485.0,-262670.0],[49487.0,-262685.0],[49488.0,-262691.0],[49503.0,-262803.0],[49503.0,-262804.0],[49507.0,-262834.0],[49508.0,-262843.0],[49509.0,-262850.0],[49510.0,-262859.0],[49512.0,-262874.0],[49518.0,-262924.0],[49520.0,-262942.0],[49522.0,-262958.0],[49529.0,-263020.0],[49538.0,-263104.0],[49549.0,-263216.0],[49549.0,-263217.0],[49551.0,-263239.0],[49552.0,-263248.0],[49553.0,-263261.0],[49558.0,-263317.0],[49558.0,-263318.0],[49561.0,-263353.0],[49565.0,-263403.0],[49565.0,-263404.0],[49569.0,-263457.0],[49569.0,-263458.0],[49570.0,-263470.0],[49571.0,-263486.0],[49572.0,-263499.0],[49573.0,-263515.0],[49574.0,-263528.0],[49576.0,-263559.0],[49576.0,-263560.0],[49577.0,-263575.0],[49577.0,-263576.0],[49580.0,-263624.0],[49583.0,-263678.0],[49583.0,-263679.0],[49584.0,-263697.0],[49584.0,-263698.0],[49586.0,-263736.0],[49586.0,-263737.0],[49587.0,-263756.0],[49587.0,-263759.0],[49588.0,-263778.0],[49588.0,-263779.0],[49590.0,-263824.0],[49590.0,-263827.0],[49591.0,-263849.0],[49591.0,-263850.0],[49592.0,-263875.0],[49592.0,-263878.0],[49593.0,-263904.0],[49593.0,-263905.0],[49594.0,-263933.0],[49594.0,-263937.0],[49595.0,-263966.0],[49595.0,-263969.0],[49596.0,-264001.0],[49596.0,-264005.0],[49597.0,-264043.0],[49597.0,-264047.0],[49598.0,-264089.0],[49598.0,-264096.0],[49599.0,-264151.0],[49599.0,-264164.0],[49600.0,-264268.0],[49600.0,-264310.0],[49800.0,-264310.0],[49800.0,-264268.0],[49801.0,-264164.0],[49801.0,-264151.0],[49802.0,-264096.0],[49802.0,-264089.0],[49803.0,-264047.0],[49803.0,-264043.0],[49804.0,-264005.0],[49804.0,-264001.0],[49805.0,-263969.0],[49805.0,-263966.0],[49806.0,-263937.0],[49806.0,-263933.0],[49807.0,-263905.0],[49807.0,-263904.0],[49808.0,-263878.0],[49808.0,-263875.0],[49809.0,-263850.0],[49809.0,-263849.0],[49810.0,-263827.0],[49810.0,-263824.0],[49812.0,-263779.0],[49812.0,-263778.0],[49813.0,-263759.0],[49813.0,-263756.0],[49814.0,-263737.0],[49814.0,-263736.0],[49816.0,-263698.0],[49816.0,-263697.0],[49817.0,-263679.0],[49817.0,-263678.0],[49820.0,-263624.0],[49823.0,-263576.0],[49823.0,-263575.0],[49824.0,-263560.0],[49824.0,-263559.0],[49826.0,-263528.0],[49827.0,-263515.0],[49828.0,-263499.0],[49829.0,-263486.0],[49830.0,-263470.0],[49831.0,-263458.0],[49831.0,-263457.0],[49835.0,-263404.0],[49835.0,-263403.0],[49839.0,-263353.0],[49842.0,-263318.0],[49842.0,-263317.0],[49847.0,-263261.0],[49848.0,-263248.0],[49849.0,-263239.0],[49851.0,-263217.0],[49851.0,-263216.0],[49862.0,-263104.0],[49871.0,-263020.0],[49878.0,-262958.0],[49880.0,-262942.0],[49882.0,-262924.0],[49888.0,-262874.0],[49890.0,-262859.0],[49891.0,-262850.0],[49892.0,-262843.0],[49893.0,-262834.0],[49897.0,-262804.0],[49897.0,-262803.0],[49912.0,-262691.0],[49913.0,-262685.0],[49915.0,-262670.0],[49922.0,-262621.0],[49934.0,-262540.0],[49946.0,-262463.0],[49961.0,-262371.0],[49963.0,-262360.0],[49970.0,-262318.0],[49971.0,-262313.0],[49977.0,-262278.0],[49990.0,-262205.0],[50009.0,-262104.0],[50010.0,-262098.0],[50015.0,-262073.0],[50016.0,-262067.0],[50038.0,-261957.0],[50055.0,-261875.0],[50076.0,-261778.0],[50079.0,-261765.0],[50082.0,-261751.0],[50105.0,-261650.0],[50107.0,-261642.0],[50112.0,-261620.0],[50126.0,-261561.0],[50130.0,-261545.0],[50135.0,-261524.0],[50166.0,-261400.0],[50187.0,-261319.0],[50194.0,-261293.0],[50196.0,-261285.0],[50198.0,-261278.0],[50200.0,-261270.0],[50205.0,-261252.0],[50207.0,-261244.0],[50237.0,-261135.0],[50240.0,-261125.0],[50252.0,-261082.0],[50255.0,-261072.0],[50267.0,-261030.0],[50268.0,-261027.0],[50272.0,-261013.0],[50299.0,-260922.0],[50328.0,-260827.0],[50358.0,-260732.0],[50377.0,-260673.0],[50410.0,-260573.0],[50424.0,-260532.0],[50431.0,-260511.0],[50438.0,-260491.0],[50442.0,-260479.0],[50471.0,-260396.0],[50482.0,-260365.0],[50513.0,-260279.0],[50534.0,-260222.0],[50572.0,-260121.0],[50576.0,-260111.0],[50589.0,-260077.0],[50590.0,-260075.0],[51444.0,-257865.0],[51446.0,-257859.0],[51450.0,-257849.0],[51471.0,-257794.0],[51475.0,-257783.0],[51477.0,-257778.0],[51520.0,-257662.0],[51541.0,-257604.0],[51569.0,-257525.0],[51581.0,-257490.0],[51586.0,-257476.0],[51591.0,-257461.0],[51598.0,-257441.0],[51646.0,-257297.0],[51666.0,-257235.0],[51694.0,-257146.0],[51697.0,-257136.0],[51699.0,-257130.0],[51730.0,-257028.0],[51742.0,-256987.0],[51746.0,-256974.0],[51775.0,-256873.0],[51796.0,-256798.0],[51826.0,-256687.0],[51854.0,-256579.0],[51871.0,-256511.0],[51910.0,-256348.0],[51926.0,-256278.0],[51927.0,-256273.0],[51928.0,-256269.0],[51935.0,-256237.0],[51938.0,-256224.0],[51955.0,-256145.0],[51960.0,-256121.0],[51961.0,-256117.0],[51964.0,-256102.0],[51966.0,-256093.0],[51974.0,-256054.0],[51988.0,-255984.0],[51997.0,-255938.0],[52005.0,-255896.0],[52028.0,-255770.0],[52030.0,-255758.0],[52034.0,-255736.0],[52037.0,-255718.0],[52038.454545454544,-255710.0],[52545.358695652176,-255710.0],[52539.0,-255749.0],[52537.0,-255760.0],[52530.0,-255802.0],[52529.0,-255807.0],[52526.0,-255825.0],[52510.0,-255915.0],[52504.0,-255947.0],[52503.0,-255953.0],[52491.0,-256016.0],[52490.0,-256022.0],[52485.0,-256047.0],[52484.0,-256053.0],[52462.0,-256163.0],[52445.0,-256245.0],[52426.0,-256333.0],[52421.0,-256355.0],[52418.0,-256369.0],[52403.0,-256435.0],[52388.0,-256500.0],[52381.0,-256529.0],[52374.0,-256559.0],[52370.0,-256575.0],[52365.0,-256596.0],[52334.0,-256720.0],[52313.0,-256801.0],[52306.0,-256827.0],[52304.0,-256835.0],[52302.0,-256842.0],[52300.0,-256850.0],[52295.0,-256868.0],[52293.0,-256876.0],[52263.0,-256985.0],[52260.0,-256995.0],[52248.0,-257038.0],[52245.0,-257048.0],[52233.0,-257090.0],[52232.0,-257093.0],[52228.0,-257107.0],[52227.0,-257110.0],[52198.0,-257208.0],[52172.0,-257293.0],[52142.0,-257388.0],[52123.0,-257447.0],[52090.0,-257547.0],[52076.0,-257588.0],[52069.0,-257609.0],[52062.0,-257629.0],[52058.0,-257641.0],[52018.0,-257755.0],[51995.0,-257819.0],[51966.0,-257898.0],[51928.0,-257999.0],[51924.0,-258009.0],[51911.0,-258043.0],[51910.0,-258045.0],[51056.0,-260255.0],[51054.0,-260261.0],[51050.0,-260271.0],[51029.0,-260326.0],[51025.0,-260337.0],[51023.0,-260342.0],[50995.0,-260417.0],[50968.0,-260491.0],[50931.0,-260595.0],[50919.0,-260630.0],[50914.0,-260644.0],[50909.0,-260659.0],[50902.0,-260679.0],[50854.0,-260823.0],[50834.0,-260885.0],[50810.0,-260961.0],[50803.0,-260984.0],[50801.0,-260990.0],[50776.0,-261072.0],[50758.0,-261133.0],[50754.0,-261146.0],[50741.0,-261191.0],[50714.0,-261286.0],[50698.0,-261344.0],[50674.0,-261433.0],[50656.0,-261502.0],[50646.0,-261541.0],[50629.0,-261609.0],[50591.0,-261768.0],[50574.0,-261842.0],[50573.0,-261847.0],[50572.0,-261851.0],[50565.0,-261883.0],[50564.0,-261887.0],[50540.0,-261999.0],[50539.0,-262003.0],[50536.0,-262018.0],[50534.0,-262027.0],[50526.0,-262066.0],[50512.0,-262136.0],[50503.0,-262182.0],[50496.0,-262219.0],[50472.0,-262350.0],[50470.0,-262362.0],[50466.0,-262384.0],[50463.0,-262402.0],[50461.0,-262413.0],[50446.0,-262503.0],[50445.0,-262510.0],[50442.0,-262528.0],[50441.0,-262535.0],[50438.0,-262553.0],[50424.0,-262644.0],[50406.0,-262769.0],[50400.0,-262813.0],[50398.0,-262829.0],[50396.0,-262843.0],[50386.0,-262922.0],[50385.0,-262929.0],[50378.0,-262987.0],[50365.0,-263102.0],[50357.0,-263178.0],[50345.0,-263304.0],[50343.0,-263328.0],[50340.0,-263361.0],[50338.0,-263385.0],[50338.0,-263387.0],[50334.0,-263435.0],[50330.0,-263488.0],[50330.0,-263490.0],[50329.0,-263502.0],[50322.0,-263606.0],[50322.0,-263608.0],[50320.0,-263639.0],[50320.0,-263640.0],[50316.0,-263710.0],[50316.0,-263712.0],[50313.0,-263768.0],[50313.0,-263770.0],[50312.0,-263789.0],[50312.0,-263792.0],[50311.0,-263811.0],[50311.0,-263814.0],[50310.0,-263835.0],[50310.0,-263838.0],[50309.0,-263860.0],[50309.0,-263862.0],[50308.0,-263884.0],[50308.0,-263886.0],[50307.0,-263911.0],[50307.0,-263913.0],[50306.0,-263940.0],[50306.0,-263945.0],[50305.0,-263974.0],[50305.0,-263976.0],[50304.0,-264008.0],[50304.0,-264013.0],[50303.0,-264047.0],[50303.0,-264054.0],[50302.0,-264093.0],[50302.0,-264103.0],[50301.0,-264154.0],[50301.0,-264166.0],[50300.0,-264266.0],[50300.0,-264310.0],[50300.0,-264311.0],[50299.0,-264321.0],[50299.0,-264322.0],[50298.0,-264333.0],[50298.0,-264334.0],[50297.0,-264345.0],[50297.0,-264347.0],[50296.0,-264359.0],[50296.0,-264361.0],[50295.0,-264377.0],[50295.0,-264433.0],[50296.0,-264445.0],[50296.0,-264446.0],[50297.0,-264455.0],[50297.0,-264456.0],[50298.0,-264464.0],[50299.0,-264470.0],[50299.0,-264471.0],[50300.0,-264477.0],[50303.0,-264492.0],[50309.0,-264516.0],[50317.0,-264542.0],[50325.0,-264565.0],[50327.0,-264570.0],[50328.0,-264573.0],[50330.0,-264578.0],[50331.0,-264581.0],[50333.0,-264586.0],[50334.0,-264589.0],[50338.0,-264599.0],[50339.0,-264602.0],[50345.0,-264617.0],[50346.0,-264620.0],[50350.0,-264630.0],[50351.0,-264633.0],[50353.0,-264638.0],[50363.0,-264665.0],[50365.0,-264671.0],[50369.0,-264682.0],[50374.0,-264697.0],[50377.0,-264707.0],[50379.0,-264713.0],[50380.0,-264717.0],[50381.0,-264720.0],[50384.0,-264731.0],[50385.0,-264734.0],[50390.0,-264754.0],[50392.0,-264763.0],[50396.0,-264783.0],[50398.0,-264795.0],[50399.0,-264802.0],[50401.0,-264819.0],[50401.0,-264820.0],[50402.0,-264830.0],[50402.0,-264832.0],[50403.0,-264848.0],[50403.0,-264907.0],[50402.0,-264929.0],[50402.0,-264933.0],[50401.0,-264952.0],[50401.0,-264955.0],[50400.0,-264975.0],[50400.0,-264979.0],[50399.0,-265005.0],[50399.0,-265114.0],[50400.0,-265141.0],[50400.0,-265145.0],[50401.0,-265166.0],[50401.0,-265170.0],[50402.0,-265190.0],[50402.0,-265194.0],[50403.0,-265220.0],[50403.0,-265267.0],[50402.0,-265285.0],[50402.0,-265288.0],[50401.0,-265299.0],[50401.0,-265301.0],[50399.0,-265318.0],[50399.0,-265319.0],[50398.0,-265325.0],[50398.0,-265326.0],[50396.0,-265338.0],[50394.0,-265348.0],[50392.0,-265357.0],[50388.0,-265372.0],[50383.0,-265387.0],[50378.0,-265400.0],[50377.0,-265402.0],[50374.0,-265409.0],[50366.0,-265425.0],[50362.0,-265432.0],[50354.0,-265445.0],[50347.0,-265455.0],[50338.0,-265467.0],[50334.0,-265472.0],[50333.0,-265473.0],[50328.0,-265479.0],[50319.0,-265489.0],[50294.0,-265514.0],[50283.0,-265524.0],[50281.0,-265526.0],[50265.0,-265540.0],[50263.0,-265542.0],[50257.0,-265547.0],[50248.0,-265555.0],[50242.0,-265560.0],[50241.0,-265561.0],[50235.0,-265566.0],[50234.0,-265567.0],[50228.0,-265572.0],[50227.0,-265573.0],[50221.0,-265578.0],[50220.0,-265579.0],[50214.0,-265584.0],[50213.0,-265585.0],[50207.0,-265590.0],[50190.0,-265605.0],[50188.0,-265607.0],[50179.0,-265615.0],[50140.0,-265654.0],[50133.0,-265662.0],[50129.0,-265667.0],[50128.0,-265668.0],[50120.0,-265678.0],[50111.0,-265690.0],[50104.0,-265700.0],[50100.0,-265706.0],[50097.0,-265711.0],[50095.0,-265714.0],[50089.0,-265724.0],[50085.0,-265731.0],[50078.0,-265744.0],[50074.0,-265752.0],[50069.0,-265763.0],[50067.0,-265767.0],[50062.0,-265779.0],[50061.0,-265781.0],[50057.0,-265791.0],[50056.0,-265794.0],[50054.0,-265799.0],[50053.0,-265802.0],[50051.0,-265807.0],[50038.0,-265846.0],[50032.0,-265866.0],[50024.0,-265894.0],[50023.0,-265898.0],[50022.0,-265901.0],[50021.0,-265905.0],[50017.0,-265919.0],[50016.0,-265923.0],[50015.0,-265926.0],[50014.0,-265930.0],[50013.0,-265933.0],[50012.0,-265937.0],[50011.0,-265940.0],[50010.0,-265944.0],[50004.0,-265964.0],[49999.0,-265980.0],[49990.0,-266007.0],[49985.0,-266021.0],[49966.0,-266078.0],[49963.0,-266088.0],[49958.0,-266106.0],[49955.0,-266118.0],[49954.0,-266123.0],[49953.0,-266127.0],[49950.0,-266143.0],[49947.0,-266165.0],[49947.0,-266166.0],[49946.0,-266176.0],[49946.0,-266178.0],[49945.0,-266193.0],[49945.0,-266236.0],[49946.0,-266255.0],[49946.0,-266257.0],[49947.0,-266271.0],[49947.0,-266273.0],[49948.0,-266285.0],[49948.0,-266286.0],[49949.0,-266297.0],[49949.0,-266299.0],[49950.0,-266309.0],[49950.0,-266310.0],[49950.0,-267638.0],[49450.0,-267638.0],[49450.0,-266310.0],[49450.0,-266309.0]],[]],[[[74200.0,-320820.0],[73700.0,-320820.0],[73700.0,-255710.0],[74200.0,-255710.0],[74200.0,-320820.0]],[]]]}, - {"id":7,"start":[115030,-267710,270],"target":[115299,-308570,180],"bounds":[102780.0,-320820.0,143510.0,-255710.0],"width":500,"keepouts":[[[[102780.0,-312707.2438715617],[102780.0,-304432.7561284383],[115227.0,-308297.6434572448],[115227.0,-308842.3565427552],[102780.0,-312707.2438715617]],[]],[[[114780.0,-266309.0],[114781.0,-266299.0],[114781.0,-266297.0],[114782.0,-266286.0],[114782.0,-266285.0],[114783.0,-266273.0],[114783.0,-266271.0],[114784.0,-266257.0],[114784.0,-266255.0],[114785.0,-266236.0],[114785.0,-266193.0],[114784.0,-266178.0],[114784.0,-266176.0],[114783.0,-266166.0],[114783.0,-266165.0],[114780.0,-266143.0],[114777.0,-266127.0],[114776.0,-266123.0],[114775.0,-266118.0],[114772.0,-266106.0],[114767.0,-266088.0],[114764.0,-266078.0],[114745.0,-266021.0],[114740.0,-266007.0],[114731.0,-265980.0],[114726.0,-265964.0],[114720.0,-265944.0],[114719.0,-265940.0],[114718.0,-265937.0],[114717.0,-265933.0],[114716.0,-265930.0],[114715.0,-265926.0],[114714.0,-265923.0],[114713.0,-265919.0],[114709.0,-265905.0],[114708.0,-265901.0],[114707.0,-265898.0],[114706.0,-265894.0],[114698.0,-265866.0],[114692.0,-265846.0],[114679.0,-265807.0],[114677.0,-265802.0],[114676.0,-265799.0],[114674.0,-265794.0],[114673.0,-265791.0],[114669.0,-265781.0],[114668.0,-265779.0],[114663.0,-265767.0],[114661.0,-265763.0],[114656.0,-265752.0],[114652.0,-265744.0],[114645.0,-265731.0],[114641.0,-265724.0],[114635.0,-265714.0],[114633.0,-265711.0],[114630.0,-265706.0],[114626.0,-265700.0],[114619.0,-265690.0],[114610.0,-265678.0],[114602.0,-265668.0],[114601.0,-265667.0],[114597.0,-265662.0],[114590.0,-265654.0],[114551.0,-265615.0],[114542.0,-265607.0],[114540.0,-265605.0],[114523.0,-265590.0],[114517.0,-265585.0],[114516.0,-265584.0],[114510.0,-265579.0],[114509.0,-265578.0],[114503.0,-265573.0],[114502.0,-265572.0],[114496.0,-265567.0],[114495.0,-265566.0],[114489.0,-265561.0],[114488.0,-265560.0],[114482.0,-265555.0],[114473.0,-265547.0],[114467.0,-265542.0],[114465.0,-265540.0],[114449.0,-265526.0],[114447.0,-265524.0],[114436.0,-265514.0],[114411.0,-265489.0],[114402.0,-265479.0],[114397.0,-265473.0],[114396.0,-265472.0],[114392.0,-265467.0],[114383.0,-265455.0],[114376.0,-265445.0],[114368.0,-265432.0],[114364.0,-265425.0],[114356.0,-265409.0],[114353.0,-265402.0],[114352.0,-265400.0],[114347.0,-265387.0],[114342.0,-265372.0],[114338.0,-265357.0],[114336.0,-265348.0],[114334.0,-265338.0],[114332.0,-265326.0],[114332.0,-265325.0],[114331.0,-265319.0],[114331.0,-265318.0],[114329.0,-265301.0],[114329.0,-265299.0],[114328.0,-265288.0],[114328.0,-265285.0],[114327.0,-265267.0],[114327.0,-265220.0],[114328.0,-265194.0],[114328.0,-265190.0],[114329.0,-265170.0],[114329.0,-265166.0],[114330.0,-265145.0],[114330.0,-265141.0],[114331.0,-265114.0],[114331.0,-265005.0],[114330.0,-264979.0],[114330.0,-264975.0],[114329.0,-264955.0],[114329.0,-264952.0],[114328.0,-264933.0],[114328.0,-264929.0],[114327.0,-264907.0],[114327.0,-264848.0],[114328.0,-264832.0],[114328.0,-264830.0],[114329.0,-264820.0],[114329.0,-264819.0],[114331.0,-264802.0],[114332.0,-264795.0],[114334.0,-264783.0],[114338.0,-264763.0],[114340.0,-264754.0],[114345.0,-264734.0],[114346.0,-264731.0],[114349.0,-264720.0],[114350.0,-264717.0],[114351.0,-264713.0],[114353.0,-264707.0],[114356.0,-264697.0],[114361.0,-264682.0],[114365.0,-264671.0],[114367.0,-264665.0],[114377.0,-264638.0],[114379.0,-264633.0],[114380.0,-264630.0],[114384.0,-264620.0],[114385.0,-264617.0],[114391.0,-264602.0],[114392.0,-264599.0],[114396.0,-264589.0],[114397.0,-264586.0],[114399.0,-264581.0],[114400.0,-264578.0],[114402.0,-264573.0],[114403.0,-264570.0],[114405.0,-264565.0],[114413.0,-264542.0],[114421.0,-264516.0],[114427.0,-264492.0],[114430.0,-264477.0],[114431.0,-264471.0],[114431.0,-264470.0],[114432.0,-264464.0],[114433.0,-264456.0],[114433.0,-264455.0],[114434.0,-264446.0],[114434.0,-264445.0],[114435.0,-264433.0],[114435.0,-264377.0],[114434.0,-264361.0],[114434.0,-264359.0],[114433.0,-264347.0],[114433.0,-264345.0],[114432.0,-264334.0],[114432.0,-264333.0],[114431.0,-264322.0],[114431.0,-264321.0],[114430.0,-264311.0],[114430.0,-264310.0],[114430.0,-264266.0],[114429.0,-264166.0],[114429.0,-264154.0],[114428.0,-264103.0],[114428.0,-264093.0],[114427.0,-264054.0],[114427.0,-264047.0],[114426.0,-264013.0],[114426.0,-264008.0],[114425.0,-263976.0],[114425.0,-263974.0],[114424.0,-263945.0],[114424.0,-263940.0],[114423.0,-263913.0],[114423.0,-263911.0],[114422.0,-263886.0],[114422.0,-263884.0],[114421.0,-263862.0],[114421.0,-263860.0],[114420.0,-263838.0],[114420.0,-263835.0],[114419.0,-263814.0],[114419.0,-263811.0],[114418.0,-263792.0],[114418.0,-263789.0],[114417.0,-263770.0],[114417.0,-263768.0],[114414.0,-263712.0],[114414.0,-263710.0],[114410.0,-263640.0],[114410.0,-263639.0],[114408.0,-263608.0],[114408.0,-263606.0],[114401.0,-263502.0],[114400.0,-263490.0],[114400.0,-263488.0],[114396.0,-263435.0],[114392.0,-263387.0],[114392.0,-263385.0],[114390.0,-263361.0],[114387.0,-263328.0],[114385.0,-263304.0],[114373.0,-263178.0],[114365.0,-263102.0],[114352.0,-262987.0],[114345.0,-262929.0],[114344.0,-262922.0],[114334.0,-262843.0],[114332.0,-262829.0],[114330.0,-262813.0],[114324.0,-262769.0],[114306.0,-262644.0],[114292.0,-262553.0],[114289.0,-262535.0],[114288.0,-262528.0],[114285.0,-262510.0],[114284.0,-262503.0],[114269.0,-262413.0],[114267.0,-262402.0],[114264.0,-262384.0],[114260.0,-262362.0],[114258.0,-262350.0],[114234.0,-262219.0],[114227.0,-262182.0],[114218.0,-262136.0],[114204.0,-262066.0],[114196.0,-262027.0],[114194.0,-262018.0],[114191.0,-262003.0],[114190.0,-261999.0],[114166.0,-261887.0],[114165.0,-261883.0],[114158.0,-261851.0],[114157.0,-261847.0],[114156.0,-261842.0],[114139.0,-261768.0],[114101.0,-261609.0],[114084.0,-261541.0],[114074.0,-261502.0],[114056.0,-261433.0],[114032.0,-261344.0],[114016.0,-261286.0],[113989.0,-261191.0],[113976.0,-261146.0],[113972.0,-261133.0],[113954.0,-261072.0],[113929.0,-260990.0],[113927.0,-260984.0],[113920.0,-260961.0],[113896.0,-260885.0],[113876.0,-260823.0],[113828.0,-260679.0],[113821.0,-260659.0],[113816.0,-260644.0],[113811.0,-260630.0],[113799.0,-260595.0],[113762.0,-260491.0],[113735.0,-260417.0],[113707.0,-260342.0],[113705.0,-260337.0],[113701.0,-260326.0],[113680.0,-260271.0],[113676.0,-260261.0],[113674.0,-260255.0],[112820.0,-258045.0],[112819.0,-258043.0],[112806.0,-258009.0],[112802.0,-257999.0],[112764.0,-257898.0],[112735.0,-257819.0],[112712.0,-257755.0],[112672.0,-257641.0],[112668.0,-257629.0],[112661.0,-257609.0],[112654.0,-257588.0],[112640.0,-257547.0],[112607.0,-257447.0],[112588.0,-257388.0],[112558.0,-257293.0],[112532.0,-257208.0],[112503.0,-257110.0],[112502.0,-257107.0],[112498.0,-257093.0],[112497.0,-257090.0],[112485.0,-257048.0],[112482.0,-257038.0],[112470.0,-256995.0],[112467.0,-256985.0],[112437.0,-256876.0],[112435.0,-256868.0],[112430.0,-256850.0],[112428.0,-256842.0],[112426.0,-256835.0],[112424.0,-256827.0],[112417.0,-256801.0],[112396.0,-256720.0],[112365.0,-256596.0],[112360.0,-256575.0],[112356.0,-256559.0],[112349.0,-256529.0],[112342.0,-256500.0],[112327.0,-256435.0],[112312.0,-256369.0],[112309.0,-256355.0],[112304.0,-256333.0],[112285.0,-256245.0],[112268.0,-256163.0],[112246.0,-256053.0],[112245.0,-256047.0],[112240.0,-256022.0],[112239.0,-256016.0],[112227.0,-255953.0],[112226.0,-255947.0],[112220.0,-255915.0],[112204.0,-255825.0],[112201.0,-255807.0],[112200.0,-255802.0],[112193.0,-255760.0],[112191.0,-255749.0],[112184.64130434782,-255710.0],[112691.54545454546,-255710.0],[112693.0,-255718.0],[112696.0,-255736.0],[112700.0,-255758.0],[112702.0,-255770.0],[112725.0,-255896.0],[112733.0,-255938.0],[112742.0,-255984.0],[112756.0,-256054.0],[112764.0,-256093.0],[112766.0,-256102.0],[112769.0,-256117.0],[112770.0,-256121.0],[112775.0,-256145.0],[112792.0,-256224.0],[112795.0,-256237.0],[112802.0,-256269.0],[112803.0,-256273.0],[112804.0,-256278.0],[112820.0,-256348.0],[112859.0,-256511.0],[112876.0,-256579.0],[112904.0,-256687.0],[112934.0,-256798.0],[112955.0,-256873.0],[112984.0,-256974.0],[112988.0,-256987.0],[113000.0,-257028.0],[113031.0,-257130.0],[113033.0,-257136.0],[113036.0,-257146.0],[113064.0,-257235.0],[113084.0,-257297.0],[113132.0,-257441.0],[113139.0,-257461.0],[113144.0,-257476.0],[113149.0,-257490.0],[113161.0,-257525.0],[113189.0,-257604.0],[113210.0,-257662.0],[113253.0,-257778.0],[113255.0,-257783.0],[113259.0,-257794.0],[113280.0,-257849.0],[113284.0,-257859.0],[113286.0,-257865.0],[114140.0,-260075.0],[114141.0,-260077.0],[114154.0,-260111.0],[114158.0,-260121.0],[114196.0,-260222.0],[114217.0,-260279.0],[114248.0,-260365.0],[114259.0,-260396.0],[114288.0,-260479.0],[114292.0,-260491.0],[114299.0,-260511.0],[114306.0,-260532.0],[114320.0,-260573.0],[114353.0,-260673.0],[114372.0,-260732.0],[114402.0,-260827.0],[114431.0,-260922.0],[114458.0,-261013.0],[114462.0,-261027.0],[114463.0,-261030.0],[114475.0,-261072.0],[114478.0,-261082.0],[114490.0,-261125.0],[114493.0,-261135.0],[114523.0,-261244.0],[114525.0,-261252.0],[114530.0,-261270.0],[114532.0,-261278.0],[114534.0,-261285.0],[114536.0,-261293.0],[114543.0,-261319.0],[114564.0,-261400.0],[114595.0,-261524.0],[114600.0,-261545.0],[114604.0,-261561.0],[114618.0,-261620.0],[114623.0,-261642.0],[114625.0,-261650.0],[114648.0,-261751.0],[114651.0,-261765.0],[114654.0,-261778.0],[114675.0,-261875.0],[114692.0,-261957.0],[114714.0,-262067.0],[114715.0,-262073.0],[114720.0,-262098.0],[114721.0,-262104.0],[114740.0,-262205.0],[114753.0,-262278.0],[114759.0,-262313.0],[114760.0,-262318.0],[114767.0,-262360.0],[114769.0,-262371.0],[114784.0,-262463.0],[114796.0,-262540.0],[114808.0,-262621.0],[114815.0,-262670.0],[114817.0,-262685.0],[114818.0,-262691.0],[114833.0,-262803.0],[114833.0,-262804.0],[114837.0,-262834.0],[114838.0,-262843.0],[114839.0,-262850.0],[114840.0,-262859.0],[114842.0,-262874.0],[114848.0,-262924.0],[114850.0,-262942.0],[114852.0,-262958.0],[114859.0,-263020.0],[114868.0,-263104.0],[114879.0,-263216.0],[114879.0,-263217.0],[114881.0,-263239.0],[114882.0,-263248.0],[114883.0,-263261.0],[114888.0,-263317.0],[114888.0,-263318.0],[114891.0,-263353.0],[114895.0,-263403.0],[114895.0,-263404.0],[114899.0,-263457.0],[114899.0,-263458.0],[114900.0,-263470.0],[114901.0,-263486.0],[114902.0,-263499.0],[114903.0,-263515.0],[114904.0,-263528.0],[114906.0,-263559.0],[114906.0,-263560.0],[114907.0,-263575.0],[114907.0,-263576.0],[114910.0,-263624.0],[114913.0,-263678.0],[114913.0,-263679.0],[114914.0,-263697.0],[114914.0,-263698.0],[114916.0,-263736.0],[114916.0,-263737.0],[114917.0,-263756.0],[114917.0,-263759.0],[114918.0,-263778.0],[114918.0,-263779.0],[114920.0,-263824.0],[114920.0,-263827.0],[114921.0,-263849.0],[114921.0,-263850.0],[114922.0,-263875.0],[114922.0,-263878.0],[114923.0,-263904.0],[114923.0,-263905.0],[114924.0,-263933.0],[114924.0,-263937.0],[114925.0,-263966.0],[114925.0,-263969.0],[114926.0,-264001.0],[114926.0,-264005.0],[114927.0,-264043.0],[114927.0,-264047.0],[114928.0,-264089.0],[114928.0,-264096.0],[114929.0,-264151.0],[114929.0,-264164.0],[114930.0,-264268.0],[114930.0,-264310.0],[115130.0,-264310.0],[115130.0,-264268.0],[115131.0,-264164.0],[115131.0,-264151.0],[115132.0,-264096.0],[115132.0,-264089.0],[115133.0,-264047.0],[115133.0,-264043.0],[115134.0,-264005.0],[115134.0,-264001.0],[115135.0,-263969.0],[115135.0,-263966.0],[115136.0,-263937.0],[115136.0,-263933.0],[115137.0,-263905.0],[115137.0,-263904.0],[115138.0,-263878.0],[115138.0,-263875.0],[115139.0,-263850.0],[115139.0,-263849.0],[115140.0,-263827.0],[115140.0,-263824.0],[115142.0,-263779.0],[115142.0,-263778.0],[115143.0,-263759.0],[115143.0,-263756.0],[115144.0,-263737.0],[115144.0,-263736.0],[115146.0,-263698.0],[115146.0,-263697.0],[115147.0,-263679.0],[115147.0,-263678.0],[115150.0,-263624.0],[115153.0,-263576.0],[115153.0,-263575.0],[115154.0,-263560.0],[115154.0,-263559.0],[115156.0,-263528.0],[115157.0,-263515.0],[115158.0,-263499.0],[115159.0,-263486.0],[115160.0,-263470.0],[115161.0,-263458.0],[115161.0,-263457.0],[115165.0,-263404.0],[115165.0,-263403.0],[115169.0,-263353.0],[115172.0,-263318.0],[115172.0,-263317.0],[115177.0,-263261.0],[115178.0,-263248.0],[115179.0,-263239.0],[115181.0,-263217.0],[115181.0,-263216.0],[115192.0,-263104.0],[115201.0,-263020.0],[115208.0,-262958.0],[115210.0,-262942.0],[115212.0,-262924.0],[115218.0,-262874.0],[115220.0,-262859.0],[115221.0,-262850.0],[115222.0,-262843.0],[115223.0,-262834.0],[115227.0,-262804.0],[115227.0,-262803.0],[115242.0,-262691.0],[115243.0,-262685.0],[115245.0,-262670.0],[115252.0,-262621.0],[115264.0,-262540.0],[115276.0,-262463.0],[115291.0,-262371.0],[115293.0,-262360.0],[115300.0,-262318.0],[115301.0,-262313.0],[115307.0,-262278.0],[115320.0,-262205.0],[115339.0,-262104.0],[115340.0,-262098.0],[115345.0,-262073.0],[115346.0,-262067.0],[115368.0,-261957.0],[115385.0,-261875.0],[115406.0,-261778.0],[115409.0,-261765.0],[115412.0,-261751.0],[115435.0,-261650.0],[115437.0,-261642.0],[115442.0,-261620.0],[115456.0,-261561.0],[115460.0,-261545.0],[115465.0,-261524.0],[115496.0,-261400.0],[115517.0,-261319.0],[115524.0,-261293.0],[115526.0,-261285.0],[115528.0,-261278.0],[115530.0,-261270.0],[115535.0,-261252.0],[115537.0,-261244.0],[115567.0,-261135.0],[115570.0,-261125.0],[115582.0,-261082.0],[115585.0,-261072.0],[115597.0,-261030.0],[115598.0,-261027.0],[115602.0,-261013.0],[115629.0,-260922.0],[115658.0,-260827.0],[115688.0,-260732.0],[115707.0,-260673.0],[115740.0,-260573.0],[115754.0,-260532.0],[115761.0,-260511.0],[115768.0,-260491.0],[115772.0,-260479.0],[115801.0,-260396.0],[115812.0,-260365.0],[115843.0,-260279.0],[115864.0,-260222.0],[115902.0,-260121.0],[115906.0,-260111.0],[115919.0,-260077.0],[115920.0,-260075.0],[116774.0,-257865.0],[116776.0,-257859.0],[116780.0,-257849.0],[116801.0,-257794.0],[116805.0,-257783.0],[116807.0,-257778.0],[116850.0,-257662.0],[116871.0,-257604.0],[116899.0,-257525.0],[116911.0,-257490.0],[116916.0,-257476.0],[116921.0,-257461.0],[116928.0,-257441.0],[116976.0,-257297.0],[116996.0,-257235.0],[117024.0,-257146.0],[117027.0,-257136.0],[117029.0,-257130.0],[117060.0,-257028.0],[117072.0,-256987.0],[117076.0,-256974.0],[117105.0,-256873.0],[117126.0,-256798.0],[117156.0,-256687.0],[117184.0,-256579.0],[117201.0,-256511.0],[117240.0,-256348.0],[117256.0,-256278.0],[117257.0,-256273.0],[117258.0,-256269.0],[117265.0,-256237.0],[117268.0,-256224.0],[117285.0,-256145.0],[117290.0,-256121.0],[117291.0,-256117.0],[117294.0,-256102.0],[117296.0,-256093.0],[117304.0,-256054.0],[117318.0,-255984.0],[117327.0,-255938.0],[117335.0,-255896.0],[117358.0,-255770.0],[117360.0,-255758.0],[117364.0,-255736.0],[117367.0,-255718.0],[117368.45454545454,-255710.0],[117875.35869565218,-255710.0],[117869.0,-255749.0],[117867.0,-255760.0],[117860.0,-255802.0],[117859.0,-255807.0],[117856.0,-255825.0],[117840.0,-255915.0],[117834.0,-255947.0],[117833.0,-255953.0],[117821.0,-256016.0],[117820.0,-256022.0],[117815.0,-256047.0],[117814.0,-256053.0],[117792.0,-256163.0],[117775.0,-256245.0],[117756.0,-256333.0],[117751.0,-256355.0],[117748.0,-256369.0],[117733.0,-256435.0],[117718.0,-256500.0],[117711.0,-256529.0],[117704.0,-256559.0],[117700.0,-256575.0],[117695.0,-256596.0],[117664.0,-256720.0],[117643.0,-256801.0],[117636.0,-256827.0],[117634.0,-256835.0],[117632.0,-256842.0],[117630.0,-256850.0],[117625.0,-256868.0],[117623.0,-256876.0],[117593.0,-256985.0],[117590.0,-256995.0],[117578.0,-257038.0],[117575.0,-257048.0],[117563.0,-257090.0],[117562.0,-257093.0],[117558.0,-257107.0],[117557.0,-257110.0],[117528.0,-257208.0],[117502.0,-257293.0],[117472.0,-257388.0],[117453.0,-257447.0],[117420.0,-257547.0],[117406.0,-257588.0],[117399.0,-257609.0],[117392.0,-257629.0],[117388.0,-257641.0],[117348.0,-257755.0],[117325.0,-257819.0],[117296.0,-257898.0],[117258.0,-257999.0],[117254.0,-258009.0],[117241.0,-258043.0],[117240.0,-258045.0],[116386.0,-260255.0],[116384.0,-260261.0],[116380.0,-260271.0],[116359.0,-260326.0],[116355.0,-260337.0],[116353.0,-260342.0],[116325.0,-260417.0],[116298.0,-260491.0],[116261.0,-260595.0],[116249.0,-260630.0],[116244.0,-260644.0],[116239.0,-260659.0],[116232.0,-260679.0],[116184.0,-260823.0],[116164.0,-260885.0],[116140.0,-260961.0],[116133.0,-260984.0],[116131.0,-260990.0],[116106.0,-261072.0],[116088.0,-261133.0],[116084.0,-261146.0],[116071.0,-261191.0],[116044.0,-261286.0],[116028.0,-261344.0],[116004.0,-261433.0],[115986.0,-261502.0],[115976.0,-261541.0],[115959.0,-261609.0],[115921.0,-261768.0],[115904.0,-261842.0],[115903.0,-261847.0],[115902.0,-261851.0],[115895.0,-261883.0],[115894.0,-261887.0],[115870.0,-261999.0],[115869.0,-262003.0],[115866.0,-262018.0],[115864.0,-262027.0],[115856.0,-262066.0],[115842.0,-262136.0],[115833.0,-262182.0],[115826.0,-262219.0],[115802.0,-262350.0],[115800.0,-262362.0],[115796.0,-262384.0],[115793.0,-262402.0],[115791.0,-262413.0],[115776.0,-262503.0],[115775.0,-262510.0],[115772.0,-262528.0],[115771.0,-262535.0],[115768.0,-262553.0],[115754.0,-262644.0],[115736.0,-262769.0],[115730.0,-262813.0],[115728.0,-262829.0],[115726.0,-262843.0],[115716.0,-262922.0],[115715.0,-262929.0],[115708.0,-262987.0],[115695.0,-263102.0],[115687.0,-263178.0],[115675.0,-263304.0],[115673.0,-263328.0],[115670.0,-263361.0],[115668.0,-263385.0],[115668.0,-263387.0],[115664.0,-263435.0],[115660.0,-263488.0],[115660.0,-263490.0],[115659.0,-263502.0],[115652.0,-263606.0],[115652.0,-263608.0],[115650.0,-263639.0],[115650.0,-263640.0],[115646.0,-263710.0],[115646.0,-263712.0],[115643.0,-263768.0],[115643.0,-263770.0],[115642.0,-263789.0],[115642.0,-263792.0],[115641.0,-263811.0],[115641.0,-263814.0],[115640.0,-263835.0],[115640.0,-263838.0],[115639.0,-263860.0],[115639.0,-263862.0],[115638.0,-263884.0],[115638.0,-263886.0],[115637.0,-263911.0],[115637.0,-263913.0],[115636.0,-263940.0],[115636.0,-263945.0],[115635.0,-263974.0],[115635.0,-263976.0],[115634.0,-264008.0],[115634.0,-264013.0],[115633.0,-264047.0],[115633.0,-264054.0],[115632.0,-264093.0],[115632.0,-264103.0],[115631.0,-264154.0],[115631.0,-264166.0],[115630.0,-264266.0],[115630.0,-264310.0],[115630.0,-264311.0],[115629.0,-264321.0],[115629.0,-264322.0],[115628.0,-264333.0],[115628.0,-264334.0],[115627.0,-264345.0],[115627.0,-264347.0],[115626.0,-264359.0],[115626.0,-264361.0],[115625.0,-264377.0],[115625.0,-264433.0],[115626.0,-264445.0],[115626.0,-264446.0],[115627.0,-264455.0],[115627.0,-264456.0],[115628.0,-264464.0],[115629.0,-264470.0],[115629.0,-264471.0],[115630.0,-264477.0],[115633.0,-264492.0],[115639.0,-264516.0],[115647.0,-264542.0],[115655.0,-264565.0],[115657.0,-264570.0],[115658.0,-264573.0],[115660.0,-264578.0],[115661.0,-264581.0],[115663.0,-264586.0],[115664.0,-264589.0],[115668.0,-264599.0],[115669.0,-264602.0],[115675.0,-264617.0],[115676.0,-264620.0],[115680.0,-264630.0],[115681.0,-264633.0],[115683.0,-264638.0],[115693.0,-264665.0],[115695.0,-264671.0],[115699.0,-264682.0],[115704.0,-264697.0],[115707.0,-264707.0],[115709.0,-264713.0],[115710.0,-264717.0],[115711.0,-264720.0],[115714.0,-264731.0],[115715.0,-264734.0],[115720.0,-264754.0],[115722.0,-264763.0],[115726.0,-264783.0],[115728.0,-264795.0],[115729.0,-264802.0],[115731.0,-264819.0],[115731.0,-264820.0],[115732.0,-264830.0],[115732.0,-264832.0],[115733.0,-264848.0],[115733.0,-264907.0],[115732.0,-264929.0],[115732.0,-264933.0],[115731.0,-264952.0],[115731.0,-264955.0],[115730.0,-264975.0],[115730.0,-264979.0],[115729.0,-265005.0],[115729.0,-265114.0],[115730.0,-265141.0],[115730.0,-265145.0],[115731.0,-265166.0],[115731.0,-265170.0],[115732.0,-265190.0],[115732.0,-265194.0],[115733.0,-265220.0],[115733.0,-265267.0],[115732.0,-265285.0],[115732.0,-265288.0],[115731.0,-265299.0],[115731.0,-265301.0],[115729.0,-265318.0],[115729.0,-265319.0],[115728.0,-265325.0],[115728.0,-265326.0],[115726.0,-265338.0],[115724.0,-265348.0],[115722.0,-265357.0],[115718.0,-265372.0],[115713.0,-265387.0],[115708.0,-265400.0],[115707.0,-265402.0],[115704.0,-265409.0],[115696.0,-265425.0],[115692.0,-265432.0],[115684.0,-265445.0],[115677.0,-265455.0],[115668.0,-265467.0],[115664.0,-265472.0],[115663.0,-265473.0],[115658.0,-265479.0],[115649.0,-265489.0],[115624.0,-265514.0],[115613.0,-265524.0],[115611.0,-265526.0],[115595.0,-265540.0],[115593.0,-265542.0],[115587.0,-265547.0],[115578.0,-265555.0],[115572.0,-265560.0],[115571.0,-265561.0],[115565.0,-265566.0],[115564.0,-265567.0],[115558.0,-265572.0],[115557.0,-265573.0],[115551.0,-265578.0],[115550.0,-265579.0],[115544.0,-265584.0],[115543.0,-265585.0],[115537.0,-265590.0],[115520.0,-265605.0],[115518.0,-265607.0],[115509.0,-265615.0],[115470.0,-265654.0],[115463.0,-265662.0],[115459.0,-265667.0],[115458.0,-265668.0],[115450.0,-265678.0],[115441.0,-265690.0],[115434.0,-265700.0],[115430.0,-265706.0],[115427.0,-265711.0],[115425.0,-265714.0],[115419.0,-265724.0],[115415.0,-265731.0],[115408.0,-265744.0],[115404.0,-265752.0],[115399.0,-265763.0],[115397.0,-265767.0],[115392.0,-265779.0],[115391.0,-265781.0],[115387.0,-265791.0],[115386.0,-265794.0],[115384.0,-265799.0],[115383.0,-265802.0],[115381.0,-265807.0],[115368.0,-265846.0],[115362.0,-265866.0],[115354.0,-265894.0],[115353.0,-265898.0],[115352.0,-265901.0],[115351.0,-265905.0],[115347.0,-265919.0],[115346.0,-265923.0],[115345.0,-265926.0],[115344.0,-265930.0],[115343.0,-265933.0],[115342.0,-265937.0],[115341.0,-265940.0],[115340.0,-265944.0],[115334.0,-265964.0],[115329.0,-265980.0],[115320.0,-266007.0],[115315.0,-266021.0],[115296.0,-266078.0],[115293.0,-266088.0],[115288.0,-266106.0],[115285.0,-266118.0],[115284.0,-266123.0],[115283.0,-266127.0],[115280.0,-266143.0],[115277.0,-266165.0],[115277.0,-266166.0],[115276.0,-266176.0],[115276.0,-266178.0],[115275.0,-266193.0],[115275.0,-266236.0],[115276.0,-266255.0],[115276.0,-266257.0],[115277.0,-266271.0],[115277.0,-266273.0],[115278.0,-266285.0],[115278.0,-266286.0],[115279.0,-266297.0],[115279.0,-266299.0],[115280.0,-266309.0],[115280.0,-266310.0],[115280.0,-267638.0],[114780.0,-267638.0],[114780.0,-266310.0],[114780.0,-266309.0]],[]],[[[139319.0,-320820.0],[138819.0,-320820.0],[138819.0,-255710.0],[139319.0,-255710.0],[139319.0,-320820.0]],[]]]}, - {"id":8,"start":[180030,-267710,270],"target":[180279,-308570,180],"bounds":[167780.0,-320820.0,208740.0,-255710.0],"width":500,"keepouts":[[[[167780.0,-312701.0337207964],[167780.0,-304438.9662792036],[180207.0,-308297.6434572448],[180207.0,-308842.3565427552],[167780.0,-312701.0337207964]],[]],[[[179780.0,-266309.0],[179781.0,-266299.0],[179781.0,-266297.0],[179782.0,-266286.0],[179782.0,-266285.0],[179783.0,-266273.0],[179783.0,-266271.0],[179784.0,-266257.0],[179784.0,-266255.0],[179785.0,-266236.0],[179785.0,-266193.0],[179784.0,-266178.0],[179784.0,-266176.0],[179783.0,-266166.0],[179783.0,-266165.0],[179780.0,-266143.0],[179777.0,-266127.0],[179776.0,-266123.0],[179775.0,-266118.0],[179772.0,-266106.0],[179767.0,-266088.0],[179764.0,-266078.0],[179745.0,-266021.0],[179740.0,-266007.0],[179731.0,-265980.0],[179726.0,-265964.0],[179720.0,-265944.0],[179719.0,-265940.0],[179718.0,-265937.0],[179717.0,-265933.0],[179716.0,-265930.0],[179715.0,-265926.0],[179714.0,-265923.0],[179713.0,-265919.0],[179709.0,-265905.0],[179708.0,-265901.0],[179707.0,-265898.0],[179706.0,-265894.0],[179698.0,-265866.0],[179692.0,-265846.0],[179679.0,-265807.0],[179677.0,-265802.0],[179676.0,-265799.0],[179674.0,-265794.0],[179673.0,-265791.0],[179669.0,-265781.0],[179668.0,-265779.0],[179663.0,-265767.0],[179661.0,-265763.0],[179656.0,-265752.0],[179652.0,-265744.0],[179645.0,-265731.0],[179641.0,-265724.0],[179635.0,-265714.0],[179633.0,-265711.0],[179630.0,-265706.0],[179626.0,-265700.0],[179619.0,-265690.0],[179610.0,-265678.0],[179602.0,-265668.0],[179601.0,-265667.0],[179597.0,-265662.0],[179590.0,-265654.0],[179551.0,-265615.0],[179542.0,-265607.0],[179540.0,-265605.0],[179523.0,-265590.0],[179517.0,-265585.0],[179516.0,-265584.0],[179510.0,-265579.0],[179509.0,-265578.0],[179503.0,-265573.0],[179502.0,-265572.0],[179496.0,-265567.0],[179495.0,-265566.0],[179489.0,-265561.0],[179488.0,-265560.0],[179482.0,-265555.0],[179473.0,-265547.0],[179467.0,-265542.0],[179465.0,-265540.0],[179449.0,-265526.0],[179447.0,-265524.0],[179436.0,-265514.0],[179411.0,-265489.0],[179402.0,-265479.0],[179397.0,-265473.0],[179396.0,-265472.0],[179392.0,-265467.0],[179383.0,-265455.0],[179376.0,-265445.0],[179368.0,-265432.0],[179364.0,-265425.0],[179356.0,-265409.0],[179353.0,-265402.0],[179352.0,-265400.0],[179347.0,-265387.0],[179342.0,-265372.0],[179338.0,-265357.0],[179336.0,-265348.0],[179334.0,-265338.0],[179332.0,-265326.0],[179332.0,-265325.0],[179331.0,-265319.0],[179331.0,-265318.0],[179329.0,-265301.0],[179329.0,-265299.0],[179328.0,-265288.0],[179328.0,-265285.0],[179327.0,-265267.0],[179327.0,-265220.0],[179328.0,-265194.0],[179328.0,-265190.0],[179329.0,-265170.0],[179329.0,-265166.0],[179330.0,-265145.0],[179330.0,-265141.0],[179331.0,-265114.0],[179331.0,-265005.0],[179330.0,-264979.0],[179330.0,-264975.0],[179329.0,-264955.0],[179329.0,-264952.0],[179328.0,-264933.0],[179328.0,-264929.0],[179327.0,-264907.0],[179327.0,-264848.0],[179328.0,-264832.0],[179328.0,-264830.0],[179329.0,-264820.0],[179329.0,-264819.0],[179331.0,-264802.0],[179332.0,-264795.0],[179334.0,-264783.0],[179338.0,-264763.0],[179340.0,-264754.0],[179345.0,-264734.0],[179346.0,-264731.0],[179349.0,-264720.0],[179350.0,-264717.0],[179351.0,-264713.0],[179353.0,-264707.0],[179356.0,-264697.0],[179361.0,-264682.0],[179365.0,-264671.0],[179367.0,-264665.0],[179377.0,-264638.0],[179379.0,-264633.0],[179380.0,-264630.0],[179384.0,-264620.0],[179385.0,-264617.0],[179391.0,-264602.0],[179392.0,-264599.0],[179396.0,-264589.0],[179397.0,-264586.0],[179399.0,-264581.0],[179400.0,-264578.0],[179402.0,-264573.0],[179403.0,-264570.0],[179405.0,-264565.0],[179413.0,-264542.0],[179421.0,-264516.0],[179427.0,-264492.0],[179430.0,-264477.0],[179431.0,-264471.0],[179431.0,-264470.0],[179432.0,-264464.0],[179433.0,-264456.0],[179433.0,-264455.0],[179434.0,-264446.0],[179434.0,-264445.0],[179435.0,-264433.0],[179435.0,-264377.0],[179434.0,-264361.0],[179434.0,-264359.0],[179433.0,-264347.0],[179433.0,-264345.0],[179432.0,-264334.0],[179432.0,-264333.0],[179431.0,-264322.0],[179431.0,-264321.0],[179430.0,-264311.0],[179430.0,-264310.0],[179430.0,-264266.0],[179429.0,-264166.0],[179429.0,-264154.0],[179428.0,-264103.0],[179428.0,-264093.0],[179427.0,-264054.0],[179427.0,-264047.0],[179426.0,-264013.0],[179426.0,-264008.0],[179425.0,-263976.0],[179425.0,-263974.0],[179424.0,-263945.0],[179424.0,-263940.0],[179423.0,-263913.0],[179423.0,-263911.0],[179422.0,-263886.0],[179422.0,-263884.0],[179421.0,-263862.0],[179421.0,-263860.0],[179420.0,-263838.0],[179420.0,-263835.0],[179419.0,-263814.0],[179419.0,-263811.0],[179418.0,-263792.0],[179418.0,-263789.0],[179417.0,-263770.0],[179417.0,-263768.0],[179414.0,-263712.0],[179414.0,-263710.0],[179410.0,-263640.0],[179410.0,-263639.0],[179408.0,-263608.0],[179408.0,-263606.0],[179401.0,-263502.0],[179400.0,-263490.0],[179400.0,-263488.0],[179396.0,-263435.0],[179392.0,-263387.0],[179392.0,-263385.0],[179390.0,-263361.0],[179387.0,-263328.0],[179385.0,-263304.0],[179373.0,-263178.0],[179365.0,-263102.0],[179352.0,-262987.0],[179345.0,-262929.0],[179344.0,-262922.0],[179334.0,-262843.0],[179332.0,-262829.0],[179330.0,-262813.0],[179324.0,-262769.0],[179306.0,-262644.0],[179292.0,-262553.0],[179289.0,-262535.0],[179288.0,-262528.0],[179285.0,-262510.0],[179284.0,-262503.0],[179269.0,-262413.0],[179267.0,-262402.0],[179264.0,-262384.0],[179260.0,-262362.0],[179258.0,-262350.0],[179234.0,-262219.0],[179227.0,-262182.0],[179218.0,-262136.0],[179204.0,-262066.0],[179196.0,-262027.0],[179194.0,-262018.0],[179191.0,-262003.0],[179190.0,-261999.0],[179166.0,-261887.0],[179165.0,-261883.0],[179158.0,-261851.0],[179157.0,-261847.0],[179156.0,-261842.0],[179139.0,-261768.0],[179101.0,-261609.0],[179084.0,-261541.0],[179074.0,-261502.0],[179056.0,-261433.0],[179032.0,-261344.0],[179016.0,-261286.0],[178989.0,-261191.0],[178976.0,-261146.0],[178972.0,-261133.0],[178954.0,-261072.0],[178929.0,-260990.0],[178927.0,-260984.0],[178920.0,-260961.0],[178896.0,-260885.0],[178876.0,-260823.0],[178828.0,-260679.0],[178821.0,-260659.0],[178816.0,-260644.0],[178811.0,-260630.0],[178799.0,-260595.0],[178762.0,-260491.0],[178735.0,-260417.0],[178707.0,-260342.0],[178705.0,-260337.0],[178701.0,-260326.0],[178680.0,-260271.0],[178676.0,-260261.0],[178674.0,-260255.0],[177820.0,-258045.0],[177819.0,-258043.0],[177806.0,-258009.0],[177802.0,-257999.0],[177764.0,-257898.0],[177735.0,-257819.0],[177712.0,-257755.0],[177672.0,-257641.0],[177668.0,-257629.0],[177661.0,-257609.0],[177654.0,-257588.0],[177640.0,-257547.0],[177607.0,-257447.0],[177588.0,-257388.0],[177558.0,-257293.0],[177532.0,-257208.0],[177503.0,-257110.0],[177502.0,-257107.0],[177498.0,-257093.0],[177497.0,-257090.0],[177485.0,-257048.0],[177482.0,-257038.0],[177470.0,-256995.0],[177467.0,-256985.0],[177437.0,-256876.0],[177435.0,-256868.0],[177430.0,-256850.0],[177428.0,-256842.0],[177426.0,-256835.0],[177424.0,-256827.0],[177417.0,-256801.0],[177396.0,-256720.0],[177365.0,-256596.0],[177360.0,-256575.0],[177356.0,-256559.0],[177349.0,-256529.0],[177342.0,-256500.0],[177327.0,-256435.0],[177312.0,-256369.0],[177309.0,-256355.0],[177304.0,-256333.0],[177285.0,-256245.0],[177268.0,-256163.0],[177246.0,-256053.0],[177245.0,-256047.0],[177240.0,-256022.0],[177239.0,-256016.0],[177227.0,-255953.0],[177226.0,-255947.0],[177220.0,-255915.0],[177204.0,-255825.0],[177201.0,-255807.0],[177200.0,-255802.0],[177193.0,-255760.0],[177191.0,-255749.0],[177184.64130434784,-255710.0],[177691.54545454544,-255710.0],[177693.0,-255718.0],[177696.0,-255736.0],[177700.0,-255758.0],[177702.0,-255770.0],[177725.0,-255896.0],[177733.0,-255938.0],[177742.0,-255984.0],[177756.0,-256054.0],[177764.0,-256093.0],[177766.0,-256102.0],[177769.0,-256117.0],[177770.0,-256121.0],[177775.0,-256145.0],[177792.0,-256224.0],[177795.0,-256237.0],[177802.0,-256269.0],[177803.0,-256273.0],[177804.0,-256278.0],[177820.0,-256348.0],[177859.0,-256511.0],[177876.0,-256579.0],[177904.0,-256687.0],[177934.0,-256798.0],[177955.0,-256873.0],[177984.0,-256974.0],[177988.0,-256987.0],[178000.0,-257028.0],[178031.0,-257130.0],[178033.0,-257136.0],[178036.0,-257146.0],[178064.0,-257235.0],[178084.0,-257297.0],[178132.0,-257441.0],[178139.0,-257461.0],[178144.0,-257476.0],[178149.0,-257490.0],[178161.0,-257525.0],[178189.0,-257604.0],[178210.0,-257662.0],[178253.0,-257778.0],[178255.0,-257783.0],[178259.0,-257794.0],[178280.0,-257849.0],[178284.0,-257859.0],[178286.0,-257865.0],[179140.0,-260075.0],[179141.0,-260077.0],[179154.0,-260111.0],[179158.0,-260121.0],[179196.0,-260222.0],[179217.0,-260279.0],[179248.0,-260365.0],[179259.0,-260396.0],[179288.0,-260479.0],[179292.0,-260491.0],[179299.0,-260511.0],[179306.0,-260532.0],[179320.0,-260573.0],[179353.0,-260673.0],[179372.0,-260732.0],[179402.0,-260827.0],[179431.0,-260922.0],[179458.0,-261013.0],[179462.0,-261027.0],[179463.0,-261030.0],[179475.0,-261072.0],[179478.0,-261082.0],[179490.0,-261125.0],[179493.0,-261135.0],[179523.0,-261244.0],[179525.0,-261252.0],[179530.0,-261270.0],[179532.0,-261278.0],[179534.0,-261285.0],[179536.0,-261293.0],[179543.0,-261319.0],[179564.0,-261400.0],[179595.0,-261524.0],[179600.0,-261545.0],[179604.0,-261561.0],[179618.0,-261620.0],[179623.0,-261642.0],[179625.0,-261650.0],[179648.0,-261751.0],[179651.0,-261765.0],[179654.0,-261778.0],[179675.0,-261875.0],[179692.0,-261957.0],[179714.0,-262067.0],[179715.0,-262073.0],[179720.0,-262098.0],[179721.0,-262104.0],[179740.0,-262205.0],[179753.0,-262278.0],[179759.0,-262313.0],[179760.0,-262318.0],[179767.0,-262360.0],[179769.0,-262371.0],[179784.0,-262463.0],[179796.0,-262540.0],[179808.0,-262621.0],[179815.0,-262670.0],[179817.0,-262685.0],[179818.0,-262691.0],[179833.0,-262803.0],[179833.0,-262804.0],[179837.0,-262834.0],[179838.0,-262843.0],[179839.0,-262850.0],[179840.0,-262859.0],[179842.0,-262874.0],[179848.0,-262924.0],[179850.0,-262942.0],[179852.0,-262958.0],[179859.0,-263020.0],[179868.0,-263104.0],[179879.0,-263216.0],[179879.0,-263217.0],[179881.0,-263239.0],[179882.0,-263248.0],[179883.0,-263261.0],[179888.0,-263317.0],[179888.0,-263318.0],[179891.0,-263353.0],[179895.0,-263403.0],[179895.0,-263404.0],[179899.0,-263457.0],[179899.0,-263458.0],[179900.0,-263470.0],[179901.0,-263486.0],[179902.0,-263499.0],[179903.0,-263515.0],[179904.0,-263528.0],[179906.0,-263559.0],[179906.0,-263560.0],[179907.0,-263575.0],[179907.0,-263576.0],[179910.0,-263624.0],[179913.0,-263678.0],[179913.0,-263679.0],[179914.0,-263697.0],[179914.0,-263698.0],[179916.0,-263736.0],[179916.0,-263737.0],[179917.0,-263756.0],[179917.0,-263759.0],[179918.0,-263778.0],[179918.0,-263779.0],[179920.0,-263824.0],[179920.0,-263827.0],[179921.0,-263849.0],[179921.0,-263850.0],[179922.0,-263875.0],[179922.0,-263878.0],[179923.0,-263904.0],[179923.0,-263905.0],[179924.0,-263933.0],[179924.0,-263937.0],[179925.0,-263966.0],[179925.0,-263969.0],[179926.0,-264001.0],[179926.0,-264005.0],[179927.0,-264043.0],[179927.0,-264047.0],[179928.0,-264089.0],[179928.0,-264096.0],[179929.0,-264151.0],[179929.0,-264164.0],[179930.0,-264268.0],[179930.0,-264310.0],[180130.0,-264310.0],[180130.0,-264268.0],[180131.0,-264164.0],[180131.0,-264151.0],[180132.0,-264096.0],[180132.0,-264089.0],[180133.0,-264047.0],[180133.0,-264043.0],[180134.0,-264005.0],[180134.0,-264001.0],[180135.0,-263969.0],[180135.0,-263966.0],[180136.0,-263937.0],[180136.0,-263933.0],[180137.0,-263905.0],[180137.0,-263904.0],[180138.0,-263878.0],[180138.0,-263875.0],[180139.0,-263850.0],[180139.0,-263849.0],[180140.0,-263827.0],[180140.0,-263824.0],[180142.0,-263779.0],[180142.0,-263778.0],[180143.0,-263759.0],[180143.0,-263756.0],[180144.0,-263737.0],[180144.0,-263736.0],[180146.0,-263698.0],[180146.0,-263697.0],[180147.0,-263679.0],[180147.0,-263678.0],[180150.0,-263624.0],[180153.0,-263576.0],[180153.0,-263575.0],[180154.0,-263560.0],[180154.0,-263559.0],[180156.0,-263528.0],[180157.0,-263515.0],[180158.0,-263499.0],[180159.0,-263486.0],[180160.0,-263470.0],[180161.0,-263458.0],[180161.0,-263457.0],[180165.0,-263404.0],[180165.0,-263403.0],[180169.0,-263353.0],[180172.0,-263318.0],[180172.0,-263317.0],[180177.0,-263261.0],[180178.0,-263248.0],[180179.0,-263239.0],[180181.0,-263217.0],[180181.0,-263216.0],[180192.0,-263104.0],[180201.0,-263020.0],[180208.0,-262958.0],[180210.0,-262942.0],[180212.0,-262924.0],[180218.0,-262874.0],[180220.0,-262859.0],[180221.0,-262850.0],[180222.0,-262843.0],[180223.0,-262834.0],[180227.0,-262804.0],[180227.0,-262803.0],[180242.0,-262691.0],[180243.0,-262685.0],[180245.0,-262670.0],[180252.0,-262621.0],[180264.0,-262540.0],[180276.0,-262463.0],[180291.0,-262371.0],[180293.0,-262360.0],[180300.0,-262318.0],[180301.0,-262313.0],[180307.0,-262278.0],[180320.0,-262205.0],[180339.0,-262104.0],[180340.0,-262098.0],[180345.0,-262073.0],[180346.0,-262067.0],[180368.0,-261957.0],[180385.0,-261875.0],[180406.0,-261778.0],[180409.0,-261765.0],[180412.0,-261751.0],[180435.0,-261650.0],[180437.0,-261642.0],[180442.0,-261620.0],[180456.0,-261561.0],[180460.0,-261545.0],[180465.0,-261524.0],[180496.0,-261400.0],[180517.0,-261319.0],[180524.0,-261293.0],[180526.0,-261285.0],[180528.0,-261278.0],[180530.0,-261270.0],[180535.0,-261252.0],[180537.0,-261244.0],[180567.0,-261135.0],[180570.0,-261125.0],[180582.0,-261082.0],[180585.0,-261072.0],[180597.0,-261030.0],[180598.0,-261027.0],[180602.0,-261013.0],[180629.0,-260922.0],[180658.0,-260827.0],[180688.0,-260732.0],[180707.0,-260673.0],[180740.0,-260573.0],[180754.0,-260532.0],[180761.0,-260511.0],[180768.0,-260491.0],[180772.0,-260479.0],[180801.0,-260396.0],[180812.0,-260365.0],[180843.0,-260279.0],[180864.0,-260222.0],[180902.0,-260121.0],[180906.0,-260111.0],[180919.0,-260077.0],[180920.0,-260075.0],[181774.0,-257865.0],[181776.0,-257859.0],[181780.0,-257849.0],[181801.0,-257794.0],[181805.0,-257783.0],[181807.0,-257778.0],[181850.0,-257662.0],[181871.0,-257604.0],[181899.0,-257525.0],[181911.0,-257490.0],[181916.0,-257476.0],[181921.0,-257461.0],[181928.0,-257441.0],[181976.0,-257297.0],[181996.0,-257235.0],[182024.0,-257146.0],[182027.0,-257136.0],[182029.0,-257130.0],[182060.0,-257028.0],[182072.0,-256987.0],[182076.0,-256974.0],[182105.0,-256873.0],[182126.0,-256798.0],[182156.0,-256687.0],[182184.0,-256579.0],[182201.0,-256511.0],[182240.0,-256348.0],[182256.0,-256278.0],[182257.0,-256273.0],[182258.0,-256269.0],[182265.0,-256237.0],[182268.0,-256224.0],[182285.0,-256145.0],[182290.0,-256121.0],[182291.0,-256117.0],[182294.0,-256102.0],[182296.0,-256093.0],[182304.0,-256054.0],[182318.0,-255984.0],[182327.0,-255938.0],[182335.0,-255896.0],[182358.0,-255770.0],[182360.0,-255758.0],[182364.0,-255736.0],[182367.0,-255718.0],[182368.45454545456,-255710.0],[182875.35869565216,-255710.0],[182869.0,-255749.0],[182867.0,-255760.0],[182860.0,-255802.0],[182859.0,-255807.0],[182856.0,-255825.0],[182840.0,-255915.0],[182834.0,-255947.0],[182833.0,-255953.0],[182821.0,-256016.0],[182820.0,-256022.0],[182815.0,-256047.0],[182814.0,-256053.0],[182792.0,-256163.0],[182775.0,-256245.0],[182756.0,-256333.0],[182751.0,-256355.0],[182748.0,-256369.0],[182733.0,-256435.0],[182718.0,-256500.0],[182711.0,-256529.0],[182704.0,-256559.0],[182700.0,-256575.0],[182695.0,-256596.0],[182664.0,-256720.0],[182643.0,-256801.0],[182636.0,-256827.0],[182634.0,-256835.0],[182632.0,-256842.0],[182630.0,-256850.0],[182625.0,-256868.0],[182623.0,-256876.0],[182593.0,-256985.0],[182590.0,-256995.0],[182578.0,-257038.0],[182575.0,-257048.0],[182563.0,-257090.0],[182562.0,-257093.0],[182558.0,-257107.0],[182557.0,-257110.0],[182528.0,-257208.0],[182502.0,-257293.0],[182472.0,-257388.0],[182453.0,-257447.0],[182420.0,-257547.0],[182406.0,-257588.0],[182399.0,-257609.0],[182392.0,-257629.0],[182388.0,-257641.0],[182348.0,-257755.0],[182325.0,-257819.0],[182296.0,-257898.0],[182258.0,-257999.0],[182254.0,-258009.0],[182241.0,-258043.0],[182240.0,-258045.0],[181386.0,-260255.0],[181384.0,-260261.0],[181380.0,-260271.0],[181359.0,-260326.0],[181355.0,-260337.0],[181353.0,-260342.0],[181325.0,-260417.0],[181298.0,-260491.0],[181261.0,-260595.0],[181249.0,-260630.0],[181244.0,-260644.0],[181239.0,-260659.0],[181232.0,-260679.0],[181184.0,-260823.0],[181164.0,-260885.0],[181140.0,-260961.0],[181133.0,-260984.0],[181131.0,-260990.0],[181106.0,-261072.0],[181088.0,-261133.0],[181084.0,-261146.0],[181071.0,-261191.0],[181044.0,-261286.0],[181028.0,-261344.0],[181004.0,-261433.0],[180986.0,-261502.0],[180976.0,-261541.0],[180959.0,-261609.0],[180921.0,-261768.0],[180904.0,-261842.0],[180903.0,-261847.0],[180902.0,-261851.0],[180895.0,-261883.0],[180894.0,-261887.0],[180870.0,-261999.0],[180869.0,-262003.0],[180866.0,-262018.0],[180864.0,-262027.0],[180856.0,-262066.0],[180842.0,-262136.0],[180833.0,-262182.0],[180826.0,-262219.0],[180802.0,-262350.0],[180800.0,-262362.0],[180796.0,-262384.0],[180793.0,-262402.0],[180791.0,-262413.0],[180776.0,-262503.0],[180775.0,-262510.0],[180772.0,-262528.0],[180771.0,-262535.0],[180768.0,-262553.0],[180754.0,-262644.0],[180736.0,-262769.0],[180730.0,-262813.0],[180728.0,-262829.0],[180726.0,-262843.0],[180716.0,-262922.0],[180715.0,-262929.0],[180708.0,-262987.0],[180695.0,-263102.0],[180687.0,-263178.0],[180675.0,-263304.0],[180673.0,-263328.0],[180670.0,-263361.0],[180668.0,-263385.0],[180668.0,-263387.0],[180664.0,-263435.0],[180660.0,-263488.0],[180660.0,-263490.0],[180659.0,-263502.0],[180652.0,-263606.0],[180652.0,-263608.0],[180650.0,-263639.0],[180650.0,-263640.0],[180646.0,-263710.0],[180646.0,-263712.0],[180643.0,-263768.0],[180643.0,-263770.0],[180642.0,-263789.0],[180642.0,-263792.0],[180641.0,-263811.0],[180641.0,-263814.0],[180640.0,-263835.0],[180640.0,-263838.0],[180639.0,-263860.0],[180639.0,-263862.0],[180638.0,-263884.0],[180638.0,-263886.0],[180637.0,-263911.0],[180637.0,-263913.0],[180636.0,-263940.0],[180636.0,-263945.0],[180635.0,-263974.0],[180635.0,-263976.0],[180634.0,-264008.0],[180634.0,-264013.0],[180633.0,-264047.0],[180633.0,-264054.0],[180632.0,-264093.0],[180632.0,-264103.0],[180631.0,-264154.0],[180631.0,-264166.0],[180630.0,-264266.0],[180630.0,-264310.0],[180630.0,-264311.0],[180629.0,-264321.0],[180629.0,-264322.0],[180628.0,-264333.0],[180628.0,-264334.0],[180627.0,-264345.0],[180627.0,-264347.0],[180626.0,-264359.0],[180626.0,-264361.0],[180625.0,-264377.0],[180625.0,-264433.0],[180626.0,-264445.0],[180626.0,-264446.0],[180627.0,-264455.0],[180627.0,-264456.0],[180628.0,-264464.0],[180629.0,-264470.0],[180629.0,-264471.0],[180630.0,-264477.0],[180633.0,-264492.0],[180639.0,-264516.0],[180647.0,-264542.0],[180655.0,-264565.0],[180657.0,-264570.0],[180658.0,-264573.0],[180660.0,-264578.0],[180661.0,-264581.0],[180663.0,-264586.0],[180664.0,-264589.0],[180668.0,-264599.0],[180669.0,-264602.0],[180675.0,-264617.0],[180676.0,-264620.0],[180680.0,-264630.0],[180681.0,-264633.0],[180683.0,-264638.0],[180693.0,-264665.0],[180695.0,-264671.0],[180699.0,-264682.0],[180704.0,-264697.0],[180707.0,-264707.0],[180709.0,-264713.0],[180710.0,-264717.0],[180711.0,-264720.0],[180714.0,-264731.0],[180715.0,-264734.0],[180720.0,-264754.0],[180722.0,-264763.0],[180726.0,-264783.0],[180728.0,-264795.0],[180729.0,-264802.0],[180731.0,-264819.0],[180731.0,-264820.0],[180732.0,-264830.0],[180732.0,-264832.0],[180733.0,-264848.0],[180733.0,-264907.0],[180732.0,-264929.0],[180732.0,-264933.0],[180731.0,-264952.0],[180731.0,-264955.0],[180730.0,-264975.0],[180730.0,-264979.0],[180729.0,-265005.0],[180729.0,-265114.0],[180730.0,-265141.0],[180730.0,-265145.0],[180731.0,-265166.0],[180731.0,-265170.0],[180732.0,-265190.0],[180732.0,-265194.0],[180733.0,-265220.0],[180733.0,-265267.0],[180732.0,-265285.0],[180732.0,-265288.0],[180731.0,-265299.0],[180731.0,-265301.0],[180729.0,-265318.0],[180729.0,-265319.0],[180728.0,-265325.0],[180728.0,-265326.0],[180726.0,-265338.0],[180724.0,-265348.0],[180722.0,-265357.0],[180718.0,-265372.0],[180713.0,-265387.0],[180708.0,-265400.0],[180707.0,-265402.0],[180704.0,-265409.0],[180696.0,-265425.0],[180692.0,-265432.0],[180684.0,-265445.0],[180677.0,-265455.0],[180668.0,-265467.0],[180664.0,-265472.0],[180663.0,-265473.0],[180658.0,-265479.0],[180649.0,-265489.0],[180624.0,-265514.0],[180613.0,-265524.0],[180611.0,-265526.0],[180595.0,-265540.0],[180593.0,-265542.0],[180587.0,-265547.0],[180578.0,-265555.0],[180572.0,-265560.0],[180571.0,-265561.0],[180565.0,-265566.0],[180564.0,-265567.0],[180558.0,-265572.0],[180557.0,-265573.0],[180551.0,-265578.0],[180550.0,-265579.0],[180544.0,-265584.0],[180543.0,-265585.0],[180537.0,-265590.0],[180520.0,-265605.0],[180518.0,-265607.0],[180509.0,-265615.0],[180470.0,-265654.0],[180463.0,-265662.0],[180459.0,-265667.0],[180458.0,-265668.0],[180450.0,-265678.0],[180441.0,-265690.0],[180434.0,-265700.0],[180430.0,-265706.0],[180427.0,-265711.0],[180425.0,-265714.0],[180419.0,-265724.0],[180415.0,-265731.0],[180408.0,-265744.0],[180404.0,-265752.0],[180399.0,-265763.0],[180397.0,-265767.0],[180392.0,-265779.0],[180391.0,-265781.0],[180387.0,-265791.0],[180386.0,-265794.0],[180384.0,-265799.0],[180383.0,-265802.0],[180381.0,-265807.0],[180368.0,-265846.0],[180362.0,-265866.0],[180354.0,-265894.0],[180353.0,-265898.0],[180352.0,-265901.0],[180351.0,-265905.0],[180347.0,-265919.0],[180346.0,-265923.0],[180345.0,-265926.0],[180344.0,-265930.0],[180343.0,-265933.0],[180342.0,-265937.0],[180341.0,-265940.0],[180340.0,-265944.0],[180334.0,-265964.0],[180329.0,-265980.0],[180320.0,-266007.0],[180315.0,-266021.0],[180296.0,-266078.0],[180293.0,-266088.0],[180288.0,-266106.0],[180285.0,-266118.0],[180284.0,-266123.0],[180283.0,-266127.0],[180280.0,-266143.0],[180277.0,-266165.0],[180277.0,-266166.0],[180276.0,-266176.0],[180276.0,-266178.0],[180275.0,-266193.0],[180275.0,-266236.0],[180276.0,-266255.0],[180276.0,-266257.0],[180277.0,-266271.0],[180277.0,-266273.0],[180278.0,-266285.0],[180278.0,-266286.0],[180279.0,-266297.0],[180279.0,-266299.0],[180280.0,-266309.0],[180280.0,-266310.0],[180280.0,-267638.0],[179780.0,-267638.0],[179780.0,-266310.0],[179780.0,-266309.0]],[]],[[[204299.0,-320820.0],[203799.0,-320820.0],[203799.0,-255710.0],[204299.0,-255710.0],[204299.0,-320820.0]],[]]]}, - {"id":16,"start":[245699,-267710,270],"target":[245879,-308570,180],"bounds":[233449.0,-320820.0,274661.0,-255710.0],"width":500,"keepouts":[[[[233449.0,-312679.608700656],[233449.0,-304460.391299344],[245807.0,-308297.6434572448],[245807.0,-308842.3565427552],[233449.0,-312679.608700656]],[]],[[[245449.0,-266309.0],[245450.0,-266299.0],[245450.0,-266297.0],[245451.0,-266286.0],[245451.0,-266285.0],[245452.0,-266273.0],[245452.0,-266271.0],[245453.0,-266257.0],[245453.0,-266255.0],[245454.0,-266236.0],[245454.0,-266193.0],[245453.0,-266178.0],[245453.0,-266176.0],[245452.0,-266166.0],[245452.0,-266165.0],[245449.0,-266143.0],[245446.0,-266127.0],[245445.0,-266123.0],[245444.0,-266118.0],[245441.0,-266106.0],[245436.0,-266088.0],[245433.0,-266078.0],[245414.0,-266021.0],[245409.0,-266007.0],[245400.0,-265980.0],[245395.0,-265964.0],[245389.0,-265944.0],[245388.0,-265940.0],[245387.0,-265937.0],[245386.0,-265933.0],[245385.0,-265930.0],[245384.0,-265926.0],[245383.0,-265923.0],[245382.0,-265919.0],[245378.0,-265905.0],[245377.0,-265901.0],[245376.0,-265898.0],[245375.0,-265894.0],[245367.0,-265866.0],[245361.0,-265846.0],[245348.0,-265807.0],[245346.0,-265802.0],[245345.0,-265799.0],[245343.0,-265794.0],[245342.0,-265791.0],[245338.0,-265781.0],[245337.0,-265779.0],[245332.0,-265767.0],[245330.0,-265763.0],[245325.0,-265752.0],[245321.0,-265744.0],[245314.0,-265731.0],[245310.0,-265724.0],[245304.0,-265714.0],[245302.0,-265711.0],[245299.0,-265706.0],[245295.0,-265700.0],[245288.0,-265690.0],[245279.0,-265678.0],[245271.0,-265668.0],[245270.0,-265667.0],[245266.0,-265662.0],[245259.0,-265654.0],[245220.0,-265615.0],[245211.0,-265607.0],[245209.0,-265605.0],[245192.0,-265590.0],[245186.0,-265585.0],[245185.0,-265584.0],[245179.0,-265579.0],[245178.0,-265578.0],[245172.0,-265573.0],[245171.0,-265572.0],[245165.0,-265567.0],[245164.0,-265566.0],[245158.0,-265561.0],[245157.0,-265560.0],[245151.0,-265555.0],[245142.0,-265547.0],[245136.0,-265542.0],[245134.0,-265540.0],[245118.0,-265526.0],[245116.0,-265524.0],[245105.0,-265514.0],[245080.0,-265489.0],[245071.0,-265479.0],[245066.0,-265473.0],[245065.0,-265472.0],[245061.0,-265467.0],[245052.0,-265455.0],[245045.0,-265445.0],[245037.0,-265432.0],[245033.0,-265425.0],[245025.0,-265409.0],[245022.0,-265402.0],[245021.0,-265400.0],[245016.0,-265387.0],[245011.0,-265372.0],[245007.0,-265357.0],[245005.0,-265348.0],[245003.0,-265338.0],[245001.0,-265326.0],[245001.0,-265325.0],[245000.0,-265319.0],[245000.0,-265318.0],[244998.0,-265301.0],[244998.0,-265299.0],[244997.0,-265288.0],[244997.0,-265285.0],[244996.0,-265267.0],[244996.0,-265220.0],[244997.0,-265194.0],[244997.0,-265190.0],[244998.0,-265170.0],[244998.0,-265166.0],[244999.0,-265145.0],[244999.0,-265141.0],[245000.0,-265114.0],[245000.0,-265005.0],[244999.0,-264979.0],[244999.0,-264975.0],[244998.0,-264955.0],[244998.0,-264952.0],[244997.0,-264933.0],[244997.0,-264929.0],[244996.0,-264907.0],[244996.0,-264848.0],[244997.0,-264832.0],[244997.0,-264830.0],[244998.0,-264820.0],[244998.0,-264819.0],[245000.0,-264802.0],[245001.0,-264795.0],[245003.0,-264783.0],[245007.0,-264763.0],[245009.0,-264754.0],[245014.0,-264734.0],[245015.0,-264731.0],[245018.0,-264720.0],[245019.0,-264717.0],[245020.0,-264713.0],[245022.0,-264707.0],[245025.0,-264697.0],[245030.0,-264682.0],[245034.0,-264671.0],[245036.0,-264665.0],[245046.0,-264638.0],[245048.0,-264633.0],[245049.0,-264630.0],[245053.0,-264620.0],[245054.0,-264617.0],[245060.0,-264602.0],[245061.0,-264599.0],[245065.0,-264589.0],[245066.0,-264586.0],[245068.0,-264581.0],[245069.0,-264578.0],[245071.0,-264573.0],[245072.0,-264570.0],[245074.0,-264565.0],[245082.0,-264542.0],[245090.0,-264516.0],[245096.0,-264492.0],[245099.0,-264477.0],[245100.0,-264471.0],[245100.0,-264470.0],[245101.0,-264464.0],[245102.0,-264456.0],[245102.0,-264455.0],[245103.0,-264446.0],[245103.0,-264445.0],[245104.0,-264433.0],[245104.0,-264377.0],[245103.0,-264361.0],[245103.0,-264359.0],[245102.0,-264347.0],[245102.0,-264345.0],[245101.0,-264334.0],[245101.0,-264333.0],[245100.0,-264322.0],[245100.0,-264321.0],[245099.0,-264311.0],[245099.0,-264310.0],[245099.0,-264266.0],[245098.0,-264166.0],[245098.0,-264154.0],[245097.0,-264103.0],[245097.0,-264093.0],[245096.0,-264054.0],[245096.0,-264047.0],[245095.0,-264013.0],[245095.0,-264008.0],[245094.0,-263976.0],[245094.0,-263974.0],[245093.0,-263945.0],[245093.0,-263940.0],[245092.0,-263913.0],[245092.0,-263911.0],[245091.0,-263886.0],[245091.0,-263884.0],[245090.0,-263862.0],[245090.0,-263860.0],[245089.0,-263838.0],[245089.0,-263835.0],[245088.0,-263814.0],[245088.0,-263811.0],[245087.0,-263792.0],[245087.0,-263789.0],[245086.0,-263770.0],[245086.0,-263768.0],[245083.0,-263712.0],[245083.0,-263710.0],[245079.0,-263640.0],[245079.0,-263639.0],[245077.0,-263608.0],[245077.0,-263606.0],[245070.0,-263502.0],[245069.0,-263490.0],[245069.0,-263488.0],[245065.0,-263435.0],[245061.0,-263387.0],[245061.0,-263385.0],[245059.0,-263361.0],[245056.0,-263328.0],[245054.0,-263304.0],[245042.0,-263178.0],[245034.0,-263102.0],[245021.0,-262987.0],[245014.0,-262929.0],[245013.0,-262922.0],[245003.0,-262843.0],[245001.0,-262829.0],[244999.0,-262813.0],[244993.0,-262769.0],[244975.0,-262644.0],[244961.0,-262553.0],[244958.0,-262535.0],[244957.0,-262528.0],[244954.0,-262510.0],[244953.0,-262503.0],[244938.0,-262413.0],[244936.0,-262402.0],[244933.0,-262384.0],[244929.0,-262362.0],[244927.0,-262350.0],[244903.0,-262219.0],[244896.0,-262182.0],[244887.0,-262136.0],[244873.0,-262066.0],[244865.0,-262027.0],[244863.0,-262018.0],[244860.0,-262003.0],[244859.0,-261999.0],[244835.0,-261887.0],[244834.0,-261883.0],[244827.0,-261851.0],[244826.0,-261847.0],[244825.0,-261842.0],[244808.0,-261768.0],[244770.0,-261609.0],[244753.0,-261541.0],[244743.0,-261502.0],[244725.0,-261433.0],[244701.0,-261344.0],[244685.0,-261286.0],[244658.0,-261191.0],[244645.0,-261146.0],[244641.0,-261133.0],[244623.0,-261072.0],[244598.0,-260990.0],[244596.0,-260984.0],[244589.0,-260961.0],[244565.0,-260885.0],[244545.0,-260823.0],[244497.0,-260679.0],[244490.0,-260659.0],[244485.0,-260644.0],[244480.0,-260630.0],[244468.0,-260595.0],[244431.0,-260491.0],[244404.0,-260417.0],[244376.0,-260342.0],[244374.0,-260337.0],[244370.0,-260326.0],[244349.0,-260271.0],[244345.0,-260261.0],[244343.0,-260255.0],[243489.0,-258045.0],[243488.0,-258043.0],[243475.0,-258009.0],[243471.0,-257999.0],[243433.0,-257898.0],[243404.0,-257819.0],[243381.0,-257755.0],[243341.0,-257641.0],[243337.0,-257629.0],[243330.0,-257609.0],[243323.0,-257588.0],[243309.0,-257547.0],[243276.0,-257447.0],[243257.0,-257388.0],[243227.0,-257293.0],[243201.0,-257208.0],[243172.0,-257110.0],[243171.0,-257107.0],[243167.0,-257093.0],[243166.0,-257090.0],[243154.0,-257048.0],[243151.0,-257038.0],[243139.0,-256995.0],[243136.0,-256985.0],[243106.0,-256876.0],[243104.0,-256868.0],[243099.0,-256850.0],[243097.0,-256842.0],[243095.0,-256835.0],[243093.0,-256827.0],[243086.0,-256801.0],[243065.0,-256720.0],[243034.0,-256596.0],[243029.0,-256575.0],[243025.0,-256559.0],[243018.0,-256529.0],[243011.0,-256500.0],[242996.0,-256435.0],[242981.0,-256369.0],[242978.0,-256355.0],[242973.0,-256333.0],[242954.0,-256245.0],[242937.0,-256163.0],[242915.0,-256053.0],[242914.0,-256047.0],[242909.0,-256022.0],[242908.0,-256016.0],[242896.0,-255953.0],[242895.0,-255947.0],[242889.0,-255915.0],[242873.0,-255825.0],[242870.0,-255807.0],[242869.0,-255802.0],[242862.0,-255760.0],[242860.0,-255749.0],[242853.64130434784,-255710.0],[243360.54545454544,-255710.0],[243362.0,-255718.0],[243365.0,-255736.0],[243369.0,-255758.0],[243371.0,-255770.0],[243394.0,-255896.0],[243402.0,-255938.0],[243411.0,-255984.0],[243425.0,-256054.0],[243433.0,-256093.0],[243435.0,-256102.0],[243438.0,-256117.0],[243439.0,-256121.0],[243444.0,-256145.0],[243461.0,-256224.0],[243464.0,-256237.0],[243471.0,-256269.0],[243472.0,-256273.0],[243473.0,-256278.0],[243489.0,-256348.0],[243528.0,-256511.0],[243545.0,-256579.0],[243573.0,-256687.0],[243603.0,-256798.0],[243624.0,-256873.0],[243653.0,-256974.0],[243657.0,-256987.0],[243669.0,-257028.0],[243700.0,-257130.0],[243702.0,-257136.0],[243705.0,-257146.0],[243733.0,-257235.0],[243753.0,-257297.0],[243801.0,-257441.0],[243808.0,-257461.0],[243813.0,-257476.0],[243818.0,-257490.0],[243830.0,-257525.0],[243858.0,-257604.0],[243879.0,-257662.0],[243922.0,-257778.0],[243924.0,-257783.0],[243928.0,-257794.0],[243949.0,-257849.0],[243953.0,-257859.0],[243955.0,-257865.0],[244809.0,-260075.0],[244810.0,-260077.0],[244823.0,-260111.0],[244827.0,-260121.0],[244865.0,-260222.0],[244886.0,-260279.0],[244917.0,-260365.0],[244928.0,-260396.0],[244957.0,-260479.0],[244961.0,-260491.0],[244968.0,-260511.0],[244975.0,-260532.0],[244989.0,-260573.0],[245022.0,-260673.0],[245041.0,-260732.0],[245071.0,-260827.0],[245100.0,-260922.0],[245127.0,-261013.0],[245131.0,-261027.0],[245132.0,-261030.0],[245144.0,-261072.0],[245147.0,-261082.0],[245159.0,-261125.0],[245162.0,-261135.0],[245192.0,-261244.0],[245194.0,-261252.0],[245199.0,-261270.0],[245201.0,-261278.0],[245203.0,-261285.0],[245205.0,-261293.0],[245212.0,-261319.0],[245233.0,-261400.0],[245264.0,-261524.0],[245269.0,-261545.0],[245273.0,-261561.0],[245287.0,-261620.0],[245292.0,-261642.0],[245294.0,-261650.0],[245317.0,-261751.0],[245320.0,-261765.0],[245323.0,-261778.0],[245344.0,-261875.0],[245361.0,-261957.0],[245383.0,-262067.0],[245384.0,-262073.0],[245389.0,-262098.0],[245390.0,-262104.0],[245409.0,-262205.0],[245422.0,-262278.0],[245428.0,-262313.0],[245429.0,-262318.0],[245436.0,-262360.0],[245438.0,-262371.0],[245453.0,-262463.0],[245465.0,-262540.0],[245477.0,-262621.0],[245484.0,-262670.0],[245486.0,-262685.0],[245487.0,-262691.0],[245502.0,-262803.0],[245502.0,-262804.0],[245506.0,-262834.0],[245507.0,-262843.0],[245508.0,-262850.0],[245509.0,-262859.0],[245511.0,-262874.0],[245517.0,-262924.0],[245519.0,-262942.0],[245521.0,-262958.0],[245528.0,-263020.0],[245537.0,-263104.0],[245548.0,-263216.0],[245548.0,-263217.0],[245550.0,-263239.0],[245551.0,-263248.0],[245552.0,-263261.0],[245557.0,-263317.0],[245557.0,-263318.0],[245560.0,-263353.0],[245564.0,-263403.0],[245564.0,-263404.0],[245568.0,-263457.0],[245568.0,-263458.0],[245569.0,-263470.0],[245570.0,-263486.0],[245571.0,-263499.0],[245572.0,-263515.0],[245573.0,-263528.0],[245575.0,-263559.0],[245575.0,-263560.0],[245576.0,-263575.0],[245576.0,-263576.0],[245579.0,-263624.0],[245582.0,-263678.0],[245582.0,-263679.0],[245583.0,-263697.0],[245583.0,-263698.0],[245585.0,-263736.0],[245585.0,-263737.0],[245586.0,-263756.0],[245586.0,-263759.0],[245587.0,-263778.0],[245587.0,-263779.0],[245589.0,-263824.0],[245589.0,-263827.0],[245590.0,-263849.0],[245590.0,-263850.0],[245591.0,-263875.0],[245591.0,-263878.0],[245592.0,-263904.0],[245592.0,-263905.0],[245593.0,-263933.0],[245593.0,-263937.0],[245594.0,-263966.0],[245594.0,-263969.0],[245595.0,-264001.0],[245595.0,-264005.0],[245596.0,-264043.0],[245596.0,-264047.0],[245597.0,-264089.0],[245597.0,-264096.0],[245598.0,-264151.0],[245598.0,-264164.0],[245599.0,-264268.0],[245599.0,-264310.0],[245799.0,-264310.0],[245799.0,-264268.0],[245800.0,-264164.0],[245800.0,-264151.0],[245801.0,-264096.0],[245801.0,-264089.0],[245802.0,-264047.0],[245802.0,-264043.0],[245803.0,-264005.0],[245803.0,-264001.0],[245804.0,-263969.0],[245804.0,-263966.0],[245805.0,-263937.0],[245805.0,-263933.0],[245806.0,-263905.0],[245806.0,-263904.0],[245807.0,-263878.0],[245807.0,-263875.0],[245808.0,-263850.0],[245808.0,-263849.0],[245809.0,-263827.0],[245809.0,-263824.0],[245811.0,-263779.0],[245811.0,-263778.0],[245812.0,-263759.0],[245812.0,-263756.0],[245813.0,-263737.0],[245813.0,-263736.0],[245815.0,-263698.0],[245815.0,-263697.0],[245816.0,-263679.0],[245816.0,-263678.0],[245819.0,-263624.0],[245822.0,-263576.0],[245822.0,-263575.0],[245823.0,-263560.0],[245823.0,-263559.0],[245825.0,-263528.0],[245826.0,-263515.0],[245827.0,-263499.0],[245828.0,-263486.0],[245829.0,-263470.0],[245830.0,-263458.0],[245830.0,-263457.0],[245834.0,-263404.0],[245834.0,-263403.0],[245838.0,-263353.0],[245841.0,-263318.0],[245841.0,-263317.0],[245846.0,-263261.0],[245847.0,-263248.0],[245848.0,-263239.0],[245850.0,-263217.0],[245850.0,-263216.0],[245861.0,-263104.0],[245870.0,-263020.0],[245877.0,-262958.0],[245879.0,-262942.0],[245881.0,-262924.0],[245887.0,-262874.0],[245889.0,-262859.0],[245890.0,-262850.0],[245891.0,-262843.0],[245892.0,-262834.0],[245896.0,-262804.0],[245896.0,-262803.0],[245911.0,-262691.0],[245912.0,-262685.0],[245914.0,-262670.0],[245921.0,-262621.0],[245933.0,-262540.0],[245945.0,-262463.0],[245960.0,-262371.0],[245962.0,-262360.0],[245969.0,-262318.0],[245970.0,-262313.0],[245976.0,-262278.0],[245989.0,-262205.0],[246008.0,-262104.0],[246009.0,-262098.0],[246014.0,-262073.0],[246015.0,-262067.0],[246037.0,-261957.0],[246054.0,-261875.0],[246075.0,-261778.0],[246078.0,-261765.0],[246081.0,-261751.0],[246104.0,-261650.0],[246106.0,-261642.0],[246111.0,-261620.0],[246125.0,-261561.0],[246129.0,-261545.0],[246134.0,-261524.0],[246165.0,-261400.0],[246186.0,-261319.0],[246193.0,-261293.0],[246195.0,-261285.0],[246197.0,-261278.0],[246199.0,-261270.0],[246204.0,-261252.0],[246206.0,-261244.0],[246236.0,-261135.0],[246239.0,-261125.0],[246251.0,-261082.0],[246254.0,-261072.0],[246266.0,-261030.0],[246267.0,-261027.0],[246271.0,-261013.0],[246298.0,-260922.0],[246327.0,-260827.0],[246357.0,-260732.0],[246376.0,-260673.0],[246409.0,-260573.0],[246423.0,-260532.0],[246430.0,-260511.0],[246437.0,-260491.0],[246441.0,-260479.0],[246470.0,-260396.0],[246481.0,-260365.0],[246512.0,-260279.0],[246533.0,-260222.0],[246571.0,-260121.0],[246575.0,-260111.0],[246588.0,-260077.0],[246589.0,-260075.0],[247443.0,-257865.0],[247445.0,-257859.0],[247449.0,-257849.0],[247470.0,-257794.0],[247474.0,-257783.0],[247476.0,-257778.0],[247519.0,-257662.0],[247540.0,-257604.0],[247568.0,-257525.0],[247580.0,-257490.0],[247585.0,-257476.0],[247590.0,-257461.0],[247597.0,-257441.0],[247645.0,-257297.0],[247665.0,-257235.0],[247693.0,-257146.0],[247696.0,-257136.0],[247698.0,-257130.0],[247729.0,-257028.0],[247741.0,-256987.0],[247745.0,-256974.0],[247774.0,-256873.0],[247795.0,-256798.0],[247825.0,-256687.0],[247853.0,-256579.0],[247870.0,-256511.0],[247909.0,-256348.0],[247925.0,-256278.0],[247926.0,-256273.0],[247927.0,-256269.0],[247934.0,-256237.0],[247937.0,-256224.0],[247954.0,-256145.0],[247959.0,-256121.0],[247960.0,-256117.0],[247963.0,-256102.0],[247965.0,-256093.0],[247973.0,-256054.0],[247987.0,-255984.0],[247996.0,-255938.0],[248004.0,-255896.0],[248027.0,-255770.0],[248029.0,-255758.0],[248033.0,-255736.0],[248036.0,-255718.0],[248037.45454545456,-255710.0],[248544.35869565216,-255710.0],[248538.0,-255749.0],[248536.0,-255760.0],[248529.0,-255802.0],[248528.0,-255807.0],[248525.0,-255825.0],[248509.0,-255915.0],[248503.0,-255947.0],[248502.0,-255953.0],[248490.0,-256016.0],[248489.0,-256022.0],[248484.0,-256047.0],[248483.0,-256053.0],[248461.0,-256163.0],[248444.0,-256245.0],[248425.0,-256333.0],[248420.0,-256355.0],[248417.0,-256369.0],[248402.0,-256435.0],[248387.0,-256500.0],[248380.0,-256529.0],[248373.0,-256559.0],[248369.0,-256575.0],[248364.0,-256596.0],[248333.0,-256720.0],[248312.0,-256801.0],[248305.0,-256827.0],[248303.0,-256835.0],[248301.0,-256842.0],[248299.0,-256850.0],[248294.0,-256868.0],[248292.0,-256876.0],[248262.0,-256985.0],[248259.0,-256995.0],[248247.0,-257038.0],[248244.0,-257048.0],[248232.0,-257090.0],[248231.0,-257093.0],[248227.0,-257107.0],[248226.0,-257110.0],[248197.0,-257208.0],[248171.0,-257293.0],[248141.0,-257388.0],[248122.0,-257447.0],[248089.0,-257547.0],[248075.0,-257588.0],[248068.0,-257609.0],[248061.0,-257629.0],[248057.0,-257641.0],[248017.0,-257755.0],[247994.0,-257819.0],[247965.0,-257898.0],[247927.0,-257999.0],[247923.0,-258009.0],[247910.0,-258043.0],[247909.0,-258045.0],[247055.0,-260255.0],[247053.0,-260261.0],[247049.0,-260271.0],[247028.0,-260326.0],[247024.0,-260337.0],[247022.0,-260342.0],[246994.0,-260417.0],[246967.0,-260491.0],[246930.0,-260595.0],[246918.0,-260630.0],[246913.0,-260644.0],[246908.0,-260659.0],[246901.0,-260679.0],[246853.0,-260823.0],[246833.0,-260885.0],[246809.0,-260961.0],[246802.0,-260984.0],[246800.0,-260990.0],[246775.0,-261072.0],[246757.0,-261133.0],[246753.0,-261146.0],[246740.0,-261191.0],[246713.0,-261286.0],[246697.0,-261344.0],[246673.0,-261433.0],[246655.0,-261502.0],[246645.0,-261541.0],[246628.0,-261609.0],[246590.0,-261768.0],[246573.0,-261842.0],[246572.0,-261847.0],[246571.0,-261851.0],[246564.0,-261883.0],[246563.0,-261887.0],[246539.0,-261999.0],[246538.0,-262003.0],[246535.0,-262018.0],[246533.0,-262027.0],[246525.0,-262066.0],[246511.0,-262136.0],[246502.0,-262182.0],[246495.0,-262219.0],[246471.0,-262350.0],[246469.0,-262362.0],[246465.0,-262384.0],[246462.0,-262402.0],[246460.0,-262413.0],[246445.0,-262503.0],[246444.0,-262510.0],[246441.0,-262528.0],[246440.0,-262535.0],[246437.0,-262553.0],[246423.0,-262644.0],[246405.0,-262769.0],[246399.0,-262813.0],[246397.0,-262829.0],[246395.0,-262843.0],[246385.0,-262922.0],[246384.0,-262929.0],[246377.0,-262987.0],[246364.0,-263102.0],[246356.0,-263178.0],[246344.0,-263304.0],[246342.0,-263328.0],[246339.0,-263361.0],[246337.0,-263385.0],[246337.0,-263387.0],[246333.0,-263435.0],[246329.0,-263488.0],[246329.0,-263490.0],[246328.0,-263502.0],[246321.0,-263606.0],[246321.0,-263608.0],[246319.0,-263639.0],[246319.0,-263640.0],[246315.0,-263710.0],[246315.0,-263712.0],[246312.0,-263768.0],[246312.0,-263770.0],[246311.0,-263789.0],[246311.0,-263792.0],[246310.0,-263811.0],[246310.0,-263814.0],[246309.0,-263835.0],[246309.0,-263838.0],[246308.0,-263860.0],[246308.0,-263862.0],[246307.0,-263884.0],[246307.0,-263886.0],[246306.0,-263911.0],[246306.0,-263913.0],[246305.0,-263940.0],[246305.0,-263945.0],[246304.0,-263974.0],[246304.0,-263976.0],[246303.0,-264008.0],[246303.0,-264013.0],[246302.0,-264047.0],[246302.0,-264054.0],[246301.0,-264093.0],[246301.0,-264103.0],[246300.0,-264154.0],[246300.0,-264166.0],[246299.0,-264266.0],[246299.0,-264310.0],[246299.0,-264311.0],[246298.0,-264321.0],[246298.0,-264322.0],[246297.0,-264333.0],[246297.0,-264334.0],[246296.0,-264345.0],[246296.0,-264347.0],[246295.0,-264359.0],[246295.0,-264361.0],[246294.0,-264377.0],[246294.0,-264433.0],[246295.0,-264445.0],[246295.0,-264446.0],[246296.0,-264455.0],[246296.0,-264456.0],[246297.0,-264464.0],[246298.0,-264470.0],[246298.0,-264471.0],[246299.0,-264477.0],[246302.0,-264492.0],[246308.0,-264516.0],[246316.0,-264542.0],[246324.0,-264565.0],[246326.0,-264570.0],[246327.0,-264573.0],[246329.0,-264578.0],[246330.0,-264581.0],[246332.0,-264586.0],[246333.0,-264589.0],[246337.0,-264599.0],[246338.0,-264602.0],[246344.0,-264617.0],[246345.0,-264620.0],[246349.0,-264630.0],[246350.0,-264633.0],[246352.0,-264638.0],[246362.0,-264665.0],[246364.0,-264671.0],[246368.0,-264682.0],[246373.0,-264697.0],[246376.0,-264707.0],[246378.0,-264713.0],[246379.0,-264717.0],[246380.0,-264720.0],[246383.0,-264731.0],[246384.0,-264734.0],[246389.0,-264754.0],[246391.0,-264763.0],[246395.0,-264783.0],[246397.0,-264795.0],[246398.0,-264802.0],[246400.0,-264819.0],[246400.0,-264820.0],[246401.0,-264830.0],[246401.0,-264832.0],[246402.0,-264848.0],[246402.0,-264907.0],[246401.0,-264929.0],[246401.0,-264933.0],[246400.0,-264952.0],[246400.0,-264955.0],[246399.0,-264975.0],[246399.0,-264979.0],[246398.0,-265005.0],[246398.0,-265114.0],[246399.0,-265141.0],[246399.0,-265145.0],[246400.0,-265166.0],[246400.0,-265170.0],[246401.0,-265190.0],[246401.0,-265194.0],[246402.0,-265220.0],[246402.0,-265267.0],[246401.0,-265285.0],[246401.0,-265288.0],[246400.0,-265299.0],[246400.0,-265301.0],[246398.0,-265318.0],[246398.0,-265319.0],[246397.0,-265325.0],[246397.0,-265326.0],[246395.0,-265338.0],[246393.0,-265348.0],[246391.0,-265357.0],[246387.0,-265372.0],[246382.0,-265387.0],[246377.0,-265400.0],[246376.0,-265402.0],[246373.0,-265409.0],[246365.0,-265425.0],[246361.0,-265432.0],[246353.0,-265445.0],[246346.0,-265455.0],[246337.0,-265467.0],[246333.0,-265472.0],[246332.0,-265473.0],[246327.0,-265479.0],[246318.0,-265489.0],[246293.0,-265514.0],[246282.0,-265524.0],[246280.0,-265526.0],[246264.0,-265540.0],[246262.0,-265542.0],[246256.0,-265547.0],[246247.0,-265555.0],[246241.0,-265560.0],[246240.0,-265561.0],[246234.0,-265566.0],[246233.0,-265567.0],[246227.0,-265572.0],[246226.0,-265573.0],[246220.0,-265578.0],[246219.0,-265579.0],[246213.0,-265584.0],[246212.0,-265585.0],[246206.0,-265590.0],[246189.0,-265605.0],[246187.0,-265607.0],[246178.0,-265615.0],[246139.0,-265654.0],[246132.0,-265662.0],[246128.0,-265667.0],[246127.0,-265668.0],[246119.0,-265678.0],[246110.0,-265690.0],[246103.0,-265700.0],[246099.0,-265706.0],[246096.0,-265711.0],[246094.0,-265714.0],[246088.0,-265724.0],[246084.0,-265731.0],[246077.0,-265744.0],[246073.0,-265752.0],[246068.0,-265763.0],[246066.0,-265767.0],[246061.0,-265779.0],[246060.0,-265781.0],[246056.0,-265791.0],[246055.0,-265794.0],[246053.0,-265799.0],[246052.0,-265802.0],[246050.0,-265807.0],[246037.0,-265846.0],[246031.0,-265866.0],[246023.0,-265894.0],[246022.0,-265898.0],[246021.0,-265901.0],[246020.0,-265905.0],[246016.0,-265919.0],[246015.0,-265923.0],[246014.0,-265926.0],[246013.0,-265930.0],[246012.0,-265933.0],[246011.0,-265937.0],[246010.0,-265940.0],[246009.0,-265944.0],[246003.0,-265964.0],[245998.0,-265980.0],[245989.0,-266007.0],[245984.0,-266021.0],[245965.0,-266078.0],[245962.0,-266088.0],[245957.0,-266106.0],[245954.0,-266118.0],[245953.0,-266123.0],[245952.0,-266127.0],[245949.0,-266143.0],[245946.0,-266165.0],[245946.0,-266166.0],[245945.0,-266176.0],[245945.0,-266178.0],[245944.0,-266193.0],[245944.0,-266236.0],[245945.0,-266255.0],[245945.0,-266257.0],[245946.0,-266271.0],[245946.0,-266273.0],[245947.0,-266285.0],[245947.0,-266286.0],[245948.0,-266297.0],[245948.0,-266299.0],[245949.0,-266309.0],[245949.0,-266310.0],[245949.0,-267638.0],[245449.0,-267638.0],[245449.0,-266310.0],[245449.0,-266309.0]],[]],[[[269899.0,-320820.0],[269399.0,-320820.0],[269399.0,-255710.0],[269899.0,-255710.0],[269899.0,-320820.0]],[]]]}, - {"id":17,"start":[311370,-267710,270],"target":[311609,-308570,180],"bounds":[299120.0,-320820.0,339891.0,-255710.0],"width":500,"keepouts":[[[[299120.0,-312697.9286454137],[299120.0,-304442.0713545863],[311537.0,-308297.6434572448],[311537.0,-308842.3565427552],[299120.0,-312697.9286454137]],[]],[[[311120.0,-266309.0],[311121.0,-266299.0],[311121.0,-266297.0],[311122.0,-266286.0],[311122.0,-266285.0],[311123.0,-266273.0],[311123.0,-266271.0],[311124.0,-266257.0],[311124.0,-266255.0],[311125.0,-266236.0],[311125.0,-266193.0],[311124.0,-266178.0],[311124.0,-266176.0],[311123.0,-266166.0],[311123.0,-266165.0],[311120.0,-266143.0],[311117.0,-266127.0],[311116.0,-266123.0],[311115.0,-266118.0],[311112.0,-266106.0],[311107.0,-266088.0],[311104.0,-266078.0],[311085.0,-266021.0],[311080.0,-266007.0],[311071.0,-265980.0],[311066.0,-265964.0],[311060.0,-265944.0],[311059.0,-265940.0],[311058.0,-265937.0],[311057.0,-265933.0],[311056.0,-265930.0],[311055.0,-265926.0],[311054.0,-265923.0],[311053.0,-265919.0],[311049.0,-265905.0],[311048.0,-265901.0],[311047.0,-265898.0],[311046.0,-265894.0],[311038.0,-265866.0],[311032.0,-265846.0],[311019.0,-265807.0],[311017.0,-265802.0],[311016.0,-265799.0],[311014.0,-265794.0],[311013.0,-265791.0],[311009.0,-265781.0],[311008.0,-265779.0],[311003.0,-265767.0],[311001.0,-265763.0],[310996.0,-265752.0],[310992.0,-265744.0],[310985.0,-265731.0],[310981.0,-265724.0],[310975.0,-265714.0],[310973.0,-265711.0],[310970.0,-265706.0],[310966.0,-265700.0],[310959.0,-265690.0],[310950.0,-265678.0],[310942.0,-265668.0],[310941.0,-265667.0],[310937.0,-265662.0],[310930.0,-265654.0],[310891.0,-265615.0],[310882.0,-265607.0],[310880.0,-265605.0],[310863.0,-265590.0],[310857.0,-265585.0],[310856.0,-265584.0],[310850.0,-265579.0],[310849.0,-265578.0],[310843.0,-265573.0],[310842.0,-265572.0],[310836.0,-265567.0],[310835.0,-265566.0],[310829.0,-265561.0],[310828.0,-265560.0],[310822.0,-265555.0],[310813.0,-265547.0],[310807.0,-265542.0],[310805.0,-265540.0],[310789.0,-265526.0],[310787.0,-265524.0],[310776.0,-265514.0],[310751.0,-265489.0],[310742.0,-265479.0],[310737.0,-265473.0],[310736.0,-265472.0],[310732.0,-265467.0],[310723.0,-265455.0],[310716.0,-265445.0],[310708.0,-265432.0],[310704.0,-265425.0],[310696.0,-265409.0],[310693.0,-265402.0],[310692.0,-265400.0],[310687.0,-265387.0],[310682.0,-265372.0],[310678.0,-265357.0],[310676.0,-265348.0],[310674.0,-265338.0],[310672.0,-265326.0],[310672.0,-265325.0],[310671.0,-265319.0],[310671.0,-265318.0],[310669.0,-265301.0],[310669.0,-265299.0],[310668.0,-265288.0],[310668.0,-265285.0],[310667.0,-265267.0],[310667.0,-265220.0],[310668.0,-265194.0],[310668.0,-265190.0],[310669.0,-265170.0],[310669.0,-265166.0],[310670.0,-265145.0],[310670.0,-265141.0],[310671.0,-265114.0],[310671.0,-265005.0],[310670.0,-264979.0],[310670.0,-264975.0],[310669.0,-264955.0],[310669.0,-264952.0],[310668.0,-264933.0],[310668.0,-264929.0],[310667.0,-264907.0],[310667.0,-264848.0],[310668.0,-264832.0],[310668.0,-264830.0],[310669.0,-264820.0],[310669.0,-264819.0],[310671.0,-264802.0],[310672.0,-264795.0],[310674.0,-264783.0],[310678.0,-264763.0],[310680.0,-264754.0],[310685.0,-264734.0],[310686.0,-264731.0],[310689.0,-264720.0],[310690.0,-264717.0],[310691.0,-264713.0],[310693.0,-264707.0],[310696.0,-264697.0],[310701.0,-264682.0],[310705.0,-264671.0],[310707.0,-264665.0],[310717.0,-264638.0],[310719.0,-264633.0],[310720.0,-264630.0],[310724.0,-264620.0],[310725.0,-264617.0],[310731.0,-264602.0],[310732.0,-264599.0],[310736.0,-264589.0],[310737.0,-264586.0],[310739.0,-264581.0],[310740.0,-264578.0],[310742.0,-264573.0],[310743.0,-264570.0],[310745.0,-264565.0],[310753.0,-264542.0],[310761.0,-264516.0],[310767.0,-264492.0],[310770.0,-264477.0],[310771.0,-264471.0],[310771.0,-264470.0],[310772.0,-264464.0],[310773.0,-264456.0],[310773.0,-264455.0],[310774.0,-264446.0],[310774.0,-264445.0],[310775.0,-264433.0],[310775.0,-264377.0],[310774.0,-264361.0],[310774.0,-264359.0],[310773.0,-264347.0],[310773.0,-264345.0],[310772.0,-264334.0],[310772.0,-264333.0],[310771.0,-264322.0],[310771.0,-264321.0],[310770.0,-264311.0],[310770.0,-264310.0],[310770.0,-264266.0],[310769.0,-264166.0],[310769.0,-264154.0],[310768.0,-264103.0],[310768.0,-264093.0],[310767.0,-264054.0],[310767.0,-264047.0],[310766.0,-264013.0],[310766.0,-264008.0],[310765.0,-263976.0],[310765.0,-263974.0],[310764.0,-263945.0],[310764.0,-263940.0],[310763.0,-263913.0],[310763.0,-263911.0],[310762.0,-263886.0],[310762.0,-263884.0],[310761.0,-263862.0],[310761.0,-263860.0],[310760.0,-263838.0],[310760.0,-263835.0],[310759.0,-263814.0],[310759.0,-263811.0],[310758.0,-263792.0],[310758.0,-263789.0],[310757.0,-263770.0],[310757.0,-263768.0],[310754.0,-263712.0],[310754.0,-263710.0],[310750.0,-263640.0],[310750.0,-263639.0],[310748.0,-263608.0],[310748.0,-263606.0],[310741.0,-263502.0],[310740.0,-263490.0],[310740.0,-263488.0],[310736.0,-263435.0],[310732.0,-263387.0],[310732.0,-263385.0],[310730.0,-263361.0],[310727.0,-263328.0],[310725.0,-263304.0],[310713.0,-263178.0],[310705.0,-263102.0],[310692.0,-262987.0],[310685.0,-262929.0],[310684.0,-262922.0],[310674.0,-262843.0],[310672.0,-262829.0],[310670.0,-262813.0],[310664.0,-262769.0],[310646.0,-262644.0],[310632.0,-262553.0],[310629.0,-262535.0],[310628.0,-262528.0],[310625.0,-262510.0],[310624.0,-262503.0],[310609.0,-262413.0],[310607.0,-262402.0],[310604.0,-262384.0],[310600.0,-262362.0],[310598.0,-262350.0],[310574.0,-262219.0],[310567.0,-262182.0],[310558.0,-262136.0],[310544.0,-262066.0],[310536.0,-262027.0],[310534.0,-262018.0],[310531.0,-262003.0],[310530.0,-261999.0],[310506.0,-261887.0],[310505.0,-261883.0],[310498.0,-261851.0],[310497.0,-261847.0],[310496.0,-261842.0],[310479.0,-261768.0],[310441.0,-261609.0],[310424.0,-261541.0],[310414.0,-261502.0],[310396.0,-261433.0],[310372.0,-261344.0],[310356.0,-261286.0],[310329.0,-261191.0],[310316.0,-261146.0],[310312.0,-261133.0],[310294.0,-261072.0],[310269.0,-260990.0],[310267.0,-260984.0],[310260.0,-260961.0],[310236.0,-260885.0],[310216.0,-260823.0],[310168.0,-260679.0],[310161.0,-260659.0],[310156.0,-260644.0],[310151.0,-260630.0],[310139.0,-260595.0],[310102.0,-260491.0],[310075.0,-260417.0],[310047.0,-260342.0],[310045.0,-260337.0],[310041.0,-260326.0],[310020.0,-260271.0],[310016.0,-260261.0],[310014.0,-260255.0],[309160.0,-258045.0],[309159.0,-258043.0],[309146.0,-258009.0],[309142.0,-257999.0],[309104.0,-257898.0],[309075.0,-257819.0],[309052.0,-257755.0],[309012.0,-257641.0],[309008.0,-257629.0],[309001.0,-257609.0],[308994.0,-257588.0],[308980.0,-257547.0],[308947.0,-257447.0],[308928.0,-257388.0],[308898.0,-257293.0],[308872.0,-257208.0],[308843.0,-257110.0],[308842.0,-257107.0],[308838.0,-257093.0],[308837.0,-257090.0],[308825.0,-257048.0],[308822.0,-257038.0],[308810.0,-256995.0],[308807.0,-256985.0],[308777.0,-256876.0],[308775.0,-256868.0],[308770.0,-256850.0],[308768.0,-256842.0],[308766.0,-256835.0],[308764.0,-256827.0],[308757.0,-256801.0],[308736.0,-256720.0],[308705.0,-256596.0],[308700.0,-256575.0],[308696.0,-256559.0],[308689.0,-256529.0],[308682.0,-256500.0],[308667.0,-256435.0],[308652.0,-256369.0],[308649.0,-256355.0],[308644.0,-256333.0],[308625.0,-256245.0],[308608.0,-256163.0],[308586.0,-256053.0],[308585.0,-256047.0],[308580.0,-256022.0],[308579.0,-256016.0],[308567.0,-255953.0],[308566.0,-255947.0],[308560.0,-255915.0],[308544.0,-255825.0],[308541.0,-255807.0],[308540.0,-255802.0],[308533.0,-255760.0],[308531.0,-255749.0],[308524.64130434784,-255710.0],[309031.54545454547,-255710.0],[309033.0,-255718.0],[309036.0,-255736.0],[309040.0,-255758.0],[309042.0,-255770.0],[309065.0,-255896.0],[309073.0,-255938.0],[309082.0,-255984.0],[309096.0,-256054.0],[309104.0,-256093.0],[309106.0,-256102.0],[309109.0,-256117.0],[309110.0,-256121.0],[309115.0,-256145.0],[309132.0,-256224.0],[309135.0,-256237.0],[309142.0,-256269.0],[309143.0,-256273.0],[309144.0,-256278.0],[309160.0,-256348.0],[309199.0,-256511.0],[309216.0,-256579.0],[309244.0,-256687.0],[309274.0,-256798.0],[309295.0,-256873.0],[309324.0,-256974.0],[309328.0,-256987.0],[309340.0,-257028.0],[309371.0,-257130.0],[309373.0,-257136.0],[309376.0,-257146.0],[309404.0,-257235.0],[309424.0,-257297.0],[309472.0,-257441.0],[309479.0,-257461.0],[309484.0,-257476.0],[309489.0,-257490.0],[309501.0,-257525.0],[309529.0,-257604.0],[309550.0,-257662.0],[309593.0,-257778.0],[309595.0,-257783.0],[309599.0,-257794.0],[309620.0,-257849.0],[309624.0,-257859.0],[309626.0,-257865.0],[310480.0,-260075.0],[310481.0,-260077.0],[310494.0,-260111.0],[310498.0,-260121.0],[310536.0,-260222.0],[310557.0,-260279.0],[310588.0,-260365.0],[310599.0,-260396.0],[310628.0,-260479.0],[310632.0,-260491.0],[310639.0,-260511.0],[310646.0,-260532.0],[310660.0,-260573.0],[310693.0,-260673.0],[310712.0,-260732.0],[310742.0,-260827.0],[310771.0,-260922.0],[310798.0,-261013.0],[310802.0,-261027.0],[310803.0,-261030.0],[310815.0,-261072.0],[310818.0,-261082.0],[310830.0,-261125.0],[310833.0,-261135.0],[310863.0,-261244.0],[310865.0,-261252.0],[310870.0,-261270.0],[310872.0,-261278.0],[310874.0,-261285.0],[310876.0,-261293.0],[310883.0,-261319.0],[310904.0,-261400.0],[310935.0,-261524.0],[310940.0,-261545.0],[310944.0,-261561.0],[310958.0,-261620.0],[310963.0,-261642.0],[310965.0,-261650.0],[310988.0,-261751.0],[310991.0,-261765.0],[310994.0,-261778.0],[311015.0,-261875.0],[311032.0,-261957.0],[311054.0,-262067.0],[311055.0,-262073.0],[311060.0,-262098.0],[311061.0,-262104.0],[311080.0,-262205.0],[311093.0,-262278.0],[311099.0,-262313.0],[311100.0,-262318.0],[311107.0,-262360.0],[311109.0,-262371.0],[311124.0,-262463.0],[311136.0,-262540.0],[311148.0,-262621.0],[311155.0,-262670.0],[311157.0,-262685.0],[311158.0,-262691.0],[311173.0,-262803.0],[311173.0,-262804.0],[311177.0,-262834.0],[311178.0,-262843.0],[311179.0,-262850.0],[311180.0,-262859.0],[311182.0,-262874.0],[311188.0,-262924.0],[311190.0,-262942.0],[311192.0,-262958.0],[311199.0,-263020.0],[311208.0,-263104.0],[311219.0,-263216.0],[311219.0,-263217.0],[311221.0,-263239.0],[311222.0,-263248.0],[311223.0,-263261.0],[311228.0,-263317.0],[311228.0,-263318.0],[311231.0,-263353.0],[311235.0,-263403.0],[311235.0,-263404.0],[311239.0,-263457.0],[311239.0,-263458.0],[311240.0,-263470.0],[311241.0,-263486.0],[311242.0,-263499.0],[311243.0,-263515.0],[311244.0,-263528.0],[311246.0,-263559.0],[311246.0,-263560.0],[311247.0,-263575.0],[311247.0,-263576.0],[311250.0,-263624.0],[311253.0,-263678.0],[311253.0,-263679.0],[311254.0,-263697.0],[311254.0,-263698.0],[311256.0,-263736.0],[311256.0,-263737.0],[311257.0,-263756.0],[311257.0,-263759.0],[311258.0,-263778.0],[311258.0,-263779.0],[311260.0,-263824.0],[311260.0,-263827.0],[311261.0,-263849.0],[311261.0,-263850.0],[311262.0,-263875.0],[311262.0,-263878.0],[311263.0,-263904.0],[311263.0,-263905.0],[311264.0,-263933.0],[311264.0,-263937.0],[311265.0,-263966.0],[311265.0,-263969.0],[311266.0,-264001.0],[311266.0,-264005.0],[311267.0,-264043.0],[311267.0,-264047.0],[311268.0,-264089.0],[311268.0,-264096.0],[311269.0,-264151.0],[311269.0,-264164.0],[311270.0,-264268.0],[311270.0,-264310.0],[311470.0,-264310.0],[311470.0,-264268.0],[311471.0,-264164.0],[311471.0,-264151.0],[311472.0,-264096.0],[311472.0,-264089.0],[311473.0,-264047.0],[311473.0,-264043.0],[311474.0,-264005.0],[311474.0,-264001.0],[311475.0,-263969.0],[311475.0,-263966.0],[311476.0,-263937.0],[311476.0,-263933.0],[311477.0,-263905.0],[311477.0,-263904.0],[311478.0,-263878.0],[311478.0,-263875.0],[311479.0,-263850.0],[311479.0,-263849.0],[311480.0,-263827.0],[311480.0,-263824.0],[311482.0,-263779.0],[311482.0,-263778.0],[311483.0,-263759.0],[311483.0,-263756.0],[311484.0,-263737.0],[311484.0,-263736.0],[311486.0,-263698.0],[311486.0,-263697.0],[311487.0,-263679.0],[311487.0,-263678.0],[311490.0,-263624.0],[311493.0,-263576.0],[311493.0,-263575.0],[311494.0,-263560.0],[311494.0,-263559.0],[311496.0,-263528.0],[311497.0,-263515.0],[311498.0,-263499.0],[311499.0,-263486.0],[311500.0,-263470.0],[311501.0,-263458.0],[311501.0,-263457.0],[311505.0,-263404.0],[311505.0,-263403.0],[311509.0,-263353.0],[311512.0,-263318.0],[311512.0,-263317.0],[311517.0,-263261.0],[311518.0,-263248.0],[311519.0,-263239.0],[311521.0,-263217.0],[311521.0,-263216.0],[311532.0,-263104.0],[311541.0,-263020.0],[311548.0,-262958.0],[311550.0,-262942.0],[311552.0,-262924.0],[311558.0,-262874.0],[311560.0,-262859.0],[311561.0,-262850.0],[311562.0,-262843.0],[311563.0,-262834.0],[311567.0,-262804.0],[311567.0,-262803.0],[311582.0,-262691.0],[311583.0,-262685.0],[311585.0,-262670.0],[311592.0,-262621.0],[311604.0,-262540.0],[311616.0,-262463.0],[311631.0,-262371.0],[311633.0,-262360.0],[311640.0,-262318.0],[311641.0,-262313.0],[311647.0,-262278.0],[311660.0,-262205.0],[311679.0,-262104.0],[311680.0,-262098.0],[311685.0,-262073.0],[311686.0,-262067.0],[311708.0,-261957.0],[311725.0,-261875.0],[311746.0,-261778.0],[311749.0,-261765.0],[311752.0,-261751.0],[311775.0,-261650.0],[311777.0,-261642.0],[311782.0,-261620.0],[311796.0,-261561.0],[311800.0,-261545.0],[311805.0,-261524.0],[311836.0,-261400.0],[311857.0,-261319.0],[311864.0,-261293.0],[311866.0,-261285.0],[311868.0,-261278.0],[311870.0,-261270.0],[311875.0,-261252.0],[311877.0,-261244.0],[311907.0,-261135.0],[311910.0,-261125.0],[311922.0,-261082.0],[311925.0,-261072.0],[311937.0,-261030.0],[311938.0,-261027.0],[311942.0,-261013.0],[311969.0,-260922.0],[311998.0,-260827.0],[312028.0,-260732.0],[312047.0,-260673.0],[312080.0,-260573.0],[312094.0,-260532.0],[312101.0,-260511.0],[312108.0,-260491.0],[312112.0,-260479.0],[312141.0,-260396.0],[312152.0,-260365.0],[312183.0,-260279.0],[312204.0,-260222.0],[312242.0,-260121.0],[312246.0,-260111.0],[312259.0,-260077.0],[312260.0,-260075.0],[313114.0,-257865.0],[313116.0,-257859.0],[313120.0,-257849.0],[313141.0,-257794.0],[313145.0,-257783.0],[313147.0,-257778.0],[313190.0,-257662.0],[313211.0,-257604.0],[313239.0,-257525.0],[313251.0,-257490.0],[313256.0,-257476.0],[313261.0,-257461.0],[313268.0,-257441.0],[313316.0,-257297.0],[313336.0,-257235.0],[313364.0,-257146.0],[313367.0,-257136.0],[313369.0,-257130.0],[313400.0,-257028.0],[313412.0,-256987.0],[313416.0,-256974.0],[313445.0,-256873.0],[313466.0,-256798.0],[313496.0,-256687.0],[313524.0,-256579.0],[313541.0,-256511.0],[313580.0,-256348.0],[313596.0,-256278.0],[313597.0,-256273.0],[313598.0,-256269.0],[313605.0,-256237.0],[313608.0,-256224.0],[313625.0,-256145.0],[313630.0,-256121.0],[313631.0,-256117.0],[313634.0,-256102.0],[313636.0,-256093.0],[313644.0,-256054.0],[313658.0,-255984.0],[313667.0,-255938.0],[313675.0,-255896.0],[313698.0,-255770.0],[313700.0,-255758.0],[313704.0,-255736.0],[313707.0,-255718.0],[313708.45454545453,-255710.0],[314215.35869565216,-255710.0],[314209.0,-255749.0],[314207.0,-255760.0],[314200.0,-255802.0],[314199.0,-255807.0],[314196.0,-255825.0],[314180.0,-255915.0],[314174.0,-255947.0],[314173.0,-255953.0],[314161.0,-256016.0],[314160.0,-256022.0],[314155.0,-256047.0],[314154.0,-256053.0],[314132.0,-256163.0],[314115.0,-256245.0],[314096.0,-256333.0],[314091.0,-256355.0],[314088.0,-256369.0],[314073.0,-256435.0],[314058.0,-256500.0],[314051.0,-256529.0],[314044.0,-256559.0],[314040.0,-256575.0],[314035.0,-256596.0],[314004.0,-256720.0],[313983.0,-256801.0],[313976.0,-256827.0],[313974.0,-256835.0],[313972.0,-256842.0],[313970.0,-256850.0],[313965.0,-256868.0],[313963.0,-256876.0],[313933.0,-256985.0],[313930.0,-256995.0],[313918.0,-257038.0],[313915.0,-257048.0],[313903.0,-257090.0],[313902.0,-257093.0],[313898.0,-257107.0],[313897.0,-257110.0],[313868.0,-257208.0],[313842.0,-257293.0],[313812.0,-257388.0],[313793.0,-257447.0],[313760.0,-257547.0],[313746.0,-257588.0],[313739.0,-257609.0],[313732.0,-257629.0],[313728.0,-257641.0],[313688.0,-257755.0],[313665.0,-257819.0],[313636.0,-257898.0],[313598.0,-257999.0],[313594.0,-258009.0],[313581.0,-258043.0],[313580.0,-258045.0],[312726.0,-260255.0],[312724.0,-260261.0],[312720.0,-260271.0],[312699.0,-260326.0],[312695.0,-260337.0],[312693.0,-260342.0],[312665.0,-260417.0],[312638.0,-260491.0],[312601.0,-260595.0],[312589.0,-260630.0],[312584.0,-260644.0],[312579.0,-260659.0],[312572.0,-260679.0],[312524.0,-260823.0],[312504.0,-260885.0],[312480.0,-260961.0],[312473.0,-260984.0],[312471.0,-260990.0],[312446.0,-261072.0],[312428.0,-261133.0],[312424.0,-261146.0],[312411.0,-261191.0],[312384.0,-261286.0],[312368.0,-261344.0],[312344.0,-261433.0],[312326.0,-261502.0],[312316.0,-261541.0],[312299.0,-261609.0],[312261.0,-261768.0],[312244.0,-261842.0],[312243.0,-261847.0],[312242.0,-261851.0],[312235.0,-261883.0],[312234.0,-261887.0],[312210.0,-261999.0],[312209.0,-262003.0],[312206.0,-262018.0],[312204.0,-262027.0],[312196.0,-262066.0],[312182.0,-262136.0],[312173.0,-262182.0],[312166.0,-262219.0],[312142.0,-262350.0],[312140.0,-262362.0],[312136.0,-262384.0],[312133.0,-262402.0],[312131.0,-262413.0],[312116.0,-262503.0],[312115.0,-262510.0],[312112.0,-262528.0],[312111.0,-262535.0],[312108.0,-262553.0],[312094.0,-262644.0],[312076.0,-262769.0],[312070.0,-262813.0],[312068.0,-262829.0],[312066.0,-262843.0],[312056.0,-262922.0],[312055.0,-262929.0],[312048.0,-262987.0],[312035.0,-263102.0],[312027.0,-263178.0],[312015.0,-263304.0],[312013.0,-263328.0],[312010.0,-263361.0],[312008.0,-263385.0],[312008.0,-263387.0],[312004.0,-263435.0],[312000.0,-263488.0],[312000.0,-263490.0],[311999.0,-263502.0],[311992.0,-263606.0],[311992.0,-263608.0],[311990.0,-263639.0],[311990.0,-263640.0],[311986.0,-263710.0],[311986.0,-263712.0],[311983.0,-263768.0],[311983.0,-263770.0],[311982.0,-263789.0],[311982.0,-263792.0],[311981.0,-263811.0],[311981.0,-263814.0],[311980.0,-263835.0],[311980.0,-263838.0],[311979.0,-263860.0],[311979.0,-263862.0],[311978.0,-263884.0],[311978.0,-263886.0],[311977.0,-263911.0],[311977.0,-263913.0],[311976.0,-263940.0],[311976.0,-263945.0],[311975.0,-263974.0],[311975.0,-263976.0],[311974.0,-264008.0],[311974.0,-264013.0],[311973.0,-264047.0],[311973.0,-264054.0],[311972.0,-264093.0],[311972.0,-264103.0],[311971.0,-264154.0],[311971.0,-264166.0],[311970.0,-264266.0],[311970.0,-264310.0],[311970.0,-264311.0],[311969.0,-264321.0],[311969.0,-264322.0],[311968.0,-264333.0],[311968.0,-264334.0],[311967.0,-264345.0],[311967.0,-264347.0],[311966.0,-264359.0],[311966.0,-264361.0],[311965.0,-264377.0],[311965.0,-264433.0],[311966.0,-264445.0],[311966.0,-264446.0],[311967.0,-264455.0],[311967.0,-264456.0],[311968.0,-264464.0],[311969.0,-264470.0],[311969.0,-264471.0],[311970.0,-264477.0],[311973.0,-264492.0],[311979.0,-264516.0],[311987.0,-264542.0],[311995.0,-264565.0],[311997.0,-264570.0],[311998.0,-264573.0],[312000.0,-264578.0],[312001.0,-264581.0],[312003.0,-264586.0],[312004.0,-264589.0],[312008.0,-264599.0],[312009.0,-264602.0],[312015.0,-264617.0],[312016.0,-264620.0],[312020.0,-264630.0],[312021.0,-264633.0],[312023.0,-264638.0],[312033.0,-264665.0],[312035.0,-264671.0],[312039.0,-264682.0],[312044.0,-264697.0],[312047.0,-264707.0],[312049.0,-264713.0],[312050.0,-264717.0],[312051.0,-264720.0],[312054.0,-264731.0],[312055.0,-264734.0],[312060.0,-264754.0],[312062.0,-264763.0],[312066.0,-264783.0],[312068.0,-264795.0],[312069.0,-264802.0],[312071.0,-264819.0],[312071.0,-264820.0],[312072.0,-264830.0],[312072.0,-264832.0],[312073.0,-264848.0],[312073.0,-264907.0],[312072.0,-264929.0],[312072.0,-264933.0],[312071.0,-264952.0],[312071.0,-264955.0],[312070.0,-264975.0],[312070.0,-264979.0],[312069.0,-265005.0],[312069.0,-265114.0],[312070.0,-265141.0],[312070.0,-265145.0],[312071.0,-265166.0],[312071.0,-265170.0],[312072.0,-265190.0],[312072.0,-265194.0],[312073.0,-265220.0],[312073.0,-265267.0],[312072.0,-265285.0],[312072.0,-265288.0],[312071.0,-265299.0],[312071.0,-265301.0],[312069.0,-265318.0],[312069.0,-265319.0],[312068.0,-265325.0],[312068.0,-265326.0],[312066.0,-265338.0],[312064.0,-265348.0],[312062.0,-265357.0],[312058.0,-265372.0],[312053.0,-265387.0],[312048.0,-265400.0],[312047.0,-265402.0],[312044.0,-265409.0],[312036.0,-265425.0],[312032.0,-265432.0],[312024.0,-265445.0],[312017.0,-265455.0],[312008.0,-265467.0],[312004.0,-265472.0],[312003.0,-265473.0],[311998.0,-265479.0],[311989.0,-265489.0],[311964.0,-265514.0],[311953.0,-265524.0],[311951.0,-265526.0],[311935.0,-265540.0],[311933.0,-265542.0],[311927.0,-265547.0],[311918.0,-265555.0],[311912.0,-265560.0],[311911.0,-265561.0],[311905.0,-265566.0],[311904.0,-265567.0],[311898.0,-265572.0],[311897.0,-265573.0],[311891.0,-265578.0],[311890.0,-265579.0],[311884.0,-265584.0],[311883.0,-265585.0],[311877.0,-265590.0],[311860.0,-265605.0],[311858.0,-265607.0],[311849.0,-265615.0],[311810.0,-265654.0],[311803.0,-265662.0],[311799.0,-265667.0],[311798.0,-265668.0],[311790.0,-265678.0],[311781.0,-265690.0],[311774.0,-265700.0],[311770.0,-265706.0],[311767.0,-265711.0],[311765.0,-265714.0],[311759.0,-265724.0],[311755.0,-265731.0],[311748.0,-265744.0],[311744.0,-265752.0],[311739.0,-265763.0],[311737.0,-265767.0],[311732.0,-265779.0],[311731.0,-265781.0],[311727.0,-265791.0],[311726.0,-265794.0],[311724.0,-265799.0],[311723.0,-265802.0],[311721.0,-265807.0],[311708.0,-265846.0],[311702.0,-265866.0],[311694.0,-265894.0],[311693.0,-265898.0],[311692.0,-265901.0],[311691.0,-265905.0],[311687.0,-265919.0],[311686.0,-265923.0],[311685.0,-265926.0],[311684.0,-265930.0],[311683.0,-265933.0],[311682.0,-265937.0],[311681.0,-265940.0],[311680.0,-265944.0],[311674.0,-265964.0],[311669.0,-265980.0],[311660.0,-266007.0],[311655.0,-266021.0],[311636.0,-266078.0],[311633.0,-266088.0],[311628.0,-266106.0],[311625.0,-266118.0],[311624.0,-266123.0],[311623.0,-266127.0],[311620.0,-266143.0],[311617.0,-266165.0],[311617.0,-266166.0],[311616.0,-266176.0],[311616.0,-266178.0],[311615.0,-266193.0],[311615.0,-266236.0],[311616.0,-266255.0],[311616.0,-266257.0],[311617.0,-266271.0],[311617.0,-266273.0],[311618.0,-266285.0],[311618.0,-266286.0],[311619.0,-266297.0],[311619.0,-266299.0],[311620.0,-266309.0],[311620.0,-266310.0],[311620.0,-267638.0],[311120.0,-267638.0],[311120.0,-266310.0],[311120.0,-266309.0]],[]],[[[335629.0,-320820.0],[335129.0,-320820.0],[335129.0,-255710.0],[335629.0,-255710.0],[335629.0,-320820.0]],[]]]}, - {"id":29,"start":[376160,-267710,270],"target":[376470,-308570,180],"bounds":[363910.0,-320820.0,405971.0,-255710.0],"width":500,"keepouts":[[[[363910.0,-312719.97468063066],[363910.0,-304420.02531936934],[376398.0,-308297.6434572448],[376398.0,-308842.3565427552],[363910.0,-312719.97468063066]],[]],[[[375910.0,-266309.0],[375911.0,-266299.0],[375911.0,-266297.0],[375912.0,-266286.0],[375912.0,-266285.0],[375913.0,-266273.0],[375913.0,-266271.0],[375914.0,-266257.0],[375914.0,-266255.0],[375915.0,-266236.0],[375915.0,-266193.0],[375914.0,-266178.0],[375914.0,-266176.0],[375913.0,-266166.0],[375913.0,-266165.0],[375910.0,-266143.0],[375907.0,-266127.0],[375906.0,-266123.0],[375905.0,-266118.0],[375902.0,-266106.0],[375897.0,-266088.0],[375894.0,-266078.0],[375875.0,-266021.0],[375870.0,-266007.0],[375861.0,-265980.0],[375856.0,-265964.0],[375850.0,-265944.0],[375849.0,-265940.0],[375848.0,-265937.0],[375847.0,-265933.0],[375846.0,-265930.0],[375845.0,-265926.0],[375844.0,-265923.0],[375843.0,-265919.0],[375839.0,-265905.0],[375838.0,-265901.0],[375837.0,-265898.0],[375836.0,-265894.0],[375828.0,-265866.0],[375822.0,-265846.0],[375809.0,-265807.0],[375807.0,-265802.0],[375806.0,-265799.0],[375804.0,-265794.0],[375803.0,-265791.0],[375799.0,-265781.0],[375798.0,-265779.0],[375793.0,-265767.0],[375791.0,-265763.0],[375786.0,-265752.0],[375782.0,-265744.0],[375775.0,-265731.0],[375771.0,-265724.0],[375765.0,-265714.0],[375763.0,-265711.0],[375760.0,-265706.0],[375756.0,-265700.0],[375749.0,-265690.0],[375740.0,-265678.0],[375732.0,-265668.0],[375731.0,-265667.0],[375727.0,-265662.0],[375720.0,-265654.0],[375681.0,-265615.0],[375672.0,-265607.0],[375670.0,-265605.0],[375653.0,-265590.0],[375647.0,-265585.0],[375646.0,-265584.0],[375640.0,-265579.0],[375639.0,-265578.0],[375633.0,-265573.0],[375632.0,-265572.0],[375626.0,-265567.0],[375625.0,-265566.0],[375619.0,-265561.0],[375618.0,-265560.0],[375612.0,-265555.0],[375603.0,-265547.0],[375597.0,-265542.0],[375595.0,-265540.0],[375579.0,-265526.0],[375577.0,-265524.0],[375566.0,-265514.0],[375541.0,-265489.0],[375532.0,-265479.0],[375527.0,-265473.0],[375526.0,-265472.0],[375522.0,-265467.0],[375513.0,-265455.0],[375506.0,-265445.0],[375498.0,-265432.0],[375494.0,-265425.0],[375486.0,-265409.0],[375483.0,-265402.0],[375482.0,-265400.0],[375477.0,-265387.0],[375472.0,-265372.0],[375468.0,-265357.0],[375466.0,-265348.0],[375464.0,-265338.0],[375462.0,-265326.0],[375462.0,-265325.0],[375461.0,-265319.0],[375461.0,-265318.0],[375459.0,-265301.0],[375459.0,-265299.0],[375458.0,-265288.0],[375458.0,-265285.0],[375457.0,-265267.0],[375457.0,-265220.0],[375458.0,-265194.0],[375458.0,-265190.0],[375459.0,-265170.0],[375459.0,-265166.0],[375460.0,-265145.0],[375460.0,-265141.0],[375461.0,-265114.0],[375461.0,-265005.0],[375460.0,-264979.0],[375460.0,-264975.0],[375459.0,-264955.0],[375459.0,-264952.0],[375458.0,-264933.0],[375458.0,-264929.0],[375457.0,-264907.0],[375457.0,-264848.0],[375458.0,-264832.0],[375458.0,-264830.0],[375459.0,-264820.0],[375459.0,-264819.0],[375461.0,-264802.0],[375462.0,-264795.0],[375464.0,-264783.0],[375468.0,-264763.0],[375470.0,-264754.0],[375475.0,-264734.0],[375476.0,-264731.0],[375479.0,-264720.0],[375480.0,-264717.0],[375481.0,-264713.0],[375483.0,-264707.0],[375486.0,-264697.0],[375491.0,-264682.0],[375495.0,-264671.0],[375497.0,-264665.0],[375507.0,-264638.0],[375509.0,-264633.0],[375510.0,-264630.0],[375514.0,-264620.0],[375515.0,-264617.0],[375521.0,-264602.0],[375522.0,-264599.0],[375526.0,-264589.0],[375527.0,-264586.0],[375529.0,-264581.0],[375530.0,-264578.0],[375532.0,-264573.0],[375533.0,-264570.0],[375535.0,-264565.0],[375543.0,-264542.0],[375551.0,-264516.0],[375557.0,-264492.0],[375560.0,-264477.0],[375561.0,-264471.0],[375561.0,-264470.0],[375562.0,-264464.0],[375563.0,-264456.0],[375563.0,-264455.0],[375564.0,-264446.0],[375564.0,-264445.0],[375565.0,-264433.0],[375565.0,-264377.0],[375564.0,-264361.0],[375564.0,-264359.0],[375563.0,-264347.0],[375563.0,-264345.0],[375562.0,-264334.0],[375562.0,-264333.0],[375561.0,-264322.0],[375561.0,-264321.0],[375560.0,-264311.0],[375560.0,-264310.0],[375560.0,-264266.0],[375559.0,-264166.0],[375559.0,-264154.0],[375558.0,-264103.0],[375558.0,-264093.0],[375557.0,-264054.0],[375557.0,-264047.0],[375556.0,-264013.0],[375556.0,-264008.0],[375555.0,-263976.0],[375555.0,-263974.0],[375554.0,-263945.0],[375554.0,-263940.0],[375553.0,-263913.0],[375553.0,-263911.0],[375552.0,-263886.0],[375552.0,-263884.0],[375551.0,-263862.0],[375551.0,-263860.0],[375550.0,-263838.0],[375550.0,-263835.0],[375549.0,-263814.0],[375549.0,-263811.0],[375548.0,-263792.0],[375548.0,-263789.0],[375547.0,-263770.0],[375547.0,-263768.0],[375544.0,-263712.0],[375544.0,-263710.0],[375540.0,-263640.0],[375540.0,-263639.0],[375538.0,-263608.0],[375538.0,-263606.0],[375531.0,-263502.0],[375530.0,-263490.0],[375530.0,-263488.0],[375526.0,-263435.0],[375522.0,-263387.0],[375522.0,-263385.0],[375520.0,-263361.0],[375517.0,-263328.0],[375515.0,-263304.0],[375503.0,-263178.0],[375495.0,-263102.0],[375482.0,-262987.0],[375475.0,-262929.0],[375474.0,-262922.0],[375464.0,-262843.0],[375462.0,-262829.0],[375460.0,-262813.0],[375454.0,-262769.0],[375436.0,-262644.0],[375422.0,-262553.0],[375419.0,-262535.0],[375418.0,-262528.0],[375415.0,-262510.0],[375414.0,-262503.0],[375399.0,-262413.0],[375397.0,-262402.0],[375394.0,-262384.0],[375390.0,-262362.0],[375388.0,-262350.0],[375364.0,-262219.0],[375357.0,-262182.0],[375348.0,-262136.0],[375334.0,-262066.0],[375326.0,-262027.0],[375324.0,-262018.0],[375321.0,-262003.0],[375320.0,-261999.0],[375296.0,-261887.0],[375295.0,-261883.0],[375288.0,-261851.0],[375287.0,-261847.0],[375286.0,-261842.0],[375269.0,-261768.0],[375231.0,-261609.0],[375214.0,-261541.0],[375204.0,-261502.0],[375186.0,-261433.0],[375162.0,-261344.0],[375146.0,-261286.0],[375119.0,-261191.0],[375106.0,-261146.0],[375102.0,-261133.0],[375084.0,-261072.0],[375059.0,-260990.0],[375057.0,-260984.0],[375050.0,-260961.0],[375026.0,-260885.0],[375006.0,-260823.0],[374958.0,-260679.0],[374951.0,-260659.0],[374946.0,-260644.0],[374941.0,-260630.0],[374929.0,-260595.0],[374892.0,-260491.0],[374865.0,-260417.0],[374837.0,-260342.0],[374835.0,-260337.0],[374831.0,-260326.0],[374810.0,-260271.0],[374806.0,-260261.0],[374804.0,-260255.0],[373950.0,-258045.0],[373949.0,-258043.0],[373936.0,-258009.0],[373932.0,-257999.0],[373894.0,-257898.0],[373865.0,-257819.0],[373842.0,-257755.0],[373802.0,-257641.0],[373798.0,-257629.0],[373791.0,-257609.0],[373784.0,-257588.0],[373770.0,-257547.0],[373737.0,-257447.0],[373718.0,-257388.0],[373688.0,-257293.0],[373662.0,-257208.0],[373633.0,-257110.0],[373632.0,-257107.0],[373628.0,-257093.0],[373627.0,-257090.0],[373615.0,-257048.0],[373612.0,-257038.0],[373600.0,-256995.0],[373597.0,-256985.0],[373567.0,-256876.0],[373565.0,-256868.0],[373560.0,-256850.0],[373558.0,-256842.0],[373556.0,-256835.0],[373554.0,-256827.0],[373547.0,-256801.0],[373526.0,-256720.0],[373495.0,-256596.0],[373490.0,-256575.0],[373486.0,-256559.0],[373479.0,-256529.0],[373472.0,-256500.0],[373457.0,-256435.0],[373442.0,-256369.0],[373439.0,-256355.0],[373434.0,-256333.0],[373415.0,-256245.0],[373398.0,-256163.0],[373376.0,-256053.0],[373375.0,-256047.0],[373370.0,-256022.0],[373369.0,-256016.0],[373357.0,-255953.0],[373356.0,-255947.0],[373350.0,-255915.0],[373334.0,-255825.0],[373331.0,-255807.0],[373330.0,-255802.0],[373323.0,-255760.0],[373321.0,-255749.0],[373314.64130434784,-255710.0],[373821.54545454547,-255710.0],[373823.0,-255718.0],[373826.0,-255736.0],[373830.0,-255758.0],[373832.0,-255770.0],[373855.0,-255896.0],[373863.0,-255938.0],[373872.0,-255984.0],[373886.0,-256054.0],[373894.0,-256093.0],[373896.0,-256102.0],[373899.0,-256117.0],[373900.0,-256121.0],[373905.0,-256145.0],[373922.0,-256224.0],[373925.0,-256237.0],[373932.0,-256269.0],[373933.0,-256273.0],[373934.0,-256278.0],[373950.0,-256348.0],[373989.0,-256511.0],[374006.0,-256579.0],[374034.0,-256687.0],[374064.0,-256798.0],[374085.0,-256873.0],[374114.0,-256974.0],[374118.0,-256987.0],[374130.0,-257028.0],[374161.0,-257130.0],[374163.0,-257136.0],[374166.0,-257146.0],[374194.0,-257235.0],[374214.0,-257297.0],[374262.0,-257441.0],[374269.0,-257461.0],[374274.0,-257476.0],[374279.0,-257490.0],[374291.0,-257525.0],[374319.0,-257604.0],[374340.0,-257662.0],[374383.0,-257778.0],[374385.0,-257783.0],[374389.0,-257794.0],[374410.0,-257849.0],[374414.0,-257859.0],[374416.0,-257865.0],[375270.0,-260075.0],[375271.0,-260077.0],[375284.0,-260111.0],[375288.0,-260121.0],[375326.0,-260222.0],[375347.0,-260279.0],[375378.0,-260365.0],[375389.0,-260396.0],[375418.0,-260479.0],[375422.0,-260491.0],[375429.0,-260511.0],[375436.0,-260532.0],[375450.0,-260573.0],[375483.0,-260673.0],[375502.0,-260732.0],[375532.0,-260827.0],[375561.0,-260922.0],[375588.0,-261013.0],[375592.0,-261027.0],[375593.0,-261030.0],[375605.0,-261072.0],[375608.0,-261082.0],[375620.0,-261125.0],[375623.0,-261135.0],[375653.0,-261244.0],[375655.0,-261252.0],[375660.0,-261270.0],[375662.0,-261278.0],[375664.0,-261285.0],[375666.0,-261293.0],[375673.0,-261319.0],[375694.0,-261400.0],[375725.0,-261524.0],[375730.0,-261545.0],[375734.0,-261561.0],[375748.0,-261620.0],[375753.0,-261642.0],[375755.0,-261650.0],[375778.0,-261751.0],[375781.0,-261765.0],[375784.0,-261778.0],[375805.0,-261875.0],[375822.0,-261957.0],[375844.0,-262067.0],[375845.0,-262073.0],[375850.0,-262098.0],[375851.0,-262104.0],[375870.0,-262205.0],[375883.0,-262278.0],[375889.0,-262313.0],[375890.0,-262318.0],[375897.0,-262360.0],[375899.0,-262371.0],[375914.0,-262463.0],[375926.0,-262540.0],[375938.0,-262621.0],[375945.0,-262670.0],[375947.0,-262685.0],[375948.0,-262691.0],[375963.0,-262803.0],[375963.0,-262804.0],[375967.0,-262834.0],[375968.0,-262843.0],[375969.0,-262850.0],[375970.0,-262859.0],[375972.0,-262874.0],[375978.0,-262924.0],[375980.0,-262942.0],[375982.0,-262958.0],[375989.0,-263020.0],[375998.0,-263104.0],[376009.0,-263216.0],[376009.0,-263217.0],[376011.0,-263239.0],[376012.0,-263248.0],[376013.0,-263261.0],[376018.0,-263317.0],[376018.0,-263318.0],[376021.0,-263353.0],[376025.0,-263403.0],[376025.0,-263404.0],[376029.0,-263457.0],[376029.0,-263458.0],[376030.0,-263470.0],[376031.0,-263486.0],[376032.0,-263499.0],[376033.0,-263515.0],[376034.0,-263528.0],[376036.0,-263559.0],[376036.0,-263560.0],[376037.0,-263575.0],[376037.0,-263576.0],[376040.0,-263624.0],[376043.0,-263678.0],[376043.0,-263679.0],[376044.0,-263697.0],[376044.0,-263698.0],[376046.0,-263736.0],[376046.0,-263737.0],[376047.0,-263756.0],[376047.0,-263759.0],[376048.0,-263778.0],[376048.0,-263779.0],[376050.0,-263824.0],[376050.0,-263827.0],[376051.0,-263849.0],[376051.0,-263850.0],[376052.0,-263875.0],[376052.0,-263878.0],[376053.0,-263904.0],[376053.0,-263905.0],[376054.0,-263933.0],[376054.0,-263937.0],[376055.0,-263966.0],[376055.0,-263969.0],[376056.0,-264001.0],[376056.0,-264005.0],[376057.0,-264043.0],[376057.0,-264047.0],[376058.0,-264089.0],[376058.0,-264096.0],[376059.0,-264151.0],[376059.0,-264164.0],[376060.0,-264268.0],[376060.0,-264310.0],[376260.0,-264310.0],[376260.0,-264268.0],[376261.0,-264164.0],[376261.0,-264151.0],[376262.0,-264096.0],[376262.0,-264089.0],[376263.0,-264047.0],[376263.0,-264043.0],[376264.0,-264005.0],[376264.0,-264001.0],[376265.0,-263969.0],[376265.0,-263966.0],[376266.0,-263937.0],[376266.0,-263933.0],[376267.0,-263905.0],[376267.0,-263904.0],[376268.0,-263878.0],[376268.0,-263875.0],[376269.0,-263850.0],[376269.0,-263849.0],[376270.0,-263827.0],[376270.0,-263824.0],[376272.0,-263779.0],[376272.0,-263778.0],[376273.0,-263759.0],[376273.0,-263756.0],[376274.0,-263737.0],[376274.0,-263736.0],[376276.0,-263698.0],[376276.0,-263697.0],[376277.0,-263679.0],[376277.0,-263678.0],[376280.0,-263624.0],[376283.0,-263576.0],[376283.0,-263575.0],[376284.0,-263560.0],[376284.0,-263559.0],[376286.0,-263528.0],[376287.0,-263515.0],[376288.0,-263499.0],[376289.0,-263486.0],[376290.0,-263470.0],[376291.0,-263458.0],[376291.0,-263457.0],[376295.0,-263404.0],[376295.0,-263403.0],[376299.0,-263353.0],[376302.0,-263318.0],[376302.0,-263317.0],[376307.0,-263261.0],[376308.0,-263248.0],[376309.0,-263239.0],[376311.0,-263217.0],[376311.0,-263216.0],[376322.0,-263104.0],[376331.0,-263020.0],[376338.0,-262958.0],[376340.0,-262942.0],[376342.0,-262924.0],[376348.0,-262874.0],[376350.0,-262859.0],[376351.0,-262850.0],[376352.0,-262843.0],[376353.0,-262834.0],[376357.0,-262804.0],[376357.0,-262803.0],[376372.0,-262691.0],[376373.0,-262685.0],[376375.0,-262670.0],[376382.0,-262621.0],[376394.0,-262540.0],[376406.0,-262463.0],[376421.0,-262371.0],[376423.0,-262360.0],[376430.0,-262318.0],[376431.0,-262313.0],[376437.0,-262278.0],[376450.0,-262205.0],[376469.0,-262104.0],[376470.0,-262098.0],[376475.0,-262073.0],[376476.0,-262067.0],[376498.0,-261957.0],[376515.0,-261875.0],[376536.0,-261778.0],[376539.0,-261765.0],[376542.0,-261751.0],[376565.0,-261650.0],[376567.0,-261642.0],[376572.0,-261620.0],[376586.0,-261561.0],[376590.0,-261545.0],[376595.0,-261524.0],[376626.0,-261400.0],[376647.0,-261319.0],[376654.0,-261293.0],[376656.0,-261285.0],[376658.0,-261278.0],[376660.0,-261270.0],[376665.0,-261252.0],[376667.0,-261244.0],[376697.0,-261135.0],[376700.0,-261125.0],[376712.0,-261082.0],[376715.0,-261072.0],[376727.0,-261030.0],[376728.0,-261027.0],[376732.0,-261013.0],[376759.0,-260922.0],[376788.0,-260827.0],[376818.0,-260732.0],[376837.0,-260673.0],[376870.0,-260573.0],[376884.0,-260532.0],[376891.0,-260511.0],[376898.0,-260491.0],[376902.0,-260479.0],[376931.0,-260396.0],[376942.0,-260365.0],[376973.0,-260279.0],[376994.0,-260222.0],[377032.0,-260121.0],[377036.0,-260111.0],[377049.0,-260077.0],[377050.0,-260075.0],[377904.0,-257865.0],[377906.0,-257859.0],[377910.0,-257849.0],[377931.0,-257794.0],[377935.0,-257783.0],[377937.0,-257778.0],[377980.0,-257662.0],[378001.0,-257604.0],[378029.0,-257525.0],[378041.0,-257490.0],[378046.0,-257476.0],[378051.0,-257461.0],[378058.0,-257441.0],[378106.0,-257297.0],[378126.0,-257235.0],[378154.0,-257146.0],[378157.0,-257136.0],[378159.0,-257130.0],[378190.0,-257028.0],[378202.0,-256987.0],[378206.0,-256974.0],[378235.0,-256873.0],[378256.0,-256798.0],[378286.0,-256687.0],[378314.0,-256579.0],[378331.0,-256511.0],[378370.0,-256348.0],[378386.0,-256278.0],[378387.0,-256273.0],[378388.0,-256269.0],[378395.0,-256237.0],[378398.0,-256224.0],[378415.0,-256145.0],[378420.0,-256121.0],[378421.0,-256117.0],[378424.0,-256102.0],[378426.0,-256093.0],[378434.0,-256054.0],[378448.0,-255984.0],[378457.0,-255938.0],[378465.0,-255896.0],[378488.0,-255770.0],[378490.0,-255758.0],[378494.0,-255736.0],[378497.0,-255718.0],[378498.45454545453,-255710.0],[379005.35869565216,-255710.0],[378999.0,-255749.0],[378997.0,-255760.0],[378990.0,-255802.0],[378989.0,-255807.0],[378986.0,-255825.0],[378970.0,-255915.0],[378964.0,-255947.0],[378963.0,-255953.0],[378951.0,-256016.0],[378950.0,-256022.0],[378945.0,-256047.0],[378944.0,-256053.0],[378922.0,-256163.0],[378905.0,-256245.0],[378886.0,-256333.0],[378881.0,-256355.0],[378878.0,-256369.0],[378863.0,-256435.0],[378848.0,-256500.0],[378841.0,-256529.0],[378834.0,-256559.0],[378830.0,-256575.0],[378825.0,-256596.0],[378794.0,-256720.0],[378773.0,-256801.0],[378766.0,-256827.0],[378764.0,-256835.0],[378762.0,-256842.0],[378760.0,-256850.0],[378755.0,-256868.0],[378753.0,-256876.0],[378723.0,-256985.0],[378720.0,-256995.0],[378708.0,-257038.0],[378705.0,-257048.0],[378693.0,-257090.0],[378692.0,-257093.0],[378688.0,-257107.0],[378687.0,-257110.0],[378658.0,-257208.0],[378632.0,-257293.0],[378602.0,-257388.0],[378583.0,-257447.0],[378550.0,-257547.0],[378536.0,-257588.0],[378529.0,-257609.0],[378522.0,-257629.0],[378518.0,-257641.0],[378478.0,-257755.0],[378455.0,-257819.0],[378426.0,-257898.0],[378388.0,-257999.0],[378384.0,-258009.0],[378371.0,-258043.0],[378370.0,-258045.0],[377516.0,-260255.0],[377514.0,-260261.0],[377510.0,-260271.0],[377489.0,-260326.0],[377485.0,-260337.0],[377483.0,-260342.0],[377455.0,-260417.0],[377428.0,-260491.0],[377391.0,-260595.0],[377379.0,-260630.0],[377374.0,-260644.0],[377369.0,-260659.0],[377362.0,-260679.0],[377314.0,-260823.0],[377294.0,-260885.0],[377270.0,-260961.0],[377263.0,-260984.0],[377261.0,-260990.0],[377236.0,-261072.0],[377218.0,-261133.0],[377214.0,-261146.0],[377201.0,-261191.0],[377174.0,-261286.0],[377158.0,-261344.0],[377134.0,-261433.0],[377116.0,-261502.0],[377106.0,-261541.0],[377089.0,-261609.0],[377051.0,-261768.0],[377034.0,-261842.0],[377033.0,-261847.0],[377032.0,-261851.0],[377025.0,-261883.0],[377024.0,-261887.0],[377000.0,-261999.0],[376999.0,-262003.0],[376996.0,-262018.0],[376994.0,-262027.0],[376986.0,-262066.0],[376972.0,-262136.0],[376963.0,-262182.0],[376956.0,-262219.0],[376932.0,-262350.0],[376930.0,-262362.0],[376926.0,-262384.0],[376923.0,-262402.0],[376921.0,-262413.0],[376906.0,-262503.0],[376905.0,-262510.0],[376902.0,-262528.0],[376901.0,-262535.0],[376898.0,-262553.0],[376884.0,-262644.0],[376866.0,-262769.0],[376860.0,-262813.0],[376858.0,-262829.0],[376856.0,-262843.0],[376846.0,-262922.0],[376845.0,-262929.0],[376838.0,-262987.0],[376825.0,-263102.0],[376817.0,-263178.0],[376805.0,-263304.0],[376803.0,-263328.0],[376800.0,-263361.0],[376798.0,-263385.0],[376798.0,-263387.0],[376794.0,-263435.0],[376790.0,-263488.0],[376790.0,-263490.0],[376789.0,-263502.0],[376782.0,-263606.0],[376782.0,-263608.0],[376780.0,-263639.0],[376780.0,-263640.0],[376776.0,-263710.0],[376776.0,-263712.0],[376773.0,-263768.0],[376773.0,-263770.0],[376772.0,-263789.0],[376772.0,-263792.0],[376771.0,-263811.0],[376771.0,-263814.0],[376770.0,-263835.0],[376770.0,-263838.0],[376769.0,-263860.0],[376769.0,-263862.0],[376768.0,-263884.0],[376768.0,-263886.0],[376767.0,-263911.0],[376767.0,-263913.0],[376766.0,-263940.0],[376766.0,-263945.0],[376765.0,-263974.0],[376765.0,-263976.0],[376764.0,-264008.0],[376764.0,-264013.0],[376763.0,-264047.0],[376763.0,-264054.0],[376762.0,-264093.0],[376762.0,-264103.0],[376761.0,-264154.0],[376761.0,-264166.0],[376760.0,-264266.0],[376760.0,-264310.0],[376760.0,-264311.0],[376759.0,-264321.0],[376759.0,-264322.0],[376758.0,-264333.0],[376758.0,-264334.0],[376757.0,-264345.0],[376757.0,-264347.0],[376756.0,-264359.0],[376756.0,-264361.0],[376755.0,-264377.0],[376755.0,-264433.0],[376756.0,-264445.0],[376756.0,-264446.0],[376757.0,-264455.0],[376757.0,-264456.0],[376758.0,-264464.0],[376759.0,-264470.0],[376759.0,-264471.0],[376760.0,-264477.0],[376763.0,-264492.0],[376769.0,-264516.0],[376777.0,-264542.0],[376785.0,-264565.0],[376787.0,-264570.0],[376788.0,-264573.0],[376790.0,-264578.0],[376791.0,-264581.0],[376793.0,-264586.0],[376794.0,-264589.0],[376798.0,-264599.0],[376799.0,-264602.0],[376805.0,-264617.0],[376806.0,-264620.0],[376810.0,-264630.0],[376811.0,-264633.0],[376813.0,-264638.0],[376823.0,-264665.0],[376825.0,-264671.0],[376829.0,-264682.0],[376834.0,-264697.0],[376837.0,-264707.0],[376839.0,-264713.0],[376840.0,-264717.0],[376841.0,-264720.0],[376844.0,-264731.0],[376845.0,-264734.0],[376850.0,-264754.0],[376852.0,-264763.0],[376856.0,-264783.0],[376858.0,-264795.0],[376859.0,-264802.0],[376861.0,-264819.0],[376861.0,-264820.0],[376862.0,-264830.0],[376862.0,-264832.0],[376863.0,-264848.0],[376863.0,-264907.0],[376862.0,-264929.0],[376862.0,-264933.0],[376861.0,-264952.0],[376861.0,-264955.0],[376860.0,-264975.0],[376860.0,-264979.0],[376859.0,-265005.0],[376859.0,-265114.0],[376860.0,-265141.0],[376860.0,-265145.0],[376861.0,-265166.0],[376861.0,-265170.0],[376862.0,-265190.0],[376862.0,-265194.0],[376863.0,-265220.0],[376863.0,-265267.0],[376862.0,-265285.0],[376862.0,-265288.0],[376861.0,-265299.0],[376861.0,-265301.0],[376859.0,-265318.0],[376859.0,-265319.0],[376858.0,-265325.0],[376858.0,-265326.0],[376856.0,-265338.0],[376854.0,-265348.0],[376852.0,-265357.0],[376848.0,-265372.0],[376843.0,-265387.0],[376838.0,-265400.0],[376837.0,-265402.0],[376834.0,-265409.0],[376826.0,-265425.0],[376822.0,-265432.0],[376814.0,-265445.0],[376807.0,-265455.0],[376798.0,-265467.0],[376794.0,-265472.0],[376793.0,-265473.0],[376788.0,-265479.0],[376779.0,-265489.0],[376754.0,-265514.0],[376743.0,-265524.0],[376741.0,-265526.0],[376725.0,-265540.0],[376723.0,-265542.0],[376717.0,-265547.0],[376708.0,-265555.0],[376702.0,-265560.0],[376701.0,-265561.0],[376695.0,-265566.0],[376694.0,-265567.0],[376688.0,-265572.0],[376687.0,-265573.0],[376681.0,-265578.0],[376680.0,-265579.0],[376674.0,-265584.0],[376673.0,-265585.0],[376667.0,-265590.0],[376650.0,-265605.0],[376648.0,-265607.0],[376639.0,-265615.0],[376600.0,-265654.0],[376593.0,-265662.0],[376589.0,-265667.0],[376588.0,-265668.0],[376580.0,-265678.0],[376571.0,-265690.0],[376564.0,-265700.0],[376560.0,-265706.0],[376557.0,-265711.0],[376555.0,-265714.0],[376549.0,-265724.0],[376545.0,-265731.0],[376538.0,-265744.0],[376534.0,-265752.0],[376529.0,-265763.0],[376527.0,-265767.0],[376522.0,-265779.0],[376521.0,-265781.0],[376517.0,-265791.0],[376516.0,-265794.0],[376514.0,-265799.0],[376513.0,-265802.0],[376511.0,-265807.0],[376498.0,-265846.0],[376492.0,-265866.0],[376484.0,-265894.0],[376483.0,-265898.0],[376482.0,-265901.0],[376481.0,-265905.0],[376477.0,-265919.0],[376476.0,-265923.0],[376475.0,-265926.0],[376474.0,-265930.0],[376473.0,-265933.0],[376472.0,-265937.0],[376471.0,-265940.0],[376470.0,-265944.0],[376464.0,-265964.0],[376459.0,-265980.0],[376450.0,-266007.0],[376445.0,-266021.0],[376426.0,-266078.0],[376423.0,-266088.0],[376418.0,-266106.0],[376415.0,-266118.0],[376414.0,-266123.0],[376413.0,-266127.0],[376410.0,-266143.0],[376407.0,-266165.0],[376407.0,-266166.0],[376406.0,-266176.0],[376406.0,-266178.0],[376405.0,-266193.0],[376405.0,-266236.0],[376406.0,-266255.0],[376406.0,-266257.0],[376407.0,-266271.0],[376407.0,-266273.0],[376408.0,-266285.0],[376408.0,-266286.0],[376409.0,-266297.0],[376409.0,-266299.0],[376410.0,-266309.0],[376410.0,-266310.0],[376410.0,-267638.0],[375910.0,-267638.0],[375910.0,-266310.0],[375910.0,-266309.0]],[]],[[[400490.0,-320820.0],[399990.0,-320820.0],[399990.0,-255710.0],[400490.0,-255710.0],[400490.0,-320820.0]],[]]]}, - {"id":30,"start":[442280,-267710,270],"target":[442639,-308570,180],"bounds":[430030.0,-320820.0,471201.0,-255710.0],"width":500,"keepouts":[[[[430030.0,-312735.1895500058],[430030.0,-304404.8104499942],[442567.0,-308297.6434572448],[442567.0,-308842.3565427552],[430030.0,-312735.1895500058]],[]],[[[442030.0,-266309.0],[442031.0,-266299.0],[442031.0,-266297.0],[442032.0,-266286.0],[442032.0,-266285.0],[442033.0,-266273.0],[442033.0,-266271.0],[442034.0,-266257.0],[442034.0,-266255.0],[442035.0,-266236.0],[442035.0,-266193.0],[442034.0,-266178.0],[442034.0,-266176.0],[442033.0,-266166.0],[442033.0,-266165.0],[442030.0,-266143.0],[442027.0,-266127.0],[442026.0,-266123.0],[442025.0,-266118.0],[442022.0,-266106.0],[442017.0,-266088.0],[442014.0,-266078.0],[441995.0,-266021.0],[441990.0,-266007.0],[441981.0,-265980.0],[441976.0,-265964.0],[441970.0,-265944.0],[441969.0,-265940.0],[441968.0,-265937.0],[441967.0,-265933.0],[441966.0,-265930.0],[441965.0,-265926.0],[441964.0,-265923.0],[441963.0,-265919.0],[441959.0,-265905.0],[441958.0,-265901.0],[441957.0,-265898.0],[441956.0,-265894.0],[441948.0,-265866.0],[441942.0,-265846.0],[441929.0,-265807.0],[441927.0,-265802.0],[441926.0,-265799.0],[441924.0,-265794.0],[441923.0,-265791.0],[441919.0,-265781.0],[441918.0,-265779.0],[441913.0,-265767.0],[441911.0,-265763.0],[441906.0,-265752.0],[441902.0,-265744.0],[441895.0,-265731.0],[441891.0,-265724.0],[441885.0,-265714.0],[441883.0,-265711.0],[441880.0,-265706.0],[441876.0,-265700.0],[441869.0,-265690.0],[441860.0,-265678.0],[441852.0,-265668.0],[441851.0,-265667.0],[441847.0,-265662.0],[441840.0,-265654.0],[441801.0,-265615.0],[441792.0,-265607.0],[441790.0,-265605.0],[441773.0,-265590.0],[441767.0,-265585.0],[441766.0,-265584.0],[441760.0,-265579.0],[441759.0,-265578.0],[441753.0,-265573.0],[441752.0,-265572.0],[441746.0,-265567.0],[441745.0,-265566.0],[441739.0,-265561.0],[441738.0,-265560.0],[441732.0,-265555.0],[441723.0,-265547.0],[441717.0,-265542.0],[441715.0,-265540.0],[441699.0,-265526.0],[441697.0,-265524.0],[441686.0,-265514.0],[441661.0,-265489.0],[441652.0,-265479.0],[441647.0,-265473.0],[441646.0,-265472.0],[441642.0,-265467.0],[441633.0,-265455.0],[441626.0,-265445.0],[441618.0,-265432.0],[441614.0,-265425.0],[441606.0,-265409.0],[441603.0,-265402.0],[441602.0,-265400.0],[441597.0,-265387.0],[441592.0,-265372.0],[441588.0,-265357.0],[441586.0,-265348.0],[441584.0,-265338.0],[441582.0,-265326.0],[441582.0,-265325.0],[441581.0,-265319.0],[441581.0,-265318.0],[441579.0,-265301.0],[441579.0,-265299.0],[441578.0,-265288.0],[441578.0,-265285.0],[441577.0,-265267.0],[441577.0,-265220.0],[441578.0,-265194.0],[441578.0,-265190.0],[441579.0,-265170.0],[441579.0,-265166.0],[441580.0,-265145.0],[441580.0,-265141.0],[441581.0,-265114.0],[441581.0,-265005.0],[441580.0,-264979.0],[441580.0,-264975.0],[441579.0,-264955.0],[441579.0,-264952.0],[441578.0,-264933.0],[441578.0,-264929.0],[441577.0,-264907.0],[441577.0,-264848.0],[441578.0,-264832.0],[441578.0,-264830.0],[441579.0,-264820.0],[441579.0,-264819.0],[441581.0,-264802.0],[441582.0,-264795.0],[441584.0,-264783.0],[441588.0,-264763.0],[441590.0,-264754.0],[441595.0,-264734.0],[441596.0,-264731.0],[441599.0,-264720.0],[441600.0,-264717.0],[441601.0,-264713.0],[441603.0,-264707.0],[441606.0,-264697.0],[441611.0,-264682.0],[441615.0,-264671.0],[441617.0,-264665.0],[441627.0,-264638.0],[441629.0,-264633.0],[441630.0,-264630.0],[441634.0,-264620.0],[441635.0,-264617.0],[441641.0,-264602.0],[441642.0,-264599.0],[441646.0,-264589.0],[441647.0,-264586.0],[441649.0,-264581.0],[441650.0,-264578.0],[441652.0,-264573.0],[441653.0,-264570.0],[441655.0,-264565.0],[441663.0,-264542.0],[441671.0,-264516.0],[441677.0,-264492.0],[441680.0,-264477.0],[441681.0,-264471.0],[441681.0,-264470.0],[441682.0,-264464.0],[441683.0,-264456.0],[441683.0,-264455.0],[441684.0,-264446.0],[441684.0,-264445.0],[441685.0,-264433.0],[441685.0,-264377.0],[441684.0,-264361.0],[441684.0,-264359.0],[441683.0,-264347.0],[441683.0,-264345.0],[441682.0,-264334.0],[441682.0,-264333.0],[441681.0,-264322.0],[441681.0,-264321.0],[441680.0,-264311.0],[441680.0,-264310.0],[441680.0,-264266.0],[441679.0,-264166.0],[441679.0,-264154.0],[441678.0,-264103.0],[441678.0,-264093.0],[441677.0,-264054.0],[441677.0,-264047.0],[441676.0,-264013.0],[441676.0,-264008.0],[441675.0,-263976.0],[441675.0,-263974.0],[441674.0,-263945.0],[441674.0,-263940.0],[441673.0,-263913.0],[441673.0,-263911.0],[441672.0,-263886.0],[441672.0,-263884.0],[441671.0,-263862.0],[441671.0,-263860.0],[441670.0,-263838.0],[441670.0,-263835.0],[441669.0,-263814.0],[441669.0,-263811.0],[441668.0,-263792.0],[441668.0,-263789.0],[441667.0,-263770.0],[441667.0,-263768.0],[441664.0,-263712.0],[441664.0,-263710.0],[441660.0,-263640.0],[441660.0,-263639.0],[441658.0,-263608.0],[441658.0,-263606.0],[441651.0,-263502.0],[441650.0,-263490.0],[441650.0,-263488.0],[441646.0,-263435.0],[441642.0,-263387.0],[441642.0,-263385.0],[441640.0,-263361.0],[441637.0,-263328.0],[441635.0,-263304.0],[441623.0,-263178.0],[441615.0,-263102.0],[441602.0,-262987.0],[441595.0,-262929.0],[441594.0,-262922.0],[441584.0,-262843.0],[441582.0,-262829.0],[441580.0,-262813.0],[441574.0,-262769.0],[441556.0,-262644.0],[441542.0,-262553.0],[441539.0,-262535.0],[441538.0,-262528.0],[441535.0,-262510.0],[441534.0,-262503.0],[441519.0,-262413.0],[441517.0,-262402.0],[441514.0,-262384.0],[441510.0,-262362.0],[441508.0,-262350.0],[441484.0,-262219.0],[441477.0,-262182.0],[441468.0,-262136.0],[441454.0,-262066.0],[441446.0,-262027.0],[441444.0,-262018.0],[441441.0,-262003.0],[441440.0,-261999.0],[441416.0,-261887.0],[441415.0,-261883.0],[441408.0,-261851.0],[441407.0,-261847.0],[441406.0,-261842.0],[441389.0,-261768.0],[441351.0,-261609.0],[441334.0,-261541.0],[441324.0,-261502.0],[441306.0,-261433.0],[441282.0,-261344.0],[441266.0,-261286.0],[441239.0,-261191.0],[441226.0,-261146.0],[441222.0,-261133.0],[441204.0,-261072.0],[441179.0,-260990.0],[441177.0,-260984.0],[441170.0,-260961.0],[441146.0,-260885.0],[441126.0,-260823.0],[441078.0,-260679.0],[441071.0,-260659.0],[441066.0,-260644.0],[441061.0,-260630.0],[441049.0,-260595.0],[441012.0,-260491.0],[440985.0,-260417.0],[440957.0,-260342.0],[440955.0,-260337.0],[440951.0,-260326.0],[440930.0,-260271.0],[440926.0,-260261.0],[440924.0,-260255.0],[440070.0,-258045.0],[440069.0,-258043.0],[440056.0,-258009.0],[440052.0,-257999.0],[440014.0,-257898.0],[439985.0,-257819.0],[439962.0,-257755.0],[439922.0,-257641.0],[439918.0,-257629.0],[439911.0,-257609.0],[439904.0,-257588.0],[439890.0,-257547.0],[439857.0,-257447.0],[439838.0,-257388.0],[439808.0,-257293.0],[439782.0,-257208.0],[439753.0,-257110.0],[439752.0,-257107.0],[439748.0,-257093.0],[439747.0,-257090.0],[439735.0,-257048.0],[439732.0,-257038.0],[439720.0,-256995.0],[439717.0,-256985.0],[439687.0,-256876.0],[439685.0,-256868.0],[439680.0,-256850.0],[439678.0,-256842.0],[439676.0,-256835.0],[439674.0,-256827.0],[439667.0,-256801.0],[439646.0,-256720.0],[439615.0,-256596.0],[439610.0,-256575.0],[439606.0,-256559.0],[439599.0,-256529.0],[439592.0,-256500.0],[439577.0,-256435.0],[439562.0,-256369.0],[439559.0,-256355.0],[439554.0,-256333.0],[439535.0,-256245.0],[439518.0,-256163.0],[439496.0,-256053.0],[439495.0,-256047.0],[439490.0,-256022.0],[439489.0,-256016.0],[439477.0,-255953.0],[439476.0,-255947.0],[439470.0,-255915.0],[439454.0,-255825.0],[439451.0,-255807.0],[439450.0,-255802.0],[439443.0,-255760.0],[439441.0,-255749.0],[439434.64130434784,-255710.0],[439941.54545454547,-255710.0],[439943.0,-255718.0],[439946.0,-255736.0],[439950.0,-255758.0],[439952.0,-255770.0],[439975.0,-255896.0],[439983.0,-255938.0],[439992.0,-255984.0],[440006.0,-256054.0],[440014.0,-256093.0],[440016.0,-256102.0],[440019.0,-256117.0],[440020.0,-256121.0],[440025.0,-256145.0],[440042.0,-256224.0],[440045.0,-256237.0],[440052.0,-256269.0],[440053.0,-256273.0],[440054.0,-256278.0],[440070.0,-256348.0],[440109.0,-256511.0],[440126.0,-256579.0],[440154.0,-256687.0],[440184.0,-256798.0],[440205.0,-256873.0],[440234.0,-256974.0],[440238.0,-256987.0],[440250.0,-257028.0],[440281.0,-257130.0],[440283.0,-257136.0],[440286.0,-257146.0],[440314.0,-257235.0],[440334.0,-257297.0],[440382.0,-257441.0],[440389.0,-257461.0],[440394.0,-257476.0],[440399.0,-257490.0],[440411.0,-257525.0],[440439.0,-257604.0],[440460.0,-257662.0],[440503.0,-257778.0],[440505.0,-257783.0],[440509.0,-257794.0],[440530.0,-257849.0],[440534.0,-257859.0],[440536.0,-257865.0],[441390.0,-260075.0],[441391.0,-260077.0],[441404.0,-260111.0],[441408.0,-260121.0],[441446.0,-260222.0],[441467.0,-260279.0],[441498.0,-260365.0],[441509.0,-260396.0],[441538.0,-260479.0],[441542.0,-260491.0],[441549.0,-260511.0],[441556.0,-260532.0],[441570.0,-260573.0],[441603.0,-260673.0],[441622.0,-260732.0],[441652.0,-260827.0],[441681.0,-260922.0],[441708.0,-261013.0],[441712.0,-261027.0],[441713.0,-261030.0],[441725.0,-261072.0],[441728.0,-261082.0],[441740.0,-261125.0],[441743.0,-261135.0],[441773.0,-261244.0],[441775.0,-261252.0],[441780.0,-261270.0],[441782.0,-261278.0],[441784.0,-261285.0],[441786.0,-261293.0],[441793.0,-261319.0],[441814.0,-261400.0],[441845.0,-261524.0],[441850.0,-261545.0],[441854.0,-261561.0],[441868.0,-261620.0],[441873.0,-261642.0],[441875.0,-261650.0],[441898.0,-261751.0],[441901.0,-261765.0],[441904.0,-261778.0],[441925.0,-261875.0],[441942.0,-261957.0],[441964.0,-262067.0],[441965.0,-262073.0],[441970.0,-262098.0],[441971.0,-262104.0],[441990.0,-262205.0],[442003.0,-262278.0],[442009.0,-262313.0],[442010.0,-262318.0],[442017.0,-262360.0],[442019.0,-262371.0],[442034.0,-262463.0],[442046.0,-262540.0],[442058.0,-262621.0],[442065.0,-262670.0],[442067.0,-262685.0],[442068.0,-262691.0],[442083.0,-262803.0],[442083.0,-262804.0],[442087.0,-262834.0],[442088.0,-262843.0],[442089.0,-262850.0],[442090.0,-262859.0],[442092.0,-262874.0],[442098.0,-262924.0],[442100.0,-262942.0],[442102.0,-262958.0],[442109.0,-263020.0],[442118.0,-263104.0],[442129.0,-263216.0],[442129.0,-263217.0],[442131.0,-263239.0],[442132.0,-263248.0],[442133.0,-263261.0],[442138.0,-263317.0],[442138.0,-263318.0],[442141.0,-263353.0],[442145.0,-263403.0],[442145.0,-263404.0],[442149.0,-263457.0],[442149.0,-263458.0],[442150.0,-263470.0],[442151.0,-263486.0],[442152.0,-263499.0],[442153.0,-263515.0],[442154.0,-263528.0],[442156.0,-263559.0],[442156.0,-263560.0],[442157.0,-263575.0],[442157.0,-263576.0],[442160.0,-263624.0],[442163.0,-263678.0],[442163.0,-263679.0],[442164.0,-263697.0],[442164.0,-263698.0],[442166.0,-263736.0],[442166.0,-263737.0],[442167.0,-263756.0],[442167.0,-263759.0],[442168.0,-263778.0],[442168.0,-263779.0],[442170.0,-263824.0],[442170.0,-263827.0],[442171.0,-263849.0],[442171.0,-263850.0],[442172.0,-263875.0],[442172.0,-263878.0],[442173.0,-263904.0],[442173.0,-263905.0],[442174.0,-263933.0],[442174.0,-263937.0],[442175.0,-263966.0],[442175.0,-263969.0],[442176.0,-264001.0],[442176.0,-264005.0],[442177.0,-264043.0],[442177.0,-264047.0],[442178.0,-264089.0],[442178.0,-264096.0],[442179.0,-264151.0],[442179.0,-264164.0],[442180.0,-264268.0],[442180.0,-264310.0],[442380.0,-264310.0],[442380.0,-264268.0],[442381.0,-264164.0],[442381.0,-264151.0],[442382.0,-264096.0],[442382.0,-264089.0],[442383.0,-264047.0],[442383.0,-264043.0],[442384.0,-264005.0],[442384.0,-264001.0],[442385.0,-263969.0],[442385.0,-263966.0],[442386.0,-263937.0],[442386.0,-263933.0],[442387.0,-263905.0],[442387.0,-263904.0],[442388.0,-263878.0],[442388.0,-263875.0],[442389.0,-263850.0],[442389.0,-263849.0],[442390.0,-263827.0],[442390.0,-263824.0],[442392.0,-263779.0],[442392.0,-263778.0],[442393.0,-263759.0],[442393.0,-263756.0],[442394.0,-263737.0],[442394.0,-263736.0],[442396.0,-263698.0],[442396.0,-263697.0],[442397.0,-263679.0],[442397.0,-263678.0],[442400.0,-263624.0],[442403.0,-263576.0],[442403.0,-263575.0],[442404.0,-263560.0],[442404.0,-263559.0],[442406.0,-263528.0],[442407.0,-263515.0],[442408.0,-263499.0],[442409.0,-263486.0],[442410.0,-263470.0],[442411.0,-263458.0],[442411.0,-263457.0],[442415.0,-263404.0],[442415.0,-263403.0],[442419.0,-263353.0],[442422.0,-263318.0],[442422.0,-263317.0],[442427.0,-263261.0],[442428.0,-263248.0],[442429.0,-263239.0],[442431.0,-263217.0],[442431.0,-263216.0],[442442.0,-263104.0],[442451.0,-263020.0],[442458.0,-262958.0],[442460.0,-262942.0],[442462.0,-262924.0],[442468.0,-262874.0],[442470.0,-262859.0],[442471.0,-262850.0],[442472.0,-262843.0],[442473.0,-262834.0],[442477.0,-262804.0],[442477.0,-262803.0],[442492.0,-262691.0],[442493.0,-262685.0],[442495.0,-262670.0],[442502.0,-262621.0],[442514.0,-262540.0],[442526.0,-262463.0],[442541.0,-262371.0],[442543.0,-262360.0],[442550.0,-262318.0],[442551.0,-262313.0],[442557.0,-262278.0],[442570.0,-262205.0],[442589.0,-262104.0],[442590.0,-262098.0],[442595.0,-262073.0],[442596.0,-262067.0],[442618.0,-261957.0],[442635.0,-261875.0],[442656.0,-261778.0],[442659.0,-261765.0],[442662.0,-261751.0],[442685.0,-261650.0],[442687.0,-261642.0],[442692.0,-261620.0],[442706.0,-261561.0],[442710.0,-261545.0],[442715.0,-261524.0],[442746.0,-261400.0],[442767.0,-261319.0],[442774.0,-261293.0],[442776.0,-261285.0],[442778.0,-261278.0],[442780.0,-261270.0],[442785.0,-261252.0],[442787.0,-261244.0],[442817.0,-261135.0],[442820.0,-261125.0],[442832.0,-261082.0],[442835.0,-261072.0],[442847.0,-261030.0],[442848.0,-261027.0],[442852.0,-261013.0],[442879.0,-260922.0],[442908.0,-260827.0],[442938.0,-260732.0],[442957.0,-260673.0],[442990.0,-260573.0],[443004.0,-260532.0],[443011.0,-260511.0],[443018.0,-260491.0],[443022.0,-260479.0],[443051.0,-260396.0],[443062.0,-260365.0],[443093.0,-260279.0],[443114.0,-260222.0],[443152.0,-260121.0],[443156.0,-260111.0],[443169.0,-260077.0],[443170.0,-260075.0],[444024.0,-257865.0],[444026.0,-257859.0],[444030.0,-257849.0],[444051.0,-257794.0],[444055.0,-257783.0],[444057.0,-257778.0],[444100.0,-257662.0],[444121.0,-257604.0],[444149.0,-257525.0],[444161.0,-257490.0],[444166.0,-257476.0],[444171.0,-257461.0],[444178.0,-257441.0],[444226.0,-257297.0],[444246.0,-257235.0],[444274.0,-257146.0],[444277.0,-257136.0],[444279.0,-257130.0],[444310.0,-257028.0],[444322.0,-256987.0],[444326.0,-256974.0],[444355.0,-256873.0],[444376.0,-256798.0],[444406.0,-256687.0],[444434.0,-256579.0],[444451.0,-256511.0],[444490.0,-256348.0],[444506.0,-256278.0],[444507.0,-256273.0],[444508.0,-256269.0],[444515.0,-256237.0],[444518.0,-256224.0],[444535.0,-256145.0],[444540.0,-256121.0],[444541.0,-256117.0],[444544.0,-256102.0],[444546.0,-256093.0],[444554.0,-256054.0],[444568.0,-255984.0],[444577.0,-255938.0],[444585.0,-255896.0],[444608.0,-255770.0],[444610.0,-255758.0],[444614.0,-255736.0],[444617.0,-255718.0],[444618.45454545453,-255710.0],[445125.35869565216,-255710.0],[445119.0,-255749.0],[445117.0,-255760.0],[445110.0,-255802.0],[445109.0,-255807.0],[445106.0,-255825.0],[445090.0,-255915.0],[445084.0,-255947.0],[445083.0,-255953.0],[445071.0,-256016.0],[445070.0,-256022.0],[445065.0,-256047.0],[445064.0,-256053.0],[445042.0,-256163.0],[445025.0,-256245.0],[445006.0,-256333.0],[445001.0,-256355.0],[444998.0,-256369.0],[444983.0,-256435.0],[444968.0,-256500.0],[444961.0,-256529.0],[444954.0,-256559.0],[444950.0,-256575.0],[444945.0,-256596.0],[444914.0,-256720.0],[444893.0,-256801.0],[444886.0,-256827.0],[444884.0,-256835.0],[444882.0,-256842.0],[444880.0,-256850.0],[444875.0,-256868.0],[444873.0,-256876.0],[444843.0,-256985.0],[444840.0,-256995.0],[444828.0,-257038.0],[444825.0,-257048.0],[444813.0,-257090.0],[444812.0,-257093.0],[444808.0,-257107.0],[444807.0,-257110.0],[444778.0,-257208.0],[444752.0,-257293.0],[444722.0,-257388.0],[444703.0,-257447.0],[444670.0,-257547.0],[444656.0,-257588.0],[444649.0,-257609.0],[444642.0,-257629.0],[444638.0,-257641.0],[444598.0,-257755.0],[444575.0,-257819.0],[444546.0,-257898.0],[444508.0,-257999.0],[444504.0,-258009.0],[444491.0,-258043.0],[444490.0,-258045.0],[443636.0,-260255.0],[443634.0,-260261.0],[443630.0,-260271.0],[443609.0,-260326.0],[443605.0,-260337.0],[443603.0,-260342.0],[443575.0,-260417.0],[443548.0,-260491.0],[443511.0,-260595.0],[443499.0,-260630.0],[443494.0,-260644.0],[443489.0,-260659.0],[443482.0,-260679.0],[443434.0,-260823.0],[443414.0,-260885.0],[443390.0,-260961.0],[443383.0,-260984.0],[443381.0,-260990.0],[443356.0,-261072.0],[443338.0,-261133.0],[443334.0,-261146.0],[443321.0,-261191.0],[443294.0,-261286.0],[443278.0,-261344.0],[443254.0,-261433.0],[443236.0,-261502.0],[443226.0,-261541.0],[443209.0,-261609.0],[443171.0,-261768.0],[443154.0,-261842.0],[443153.0,-261847.0],[443152.0,-261851.0],[443145.0,-261883.0],[443144.0,-261887.0],[443120.0,-261999.0],[443119.0,-262003.0],[443116.0,-262018.0],[443114.0,-262027.0],[443106.0,-262066.0],[443092.0,-262136.0],[443083.0,-262182.0],[443076.0,-262219.0],[443052.0,-262350.0],[443050.0,-262362.0],[443046.0,-262384.0],[443043.0,-262402.0],[443041.0,-262413.0],[443026.0,-262503.0],[443025.0,-262510.0],[443022.0,-262528.0],[443021.0,-262535.0],[443018.0,-262553.0],[443004.0,-262644.0],[442986.0,-262769.0],[442980.0,-262813.0],[442978.0,-262829.0],[442976.0,-262843.0],[442966.0,-262922.0],[442965.0,-262929.0],[442958.0,-262987.0],[442945.0,-263102.0],[442937.0,-263178.0],[442925.0,-263304.0],[442923.0,-263328.0],[442920.0,-263361.0],[442918.0,-263385.0],[442918.0,-263387.0],[442914.0,-263435.0],[442910.0,-263488.0],[442910.0,-263490.0],[442909.0,-263502.0],[442902.0,-263606.0],[442902.0,-263608.0],[442900.0,-263639.0],[442900.0,-263640.0],[442896.0,-263710.0],[442896.0,-263712.0],[442893.0,-263768.0],[442893.0,-263770.0],[442892.0,-263789.0],[442892.0,-263792.0],[442891.0,-263811.0],[442891.0,-263814.0],[442890.0,-263835.0],[442890.0,-263838.0],[442889.0,-263860.0],[442889.0,-263862.0],[442888.0,-263884.0],[442888.0,-263886.0],[442887.0,-263911.0],[442887.0,-263913.0],[442886.0,-263940.0],[442886.0,-263945.0],[442885.0,-263974.0],[442885.0,-263976.0],[442884.0,-264008.0],[442884.0,-264013.0],[442883.0,-264047.0],[442883.0,-264054.0],[442882.0,-264093.0],[442882.0,-264103.0],[442881.0,-264154.0],[442881.0,-264166.0],[442880.0,-264266.0],[442880.0,-264310.0],[442880.0,-264311.0],[442879.0,-264321.0],[442879.0,-264322.0],[442878.0,-264333.0],[442878.0,-264334.0],[442877.0,-264345.0],[442877.0,-264347.0],[442876.0,-264359.0],[442876.0,-264361.0],[442875.0,-264377.0],[442875.0,-264433.0],[442876.0,-264445.0],[442876.0,-264446.0],[442877.0,-264455.0],[442877.0,-264456.0],[442878.0,-264464.0],[442879.0,-264470.0],[442879.0,-264471.0],[442880.0,-264477.0],[442883.0,-264492.0],[442889.0,-264516.0],[442897.0,-264542.0],[442905.0,-264565.0],[442907.0,-264570.0],[442908.0,-264573.0],[442910.0,-264578.0],[442911.0,-264581.0],[442913.0,-264586.0],[442914.0,-264589.0],[442918.0,-264599.0],[442919.0,-264602.0],[442925.0,-264617.0],[442926.0,-264620.0],[442930.0,-264630.0],[442931.0,-264633.0],[442933.0,-264638.0],[442943.0,-264665.0],[442945.0,-264671.0],[442949.0,-264682.0],[442954.0,-264697.0],[442957.0,-264707.0],[442959.0,-264713.0],[442960.0,-264717.0],[442961.0,-264720.0],[442964.0,-264731.0],[442965.0,-264734.0],[442970.0,-264754.0],[442972.0,-264763.0],[442976.0,-264783.0],[442978.0,-264795.0],[442979.0,-264802.0],[442981.0,-264819.0],[442981.0,-264820.0],[442982.0,-264830.0],[442982.0,-264832.0],[442983.0,-264848.0],[442983.0,-264907.0],[442982.0,-264929.0],[442982.0,-264933.0],[442981.0,-264952.0],[442981.0,-264955.0],[442980.0,-264975.0],[442980.0,-264979.0],[442979.0,-265005.0],[442979.0,-265114.0],[442980.0,-265141.0],[442980.0,-265145.0],[442981.0,-265166.0],[442981.0,-265170.0],[442982.0,-265190.0],[442982.0,-265194.0],[442983.0,-265220.0],[442983.0,-265267.0],[442982.0,-265285.0],[442982.0,-265288.0],[442981.0,-265299.0],[442981.0,-265301.0],[442979.0,-265318.0],[442979.0,-265319.0],[442978.0,-265325.0],[442978.0,-265326.0],[442976.0,-265338.0],[442974.0,-265348.0],[442972.0,-265357.0],[442968.0,-265372.0],[442963.0,-265387.0],[442958.0,-265400.0],[442957.0,-265402.0],[442954.0,-265409.0],[442946.0,-265425.0],[442942.0,-265432.0],[442934.0,-265445.0],[442927.0,-265455.0],[442918.0,-265467.0],[442914.0,-265472.0],[442913.0,-265473.0],[442908.0,-265479.0],[442899.0,-265489.0],[442874.0,-265514.0],[442863.0,-265524.0],[442861.0,-265526.0],[442845.0,-265540.0],[442843.0,-265542.0],[442837.0,-265547.0],[442828.0,-265555.0],[442822.0,-265560.0],[442821.0,-265561.0],[442815.0,-265566.0],[442814.0,-265567.0],[442808.0,-265572.0],[442807.0,-265573.0],[442801.0,-265578.0],[442800.0,-265579.0],[442794.0,-265584.0],[442793.0,-265585.0],[442787.0,-265590.0],[442770.0,-265605.0],[442768.0,-265607.0],[442759.0,-265615.0],[442720.0,-265654.0],[442713.0,-265662.0],[442709.0,-265667.0],[442708.0,-265668.0],[442700.0,-265678.0],[442691.0,-265690.0],[442684.0,-265700.0],[442680.0,-265706.0],[442677.0,-265711.0],[442675.0,-265714.0],[442669.0,-265724.0],[442665.0,-265731.0],[442658.0,-265744.0],[442654.0,-265752.0],[442649.0,-265763.0],[442647.0,-265767.0],[442642.0,-265779.0],[442641.0,-265781.0],[442637.0,-265791.0],[442636.0,-265794.0],[442634.0,-265799.0],[442633.0,-265802.0],[442631.0,-265807.0],[442618.0,-265846.0],[442612.0,-265866.0],[442604.0,-265894.0],[442603.0,-265898.0],[442602.0,-265901.0],[442601.0,-265905.0],[442597.0,-265919.0],[442596.0,-265923.0],[442595.0,-265926.0],[442594.0,-265930.0],[442593.0,-265933.0],[442592.0,-265937.0],[442591.0,-265940.0],[442590.0,-265944.0],[442584.0,-265964.0],[442579.0,-265980.0],[442570.0,-266007.0],[442565.0,-266021.0],[442546.0,-266078.0],[442543.0,-266088.0],[442538.0,-266106.0],[442535.0,-266118.0],[442534.0,-266123.0],[442533.0,-266127.0],[442530.0,-266143.0],[442527.0,-266165.0],[442527.0,-266166.0],[442526.0,-266176.0],[442526.0,-266178.0],[442525.0,-266193.0],[442525.0,-266236.0],[442526.0,-266255.0],[442526.0,-266257.0],[442527.0,-266271.0],[442527.0,-266273.0],[442528.0,-266285.0],[442528.0,-266286.0],[442529.0,-266297.0],[442529.0,-266299.0],[442530.0,-266309.0],[442530.0,-266310.0],[442530.0,-267638.0],[442030.0,-267638.0],[442030.0,-266310.0],[442030.0,-266309.0]],[]],[[[466659.0,-320820.0],[466159.0,-320820.0],[466159.0,-255710.0],[466659.0,-255710.0],[466659.0,-320820.0]],[]]]}, - {"id":33,"start":[507440,-267710,270],"target":[507639,-308570,180],"bounds":[495190.0,-320820.0,537070.0,-255710.0],"width":500,"keepouts":[[[[495190.0,-312685.5083438831],[495190.0,-304454.4916561169],[507567.0,-308297.6434572448],[507567.0,-308842.3565427552],[495190.0,-312685.5083438831]],[]],[[[507190.0,-266309.0],[507191.0,-266299.0],[507191.0,-266297.0],[507192.0,-266286.0],[507192.0,-266285.0],[507193.0,-266273.0],[507193.0,-266271.0],[507194.0,-266257.0],[507194.0,-266255.0],[507195.0,-266236.0],[507195.0,-266193.0],[507194.0,-266178.0],[507194.0,-266176.0],[507193.0,-266166.0],[507193.0,-266165.0],[507190.0,-266143.0],[507187.0,-266127.0],[507186.0,-266123.0],[507185.0,-266118.0],[507182.0,-266106.0],[507177.0,-266088.0],[507174.0,-266078.0],[507155.0,-266021.0],[507150.0,-266007.0],[507141.0,-265980.0],[507136.0,-265964.0],[507130.0,-265944.0],[507129.0,-265940.0],[507128.0,-265937.0],[507127.0,-265933.0],[507126.0,-265930.0],[507125.0,-265926.0],[507124.0,-265923.0],[507123.0,-265919.0],[507119.0,-265905.0],[507118.0,-265901.0],[507117.0,-265898.0],[507116.0,-265894.0],[507108.0,-265866.0],[507102.0,-265846.0],[507089.0,-265807.0],[507087.0,-265802.0],[507086.0,-265799.0],[507084.0,-265794.0],[507083.0,-265791.0],[507079.0,-265781.0],[507078.0,-265779.0],[507073.0,-265767.0],[507071.0,-265763.0],[507066.0,-265752.0],[507062.0,-265744.0],[507055.0,-265731.0],[507051.0,-265724.0],[507045.0,-265714.0],[507043.0,-265711.0],[507040.0,-265706.0],[507036.0,-265700.0],[507029.0,-265690.0],[507020.0,-265678.0],[507012.0,-265668.0],[507011.0,-265667.0],[507007.0,-265662.0],[507000.0,-265654.0],[506961.0,-265615.0],[506952.0,-265607.0],[506950.0,-265605.0],[506933.0,-265590.0],[506927.0,-265585.0],[506926.0,-265584.0],[506920.0,-265579.0],[506919.0,-265578.0],[506913.0,-265573.0],[506912.0,-265572.0],[506906.0,-265567.0],[506905.0,-265566.0],[506899.0,-265561.0],[506898.0,-265560.0],[506892.0,-265555.0],[506883.0,-265547.0],[506877.0,-265542.0],[506875.0,-265540.0],[506859.0,-265526.0],[506857.0,-265524.0],[506846.0,-265514.0],[506821.0,-265489.0],[506812.0,-265479.0],[506807.0,-265473.0],[506806.0,-265472.0],[506802.0,-265467.0],[506793.0,-265455.0],[506786.0,-265445.0],[506778.0,-265432.0],[506774.0,-265425.0],[506766.0,-265409.0],[506763.0,-265402.0],[506762.0,-265400.0],[506757.0,-265387.0],[506752.0,-265372.0],[506748.0,-265357.0],[506746.0,-265348.0],[506744.0,-265338.0],[506742.0,-265326.0],[506742.0,-265325.0],[506741.0,-265319.0],[506741.0,-265318.0],[506739.0,-265301.0],[506739.0,-265299.0],[506738.0,-265288.0],[506738.0,-265285.0],[506737.0,-265267.0],[506737.0,-265220.0],[506738.0,-265194.0],[506738.0,-265190.0],[506739.0,-265170.0],[506739.0,-265166.0],[506740.0,-265145.0],[506740.0,-265141.0],[506741.0,-265114.0],[506741.0,-265005.0],[506740.0,-264979.0],[506740.0,-264975.0],[506739.0,-264955.0],[506739.0,-264952.0],[506738.0,-264933.0],[506738.0,-264929.0],[506737.0,-264907.0],[506737.0,-264848.0],[506738.0,-264832.0],[506738.0,-264830.0],[506739.0,-264820.0],[506739.0,-264819.0],[506741.0,-264802.0],[506742.0,-264795.0],[506744.0,-264783.0],[506748.0,-264763.0],[506750.0,-264754.0],[506755.0,-264734.0],[506756.0,-264731.0],[506759.0,-264720.0],[506760.0,-264717.0],[506761.0,-264713.0],[506763.0,-264707.0],[506766.0,-264697.0],[506771.0,-264682.0],[506775.0,-264671.0],[506777.0,-264665.0],[506787.0,-264638.0],[506789.0,-264633.0],[506790.0,-264630.0],[506794.0,-264620.0],[506795.0,-264617.0],[506801.0,-264602.0],[506802.0,-264599.0],[506806.0,-264589.0],[506807.0,-264586.0],[506809.0,-264581.0],[506810.0,-264578.0],[506812.0,-264573.0],[506813.0,-264570.0],[506815.0,-264565.0],[506823.0,-264542.0],[506831.0,-264516.0],[506837.0,-264492.0],[506840.0,-264477.0],[506841.0,-264471.0],[506841.0,-264470.0],[506842.0,-264464.0],[506843.0,-264456.0],[506843.0,-264455.0],[506844.0,-264446.0],[506844.0,-264445.0],[506845.0,-264433.0],[506845.0,-264377.0],[506844.0,-264361.0],[506844.0,-264359.0],[506843.0,-264347.0],[506843.0,-264345.0],[506842.0,-264334.0],[506842.0,-264333.0],[506841.0,-264322.0],[506841.0,-264321.0],[506840.0,-264311.0],[506840.0,-264310.0],[506840.0,-264266.0],[506839.0,-264166.0],[506839.0,-264154.0],[506838.0,-264103.0],[506838.0,-264093.0],[506837.0,-264054.0],[506837.0,-264047.0],[506836.0,-264013.0],[506836.0,-264008.0],[506835.0,-263976.0],[506835.0,-263974.0],[506834.0,-263945.0],[506834.0,-263940.0],[506833.0,-263913.0],[506833.0,-263911.0],[506832.0,-263886.0],[506832.0,-263884.0],[506831.0,-263862.0],[506831.0,-263860.0],[506830.0,-263838.0],[506830.0,-263835.0],[506829.0,-263814.0],[506829.0,-263811.0],[506828.0,-263792.0],[506828.0,-263789.0],[506827.0,-263770.0],[506827.0,-263768.0],[506824.0,-263712.0],[506824.0,-263710.0],[506820.0,-263640.0],[506820.0,-263639.0],[506818.0,-263608.0],[506818.0,-263606.0],[506811.0,-263502.0],[506810.0,-263490.0],[506810.0,-263488.0],[506806.0,-263435.0],[506802.0,-263387.0],[506802.0,-263385.0],[506800.0,-263361.0],[506797.0,-263328.0],[506795.0,-263304.0],[506783.0,-263178.0],[506775.0,-263102.0],[506762.0,-262987.0],[506755.0,-262929.0],[506754.0,-262922.0],[506744.0,-262843.0],[506742.0,-262829.0],[506740.0,-262813.0],[506734.0,-262769.0],[506716.0,-262644.0],[506702.0,-262553.0],[506699.0,-262535.0],[506698.0,-262528.0],[506695.0,-262510.0],[506694.0,-262503.0],[506679.0,-262413.0],[506677.0,-262402.0],[506674.0,-262384.0],[506670.0,-262362.0],[506668.0,-262350.0],[506644.0,-262219.0],[506637.0,-262182.0],[506628.0,-262136.0],[506614.0,-262066.0],[506606.0,-262027.0],[506604.0,-262018.0],[506601.0,-262003.0],[506600.0,-261999.0],[506576.0,-261887.0],[506575.0,-261883.0],[506568.0,-261851.0],[506567.0,-261847.0],[506566.0,-261842.0],[506549.0,-261768.0],[506511.0,-261609.0],[506494.0,-261541.0],[506484.0,-261502.0],[506466.0,-261433.0],[506442.0,-261344.0],[506426.0,-261286.0],[506399.0,-261191.0],[506386.0,-261146.0],[506382.0,-261133.0],[506364.0,-261072.0],[506339.0,-260990.0],[506337.0,-260984.0],[506330.0,-260961.0],[506306.0,-260885.0],[506286.0,-260823.0],[506238.0,-260679.0],[506231.0,-260659.0],[506226.0,-260644.0],[506221.0,-260630.0],[506209.0,-260595.0],[506172.0,-260491.0],[506145.0,-260417.0],[506117.0,-260342.0],[506115.0,-260337.0],[506111.0,-260326.0],[506090.0,-260271.0],[506086.0,-260261.0],[506084.0,-260255.0],[505230.0,-258045.0],[505229.0,-258043.0],[505216.0,-258009.0],[505212.0,-257999.0],[505174.0,-257898.0],[505145.0,-257819.0],[505122.0,-257755.0],[505082.0,-257641.0],[505078.0,-257629.0],[505071.0,-257609.0],[505064.0,-257588.0],[505050.0,-257547.0],[505017.0,-257447.0],[504998.0,-257388.0],[504968.0,-257293.0],[504942.0,-257208.0],[504913.0,-257110.0],[504912.0,-257107.0],[504908.0,-257093.0],[504907.0,-257090.0],[504895.0,-257048.0],[504892.0,-257038.0],[504880.0,-256995.0],[504877.0,-256985.0],[504847.0,-256876.0],[504845.0,-256868.0],[504840.0,-256850.0],[504838.0,-256842.0],[504836.0,-256835.0],[504834.0,-256827.0],[504827.0,-256801.0],[504806.0,-256720.0],[504775.0,-256596.0],[504770.0,-256575.0],[504766.0,-256559.0],[504759.0,-256529.0],[504752.0,-256500.0],[504737.0,-256435.0],[504722.0,-256369.0],[504719.0,-256355.0],[504714.0,-256333.0],[504695.0,-256245.0],[504678.0,-256163.0],[504656.0,-256053.0],[504655.0,-256047.0],[504650.0,-256022.0],[504649.0,-256016.0],[504637.0,-255953.0],[504636.0,-255947.0],[504630.0,-255915.0],[504614.0,-255825.0],[504611.0,-255807.0],[504610.0,-255802.0],[504603.0,-255760.0],[504601.0,-255749.0],[504594.64130434784,-255710.0],[505101.54545454547,-255710.0],[505103.0,-255718.0],[505106.0,-255736.0],[505110.0,-255758.0],[505112.0,-255770.0],[505135.0,-255896.0],[505143.0,-255938.0],[505152.0,-255984.0],[505166.0,-256054.0],[505174.0,-256093.0],[505176.0,-256102.0],[505179.0,-256117.0],[505180.0,-256121.0],[505185.0,-256145.0],[505202.0,-256224.0],[505205.0,-256237.0],[505212.0,-256269.0],[505213.0,-256273.0],[505214.0,-256278.0],[505230.0,-256348.0],[505269.0,-256511.0],[505286.0,-256579.0],[505314.0,-256687.0],[505344.0,-256798.0],[505365.0,-256873.0],[505394.0,-256974.0],[505398.0,-256987.0],[505410.0,-257028.0],[505441.0,-257130.0],[505443.0,-257136.0],[505446.0,-257146.0],[505474.0,-257235.0],[505494.0,-257297.0],[505542.0,-257441.0],[505549.0,-257461.0],[505554.0,-257476.0],[505559.0,-257490.0],[505571.0,-257525.0],[505599.0,-257604.0],[505620.0,-257662.0],[505663.0,-257778.0],[505665.0,-257783.0],[505669.0,-257794.0],[505690.0,-257849.0],[505694.0,-257859.0],[505696.0,-257865.0],[506550.0,-260075.0],[506551.0,-260077.0],[506564.0,-260111.0],[506568.0,-260121.0],[506606.0,-260222.0],[506627.0,-260279.0],[506658.0,-260365.0],[506669.0,-260396.0],[506698.0,-260479.0],[506702.0,-260491.0],[506709.0,-260511.0],[506716.0,-260532.0],[506730.0,-260573.0],[506763.0,-260673.0],[506782.0,-260732.0],[506812.0,-260827.0],[506841.0,-260922.0],[506868.0,-261013.0],[506872.0,-261027.0],[506873.0,-261030.0],[506885.0,-261072.0],[506888.0,-261082.0],[506900.0,-261125.0],[506903.0,-261135.0],[506933.0,-261244.0],[506935.0,-261252.0],[506940.0,-261270.0],[506942.0,-261278.0],[506944.0,-261285.0],[506946.0,-261293.0],[506953.0,-261319.0],[506974.0,-261400.0],[507005.0,-261524.0],[507010.0,-261545.0],[507014.0,-261561.0],[507028.0,-261620.0],[507033.0,-261642.0],[507035.0,-261650.0],[507058.0,-261751.0],[507061.0,-261765.0],[507064.0,-261778.0],[507085.0,-261875.0],[507102.0,-261957.0],[507124.0,-262067.0],[507125.0,-262073.0],[507130.0,-262098.0],[507131.0,-262104.0],[507150.0,-262205.0],[507163.0,-262278.0],[507169.0,-262313.0],[507170.0,-262318.0],[507177.0,-262360.0],[507179.0,-262371.0],[507194.0,-262463.0],[507206.0,-262540.0],[507218.0,-262621.0],[507225.0,-262670.0],[507227.0,-262685.0],[507228.0,-262691.0],[507243.0,-262803.0],[507243.0,-262804.0],[507247.0,-262834.0],[507248.0,-262843.0],[507249.0,-262850.0],[507250.0,-262859.0],[507252.0,-262874.0],[507258.0,-262924.0],[507260.0,-262942.0],[507262.0,-262958.0],[507269.0,-263020.0],[507278.0,-263104.0],[507289.0,-263216.0],[507289.0,-263217.0],[507291.0,-263239.0],[507292.0,-263248.0],[507293.0,-263261.0],[507298.0,-263317.0],[507298.0,-263318.0],[507301.0,-263353.0],[507305.0,-263403.0],[507305.0,-263404.0],[507309.0,-263457.0],[507309.0,-263458.0],[507310.0,-263470.0],[507311.0,-263486.0],[507312.0,-263499.0],[507313.0,-263515.0],[507314.0,-263528.0],[507316.0,-263559.0],[507316.0,-263560.0],[507317.0,-263575.0],[507317.0,-263576.0],[507320.0,-263624.0],[507323.0,-263678.0],[507323.0,-263679.0],[507324.0,-263697.0],[507324.0,-263698.0],[507326.0,-263736.0],[507326.0,-263737.0],[507327.0,-263756.0],[507327.0,-263759.0],[507328.0,-263778.0],[507328.0,-263779.0],[507330.0,-263824.0],[507330.0,-263827.0],[507331.0,-263849.0],[507331.0,-263850.0],[507332.0,-263875.0],[507332.0,-263878.0],[507333.0,-263904.0],[507333.0,-263905.0],[507334.0,-263933.0],[507334.0,-263937.0],[507335.0,-263966.0],[507335.0,-263969.0],[507336.0,-264001.0],[507336.0,-264005.0],[507337.0,-264043.0],[507337.0,-264047.0],[507338.0,-264089.0],[507338.0,-264096.0],[507339.0,-264151.0],[507339.0,-264164.0],[507340.0,-264268.0],[507340.0,-264310.0],[507540.0,-264310.0],[507540.0,-264268.0],[507541.0,-264164.0],[507541.0,-264151.0],[507542.0,-264096.0],[507542.0,-264089.0],[507543.0,-264047.0],[507543.0,-264043.0],[507544.0,-264005.0],[507544.0,-264001.0],[507545.0,-263969.0],[507545.0,-263966.0],[507546.0,-263937.0],[507546.0,-263933.0],[507547.0,-263905.0],[507547.0,-263904.0],[507548.0,-263878.0],[507548.0,-263875.0],[507549.0,-263850.0],[507549.0,-263849.0],[507550.0,-263827.0],[507550.0,-263824.0],[507552.0,-263779.0],[507552.0,-263778.0],[507553.0,-263759.0],[507553.0,-263756.0],[507554.0,-263737.0],[507554.0,-263736.0],[507556.0,-263698.0],[507556.0,-263697.0],[507557.0,-263679.0],[507557.0,-263678.0],[507560.0,-263624.0],[507563.0,-263576.0],[507563.0,-263575.0],[507564.0,-263560.0],[507564.0,-263559.0],[507566.0,-263528.0],[507567.0,-263515.0],[507568.0,-263499.0],[507569.0,-263486.0],[507570.0,-263470.0],[507571.0,-263458.0],[507571.0,-263457.0],[507575.0,-263404.0],[507575.0,-263403.0],[507579.0,-263353.0],[507582.0,-263318.0],[507582.0,-263317.0],[507587.0,-263261.0],[507588.0,-263248.0],[507589.0,-263239.0],[507591.0,-263217.0],[507591.0,-263216.0],[507602.0,-263104.0],[507611.0,-263020.0],[507618.0,-262958.0],[507620.0,-262942.0],[507622.0,-262924.0],[507628.0,-262874.0],[507630.0,-262859.0],[507631.0,-262850.0],[507632.0,-262843.0],[507633.0,-262834.0],[507637.0,-262804.0],[507637.0,-262803.0],[507652.0,-262691.0],[507653.0,-262685.0],[507655.0,-262670.0],[507662.0,-262621.0],[507674.0,-262540.0],[507686.0,-262463.0],[507701.0,-262371.0],[507703.0,-262360.0],[507710.0,-262318.0],[507711.0,-262313.0],[507717.0,-262278.0],[507730.0,-262205.0],[507749.0,-262104.0],[507750.0,-262098.0],[507755.0,-262073.0],[507756.0,-262067.0],[507778.0,-261957.0],[507795.0,-261875.0],[507816.0,-261778.0],[507819.0,-261765.0],[507822.0,-261751.0],[507845.0,-261650.0],[507847.0,-261642.0],[507852.0,-261620.0],[507866.0,-261561.0],[507870.0,-261545.0],[507875.0,-261524.0],[507906.0,-261400.0],[507927.0,-261319.0],[507934.0,-261293.0],[507936.0,-261285.0],[507938.0,-261278.0],[507940.0,-261270.0],[507945.0,-261252.0],[507947.0,-261244.0],[507977.0,-261135.0],[507980.0,-261125.0],[507992.0,-261082.0],[507995.0,-261072.0],[508007.0,-261030.0],[508008.0,-261027.0],[508012.0,-261013.0],[508039.0,-260922.0],[508068.0,-260827.0],[508098.0,-260732.0],[508117.0,-260673.0],[508150.0,-260573.0],[508164.0,-260532.0],[508171.0,-260511.0],[508178.0,-260491.0],[508182.0,-260479.0],[508211.0,-260396.0],[508222.0,-260365.0],[508253.0,-260279.0],[508274.0,-260222.0],[508312.0,-260121.0],[508316.0,-260111.0],[508329.0,-260077.0],[508330.0,-260075.0],[509184.0,-257865.0],[509186.0,-257859.0],[509190.0,-257849.0],[509211.0,-257794.0],[509215.0,-257783.0],[509217.0,-257778.0],[509260.0,-257662.0],[509281.0,-257604.0],[509309.0,-257525.0],[509321.0,-257490.0],[509326.0,-257476.0],[509331.0,-257461.0],[509338.0,-257441.0],[509386.0,-257297.0],[509406.0,-257235.0],[509434.0,-257146.0],[509437.0,-257136.0],[509439.0,-257130.0],[509470.0,-257028.0],[509482.0,-256987.0],[509486.0,-256974.0],[509515.0,-256873.0],[509536.0,-256798.0],[509566.0,-256687.0],[509594.0,-256579.0],[509611.0,-256511.0],[509650.0,-256348.0],[509666.0,-256278.0],[509667.0,-256273.0],[509668.0,-256269.0],[509675.0,-256237.0],[509678.0,-256224.0],[509695.0,-256145.0],[509700.0,-256121.0],[509701.0,-256117.0],[509704.0,-256102.0],[509706.0,-256093.0],[509714.0,-256054.0],[509728.0,-255984.0],[509737.0,-255938.0],[509745.0,-255896.0],[509768.0,-255770.0],[509770.0,-255758.0],[509774.0,-255736.0],[509777.0,-255718.0],[509778.45454545453,-255710.0],[510285.35869565216,-255710.0],[510279.0,-255749.0],[510277.0,-255760.0],[510270.0,-255802.0],[510269.0,-255807.0],[510266.0,-255825.0],[510250.0,-255915.0],[510244.0,-255947.0],[510243.0,-255953.0],[510231.0,-256016.0],[510230.0,-256022.0],[510225.0,-256047.0],[510224.0,-256053.0],[510202.0,-256163.0],[510185.0,-256245.0],[510166.0,-256333.0],[510161.0,-256355.0],[510158.0,-256369.0],[510143.0,-256435.0],[510128.0,-256500.0],[510121.0,-256529.0],[510114.0,-256559.0],[510110.0,-256575.0],[510105.0,-256596.0],[510074.0,-256720.0],[510053.0,-256801.0],[510046.0,-256827.0],[510044.0,-256835.0],[510042.0,-256842.0],[510040.0,-256850.0],[510035.0,-256868.0],[510033.0,-256876.0],[510003.0,-256985.0],[510000.0,-256995.0],[509988.0,-257038.0],[509985.0,-257048.0],[509973.0,-257090.0],[509972.0,-257093.0],[509968.0,-257107.0],[509967.0,-257110.0],[509938.0,-257208.0],[509912.0,-257293.0],[509882.0,-257388.0],[509863.0,-257447.0],[509830.0,-257547.0],[509816.0,-257588.0],[509809.0,-257609.0],[509802.0,-257629.0],[509798.0,-257641.0],[509758.0,-257755.0],[509735.0,-257819.0],[509706.0,-257898.0],[509668.0,-257999.0],[509664.0,-258009.0],[509651.0,-258043.0],[509650.0,-258045.0],[508796.0,-260255.0],[508794.0,-260261.0],[508790.0,-260271.0],[508769.0,-260326.0],[508765.0,-260337.0],[508763.0,-260342.0],[508735.0,-260417.0],[508708.0,-260491.0],[508671.0,-260595.0],[508659.0,-260630.0],[508654.0,-260644.0],[508649.0,-260659.0],[508642.0,-260679.0],[508594.0,-260823.0],[508574.0,-260885.0],[508550.0,-260961.0],[508543.0,-260984.0],[508541.0,-260990.0],[508516.0,-261072.0],[508498.0,-261133.0],[508494.0,-261146.0],[508481.0,-261191.0],[508454.0,-261286.0],[508438.0,-261344.0],[508414.0,-261433.0],[508396.0,-261502.0],[508386.0,-261541.0],[508369.0,-261609.0],[508331.0,-261768.0],[508314.0,-261842.0],[508313.0,-261847.0],[508312.0,-261851.0],[508305.0,-261883.0],[508304.0,-261887.0],[508280.0,-261999.0],[508279.0,-262003.0],[508276.0,-262018.0],[508274.0,-262027.0],[508266.0,-262066.0],[508252.0,-262136.0],[508243.0,-262182.0],[508236.0,-262219.0],[508212.0,-262350.0],[508210.0,-262362.0],[508206.0,-262384.0],[508203.0,-262402.0],[508201.0,-262413.0],[508186.0,-262503.0],[508185.0,-262510.0],[508182.0,-262528.0],[508181.0,-262535.0],[508178.0,-262553.0],[508164.0,-262644.0],[508146.0,-262769.0],[508140.0,-262813.0],[508138.0,-262829.0],[508136.0,-262843.0],[508126.0,-262922.0],[508125.0,-262929.0],[508118.0,-262987.0],[508105.0,-263102.0],[508097.0,-263178.0],[508085.0,-263304.0],[508083.0,-263328.0],[508080.0,-263361.0],[508078.0,-263385.0],[508078.0,-263387.0],[508074.0,-263435.0],[508070.0,-263488.0],[508070.0,-263490.0],[508069.0,-263502.0],[508062.0,-263606.0],[508062.0,-263608.0],[508060.0,-263639.0],[508060.0,-263640.0],[508056.0,-263710.0],[508056.0,-263712.0],[508053.0,-263768.0],[508053.0,-263770.0],[508052.0,-263789.0],[508052.0,-263792.0],[508051.0,-263811.0],[508051.0,-263814.0],[508050.0,-263835.0],[508050.0,-263838.0],[508049.0,-263860.0],[508049.0,-263862.0],[508048.0,-263884.0],[508048.0,-263886.0],[508047.0,-263911.0],[508047.0,-263913.0],[508046.0,-263940.0],[508046.0,-263945.0],[508045.0,-263974.0],[508045.0,-263976.0],[508044.0,-264008.0],[508044.0,-264013.0],[508043.0,-264047.0],[508043.0,-264054.0],[508042.0,-264093.0],[508042.0,-264103.0],[508041.0,-264154.0],[508041.0,-264166.0],[508040.0,-264266.0],[508040.0,-264310.0],[508040.0,-264311.0],[508039.0,-264321.0],[508039.0,-264322.0],[508038.0,-264333.0],[508038.0,-264334.0],[508037.0,-264345.0],[508037.0,-264347.0],[508036.0,-264359.0],[508036.0,-264361.0],[508035.0,-264377.0],[508035.0,-264433.0],[508036.0,-264445.0],[508036.0,-264446.0],[508037.0,-264455.0],[508037.0,-264456.0],[508038.0,-264464.0],[508039.0,-264470.0],[508039.0,-264471.0],[508040.0,-264477.0],[508043.0,-264492.0],[508049.0,-264516.0],[508057.0,-264542.0],[508065.0,-264565.0],[508067.0,-264570.0],[508068.0,-264573.0],[508070.0,-264578.0],[508071.0,-264581.0],[508073.0,-264586.0],[508074.0,-264589.0],[508078.0,-264599.0],[508079.0,-264602.0],[508085.0,-264617.0],[508086.0,-264620.0],[508090.0,-264630.0],[508091.0,-264633.0],[508093.0,-264638.0],[508103.0,-264665.0],[508105.0,-264671.0],[508109.0,-264682.0],[508114.0,-264697.0],[508117.0,-264707.0],[508119.0,-264713.0],[508120.0,-264717.0],[508121.0,-264720.0],[508124.0,-264731.0],[508125.0,-264734.0],[508130.0,-264754.0],[508132.0,-264763.0],[508136.0,-264783.0],[508138.0,-264795.0],[508139.0,-264802.0],[508141.0,-264819.0],[508141.0,-264820.0],[508142.0,-264830.0],[508142.0,-264832.0],[508143.0,-264848.0],[508143.0,-264907.0],[508142.0,-264929.0],[508142.0,-264933.0],[508141.0,-264952.0],[508141.0,-264955.0],[508140.0,-264975.0],[508140.0,-264979.0],[508139.0,-265005.0],[508139.0,-265114.0],[508140.0,-265141.0],[508140.0,-265145.0],[508141.0,-265166.0],[508141.0,-265170.0],[508142.0,-265190.0],[508142.0,-265194.0],[508143.0,-265220.0],[508143.0,-265267.0],[508142.0,-265285.0],[508142.0,-265288.0],[508141.0,-265299.0],[508141.0,-265301.0],[508139.0,-265318.0],[508139.0,-265319.0],[508138.0,-265325.0],[508138.0,-265326.0],[508136.0,-265338.0],[508134.0,-265348.0],[508132.0,-265357.0],[508128.0,-265372.0],[508123.0,-265387.0],[508118.0,-265400.0],[508117.0,-265402.0],[508114.0,-265409.0],[508106.0,-265425.0],[508102.0,-265432.0],[508094.0,-265445.0],[508087.0,-265455.0],[508078.0,-265467.0],[508074.0,-265472.0],[508073.0,-265473.0],[508068.0,-265479.0],[508059.0,-265489.0],[508034.0,-265514.0],[508023.0,-265524.0],[508021.0,-265526.0],[508005.0,-265540.0],[508003.0,-265542.0],[507997.0,-265547.0],[507988.0,-265555.0],[507982.0,-265560.0],[507981.0,-265561.0],[507975.0,-265566.0],[507974.0,-265567.0],[507968.0,-265572.0],[507967.0,-265573.0],[507961.0,-265578.0],[507960.0,-265579.0],[507954.0,-265584.0],[507953.0,-265585.0],[507947.0,-265590.0],[507930.0,-265605.0],[507928.0,-265607.0],[507919.0,-265615.0],[507880.0,-265654.0],[507873.0,-265662.0],[507869.0,-265667.0],[507868.0,-265668.0],[507860.0,-265678.0],[507851.0,-265690.0],[507844.0,-265700.0],[507840.0,-265706.0],[507837.0,-265711.0],[507835.0,-265714.0],[507829.0,-265724.0],[507825.0,-265731.0],[507818.0,-265744.0],[507814.0,-265752.0],[507809.0,-265763.0],[507807.0,-265767.0],[507802.0,-265779.0],[507801.0,-265781.0],[507797.0,-265791.0],[507796.0,-265794.0],[507794.0,-265799.0],[507793.0,-265802.0],[507791.0,-265807.0],[507778.0,-265846.0],[507772.0,-265866.0],[507764.0,-265894.0],[507763.0,-265898.0],[507762.0,-265901.0],[507761.0,-265905.0],[507757.0,-265919.0],[507756.0,-265923.0],[507755.0,-265926.0],[507754.0,-265930.0],[507753.0,-265933.0],[507752.0,-265937.0],[507751.0,-265940.0],[507750.0,-265944.0],[507744.0,-265964.0],[507739.0,-265980.0],[507730.0,-266007.0],[507725.0,-266021.0],[507706.0,-266078.0],[507703.0,-266088.0],[507698.0,-266106.0],[507695.0,-266118.0],[507694.0,-266123.0],[507693.0,-266127.0],[507690.0,-266143.0],[507687.0,-266165.0],[507687.0,-266166.0],[507686.0,-266176.0],[507686.0,-266178.0],[507685.0,-266193.0],[507685.0,-266236.0],[507686.0,-266255.0],[507686.0,-266257.0],[507687.0,-266271.0],[507687.0,-266273.0],[507688.0,-266285.0],[507688.0,-266286.0],[507689.0,-266297.0],[507689.0,-266299.0],[507690.0,-266309.0],[507690.0,-266310.0],[507690.0,-267638.0],[507190.0,-267638.0],[507190.0,-266310.0],[507190.0,-266309.0]],[]],[[[531659.0,-320820.0],[531159.0,-320820.0],[531159.0,-255710.0],[531659.0,-255710.0],[531659.0,-320820.0]],[]]]}, - {"id":34,"start":[579730,-267710,270],"target":[579879,-308570,180],"bounds":[567480.0,-320820.0,602300.0,-255710.0],"width":500,"keepouts":[[[[567480.0,-312669.9829669697],[567480.0,-304470.0170330303],[579807.0,-308297.6434572448],[579807.0,-308842.3565427552],[567480.0,-312669.9829669697]],[]],[[[579480.0,-266309.0],[579481.0,-266299.0],[579481.0,-266297.0],[579482.0,-266286.0],[579482.0,-266285.0],[579483.0,-266273.0],[579483.0,-266271.0],[579484.0,-266257.0],[579484.0,-266255.0],[579485.0,-266236.0],[579485.0,-266193.0],[579484.0,-266178.0],[579484.0,-266176.0],[579483.0,-266166.0],[579483.0,-266165.0],[579480.0,-266143.0],[579477.0,-266127.0],[579476.0,-266123.0],[579475.0,-266118.0],[579472.0,-266106.0],[579467.0,-266088.0],[579464.0,-266078.0],[579445.0,-266021.0],[579440.0,-266007.0],[579431.0,-265980.0],[579426.0,-265964.0],[579420.0,-265944.0],[579419.0,-265940.0],[579418.0,-265937.0],[579417.0,-265933.0],[579416.0,-265930.0],[579415.0,-265926.0],[579414.0,-265923.0],[579413.0,-265919.0],[579409.0,-265905.0],[579408.0,-265901.0],[579407.0,-265898.0],[579406.0,-265894.0],[579398.0,-265866.0],[579392.0,-265846.0],[579379.0,-265807.0],[579377.0,-265802.0],[579376.0,-265799.0],[579374.0,-265794.0],[579373.0,-265791.0],[579369.0,-265781.0],[579368.0,-265779.0],[579363.0,-265767.0],[579361.0,-265763.0],[579356.0,-265752.0],[579352.0,-265744.0],[579345.0,-265731.0],[579341.0,-265724.0],[579335.0,-265714.0],[579333.0,-265711.0],[579330.0,-265706.0],[579326.0,-265700.0],[579319.0,-265690.0],[579310.0,-265678.0],[579302.0,-265668.0],[579301.0,-265667.0],[579297.0,-265662.0],[579290.0,-265654.0],[579251.0,-265615.0],[579242.0,-265607.0],[579240.0,-265605.0],[579223.0,-265590.0],[579217.0,-265585.0],[579216.0,-265584.0],[579210.0,-265579.0],[579209.0,-265578.0],[579203.0,-265573.0],[579202.0,-265572.0],[579196.0,-265567.0],[579195.0,-265566.0],[579189.0,-265561.0],[579188.0,-265560.0],[579182.0,-265555.0],[579173.0,-265547.0],[579167.0,-265542.0],[579165.0,-265540.0],[579149.0,-265526.0],[579147.0,-265524.0],[579136.0,-265514.0],[579111.0,-265489.0],[579102.0,-265479.0],[579097.0,-265473.0],[579096.0,-265472.0],[579092.0,-265467.0],[579083.0,-265455.0],[579076.0,-265445.0],[579068.0,-265432.0],[579064.0,-265425.0],[579056.0,-265409.0],[579053.0,-265402.0],[579052.0,-265400.0],[579047.0,-265387.0],[579042.0,-265372.0],[579038.0,-265357.0],[579036.0,-265348.0],[579034.0,-265338.0],[579032.0,-265326.0],[579032.0,-265325.0],[579031.0,-265319.0],[579031.0,-265318.0],[579029.0,-265301.0],[579029.0,-265299.0],[579028.0,-265288.0],[579028.0,-265285.0],[579027.0,-265267.0],[579027.0,-265220.0],[579028.0,-265194.0],[579028.0,-265190.0],[579029.0,-265170.0],[579029.0,-265166.0],[579030.0,-265145.0],[579030.0,-265141.0],[579031.0,-265114.0],[579031.0,-265005.0],[579030.0,-264979.0],[579030.0,-264975.0],[579029.0,-264955.0],[579029.0,-264952.0],[579028.0,-264933.0],[579028.0,-264929.0],[579027.0,-264907.0],[579027.0,-264848.0],[579028.0,-264832.0],[579028.0,-264830.0],[579029.0,-264820.0],[579029.0,-264819.0],[579031.0,-264802.0],[579032.0,-264795.0],[579034.0,-264783.0],[579038.0,-264763.0],[579040.0,-264754.0],[579045.0,-264734.0],[579046.0,-264731.0],[579049.0,-264720.0],[579050.0,-264717.0],[579051.0,-264713.0],[579053.0,-264707.0],[579056.0,-264697.0],[579061.0,-264682.0],[579065.0,-264671.0],[579067.0,-264665.0],[579077.0,-264638.0],[579079.0,-264633.0],[579080.0,-264630.0],[579084.0,-264620.0],[579085.0,-264617.0],[579091.0,-264602.0],[579092.0,-264599.0],[579096.0,-264589.0],[579097.0,-264586.0],[579099.0,-264581.0],[579100.0,-264578.0],[579102.0,-264573.0],[579103.0,-264570.0],[579105.0,-264565.0],[579113.0,-264542.0],[579121.0,-264516.0],[579127.0,-264492.0],[579130.0,-264477.0],[579131.0,-264471.0],[579131.0,-264470.0],[579132.0,-264464.0],[579133.0,-264456.0],[579133.0,-264455.0],[579134.0,-264446.0],[579134.0,-264445.0],[579135.0,-264433.0],[579135.0,-264377.0],[579134.0,-264361.0],[579134.0,-264359.0],[579133.0,-264347.0],[579133.0,-264345.0],[579132.0,-264334.0],[579132.0,-264333.0],[579131.0,-264322.0],[579131.0,-264321.0],[579130.0,-264311.0],[579130.0,-264310.0],[579130.0,-264266.0],[579129.0,-264166.0],[579129.0,-264154.0],[579128.0,-264103.0],[579128.0,-264093.0],[579127.0,-264054.0],[579127.0,-264047.0],[579126.0,-264013.0],[579126.0,-264008.0],[579125.0,-263976.0],[579125.0,-263974.0],[579124.0,-263945.0],[579124.0,-263940.0],[579123.0,-263913.0],[579123.0,-263911.0],[579122.0,-263886.0],[579122.0,-263884.0],[579121.0,-263862.0],[579121.0,-263860.0],[579120.0,-263838.0],[579120.0,-263835.0],[579119.0,-263814.0],[579119.0,-263811.0],[579118.0,-263792.0],[579118.0,-263789.0],[579117.0,-263770.0],[579117.0,-263768.0],[579114.0,-263712.0],[579114.0,-263710.0],[579110.0,-263640.0],[579110.0,-263639.0],[579108.0,-263608.0],[579108.0,-263606.0],[579101.0,-263502.0],[579100.0,-263490.0],[579100.0,-263488.0],[579096.0,-263435.0],[579092.0,-263387.0],[579092.0,-263385.0],[579090.0,-263361.0],[579087.0,-263328.0],[579085.0,-263304.0],[579073.0,-263178.0],[579065.0,-263102.0],[579052.0,-262987.0],[579045.0,-262929.0],[579044.0,-262922.0],[579034.0,-262843.0],[579032.0,-262829.0],[579030.0,-262813.0],[579024.0,-262769.0],[579006.0,-262644.0],[578992.0,-262553.0],[578989.0,-262535.0],[578988.0,-262528.0],[578985.0,-262510.0],[578984.0,-262503.0],[578969.0,-262413.0],[578967.0,-262402.0],[578964.0,-262384.0],[578960.0,-262362.0],[578958.0,-262350.0],[578934.0,-262219.0],[578927.0,-262182.0],[578918.0,-262136.0],[578904.0,-262066.0],[578896.0,-262027.0],[578894.0,-262018.0],[578891.0,-262003.0],[578890.0,-261999.0],[578866.0,-261887.0],[578865.0,-261883.0],[578858.0,-261851.0],[578857.0,-261847.0],[578856.0,-261842.0],[578839.0,-261768.0],[578801.0,-261609.0],[578784.0,-261541.0],[578774.0,-261502.0],[578756.0,-261433.0],[578732.0,-261344.0],[578716.0,-261286.0],[578689.0,-261191.0],[578676.0,-261146.0],[578672.0,-261133.0],[578654.0,-261072.0],[578629.0,-260990.0],[578627.0,-260984.0],[578620.0,-260961.0],[578596.0,-260885.0],[578576.0,-260823.0],[578528.0,-260679.0],[578521.0,-260659.0],[578516.0,-260644.0],[578511.0,-260630.0],[578499.0,-260595.0],[578462.0,-260491.0],[578435.0,-260417.0],[578407.0,-260342.0],[578405.0,-260337.0],[578401.0,-260326.0],[578380.0,-260271.0],[578376.0,-260261.0],[578374.0,-260255.0],[577520.0,-258045.0],[577519.0,-258043.0],[577506.0,-258009.0],[577502.0,-257999.0],[577464.0,-257898.0],[577435.0,-257819.0],[577412.0,-257755.0],[577372.0,-257641.0],[577368.0,-257629.0],[577361.0,-257609.0],[577354.0,-257588.0],[577340.0,-257547.0],[577307.0,-257447.0],[577288.0,-257388.0],[577258.0,-257293.0],[577232.0,-257208.0],[577203.0,-257110.0],[577202.0,-257107.0],[577198.0,-257093.0],[577197.0,-257090.0],[577185.0,-257048.0],[577182.0,-257038.0],[577170.0,-256995.0],[577167.0,-256985.0],[577137.0,-256876.0],[577135.0,-256868.0],[577130.0,-256850.0],[577128.0,-256842.0],[577126.0,-256835.0],[577124.0,-256827.0],[577117.0,-256801.0],[577096.0,-256720.0],[577065.0,-256596.0],[577060.0,-256575.0],[577056.0,-256559.0],[577049.0,-256529.0],[577042.0,-256500.0],[577027.0,-256435.0],[577012.0,-256369.0],[577009.0,-256355.0],[577004.0,-256333.0],[576985.0,-256245.0],[576968.0,-256163.0],[576946.0,-256053.0],[576945.0,-256047.0],[576940.0,-256022.0],[576939.0,-256016.0],[576927.0,-255953.0],[576926.0,-255947.0],[576920.0,-255915.0],[576904.0,-255825.0],[576901.0,-255807.0],[576900.0,-255802.0],[576893.0,-255760.0],[576891.0,-255749.0],[576884.6413043478,-255710.0],[577391.5454545454,-255710.0],[577393.0,-255718.0],[577396.0,-255736.0],[577400.0,-255758.0],[577402.0,-255770.0],[577425.0,-255896.0],[577433.0,-255938.0],[577442.0,-255984.0],[577456.0,-256054.0],[577464.0,-256093.0],[577466.0,-256102.0],[577469.0,-256117.0],[577470.0,-256121.0],[577475.0,-256145.0],[577492.0,-256224.0],[577495.0,-256237.0],[577502.0,-256269.0],[577503.0,-256273.0],[577504.0,-256278.0],[577520.0,-256348.0],[577559.0,-256511.0],[577576.0,-256579.0],[577604.0,-256687.0],[577634.0,-256798.0],[577655.0,-256873.0],[577684.0,-256974.0],[577688.0,-256987.0],[577700.0,-257028.0],[577731.0,-257130.0],[577733.0,-257136.0],[577736.0,-257146.0],[577764.0,-257235.0],[577784.0,-257297.0],[577832.0,-257441.0],[577839.0,-257461.0],[577844.0,-257476.0],[577849.0,-257490.0],[577861.0,-257525.0],[577889.0,-257604.0],[577910.0,-257662.0],[577953.0,-257778.0],[577955.0,-257783.0],[577959.0,-257794.0],[577980.0,-257849.0],[577984.0,-257859.0],[577986.0,-257865.0],[578840.0,-260075.0],[578841.0,-260077.0],[578854.0,-260111.0],[578858.0,-260121.0],[578896.0,-260222.0],[578917.0,-260279.0],[578948.0,-260365.0],[578959.0,-260396.0],[578988.0,-260479.0],[578992.0,-260491.0],[578999.0,-260511.0],[579006.0,-260532.0],[579020.0,-260573.0],[579053.0,-260673.0],[579072.0,-260732.0],[579102.0,-260827.0],[579131.0,-260922.0],[579158.0,-261013.0],[579162.0,-261027.0],[579163.0,-261030.0],[579175.0,-261072.0],[579178.0,-261082.0],[579190.0,-261125.0],[579193.0,-261135.0],[579223.0,-261244.0],[579225.0,-261252.0],[579230.0,-261270.0],[579232.0,-261278.0],[579234.0,-261285.0],[579236.0,-261293.0],[579243.0,-261319.0],[579264.0,-261400.0],[579295.0,-261524.0],[579300.0,-261545.0],[579304.0,-261561.0],[579318.0,-261620.0],[579323.0,-261642.0],[579325.0,-261650.0],[579348.0,-261751.0],[579351.0,-261765.0],[579354.0,-261778.0],[579375.0,-261875.0],[579392.0,-261957.0],[579414.0,-262067.0],[579415.0,-262073.0],[579420.0,-262098.0],[579421.0,-262104.0],[579440.0,-262205.0],[579453.0,-262278.0],[579459.0,-262313.0],[579460.0,-262318.0],[579467.0,-262360.0],[579469.0,-262371.0],[579484.0,-262463.0],[579496.0,-262540.0],[579508.0,-262621.0],[579515.0,-262670.0],[579517.0,-262685.0],[579518.0,-262691.0],[579533.0,-262803.0],[579533.0,-262804.0],[579537.0,-262834.0],[579538.0,-262843.0],[579539.0,-262850.0],[579540.0,-262859.0],[579542.0,-262874.0],[579548.0,-262924.0],[579550.0,-262942.0],[579552.0,-262958.0],[579559.0,-263020.0],[579568.0,-263104.0],[579579.0,-263216.0],[579579.0,-263217.0],[579581.0,-263239.0],[579582.0,-263248.0],[579583.0,-263261.0],[579588.0,-263317.0],[579588.0,-263318.0],[579591.0,-263353.0],[579595.0,-263403.0],[579595.0,-263404.0],[579599.0,-263457.0],[579599.0,-263458.0],[579600.0,-263470.0],[579601.0,-263486.0],[579602.0,-263499.0],[579603.0,-263515.0],[579604.0,-263528.0],[579606.0,-263559.0],[579606.0,-263560.0],[579607.0,-263575.0],[579607.0,-263576.0],[579610.0,-263624.0],[579613.0,-263678.0],[579613.0,-263679.0],[579614.0,-263697.0],[579614.0,-263698.0],[579616.0,-263736.0],[579616.0,-263737.0],[579617.0,-263756.0],[579617.0,-263759.0],[579618.0,-263778.0],[579618.0,-263779.0],[579620.0,-263824.0],[579620.0,-263827.0],[579621.0,-263849.0],[579621.0,-263850.0],[579622.0,-263875.0],[579622.0,-263878.0],[579623.0,-263904.0],[579623.0,-263905.0],[579624.0,-263933.0],[579624.0,-263937.0],[579625.0,-263966.0],[579625.0,-263969.0],[579626.0,-264001.0],[579626.0,-264005.0],[579627.0,-264043.0],[579627.0,-264047.0],[579628.0,-264089.0],[579628.0,-264096.0],[579629.0,-264151.0],[579629.0,-264164.0],[579630.0,-264268.0],[579630.0,-264310.0],[579830.0,-264310.0],[579830.0,-264268.0],[579831.0,-264164.0],[579831.0,-264151.0],[579832.0,-264096.0],[579832.0,-264089.0],[579833.0,-264047.0],[579833.0,-264043.0],[579834.0,-264005.0],[579834.0,-264001.0],[579835.0,-263969.0],[579835.0,-263966.0],[579836.0,-263937.0],[579836.0,-263933.0],[579837.0,-263905.0],[579837.0,-263904.0],[579838.0,-263878.0],[579838.0,-263875.0],[579839.0,-263850.0],[579839.0,-263849.0],[579840.0,-263827.0],[579840.0,-263824.0],[579842.0,-263779.0],[579842.0,-263778.0],[579843.0,-263759.0],[579843.0,-263756.0],[579844.0,-263737.0],[579844.0,-263736.0],[579846.0,-263698.0],[579846.0,-263697.0],[579847.0,-263679.0],[579847.0,-263678.0],[579850.0,-263624.0],[579853.0,-263576.0],[579853.0,-263575.0],[579854.0,-263560.0],[579854.0,-263559.0],[579856.0,-263528.0],[579857.0,-263515.0],[579858.0,-263499.0],[579859.0,-263486.0],[579860.0,-263470.0],[579861.0,-263458.0],[579861.0,-263457.0],[579865.0,-263404.0],[579865.0,-263403.0],[579869.0,-263353.0],[579872.0,-263318.0],[579872.0,-263317.0],[579877.0,-263261.0],[579878.0,-263248.0],[579879.0,-263239.0],[579881.0,-263217.0],[579881.0,-263216.0],[579892.0,-263104.0],[579901.0,-263020.0],[579908.0,-262958.0],[579910.0,-262942.0],[579912.0,-262924.0],[579918.0,-262874.0],[579920.0,-262859.0],[579921.0,-262850.0],[579922.0,-262843.0],[579923.0,-262834.0],[579927.0,-262804.0],[579927.0,-262803.0],[579942.0,-262691.0],[579943.0,-262685.0],[579945.0,-262670.0],[579952.0,-262621.0],[579964.0,-262540.0],[579976.0,-262463.0],[579991.0,-262371.0],[579993.0,-262360.0],[580000.0,-262318.0],[580001.0,-262313.0],[580007.0,-262278.0],[580020.0,-262205.0],[580039.0,-262104.0],[580040.0,-262098.0],[580045.0,-262073.0],[580046.0,-262067.0],[580068.0,-261957.0],[580085.0,-261875.0],[580106.0,-261778.0],[580109.0,-261765.0],[580112.0,-261751.0],[580135.0,-261650.0],[580137.0,-261642.0],[580142.0,-261620.0],[580156.0,-261561.0],[580160.0,-261545.0],[580165.0,-261524.0],[580196.0,-261400.0],[580217.0,-261319.0],[580224.0,-261293.0],[580226.0,-261285.0],[580228.0,-261278.0],[580230.0,-261270.0],[580235.0,-261252.0],[580237.0,-261244.0],[580267.0,-261135.0],[580270.0,-261125.0],[580282.0,-261082.0],[580285.0,-261072.0],[580297.0,-261030.0],[580298.0,-261027.0],[580302.0,-261013.0],[580329.0,-260922.0],[580358.0,-260827.0],[580388.0,-260732.0],[580407.0,-260673.0],[580440.0,-260573.0],[580454.0,-260532.0],[580461.0,-260511.0],[580468.0,-260491.0],[580472.0,-260479.0],[580501.0,-260396.0],[580512.0,-260365.0],[580543.0,-260279.0],[580564.0,-260222.0],[580602.0,-260121.0],[580606.0,-260111.0],[580619.0,-260077.0],[580620.0,-260075.0],[581474.0,-257865.0],[581476.0,-257859.0],[581480.0,-257849.0],[581501.0,-257794.0],[581505.0,-257783.0],[581507.0,-257778.0],[581550.0,-257662.0],[581571.0,-257604.0],[581599.0,-257525.0],[581611.0,-257490.0],[581616.0,-257476.0],[581621.0,-257461.0],[581628.0,-257441.0],[581676.0,-257297.0],[581696.0,-257235.0],[581724.0,-257146.0],[581727.0,-257136.0],[581729.0,-257130.0],[581760.0,-257028.0],[581772.0,-256987.0],[581776.0,-256974.0],[581805.0,-256873.0],[581826.0,-256798.0],[581856.0,-256687.0],[581884.0,-256579.0],[581901.0,-256511.0],[581940.0,-256348.0],[581956.0,-256278.0],[581957.0,-256273.0],[581958.0,-256269.0],[581965.0,-256237.0],[581968.0,-256224.0],[581985.0,-256145.0],[581990.0,-256121.0],[581991.0,-256117.0],[581994.0,-256102.0],[581996.0,-256093.0],[582004.0,-256054.0],[582018.0,-255984.0],[582027.0,-255938.0],[582035.0,-255896.0],[582058.0,-255770.0],[582060.0,-255758.0],[582064.0,-255736.0],[582067.0,-255718.0],[582068.4545454546,-255710.0],[582575.3586956522,-255710.0],[582569.0,-255749.0],[582567.0,-255760.0],[582560.0,-255802.0],[582559.0,-255807.0],[582556.0,-255825.0],[582540.0,-255915.0],[582534.0,-255947.0],[582533.0,-255953.0],[582521.0,-256016.0],[582520.0,-256022.0],[582515.0,-256047.0],[582514.0,-256053.0],[582492.0,-256163.0],[582475.0,-256245.0],[582456.0,-256333.0],[582451.0,-256355.0],[582448.0,-256369.0],[582433.0,-256435.0],[582418.0,-256500.0],[582411.0,-256529.0],[582404.0,-256559.0],[582400.0,-256575.0],[582395.0,-256596.0],[582364.0,-256720.0],[582343.0,-256801.0],[582336.0,-256827.0],[582334.0,-256835.0],[582332.0,-256842.0],[582330.0,-256850.0],[582325.0,-256868.0],[582323.0,-256876.0],[582293.0,-256985.0],[582290.0,-256995.0],[582278.0,-257038.0],[582275.0,-257048.0],[582263.0,-257090.0],[582262.0,-257093.0],[582258.0,-257107.0],[582257.0,-257110.0],[582228.0,-257208.0],[582202.0,-257293.0],[582172.0,-257388.0],[582153.0,-257447.0],[582120.0,-257547.0],[582106.0,-257588.0],[582099.0,-257609.0],[582092.0,-257629.0],[582088.0,-257641.0],[582048.0,-257755.0],[582025.0,-257819.0],[581996.0,-257898.0],[581958.0,-257999.0],[581954.0,-258009.0],[581941.0,-258043.0],[581940.0,-258045.0],[581086.0,-260255.0],[581084.0,-260261.0],[581080.0,-260271.0],[581059.0,-260326.0],[581055.0,-260337.0],[581053.0,-260342.0],[581025.0,-260417.0],[580998.0,-260491.0],[580961.0,-260595.0],[580949.0,-260630.0],[580944.0,-260644.0],[580939.0,-260659.0],[580932.0,-260679.0],[580884.0,-260823.0],[580864.0,-260885.0],[580840.0,-260961.0],[580833.0,-260984.0],[580831.0,-260990.0],[580806.0,-261072.0],[580788.0,-261133.0],[580784.0,-261146.0],[580771.0,-261191.0],[580744.0,-261286.0],[580728.0,-261344.0],[580704.0,-261433.0],[580686.0,-261502.0],[580676.0,-261541.0],[580659.0,-261609.0],[580621.0,-261768.0],[580604.0,-261842.0],[580603.0,-261847.0],[580602.0,-261851.0],[580595.0,-261883.0],[580594.0,-261887.0],[580570.0,-261999.0],[580569.0,-262003.0],[580566.0,-262018.0],[580564.0,-262027.0],[580556.0,-262066.0],[580542.0,-262136.0],[580533.0,-262182.0],[580526.0,-262219.0],[580502.0,-262350.0],[580500.0,-262362.0],[580496.0,-262384.0],[580493.0,-262402.0],[580491.0,-262413.0],[580476.0,-262503.0],[580475.0,-262510.0],[580472.0,-262528.0],[580471.0,-262535.0],[580468.0,-262553.0],[580454.0,-262644.0],[580436.0,-262769.0],[580430.0,-262813.0],[580428.0,-262829.0],[580426.0,-262843.0],[580416.0,-262922.0],[580415.0,-262929.0],[580408.0,-262987.0],[580395.0,-263102.0],[580387.0,-263178.0],[580375.0,-263304.0],[580373.0,-263328.0],[580370.0,-263361.0],[580368.0,-263385.0],[580368.0,-263387.0],[580364.0,-263435.0],[580360.0,-263488.0],[580360.0,-263490.0],[580359.0,-263502.0],[580352.0,-263606.0],[580352.0,-263608.0],[580350.0,-263639.0],[580350.0,-263640.0],[580346.0,-263710.0],[580346.0,-263712.0],[580343.0,-263768.0],[580343.0,-263770.0],[580342.0,-263789.0],[580342.0,-263792.0],[580341.0,-263811.0],[580341.0,-263814.0],[580340.0,-263835.0],[580340.0,-263838.0],[580339.0,-263860.0],[580339.0,-263862.0],[580338.0,-263884.0],[580338.0,-263886.0],[580337.0,-263911.0],[580337.0,-263913.0],[580336.0,-263940.0],[580336.0,-263945.0],[580335.0,-263974.0],[580335.0,-263976.0],[580334.0,-264008.0],[580334.0,-264013.0],[580333.0,-264047.0],[580333.0,-264054.0],[580332.0,-264093.0],[580332.0,-264103.0],[580331.0,-264154.0],[580331.0,-264166.0],[580330.0,-264266.0],[580330.0,-264310.0],[580330.0,-264311.0],[580329.0,-264321.0],[580329.0,-264322.0],[580328.0,-264333.0],[580328.0,-264334.0],[580327.0,-264345.0],[580327.0,-264347.0],[580326.0,-264359.0],[580326.0,-264361.0],[580325.0,-264377.0],[580325.0,-264433.0],[580326.0,-264445.0],[580326.0,-264446.0],[580327.0,-264455.0],[580327.0,-264456.0],[580328.0,-264464.0],[580329.0,-264470.0],[580329.0,-264471.0],[580330.0,-264477.0],[580333.0,-264492.0],[580339.0,-264516.0],[580347.0,-264542.0],[580355.0,-264565.0],[580357.0,-264570.0],[580358.0,-264573.0],[580360.0,-264578.0],[580361.0,-264581.0],[580363.0,-264586.0],[580364.0,-264589.0],[580368.0,-264599.0],[580369.0,-264602.0],[580375.0,-264617.0],[580376.0,-264620.0],[580380.0,-264630.0],[580381.0,-264633.0],[580383.0,-264638.0],[580393.0,-264665.0],[580395.0,-264671.0],[580399.0,-264682.0],[580404.0,-264697.0],[580407.0,-264707.0],[580409.0,-264713.0],[580410.0,-264717.0],[580411.0,-264720.0],[580414.0,-264731.0],[580415.0,-264734.0],[580420.0,-264754.0],[580422.0,-264763.0],[580426.0,-264783.0],[580428.0,-264795.0],[580429.0,-264802.0],[580431.0,-264819.0],[580431.0,-264820.0],[580432.0,-264830.0],[580432.0,-264832.0],[580433.0,-264848.0],[580433.0,-264907.0],[580432.0,-264929.0],[580432.0,-264933.0],[580431.0,-264952.0],[580431.0,-264955.0],[580430.0,-264975.0],[580430.0,-264979.0],[580429.0,-265005.0],[580429.0,-265114.0],[580430.0,-265141.0],[580430.0,-265145.0],[580431.0,-265166.0],[580431.0,-265170.0],[580432.0,-265190.0],[580432.0,-265194.0],[580433.0,-265220.0],[580433.0,-265267.0],[580432.0,-265285.0],[580432.0,-265288.0],[580431.0,-265299.0],[580431.0,-265301.0],[580429.0,-265318.0],[580429.0,-265319.0],[580428.0,-265325.0],[580428.0,-265326.0],[580426.0,-265338.0],[580424.0,-265348.0],[580422.0,-265357.0],[580418.0,-265372.0],[580413.0,-265387.0],[580408.0,-265400.0],[580407.0,-265402.0],[580404.0,-265409.0],[580396.0,-265425.0],[580392.0,-265432.0],[580384.0,-265445.0],[580377.0,-265455.0],[580368.0,-265467.0],[580364.0,-265472.0],[580363.0,-265473.0],[580358.0,-265479.0],[580349.0,-265489.0],[580324.0,-265514.0],[580313.0,-265524.0],[580311.0,-265526.0],[580295.0,-265540.0],[580293.0,-265542.0],[580287.0,-265547.0],[580278.0,-265555.0],[580272.0,-265560.0],[580271.0,-265561.0],[580265.0,-265566.0],[580264.0,-265567.0],[580258.0,-265572.0],[580257.0,-265573.0],[580251.0,-265578.0],[580250.0,-265579.0],[580244.0,-265584.0],[580243.0,-265585.0],[580237.0,-265590.0],[580220.0,-265605.0],[580218.0,-265607.0],[580209.0,-265615.0],[580170.0,-265654.0],[580163.0,-265662.0],[580159.0,-265667.0],[580158.0,-265668.0],[580150.0,-265678.0],[580141.0,-265690.0],[580134.0,-265700.0],[580130.0,-265706.0],[580127.0,-265711.0],[580125.0,-265714.0],[580119.0,-265724.0],[580115.0,-265731.0],[580108.0,-265744.0],[580104.0,-265752.0],[580099.0,-265763.0],[580097.0,-265767.0],[580092.0,-265779.0],[580091.0,-265781.0],[580087.0,-265791.0],[580086.0,-265794.0],[580084.0,-265799.0],[580083.0,-265802.0],[580081.0,-265807.0],[580068.0,-265846.0],[580062.0,-265866.0],[580054.0,-265894.0],[580053.0,-265898.0],[580052.0,-265901.0],[580051.0,-265905.0],[580047.0,-265919.0],[580046.0,-265923.0],[580045.0,-265926.0],[580044.0,-265930.0],[580043.0,-265933.0],[580042.0,-265937.0],[580041.0,-265940.0],[580040.0,-265944.0],[580034.0,-265964.0],[580029.0,-265980.0],[580020.0,-266007.0],[580015.0,-266021.0],[579996.0,-266078.0],[579993.0,-266088.0],[579988.0,-266106.0],[579985.0,-266118.0],[579984.0,-266123.0],[579983.0,-266127.0],[579980.0,-266143.0],[579977.0,-266165.0],[579977.0,-266166.0],[579976.0,-266176.0],[579976.0,-266178.0],[579975.0,-266193.0],[579975.0,-266236.0],[579976.0,-266255.0],[579976.0,-266257.0],[579977.0,-266271.0],[579977.0,-266273.0],[579978.0,-266285.0],[579978.0,-266286.0],[579979.0,-266297.0],[579979.0,-266299.0],[579980.0,-266309.0],[579980.0,-266310.0],[579980.0,-267638.0],[579480.0,-267638.0],[579480.0,-266310.0],[579480.0,-266309.0]],[]]]} - ] -} diff --git a/inire/tests/example_scenarios.py b/inire/tests/example_scenarios.py index 19d1166..e28fd60 100644 --- a/inire/tests/example_scenarios.py +++ b/inire/tests/example_scenarios.py @@ -11,7 +11,6 @@ from shapely.geometry import Polygon, box from inire import ( CongestionOptions, DiagnosticsOptions, - FixedRoute, NetSpec, ObjectiveWeights, RoutingOptions, @@ -122,7 +121,7 @@ def snapshot_example_03() -> ScenarioSnapshot: problem_b = RoutingProblem( bounds=problem_a.bounds, nets=(NetSpec("netB", Port(50, -20, 90), Port(50, 20, 90)),), - fixed_routes=(FixedRoute.from_result(results_a["netA"]),), + static_obstacles=results_a["netA"].locked_geometry, ) finder_b = build_routing_stack(problem_b, options).finder results_b = finder_b.route_all() @@ -290,7 +289,6 @@ def _build_example_07_variant_stack( sbend_radii=(50.0,), greedy_h_weight=1.5, bend_clip_margin=10.0, - distance_heuristic_weight=10.0, ), objective=ObjectiveWeights( unit_length_cost=0.1, diff --git a/inire/tests/routing_corpus.py b/inire/tests/routing_corpus.py index d308cd9..dbe8f51 100644 --- a/inire/tests/routing_corpus.py +++ b/inire/tests/routing_corpus.py @@ -71,7 +71,6 @@ def _public_defaults(case: BenchmarkCase, defaults: RoutingOptions) -> RoutingOp bend_collision_type=geometry.bend_collision_type, bend_proxy_geometry=geometry.bend_proxy_geometry, bend_physical_geometry=geometry.bend_physical_geometry, - sbend_outlines=geometry.sbend_outlines, bend_clip_margin=geometry.bend_clip_margin, min_straight_length=geometry.min_straight_length, max_straight_length=geometry.max_straight_length, diff --git a/inire/tests/test_api.py b/inire/tests/test_api.py index e8b0c21..0443013 100644 --- a/inire/tests/test_api.py +++ b/inire/tests/test_api.py @@ -1,15 +1,11 @@ import importlib -from dataclasses import replace import pytest import shapely -from shapely.affinity import rotate, translate from shapely.geometry import Polygon, box import inire -import inire.geometry.components as components_module import inire.router._router as router_module -import inire.router._search as search_module from inire import ( Bend90Seed, CongestionOptions, @@ -21,19 +17,17 @@ from inire import ( RefinementOptions, RoutingOptions, RoutingProblem, - SBendOutline, SBendSeed, SearchOptions, StraightSeed, TopologyOptions, route, ) -from inire.geometry.components import Bend90, SBend, Straight +from inire.geometry.components import Straight from inire.geometry.collision import RoutingWorld from inire.results import RoutingReport, RoutingResult from inire.router._astar_types import AStarContext from inire.router._router import PathFinder, _IterationReview -from inire.router._stack import RoutingAttempts from inire.router.cost import CostEvaluator from inire.router.danger_map import DangerMap def test_root_module_exports_only_stable_surface() -> None: @@ -263,10 +257,7 @@ def test_route_verification_rejects_adjacent_component_overlap(wrong_side) -> No if wrong_side: outline = shapely.union_all([box(-4, -11, 0, -9), box(-4, -10, -2, -4), box(-4, -6, 11, -4), box(9, -6, 11, 0)]) else: - outline = shapely.union_all([ - box(0, -11, 11, -9), box(9, -11, 11, 0), - box(2, -9.5, 3, -7), box(-4, -8, 3, -7), box(-4, -10, -3, -7), - ]) + outline = shapely.union_all([box(0, -11, 11, -9), box(9, -11, 11, 0), box(-4, -11, 2, -10.5)]) net = NetSpec("bend", Port(20, 20, 0), Port(50, 30, 90)) seed = PathSeed((StraightSeed(20), Bend90Seed(10, "CCW"))) problem = RoutingProblem((0, 0, 100, 100), (net,), initial_paths={"bend": seed}) @@ -285,242 +276,6 @@ def test_route_verification_rejects_adjacent_component_overlap(wrong_side) -> No assert result.report.discontinuous is wrong_side -@pytest.mark.parametrize("mode", ["off", "guide", "seed", "automatic"]) -def test_custom_sbend_outline_is_shared_by_search_and_seed_replay(mode) -> None: - outline = Polygon([(0, -1), (20, 3), (50, 29), (80, 39), (80, 41), (50, 31), (20, 5), (0, 1)]) - net = NetSpec("shift", Port(30, 50, 0), Port(110, 90, 0)) - problem = RoutingProblem((0, 0, 160, 160), (net,)) - options = RoutingOptions( - search=SearchOptions(bend_radii=(), sbend_radii=(50,), sbend_outlines=(SBendOutline(40, 50, 2, outline),)), - congestion=CongestionOptions(max_iterations=1), - topology=TopologyOptions(mode=mode), - ) - - result = route(problem, options=options).results_by_net["shift"] - replay = route( - replace(problem, initial_paths={"shift": result.as_seed()}), - options=replace(options, search=replace(options.search, node_limit=0)), - ).results_by_net["shift"] - - assert result.is_valid - assert replay.is_valid - assert result.as_seed() == PathSeed((SBendSeed(40, 50),)) - assert len(result.locked_geometry) == 1 - assert result.locked_geometry[0].equals(translate(outline, 30, 50)) - assert result.locked_geometry == replay.locked_geometry - - -def test_sbend_outline_requires_both_port_faces() -> None: - half = SBend.generate(Port(0, 0, 0), 40, 50, 2).physical_geometry[0] - - with pytest.raises(ValueError, match="port faces"): - SBendOutline(40, 50, 2, half) - - -@pytest.mark.parametrize("budget", [True, -1, 1.5, float("nan"), float("inf")]) -def test_search_and_congestion_reject_invalid_budgets(budget) -> None: - with pytest.raises(ValueError, match="node_limit must be a nonnegative integer"): - SearchOptions(node_limit=budget) - with pytest.raises(ValueError, match="max_iterations must be a nonnegative integer"): - CongestionOptions(max_iterations=budget) - - -@pytest.mark.parametrize("value", [-1, float("nan"), float("inf")]) -def test_cost_options_require_finite_nonnegative_values(value) -> None: - with pytest.raises(ValueError, match="unit_length_cost"): - ObjectiveWeights(unit_length_cost=value) - with pytest.raises(ValueError, match="greedy_h_weight"): - SearchOptions(greedy_h_weight=value) - with pytest.raises(ValueError, match="base_penalty"): - CongestionOptions(base_penalty=value) - with pytest.raises(ValueError, match="multiplier"): - CongestionOptions(multiplier=value) - - -def test_public_inputs_reject_invalid_ids_and_named_options() -> None: - with pytest.raises(TypeError, match="Net ID must be a string"): - NetSpec(7, Port(0, 0, 0), Port(10, 0, 0)) - with pytest.raises(ValueError, match="net_order"): - CongestionOptions(net_order="longesst") - with pytest.raises(ValueError, match="visibility_guidance"): - SearchOptions(visibility_guidance="exact") - - -def _sbend_strip(offset, half_width=1): - centerline = [(0, 0), (20, offset / 10), (50, 3 * offset / 4), (80, offset)] - return Polygon( - [(x, y - half_width) for x, y in centerline] + [(x, y + half_width) for x, y in reversed(centerline)], - ) - - -@pytest.mark.parametrize(("width", "expected_polygons"), [(0.3, 1), (0.1 + 0.2, 1), (300 * 0.001, 1), (0.31, 2)]) -def test_custom_sbend_matches_float_width_in_search_and_replay(width, expected_polygons) -> None: - outline = SBendOutline(40, 50, 0.3, _sbend_strip(40, half_width=0.15)) - net = NetSpec("shift", Port(10, 10, 0), Port(90, 50, 0), width) - problem = RoutingProblem((0, 0, 100, 100), (net,), clearance=0) - search = SearchOptions(node_limit=30, sbend_outlines=(outline,), bend_radii=(), sbend_radii=(50,)) - options = RoutingOptions(search=search, topology=TopologyOptions(mode="off")) - active = route(problem, options=options).results_by_net["shift"] - replay = route( - replace(problem, initial_paths={"shift": PathSeed((SBendSeed(40, 50),))}), - options=replace(options, search=replace(search, node_limit=0)), - ).results_by_net["shift"] - assert active.is_valid - assert replay.is_valid - assert len(active.locked_geometry) == expected_polygons - assert active.locked_geometry == replay.locked_geometry - - -@pytest.mark.parametrize("mode", ["off", "automatic"]) -@pytest.mark.parametrize("terminal", ["start", "target"]) -def test_search_and_seed_replay_check_materialized_sbend_faces(mode, terminal) -> None: - clearance = 0.1 - # The nominal face fails clearance. The supplied outline is within the face tolerance. - if terminal == "start": - face_x, offset = 0, 0.8e-6 - keepout = box(0, 7, 10 - clearance + 0.4e-6, 13) - else: - face_x, offset = 80, -0.8e-6 - keepout = box(90 + clearance - 0.4e-6, 47, 100, 53) - polygon = Polygon([(x + offset if x == face_x else x, y) for x, y in _sbend_strip(40).exterior.coords]) - outline = SBendOutline(40, 50, 2, polygon) - net = NetSpec("shift", Port(10, 10, 0), Port(90, 50, 0), width=2) - problem = RoutingProblem( - (0, 0, 100, 100), (net,), (keepout,), initial_paths={net.net_id: PathSeed((SBendSeed(40, 50),))}, clearance=clearance, - ) - options = RoutingOptions( - search=SearchOptions(node_limit=0, bend_radii=(), sbend_radii=(50,), sbend_outlines=(outline,)), - topology=TopologyOptions(mode=mode), - ) - callbacks = [] - - run = route(problem, options=options, iteration_callback=lambda _, results: callbacks.append(results[net.net_id])) - result = run.results_by_net[net.net_id] - - assert result.locked_geometry[0].distance(keepout) > clearance - assert result.is_valid - assert result.report.terminal_error is None - assert len(callbacks) == 1 - assert callbacks[0].report == result.report - active_options = replace(options, search=replace(options.search, node_limit=30)) - active = route(replace(problem, initial_paths={}), options=active_options).results_by_net[net.net_id] - assert active.is_valid - assert active.as_seed() == result.as_seed() - assert active.locked_geometry == result.locked_geometry - - -def test_search_checks_materialized_quarter_turn_face() -> None: - bend = Bend90.generate(Port(0, 0, 0), 20, 2, "CCW") - polygon = Polygon([(0.8e-6 if x == 0 else x, y - 20) for x, y in bend.physical_geometry[0].exterior.coords]) - net = NetSpec("corner", Port(10, 10, 0), Port(30, 30, 90)) - keepout = box(0, 7, 9.9000004, 13) - problem = RoutingProblem((0, 0, 50, 50), (net,), (keepout,), clearance=0.1) - options = RoutingOptions(search=SearchOptions(node_limit=30, bend_radii=(20,), sbend_radii=(), bend_physical_geometry=polygon)) - - result = route(problem, options=options).results_by_net[net.net_id] - - assert result.is_valid - assert result.as_seed() == PathSeed((Bend90Seed(20, "CCW"),)) - - -def test_custom_sbend_outline_rejects_duplicate_and_ambiguous_widths() -> None: - outline = SBendOutline(40, 50, 0.3, _sbend_strip(40, half_width=0.15)) - with pytest.raises(ValueError, match="Duplicate S-bend outline"): - SearchOptions(sbend_radii=(50,), sbend_outlines=(outline, replace(outline, width=0.1 + 0.2))) - other = replace(outline, width=0.3 * (1 + 1.5e-12)) - options = SearchOptions(sbend_radii=(50,), sbend_outlines=(outline, other)) - with pytest.raises(ValueError, match="Ambiguous S-bend outlines"): - options.sbend_outline(40, 50, (outline.width + other.width) / 2) - - -@pytest.mark.parametrize("contact", ["face", "rounding", "gap", "extra_edge", "extra_point"]) -@pytest.mark.parametrize("heading", [0, 90]) -def test_custom_sbend_join_checks_actual_centered_face(contact, heading) -> None: - left, right = _sbend_strip(40), _sbend_strip(-40) - if contact in ("rounding", "gap"): - shift = 0.25e-6 if contact == "rounding" else 0.75e-6 - left, right = translate(left, -shift), translate(right, shift) - if contact in ("extra_edge", "extra_point"): - left = left.union(box(70, 36, 74, 51)).union(box(73, 49, 80, 51)) - tip = box(0, 9, 7, 11) if contact == "extra_edge" else Polygon([(0, 50 - 40), (7, 9), (7, 11)]) - right = right.union(box(6, -3, 8, 11)).union(tip) - start = Port(20, 30, 0) if heading == 0 else Port(100, 20, 90) - finish = Port(180, 30, 0) if heading == 0 else Port(100, 180, 90) - net = NetSpec("shift", start, finish) - seed = PathSeed((SBendSeed(40, 50), SBendSeed(-40, 50))) - problem = RoutingProblem((0, 0, 220, 220), (net,), initial_paths={"shift": seed}, clearance=0) - options = RoutingOptions(search=SearchOptions( - node_limit=0, sbend_radii=(50,), - sbend_outlines=(SBendOutline(40, 50, 2, left), SBendOutline(-40, 50, 2, right)), - )) - - result = route(problem, options=options).results_by_net["shift"] - - assert result.reached_target - assert result.report.discontinuous == (contact == "gap") - assert result.report.self_collision_count == int(contact in ("extra_edge", "extra_point")) - assert result.is_valid == (contact in ("face", "rounding")) - - -def test_custom_sbend_width_is_measured_over_the_whole_port_face() -> None: - with pytest.raises(ValueError, match="port faces of width"): - SBendOutline(40, 50, 2, _sbend_strip(40, half_width=0.01)) - - outline = Polygon([(0, -1), (20, -2), (80, 39), (80, 40), (80, 41), (20, 5), (0, 1), (0, 0)]) - assert SBendOutline(40, 50, 2, outline).polygon == outline - - -@pytest.mark.parametrize("width", [2, 4]) -@pytest.mark.parametrize("node_limit", [0, 100]) -def test_custom_quarter_turn_requires_the_net_width_at_its_faces(width, node_limit) -> None: - outline = box(0, -11, 11, -9).union(box(9, -11, 11, 0)) - net = NetSpec("bend", Port(10, 20, 0), Port(30, 40, 90), width) - seed = PathSeed((StraightSeed(10), Bend90Seed(10, "CCW"), StraightSeed(10))) - problem = RoutingProblem((0, 0, 100, 100), (net,), initial_paths={} if node_limit else {"bend": seed}, clearance=0) - options = RoutingOptions( - search=SearchOptions(node_limit=node_limit, bend_radii=(10,), sbend_radii=(), bend_physical_geometry=outline), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode="off"), - ) - - result = route(problem, options=options).results_by_net["bend"] - - assert result.is_valid == (width == 2) - if node_limit == 0: - assert result.report.discontinuous == (width == 4) - - -def test_custom_quarter_turn_outline_leaves_circular_sbends_available() -> None: - net = NetSpec("shift", Port(30, 50, 0), Port(110, 90, 0)) - seed = PathSeed((SBendSeed(40, 50),)) - problem = RoutingProblem((0, 0, 160, 160), (net,), initial_paths={"shift": seed}) - options = RoutingOptions(search=SearchOptions(node_limit=0, sbend_radii=(50,), bend_physical_geometry=box(0, -11, 11, 0))) - - result = route(problem, options=options).results_by_net["shift"] - - assert result.is_valid - assert result.locked_geometry == SBend.generate(net.start, 40, 50, 2).physical_geometry - - -def test_route_verification_rejects_self_contact_away_from_a_join() -> None: - net = NetSpec("fold", Port(10, 10, 0), Port(10, 12, 180)) - turn = Bend90Seed(1, "CCW") - seed = PathSeed((StraightSeed(20), turn, turn, StraightSeed(20))) - problem = RoutingProblem((0, 0, 100, 100), (net,), initial_paths={"fold": seed}, clearance=0) - options = RoutingOptions( - search=SearchOptions(node_limit=0, bend_radii=(1,)), - congestion=CongestionOptions(max_iterations=1), - ) - - result = route(problem, options=options).results_by_net["fold"] - - assert result.locked_geometry[0].intersection(result.locked_geometry[-1]).length == 20 - assert result.reached_target - assert result.outcome == "colliding" - assert result.report.self_collision_count > 0 - assert not result.report.discontinuous - - @pytest.mark.parametrize("mode", ["automatic", "off", "guide", "seed"]) @pytest.mark.parametrize(("seed_length", "grid_length"), [(0.2, 1), (19.5, 20), (19.75, 20), (20.49, 20)]) def test_fractional_straight_seed_uses_grid_length(mode, seed_length, grid_length) -> None: @@ -552,365 +307,6 @@ def test_no_iterations_skips_seed_preparation(mode, monkeypatch) -> None: assert run.metrics.nodes_expanded == run.metrics.warm_start_paths_built == 0 -@pytest.mark.parametrize("mode", ["guide", "seed"]) -def test_zero_search_budget_verifies_seeds_without_triangulation(mode, monkeypatch) -> None: - monkeypatch.delattr(shapely, "constrained_delaunay_triangles", raising=False) - net = NetSpec("line", Port(10, 50, 0), Port(90, 50, 0)) - problem = RoutingProblem((0, 0, 100, 100), (net,), initial_paths={"line": PathSeed((StraightSeed(80),))}) - options = RoutingOptions( - search=SearchOptions(node_limit=0), congestion=CongestionOptions(max_iterations=1), topology=TopologyOptions(mode=mode), - ) - - run = route(problem, options=options) - - assert run.results_by_net["line"].is_valid - assert run.metrics.nodes_expanded == 0 - assert run.metrics.verify_path_report_calls == 1 - - -@pytest.mark.parametrize("mode", ["automatic", "off", "guide", "seed"]) -@pytest.mark.parametrize("rounds", [1, 10]) -def test_verify_only_retains_colliding_seeds_and_final_trace(mode, rounds, monkeypatch) -> None: - nets = ( - NetSpec("horizontal", Port(10, 50, 0), Port(90, 50, 0)), - NetSpec("vertical", Port(50, 10, 90), Port(50, 90, 90)), - NetSpec("partial", Port(10, 80, 0), Port(90, 80, 0)), - NetSpec("unseeded", Port(10, 90, 0), Port(90, 90, 0)), - ) - seeds = {net.net_id: PathSeed((StraightSeed(80),)) for net in nets[:2]} - seeds["partial"] = PathSeed((StraightSeed(40),)) - problem = RoutingProblem((0, 0, 100, 100), nets, (box(20, 77, 25, 82),), initial_paths=seeds) - options = RoutingOptions( - search=SearchOptions(node_limit=0), - congestion=CongestionOptions(max_iterations=rounds), - diagnostics=DiagnosticsOptions(capture_conflict_trace=True), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode=mode), - ) - - def fail_on_proximity(*_args): - pytest.fail("Geometry-only verification built a proximity map") - - monkeypatch.setattr(DangerMap, "precompute", fail_on_proximity) - callbacks = [] - run = route(problem, options=options) - with_callback = route(problem, options=options, iteration_callback=lambda index, results: callbacks.append((index, results))) - - for net in nets[:2]: - result = run.results_by_net[net.net_id] - assert result.as_seed() == seeds[net.net_id] - assert result.outcome == "colliding" - assert result.report.dynamic_collision_count == 1 - assert run.results_by_net["partial"].outcome == "partial" - assert run.results_by_net["partial"].report.total_length == 40 - assert run.results_by_net["partial"].report.static_collision_count == 1 - assert run.results_by_net["unseeded"].outcome == "unroutable" - iteration, restored, final = run.conflict_trace - assert (iteration.stage, restored.stage, final.stage) == ("iteration", "restored_best", "final") - assert iteration.conflict_edges == restored.conflict_edges == final.conflict_edges == (("horizontal", "vertical"),) - for traced_net in final.nets[:2]: - assert traced_net.component_conflicts - assert traced_net == next(net for net in iteration.nets if net.net_id == traced_net.net_id) - assert traced_net == next(net for net in restored.nets if net.net_id == traced_net.net_id) - assert run.metrics.nodes_expanded == 0 - assert run.metrics.route_iterations == 1 - assert run.metrics.verify_path_report_calls == 3 - assert run.metrics.verify_static_buffer_ops == 3 - assert run.metrics.verify_dynamic_exact_pair_checks == 2 - assert callbacks == [(0, run.results_by_net)] - assert with_callback.results_by_net == run.results_by_net - assert with_callback.metrics.verify_path_report_calls == run.metrics.verify_path_report_calls - - -@pytest.mark.parametrize("mode", ["automatic", "off", "guide", "seed"]) -@pytest.mark.parametrize("move", [Bend90Seed(10, "CCW"), SBendSeed(6, 10)]) -def test_verify_only_reports_width_incompatible_seed_segments(mode, move) -> None: - net = NetSpec("wide", Port(20, 30, 0), Port(30, 40, 90), width=30) - peer = NetSpec("peer", Port(20, 80, 0), Port(70, 80, 0)) - seeds = {"wide": PathSeed((move,)), "peer": PathSeed((StraightSeed(50),))} - problem = RoutingProblem((0, 0, 100, 100), (net, peer), initial_paths=seeds) - options = RoutingOptions( - search=SearchOptions(node_limit=0, bend_radii=(10,), sbend_radii=(10,)), - topology=TopologyOptions(mode=mode), - ) - - callbacks = [] - results = route(problem, options=options, iteration_callback=lambda _, current: callbacks.append(current["wide"].report)).results_by_net - - assert results["peer"].is_valid - report = results["wide"].report - assert report.invalid_geometry - assert report.seed_error == f"Initial path for 'wide' segment 1 ({type(move).__name__}) needs radius at least 15, got 10" - assert callbacks == [report] - - -def test_active_search_can_recover_from_width_incompatible_seed() -> None: - net = NetSpec("wide", Port(20, 30, 0), Port(70, 30, 0), width=30) - problem = RoutingProblem((0, 0, 100, 100), (net,), initial_paths={"wide": PathSeed((Bend90Seed(10, "CCW"),))}) - options = RoutingOptions(search=SearchOptions(node_limit=10, bend_radii=(10,)), topology=TopologyOptions(mode="off")) - - result = route(problem, options=options).results_by_net["wide"] - - assert result.is_valid - assert result.report.seed_error is not None - assert result.as_seed() == PathSeed((StraightSeed(50),)) - - -@pytest.mark.parametrize("rotation", [0, 90, 180, 270]) -def test_lattice_heading_heuristic_is_cardinally_invariant(rotation) -> None: - origin = (60, 60) - start = Port(8, 60, 0).rotated(rotation, origin) - target = Port(112, 101, 0).rotated(rotation, origin) - keepouts = tuple(rotate(polygon, rotation, origin=origin) for polygon in (box(87, 48, 99, 71), box(28, 84, 47, 107))) - problem = RoutingProblem((0, 0, 120, 120), (NetSpec("turn", start, target, 1.75),), keepouts, clearance=1.25) - options = RoutingOptions( - search=SearchOptions(node_limit=50, bend_radii=(10,), sbend_radii=()), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - - assert run.results_by_net["turn"].is_valid - assert run.metrics.nodes_expanded == 17 - - -@pytest.mark.parametrize("price", [0.001, 1, 1000, 1e12]) -def test_lattice_length_cost_units_preserve_search_order(price) -> None: - net = NetSpec("turn", Port(15, 40, 0), Port(165, 80, 0)) - problem = RoutingProblem((0, 0, 190, 100), (net,), (box(63, 7, 85, 55),)) - options = RoutingOptions( - search=SearchOptions(node_limit=32, min_straight_length=2, bend_radii=(10,), sbend_radii=()), - objective=ObjectiveWeights(price, 0, 0, 0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - - assert run.results_by_net["turn"].is_valid - assert run.metrics.nodes_expanded == 12 - - -@pytest.mark.parametrize(("heuristic", "price"), [(1.5, 1), (0, 1), (1.5, 0)]) -def test_partial_path_tracks_geometric_progress_without_cost_heuristic(heuristic, price) -> None: - net = NetSpec("across", Port(5, 20, 0), Port(90, 20, 0)) - problem = RoutingProblem((0, 0, 100, 40), (net,), (box(45, 0, 55, 40),)) - options = RoutingOptions( - search=SearchOptions(node_limit=5, greedy_h_weight=heuristic, bend_radii=(), sbend_radii=()), - objective=ObjectiveWeights(price, 0, 0, 0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - - assert run.results_by_net["across"].outcome == "partial" - - -@pytest.mark.parametrize("coordinates", [(30, 20), (30.4, 20.4), (101, 20)]) -def test_coincident_ports_report_an_explicit_input_error(coordinates) -> None: - x, y = coordinates - net = NetSpec("abutting", Port(round(x), round(y), 0), Port(x, y, 0)) - problem = RoutingProblem((0, 0, 100, 100), (net,)) - with pytest.raises(ValueError, match="'abutting' has coincident ports"): - route(problem) - - -@pytest.mark.parametrize("mode", ["off", "automatic"]) -@pytest.mark.parametrize(("target_x", "blocked", "message"), [ - (302, False, "face extends outside the routing board"), - (280, True, "face violates keepout clearance"), - (300, False, None), -]) -def test_invalid_terminal_faces_are_reported_without_search(mode, target_x, blocked, message) -> None: - nets = ( - NetSpec("bad", Port(10, 80, 0), Port(target_x, 80, 0)), - NetSpec("peer", Port(10, 120, 0), Port(80, 120, 0)), - ) - keepouts = (box(275, 75, 285, 85),) if blocked else () - problem = RoutingProblem((0, 0, 300, 160), nets, keepouts) - options = RoutingOptions( - search=SearchOptions(node_limit=600, bend_radii=(20,)), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode=mode), - ) - - run = route(problem, options=options) - - bad = run.results_by_net["bad"] - assert run.results_by_net["peer"].is_valid - assert bad.is_valid == (message is None) - assert run.metrics.nodes_expanded < 10 - if message is None: - assert bad.report.terminal_error is None - else: - assert bad.report.terminal_error == f"target port {(target_x, 80, 0)} {message}" - - -def test_keepout_clearance_at_face_and_opposite_coincident_headings() -> None: - net = NetSpec("return", Port(50, 50, 0), Port(50, 50, 180)) - problem = RoutingProblem((0, 0, 100, 100), (net,), (box(30, 53, 70, 60),)) - options = RoutingOptions(search=SearchOptions(node_limit=0), topology=TopologyOptions(mode="off")) - - result = route(problem, options=options).results_by_net["return"] - - assert result.report.terminal_error is None - assert result.outcome == "unroutable" - - -@pytest.mark.parametrize(("radius", "spacing", "valid"), [(2, 0, True), (2, 4, False), (3, 4, True)]) -def test_same_net_clearance_preserves_join_and_checks_separated_path(radius, spacing, valid) -> None: - net = NetSpec("fold", Port(10, 20, 0), Port(10, 20 + 2 * radius, 180)) - seed = PathSeed((StraightSeed(25), Bend90Seed(radius, "CCW"), Bend90Seed(radius, "CCW"), StraightSeed(25))) - problem = RoutingProblem((0, 0, 100, 50), (net,), initial_paths={"fold": seed}, self_clearance=spacing) - options = RoutingOptions(search=SearchOptions(node_limit=0, bend_radii=(radius,))) - - result = route(problem, options=options).results_by_net["fold"] - - assert result.is_valid is valid - assert not result.report.discontinuous - if not valid: - assert result.report.self_collision_count > 0 - - -@pytest.mark.parametrize(("start_x", "y", "collides"), [(10, 22, True), (40, 22, True), (40, 23, False)]) -def test_zero_clearance_forbids_inter_net_contact_but_allows_keepout_edges(start_x, y, collides) -> None: - nets = ( - NetSpec("first", Port(10, 20, 0), Port(40, 20, 0)), - NetSpec("second", Port(start_x, y, 0), Port(90, y, 0)), - ) - seeds = {"first": PathSeed((StraightSeed(30),)), "second": PathSeed((StraightSeed(90 - start_x),))} - problem = RoutingProblem((0, 0, 100, 50), nets, (box(10, 15, 40, 19),), initial_paths=seeds, clearance=0) - - results = route(problem, options=RoutingOptions(search=SearchOptions(node_limit=0))).results_by_net - - assert [result.report.static_collision_count for result in results.values()] == [0, 0] - assert [result.report.dynamic_collision_count for result in results.values()] == [int(collides), int(collides)] - - -def test_automatic_residual_cannot_touch_a_locked_distinct_net_at_zero_clearance() -> None: - nets = ( - NetSpec("first", Port(10, 20, 0), Port(80, 20, 0)), - NetSpec("second", Port(10, 22, 0), Port(80, 22, 0)), - ) - problem = RoutingProblem((0, 0, 100, 50), nets, clearance=0) - options = RoutingOptions( - search=SearchOptions(node_limit=30, bend_radii=(), sbend_radii=()), - refinement=RefinementOptions(enabled=False), - ) - - results = route(problem, options=options).results_by_net - - assert sum(result.is_valid for result in results.values()) == 1 - - -def test_zero_clearance_search_counts_physical_congestion_work() -> None: - nets = ( - NetSpec("horizontal", Port(10, 50, 0), Port(90, 50, 0)), - NetSpec("vertical", Port(50, 10, 90), Port(50, 90, 90)), - ) - problem = RoutingProblem((0, 0, 100, 100), nets, clearance=0) - options = RoutingOptions( - search=SearchOptions(node_limit=20, bend_radii=(), sbend_radii=()), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - diagnostics=DiagnosticsOptions(capture_iteration_trace=True), - ) - - run = route(problem, options=options) - - assert run.metrics.congestion_check_calls >= 2 - assert run.metrics.congestion_candidate_ids >= run.metrics.congestion_exact_pair_checks > 0 - assert run.iteration_trace[0].congestion_check_calls == run.metrics.congestion_check_calls - assert run.iteration_trace[0].congestion_exact_pair_checks == run.metrics.congestion_exact_pair_checks - - -@pytest.mark.parametrize("mode", ["off", "automatic"]) -@pytest.mark.parametrize("node_limit", [0, 10]) -@pytest.mark.parametrize("move", [Bend90Seed(1e11, "CCW"), SBendSeed(1e11, 1e11)]) -def test_unsafe_seed_reports_segment_without_allocating_geometry(monkeypatch, mode, node_limit, move) -> None: - def unexpected_tessellation(*_args, **_kwargs): - pytest.fail("Oversized seed reached the tessellator") - - monkeypatch.setattr(components_module, "_get_arc_polygons", unexpected_tessellation) - monkeypatch.setattr(SBend, "_arcs", unexpected_tessellation) - net = NetSpec("track", Port(10, 20, 0), Port(90, 20, 0)) - problem = RoutingProblem((0, 0, 100, 50), (net,), initial_paths={net.net_id: PathSeed((move,))}) - options = RoutingOptions( - search=SearchOptions(node_limit=node_limit, bend_radii=(1e11,), sbend_radii=(1e11,), sbend_offsets=(1e11,)), - topology=TopologyOptions(mode=mode), - refinement=RefinementOptions(enabled=False), - diagnostics=DiagnosticsOptions(capture_conflict_trace=True), - ) - - run = route(problem, options=options) - result = run.results_by_net[net.net_id] - - assert result.is_valid is bool(node_limit) - assert result.report.seed_error == ( - f"Initial path for 'track' segment 1 ({type(move).__name__}) exceeds 250,000 subdivisions for one circular arc" - ) - assert run.conflict_trace[-1].nets[0].report.seed_error == result.report.seed_error - - -def test_search_rejects_out_of_board_bends_before_tessellation(monkeypatch) -> None: - def unexpected_tessellation(*_args, **_kwargs): - pytest.fail("Search tessellated a bend with an endpoint outside the board") - - monkeypatch.setattr(components_module, "_get_num_segments", unexpected_tessellation) - problem = RoutingProblem((0, 0, 100, 50), (NetSpec("straight", Port(10, 20, 0), Port(90, 20, 0)),)) - options = RoutingOptions( - search=SearchOptions(node_limit=10, bend_radii=(1e11,), sbend_radii=(1e11,), sbend_offsets=(1,), visibility_guidance="off"), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - assert route(problem, options=options).results_by_net["straight"].is_valid - - -@pytest.mark.parametrize(("second_x", "y", "valid"), [(53, 25, True), (52, 25, False), (50, 26, True)]) -def test_guide_admits_moves_using_physical_inter_net_clearance(second_x, y, valid) -> None: - nets = ( - NetSpec("first", Port(10, 20, 0), Port(50, 20, 0)), - NetSpec("second", Port(second_x, y, 0), Port(90, y, 0)), - ) - problem = RoutingProblem((0, 0, 100, 50), nets, clearance=4) - options = RoutingOptions( - search=SearchOptions(node_limit=50, bend_radii=(), sbend_radii=(), visibility_guidance="off"), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="guide"), - ) - - results = route(problem, options=options).results_by_net - - assert results["first"].is_valid - assert results["second"].is_valid is valid - - -def test_automatic_falls_back_to_lattice_when_corridor_search_is_unavailable(monkeypatch) -> None: - monkeypatch.delattr(shapely, "constrained_delaunay_triangles", raising=False) - net = NetSpec("line", Port(10, 50, 0), Port(90, 50, 0)) - problem = RoutingProblem((0, 0, 100, 100), (net,)) - options = RoutingOptions(search=SearchOptions(bend_radii=(), sbend_radii=()), refinement=RefinementOptions(enabled=False)) - - run = route(problem, options=options) - - assert run.results_by_net["line"].is_valid - assert run.automatic is not None - assert run.automatic.stages[run.automatic.selected_stage].kind == "lattice-fallback" - - def test_automatic_final_conflict_trace_includes_direct_locks() -> None: problem = RoutingProblem( (0, 0, 100, 100), @@ -1011,184 +407,6 @@ def test_lattice_straight_can_run_along_a_keepout_at_clearance(y, gap, valid) -> assert route(problem, options=options).results_by_net["straight"].is_valid is valid -@pytest.mark.parametrize("mode", ["off", "guide", "seed"]) -@pytest.mark.parametrize( - ("obstacle", "valid"), - [(box(32, 16, 36, 24), True), (box(4, 16, 8, 24), True), (box(31.9, 16, 36, 24), False)], -) -def test_lattice_straight_uses_flat_port_faces_for_clearance(mode, obstacle, valid) -> None: - net = NetSpec("line", Port(10, 20, 0), Port(30, 20, 0)) - problem = RoutingProblem((0, 0, 60, 60), (net,), (obstacle,), clearance=2) - options = RoutingOptions( - search=SearchOptions(node_limit=100, bend_radii=(), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode=mode), - ) - - assert route(problem, options=options).results_by_net["line"].is_valid is valid - - -@pytest.mark.parametrize("min_length", [0, 0.5, 5]) -def test_lattice_can_launch_a_straight_before_a_bend_from_flat_port_face(min_length) -> None: - net = NetSpec("turn", Port(10, 20, 0), Port(50, 30, 90)) - problem = RoutingProblem((0, 15, 60, 32), (net,), (box(4, 16, 8, 24),), clearance=2) - options = RoutingOptions( - search=SearchOptions(node_limit=100, min_straight_length=min_length, bend_radii=(10,), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode="off"), - ) - - result = route(problem, options=options).results_by_net["turn"] - - assert result.is_valid - assert result.as_seed() == PathSeed((StraightSeed(30), Bend90Seed(10, "CCW"))) - - -def test_lattice_partial_path_leaves_crossing_net_valid() -> None: - blocked = NetSpec("blocked", Port(10, 100, 0), Port(170, 100, 0)) - through = NetSpec("through", Port(80, 40, 90), Port(80, 160, 90)) - problem = RoutingProblem((0, 0, 200, 200), (blocked, through), (box(125, 94, 145, 106),)) - options = RoutingOptions( - search=SearchOptions(node_limit=100, bend_radii=(), sbend_radii=()), - congestion=CongestionOptions(max_iterations=3, warm_start_enabled=False), - diagnostics=DiagnosticsOptions(capture_conflict_trace=True), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - partial, complete = run.results_by_net["blocked"], run.results_by_net["through"] - - assert partial.outcome == "partial" - assert partial.locked_geometry[0].intersects(complete.locked_geometry[0]) - assert complete.is_valid - assert all(entry.conflict_edges == () for entry in run.conflict_trace) - - -@pytest.mark.parametrize("reverse", [False, True]) -def test_invalid_seed_leaves_crossing_peer_valid(reverse) -> None: - blocked = NetSpec("blocked", Port(10, 100, 0), Port(170, 100, 0)) - through = NetSpec("through", Port(80, 40, 90), Port(80, 160, 90)) - nets = (through, blocked) if reverse else (blocked, through) - seeds = {"blocked": PathSeed((StraightSeed(160),)), "through": PathSeed((StraightSeed(120),))} - problem = RoutingProblem((0, 0, 200, 200), nets, (box(125, 94, 145, 106),), initial_paths=seeds) - options = RoutingOptions( - search=SearchOptions(node_limit=0), - congestion=CongestionOptions(max_iterations=1), - diagnostics=DiagnosticsOptions(capture_conflict_trace=True), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - - assert run.results_by_net["blocked"].report.static_collision_count == 1 - assert run.results_by_net["through"].is_valid - assert all(entry.conflict_edges == () for entry in run.conflict_trace) - - -def test_lattice_can_chain_straights_before_a_bend_under_scan_limit() -> None: - net = NetSpec("lead", Port(10, 20, 0), Port(80, 30, 90)) - problem = RoutingProblem((0, 15, 95, 32), (net,)) - options = RoutingOptions( - search=SearchOptions(node_limit=100, max_straight_length=10, bend_radii=(10,), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode="off"), - ) - - result = route(problem, options=options).results_by_net["lead"] - - assert result.is_valid - assert result.as_seed() == PathSeed((*(StraightSeed(10),) * 6, Bend90Seed(10, "CCW"))) - - -def test_lattice_can_turn_away_from_a_distant_target_to_leave_a_keepout() -> None: - net = NetSpec("detour", Port(300, 100, 0), Port(360, 350, 0)) - problem = RoutingProblem((0, 0, 450, 400), (net,), (box(319, 96, 390, 170),)) - options = RoutingOptions( - search=SearchOptions(node_limit=100, bend_radii=(20,), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode="off"), - ) - - result = route(problem, options=options).results_by_net["detour"] - - assert result.is_valid - assert result.as_seed().segments[0] == Bend90Seed(20, "CW") - - -@pytest.mark.parametrize("mode", ["off", "guide", "seed", "automatic"]) -def test_search_can_find_consecutive_sbends(mode) -> None: - net = NetSpec("double", Port(20, 20, 0), Port(48, 30, 0)) - problem = RoutingProblem((0, 0, 100, 100), (net,), clearance=0) - options = RoutingOptions( - search=SearchOptions(node_limit=100, bend_radii=(), sbend_radii=(10,), sbend_offsets=(5,)), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode=mode), - ) - - result = route(problem, options=options).results_by_net["double"] - - assert result.is_valid - assert result.as_seed() == PathSeed((SBendSeed(5, 10), SBendSeed(5, 10))) - - -def test_congestion_retry_includes_keepout_collision_alongside_peer_conflicts() -> None: - static = NetSpec("static", Port(20, 40, 0), Port(230, 40, 0)) - horizontal = NetSpec("horizontal", Port(20, 150, 0), Port(230, 150, 0)) - vertical = NetSpec("vertical", Port(140, 105, 90), Port(140, 235, 90)) - problem = RoutingProblem( - (0, 0, 260, 260), (static, horizontal, vertical), (box(80, 20, 100, 60),), clearance=0, - initial_paths={ - "static": PathSeed((StraightSeed(210),)), - "horizontal": PathSeed((StraightSeed(210),)), - "vertical": PathSeed((StraightSeed(130),)), - }, - ) - options = RoutingOptions( - search=SearchOptions(bend_radii=(5, 10), sbend_radii=(), node_limit=500), - congestion=CongestionOptions(max_iterations=2, warm_start_enabled=False), - refinement=RefinementOptions(enabled=False), - diagnostics=DiagnosticsOptions(capture_iteration_trace=True), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - - assert run.iteration_trace[0].conflict_edges == 1 - assert "static" in run.iteration_trace[1].routed_net_ids - assert run.results_by_net["static"].is_valid - - -def test_close_net_widths_use_distinct_keepout_trees() -> None: - narrow = NetSpec("narrow", Port(10, 20, 0), Port(90, 20, 0), width=2.00001) - wide = NetSpec("wide", Port(10, 60, 0), Port(90, 60, 0), width=2.00004) - problem = RoutingProblem((0, 0, 100, 100), (narrow, wide), (box(28, 21.00001, 75, 31),), clearance=0) - options = RoutingOptions( - search=SearchOptions(node_limit=40, bend_radii=(), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode="off"), - ) - - for candidate in (problem, replace(problem, nets=(wide, narrow))): - run = route(candidate, options=options) - assert all(result.is_valid for result in run.results_by_net.values()) - assert run.metrics.static_net_tree_rebuilds == 2 - - -def test_lattice_can_find_a_bend_with_diagonal_clearance_at_its_port() -> None: - net = NetSpec("turn", Port(20, 20, 0), Port(30, 30, 90)) - problem = RoutingProblem((0, 0, 100, 100), (net,), (box(16, 14, 19.25, 17.125),), clearance=2) - options = RoutingOptions( - search=SearchOptions(node_limit=100, bend_radii=(10,), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - topology=TopologyOptions(mode="off"), - ) - - result = route(problem, options=options).results_by_net["turn"] - - assert result.is_valid - assert result.as_seed() == PathSeed((Bend90Seed(10, "CCW"),)) - - @pytest.mark.parametrize("mode", ["automatic", "off", "guide", "seed"]) def test_fractional_quarter_turn_reaches_its_terminal_face(mode) -> None: problem = RoutingProblem((0, 0, 100, 100), nets=(NetSpec("bend", Port(20, 20, 0), Port(31, 31, 90)),)) @@ -1232,8 +450,7 @@ def test_route_verification_detects_physical_bend_overlap(mode, proxy) -> None: NetSpec("a", Port(50, 50, 0), Port(60, 60, 90)), NetSpec("b", Port(41, 54, 0), Port(51, 44, 270)), ) - seeds = {"a": PathSeed((Bend90Seed(10, "CCW"),)), "b": PathSeed((Bend90Seed(10, "CW"),))} - problem = RoutingProblem((0, 0, 120, 120), nets, initial_paths=seeds) + problem = RoutingProblem((0, 0, 120, 120), nets) search = SearchOptions(node_limit=100, bend_radii=(10,), bend_collision_type="clipped_bbox", bend_clip_margin=4) else: nets = ( @@ -1243,11 +460,10 @@ def test_route_verification_detects_physical_bend_overlap(mode, proxy) -> None: seed = PathSeed((Bend90Seed(10, "CCW"),)) problem = RoutingProblem((0, 0, 120, 120), nets, initial_paths={net.net_id: seed for net in nets}) bend_proxy = box(0, -11, 11, 0) - outline = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)]) - physical_bend = outline.union(box(10, -8, 13, -6)).union(box(12, -8, 14, 9)) + physical_bend = bend_proxy.union(box(-13, -11, 1, -9)).union(box(-13, -11, -11, 15)) search = SearchOptions(node_limit=20, bend_radii=(10,), bend_proxy_geometry=bend_proxy, bend_physical_geometry=physical_bend) options = RoutingOptions( - search=replace(search, node_limit=0), + search=search, congestion=CongestionOptions(max_iterations=1), diagnostics=DiagnosticsOptions(capture_conflict_trace=True), topology=TopologyOptions(mode=mode), @@ -1563,8 +779,7 @@ def test_capture_conflict_trace_records_component_pairs() -> None: assert trace_by_net["vertical"].component_conflicts[0].other_component_index == 0 -@pytest.mark.parametrize("replay", [False, True]) -def test_capture_frontier_trace_preserves_route_outputs(replay) -> None: +def test_capture_frontier_trace_preserves_route_outputs() -> None: problem = RoutingProblem( bounds=(0, 0, 100, 100), nets=( @@ -1577,14 +792,16 @@ def test_capture_frontier_trace_preserves_route_outputs(replay) -> None: refinement=RefinementOptions(enabled=False), topology=TopologyOptions(mode="off"), ) - if replay: - problem = replace(problem, initial_paths={net.net_id: PathSeed((StraightSeed(80),)) for net in problem.nets}) - base_options = replace(base_options, search=replace(base_options.search, node_limit=0)) run_without_trace = route(problem, options=base_options) run_with_trace = route( problem, - options=replace(base_options, diagnostics=DiagnosticsOptions(capture_frontier_trace=True)), + options=RoutingOptions( + congestion=base_options.congestion, + refinement=base_options.refinement, + diagnostics=DiagnosticsOptions(capture_frontier_trace=True), + topology=base_options.topology, + ), ) assert {net_id: result.outcome for net_id, result in run_without_trace.results_by_net.items()} == { @@ -1733,37 +950,6 @@ def test_reverify_iterations_limit_late_reroutes_to_conflicting_nets(monkeypatch assert results["netC"].reached_target -def test_routing_attempts_reserve_an_index_for_a_timed_out_worker(monkeypatch) -> None: - net = NetSpec("track", Port(10, 20, 0), Port(90, 20, 0)) - problem = RoutingProblem( - (0, 0, 100, 50), (net,), initial_paths={net.net_id: PathSeed((StraightSeed(80),))}, - ) - options = RoutingOptions( - search=SearchOptions(node_limit=0), - topology=TopologyOptions(mode="off"), - diagnostics=DiagnosticsOptions(capture_iteration_trace=True, capture_conflict_trace=True), - ) - callbacks = [] - - def expired(finder, state): - if finder.metrics.total_route_iterations: - state.timed_out = True - finder.metrics.total_timeout_events = 1 - return state.timed_out - - attempts = RoutingAttempts(lambda index, _: callbacks.append(index)) - with monkeypatch.context() as patch: - patch.setattr(PathFinder, "_expired", expired) - timed_out = attempts.run(problem, options=options) - selected = attempts.run(problem, options=options) - - assert timed_out.metrics.timeout_events == 1 - assert attempts.metrics().route_iterations == 2 - assert callbacks == [1] - assert [entry.iteration for entry in selected.iteration_trace] == [1] - assert [entry.iteration for entry in selected.conflict_trace if entry.stage == "iteration"] == [1] - - def test_run_iteration_orders_subset_reroutes_by_recent_work(monkeypatch: pytest.MonkeyPatch) -> None: problem = RoutingProblem( bounds=(0, 0, 100, 100), @@ -1784,11 +970,10 @@ def test_run_iteration_orders_subset_reroutes_by_recent_work(monkeypatch: pytest route_order: list[str] = [] def fake_route_net_once(self, state, iteration, net_id, *, node_limit_override=None, incumbent_fallback=None): + _ = self _ = state _ = iteration route_order.append(net_id) - self.metrics.reroute_work += 200 if net_id == "netA" else 20 - self.metrics.total_congestion_check_calls += 1000 if net_id == "netB" else 0 assert node_limit_override is None assert incumbent_fallback is None return RoutingResult(net_id=net_id, path=(), reached_target=False), False @@ -1810,9 +995,6 @@ def test_run_iteration_orders_subset_reroutes_by_recent_work(monkeypatch: pytest assert review is not None assert route_order == ["netB", "netA"] - assert state.recent_attempt_work == {"netA": 200, "netB": 20} - pathfinder._run_iteration(state, 2, {"netA", "netB"}, None) - assert route_order == ["netB", "netA", "netB", "netA"] def test_run_iteration_caps_two_heaviest_late_phase_nets(monkeypatch: pytest.MonkeyPatch) -> None: @@ -1898,12 +1080,12 @@ def test_route_net_once_skips_search_for_capped_incumbent_fallback(monkeypatch: def fail_route_astar(*_args, **_kwargs): raise AssertionError("route_astar should not run for capped incumbent fallback") - def record_added_route(self, net_id, path): + def record_install(self, net_id, path): _ = self installed.append((net_id, tuple(path))) monkeypatch.setattr(router_module, "route_astar", fail_route_astar) - monkeypatch.setattr(PathFinder, "_add_route", record_added_route) + monkeypatch.setattr(PathFinder, "_install_path", record_install) result, guidance_seed_present = pathfinder._route_net_once( state, @@ -2032,7 +1214,7 @@ def test_rejected_pair_keeps_original_index_for_reverse_attempt(monkeypatch: pyt state = finder._prepare_state() for net in problem.nets: path = (Straight.generate(net.start, 80, net.width, dilation=1.0),) - finder._add_route(net.net_id, path) + 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) @@ -2090,7 +1272,7 @@ def test_route_all_restores_best_iteration_snapshot_on_timeout(monkeypatch: pyte total_dynamic_collisions=0, ), ) - state.best_is_indexed = True + state.best_is_installed = True state.results = {"netA": worse_result} return True @@ -2103,38 +1285,6 @@ def test_route_all_restores_best_iteration_snapshot_on_timeout(monkeypatch: pyte assert evaluator.collision_engine.has_dynamic_paths() -@pytest.mark.parametrize("during", ["preparation", "search"]) -def test_worker_checks_timeout_inside_single_net_attempt(during, monkeypatch) -> None: - clock = [0.0] - monkeypatch.setattr(router_module.time, "monotonic", lambda: clock[0]) - problem = RoutingProblem((0, 0, 100, 100), (NetSpec("line", Port(10, 50, 0), Port(90, 50, 0)),)) - options = RoutingOptions( - search=SearchOptions(node_limit=100), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - if during == "preparation": - def expire_during_preparation(*_args): - clock[0] = 61.0 - - monkeypatch.setattr(PathFinder, "_prepare_topology", expire_during_preparation) - else: - original_expand = search_module._expand_moves - - def expire_during_search(*args, **kwargs): - original_expand(*args, **kwargs) - clock[0] = 61.0 - - monkeypatch.setattr(search_module, "_expand_moves", expire_during_search) - - result = route(problem, options=options) - - assert result.metrics.timeout_events == 1 - assert result.metrics.nodes_expanded == int(during == "search") - assert not result.results_by_net["line"].is_valid - - def test_capture_conflict_trace_records_restored_best_stage(monkeypatch: pytest.MonkeyPatch) -> None: problem = RoutingProblem( bounds=(0, 0, 100, 100), diff --git a/inire/tests/test_astar.py b/inire/tests/test_astar.py index 8a8af6b..1232d0c 100644 --- a/inire/tests/test_astar.py +++ b/inire/tests/test_astar.py @@ -6,7 +6,6 @@ from inire import CongestionOptions, NetSpec, ObjectiveWeights, RefinementOption from inire.geometry.components import Bend90, Straight from inire.geometry.collision import RoutingWorld from inire.geometry.primitives import Port -from inire.router import _astar_moves from inire.router._astar_types import AStarContext, AStarNode, CongestionCaches, SearchRunConfig from inire.router._astar_admission import add_node from inire.router._astar_moves import ( @@ -251,30 +250,6 @@ def test_should_cap_straights_to_bounds_only_for_large_no_warm_runs(basic_evalua assert not _should_cap_straights_to_bounds(small_context) -def test_equal_cost_arrivals_can_propose_different_straights(monkeypatch) -> None: - start, target = Port(5, 20, 0), Port(35, 20, 0) - problem = RoutingProblem((0, 0, 100, 50), (NetSpec("track", start, target),)) - options = _build_options(max_straight_length=50, min_straight_length=2, bend_radii=(), sbend_radii=()) - context = build_routing_stack(problem, options).context - config = SearchRunConfig.from_options(options) - root = AStarNode(start, 0, 0) - direct = Straight.generate(start, 20, 2) - first_short = Straight.generate(start, 15, 2) - second_short = Straight.generate(first_short.end_port, 5, 2) - intermediate = AStarNode(first_short.end_port, 15, 0, parent=root, component_result=first_short) - long_arrival = AStarNode(direct.end_port, 20, 0, parent=root, component_result=direct) - short_arrival = AStarNode(second_short.end_port, 20, 0, parent=intermediate, component_result=second_short) - assert long_arrival.port == short_arrival.port - assert long_arrival.g_cost == short_arrival.g_cost - - proposals = [] - monkeypatch.setattr(_astar_moves, "process_move", lambda *args: proposals.append(args[-2:])) - for node, offers_target in ((long_arrival, True), (short_arrival, False)): - proposals.clear() - _astar_moves.expand_moves(node, target, 2, "track", [], {}, context, context.metrics, CongestionCaches(), config, None) - assert (("straight", (10,)) in proposals) is offers_target - - def test_pair_local_context_clones_live_static_obstacles() -> None: obstacle = Polygon([(20, -20), (40, -20), (40, 20), (20, 20)]) engine = RoutingWorld(clearance=2.0) @@ -291,7 +266,7 @@ def test_pair_local_context_clones_live_static_obstacles() -> None: ) context = AStarContext(evaluator, problem, RoutingOptions()) - local_context = _build_pair_local_context(context, problem.nets, {}, ("pair_a", "pair_b")) + local_context = _build_pair_local_context(context, problem.nets, {}, ("pair_a", "pair_b"), lock_partial_paths=True) assert context.problem.static_obstacles == () assert len(local_context.problem.static_obstacles) == 1 @@ -312,7 +287,7 @@ def test_worker_samples_proximity_only_for_objectives_it_uses(search_danger, ref 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")) + 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) @@ -411,7 +386,7 @@ def test_route_astar_supports_all_visibility_guidance_modes( assert validation["connectivity_ok"] -def test_tangent_corner_mode_uses_only_tangent_queries(basic_evaluator: CostEvaluator) -> None: +def test_tangent_corner_mode_avoids_exact_visibility_graph_builds(basic_evaluator: CostEvaluator) -> None: obstacle = Polygon([(30, 10), (50, 10), (50, 40), (30, 40)]) basic_evaluator.collision_engine.add_static_obstacle(obstacle) basic_evaluator.danger_map.precompute([obstacle]) @@ -427,9 +402,9 @@ def test_tangent_corner_mode_uses_only_tangent_queries(basic_evaluator: CostEval path = _route(context, Port(0, 0, 0), Port(80, 50, 0)) assert path is not None - assert context.metrics.total_visibility_tangent_candidate_scans > 0 - assert context.metrics.total_visibility_corner_queries_exact == 0 - assert context.metrics.total_visibility_point_queries == 0 + assert context.metrics.total_visibility_builds == 0 + assert context.metrics.total_visibility_corner_pairs_checked == 0 + assert context.metrics.total_ray_cast_calls_visibility_build == 0 def test_route_astar_repeated_searches_succeed_with_small_cache_limit(basic_evaluator: CostEvaluator) -> None: @@ -449,9 +424,6 @@ def test_route_astar_repeated_searches_succeed_with_small_cache_limit(basic_eval path = _route(context, start, target) assert path is not None assert path[-1].end_port == target - assert len(context.move_cache_abs) <= 2 - assert len(context.move_cache_rel) <= 2 - assert context.hard_collision_set | context.static_safe_cache <= context.move_cache_abs.keys() def test_self_collision_prunes_before_congestion_check(basic_evaluator: CostEvaluator) -> None: @@ -466,6 +438,7 @@ def test_self_collision_prunes_before_congestion_check(basic_evaluator: CostEval parent, parent_result, target=Port(20, 0, 0), + net_width=2.0, net_id="netA", open_set=open_set, closed_set=closed_set, @@ -493,6 +466,7 @@ def test_closed_set_dominance_prunes_before_congestion_check(basic_evaluator: Co root, result, target=Port(20, 0, 0), + net_width=2.0, net_id="netA", open_set=open_set, closed_set=closed_set, @@ -521,6 +495,7 @@ def test_closed_set_keeps_cheaper_weighted_or_guided_move(length_weight, guidanc root, move, target=Port(20, 0, 0), + net_width=2.0, net_id="netA", open_set=open_set, closed_set={move.end_port.as_tuple(): 5.0}, @@ -548,6 +523,7 @@ def test_no_dynamic_paths_skips_congestion_check(basic_evaluator: CostEvaluator) root, result, target=Port(20, 0, 0), + net_width=2.0, net_id="netA", open_set=open_set, closed_set=closed_set, @@ -578,6 +554,7 @@ def test_guidance_seed_matching_move_reduces_cost_and_advances_seed_index( root, result, target=Port(20, 0, 0), + net_width=2.0, net_id="netA", open_set=open_set, closed_set=closed_set, @@ -596,6 +573,7 @@ def test_guidance_seed_matching_move_reduces_cost_and_advances_seed_index( AStarNode(Port(0, 0, 0), 0.0, 0.0), result, target=Port(20, 0, 0), + net_width=2.0, net_id="netA", open_set=unguided_open_set, closed_set={}, @@ -636,6 +614,7 @@ def test_guidance_seed_bend90_keeps_full_bonus( root, result, target=Port(10, 10, 90), + net_width=2.0, net_id="netA", open_set=open_set, closed_set={}, @@ -654,6 +633,7 @@ def test_guidance_seed_bend90_keeps_full_bonus( AStarNode(Port(0, 0, 0), 0.0, 0.0), result, target=Port(10, 10, 90), + net_width=2.0, net_id="netA", open_set=unguided_open_set, closed_set={}, diff --git a/inire/tests/test_capacity.py b/inire/tests/test_capacity.py index 3a7a86d..fe558c9 100644 --- a/inire/tests/test_capacity.py +++ b/inire/tests/test_capacity.py @@ -1,9 +1,7 @@ from dataclasses import replace -import pytest from shapely.geometry import Polygon -from inire import CongestionOptions, NetSpec, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, route from inire.router._capacity import cut_capacity, port_conflicts from inire.tests.routing_corpus import CASE_GROUPS @@ -25,29 +23,3 @@ def test_fixed_port_conflicts_are_disjoint_and_depend_on_clearance() -> None: assert len(case.problem.nets) - len(pairs) == case.routing_bound assert len({net_id for pair in pairs for net_id in pair}) == 2 * len(pairs) assert port_conflicts(replace(case.problem, clearance=0), case.options) == () - - -@pytest.mark.parametrize("heading", [0, 90]) -@pytest.mark.parametrize( - ("clearance", "second_width", "conflict"), - [(0, 1.5, False), (0, 2, True), (0, 2.5, True), (1e-7, 2 - 1e-7, True), (0.25, 1.5, False)], - ids=["positive-gap", "touching", "overlapping", "tiny-clearance", "exact-clearance"], -) -def test_automatic_bound_matches_terminal_face_clearance(heading, clearance, second_width, conflict) -> None: - nets = tuple( - NetSpec(net_id, Port(10, y, 0).rotated(heading, (50, 50)), Port(90, y, 0).rotated(heading, (50, 50)), width) - for net_id, y, width in (("a", 20, 2), ("clear", 40, 2), ("b", 22, second_width)) - ) - problem = RoutingProblem((0, 0, 100, 100), nets, clearance=clearance) - options = RoutingOptions( - search=SearchOptions(node_limit=20, bend_radii=(), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1), - refinement=RefinementOptions(enabled=False), - ) - - run = route(problem, options=options) - - assert run.automatic is not None - assert run.automatic.port_conflicts == ((("a", "b"),) if conflict else ()) - assert run.automatic.max_routed == len(nets) - int(conflict) - assert len(run.automatic.verified_net_ids) <= run.automatic.max_routed diff --git a/inire/tests/test_clearance_precision.py b/inire/tests/test_clearance_precision.py index 619daff..2829d8c 100644 --- a/inire/tests/test_clearance_precision.py +++ b/inire/tests/test_clearance_precision.py @@ -45,7 +45,7 @@ def test_clearance_thresholds(): # Net 1: Centerline at y=0 p1 = Port(0, 0, 0) res1 = Straight.generate(p1, 50.0, width=2.0, dilation=1.0) - ce.add_path_geometry("net1", res1.collision_geometry, dilated_geometry=res1.dilated_collision_geometry) + ce.add_path("net1", res1.collision_geometry, dilated_geometry=res1.dilated_collision_geometry) # Net 2: Parallel to Net 1 # 1. Beyond minimum spacing: y=5. Gap = 5 - 2 = 3 > 2. OK. diff --git a/inire/tests/test_collision.py b/inire/tests/test_collision.py index ee99707..cff398a 100644 --- a/inire/tests/test_collision.py +++ b/inire/tests/test_collision.py @@ -2,13 +2,12 @@ from dataclasses import replace import numpy import pytest -from shapely import get_precision, set_precision from shapely.geometry import Polygon, box import inire.geometry.collision as collision_module import inire.geometry.component_overlap as overlap_module from inire.geometry.collision import RoutingWorld -from inire.geometry.components import Bend90, ComponentResult +from inire.geometry.components import ComponentResult from inire.geometry.components import Straight from inire.geometry.primitives import Port from inire.router._astar_types import AStarMetrics @@ -35,7 +34,7 @@ def test_verify_path_rejects_invalid_polygon_before_clearance_checks() -> None: self_intersecting = Polygon([(0, -1), (10, 1), (0, 1), (10, -1)]) component = replace(straight, physical_geometry=(self_intersecting,)) - world.add_route("invalid", (component,)) + world.install_path("invalid", (component,)) report = world.verify_path_report("invalid", (component,)) assert not world.has_dynamic_paths() @@ -140,18 +139,6 @@ def test_ray_cast_cache_has_a_fixed_capacity(monkeypatch: pytest.MonkeyPatch) -> assert len(engine._static_obstacles.ray_cast_cache) <= 2 -def test_static_index_ignores_precision_metadata_on_direct_import() -> None: - obstacle = set_precision(box(10, 10, 20, 20), 1, mode="pointwise") - world = RoutingWorld(clearance=.25) - world.add_static_obstacle(obstacle) - indexed, = world.iter_static_geometries() - assert indexed.equals_exact(obstacle, 0) - assert get_precision(indexed) == 0 - - move = Straight.generate(Port(5, 9, 0), 20, 2) - assert world.verify_path_report("track", (move,)).static_collision_count == 1 - - def test_check_move_static_clearance() -> None: engine = RoutingWorld(clearance=2.0) _install_static_straight(engine, Port(10, 50, 0), 10.0, width=100.0, dilation=1.0) @@ -174,16 +161,6 @@ def test_check_move_static_clearance() -> None: assert not engine.check_move_static(res_exact, start_port=start_exact) -def test_static_bend_query_checks_clearance_beyond_its_tangent_face() -> None: - engine = RoutingWorld(clearance=2) - bend = Bend90.generate(Port(20, 20, 0), 10, 2, "CCW", dilation=1) - obstacle = box(16, 18.6, 18.25, 18.9) - assert bend.physical_geometry[0].distance(obstacle) < 2 - engine.add_static_obstacle(obstacle) - - assert engine.check_move_static(bend, start_port=bend.start_port, end_port=bend.end_port) - - def test_verify_path_report_uses_physical_distance_at_a_mitred_corner() -> None: engine = RoutingWorld(clearance=2.0) path = (Straight.generate(Port(0, 0, 0), 20.0, width=2.0),) @@ -205,7 +182,7 @@ def test_verify_path_report_preserves_long_net_id() -> None: geoms = [poly for component in path for poly in component.collision_geometry] dilated = [poly for component in path for poly in component.dilated_collision_geometry] - engine.add_path_geometry(net_id, geoms, dilated_geometry=dilated) + engine.add_path(net_id, geoms, dilated_geometry=dilated) report = engine.verify_path_report(net_id, path) assert report.dynamic_collision_count == 0 @@ -221,12 +198,12 @@ def test_verify_path_report_distinguishes_long_net_ids_with_shared_prefix() -> N path_a = [Straight.generate(Port(0, 0, 0), 20.0, width=2.0, dilation=1.0)] path_b = [Straight.generate(Port(0, 0, 0), 20.0, width=2.0, dilation=1.0)] - engine.add_path_geometry( + engine.add_path( net_a, [poly for component in path_a for poly in component.collision_geometry], dilated_geometry=[poly for component in path_a for poly in component.dilated_collision_geometry], ) - engine.add_path_geometry( + engine.add_path( net_b, [poly for component in path_b for poly in component.collision_geometry], dilated_geometry=[poly for component in path_b for poly in component.dilated_collision_geometry], @@ -245,12 +222,12 @@ def test_verify_path_report_uses_physical_bounds_before_exact_checks() -> None: path_b = [Straight.generate(Port(0, 0, 0), 20.0, width=2.0, dilation=1.0)] path_far = [Straight.generate(Port(100, 100, 0), 20.0, width=2.0, dilation=1.0)] - engine.add_path_geometry( + engine.add_path( "netB", [poly for component in path_b for poly in component.collision_geometry], dilated_geometry=[poly for component in path_b for poly in component.dilated_collision_geometry], ) - engine.add_path_geometry( + engine.add_path( "netFar", [poly for component in path_far for poly in component.collision_geometry], dilated_geometry=[poly for component in path_far for poly in component.dilated_collision_geometry], @@ -268,7 +245,7 @@ def test_verify_path_report_uses_physical_distance_between_routes(clearance, val engine = RoutingWorld(clearance=clearance) existing = Straight.generate(Port(0, 0, 0), 10, width=2, dilation=clearance / 2) query = Straight.generate(Port(12, 2, 90), 10, width=2, dilation=clearance / 2) - engine.add_route("existing", (existing,)) + engine.install_path("existing", (existing,)) # The physical corners are one unit apart on each axis. assert engine.verify_path_report("query", (query,)).is_valid is valid @@ -284,7 +261,7 @@ def test_verify_path_clearance_threshold_survives_translation(y, gap, valid) -> tested = Straight.generate(Port(0, y, 0), 20, width) peer = Straight.generate(Port(0, y + 1, 0), 20, width) - engine.add_route("peer", (peer,)) + engine.install_path("peer", (peer,)) assert engine.verify_path_report("query", (tested,)).is_valid is valid engine.remove_path("peer") engine.add_static_obstacle(peer.physical_geometry[0]) @@ -321,7 +298,7 @@ def test_verify_path_details_returns_conflicting_net_ids() -> None: path_a = [Straight.generate(Port(0, 0, 0), 20.0, width=2.0, dilation=1.0)] path_b = [Straight.generate(Port(0, 0, 0), 20.0, width=2.0, dilation=1.0)] - engine.add_path_geometry( + engine.add_path( "netB", [poly for component in path_b for poly in component.collision_geometry], dilated_geometry=[poly for component in path_b for poly in component.dilated_collision_geometry], @@ -332,11 +309,6 @@ def test_verify_path_details_returns_conflicting_net_ids() -> None: assert detail.report.dynamic_collision_count == 1 assert detail.conflicting_net_ids == ("netB",) - engine.remove_path("netB") - rechecked = engine.verify_path_details("netA", path_a, geometry_report=detail.report) - assert rechecked.report == engine.verify_path_geometry(path_a) - assert rechecked.conflicting_net_ids == () - def test_verify_path_details_reports_component_conflicts() -> None: engine = RoutingWorld(clearance=2.0) @@ -348,7 +320,7 @@ def test_verify_path_details_reports_component_conflicts() -> None: Straight.generate(Port(10, 0, 0), 10.0, width=2.0, dilation=1.0), ] - engine.add_route("netB", path_b) + engine.install_path("netB", path_b) detail = engine.verify_path_details("netA", path_a, capture_component_conflicts=True) @@ -384,7 +356,7 @@ def test_verify_path_details_deduplicates_component_conflicts() -> None: dilated_physical_geometry=[box(5, 0, 17, 10)], ) - engine.add_path_geometry( + engine.add_path( "netB", blocker_component.collision_geometry, dilated_geometry=blocker_component.dilated_collision_geometry, @@ -403,7 +375,7 @@ def test_remove_path_clears_dynamic_path() -> None: geoms = [poly for component in path for poly in component.collision_geometry] dilated = [poly for component in path for poly in component.dilated_collision_geometry] - engine.add_path_geometry("netA", geoms, dilated_geometry=dilated) + engine.add_path("netA", geoms, dilated_geometry=dilated) assert {net_id for net_id, _ in engine._dynamic_paths.geometries.values()} == {"netA"} engine.remove_path("netA") @@ -417,12 +389,12 @@ def test_dynamic_grid_updates_incrementally_on_add_and_remove() -> None: path_a = [Straight.generate(Port(0, 0, 0), 20.0, width=2.0, dilation=1.0)] path_b = [Straight.generate(Port(0, 4, 0), 20.0, width=2.0, dilation=1.0)] - engine.add_path_geometry( + engine.add_path( "netA", [poly for component in path_a for poly in component.collision_geometry], dilated_geometry=[poly for component in path_a for poly in component.dilated_collision_geometry], ) - engine.add_path_geometry( + engine.add_path( "netB", [poly for component in path_b for poly in component.collision_geometry], dilated_geometry=[poly for component in path_b for poly in component.dilated_collision_geometry], @@ -443,40 +415,18 @@ def test_dynamic_grid_updates_incrementally_on_add_and_remove() -> None: assert "netB" in dynamic_paths.grid_net_obj_ids.get((0, 0), {}) -@pytest.mark.parametrize("large_install", [True, False]) -def test_large_dynamic_spans_use_tree_for_congestion(large_install) -> None: - engine = RoutingWorld(clearance=2) - installed = Straight.generate(Port(0, 0, 0), 100_000 if large_install else 20, width=2, dilation=1) - query = Straight.generate(Port(10, -10, 90), 20 if large_install else 100_000, width=2, dilation=1) - engine.add_route("peer", (installed,)) - index = engine._dynamic_paths - - assert bool(index.grid_net_obj_ids) is (not large_install) - assert engine.has_possible_move_congestion(query, "query") - assert engine.has_candidate_move_congestion(query, "query") - assert engine.check_move_congestion(query, "query") == 1 - assert engine.verify_path_report("query", (query,)).dynamic_collision_count == 1 - assert engine.check_move_congestion(query, "peer") == 0 - - engine.remove_path("peer") - - assert not engine.has_possible_move_congestion(query, "query") - assert engine.check_move_congestion(query, "query") == 0 - assert not index.grid_net_obj_ids - - def test_dynamic_net_envelopes_update_incrementally_on_add_and_remove() -> None: engine = RoutingWorld(clearance=2.0) engine.metrics = AStarMetrics() path_a = [Straight.generate(Port(0, 0, 0), 20.0, width=2.0, dilation=1.0)] path_b = [Straight.generate(Port(0, 40, 0), 10.0, width=2.0, dilation=1.0)] - engine.add_path_geometry( + engine.add_path( "netA", [poly for component in path_a for poly in component.collision_geometry], dilated_geometry=[poly for component in path_a for poly in component.dilated_collision_geometry], ) - engine.add_path_geometry( + engine.add_path( "netB", [poly for component in path_b for poly in component.collision_geometry], dilated_geometry=[poly for component in path_b for poly in component.dilated_collision_geometry], @@ -505,7 +455,7 @@ def test_congestion_query_uses_per_polygon_bounds() -> None: engine.metrics = AStarMetrics() blocker = Straight.generate(Port(40, 4, 90), 2.0, width=2.0, dilation=1.0) - engine.add_path_geometry( + engine.add_path( "netB", list(blocker.collision_geometry), dilated_geometry=list(blocker.dilated_collision_geometry), @@ -536,7 +486,7 @@ def test_congestion_touching_geometries_do_not_count_as_overlap() -> None: existing = Straight.generate(Port(0, 0, 0), 10.0, width=2.0, dilation=1.0) touching = Straight.generate(Port(12, 0, 0), 10.0, width=2.0, dilation=1.0) - engine.add_path_geometry( + engine.add_path( "netB", list(existing.collision_geometry), dilated_geometry=list(existing.dilated_collision_geometry), @@ -550,7 +500,7 @@ def test_congestion_exact_checks_only_touch_relevant_move_polygons() -> None: engine.metrics = AStarMetrics() blocker = Straight.generate(Port(0, 0, 0), 10.0, width=2.0, dilation=1.0) - engine.add_path_geometry( + engine.add_path( "netB", list(blocker.collision_geometry), dilated_geometry=list(blocker.dilated_collision_geometry), @@ -581,7 +531,7 @@ def test_congestion_grid_span_cache_reuses_broad_phase_candidates() -> None: cache: dict[tuple[str, int, int, int, int], dict[str, tuple[int, ...]]] = {} blocker = Straight.generate(Port(15, 0, 0), 20.0, width=2.0, dilation=1.0) - engine.add_path_geometry( + engine.add_path( "netB", list(blocker.collision_geometry), dilated_geometry=list(blocker.dilated_collision_geometry), @@ -619,7 +569,7 @@ def test_has_possible_move_congestion_uses_presence_cache_and_skips_empty_spans( presence_cache: dict[tuple[str, int, int, int, int], bool] = {} blocker = Straight.generate(Port(10, 0, 0), 20.0, width=2.0, dilation=1.0) - engine.add_path_geometry( + engine.add_path( "netB", list(blocker.collision_geometry), dilated_geometry=list(blocker.dilated_collision_geometry), @@ -644,7 +594,7 @@ def test_has_candidate_move_congestion_uses_candidate_precheck_cache() -> None: grid_net_cache: dict[tuple[str, int, int, int, int], tuple[str, ...]] = {} blocker = Straight.generate(Port(10, 0, 0), 20.0, width=2.0, dilation=1.0) - engine.add_path_geometry( + engine.add_path( "netB", list(blocker.collision_geometry), dilated_geometry=list(blocker.dilated_collision_geometry), diff --git a/inire/tests/test_components.py b/inire/tests/test_components.py index ee9455a..4df48cd 100644 --- a/inire/tests/test_components.py +++ b/inire/tests/test_components.py @@ -1,15 +1,14 @@ import pytest from dataclasses import FrozenInstanceError -from math import asin, cos, pi, sin, sqrt +from math import pi, sqrt from shapely.affinity import rotate as shapely_rotate from shapely.affinity import scale as shapely_scale from shapely.affinity import translate as shapely_translate -from shapely.geometry import Polygon, box +from shapely.geometry import Polygon import inire.geometry.components as components_module from inire.geometry.components import Bend90, SBend, Straight from inire.geometry.primitives import Port -from inire.geometry.sbend import sbend_grid_span from inire.router.cost import CostEvaluator from inire.geometry.collision import RoutingWorld @@ -105,13 +104,12 @@ def test_translate_reuses_shared_polygons_and_preserves_each_geometry_view( ) -> None: component = SBend.generate(Port(0, 0, 90), -5.0, 10.0, 2.0, collision_type=collision_type, dilation=1.0) calls = [] - transform = components_module.transform - def record(polygons, operation): - calls.extend(map(id, polygons)) - return transform(polygons, operation) + def translate(polygon, dx, dy): + calls.append(id(polygon)) + return shapely_translate(polygon, dx, dy) - monkeypatch.setattr(components_module, "transform", record) + monkeypatch.setattr(components_module, "shapely_translate", translate) dx, dy = 81.25, -31.5 shifted = component.translate(dx, dy) @@ -212,11 +210,16 @@ def test_custom_bend_collision_polygon_can_differ_from_physical_geometry() -> No @pytest.mark.parametrize("dilation", [1, 10]) -def test_arc_proxy_dilation_uses_the_circular_geometry(dilation) -> None: +@pytest.mark.parametrize("kind", ["quarter_turn", "sbend"]) +def test_arc_proxy_dilation_uses_the_circular_geometry(kind, dilation) -> None: outline = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)]) start = Port(20, 20, 0) - default = Bend90.generate(start, 10, 2, "CCW", dilation=dilation) - custom = Bend90.generate(start, 10, 2, "CCW", physical_geometry_type=outline, dilation=dilation) + if kind == "quarter_turn": + default = Bend90.generate(start, 10, 2, "CCW", dilation=dilation) + custom = Bend90.generate(start, 10, 2, "CCW", physical_geometry_type=outline, dilation=dilation) + else: + default = SBend.generate(start, 5, 10, 2, dilation=dilation) + custom = SBend.generate(start, 5, 10, 2, physical_geometry_type=outline, dilation=dilation) assert custom.collision_geometry == default.collision_geometry assert custom.dilated_collision_geometry == default.dilated_collision_geometry @@ -224,26 +227,6 @@ def test_arc_proxy_dilation_uses_the_circular_geometry(dilation) -> None: assert custom.dilated_physical_geometry != custom.dilated_collision_geometry -@pytest.mark.parametrize("heading", [0, 90, 180, 270]) -@pytest.mark.parametrize(("radius", "offset"), [(50, 40), (50, -40), (12.25, 11), (12.25, -11)]) -def test_custom_sbend_uses_one_asymmetric_polygon_and_reaches_grid_face(heading, radius, offset) -> None: - span = sbend_grid_span(offset, radius) - profile = [(0, 0), (span // 3, offset * 0.15), (2 * span // 3, offset * 0.65), (span, offset)] - outline = Polygon([(x, y - 1) for x, y in profile] + [(x, y + 1) for x, y in reversed(profile)]) - start = Port(30, 50, heading) - expected = SBend.generate(start, offset, radius, 2) - result = SBend.generate(start, offset, radius, 2, outline=outline, dilation=1) - - assert result.physical_checks == (True, True) - assert result.end_port == expected.end_port - assert result.collision_geometry == result.physical_geometry - placed = shapely_translate(shapely_rotate(outline, heading, origin=(0, 0)), start.x, start.y) - assert len(result.physical_geometry) == 1 - assert result.physical_geometry[0].equals(placed) - assert result.dilated_physical_geometry == result.dilated_collision_geometry - assert result.dilated_physical_geometry[0].equals(placed.buffer(1)) - - def test_sbend_collision_models() -> None: start = Port(0, 0, 0) offset = 5.0 @@ -300,30 +283,6 @@ def test_arc_sagitta_precision() -> None: assert pts_fine > pts_coarse * 2 -@pytest.mark.parametrize("radius", [100, 79999, 80001, 100000]) -@pytest.mark.parametrize("offset", [None, 0.5]) -def test_circular_bends_detect_keepouts_inside_the_outer_edge(radius, offset) -> None: - width = radius / 200 - start = Port(0, 0, 0) - if offset is None: - component = Bend90.generate(start, radius, width, direction="CCW") - centers = [(0, radius, -pi / 2 + pi / 64)] - else: - lateral = round(offset * radius) - component = SBend.generate(start, lateral, radius, width) - theta = 2 * asin(sqrt(lateral / radius) / 2) - span = sqrt(lateral * (4 * radius - lateral)) - centers = [(0, radius, -pi / 2 + theta / 32), (span, lateral - radius, pi / 2 + theta / 32)] - # These points are between the old 16-segment chord and the physical - # outer edge at fine scales. The keepouts lie entirely inside the arc. - outer_probe_radius = radius + width / 2 - max(0.03, width * 0.12) - for cx, cy, angle in centers: - x, y = cx + outer_probe_radius * cos(angle), cy + outer_probe_radius * sin(angle) - world = RoutingWorld(0) - world.add_static_obstacle(box(x - 0.005, y - 0.005, x + 0.005, y + 0.005)) - assert world.verify_path_report("bend", (component,)).static_collision_count == 1 - - def test_component_transform_invariance() -> None: # Verify that generating at (0,0) then transforming # is same as generating at the transformed port. diff --git a/inire/tests/test_congestion_policy.py b/inire/tests/test_congestion_policy.py index 71b8d3a..4d71a99 100644 --- a/inire/tests/test_congestion_policy.py +++ b/inire/tests/test_congestion_policy.py @@ -52,8 +52,7 @@ def test_reroute_plan_caps_only_heavy_nets_in_the_final_conflict_regime() -> Non def test_next_reroute_nets_respect_reached_targets_and_corridors() -> None: ordered = ("a", "b", "c", "d") review = IterationReview({"a", "b"}, {("a", "b")}, {"d"}, 2) - assert next_reroute_net_ids(ordered, review, all_reached_target=True, has_corridors=True) == {"a", "b", "c"} - assert next_reroute_net_ids(ordered, review, all_reached_target=True, has_corridors=False) == {"a", "b", "c"} + assert next_reroute_net_ids(ordered, review, all_reached_target=True, has_corridors=True) == {"a", "b"} assert next_reroute_net_ids(ordered, review, all_reached_target=False, has_corridors=True) == {"a", "b", "c"} assert next_reroute_net_ids(ordered, review, all_reached_target=False, has_corridors=False) == set(ordered) diff --git a/inire/tests/test_cost.py b/inire/tests/test_cost.py index 1623a9c..9360554 100644 --- a/inire/tests/test_cost.py +++ b/inire/tests/test_cost.py @@ -1,12 +1,7 @@ -from math import ceil - -from numpy import array -from numpy.testing import assert_allclose from shapely.geometry import Polygon, box from inire.geometry.collision import RoutingWorld from inire.geometry.primitives import Port -from inire import RoutingProblem -from inire.router.cost import CostEvaluator, proximity_map +from inire.router.cost import CostEvaluator from inire.router.danger_map import DangerMap @@ -114,50 +109,3 @@ def test_danger_map_skips_distant_rings_and_keeps_nearby_exteriors_and_holes() - assert danger.get_cost(20, 10) > 0 assert danger.get_cost(0, 10) > 0 assert danger.get_cost(10, 10) == 0 - - -def test_danger_map_clips_sampling_without_restarting_spacing_on_diagonal_edges() -> None: - obstacle = Polygon([(-13, 6), (13, -9), (30, 19), (8, 26)]) - spacing = 2.75 - danger = DangerMap((0, 0, 20, 20), resolution=spacing, safety_threshold=2) - window = box(-2, -2, 22, 22) - ring = obstacle.exterior - original = [ring.interpolate(i * spacing) for i in range(ceil(ring.length / spacing))] - expected = sorted((point.x, point.y) for point in original if window.covers(point)) - - danger.precompute([obstacle]) - - assert danger.tree is not None - assert_allclose(sorted(map(tuple, danger.tree.data)), expected, atol=1e-12) - - -def test_danger_map_samples_only_the_nearby_edge_of_a_large_keepout() -> None: - danger = DangerMap((0, 0, 100, 100)) - danger.precompute([box(90, 20, 100_090, 100_020)]) - - assert danger.tree is not None - assert danger.tree.n < 30 - assert danger.get_cost(85, 40) == 0.04 - - -def test_large_perimeter_uses_bounded_exact_index_with_interior_opening() -> None: - problem = RoutingProblem((0, 0, 1_100_000, 1_100_000)) - hole = box(100, 100, 900, 900) - obstacle = Polygon(box(50, 50, 1_000_050, 1_000_050).exterior, [hole.exterior]) - danger = proximity_map(problem, 10) - danger.precompute((obstacle,)) - - assert danger.tree is None - assert danger.has_data - assert_allclose(danger.costs_at_points(array([[45, 500], [105, 500], [500, 500]])), [0.04, 0.04, 0.0]) - assert danger.get_cost(105, 500) == 0.04 - - -def test_proximity_cost_is_stable_when_layout_units_change() -> None: - for scale in (1, 10, 1000): - problem = RoutingProblem((0, 0, 1500 * scale, 1600 * scale)) - danger = proximity_map(problem, 10 * scale) - danger.precompute((box(200 * scale, 200 * scale, 1200 * scale, 1200 * scale),)) - - assert danger.tree.n == 800 - assert danger.get_cost(500 * scale, 195 * scale) == 0.04 diff --git a/inire/tests/test_crow_launch.py b/inire/tests/test_crow_launch.py deleted file mode 100644 index 4f14fbc..0000000 --- a/inire/tests/test_crow_launch.py +++ /dev/null @@ -1,31 +0,0 @@ -from json import loads -from pathlib import Path - -import pytest -from shapely.geometry import Polygon - -from inire import ( - CongestionOptions, NetSpec, ObjectiveWeights, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, route, -) - - -_CASES = loads((Path(__file__).parent / "data" / "crow_launch_cases.json").read_text())["cases"] - - -@pytest.mark.parametrize("case", _CASES, ids=[str(case["id"]) for case in _CASES]) -def test_original_crow_launch_direction_routes_at_the_review_budget(case) -> None: - net = NetSpec(str(case["id"]), Port(*case["start"]), Port(*case["target"]), case["width"]) - problem = RoutingProblem(tuple(case["bounds"]), (net,), tuple(Polygon(*rings) for rings in case["keepouts"]), clearance=70) - options = RoutingOptions( - search=SearchOptions( - node_limit=225, bend_radii=(5000, 10000), sbend_radii=(5000, 10000), min_straight_length=500, max_straight_length=450_000, - ), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - objective=ObjectiveWeights(danger_weight=0), - refinement=RefinementOptions(enabled=False), - ) - - run = route(problem, options=options) - - assert run.results_by_net[net.net_id].is_valid - assert run.metrics.nodes_expanded <= 225 diff --git a/inire/tests/test_example_regressions.py b/inire/tests/test_example_regressions.py index 3c5f6b7..6099783 100644 --- a/inire/tests/test_example_regressions.py +++ b/inire/tests/test_example_regressions.py @@ -1,5 +1,3 @@ -from dataclasses import replace - import pytest from shapely.geometry import Polygon, box @@ -92,7 +90,7 @@ def test_example_07_no_warm_start_trace_finishes_without_conflict_edges() -> Non assert final_entry.conflict_edges == () -def test_example_06_clipped_bbox_margin_keeps_legacy_seed_replayable() -> None: +def test_example_06_clipped_bbox_margin_restores_legacy_seed() -> None: bounds = (-20, -20, 170, 170) obstacles = ( Polygon([(40, 110), (60, 110), (60, 130), (40, 130)]), @@ -118,7 +116,22 @@ def test_example_06_clipped_bbox_margin_keeps_legacy_seed_replayable() -> None: **common_kwargs, ), ).results_by_net["clipped_model"] - legacy_seed = PathSeed( + legacy_margin = route( + problem, + options=RoutingOptions( + search=SearchOptions( + bend_radii=(10.0,), + bend_collision_type="clipped_bbox", + bend_clip_margin=1.0, + ), + **common_kwargs, + ), + ).results_by_net["clipped_model"] + + assert no_margin.is_valid + assert legacy_margin.is_valid + assert legacy_margin.as_seed() != no_margin.as_seed() + assert legacy_margin.as_seed() == PathSeed( ( StraightSeed(5.0), Bend90Seed(10.0, "CW"), @@ -128,16 +141,6 @@ def test_example_06_clipped_bbox_margin_keeps_legacy_seed_replayable() -> None: StraightSeed(30.0), ) ) - simulation = replace(problem, initial_paths={"clipped_model": legacy_seed}) - legacy_options = RoutingOptions( - search=SearchOptions(node_limit=0, bend_radii=(10.0,), bend_collision_type="clipped_bbox", bend_clip_margin=1.0), - **common_kwargs, - ) - legacy = route(simulation, options=legacy_options).results_by_net["clipped_model"] - - assert no_margin.is_valid - assert legacy.is_valid - assert legacy.as_seed() == legacy_seed def test_example_07_reduced_bottleneck_uses_adaptive_greedy_callback() -> None: diff --git a/inire/tests/test_failed_net_congestion.py b/inire/tests/test_failed_net_congestion.py index 38d7815..4e09f82 100644 --- a/inire/tests/test_failed_net_congestion.py +++ b/inire/tests/test_failed_net_congestion.py @@ -1,24 +1,77 @@ from shapely.geometry import box -from inire import CongestionOptions, NetSpec, Port, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions -from inire.router._stack import build_routing_stack +from inire import CongestionOptions, RoutingOptions, RoutingProblem +from inire.geometry.primitives import Port +from inire.geometry.collision import RoutingWorld +from inire.model import NetSpec +from inire.router._astar_types import AStarContext +from inire.router._router import PathFinder +from inire.router.cost import CostEvaluator +from inire.router.danger_map import DangerMap +def test_failed_net_visibility() -> None: + """ + Verifies that nets that fail to reach their target (return partial paths) + ARE added to the collision engine, making them visible to other nets + for negotiated congestion. + """ + # 1. Setup + engine = RoutingWorld(clearance=2.0) -def test_partial_path_is_returned_without_installing_it() -> None: - problem = RoutingProblem( - bounds=(0, 0, 100, 100), - nets=(NetSpec("blocked", Port(0, 50, 0), Port(100, 50, 0)),), - static_obstacles=(box(40, 40, 60, 60),), + # Create a simple danger map (bounds 0-100) + # We don't strictly need obstacles in it for this test. + dm = DangerMap(bounds=(0, 0, 100, 100)) + + evaluator = CostEvaluator(engine, dm) + + # 2. Configure Router with low limit to FORCE failure + # node_limit=10 is extremely low, likely allowing only a few moves. + # Start (0,0) -> Target (100,0) is 100um away. + + # Let's add a static obstacle that blocks the direct path. + obstacle = box(40, -10, 60, 10) # Wall at x=50 + engine.add_static_obstacle(obstacle) + + # With obstacle, direct jump fails. A* must search around. + # Limit=10 should be enough to fail to find a path around. + netlist = { + "net1": (Port(0, 0, 0), Port(100, 0, 0)) + } + net_widths = {"net1": 1.0} + pf = PathFinder( + AStarContext( + evaluator, + RoutingProblem( + bounds=(0, 0, 100, 100), + nets=tuple( + NetSpec(net_id=net_id, start=start, target=target, width=net_widths.get(net_id, 2.0)) + for net_id, (start, target) in netlist.items() + ), + ), + RoutingOptions( + search=RoutingOptions().search.__class__(node_limit=10), + congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), + ), + ), ) - options = RoutingOptions( - search=SearchOptions(node_limit=10, bend_radii=(), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode="off"), - ) - stack = build_routing_stack(problem, options) - result = stack.finder.route_all()["blocked"] + # 4. Route + print("\nStarting Route...") + results = pf.route_all() - assert result.outcome == "partial" - assert result.path - assert not stack.world.has_dynamic_paths() + res = results["net1"] + print(f"Result: is_valid={res.is_valid}, reached={res.reached_target}, path_len={len(res.path)}") + + # 5. Verify Failure Condition + # We expect reached_target to be False because of node_limit + obstacle + assert not res.reached_target, "Test setup failed: Net reached target despite low limit!" + assert len(res.path) > 0, "Test setup failed: No partial path returned!" + + # 6. Verify Visibility + # Check if net1 is in the collision engine + found_nets = {net_id for net_id, _ in engine._dynamic_paths.geometries.values()} + + print(f"Nets found in engine: {found_nets}") + + # The FIX Expectation: "net1" SHOULD be present + assert "net1" in found_nets, "Bug present: Net1 is invisible despite having partial path!" diff --git a/inire/tests/test_layout.py b/inire/tests/test_layout.py deleted file mode 100644 index 985f78d..0000000 --- a/inire/tests/test_layout.py +++ /dev/null @@ -1,277 +0,0 @@ -import pickle -from copy import deepcopy -from dataclasses import asdict, replace -from json import dumps, loads - -import pytest -from shapely import set_precision, union_all -from shapely.geometry import box - -from inire import ( - Bend90Seed, CongestionOptions, FixedRoute, NetSpec, PathSeed, Port, RefinementOptions, - RoutingOptions, RoutingProblem, SBendOutline, SearchOptions, StraightSeed, TopologyOptions, route, -) -from inire.layout import PlacedPort, partition_layers, preserves_length, route_profiles - - -_REPLAY = RoutingOptions(search=SearchOptions(node_limit=0), refinement=RefinementOptions(enabled=False)) - - -def test_declared_port_width_check_requires_transition_for_wider_device() -> None: - source = PlacedPort(Port(10000, 10000, 0), 500) - target = PlacedPort(Port(110000, 10000, 0), 3000) - with pytest.raises(ValueError, match="joins widths 500 and 3000"): - source.connect("wide", target) - - inlet = PlacedPort(Port(70000, 10000, 0), 500) - net = source.connect("before_taper", inlet) - assert net.width == 500 - assert net.target == inlet.port - rotated = replace(source, port=source.port.rotated(90)).connect("rotated", replace(inlet, port=inlet.port.rotated(90))) - assert rotated.start.r == rotated.target.r == 90 - - -@pytest.mark.parametrize(("outer_radius", "valid"), [(3069, False), (3070, True)]) -def test_replay_verifies_actual_concentric_bend_clearance(outer_radius, valid) -> None: - center_x, center_y = 3000, 6070 - inner = NetSpec("inside", Port(center_x, center_y - 2500, 0), Port(center_x + 2500, center_y, 90), 490) - outer = NetSpec("outside", Port(center_x, center_y - outer_radius, 0), Port(center_x + outer_radius, center_y, 90), 509.94) - seeds = {"inside": PathSeed((Bend90Seed(2500, "CCW"),)), "outside": PathSeed((Bend90Seed(outer_radius, "CCW"),))} - problem = RoutingProblem((0, 0, 7000, 7000), (inner, outer), initial_paths=seeds, clearance=70) - options = replace(_REPLAY, search=replace(_REPLAY.search, bend_radii=(2500, outer_radius))) - results = route(problem, options=options).results_by_net - for net_id, result in results.items(): - assert result.as_seed() == seeds[net_id] - assert result.is_valid is valid - assert not result.report.discontinuous - assert result.report.dynamic_collision_count == int(not valid) - - -@pytest.mark.parametrize("mode", ["automatic", "off", "guide", "seed"]) -@pytest.mark.parametrize(("start_x", "y", "valid"), [(10, 22, False), (40, 22, False), (40, 23, True)]) -def test_imported_fixed_routes_hold_clearance_at_edges_and_vertices(mode, start_x, y, valid) -> None: - net = NetSpec("new", Port(start_x, y, 0), Port(90, y, 0)) - fixed = FixedRoute("existing", (box(10, 19, 40, 21),)) - problem = RoutingProblem((0, 0, 100, 50), (net,), clearance=0, fixed_routes=(fixed,)) - options = RoutingOptions( - search=SearchOptions(node_limit=20, bend_radii=(), sbend_radii=()), - topology=TopologyOptions(mode=mode), - ) - - results = route(problem, options=options).results_by_net - - assert set(results) == {"new"} - assert results["new"].is_valid is valid - - -def test_fixed_route_from_result_preserves_polygon_and_owner() -> None: - net = NetSpec("first", Port(10, 20, 0), Port(90, 20, 0)) - problem = RoutingProblem((0, 0, 100, 50), (net,)) - fixed = FixedRoute.from_result(route(problem).results_by_net["first"]) - assert fixed.net_id == net.net_id - assert fixed.polygons[0].equals(box(10, 19, 90, 21)) - with pytest.raises(ValueError, match="Duplicate active or fixed"): - replace(problem, fixed_routes=(fixed,)) - - -@pytest.mark.parametrize("fixed_bounds", [(23.9, 15.6, 24.4, 16.1), (25.15, 14.75, 25.25, 14.85)], ids=["overlap", "insufficient-gap"]) -def test_lattice_bend_admission_checks_physical_clearance_to_fixed_route(fixed_bounds) -> None: - net = NetSpec("active", Port(10, 10, 0), Port(30, 30, 90)) - fixed = FixedRoute("locked", (box(*fixed_bounds),)) - problem = RoutingProblem((0, 0, 50, 50), (net,), clearance=1, fixed_routes=(fixed,)) - options = RoutingOptions( - search=SearchOptions(node_limit=50, bend_radii=(10, 20), sbend_radii=(), bend_proxy_geometry="clipped_bbox", bend_clip_margin=9), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - result = route(problem, options=options).results_by_net[net.net_id] - - assert result.is_valid - assert result.as_seed() == PathSeed((StraightSeed(10), Bend90Seed(10, "CCW"), StraightSeed(10))) - - -@pytest.mark.parametrize("fixed", [False, True], ids=["keepout", "fixed-net"]) -@pytest.mark.parametrize(("clearance", "valid"), [(0.25, True), (0.5, False)]) -def test_imported_polygon_precision_preserves_fractional_clearance(fixed, clearance, valid) -> None: - net = NetSpec("signal", Port(10, 20, 0), Port(90, 20, 0), 1.5) - obstacle = box(20, 21, 30, 24) - problem = RoutingProblem( - (0, 0, 100, 50), (net,), initial_paths={net.net_id: PathSeed((StraightSeed(80),))}, clearance=clearance, - ) - reports = [] - for polygon in (obstacle, set_precision(obstacle, 1, mode="pointwise")): - with_obstacle = replace(problem, fixed_routes=(FixedRoute("existing", (polygon,)),)) if fixed else replace( - problem, static_obstacles=(polygon,), - ) - result = route(with_obstacle, options=_REPLAY).results_by_net[net.net_id] - assert result.is_valid is valid - assert result.locked_geometry[0].bounds == (10, 19.25, 90, 20.75) - reports.append(result.report) - assert reports[0] == reports[1] - - -@pytest.mark.parametrize(("pitch", "valid"), [(28000, False), (32000, False), (36000, True)]) -def test_cpw_envelope_clearance_and_signal_recipe_replay(pitch, valid) -> None: - nets = tuple(NetSpec(f"cpw{i}", Port(10000, 30000 + i * pitch, 0), Port(210000, 30000 + i * pitch, 0), 29500) - for i in range(2)) - seeds = {net.net_id: PathSeed((StraightSeed(200000),)) for net in nets} - problem = RoutingProblem((0, 0, 220000, 100000), nets, initial_paths=seeds, clearance=3000) - - envelopes = route(problem, options=_REPLAY).results_by_net - - assert all(envelope.is_valid for envelope in envelopes.values()) == valid - if valid: - signals = replace( - problem, - nets=tuple(replace(net, width=15500) for net in nets), - initial_paths={key: result.as_seed() for key, result in envelopes.items()}, - ) - replay = route(signals, options=_REPLAY) - assert replay.metrics.nodes_expanded == 0 - for net in signals.nets: - result = replay.results_by_net[net.net_id] - assert result.is_valid - assert result.effective_net == net - assert result.as_seed() == envelopes[net.net_id].as_seed() - - -def test_profile_options_apply_to_active_search_and_seed_replay() -> None: - flux = NetSpec("flux", Port(35000, 20000, 0), Port(50000, 35000, 90), 29500) - feed = NetSpec("feed", Port(100000, 20000, 0), Port(115000, 35000, 90), 29500) - problem = RoutingProblem((0, 0, 220000, 95000), (flux, feed), clearance=3000) - options = RoutingOptions( - search=SearchOptions(node_limit=80, bend_radii=(15000,), sbend_radii=()), - refinement=RefinementOptions(enabled=False), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode="off"), - ) - feed_profile = replace(options, search=replace(options.search, bend_radii=(50000,))) - profiles = ((("flux",), options), (("feed",), feed_profile)) - - restricted = route_profiles(problem, profiles) - - assert restricted["flux"].is_valid - assert not restricted["feed"].is_valid - feed = replace(feed, target=Port(150000, 70000, 90)) - open_board = replace(problem, nets=(flux, feed)) - both = route_profiles(open_board, profiles) - assert both["feed"].as_seed() == PathSeed((Bend90Seed(50000, "CCW"),)) - assert all(result.is_valid for result in both.values()) - invalid = replace(open_board, initial_paths={"feed": PathSeed((Bend90Seed(15000, "CCW"),))}) - with pytest.raises(ValueError, match="'feed'.*outside bend_radii"): - route_profiles(invalid, profiles) - - -@pytest.mark.parametrize(("second_y", "valid"), [(22, False), (23, True)]) -def test_profile_reserves_replayed_net_against_zero_clearance_contact(second_y, valid) -> None: - first = NetSpec("first", Port(10, 20, 0), Port(90, 20, 0)) - second = NetSpec("second", Port(10, second_y, 0), Port(90, second_y, 0)) - seeds = {net.net_id: PathSeed((StraightSeed(80),)) for net in (first, second)} - problem = RoutingProblem((0, 0, 100, 50), (first, second), initial_paths=seeds, clearance=0) - - results = route_profiles(problem, [(("first",), _REPLAY), (("second",), _REPLAY)]) - - assert results["first"].is_valid - assert results["second"].is_valid is valid - if valid: - assert results["second"].as_seed() == seeds["second"] - - -def test_independent_layer_outputs_retain_assignment_and_connectivity() -> None: - silicon = NetSpec("si", Port(1000, 10000, 0), Port(19000, 10000, 0), 500) - nitride = NetSpec("sin", Port(10000, 1000, 90), Port(10000, 19000, 90), 750) - geometry = {} - for layer, nets in partition_layers((((1, 0), silicon), ((4, 0), nitride))).items(): - problem = RoutingProblem( - (0, 0, 20000, 20000), nets, - initial_paths={net.net_id: PathSeed((StraightSeed(18000),)) for net in nets}, - ) - result, = route(problem, options=_REPLAY).results_by_net.values() - assert result.is_valid - assert result.effective_net == nets[0] - assert result.as_seed() == problem.initial_paths[result.net_id] - geometry[layer] = union_all(result.locked_geometry) - assert set(geometry) == {(1, 0), (4, 0)} - assert all(shape.geom_type == "Polygon" for shape in geometry.values()) - assert geometry[1, 0].intersection(geometry[4, 0]).area > 0 - - -def test_authored_template_lengths_are_used_for_candidate_acceptance() -> None: - net = NetSpec("arm", Port(20, 20, 0), Port(30, 30, 90)) - problem = RoutingProblem((0, 0, 100, 100), (net,)) - outline = box(0, -11, 11, -9).union(box(9, -11, 11, 0)) - options = RoutingOptions(search=SearchOptions( - node_limit=100, bend_radii=(10,), bend_physical_geometry=outline, bend_physical_length=18.7, - )) - result = route(problem, options=options).results_by_net["arm"] - assert preserves_length(result, 18.7, tolerance=1e-6) - assert not preserves_length(result, 37.4, tolerance=1e-6) - assert result.report.total_length == 18.7 - - -def test_authored_sbend_length_survives_seed_replay() -> None: - polygon = box(0, -1, 80, 41).intersection( - box(0, -1, 80, 1).union(box(1, 0, 79, 41)).union(box(79, 39, 80, 41)), - ) - outline = SBendOutline(40, 50, 2, polygon, length=95) - net = NetSpec("shift", Port(10, 10, 0), Port(90, 50, 0)) - seed = PathSeed(()) - search = SearchOptions(node_limit=80, bend_radii=(), sbend_radii=(50,), sbend_outlines=(outline,)) - problem = RoutingProblem((0, 0, 110, 110), (net,)) - options = RoutingOptions(search=search) - result = route(problem, options=options).results_by_net["shift"] - assert result.as_seed() != seed - replay = route( - replace(problem, initial_paths={"shift": result.as_seed()}), - options=replace(options, search=replace(search, node_limit=0)), - ).results_by_net["shift"] - assert preserves_length(replay, 95, tolerance=0) - - -def test_routing_inputs_and_results_are_detached_snapshots() -> None: - track = NetSpec("track", Port(10, 20, 0), Port(90, 20, 0)) - seeds = {"track": PathSeed((StraightSeed(80),))} - problem = RoutingProblem((0, 0, 100, 50), (track,), initial_paths=seeds) - seeds.clear() - assert tuple(problem.initial_paths) == ("track",) - - run = route(problem, options=_REPLAY, iteration_callback=lambda _, results: results.clear()) - with pytest.raises(TypeError): - problem.initial_paths["track"] = PathSeed(()) - with pytest.raises(TypeError): - del run.results_by_net["track"] - with pytest.raises(TypeError): - run.results_by_net.clear() - assert run.results_by_net["track"].is_valid - - -def test_read_only_snapshots_survive_python_copy_and_pickle() -> None: - track = NetSpec("track", Port(10, 20, 0), Port(90, 20, 0)) - problem = RoutingProblem((0, 0, 100, 50), (track,)) - run = route(problem) - for copy in (deepcopy, lambda value: pickle.loads(pickle.dumps(value))): - assert copy(problem) == problem - restored = copy(run) - assert restored == run - with pytest.raises(TypeError): - del restored.results_by_net["track"] - source = dict(run.results_by_net) - replacement = replace(run, results_by_net=source) - source.clear() - assert replacement.results_by_net == run.results_by_net - - -def test_asdict_serializes_snapshot_entries_as_structured_data() -> None: - net = NetSpec("track", Port(10, 20, 0), Port(90, 20, 0)) - seed = PathSeed((StraightSeed(80),)) - problem = RoutingProblem((0, 0, 100, 50), (net,), initial_paths={net.net_id: seed}) - run = route(problem, options=_REPLAY) - - problem_data = loads(dumps(asdict(problem), default=str)) - result_data = loads(dumps(asdict(run), default=str)) - - assert problem_data["initial_paths"]["track"]["segments"] == [{"length": 80}] - assert result_data["results_by_net"]["track"]["report"]["total_length"] == 80 - assert result_data["results_by_net"]["track"]["path"][0]["move_spec"] == {"length": 80} diff --git a/inire/tests/test_pathfinder.py b/inire/tests/test_pathfinder.py index dc2e721..05e9851 100644 --- a/inire/tests/test_pathfinder.py +++ b/inire/tests/test_pathfinder.py @@ -119,7 +119,7 @@ def test_frontier_replay_restores_installed_path_and_metrics(monkeypatch: pytest for net_id, net in state.net_specs.items(): path = (Straight.generate(net.start, 80, net.width, dilation=world.clearance / 2),) state.results[net_id] = RoutingResult(net_id, path, reached_target=True) - finder._add_route(net_id, path) + finder._install_path(net_id, path) original_metrics = finder.metrics original_snapshot = original_metrics.snapshot() diff --git a/inire/tests/test_refinements.py b/inire/tests/test_refinements.py index 8832ee3..408c49d 100644 --- a/inire/tests/test_refinements.py +++ b/inire/tests/test_refinements.py @@ -1,18 +1,15 @@ from dataclasses import replace import pytest -from shapely.geometry import Polygon, box +from shapely.geometry import Polygon from inire import CongestionOptions, ObjectiveWeights, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route -from inire import DiagnosticsOptions, PathSeed, StraightSeed from inire.geometry.collision import RoutingWorld from inire.geometry.components import Bend90 from inire.geometry.primitives import Port -from inire.geometry.primitives import port_local_coordinates from inire.model import NetSpec from inire.router._astar_types import AStarContext from inire.router._router import PathFinder -from inire.router._seed_materialization import materialize_path_seed from inire.router._waypoints import compile_waypoints from inire.router.cost import CostEvaluator from inire.router.danger_map import DangerMap @@ -36,27 +33,6 @@ _REFINEMENT_OPTIONS = RoutingOptions( ) -@pytest.mark.parametrize("limit", [None, 1, 4]) -def test_refinement_window_order_matches_exhaustive_search(limit) -> None: - problem = _seeded_foldback() - options = replace(_REFINEMENT_OPTIONS, refinement=RefinementOptions(max_windows_per_net=limit)) - start = problem.nets[0].start - path = materialize_path_seed(problem.initial_paths["foldback"], start=start, net_width=2, search=options.search, clearance=2) - assert path is not None - finder = PathFinder(AStarContext(CostEvaluator(RoutingWorld(clearance=2), DangerMap(problem.bounds)), problem, options)) - ports = [start, *(move.end_port for move in path)] - eligible = [] - for left, source in enumerate(ports[:-1]): - for right, target in enumerate(ports[left + 1 :], start=left + 1): - bends = [move.move_type == "bend90" for move in path[left:right]] - forward, _ = port_local_coordinates(source, target.x, target.y) - if sum(bends) >= 4 and source.r == target.r and forward >= 40: - priority = -sum((bends[0], bends[-1])) if limit == 4 else 0 - eligible.append((priority, left - right, left, right)) - - assert list(finder.refiner._iter_refinement_windows(start, path)) == [(left, right) for _, _, left, right in sorted(eligible)] - - @pytest.mark.parametrize("radius", [10, 10.25]) def test_refinement_handles_both_signs_of_the_lateral_offset(radius) -> None: options = replace(_REFINEMENT_OPTIONS, search=replace(_REFINEMENT_OPTIONS.search, bend_radii=(radius,))) @@ -69,87 +45,6 @@ def test_refinement_handles_both_signs_of_the_lateral_offset(radius) -> None: assert paths[0].report.total_length == pytest.approx(paths[1].report.total_length) -def test_automatic_refinement_rechecks_retained_partial_paths() -> None: - base = _seeded_foldback() - blocked = NetSpec("blocked", Port(150, 120, 90), Port(150, 210, 90)) - problem = replace( - base, - nets=(*base.nets, blocked), - static_obstacles=(box(70, 180, 260, 220),), - initial_paths={**base.initial_paths, "blocked": PathSeed((StraightSeed(50),))}, - ) - options = replace( - _REFINEMENT_OPTIONS, - search=replace(_REFINEMENT_OPTIONS.search, node_limit=15), - congestion=replace(_REFINEMENT_OPTIONS.congestion, warm_start_enabled=False), - diagnostics=DiagnosticsOptions(capture_conflict_trace=True), - topology=TopologyOptions(mode="automatic"), - ) - - run = route(problem, options=options) - - assert run.automatic is not None - assert run.automatic.stages[run.automatic.selected_stage].operation == "refine" - assert run.results_by_net["foldback"].is_valid - partial = run.results_by_net["blocked"] - assert partial.outcome == "partial" - assert partial.report.dynamic_collision_count == 1 - final = run.conflict_trace[-1] - assert final.stage == "final" - traced = next(net for net in final.nets if net.net_id == "blocked") - assert traced.report == partial.report - assert traced.conflicting_net_ids == ("foldback",) - - -@pytest.mark.parametrize("weights", [None, (0, 0, 0)]) -def test_automatic_selects_refinement_using_its_explicit_objective(weights) -> None: - problem = _seeded_foldback() - lattice_options = replace( - _REFINEMENT_OPTIONS, - search=replace(_REFINEMENT_OPTIONS.search, node_limit=100), - objective=ObjectiveWeights(0, 0, 0, 0), - refinement=RefinementOptions(objective=ObjectiveWeights(danger_weight=0)), - ) - automatic_options = replace( - lattice_options, topology=TopologyOptions(mode="automatic", automatic_length_weights=weights), - ) - expected = route(problem, options=lattice_options).results_by_net["foldback"] - run = route(problem, options=automatic_options) - actual = run.results_by_net["foldback"] - - assert actual.is_valid - assert len(actual.path) == 9 - assert actual.as_seed() == expected.as_seed() - assert run.automatic.stages[run.automatic.selected_stage].operation == "refine" - - -def test_seeded_refinement_builds_proximity_map_at_zero_search_budget(monkeypatch) -> None: - problem = replace(_seeded_foldback(), static_obstacles=(box(0, 0, 10, 10),)) - options = replace( - _REFINEMENT_OPTIONS, - search=replace(_REFINEMENT_OPTIONS.search, node_limit=0), - refinement=RefinementOptions(objective=ObjectiveWeights()), - ) - calls = [] - precompute = DangerMap.precompute - - def track(self, obstacles): - calls.append(tuple(obstacles)) - precompute(self, obstacles) - - monkeypatch.setattr(DangerMap, "precompute", track) - callbacks = [] - run = route(problem, options=options, iteration_callback=lambda _, results: callbacks.append(results["foldback"])) - - result = run.results_by_net["foldback"] - assert result.is_valid - assert run.metrics.refinement_candidates_accepted > 0 - assert calls == [problem.static_obstacles] - assert result.as_seed() != problem.initial_paths["foldback"] - assert result.report.total_length == pytest.approx(sum(component.length for component in result.path)) - assert callbacks == [result] - - @pytest.mark.parametrize("mode", ["automatic", "off"]) def test_refinement_preserves_custom_bend_geometry_on_seed_replay(mode) -> None: outline = Polygon([(0, -11), (11, -11), (11, 0), (9, 0), (9, -9), (0, -9)]) diff --git a/inire/tests/test_route_behavior.py b/inire/tests/test_route_behavior.py index 8bfc5ea..8730c59 100644 --- a/inire/tests/test_route_behavior.py +++ b/inire/tests/test_route_behavior.py @@ -182,13 +182,13 @@ def test_route_uses_complete_initial_paths_without_rerouting() -> None: assert result.as_seed() == initial_seed -def test_route_uses_a_partial_initial_path_on_the_first_iteration() -> None: +def test_route_retries_partial_initial_paths_across_iterations() -> None: iterations: list[int] = [] - partial_seed = PathSeed((StraightSeed(length=7.0),)) + partial_seed = PathSeed((StraightSeed(length=5.0),)) run = _route_problem( - netlist={"net": (Port(0, 0, 0), Port(20, 0, 0))}, + netlist={"net": (Port(0, 0, 0), Port(10, 0, 0))}, net_widths={"net": 2.0}, - max_iterations=1, + max_iterations=2, warm_start_enabled=False, capture_expanded=True, initial_paths={"net": partial_seed}, @@ -197,13 +197,12 @@ def test_route_uses_a_partial_initial_path_on_the_first_iteration() -> None: ) result = run.results_by_net["net"] - assert iterations == [0] + assert iterations == [0, 1] assert result.is_valid assert result.reached_target assert result.outcome == "completed" - assert result.as_seed().segments == (*partial_seed.segments, StraightSeed(13)) + assert result.as_seed() != partial_seed assert run.expanded_nodes - assert run.metrics.guidance_match_moves > 0 def test_route_negotiated_congestion_resolution() -> None: @@ -263,13 +262,7 @@ def test_route_refinement_reduces_locked_detour_bends() -> None: def test_route_refinement_simplifies_triple_crossing_detours() -> None: - detour = PathSeed( - ( - Bend90Seed(10, "CCW"), Bend90Seed(10, "CW"), Bend90Seed(10, "CCW"), Bend90Seed(10, "CW"), - StraightSeed(20), Bend90Seed(10, "CW"), StraightSeed(20), Bend90Seed(10, "CCW"), - ) - ) - layout = dict( + base_run = _route_problem( bounds=(0, 0, 100, 100), netlist={ "horizontal": (Port(10, 50, 0), Port(90, 50, 0)), @@ -277,13 +270,30 @@ def test_route_refinement_simplifies_triple_crossing_detours() -> None: "vertical_down": (Port(55, 90, 270), Port(55, 10, 270)), }, net_widths={"horizontal": 2.0, "vertical_up": 2.0, "vertical_down": 2.0}, - initial_paths={"horizontal": PathSeed((StraightSeed(80),)), "vertical_up": detour, "vertical_down": detour}, - node_limit=0, bend_radii=[10.0], sbend_radii=[10.0], + base_penalty=1000.0, + enabled=False, + greedy_h_weight=1.5, + bend_penalty=250.0, + sbend_penalty=500.0, + ) + refined_run = _route_problem( + bounds=(0, 0, 100, 100), + 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)), + }, + net_widths={"horizontal": 2.0, "vertical_up": 2.0, "vertical_down": 2.0}, + bend_radii=[10.0], + sbend_radii=[10.0], + base_penalty=1000.0, + enabled=True, + greedy_h_weight=1.5, + bend_penalty=250.0, + sbend_penalty=500.0, ) - base_run = _route_problem(**layout, enabled=False) - refined_run = _route_problem(**layout, enabled=True) for net_id in ("vertical_up", "vertical_down"): base_result = base_run.results_by_net[net_id] diff --git a/inire/tests/test_routing_benchmarks.py b/inire/tests/test_routing_benchmarks.py index 8a8f9b6..fedc03c 100644 --- a/inire/tests/test_routing_benchmarks.py +++ b/inire/tests/test_routing_benchmarks.py @@ -5,15 +5,11 @@ from json import dumps, loads import pytest from shapely import union_all -from shapely.geometry import Point, Polygon, box, shape +from shapely.geometry import Point, box, shape -from inire import ( - Bend90Seed, NetSpec, PathSeed, Port, RoutingOptions, RoutingProblem, SBendOutline, - SBendSeed, SearchOptions, StraightSeed, TopologyOptions, route, -) +from inire import Bend90Seed, NetSpec, Port, RoutingOptions, RoutingProblem, SBendSeed, SearchOptions, StraightSeed, TopologyOptions, route from inire.constants import TOLERANCE_LINEAR from inire.router._automatic import _AutomaticRun -from inire.router._capacity import port_conflicts from inire.router._routing_policy import _disconnected_nets from inire.tests.retry_holdout_benchmarks import RETRY_HOLDOUT_CASES from inire.tests.routing_benchmarks import ( @@ -207,8 +203,8 @@ def test_automatic_constructs_an_exact_sbend_grid() -> None: def test_automatic_skips_identical_guide_retry_on_staggered_grid() -> None: case = next(case for case in CROSSING_BENCHMARK_CASES if case.name == "crossing-staggered-grid") first, *others = case.problem.nets - # A 22-unit shift leaves a net unresolved after the early guide and exercises the retry. - problem = replace(case.problem, nets=(replace(first, target=first.target.translate(dy=2)), *others)) + # An odd shift has no exact forward span at this radius, so use guide search. + problem = replace(case.problem, nets=(replace(first, target=first.target.translate(dy=1)), *others)) options = replace( case.options, search=replace(case.options.search, node_limit=101), @@ -221,7 +217,6 @@ def test_automatic_skips_identical_guide_retry_on_staggered_grid() -> None: assert report is not None guided = [stage for stage in report.stages if stage.operation == "search" and stage.mode == "guide"] assert [(stage.policy, stage.node_limit) for stage in guided] == [("early-guide", 101), ("direct-probe-near-port", 100)] - assert len(guided[0].valid_net_ids) < len(problem.nets) def test_automatic_times_planning_search_verification_and_refinement() -> None: @@ -400,63 +395,6 @@ def test_bundle_first_routes_point_terminals_without_supplied_paths(name: str) - assert sample.nodes_expanded == 0 -@pytest.mark.parametrize(("name", "mode"), [("complex-routing-example-1", "automatic"), ("complex-routing-example-1-point-terminals", "bundle")]) -def test_unused_custom_outline_keeps_constructive_planning_available(name, mode) -> None: - (case,) = CASE_GROUPS[name] - width = 3 - outline = SBendOutline(40, 50, width, Polygon([(0, -1.5), (80, 38.5), (80, 41.5), (0, 1.5)])) - options = replace( - case.options, - search=replace(case.options.search, node_limit=100, sbend_outlines=(outline,)), - topology=replace(case.options.topology, mode=mode), - congestion=replace(case.options.congestion, max_iterations=1, warm_start_enabled=False), - refinement=replace(case.options.refinement, enabled=False), - ) - - result = route(case.problem, options=options) - - assert all(path.is_valid for path in result.results_by_net.values()) - - -@pytest.mark.parametrize("hint", [(), (StraightSeed(2400),)]) -def test_automatic_plan_recovers_full_complex_board_with_one_supplied_hint(hint) -> None: - (case,) = CASE_GROUPS["complex-routing-example-1"] - problem = replace(case.problem, initial_paths={"net_04": PathSeed(hint)}) - options = replace( - case.options, - search=replace(case.options.search, node_limit=100), - topology=replace(case.options.topology, mode="automatic"), - congestion=replace(case.options.congestion, max_iterations=1, warm_start_enabled=False), - refinement=replace(case.options.refinement, enabled=False), - ) - - result = route(problem, options=options) - - assert len(result.results_by_net) == 9 - assert all(path.is_valid for path in result.results_by_net.values()) - - -def test_point_terminal_replay_preserves_the_selected_port_headings() -> None: - (case,) = CASE_GROUPS["complex-routing-example-1-point-terminals"] - a, *others = case.problem.nets - problem = replace(case.problem, nets=(replace(a, start=a.start.translate(rotation=180)), *others)) - options = replace(case.options, topology=replace(case.options.topology, mode="automatic")) - chosen = route(problem, options=options) - paths = chosen.results_by_net - assert all(path.is_valid for path in paths.values()) - rebuilt = tuple( - replace(net, start=paths[net.net_id].path[0].start_port, target=paths[net.net_id].path[-1].end_port) for net in problem.nets - ) - assert rebuilt[0].start.r != problem.nets[0].start.r - assert [net.net_id for net in rebuilt if net.target.r == 180] == ["net_08"] - seeds = {net_id: result.as_seed() for net_id, result in paths.items()} - replay_options = replace( - options, search=replace(options.search, node_limit=0), refinement=replace(options.refinement, enabled=False), - ) - replay = route(replace(problem, nets=rebuilt, initial_paths=seeds), options=replay_options) - assert all(result.is_valid and result.locked_geometry == paths[net_id].locked_geometry for net_id, result in replay.results_by_net.items()) - - def test_complex_benchmarks_are_distinct_unseeded_nine_net_problems() -> None: assert len({case.name for case in BENCHMARK_CASES}) == len(BENCHMARK_CASES) assert len(COMPLEX_BENCHMARK_CASES) == 20 @@ -551,13 +489,13 @@ def test_joint_portal_lane_retry_keeps_incumbents_and_verifies_another_net() -> trials = planner._incumbent_trials(attempts, first, len(problem.nets)) - ordinary, joint, *_ = trials - assert set(first.valid_costs) == {"track2", "track5"} - assert joint.stage.policy == "joint-portal-lanes" + ordinary, joint, verified = trials + assert set(ordinary.valid_costs) == set(first.valid_costs) == {"track2", "track5"} + assert joint.stage.policy == verified.stage.policy == "joint-portal-lanes" assert set(joint.stage.incumbent_net_ids) == set(first.valid_costs) assert not joint.selectable - assert set(ordinary.valid_costs) <= {"track2", "track3", "track5"} - assert any(trial.selectable and set(trial.valid_costs) == {"track2", "track3", "track5"} for trial in trials) + assert verified.selectable + assert set(verified.valid_costs) == {"track2", "track3", "track5"} def test_automatic_weighted_scoring_preserves_coverage_and_reduces_cost() -> None: @@ -628,17 +566,6 @@ def test_port_spacing_certificate_reaches_clements_capacity() -> None: assert len(sample.stages) == 1 -def test_port_spacing_certificate_keeps_input_order_in_mixed_width_bank() -> None: - nets = tuple( - NetSpec(name, Port(5, y, 0), Port(95, y + 40, 0), width) - for name, y, width in (("a", 15, 6), ("b", 19, 2), ("c", 11, 3), ("d", 18, 2), ("clear", 30, 2)) - ) - problem = RoutingProblem((0, 0, 100, 100), nets) - - assert port_conflicts(problem, RoutingOptions()) == (("a", "b"),) - assert port_conflicts(replace(problem, nets=(nets[0], nets[2], nets[1], *nets[3:])), RoutingOptions()) == (("a", "c"), ("b", "d")) - - def test_paired_perimeters_respect_the_supplied_detour() -> None: case = next(case for case in FALLBACK_BENCHMARK_CASES if case.name == "fallback-seeded-detour") options = replace(case.options, search=replace(case.options.search, node_limit=100), topology=TopologyOptions(mode="automatic")) diff --git a/inire/tests/test_terminal_bench.py b/inire/tests/test_terminal_bench.py index 0c828c6..8bad596 100644 --- a/inire/tests/test_terminal_bench.py +++ b/inire/tests/test_terminal_bench.py @@ -2,12 +2,11 @@ from dataclasses import replace from itertools import combinations, pairwise import pytest -import shapely from shapely import union_all from shapely.affinity import translate from shapely.geometry import box -from inire import Bend90Seed, DiagnosticsOptions, Port, SBendSeed, TopologyOptions, route +from inire import Bend90Seed, Port, SBendSeed, TopologyOptions, route from inire.constants import TOLERANCE_LINEAR from inire.router._waypoints import export_waypoints from inire.tests.terminal_bench_lane_plan import terminal_bench_lane_problem @@ -132,57 +131,3 @@ def test_bundle_preserves_explicit_terminal_headings_by_default() -> None: options = replace(terminal_bench_options(), topology=TopologyOptions(mode="bundle")) with pytest.raises(ValueError, match="arrival heading 180 for net_08"): route(terminal_bench_problem(), options=options) - - -@pytest.mark.parametrize("unsupported", ["missing-function", "old-geos"]) -def test_automatic_constructs_bundle_without_triangulation(unsupported, monkeypatch) -> None: - if unsupported == "missing-function": - monkeypatch.delattr(shapely, "constrained_delaunay_triangles", raising=False) - else: - monkeypatch.setattr(shapely, "geos_version", (3, 9, 0)) - base = terminal_bench_options(node_limit=100, max_iterations=1) - options = replace( - base, topology=TopologyOptions(infer_terminal_headings=True), diagnostics=DiagnosticsOptions(capture_iteration_trace=True), - ) - callbacks = [] - run = route(terminal_bench_problem(), options=options, iteration_callback=lambda index, _: callbacks.append(index)) - assert len(callbacks) >= 2 - assert [entry.iteration for entry in run.iteration_trace] == callbacks[-1:] - - assert run.automatic is not None - assert len(run.automatic.verified_net_ids) == 9 - assert run.metrics.nodes_expanded == 0 - result = run.results_by_net["net_08"] - requested = next(net for net in terminal_bench_problem().nets if net.net_id == result.net_id) - assert result.path[-1].end_port.r == 180 - assert result.requested_net == requested - assert result.effective_net == replace(requested, target=replace(requested.target, r=180)) - - -def test_placement_recipes_replay_with_resolved_ports() -> None: - problem = terminal_bench_problem() - options = replace( - terminal_bench_options(node_limit=100, max_iterations=1), - topology=TopologyOptions(infer_terminal_headings=True), - ) - run = route(problem, options=options) - assert all(result.is_valid for result in run.results_by_net.values()) - seeds = {key: result.as_seed() for key, result in run.results_by_net.items()} - replay_options = replace( - options, search=replace(options.search, node_limit=0), topology=TopologyOptions(mode="off"), - refinement=replace(options.refinement, enabled=False), - ) - requested = route(replace(problem, initial_paths=seeds), options=replay_options) - assert not requested.results_by_net["net_08"].reached_target - - nets = tuple(result.effective_net for result in run.results_by_net.values()) - assert all(net is not None for net in nets) - replay = route(replace(problem, nets=nets, initial_paths=seeds), options=replay_options) - assert replay.metrics.nodes_expanded == 0 - assert replay.results_by_net.keys() == run.results_by_net.keys() - for key, result in replay.results_by_net.items(): - original = run.results_by_net[key] - assert result.is_valid - assert result.effective_net == original.effective_net - assert result.as_seed() == seeds[key] - assert result.locked_geometry == original.locked_geometry diff --git a/inire/tests/test_topology.py b/inire/tests/test_topology.py index 8f1b41c..81b92b2 100644 --- a/inire/tests/test_topology.py +++ b/inire/tests/test_topology.py @@ -1,188 +1,14 @@ from dataclasses import replace import pytest -from shapely.affinity import rotate, scale -from shapely.geometry import LineString, Polygon, box +from shapely.geometry import LineString, box -from inire import ( - CongestionOptions, DiagnosticsOptions, NetSpec, ObjectiveWeights, PathSeed, Port, RefinementOptions, - RoutingOptions, RoutingProblem, SBendSeed, SearchOptions, StraightSeed, TopologyOptions, route, -) +from inire import CongestionOptions, NetSpec, PathSeed, Port, RoutingOptions, RoutingProblem, SearchOptions, StraightSeed, TopologyOptions, route from inire.router._stack import build_routing_stack from inire.router._topology import _Assignment, _endpoint_access, _Mesh, _plan_lane_assignments, plan_corridors from inire.tests.routing_benchmarks import DETOUR -@pytest.mark.parametrize("hint", [(), (StraightSeed(5),), (StraightSeed(680),)]) -def test_seed_mode_realizes_corridor_with_incomplete_or_invalid_hint(hint) -> None: - problem = replace(DETOUR.problem, initial_paths={"detour": PathSeed(hint)}) - options = replace( - DETOUR.options, - search=replace(DETOUR.options.search, node_limit=100), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="seed"), - ) - - run = route(problem, options=options) - - assert run.results_by_net["detour"].is_valid - assert 0 < run.metrics.nodes_expanded <= 100 - - -@pytest.mark.parametrize("heading", [0, 90, 180, 270]) -def test_flat_ended_straight_recovery_after_a_bend_is_cardinally_invariant(heading) -> None: - keepout = rotate(box(52.85, 25, 54, 27.2), heading, origin=(0, 0)) - board = rotate(box(38, 18, 54, 62), heading, origin=(0, 0)) - start, target = Port(40, 20, 0).rotated(heading), Port(40, 60, 180).rotated(heading) - problem = RoutingProblem(board.bounds, (NetSpec("flat", start, target),), (keepout,)) - options = RoutingOptions( - search=SearchOptions(node_limit=200, bend_radii=(10,), sbend_radii=()), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - assert route(problem, options=options).results_by_net["flat"].is_valid - - -@pytest.mark.parametrize("mode", ["off", "guide", "seed", "automatic"]) -@pytest.mark.parametrize("sign", [1, -1]) -def test_search_infers_intermediate_sbend_offsets(mode, sign) -> None: - problem = RoutingProblem((0, 0, 100, 100), (NetSpec("shift", Port(20, 50, 0), Port(56, 50 + sign * 20, 0)),), clearance=0) - options = RoutingOptions( - search=SearchOptions(node_limit=100, bend_radii=(), sbend_radii=(10,)), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode=mode), - ) - - result = route(problem, options=options).results_by_net["shift"] - - assert result.is_valid - offsets = [segment.offset for segment in result.as_seed().segments if isinstance(segment, SBendSeed)] - assert len(offsets) == 2 - assert sum(offsets) == sign * 20 - - -@pytest.mark.parametrize("reflection", [-1, 1]) -def test_bounded_search_revisits_turns_away_from_the_target(reflection) -> None: - start, target = Port(190, reflection * -40, 270 if reflection == 1 else 90), Port(20, reflection * -50, 0) - board = scale(box(-25, -185, 230, 0), yfact=reflection, origin=(0, 0)) - keepout = scale(box(50, -185, 187, -37), yfact=reflection, origin=(0, 0)) - problem = RoutingProblem(board.bounds, (NetSpec("detour", start, target),), (keepout,), clearance=1) - options = RoutingOptions( - search=SearchOptions(node_limit=500, min_straight_length=2, max_straight_length=40, bend_radii=(10,), sbend_radii=()), - objective=ObjectiveWeights(bend_penalty=10, danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - - assert run.results_by_net["detour"].is_valid - assert run.metrics.nodes_expanded <= 500 - - -def test_small_budget_admits_a_turn_away_from_the_target() -> None: - net = NetSpec("detour", Port(503, -65, 270), Port(20, -12, 180)) - problem = RoutingProblem((0, -185, 555, 0), (net,), (box(50, -185, 500, -38),), clearance=1) - options = RoutingOptions( - search=SearchOptions(node_limit=10, min_straight_length=2, bend_radii=(10,), sbend_radii=()), - objective=ObjectiveWeights(bend_penalty=10, danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="off"), - ) - - run = route(problem, options=options) - - assert run.results_by_net["detour"].is_valid - assert run.metrics.nodes_expanded <= 10 - - -@pytest.mark.parametrize("with_peer", [False, True]) -def test_narrow_alternative_remains_available_with_a_shared_guide(with_peer) -> None: - narrow = NetSpec("narrow", Port(60, 110, 0), Port(740, 110, 0)) - wide = NetSpec("wide", Port(100, 500, 0), Port(150, 500, 0), 100) - nets = (narrow, wide) if with_peer else (narrow,) - problem = RoutingProblem((0, 0, 800, 600), nets, (box(300, 50, 480, 350),), clearance=6) - options = RoutingOptions( - search=SearchOptions(node_limit=500, bend_radii=(20,), sbend_radii=()), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode="seed"), - ) - - run = route(problem, options=options) - - assert all(result.is_valid for result in run.results_by_net.values()) - - -@pytest.mark.parametrize("mode", ["off", "guide", "seed", "automatic"]) -@pytest.mark.parametrize("narrow_by", [0, 0.001]) -def test_offset_gate_search_uses_exact_clearance(mode, narrow_by) -> None: - walls = ( - box(20, 0, 26, 5 + narrow_by), box(20, 9 - narrow_by, 26, 25), - box(43, 0, 49, 11 + narrow_by), box(43, 15 - narrow_by, 49, 25), - ) - net = NetSpec("gate", Port(1, 7, 0), Port(60, 13, 0)) - problem = RoutingProblem((0, 0, 62, 25), (net,), walls, clearance=1) - options = RoutingOptions( - search=SearchOptions(node_limit=250, min_straight_length=1, bend_radii=(), sbend_radii=(10,), sbend_offsets=(6,)), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode=mode), - ) - - assert route(problem, options=options).results_by_net["gate"].is_valid == (narrow_by == 0) - - -@pytest.mark.parametrize("mode", ["off", "guide", "seed", "automatic"]) -def test_rounded_keepout_guidance_preserves_acute_aperture(mode) -> None: - keepouts = (Polygon([(35, 0), (65, 0), (50, 22.95)]), Polygon([(35, 50), (65, 50), (50, 27.05)])) - problem = RoutingProblem((0, 0, 100, 50), (NetSpec("opening", Port(7, 15, 0), Port(93, 35, 0)),), keepouts, clearance=1) - options = RoutingOptions( - search=SearchOptions(node_limit=200, bend_radii=(), sbend_radii=(10,), sbend_offsets=(10,)), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False, use_tiered_strategy=False), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode=mode), - ) - - assert route(problem, options=options).results_by_net["opening"].is_valid - - -@pytest.mark.parametrize("mode", ["guide", "seed"]) -def test_guidance_retry_can_change_an_incumbent_in_an_offset_gate(mode) -> None: - nets = (NetSpec("a", Port(16, 48, 0), Port(199, 82, 0), 4.5), NetSpec("b", Port(18, 59, 0), Port(197, 93, 0), 1.25)) - walls = (box(60, 0, 67, 56.25), box(60, 74.125, 67, 118), box(125, 0, 132, 66.25), box(125, 84.125, 132, 118)) - problem = RoutingProblem((0, 0, 219, 118), nets, walls, clearance=1) - options = RoutingOptions( - search=SearchOptions(node_limit=1000, bend_radii=(10,), sbend_radii=(10,), sbend_offsets=(10, 12)), - objective=ObjectiveWeights(danger_weight=0), - congestion=CongestionOptions(max_iterations=2), - refinement=RefinementOptions(enabled=False), - topology=TopologyOptions(mode=mode), - diagnostics=DiagnosticsOptions(capture_iteration_trace=True, capture_conflict_trace=True), - ) - snapshots = [] - run = route( - problem, options=options, - iteration_callback=lambda index, results: snapshots.append((index, sum(result.is_valid for result in results.values()))), - ) - - assert all(result.is_valid for result in run.results_by_net.values()) - assert snapshots == [(0, 1), (1, 1), (2, 2)] - assert [(entry.iteration, entry.completed_nets) for entry in run.iteration_trace] == [(2, 2)] - assert [entry.iteration for entry in run.conflict_trace if entry.stage == "iteration"] == [2] - assert run.conflict_trace[-1].iteration is None - - def test_lane_assignment_keeps_mesh_path_order_on_equal_costs(monkeypatch: pytest.MonkeyPatch) -> None: problem = DETOUR.problem mesh = _Mesh(box(*problem.bounds), problem.static_obstacles, problem.nets[0].width / 2, problem.clearance) @@ -248,49 +74,18 @@ def test_seed_mode_respects_user_paths_on_repeated_runs() -> None: assert list(stack.world.iter_static_dilated_geometries()) == [] -@pytest.mark.parametrize("mode", ["guide", "seed"]) -def test_narrow_net_recovers_corridors_with_a_wide_peer(mode) -> None: - wide = NetSpec("wide", Port(12, 200, 0), Port(30, 200, 0), width=180) - problem = replace(DETOUR.problem, nets=(*DETOUR.problem.nets, wide)) - options = replace( - DETOUR.options, - search=replace(DETOUR.options.search, node_limit=100), - congestion=replace(DETOUR.options.congestion, max_iterations=1, warm_start_enabled=False), - topology=TopologyOptions(mode=mode), - ) - - run = route(problem, options=options) - - assert run.topology is not None - assert run.topology.corridor_counts == (("detour", 2),) - assert run.results_by_net["wide"].is_valid - if mode == "seed": - assert run.topology.seeded_net_ids == ("detour",) - assert run.results_by_net["detour"].is_valid - - -def test_seed_mode_routes_a_detour_between_flush_board_ports() -> None: - problem = replace(DETOUR.problem, nets=(NetSpec("detour", Port(0, 300, 0), Port(800, 300, 0)),)) - options = replace( - DETOUR.options, - search=replace(DETOUR.options.search, node_limit=100), - congestion=replace(DETOUR.options.congestion, max_iterations=1, warm_start_enabled=False), +def test_topological_routing_falls_back_for_ports_outside_the_inset_mesh() -> None: + problem = RoutingProblem(bounds=(0, 0, 100, 100), nets=(NetSpec("edge", Port(0, 50, 0), Port(100, 50, 0)),)) + options = RoutingOptions( + search=SearchOptions(bend_radii=(10,)), + congestion=CongestionOptions(max_iterations=1, warm_start_enabled=False), topology=TopologyOptions(mode="seed"), ) run = route(problem, options=options) - assert run.results_by_net["detour"].is_valid + assert run.results_by_net["edge"].is_valid assert run.topology is not None - assert run.topology.corridor_counts == (("detour", 2),) - assert run.topology.seeded_net_ids == ("detour",) - - -def test_board_edge_lead_requires_a_clear_flat_footprint() -> None: - board = box(0, 0, 100, 100) - mesh = _Mesh(board, (box(0, 48, 1, 52),), 1, 2) - assert mesh.endpoint(Port(0, 50, 0), 1, 10) is None - assert mesh.endpoint(Port(0, 0, 0), 1, 10) is None - assert mesh.endpoint(Port(0, 60, 0), 1, 10) is not None + assert run.topology.corridor_counts == () def test_seed_mode_keeps_a_verified_route_when_another_net_is_partial() -> None: diff --git a/inire/tests/test_visibility.py b/inire/tests/test_visibility.py index 03274d9..ff20439 100644 --- a/inire/tests/test_visibility.py +++ b/inire/tests/test_visibility.py @@ -6,16 +6,15 @@ from inire.router._astar_types import AStarMetrics from inire.router.visibility import VisibilityManager -def test_corner_visibility_cache_respects_max_distance() -> None: +def test_point_visibility_cache_respects_max_distance() -> None: engine = RoutingWorld(clearance=0.0) - engine.add_static_obstacle(box(-2, 0, 0, 2)) engine.add_static_obstacle(box(10, 20, 20, 30)) engine.add_static_obstacle(box(100, 20, 110, 30)) visibility = VisibilityManager(engine) origin = Port(0, 0, 0) - near_corners = visibility.get_corner_visibility(origin, max_dist=40.0) - far_corners = visibility.get_corner_visibility(origin, max_dist=200.0) + near_corners = visibility.get_point_visibility(origin, max_dist=40.0) + far_corners = visibility.get_point_visibility(origin, max_dist=200.0) assert len(near_corners) == 3 assert len(far_corners) > len(near_corners) @@ -31,14 +30,16 @@ def test_visibility_manager_is_lazy_until_queried() -> None: assert visibility.corners == [] assert engine.metrics.total_visibility_corner_index_builds == 0 + assert engine.metrics.total_visibility_builds == 0 visibility.ensure_corner_index_current() assert visibility.corners assert engine.metrics.total_visibility_corner_index_builds == 1 + assert engine.metrics.total_visibility_builds == 0 -def test_exact_corner_visibility_caches_local_queries() -> None: +def test_exact_corner_visibility_builds_graph_once_per_static_version() -> None: engine = RoutingWorld(clearance=0.0) engine.metrics = AStarMetrics() engine.add_static_obstacle(box(10, 20, 20, 30)) @@ -50,41 +51,7 @@ def test_exact_corner_visibility_caches_local_queries() -> None: assert second == first assert engine.metrics.total_visibility_corner_index_builds == 1 - assert engine.metrics.total_visibility_point_cache_misses == 1 - assert engine.metrics.total_visibility_point_cache_hits == 1 - assert engine.metrics.total_visibility_builds == 0 - assert engine.metrics.total_visibility_corner_pairs_checked == 0 - - -def test_exact_corner_visibility_respects_fractional_distance_limits() -> None: - engine = RoutingWorld(clearance=0.0) - engine.add_static_obstacle(box(0, 0, 1, 1)) - engine.add_static_obstacle(box(-11, 0, -9.9996, 1)) - visibility = VisibilityManager(engine) - origin = Port(0, 0, 0) - - assert visibility.get_corner_visibility(origin, max_dist=9.99955) == [] - assert visibility.get_corner_visibility(origin, max_dist=9.99965) == [(-10.0, 0.0, 9.9996)] - - -def test_exact_corner_visibility_accepts_only_endpoint_contact_and_scales_to_large_boards() -> None: - engine = RoutingWorld(clearance=0.0) - engine.add_static_obstacle(box(10, 20, 20, 30)) - engine.add_static_obstacle(box(-10, 10, 0, 15)) - visibility = VisibilityManager(engine) - origin = Port(10, 20, 0) - local = visibility.get_corner_visibility(origin, max_dist=25) - - assert (0, 15) in {(x, y) for x, y, _ in local} - assert not engine.corner_segment_visible((10, 20), (20, 30)) - - for index in range(49): - engine.add_static_obstacle(box(100 + 10 * index, 0, 105 + 10 * index, 5)) - assert visibility.get_corner_visibility(origin, max_dist=25) == local - - engine.add_static_obstacle(box(4, 16, 6, 19)) - blocked = visibility.get_corner_visibility(origin, max_dist=25) - assert (0, 15) not in {(x, y) for x, y, _ in blocked} + assert engine.metrics.total_visibility_builds == 1 def test_clear_cache_invalidates_without_rebuilding_and_static_change_rebuilds_lazily() -> None: @@ -95,13 +62,13 @@ def test_clear_cache_invalidates_without_rebuilding_and_static_change_rebuilds_l visibility.get_corner_visibility(Port(10, 20, 0), max_dist=100.0) assert engine.metrics.total_visibility_corner_index_builds == 1 - assert engine.metrics.total_visibility_point_cache_misses == 1 + assert engine.metrics.total_visibility_builds == 1 visibility.clear_cache() assert visibility.corners == [] assert engine.metrics.total_visibility_corner_index_builds == 1 - assert engine.metrics.total_visibility_point_cache_misses == 1 + assert engine.metrics.total_visibility_builds == 1 engine.add_static_obstacle(box(40, 20, 50, 30)) @@ -109,7 +76,7 @@ def test_clear_cache_invalidates_without_rebuilding_and_static_change_rebuilds_l assert visible == [] assert engine.metrics.total_visibility_corner_index_builds == 2 - assert engine.metrics.total_visibility_point_cache_misses == 2 + assert engine.metrics.total_visibility_builds == 2 def test_tangent_corner_candidate_query_matches_bruteforce_filter() -> None: diff --git a/inire/tests/test_visualization.py b/inire/tests/test_visualization.py index 1bf99b1..eb139ca 100644 --- a/inire/tests/test_visualization.py +++ b/inire/tests/test_visualization.py @@ -1,27 +1,26 @@ -from matplotlib import pyplot as plt -from numpy import asarray -from shapely.geometry import Polygon, box +import matplotlib +matplotlib.use("Agg") + +from inire.geometry.components import Bend90 +from inire.geometry.primitives import Port +from inire import RoutingResult from inire.utils.visualization import plot_routing_results -from scripts.render_documentation_figures import _polygon -def test_polygon_holes_remain_unfilled_in_routes_and_documentation() -> None: - keepout = Polygon(box(1, 1, 9, 9).exterior, [box(3, 3, 7, 7).exterior]) - figure, route_axes = plot_routing_results({}, [keepout], (0, 0, 10, 10)) - walkthrough_axes = figure.add_axes((0.6, 0.6, 0.25, 0.25)) - _polygon(walkthrough_axes, keepout, fill="gray", edge="black") - walkthrough_axes.set(xlim=(0, 10), ylim=(0, 10)) - route_axes.grid(False) - try: - figure.canvas.draw() - pixels = asarray(figure.canvas.buffer_rgba()) - for axes in (route_axes, walkthrough_axes): - def pixel(x, y, axes=axes): - xp, yp = axes.transData.transform((x, y)) - return tuple(pixels[-1 - round(yp), round(xp)]) +def test_plot_routing_results_respects_show_actual() -> None: + bend = Bend90.generate(Port(0, 0, 0), 10.0, 2.0, direction="CCW", collision_type="bbox") + result = RoutingResult("net", [bend], reached_target=True) - assert pixel(2.5, 2.5) != pixel(5, 5) - assert pixel(5, 5) == pixel(0.5, 0.5) - finally: - plt.close(figure) + fig_actual, ax_actual = plot_routing_results({"net": result}, [], (-5.0, -5.0, 20.0, 20.0), show_actual=True) + fig_proxy, ax_proxy = plot_routing_results({"net": result}, [], (-5.0, -5.0, 20.0, 20.0), show_actual=False) + + actual_line_points = max(len(line.get_xdata()) for line in ax_actual.lines) + proxy_line_points = max(len(line.get_xdata()) for line in ax_proxy.lines) + + assert actual_line_points > proxy_line_points + assert ax_actual.get_title().endswith("Actual Geometry)") + assert ax_proxy.get_title().endswith("(Proxy Geometry)") + + fig_actual.clf() + fig_proxy.clf() diff --git a/inire/utils/visualization.py b/inire/utils/visualization.py index f7fd1d8..a996393 100644 --- a/inire/utils/visualization.py +++ b/inire/utils/visualization.py @@ -12,11 +12,8 @@ if "MPLBACKEND" not in os.environ: matplotlib.use("Agg") import matplotlib.pyplot as plt -from matplotlib.patches import PathPatch -from matplotlib.path import Path import numpy from shapely.geometry import MultiPolygon, Polygon -from shapely.geometry.polygon import orient if TYPE_CHECKING: from matplotlib.axes import Axes @@ -27,16 +24,6 @@ if TYPE_CHECKING: from inire.results import RoutingResult -def draw_polygon(ax: Axes, polygon: Polygon, **style: object) -> None: - if not polygon.interiors: - ax.fill(*polygon.exterior.xy, **style) - return - - polygon = orient(polygon) - paths = [Path(list(ring.coords), closed=True) for ring in (polygon.exterior, *polygon.interiors)] - ax.add_patch(PathPatch(Path.make_compound_path(*paths), **style)) - - def plot_routing_results( results: dict[str, RoutingResult], static_obstacles: list[Polygon], @@ -61,7 +48,8 @@ def plot_routing_results( # Plot static obstacles (gray) for poly in static_obstacles: - draw_polygon(ax, poly, alpha=0.3, fc="gray", ec="black", zorder=1) + x, y = poly.exterior.xy + ax.fill(x, y, alpha=0.3, fc="gray", ec="black", zorder=1) # Plot paths colors = plt.get_cmap("tab20") @@ -80,8 +68,9 @@ def plot_routing_results( geoms = [poly] for g in geoms: - if isinstance(g, Polygon): - draw_polygon(ax, g, alpha=0.15, fc=color, ec=color, linestyle='--', lw=0.5, zorder=2) + if hasattr(g, "exterior"): + x, y = g.exterior.xy + ax.fill(x, y, alpha=0.15, fc=color, ec=color, linestyle='--', lw=0.5, zorder=2) else: # Fallback for LineString or other geometries x, y = g.xy @@ -95,12 +84,12 @@ def plot_routing_results( else: geoms = [poly] for g in geoms: - label = net_id if not label_added else "" - if isinstance(g, Polygon): - draw_polygon(ax, g, fc="none", ec=color, lw=1.5, alpha=0.9, zorder=3, label=label) + if hasattr(g, "exterior"): + x, y = g.exterior.xy + ax.plot(x, y, color=color, lw=1.5, alpha=0.9, zorder=3, label=net_id if not label_added else "") else: x, y = g.xy - ax.plot(x, y, color=color, lw=1.5, alpha=0.9, zorder=3, label=label) + ax.plot(x, y, color=color, lw=1.5, alpha=0.9, zorder=3, label=net_id if not label_added else "") label_added = True # 3. Plot subtle port orientation arrow @@ -109,6 +98,10 @@ def plot_routing_results( ax.quiver(p.x, p.y, numpy.cos(rad), numpy.sin(rad), color="black", scale=40, width=0.002, alpha=0.2, pivot="tail", zorder=4) + if not res.path and not res.is_valid: + # Empty failed paths are typically unroutable. + pass + # 4. Plot main arrows for netlist ports if netlist: for _net_id, (start_p, target_p) in netlist.items(): @@ -154,8 +147,20 @@ def plot_danger_map( y_coords = numpy.arange(danger_map.miny + res/2, danger_map.maxy, res) xv, yv = numpy.meshgrid(x_coords, y_coords, indexing='ij') - points = numpy.column_stack((xv.ravel(), yv.ravel())) - grid = danger_map.costs_at_points(points).reshape(xv.shape) + if danger_map.tree is not None: + points = numpy.stack([xv.ravel(), yv.ravel()], axis=1) + dists, _ = danger_map.tree.query(points, distance_upper_bound=danger_map.safety_threshold) + + # Apply cost function + safe_dists = numpy.maximum(dists, 0.1) + grid_flat = numpy.where( + dists < danger_map.safety_threshold, + danger_map.k / (safe_dists**2), + 0.0 + ) + grid = grid_flat.reshape(xv.shape) + else: + grid = numpy.zeros(xv.shape) # Need to transpose because grid is [x, y] and imshow expects [row, col] (y, x) im = ax.imshow( diff --git a/plans/full-project-review.md b/plans/full-project-review.md deleted file mode 100644 index 9fb309a..0000000 --- a/plans/full-project-review.md +++ /dev/null @@ -1,319 +0,0 @@ -# Full project review and follow-up plan - -Review baseline `3d7fc3a`. This pass covers public inputs and seed replay, physical geometry and collision checks, lattice and corridor routing, automatic planner selection, congestion and refinement, diagnostics, examples, and local developer checks. The earlier review fixes are in the baseline. See the [routing simplification plan](routing-simplification.md) for the prior prototypes and their parity requirements. - -The full local run passed 592 tests with `INIRE_RUN_PERFORMANCE=1` on Python 3.13.18, Shapely 2.1.2, and GEOS 3.13.1. Ruff passed. Public defaults matched the prior verified net IDs on all 67 boards, for 433 verified nets. The three focused triangulation capability tests passed, and all seven complex-routing walkthrough figures regenerated byte for byte. All 15 active Markdown pages are within two links of the user or developer guide, and local file links resolve. [Developer checks](../docs/development.md#check-a-change) · [Walkthrough](../docs/complex-routing-example-1.md) - -The follow-up pass independently verified every nonempty returned path on the 67 corpus boards under a 35-node, single-iteration automatic profile with warm start and refinement disabled. The resulting geometry reports matched the public results in that profile. Hatchling built the wheel and source distribution locally. The extracted wheel routed a public-API smoke case outside the checkout, and the unpacked source archive built a wheel and ran complex-routing example 1 to 9/9 with the benchmark CLI. All nine numbered examples ran from both the project directory and a clean export, producing nine images each time. [Automatic residual routing](../inire/router/_routing_policy.py#L211) · [Build configuration](../pyproject.toml#L39) - -Project-directory compatibility checks with Shapely 2.0.0 and 2.0.7 confirmed the automatic lattice fallback on Shapely versions without triangulation, 9/9 coverage in complex-routing example 1, and the documented restrictions on active guide and seed searches. The Shapely 2.0.0 run used Python 3.11.11, GEOS 3.11.1, and NumPy 1.26.4. A 192-layout primitive matrix passed 768 seed verifications on each of three Shapely versions and 768 active searches on Shapely 2.1.2 and 384 each on 2.0.0 and 2.0.7. An independent rectangular geometry check agreed with all 1,728 route reports and the associated final conflict traces on each version. [Mode and dependency behavior](../docs/complex-routing-example-1.md#compare-all-routing-modes) - -On Python 3.14.10 with the local Shapely build against GEOS 3.15.0, the full suite passed 581 tests and skipped the 11 opt-in performance checks. A fresh source archive built a wheel whose 39 production modules all matched the reviewed checkout. The extracted wheel routed a public smoke case on Python 3.13 and 3.14 from outside the checkout. [Local verification](../docs/development.md#check-a-change) · [Build configuration](../pyproject.toml#L39) - -The six imported layouts regenerated byte for byte from the pinned upstream archives. The documented placed-device route survived a WKT export and readback as a connected polygon, and the locked-route example completed a second route around the exported geometry. A 72-call concurrent smoke test reproduced the sequential geometry of 36 simple layouts. A further 96 seed replays used rotated and translated serial-gate layouts. Their geometry reports were consistent under those transforms, and the erased collision diagnostics in one layout reduced to the crossing in item 30. Additional probes used nanometer-scale bends and keepouts, narrow apertures, seed reuse after heading inference, partial incumbent reuse, and dependency combinations outside the lockfile. [Fixture importer](../docs/benchmark-fixtures.md#regenerate-the-converted-inputs) · [Placed-device and export workflow](../docs/user/route-a-layout.md#route-between-placed-crossings) - -Three fresh processes with different Python hash seeds produced identical per-net outcomes, move sequences, polygon WKB hashes, reports, selected stages, and work counters across 82 runs. These covered all 67 corpus boards in bounded automatic mode and five boards in lattice, guide, and seed modes with a fixed net-shuffle seed. [Benchmark options](../inire/tests/routing_corpus.py) - -The independent fabrication pass used three openEBL 2025-02 submissions. KLayout 0.30.12 extracted the silicon polygons, port markers, and authored waveguide waypoints on the submissions' 1 nm grid. A fresh automatic search verified 9/18 links in the Raymond MZI array, 27/36 in the CROW MZI, and 2/4 in the contra-directional coupler with a 225-node limit per attempt. Each link was attempted separately, retaining neighboring authored silicon and opening its two intentional port joins in the keepouts. All 58 links verified when replayed from their authored waypoints with 5 µm circular bends. Reversing the search recovered the other nine CROW links, and lattice attempts with a 1,200-node limit completed the other two layouts. After replacing all 58 links across the three layouts and writing OASIS at 1 nm, the pinned EBeam deck reported exactly the same markers as the originals. The Raymond original, an export-only control, and the modified version all gave zero markers. These are checks against the published deck and the selected optical routes. [Pinned fabrication submissions](https://github.com/SiEPIC/openEBL-2025-02/tree/a887476a301db2a014be007717cd1821e111f58e/submissions) · [Pinned EBeam deck](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/drc/SiEPIC_EBeam.drc) - -On the independent 5-by-3 mm CPW chip, KLayout confirmed that the published etch layer removes a 5 µm section from the feedline conductor. Routing the two conductor sections as separate connections and reconstructing their 6 µm gaps returned the same effective metal across the full chip after OASIS write and read at 1 nm. Routing one connection with the coupling mask omitted produced a continuous conductor across the intended break. [Published CPW chip and layout source](https://github.com/paulggin/klayout-cpw-design/tree/a38dc34cf6785ba0af41b27f43b6137fd2b69cc7) - -## Implementation order - -Implemented items 1, 2, and 17 cover missing joins, extra line or point contact on the join plane, custom port-face widths, and outer-edge arc accuracy. The focused geometry, API, collision, and refinement run passed 287 tests. - -Implemented items 3, 6, and 21 retain constructive planning for unused custom outlines, reject unsupported search and congestion settings, and match custom S-bend widths consistently in search and replay. - -Implemented items 11, 13, and 30 preserve replay diagnostics across all four modes, report the segment of a width-incompatible seed, skip proximity work in geometry-only runs, and use explicit refinement weights for automatic refinement selection. - -Implemented items 25 and 36 use cardinal heading vectors and consistent length units in the lattice and corridor heuristics. Partial results track geometric progress even with zero heuristic weight, and a high legal move cost no longer acts as a collision sentinel. - -Implemented items 7, 8, 9, and 10 cover endpoint-aware corner visibility with a local fallback, hole-aware plots, indexed terminal-bank checks, and removal of unused private A* node fields. The 4,000-net capacity probe took about 0.11 s for a clear bank and 0.04 s for a densely overlapping bank. - -Implemented items 23 and 38 expose optional same-net spacing and reject edge and vertex shorts between different nets at zero clearance, including automatic reservations. Hard corridor congestion now uses exact physical spacing with exact-fit and diagonal controls. - -Implemented items 4, 5, 12, 15, 16, 18, 20, 24, 26, 27, 28, 32, 37, and 41 cover straight and turn recovery, width-specific corridors, search deadlines, partial hints, inferred headings, terminal diagnostics, and bounded guidance retries. The saved CROW fixtures reproduce all nine physical inputs on their authored grid. Each routes in its authored direction at the 225-node limit. - -Implemented items 14 and 22 exclude repository tests from the wheel and workspace metadata from the source archive. The source archive rebuilt a wheel and verified 9/9 nets on complex-routing example 1. The extracted wheel routed and verified an export outside the checkout with warnings treated as errors on Python 3.11 with Shapely 2.0.7 and NumPy 1.26.4 and 2.2.6. The current Python 3.13 environment also passed. - -Implemented items 19 and 29 bound proximity sampling and move-cache memory. The 8,000-expansion blocked-board probe retained 8,192 absolute move entries and used about 418 MiB peak RSS. The review baseline retained 111,086 entries and used about 648 MiB. - -Implemented items 31, 33, 34, 35, 39, and 40 add authored bend lengths, physical CPW envelopes, process-profile routing, placed-port width checks, rounded export verification, and layer grouping. The local tests use the reviewed widths, radii, pitches, and export grid controls. - -### Implementation verification - -- The full suite passed 746 tests with `INIRE_RUN_PERFORMANCE=1`. Ruff passed for the package, scripts, and examples. -- Both corpus profiles retained the same verified net IDs on all 67 boards, for 433 verified nets per profile. On the matched-budget profile, total search work fell from 27,160 to 26,559 expansions. The splitter tree retained its 6/6 coverage at the original 500-node per-search limit and used 8,957 total expansions, up from 6,298. The combined benchmark-weighted cost fell by about 0.16% across matching net sets. -- The no-warm-start fan-out canary retains its verified coverage and work guardrails. Its example sets `distance_heuristic_weight=10.0` to preserve its intended search priority with a length price of `0.1`. The option scales the heuristic distance term in the chosen cost units. It leaves the applied route objective and the default weight of `1.0` unchanged. -- KLayout read back the rounded bend controls as separate conductors. The pinned EBeam deck produced eight spacing markers for the 1 nm export of the near-limit pair and zero for the 0.01 nm export of the same pair. The 3,072 nm outer-radius control passed Inire's geometric check with 71.03 nm separation at 1 nm resolution and still received four markers from the deck. -- All nine replacement CROW routes passed the 1 nm export check. The assembled OASIS file, the export-only control, and the original layout had the same ten EBeam spacing markers at the same locations. -- All 16 active documentation pages are at most two links from the user or developer guide. All local file links resolve. Six complex-routing walkthrough images regenerated byte for byte. The routing-mode comparison, placed-crossing illustration, and partial-route illustration reflect the current search and geometry. - -| Batch | Work | Acceptance gate | -| --- | --- | --- | -| Physical verification | 1, 2, 17, 23, and 38 | Reject the faulty geometry and keep legal joins valid in search and seed replay. Check circular bend accuracy, folded-route spacing, and isolation between different nets. | -| Routing coverage and selection | 3, 4, 5, 11, 15, 16, 18, 24, 25, 27, 28, 32, 36, and 41 | Recover each reported route at its existing budget, and apply objective units consistently. Reach the required bound on every corpus board. | -| Input, replay, and diagnostic accuracy | 6, 7, 8, 20, 21, 26, 30, and 37 | Diagnose invalid settings and impossible terminals early, preserve useful visibility on large layouts, render the actual free space, and replay the intended physical geometry. | -| Performance and cleanup | 9, 10, 12, 13, 19, and 29 | Compare runtimes and memory where the workload changes, and keep the best verified result if a worker times out. Require exact routing and trace parity for the private-state cleanup. | -| Release packaging | 14 and 22 | Build and smoke-test the runtime wheel independently of the checkout. Keep the source archive usable for development and verify the supported dependency combinations. | -| Fabrication workflow | 31, 33, 34, 35, 39, and 40 | Compare process-specific geometry and authored optical lengths before and after routing and export. Check port matching, the RF cross-section, per-net bend rules, export-grid clearance, and layer assignment. | - -## 1. Detect extra contact on the join plane — High - -Two adjacent custom S-bends can share their centered two-unit port face and another two-unit edge ten units away. The route verifies with zero self-collisions because both intersections lie on the same plane. The extra edge connects separated parts of the route. [Adjacent-component verification](../inire/geometry/component_overlap.py#L48) - -Reproduce on bounds `(0, 0, 220, 120)` at zero clearance. Route from `(20, 30, 0)` to `(180, 30, 0)` using `SBendSeed(40, 50)` and `SBendSeed(-40, 50)` with width 2. Give both outlines their standard local endpoints. The base outline is the strip formed by adding and subtracting one from each y coordinate of `[(0, 0), (20, offset / 10), (50, 3 * offset / 4), (80, offset)]`. Union the positive outline with `box(70, 36, 74, 51)` and `box(73, 49, 80, 51)`. Union the negative outline with `box(6, -3, 8, 11)` and `box(0, 9, 7, 11)`. Seed-only verification reports two shared edges on `x = 100`, spanning `y = 69..71` and `y = 79..81`. - -Determine the connected, centered face shared by the two components and confine the join tolerance to that face. Reuse the predicate in verification, A* ancestor checks, and refinement. Check the off-center edge and a point contact away from the face, ordinary straight and bend joins, and rotated custom joins that differ by rounding. [A* and refinement callers](../inire/router/refiner.py#L69) - -## 2. Validate port-face width on custom bends — Medium - -`SBendOutline(40, 50, 2, polygon)` accepts both terminals with faces only 0.02 units wide. Use the strip in item 1 with `offset=40` and a half-width of `0.01`. A route from `(10, 10, 0)` to `(110, 50, 0)` with a 10-unit width-2 straight on each side verifies with two abrupt width changes. The current check validates the face position, orientation, and finite extent. [Outline validation](../inire/model.py#L52) · [Port-face predicate](../inire/geometry/components.py#L33) - -The same check affects custom 90-degree bends, where one configured polygon can apply to nets of different widths. Set `bend_radii=(10,)` and `bend_physical_geometry=box(0, -11, 11, -9).union(box(9, -11, 11, 0))`. On an empty 100-by-100 board at zero clearance, verify a net from `(10, 20, 0)` to `(30, 40, 90)` with `StraightSeed(10)`, `Bend90Seed(10, "CCW")`, and `StraightSeed(10)`. Lattice and automatic modes both report completion at widths 2 and 4. At width 4 the exported straight faces span 4 units and the bend faces span 2 units. [Custom quarter-turn geometry](../inire/geometry/components.py#L406) - -Check the centered connected span against the declared width for S-bend outlines and the routed net width for custom quarter turns. Interior sections can still vary in width. Compare the face extent within a geometric tolerance so multiple collinear edges can form a single face. Reject the 0.02-unit S-bend outline and accept an asymmetric outline with full-width terminal faces. Verify the width-2 quarter turn and diagnose the width-4 mismatch in both search and seed replay. Describe how a custom quarter-turn template applies on mixed-width boards. [Custom geometry API](../docs/user/api-reference.md#searchoptions) - -## 3. Keep automatic planning available with unused outlines — Medium - -Complex-routing example 1 uses width-2 nets. Adding a single `SBendOutline(40, 50, 3, polygon)` dropped automatic coverage from 9/9 to 0/9 with a 100-node limit, one congestion iteration, warm start off, and refinement off. The width-3 outline matches no net. Automatic switches to lattice routing when the outline list is nonempty, and explicit bundle has the same unconditional restriction. [Automatic dispatch](../inire/router/_automatic.py#L603) · [Bundle checks](../inire/router/_bundle.py#L213) - -Check whether any registered outline applies to a net before changing planner availability. Share the applicability rule between automatic and bundle. Keep the lattice fallback when an outline applies. With an unused width, require the fixed-heading example's 9/9 result and verify that the point-terminal bundle still runs. With a matching outline, verify the exported polygon and preserve the documented bundle error. [Mode comparison and fixture](../docs/complex-routing-example-1.md#compare-all-routing-modes) - -## 4. Recover legal straight moves after a bend — Medium - -On bounds `(38, 18, 54, 62)`, use start `(40, 20, 0)`, target `(40, 60, 180)`, width 2, clearance 2, and keepout `box(52.85, 25, 54, 27.2)`. Use radius-10 quarter turns, disable S-bends and warm start, and run lattice search for one iteration with a 200-node limit. Search stops after the first bend. The seed `CCW(10), straight(20), CCW(10)` verifies. An in-memory probe enabling the flat-ended footprint check at the intermediate port reached the target in five expansions. [Straight-move proposal](../inire/router/_astar_moves.py#L217) · [Flat-ended scan](../inire/geometry/collision.py#L729) - -Preserve the conservative ray for ordinary move proposals. Recover a candidate when the ray blocks an otherwise legal straight at a component output. Try a deferred check if adding the exact scan to the main frontier changes bounded search order. Check all four rotations, an obstacle that genuinely blocks the next straight, and the splitter-tree benchmark, which is sensitive to changes in straight proposals. - -## 5. Recover narrower passages when the shared mesh finds a different corridor — Medium - -The width-specific retry covers nets with no shared corridor. If the shared mesh supplies a different corridor, the narrower net can still lose a usable passage. On an 800-by-600 board, place a keepout at `box(300, 50, 480, 350)`. The width-2 net runs east from `(60, 110, 0)` to `(740, 110, 0)` at clearance 6. Add an unrelated width-100 straight from `(100, 500, 0)` to `(150, 500, 0)`. With seed mode, radius 20, S-bends and warm start off, one iteration, and 500 nodes, the detour changes from completed with two corridors to partial with one corridor. The shared inset closes the lower opening. [Width-specific corridor fallback](../inire/router/_topology.py#L432) - -Prototype a width-specific retry after the shared corridors fail to realize a route, or include an alternative through a passage absent from the shared mesh. Keep the shared lane assignment and the per-net expansion allowance intact. Require the width-2 route to complete with or without the unrelated wide net at the same budget. Check mixed-width portal contention and the existing shared-lane cases for coverage and cost changes. - -## 6. Validate search and congestion settings at construction — Medium - -`SearchOptions(node_limit=float('nan'))` is accepted and bypasses the normal expansion-limit comparison. `CongestionOptions(max_iterations=1.5)` is accepted and raises `TypeError` inside `range()` during routing. A misspelled `net_order='longesst'` silently selects shortest-first ordering. [Search and congestion options](../inire/model.py#L66) · [Expansion ceiling](../inire/router/_search.py#L74) · [Net ordering](../inire/router/_congestion_policy.py#L16) - -`NetSpec` also accepts integer IDs even though the API type is `str`. On a 100-by-40 empty board with one width-2 net from `(5, 20, 0)` to `(90, 20, 0)`, replay `StraightSeed(85)` at zero search nodes and use integer ID `7`. Verification reports one dynamic conflict against the path itself because it queries the index with a string ID. Two overlapping paths with IDs `7` and `"7"` raise `TypeError` while comparing peers. Enforce string IDs at construction, or normalize IDs before uniqueness checks and seed-map validation. [Net model](../inire/model.py#L24) · [Verification index lookup](../inire/geometry/collision.py#L661) - -Validate nonnegative integer budgets and enumerate allowed order names at construction. Keep zero-budget verification behavior and support the documented defaults. In the same change, decide and document which numerical objective and penalty values are supported. Reject nonfinite values before scoring or iteration. Test zero, valid positive values, rejected values, and identifiers loaded from serialized layouts through the public constructors. - -## 7. Make exact-corner visibility useful on real corner states — Medium - -With clearance zero, put two keepouts at `box(10, 20, 20, 30)` and `box(-10, 10, 0, 15)`. The segment from `(10, 20)` to `(0, 15)` touches the two keepouts only at its endpoints. The visibility ray returns reach zero because it counts the source corner itself as a hit. The exact-corner query returns no visible corner. In a separate probe with 200 indexed corners, adding one distant rectangle dropped the same local query from five visible corners to zero. Above 200 corners the graph builder skips construction and the exact query has no local fallback. [Corner visibility](../inire/router/visibility.py) · [Ray intersection](../inire/geometry/collision.py#L812) · [Visibility option](../docs/user/api-reference.md#searchoptions) - -Give visibility rays endpoint-aware semantics and leave move admission responsible for physical clearance. Compute or cache local exact neighbors on demand when global precomputation is skipped. Check an outward ray, a ray entering the source keepout, a blocker strictly between corners, and a local query before and after adding distant corners. Confirm the default tangent mode keeps its existing coverage and work. - -## 8. Show holes in keepouts and routed polygons — Low - -The main route plot and the walkthrough polygon helper draw exterior rings only. For a keepout with exterior `box(20, 20, 80, 80)` and hole `box(30, 30, 70, 70)`, a net from `(35, 50, 0)` to `(65, 50, 0)` verifies inside the hole. Both renderers paint the hole as keepout. The same rendering path also omits holes in custom outlines. [Route visualization](../inire/utils/visualization.py#L49) · [Documentation figure helper](../scripts/render_documentation_figures.py#L45) - -Share a hole-aware polygon renderer for the affected paths, including filled and outline-only geometry. Keep labels, proxy styling, and axis bounds. Verify a point in a hole stays unfilled in a headless rendering test. Regenerate the active walkthrough figures and inspect any visual changes. - -## 9. Avoid quadratic scans of clear terminal banks — Low - -The capacity check enumerates every pair of terminals on each aligned bank. With width-2 nets at `y = 5 * i` between `x = 5` and `x = 95` and clearance 2, every terminal pair is clear. The check took about 0.25, 0.75, and 2.62 seconds for 1,000, 2,000, and 4,000 nets on this machine. [Aligned port conflict check](../inire/router/_capacity.py#L62) - -Index lateral intervals to find pairs that can actually conflict. Preserve the disjoint-net bound and compare deterministic pair selection on overlapping and mixed-width banks. Benchmark the clear bank and a dense bank separately. Use the existing capacity suite and automatic coverage checks before adopting a changed pair order. - -## 10. Remove unused per-node search state — Low - -`AStarNode.base_move_cost`, `cache_key`, and `congestion_resolved` have no readers or current constructor call sites that supply them. The public metrics still expose lazy-congestion counters and two ray-cast categories whose production callers have been removed. [Search node](../inire/router/_astar_types.py#L153) · [Public metrics](../inire/results.py#L216) · [Ray-cast labels](../inire/geometry/collision.py#L693) - -Remove the three private node fields and their constructor arguments in a parity-only change. Keep exported counter names available for existing diagnostics and baseline files. Document retired counters separately if that helps interpret current reports. Compare selected paths and stage, iteration, and frontier traces exactly. [Parity procedure](../docs/routing-diagnostics.md#reproduce-and-compare) - -## 11. Honor the explicit refinement objective in automatic mode — Medium - -Use the seeded foldback fixture with a 100-node search limit, all search objective weights set to zero, and `RefinementOptions(objective=ObjectiveWeights(danger_weight=0))`. With identical geometry and congestion settings, explicit lattice mode returns a verified nine-component route of length 392.83. Automatic mode builds the same refinement but returns its 17-component, 475.66-unit incumbent because both layouts tie under the search objective. [Seeded foldback fixture](../inire/tests/test_refinements.py#L21) · [Refinement scoring](../inire/router/refiner.py#L100) · [Automatic selection](../inire/router/_automatic.py#L149) - -Keep the search objective for ranking ordinary planner attempts. For a verified refinement that preserves the selected net IDs, apply the caller's explicit refinement objective consistently when deciding whether to keep the replacement. Define its interaction with `automatic_length_weights` in the API reference. Check the foldback in both modes, the default selection when no override is set, and the guard against losing verified nets. [Refinement handoff](../inire/router/_automatic.py#L584) · [Objective options](../docs/user/api-reference.md#refinementoptions) - -## 12. Report and enforce the worker deadline during long attempts — Low - -The worker checks its timeout before starting each net. A single search can cross the deadline, complete, and leave `timeout_events` at zero. In a fake-clock probe, a one-net lattice worker with warm start disabled completed a legal straight after the clock advanced from 0 to 61 seconds. Its 60-second deadline was never observed. Corridor preparation and warm-start work can also run past the deadline before the first between-net check. [Worker deadline](../inire/router/_router.py#L290) · [Between-net timeout check](../inire/router/_router.py#L955) · [A* expansion loop](../inire/router/_search.py#L74) - -Define safe cancellation points for the worker. Check the deadline during long search loops and at phase transitions, count expiration once, and keep the best verified result and consistent collision indexes. Use a fake clock to cover a single long search, expiry during preparation, and a timeout after a previous iteration produced a verified layout. Check that tight loops retain their current runtime on the performance suite. - -## 13. Skip proximity sampling in verification-only runs — Low - -In explicit lattice mode with `node_limit=0`, one congestion iteration, and refinement disabled, the default danger weight still builds the proximity tree even though no moves are scored. On a 100,100-by-100,100 board with keepout `box(50, 80, 100050, 100080)`, verification of the straight seed from `(10, 20, 0)` to `(90, 20, 0)` built 80,000 samples and took about 34 ms. Setting the danger weight to zero produced the same verified result and took about 0.8 ms. Both runs expanded zero nodes. [Proximity setup](../inire/router/_stack.py#L47) - -Build obstacle samples when search or enabled refinement actually needs proximity costs. Keep the board bounds available for geometric verification. Test an explicit verification-only run with the default weights and a seeded refinement with a nonzero danger weight. Check automatic candidate scoring separately, since automatic may still need proximity data for layout selection. [Automatic scoring](../inire/router/_automatic.py#L149) - -## 14. Ship a self-contained runtime wheel — Low - -The local wheel contained 41 entries under `inire/tests/`, including benchmark tests and fixtures. It contained no `scripts/` or `examples/` entries. The public routing smoke case passed from the extracted wheel with the checkout removed from the import path. Importing the shipped `inire.tests.test_routing_benchmarks` failed with `No module named 'scripts'`. [Build configuration](../pyproject.toml#L39) · [Benchmark test imports](../inire/tests/test_routing_benchmarks.py#L24) - -Keep repository benchmark tests and their fixtures in the source distribution and exclude them from the runtime wheel. Build both artifacts locally, run the public-API smoke cases against the wheel with the checkout off the import path, and check that the unpacked source distribution can build the wheel and run its benchmark tooling. - -## 15. Keep corridor seeding available for incomplete caller hints — Medium - -On the existing detour fixture, use seed mode with a 100-node search limit, one congestion iteration, and warm start and refinement disabled. The unseeded run completes with a topology-generated seed in 41 expansions. Adding an empty `PathSeed`, or the legal prefix `PathSeed((StraightSeed(5),))`, consumes the detailed-search budget and returns a partial result. Adding a complete straight seed of length 680 through the obstacle returns a static collision with zero expansions. The corridor seed builder skips any net present in the caller's seed mapping. [Detour fixture](../inire/tests/routing_benchmarks.py) · [Corridor seed builder](../inire/router/_router.py#L216) · [Seed use during routing](../inire/router/_router.py#L838) - -Preserve a complete verified caller seed. Treat an empty seed as an absent hint, and allow seed mode to realize a corridor when the caller's seed is incomplete or fails geometric checks. Reuse a legal prefix as guidance when possible. Keep the original diagnostic path when the verification-only budget is zero. Require the detour to complete under the same budget with no seed, an empty seed, and a legal prefix. Check the statically invalid complete hint in both search and verification-only runs, and retain the existing test for caller seeds across repeated runs. [Seed mode tests](../inire/tests/test_topology.py#L56) - -## 16. Infer intermediate S-bend offsets for a multi-bend shift — Medium - -Use an empty 100-by-100 board, width 2, clearance 0, start `(20, 20, 0)`, and target `(56, 40, 0)`. Disable quarter turns and set `sbend_radii=(10,)`, a 100-node budget, one congestion iteration, and warm start and refinement disabled. With `sbend_offsets=None`, lattice, guide, seed, and automatic all return partial. With `sbend_offsets=(10,)`, each mode verifies two consecutive 10-unit S-bends. The implicit target-offset logic only proposes that shift when a single configured bend can cover it. [S-bend move proposals](../inire/router/_astar_moves.py#L329) · [Public option](../docs/user/api-reference.md#searchoptions) - -Propose bounded intermediate offsets when the target lies beyond one S-bend's lateral range, using the remaining forward room and the configured radii. Check both signs, valid fractional radii, and a budget that cannot realize the proposed shift. Preserve explicit signed offset lists and the empty-list setting that disables S-bends. Compare all four modes on the reproducer and review branch counts and coverage on the corpus. - -## 17. Preserve circular bend accuracy in fine layout units — High - -A 100 µm bend represented on a 1 nm grid uses 16 segments per arc. In a zero-budget quarter-turn replay at zero clearance, use bounds `(0, 0, 102000, 102000)`, a 500-unit net from `(1000, 1000, 0)` to `(101000, 101000, 90)`, and `Bend90Seed(100000, "CCW")`. Put a 10-unit square around the point at radius `100190` and angle `-π/2 + π/64` from the bend center `(1000, 101000)`. The entire square is inside the ideal circular guide. The exported polygon misses the keepout by 55.52 units and the result verifies. A circular `SBendSeed(50000, 100000)` also missed a keepout inside the first ideal arc. [Arc sampling](../inire/geometry/components.py#L218) · [S-bend sampling](../inire/geometry/components.py#L509) · [Coordinate units](../docs/user/route-a-layout.md#define-the-inputs) - -The quarter turn uses 1,571 segments at radius 79,999 and drops to 16 at radius 80,001 because the sagitta-derived angle falls below the angular tolerance. Compute the number of segments with a numerically stable formula and keep the approximation error bounded as radius grows. Check quarter turns and both S-bend halves on either side of the threshold, compare several layout units for the same physical geometry, and verify keepouts near both arc boundaries against analytic distances. If a tessellation limit is necessary, give callers an explicit accuracy contract. [Bend option reference](../docs/user/api-reference.md#searchoptions) - -## 18. Keep planning available for unseeded nets on a partially seeded layout — Medium - -Complex-routing example 1 verifies 9/9 with automatic mode, a 100-node limit, one congestion iteration, and refinement disabled. Reuse its verified 2,400-unit straight for `net_04` through `initial_paths` and the same call verifies only that net. An empty `PathSeed` for `net_04` also drops coverage to 1/9. Holding that straight fixed as a keepout verifies one of the eight remaining routes. A nonempty seed mapping suppresses the bundle, column, compact, and direct planners for the whole layout. In the worker, one materialized path also suppresses greedy warm-start generation for every remaining net. [Bundle entry check](../inire/router/_bundle.py#L213) · [Direct paths](../inire/router/_routing_policy.py#L78) · [Worker preparation](../inire/router/_router.py#L289) - -Treat empty paths as absent during planning. Make verified caller paths available as incumbents while retaining compatible construction and warm-start options for unseeded nets. For example, a candidate that already reproduces the caller's straight can use it with its existing geometry. Verify candidates on the whole board before selecting them. Recover 9/9 on this fixture with either hint at the same budget. Cover a caller seed that disagrees with a constructive candidate and preserve the precedence of fixed terminal headings. [Reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route) - -## 19. Bound proximity-map work on fine layout grids — Medium - -The default proximity map samples every five layout units and sets its distance cutoff to ten units. Route a width-0.5 µm straight five micrometers below a 1 mm square keepout on a 1.5-by-1.6 mm board. With lattice mode and 20 search nodes, both micrometer and nanometer representations complete in two expansions. At 1 nm per unit, tree setup grows from 800 to 800,000 samples, from about 0.5 ms to 360 ms, and from about 71 MiB to 208 MiB peak process memory. The proximity cost at the same physical position changes from 0.04 to zero. This is active search, so skipping verification-only work in item 13 would leave the problem in place. [Proximity sampling](../inire/router/danger_map.py#L68) · [Automatic candidate scoring](../inire/router/cost.py#L243) · [Coordinate units](../docs/user/route-a-layout.md#define-the-inputs) - -Bound setup work independently of the database unit and document how callers choose the physical range of proximity scoring. Compare an index of boundary segments with exposing a configurable sampling interval and sharing the index between attempts. Keep the default corpus route coverage and measure peak memory on identical one-micrometer, 0.1-micrometer, and one-nanometer layouts. Include a long keepout edge and a polygon with an interior opening. - -## 20. Preserve routed headings when reusing inferred-terminal paths — Low - -On the point-terminal variant of complex-routing example 1, automatic routing with heading inference verifies 9/9. Export the nine `as_seed()` values and replay them using the original `NetSpec` entries and zero search nodes. Only 8/9 verify because `net_08` arrived westbound and its original target heading points east. Replay with both endpoint ports from the chosen path and all nine verify. `PathSeed` stores only moves, so callers saving paths for reuse need the inferred terminal ports as well. [Result seed export](../inire/results.py#L284) · [Heading inference dispatch](../inire/router/_automatic.py#L618) · [Point-terminal walkthrough](../docs/complex-routing-example-1.md#compare-all-routing-modes) - -Add a public example that stores both chosen ports alongside the seed, then rebuilds a zero-budget verification problem. Exercise a changed departure heading and a changed arrival heading, and compare the replayed physical polygons. Use the same port values in the example when exporting geometry and reusing its path. [Reuse workflow](../docs/user/route-a-layout.md#reuse-an-existing-route) - -## 21. Match custom S-bend outlines across ordinary floating-point conversions — Medium - -Register `SBendOutline(40, 50, 0.3, polygon)` and replay `SBendSeed(40, 50)` from `(10, 10, 0)` to `(90, 50, 0)`. Form the outline by taking the points `[(0, 0), (20, 0), (50, 25), (80, 40)]` and joining the upper and lower offsets at `±0.15` in y. At width `0.3` the route exports the registered outline as one polygon. At width `0.1 + 0.2` it exports two circular arc polygons. Both routes verify. Template lookup, move proposals, and planner eligibility require a consistent definition of a matching width. [Outline lookup and registration](../inire/model.py#L93) · [Move proposals](../inire/router/_astar_moves.py#L329) - -Normalize equivalent values or use a narrowly bounded matching tolerance consistently across registration, search, seed replay, and planner eligibility. Detect ambiguous matches explicitly and keep genuinely distinct widths and radii independent. Test the two equivalent widths against the same outline and verify that a materially different width still receives the circular bend. Include values obtained by layout-unit conversion. [Custom outline API](../docs/user/api-reference.md#searchoptions) - -## 22. Declare a runtime-compatible NumPy and Shapely range — Medium - -The runtime requirements allow NumPy 2.2.6 with Shapely 2.0.0. Both wheels install on Python 3.11, but `import inire` fails with `ImportError: numpy.core.multiarray failed to import`. Shapely 2.0.0 imports and routes with NumPy 1.26.4. It emits intersection warnings on verified component joins in complex-routing example 1, which abort the example when runtime warnings are treated as errors. Shapely 2.0.4 introduced NumPy 2.0 wheel compatibility, and 2.0.6 fixed a further NumPy 2.1 compatibility issue. This can affect consumers with an older Shapely pin even when the project's current lockfile works. [Runtime requirements](../pyproject.toml#L23) · [Join verification](../inire/geometry/component_overlap.py#L48) · [Shapely 2.0 release notes](https://shapely.readthedocs.io/en/2.0.7/release/2.x.html) - -Choose and document a compatible dependency floor. Test installation and public routing on Python 3.11 with the oldest supported Shapely and the supported NumPy major versions. Keep the automatic fallback available on a release without constrained triangulation. Include a current environment in the local release smoke checks. - -## 23. Define the spacing requirement between separated parts of one net — Medium - -The API describes `clearance` as required spacing between physical shapes. On an empty board, replay a width-2 route from `(10, 20, 0)` to `(10, 24, 180)` with a 25-unit straight, two consecutive radius-2 counterclockwise turns, and another 25-unit straight. The parallel straight sections are 2 units apart edge to edge. At clearance 4, verification still reports completion with zero self-collisions. The same-net check detects intersections, including unintended contact, and uses no spacing threshold. Close parallel runs can matter for optical coupling even when they belong to one connection. [Clearance API](../docs/user/api-reference.md#routingproblem) · [Self-collision verification](../inire/geometry/component_overlap.py#L63) - -Document the existing inter-net and keepout rule explicitly. Define a separate rule for self-spacing if process clearance is expected between separated segments. Apply it to search, seed verification, and refinement with a local exemption for connected geometry near ordinary joins. Test the folded path, a connected bend with short adjoining straights, and a fold at exact spacing. - -## 24. Propose an S-bend launch between two offset apertures in lattice mode — Medium - -On bounds `(0, 0, 62, 25)` at clearance 1, use a width-2 net from `(1, 7, 0)` to `(60, 13, 0)`. Place one wall across `x = 20..26` with opening `y = 4.95..9.05` and another across `x = 43..49` with opening `y = 10.95..15.05`. Disable quarter turns, set `sbend_radii=(10,)`, `sbend_offsets=(6,)`, and a minimum straight length of 1. Disable danger weighting, warm start, and refinement. With one iteration and a 1,000-node limit, lattice search exhausts its frontier after 14 expansions. Any launch at integer `x = 26..29` can complete with the S-bend and a straight, yet lattice visits none of those states. Guide and seed modes verify the route in 22 and 14 expansions respectively. Automatic mode on Shapely 2.0.0 reproduces the 14-expansion failure. Across 63 generated versions of this two-aperture design, every reference path verified, and lattice missed 51 while the triangulation-capable modes completed all 63. [Straight proposals](../inire/router/_astar_moves.py#L228) · [Candidate generation around visible corners](../inire/router/_astar_moves.py#L52) - -Derive straight candidates from transitions between offset apertures. Include S-bend reach in local obstacle guidance when quarter turns are disabled. Keep move admission responsible for the physical checks. Verify the same case in lattice mode and on Shapely 2.0, with both signs and all four input headings. Compare branch counts on open boards and narrow gates. - -## 25. Make the heading heuristic consistent under cardinal rotation — Medium - -On bounds `(0, 0, 120, 120)`, use a width-1.75 net from `(8, 60, 0)` to `(112, 101, 0)`, clearance 1.25, and keepouts `box(87, 48, 99, 71)` and `box(28, 84, 47, 107)`. Run lattice mode with radius-10 quarter turns, S-bends disabled, a 50-node limit, one congestion iteration, and danger weighting, warm start, tiered strategy, and refinement disabled. The original layout verifies in 17 expansions. Each of the three cardinal rotations reaches the 50-node limit without completing. The original seed verifies when replayed on all four layouts. The heuristic uses trigonometric values for the target heading and tests the perpendicular projection against zero. Tiny nonzero results on an aligned state incur a bend penalty. Replacing only those target vectors with exact cardinal values yielded completion in 17 expansions in every rotation. [Target heading and scoring](../inire/router/cost.py#L105) · [Cardinal rotation helper](../inire/geometry/primitives.py#L59) - -Use the exact cardinal vector in the heuristic. Verify mirrored and rotated geometries with the same budget, including a case where the target genuinely requires an alignment penalty. Compare the selected paths and expansions on the corpus to identify any search-order changes. - -## 26. Give coincident terminals an explicit result — Low - -A connection between abutting cells can have identical arrival and departure ports. Distinct input coordinates can also collapse to the same port after grid snapping. On an empty 100-by-100 board, a net with both endpoints `(30, 20, 0)` produces an empty `unroutable` result with `reached_target=False` in lattice, guide, seed, and automatic modes. The search reaches its target at the initial state, and the worker then treats the empty path as a failure. This looks the same to applications as a failed geometric search. [Grid snapping](../docs/user/api-reference.md#ports-and-nets) · [Reached-target check](../inire/router/_search.py#L103) · [Empty-path result](../inire/router/_router.py#L895) - -Define whether Inire should report a geometry-free connection or ask callers to remove it. If supported, distinguish it from an unroutable path and validate board and port compatibility before treating it as connected. If unsupported, give callers an input error that names the net and document how placed-cell workflows should handle the direct join. Exercise exact and snapped coincidences, opposite headings at the same position, and endpoints outside the board. - -## 27. Keep acute-corner apertures open in the routing model — Medium - -On bounds `(0, 0, 100, 50)` at clearance 1, route a width-2 net from `(7, 15, 0)` to `(93, 35, 0)`. Use keepout triangles `[(35, 0), (65, 0), (50, 22.95)]` and `[(35, 50), (65, 50), (50, 27.05)]`. The gap is 4.1 units at its tightest point. The seed `SBendSeed(10, 10), StraightSeed(50), SBendSeed(10, 10)` verifies. With quarter turns disabled, `sbend_radii=(10,)`, `sbend_offsets=(10,)`, 200 nodes, one iteration, and danger weighting, warm start, and refinement disabled, all four search modes return partial. The mesh reports zero corridors. Its mitered buffers merge across the gap, and the width-aware lattice ray casts against keepouts with the same corner extension. [Mesh padding](../inire/router/_topology.py#L106) · [Width-specific static ray geometry](../inire/geometry/static_obstacle_index.py#L94) - -An in-memory probe using rounded corner padding for the mesh alone restored guide, seed, and automatic routing in 25 expansions. Applying it to the ray alone restored lattice routing in 15. Match the broad-phase geometry to Euclidean clearance, or use a local exact retry when corner padding closes a passage. Keep final move verification exact. Test acute and beveled shapes, a genuinely too-narrow aperture, and exact clearance in addition to the existing rectangular cases. [Physical clearance predicate](../inire/geometry/collision.py#L54) - -## 28. Recover when the corridor cost steers search away from a working route — Medium - -On bounds `(0, 0, 219, 118)` at clearance 1, route width 4.5 from `(16, 48, 0)` to `(199, 82, 0)` and width 1.25 from `(18, 59, 0)` to `(197, 93, 0)`. Use full-height walls across `x = 60..67` with opening `y = 56.25..74.125` and `x = 125..132` with opening `y = 66.25..84.125`. Set both bend radii to 10, S-bend offsets to `(10, 12)`, a 1,000-node search limit, and two congestion iterations. Leave warm start enabled and disable refinement and danger weighting. Lattice verifies both routes in 846 expansions. Default guide strength verifies one route in 3,678 expansions, and seed mode also verifies one. Setting guide strength to zero keeps the corridor proposals and verifies both in 1,488 expansions. Raising the node limit to 4,000 leaves default guide and seed at one route. [Corridor cost](../inire/router/_astar_admission.py#L187) · [Routing retry policy](../inire/router/_router.py#L869) · [Guide strength API](../docs/user/api-reference.md#topologyoptions) - -Allow a bounded lower-strength retry when a corridor yields incomplete coverage. Keep useful corridor proposals and allow an incumbent to be reconsidered when it blocks another feasible route. Compare coverage and work on this board and on a case where the guidance cost helps. Preserve intentional caller settings and define when explicit guide and seed modes can use the retry. - -## 29. Bound search memory on large failed attempts — Medium - -On bounds `(0, 0, 2400, 1600)`, block the board with `box(1180, 0, 1220, 1600)` and route a width-2 net from `(150, 800, 0)` to `(2100, 780, 0)` at clearance 2. Use lattice mode, one congestion iteration, quarter-turn radii `(20, 45)`, S-bend radii `(15, 30)`, and offsets `(-18, -12, 12, 18)`. Turn off danger weighting, tiered strategy, refinement, and warm start. The worker returns a partial path at each configured budget. Peak process memory was about 109 MiB at 500 expansions, 294 MiB at 3,000, and 648 MiB at 8,000. At 8,000 expansions it retained 111,086 absolute move entries and the same number of static-admission keys between the two sets. Lowering the internal geometry-cache threshold to 5,000 entries reduced peak memory at 3,000 expansions to 216 MiB, with the same expansion count and outcome. The static-admission keys were still retained. [Search cache ownership and eviction](../inire/router/_astar_types.py#L229) · [Per-move cache use](../inire/router/_astar_admission.py#L44) - -Measure the separate costs of the move caches, static-admission sets, and live frontier. Give long attempts a practical memory bound and retire stale collision keys with the geometry they describe. Reuse local component geometry where it actually reduces retention. Verify deterministic route and trace parity, check peak memory on the blocked board, and include a long attempt that succeeds. - -## 30. Keep collision diagnostics in verification-only runs — Medium - -On an empty 100-by-100 board, seed width-2 straights from `(10, 50, 0)` to `(90, 50, 0)` and `(50, 10, 90)` to `(50, 90, 90)`. Set the search budget to zero and disable refinement. With `max_iterations=1`, lattice, guide, seed, and automatic each report two colliding paths and one conflict edge. With `max_iterations=2` or its default of 10, the first iteration reports the same conflict. The next iteration replaces both paths with empty results, the layout ranking prefers the empty conflict graph, and the final report calls both paths unroutable. The final trace also loses the conflict edge. [Seed use and retries](../inire/router/_router.py#L838) · [Best-layout ranking](../inire/router/_congestion_policy.py#L31) · [Verification-only option](../docs/user/api-reference.md#searchoptions) - -Verify supplied paths once when the search budget is zero and return the physical result and final conflict graph. Keep complete and incomplete seeds diagnosable alongside unseeded nets. Test both one and several congestion iterations in the four modes, and check whether enabled refinement needs a separate verified replacement rule. Retain the explicit zero-iteration behavior. - -## 31. Preserve authored lengths when rerouting phase-sensitive connections — Medium - -In the Raymond fabrication submission, the two `MZI9` arms carry authored length annotations of 286.770 µm (`Waveguide$10`) and 183.637 µm (`Waveguide$1`). Replacing the former with the automatic route from `(261120, -46270, 0)` to `(261120, -167770, 180)` on the 1 nm grid gives a 127.208 µm path, using two clockwise 5 µm quarter turns and a 111.5 µm straight. Both 500 nm port faces join the existing silicon, and the modified MZI array still passes the published EBeam deck. The signed arm-length difference changes from +103.133 µm to −56.429 µm. Even when the original waypoints and radius are replayed, the circular replacement's reported length can differ from the authored waveguide length. The EBeam 500 nm strip definition specifies Bézier bends, and the `Waveguide` cell's authored 156.137 µm becomes 154.948 µm with circular bends. [Raymond fabrication layout](https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/EBeam_hannahraymond_MZIv21.gds) · [EBeam waveguide definitions](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/WAVEGUIDES.xml#L3-L15) · [Public results](../docs/user/api-reference.md#results) - -Document which geometric and fabrication checks are covered and which circuit constraints callers must supply and check. Add a reuse example that compares a verified replacement with the authored length and preserves the incumbent when the length difference falls outside tolerance. Evaluate a per-net length target or pairwise length-difference constraint, and carry the actual process-specific bend length through search, refinement, and export when that model is supplied. Use both a length-sensitive MZI and an unconstrained connection as acceptance cases. [Authored length workflow](../docs/user/fabrication.md#preserve-length-sensitive-paths) - -## 32. Infer a launch S-bend before a final quarter turn — Medium - -The CROW MZI fabrication submission has nine comparable lower connections that failed in their authored direction under the 225-node probe. All nine completed in 9 to 11 total expansions when the terminal order was reversed and both port headings were turned 180°. Each reversed route also verified when replayed in its original direction. For the `Waveguide$33` link, use a 500 nm width, 70 nm clearance, 5 and 10 µm radii, and the actual terminals `(49700, -267710, 270)` and `(50180, -308570, 180)` on the 1 nm grid. The reversed search realizes one quarter turn, a straight, and an S-bend into its target. The original direction can use the same sequence in reverse. With the original headings and `sbend_offsets=(5480,)`, automatic also completes at the same budget. The lattice's goal-derived S-bend proposal requires the current and target headings to match, so the original approach does not get the necessary S-bend proposal before the quarter turn. [CROW MZI fabrication layout](https://github.com/SiEPIC/openEBL-2025-02/blob/a887476a301db2a014be007717cd1821e111f58e/submissions/masihb_crow1_mzi_v1.gds) · [A* S-bend proposals](../inire/router/_astar_moves.py#L329) - -Use the position before a supported terminal quarter turn to propose useful S-bend offsets, or add a bounded reverse probe for unresolved nets with reversible geometry. Verify any reversed seed in the requested direction. Fractional S-bends and asymmetric custom outlines need that check because their physical geometry can depend on the travel direction. Retest the nine links, both handednesses, and a connection that needs to take the turn before the S-bend. Measure expansion counts and keep the configured search budget intact. - -## 33. Verify the RF cross-section before exporting a coplanar waveguide — Medium - -The pinned QFoundry feedline defines a 15.5 µm signal trace with a 7 µm gap on each side. Replay two parallel, 200 µm straight connections on a 1 nm grid using `NetSpec.width=15500` and `clearance=3000`. At a 32 µm pitch Inire verifies both center conductors. Converting the paths to the negative lithography layer leaves a 2.5 µm ground strip between the two gap envelopes. The QFoundry deck reports one aluminum width violation. At 28 µm pitch the two envelopes merge and the center ground strip disappears. The deck reports no width violation because the intended strip no longer exists. Replaying the same paths at the 29.5 µm envelope width with 3 µm clearance rejects both pitches. A 36 µm control verifies the envelopes, leaves a 6.5 µm strip, and passes the deck. [RF routing scope](../README.md) · [QFoundry waveguide dimensions and layers](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/waveguides.xml#L21-L48) · [QFoundry fabrication checks](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/drc/drc.lydrc) - -Route against the gap envelope and replay the verified placement at the signal width. At the 15 µm minimum flux-line bend radius, the router accepts the 15.5 µm signal and the 29.5 µm gap envelope. The 49.5 µm width exceeds the bend diameter. Check the three pitches using the published dimensions and process rules. [CPW envelope routing](../docs/user/fabrication.md#route-a-coplanar-waveguide-envelope) - -## 34. Apply the bend rules for each geometry class on a mixed layout — Medium - -The pinned QFoundry feedline and flux-line profiles have the same 15.5 µm trace width and 7 µm gaps, but their minimum bend radii are 50 µm and 15 µm respectively. On bounds `(0, 0, 150000, 55000)` at 1 nm per unit, route gap-envelope width 29500 from `(35000, 20000, 0)` to `(50000, 35000, 90)` for `flux` and from `(100000, 20000, 0)` to `(115000, 35000, 90)` for `feed`. With clearance 3000, no S-bends, and allowed radii `(15000, 50000)`, lattice completes both with a radius-15000 quarter turn. The feedline violates its process radius. Removing the smaller radius globally also removes the legal flux-line turn. A shared width cannot distinguish these two route profiles. [QFoundry bend profiles](https://github.com/tii-qfoundry/PDK_QFoundry/blob/9c31db1d6879c96bd98460ee134181a865481d75/qfoundry/tech/waveguides.xml#L42-L64) · [Net model](../inire/model.py#L24) · [Search options](../docs/user/api-reference.md#searchoptions) - -Document how to route separately by process profile and preserve each verified group as keepouts. Evaluate a per-net permitted geometry profile for design flows that need joint routing. Use the same profile during search, seed replay, refinement, and final verification. Check this board and a second board with room for both legal turns. - -## 35. Check the physical widths of placed optical ports — Medium - -On a 1 nm grid, connect a 500 nm device port at `(10000, 10000, 0)` to a 3 µm device port at `(110000, 10000, 0)` with a width-500 net. With the documented port openings in the routing keepouts, Inire verifies a straight. On the assembled silicon, the independent EBeam deck reports one `SiEPIC-1a` marker at the target port. Route the 500 nm connection to `(70000, 10000, 0)` instead, and place the pinned 40 µm, 500-to-3000 nm EBeam taper from there to the target. The assembly passes the same deck. The API has port position and heading plus one width for the whole net. The widths of the attached devices live outside that model. [Placed-device workflow](../docs/user/route-a-layout.md#route-between-placed-crossings) · [Published EBeam taper](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/gds/EBeam/ebeam_routing_taper_te1550_w%3D500nm_to_w%3D3000nm_L%3D40um.gds) · [Pinned EBeam deck](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/drc/SiEPIC_EBeam.drc) - -Show how to check both terminal widths and place explicit process tapers before routing. Have a layout adapter accept declared port widths and reject a direct join if the widths differ. Use the correctly placed taper, a deliberately omitted taper, and matched-width terminals rotated by 90° as acceptance cases. - -## 36. Keep the search heuristic in the configured cost units — Medium - -On bounds `(0, 0, 190, 100)`, route a width-2 net from `(15, 40, 0)` to `(165, 80, 0)` around `box(63, 7, 85, 55)` at clearance 2. Use lattice mode, a 32-node limit, radius-10 quarter turns, no S-bends, a minimum straight length of 2, and `greedy_h_weight=1.5`. Disable warm start, tiered strategy, and refinement, and use one congestion iteration. With only length in the search objective, `unit_length_cost=1` completes in 12 expansions. Changing the cost per unit to `0.001` or `1000` yields a partial route at 32 expansions. A cost-unit change should leave the pure-length objective ordered the same way. An in-memory probe scaling the Manhattan distance term by the configured length cost restored the original path at `0.001` in 12 expansions. [Search heuristic and move scoring](../inire/router/cost.py#L117) · [Corridor heuristic](../inire/router/_astar_types.py#L99) · [Cost options](../docs/user/api-reference.md#objectiveweights) - -Use the configured length units for estimated remaining distance, including corridor distance. Keep the interpretation of `greedy_h_weight` consistent with the accumulated objective. Check the three cost scales in lattice search, a corridor-guided case, and explicit behavior at zero length cost. - -## 37. Diagnose terminals whose physical ports cannot be reached — Medium - -On bounds `(0, 0, 300, 160)`, route a width-2 net at clearance 2 from `(10, 80, 0)` to `(302, 80, 0)`. Use radius-20 quarter turns, radius-10 S-bends, a 600-node limit, one congestion iteration, and disable warm start, refinement, and danger weighting. Lattice uses all 600 expansions. Automatic uses 2,200 across attempts and returns a partial path with no diagnostic that identifies the off-board terminal. The same happens with target `(280, 80, 0)` inside `box(275, 75, 285, 85)`. As a control, target `(300, 80, 0)` is on the board edge and verifies with a flat end face. [Worker dispatch](../inire/router/_router.py#L838) · [Physical verification](../inire/geometry/collision.py#L608) · [Reported outcomes](../docs/user/api-reference.md#results) - -Check terminal positions and the required physical end faces against the board and keepouts before starting an attempt. Report the specific invalid terminal and keep other nets routable. Preserve valid flush interfaces and port openings. Keep verification of a supplied partial path available for inspecting an infeasible connection, and test placements just inside and outside a boundary and at exact clearance. - -## 38. Distinguish zero clearance from a short between different nets — Medium - -On a 1 nm grid, replay two 8 µm straights with 500 nm width and y coordinates 2000 and 2500. At `clearance=0`, both routes verify without dynamic collisions. Their polygons share an 8 µm edge. After writing and reading the common silicon layer, KLayout merges them into one connected polygon. The published EBeam width and spacing deck produces no marker because it sees a single conductor. At positive clearance, Inire detects the contact. A control with 70 nm of actual gap verifies in both tools and retains two connected components. [Exact clearance predicate](../inire/geometry/collision.py#L48) · [Placement workflow](../docs/user/route-a-layout.md#save-a-placement-recipe) · [Pinned EBeam deck](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/drc/SiEPIC_EBeam.drc) - -Define and document whether distinct nets may share edges or vertices at zero clearance. For independent same-layer connections, report shared edges as shorts or require an explicit policy for intentional contact. Preserve normal adjacent moves of the same net and process boundaries represented as keepouts. Check a shared edge, an endpoint contact, a valid zero-clearance boundary, and separate exported conductors. - -## 39. Verify clearance on the coordinates written to the layout file — Medium - -On a 1 nm grid, replay concentric counterclockwise quarter turns about `(3000, 6070)`. The inner net is 490 nm wide with radius 2500 nm, from `(3000, 3570, 0)` to `(5500, 6070, 90)`. The outer is 509.94 nm wide with radius 3070 nm, from `(3000, 3000, 0)` to `(6070, 6070, 90)`. At clearance 70 nm both verify, with a minimum floating-point separation of 70.0208 nm. Rounding their polygon vertices to the original 1 nm grid reduces the gap to 68.9420 nm. KLayout reports 12 EBeam `Si_space` markers in the written OASIS file. A 0.1 nm export of the same polygons produces zero markers. The 1 nm control with a 3072 nm outer radius, the same widths, and corresponding endpoints also produces zero markers. [Placement workflow](../docs/user/route-a-layout.md#save-a-placement-recipe) · [Arc polygon coordinates](../inire/geometry/components.py#L235) · [Pinned EBeam spacing rule](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/drc/SiEPIC_EBeam.drc) - -Document that snapping ports leaves bend polygons with fractional vertex coordinates. In a fabrication export adapter, verify the actual quantized geometries or allow an intentional clearance margin tied to the export grid. Test rounded bends near minimum clearance and check that the selected rounding policy preserves port faces and accepted joins. - -## 40. Preserve layer identity in the routing and export workflow — Low - -On a 1 nm grid, replay a 500 nm-wide silicon straight from `(1000, 10000, 0)` to `(19000, 10000, 0)` and a 750 nm-wide silicon nitride straight from `(10000, 1000, 90)` to `(10000, 19000, 90)`. A single Inire problem reports both as colliding. Each verifies in a separate problem. On the EBeam silicon `1/0` and silicon nitride `4/0` layers, KLayout retains both geometries separately despite their projected intersection, and the published fabrication deck reports zero markers. Exporting both on `1/0` instead produces one connected polygon, also with zero markers. Process layer identity determines which geometry overlaps are allowed. [Layout inputs](../docs/user/api-reference.md#layout-inputs) · [Pinned EBeam layer rules](https://github.com/SiEPIC/SiEPIC_EBeam_PDK/blob/363fbb52eefa8669100499ab531d3fe7befc4867/klayout/EBeam/drc/SiEPIC_EBeam.drc) - -State that each routing problem represents one collision plane. Show how an adapter preserves layer identity, partitions independent layers into separate problems, and adds cross-layer keepouts where the process requires them. Keep placed transition devices in the circuit model. Check both layer assignments and verify connectivity separately from fabrication spacing. - -## 41. Revisit legal turns away from the target before the budget runs out — Medium - -Use bounds `(-25, -185, 230, 0)`, keepout `box(50, -185, 187, -37)`, width 2, clearance 1, and terminals `(190, -40, 270)` and `(20, -50, 0)`. The path must go east around the obstacle before traveling west to approach the target. Use lattice mode, radius-10 quarter turns, no S-bends, straight lengths from 2 to 40, a bend penalty of 10, and a 500-node limit. Use one congestion iteration and disable warm start, tiered strategy, refinement, and danger weighting. The current search returns partial at 500 expansions. An in-memory run admitting the turns immediately completes in 443. A geometric seed verifies as well. The distant-turn rule defers moves whose new headings point away from the target, and A* only releases those moves when the preferred queue empties. [Turn classification](../inire/router/_astar_moves.py#L298) · [Deferred queue](../inire/router/_search.py#L74) - -Keep a bounded share of the search budget for deferred turns, or promote deferred moves when the preferred frontier stops improving. Compare the original budget on this board, a mirrored board, and cases where the detour is blocked. Measure the added search on boards whose best path turns toward the target immediately. - -## Local verification for the batches - -- Run `.venv/bin/ruff check --no-cache inire scripts` and focused regressions for each batch. Run `INIRE_RUN_PERFORMANCE=1 .venv/bin/pytest -q` before closing the plan. Tests run locally using the existing developer workflow. [Developer guide](../docs/development.md#check-a-change) -- Compare `public-defaults` and `corpus-regression` per board for verified IDs, work, and route cost. Use 433 verified nets across 67 boards as the prior public-defaults baseline. Investigate any coverage loss and record intended gains or path changes. Include the splitter-tree regression, mixed-width and crossing holdouts, and the fixed-heading and point-terminal variants of complex-routing example 1. [Benchmark profiles and fixtures](../docs/benchmarks.md#choose-a-profile) -- Exercise automatic, lattice, guide, seed, and bundle where each mode supports the fixture. Confirm the no-triangulation capability tests and run a smoke check using the minimum supported library versions when that environment is available. Replay supplied seeds with a zero search budget where specified. [Mode and dependency behavior](../docs/complex-routing-example-1.md#compare-all-routing-modes) -- Regenerate the walkthrough into a scratch directory. Keep active user and developer pages reachable within two links, with planning and archived materials outside that navigation check. [Figure regeneration](../docs/development.md#check-a-documentation-figure) -- For fabrication changes, compare the original, an export-only control, and the routed design in KLayout. Use the pinned decks above and compare marker types and coordinates. For optical checks, replace the original waveguide polygons on the silicon layer and retain the surrounding layout and port markers. Check circuit length metadata separately. For RF, retain the conductor and gap dimensions through negative-layer export and check ground continuity as well as widths. diff --git a/pyproject.toml b/pyproject.toml index 9f682d2..fcbc085 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,9 +21,9 @@ classifiers = [ ] dynamic = ["version"] dependencies = [ - "numpy>=1.26,<3", + "numpy", "scipy", - "shapely>=2.0.7,<3", + "shapely>=2.0", "rtree", "matplotlib", ] @@ -43,14 +43,6 @@ build-backend = "hatchling.build" [tool.hatch.version] path = "inire/__init__.py" - -[tool.hatch.build.targets.wheel] -packages = ["inire"] -exclude = ["/inire/tests"] - -[tool.hatch.build.targets.sdist] -exclude = ["/.agents", "/.aws", "/.codex"] - [tool.ruff] exclude = [ ".git", diff --git a/scripts/record_performance_baseline.py b/scripts/record_performance_baseline.py index 3df56c0..6a01fcf 100644 --- a/scripts/record_performance_baseline.py +++ b/scripts/record_performance_baseline.py @@ -34,7 +34,7 @@ def _render_markdown(payload: dict[str, object]) -> str: "Use `scripts/diff_performance_baseline.py` to compare a fresh run against that snapshot.", "", "| Scenario | Duration (s) | Total | Valid | Reached | Iter | Nets Routed | Nodes | Ray Casts | " - "Moves Gen | Moves Added | Dyn Tree | Corner Index Builds | Congestion Checks | Verify Calls |", + "Moves Gen | Moves Added | Dyn Tree | Visibility Builds | Congestion Checks | Verify Calls |", "| :-- | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: | --: |", ] for row in rows: @@ -53,7 +53,7 @@ def _render_markdown(payload: dict[str, object]) -> str: f"{metrics['moves_generated']} | " f"{metrics['moves_added']} | " f"{metrics['dynamic_tree_rebuilds']} | " - f"{metrics['visibility_corner_index_builds']} | " + f"{metrics['visibility_builds']} | " f"{metrics['congestion_check_calls']} | " f"{metrics['verify_path_report_calls']} |" ) diff --git a/scripts/render_complex_routing_example.py b/scripts/render_complex_routing_example.py index 9163d97..b7ca8ca 100644 --- a/scripts/render_complex_routing_example.py +++ b/scripts/render_complex_routing_example.py @@ -20,7 +20,7 @@ from inire.geometry.intervals import open_intervals from inire.router._bundle import _identify_layout, plan_ordered_bundle from inire.router._seed_materialization import materialize_path_seed from inire.router._stack import route_once -from inire.router._topology import _build_corridors, _endpoint_access, _Mesh, _plan_lane_assignments, constrained_triangulation_available +from inire.router._topology import _build_corridors, _endpoint_access, _Mesh, _plan_lane_assignments from inire.router._waypoints import export_waypoints from scripts.render_documentation_figures import EDGE, INK, MUTED, _board, _polygon, _save, plt @@ -221,44 +221,6 @@ def _guide_figure(directory: Path, problem: RoutingProblem, options: RoutingOpti _save(fig, directory, f"{COMPLEX_EXAMPLE}-guide.png") -def _modes_figure(directory: Path, problem: RoutingProblem, options: RoutingOptions, *, triangulation: bool) -> None: - config = replace( - options, - search=replace(options.search, node_limit=100), - congestion=replace(options.congestion, max_iterations=1, warm_start_enabled=False), - refinement=replace(options.refinement, enabled=False), - ) - modes = ("automatic", "off", "guide", "seed", "bundle") - fig, panels = plt.subplots(3, 2, figsize=(10, 7), layout="constrained") - fig.suptitle("One congestion iteration · 100 nodes per search", color=INK, fontsize=13) - for ax, mode in zip(panels.ravel()[:-1], modes, strict=True): - if mode in ("guide", "seed") and not triangulation: - ax.set_title(mode, loc="left", color=INK, fontsize=11) - ax.text(0.5, 0.5, "Requires constrained triangulation", color=MUTED, ha="center", transform=ax.transAxes) - ax.set_axis_off() - continue - settings = replace(config, topology=replace(config.topology, mode=mode, infer_terminal_headings=mode == "bundle")) - run = route(problem, options=settings) - verified = sum(result.is_valid for result in run.results_by_net.values()) - label = "bundle with heading inference" if mode == "bundle" else mode - _board(ax, problem) - ax.set_title(f"{label} · {verified}/{len(problem.nets)} verified", loc="left", color=INK, fontsize=11) - for net in problem.nets: - _draw_ports(ax, net.start, net.target, EDGE, arrow_length=0) - result = run.results_by_net[net.net_id] - if result.path: - _footprint(ax, result.path, UPPER if result.is_valid else RETURN, dashed=not result.is_valid) - - legend = panels.flat[-1] - legend.set_axis_off() - handles = [ - Line2D([], [], color=UPPER, label="Verified path"), - Line2D([], [], color=RETURN, linestyle="--", label="Unverified or partial path"), - ] - legend.legend(handles=handles, loc="center left", frameon=False, fontsize=10) - _save(fig, directory, f"{COMPLEX_EXAMPLE}-modes.png") - - def main() -> None: parser = ArgumentParser(description=__doc__) parser.add_argument("--output-dir", type=Path, default=Path(__file__).resolve().parents[1] / "docs" / "figures") @@ -287,10 +249,7 @@ def main() -> None: _turnaround_figure(directory, problem, proposed_paths, paths) _verify_figure(directory, problem, paths, colors) _refine_figure(directory, problem, paths, _result_paths(refined)) - triangulation = constrained_triangulation_available() - if triangulation: - _guide_figure(directory, problem, options) - _modes_figure(directory, problem, options, triangulation=triangulation) + _guide_figure(directory, problem, options) print(f"{COMPLEX_EXAMPLE}: {len(problem.nets)}/{len(problem.nets)} verified, {refined.metrics.nodes_expanded} A* expansions") diff --git a/scripts/render_documentation_figures.py b/scripts/render_documentation_figures.py index d0ea84a..e3288b4 100644 --- a/scripts/render_documentation_figures.py +++ b/scripts/render_documentation_figures.py @@ -19,7 +19,6 @@ from inire.tests.routing_corpus import CASE_GROUPS, profile_options matplotlib.use("Agg") from matplotlib import pyplot as plt # noqa: E402 from matplotlib.patches import FancyBboxPatch # noqa: E402 -from inire.utils.visualization import draw_polygon # noqa: E402 if TYPE_CHECKING: from matplotlib.axes import Axes @@ -44,7 +43,7 @@ def _save(fig: Figure, directory: Path, name: str) -> None: def _polygon(ax: Axes, polygon: Polygon, *, fill: str, edge: str, **kwargs: object) -> None: - draw_polygon(ax, polygon, facecolor=fill, edgecolor=edge, **kwargs) + ax.fill(*polygon.exterior.xy, facecolor=fill, edgecolor=edge, **kwargs) def _waveguide(ax: Axes, result: RoutingResult, *, color: str, linestyle: str = "-") -> None: diff --git a/uv.lock b/uv.lock index e7869b9..2da873d 100644 --- a/uv.lock +++ b/uv.lock @@ -193,10 +193,10 @@ dev = [ [package.metadata] requires-dist = [ { name = "matplotlib" }, - { name = "numpy", specifier = ">=1.26,<3" }, + { name = "numpy" }, { name = "rtree" }, { name = "scipy" }, - { name = "shapely", specifier = ">=2.0.7,<3" }, + { name = "shapely", specifier = ">=2.0" }, ] [package.metadata.requires-dev]