Route the 40-net photonic floorplan with verified constructive candidates
This commit is contained in:
parent
ee41dc600a
commit
0183a91e9c
14 changed files with 555 additions and 55 deletions
|
|
@ -48,23 +48,43 @@ Run `PYTHONPATH=. python scripts/capture_legacy_routing.py /tmp/inire-parity.jso
|
||||||
|
|
||||||
## Catalog scale benchmarks
|
## Catalog scale benchmarks
|
||||||
|
|
||||||
Use the aligned case for long-range profile changes. Use the constrained case for an obstacle detour among 40 connections on the same 5 × 5 mm board at 100 nm pitch. The script verifies the frozen reference routes independently before timing unseeded search.
|
The default `floorplan` case represents a synthetic single-layer photonic layout on a 5 × 5 mm die at 100 nm pitch. It uses 40 nets across seven port banks, with mixed approach directions, staggered fan-outs, and a short local connection. The 60 keepouts cover 11.0% of the die and represent clustered device and pad banks, larger electronics and thermal regions, and stepped block boundaries. Six reference routes pass through an 82 µm gap between two blocks. A separate keepout forces one aligned eastbound connection to detour. The frozen reference paths range from 0.33 to 2.52 mm. Each is verified against the board, keepouts, and the other reference paths before timing unseeded search. [Floorplan coordinates](../scripts/catalog_floorplan.py)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode native
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode native --no-refinement
|
||||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode manhattan
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode manhattan --no-refinement
|
||||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode typed
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode typed --no-refinement
|
||||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode typed --no-refinement
|
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case floorplan --mode octagonal --no-refinement
|
||||||
PYTHONPATH=. python scripts/benchmark_catalog_routing.py --case constrained --mode octagonal
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Native uses the existing Manhattan API. Manhattan uses the catalog evaluator with a single profile and cardinal turns. Typed adds the centered transition. Octagonal also admits 45° bends. The diagonal-savings case keeps cardinal terminals and gives the octagonal search a shorter two-turn path. The diagonal case has a native diagonal terminal pair.
|
Native uses the Manhattan API. Catalog Manhattan uses the catalog evaluator with a single profile and cardinal turns. Typed adds the centered transition. Octagonal also admits 45° bends. All four modes receive the same floorplan and terminal pairs, with no supplied routes.
|
||||||
|
|
||||||
|
The floorplan defaults to `--net-order bank`, which groups nets by their terminal headings and routes the outside of a lateral fan-out first. Use `--net-order input` to route in fixture order. The native warm start defaults to `--native-jog-limit 48`. It verifies straight and single-turn links and samples two-turn launch positions around keepouts and peer routes. [Native search options](user/api-reference.md#searchoptions)
|
||||||
|
|
||||||
|
The catalog modes default to `--constructive` on this fixture. They verify straight, single-turn, and two-turn candidates before falling back to detailed search. After placing the routes, they try cheaper collinear profile changes with the installed routes in place. Every replacement must pass full path verification, meet the original terminal poses, and fit within the original physical length. With refinement enabled, the router also compares local replacements and can try another net order if coverage is incomplete. Use `--no-constructive` to run the detailed catalog strategy.
|
||||||
|
|
||||||
|
Use `aligned` to isolate long-range profile changes and `constrained` to reproduce the rectangular obstacle grid with a single blocked lane. The `diagonal-savings` case keeps cardinal terminals and gives the octagonal search a shorter two-turn path. The `diagonal` case has a native diagonal terminal pair.
|
||||||
|
|
||||||
Use `--guide-pitch 1000` and `--guide-pitch 10000` to compare coarse guidance against explicit routing. The off-coarse case exercises a displaced transition at 1 nm layout precision. On the same case `--auto-pitch 1000` selects 200 nm and verifies the same terminal poses. For a bounded failure control, use `--node-limit 0`. Use `--geometry` to retain the ordered moves and physical polygons with each report.
|
Use `--guide-pitch 1000` and `--guide-pitch 10000` to compare coarse guidance against explicit routing. The off-coarse case exercises a displaced transition at 1 nm layout precision. On the same case `--auto-pitch 1000` selects 200 nm and verifies the same terminal poses. For a bounded failure control, use `--node-limit 0`. Use `--geometry` to retain the ordered moves and physical polygons with each report.
|
||||||
|
|
||||||
The report includes repeated wall times, peak resident memory from the operating system, and per-net cost and physical length. Compare costs on the intersection of the completed net sets. Catalog reports also include work from discarded search attempts and budgeted retries.
|
The report includes repeated wall times, peak resident memory from the operating system, and per-net cost and physical length. Compare costs on the intersection of the completed net sets. Catalog reports also include work from discarded search attempts and budgeted retries.
|
||||||
|
|
||||||
### Representative measurements
|
### Photonic floorplan measurements
|
||||||
|
|
||||||
|
The table gives medians of five unseeded runs per setting on an AMD Ryzen 9 5900X with a 1,000-node detailed-search limit. Routing time includes final verification. All four modes verified all 40 nets, including the six in the shared passage, with both refinement settings.
|
||||||
|
|
||||||
|
| Mode | Median without refinement | Median with refinement | Slowest run across both settings | Catalog cost |
|
||||||
|
| --- | ---: | ---: | ---: | ---: |
|
||||||
|
| Native Manhattan | 0.37 s | 0.37 s | 0.49 s | 8.0379 |
|
||||||
|
| Single-profile catalog Manhattan | 0.81 s | 0.74 s | 1.27 s | 8.0379 |
|
||||||
|
| Typed Manhattan | 1.50 s | 2.31 s | 2.40 s | 6.3917 |
|
||||||
|
| Octagonal | 2.00 s | 1.64 s | 2.47 s | 6.3881 |
|
||||||
|
|
||||||
|
Catalog cost was the same under both refinement settings. Compared with the prior 40-net results for each mode and setting, every route matched or improved its physical length and catalog cost, and the minimum clearances were unchanged. The typed and octagonal runs used profile changes on 26 nets each. The octagonal layouts retained their 45° bends.
|
||||||
|
|
||||||
|
Fresh Python invocations with refinement enabled and `--repeat 1` took 0.94–3.08 s across the four modes, including startup, reference verification, and JSON output.
|
||||||
|
|
||||||
|
### Controlled obstacle-grid measurements
|
||||||
|
|
||||||
The following constrained-case runs used an AMD Ryzen 9 5900X and a 1000-node detailed-search limit. Times are medians of three runs. The catalog Manhattan and typed configurations completed all 40 requests. Native Manhattan verified 39 within the same node limit.
|
The following constrained-case runs used an AMD Ryzen 9 5900X and a 1000-node detailed-search limit. Times are medians of three runs. The catalog Manhattan and typed configurations completed all 40 requests. Native Manhattan verified 39 within the same node limit.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ After defining the Masque interface, construct the synthetic cells and record th
|
||||||
|
|
||||||
### Synthetic scale benchmark
|
### Synthetic scale benchmark
|
||||||
|
|
||||||
- Use a 5 × 5 mm board at 100 nm pitch, approximately 40 nets, and 50–100 obstacles with a union covering approximately 10% of the routing area. One reproducible starting layout uses 72 rectangles of `250 × 140` µm, with lower-left corners at `(400 + 500i, 400 + 550j)` µm for `0 ≤ i < 9` and `0 ≤ j < 8`. The disjoint rectangles cover `2.52 mm²`, or `10.08%` of the board. Stagger or reshape selected obstacles while preserving the overall density to exercise constrained passages as well as open lanes.
|
- Use a 5 × 5 mm board at 100 nm pitch, approximately 40 nets, and 50–100 obstacles with a union covering approximately 10% of the routing area. The primary floorplan fixture uses seven port banks, a six-net shared passage, and 60 clustered keepouts that cover 11.0% of the board. The original grid of 72 rectangular keepouts remains available for controlled comparisons. [Catalog scale benchmarks](benchmarks.md#catalog-scale-benchmarks)
|
||||||
- Freeze 40 terminal pairs and independently verified reference paths. Include some direct lanes, obstacle detours, shared passages, and routes with a demonstrably cheaper legal typed or diagonal alternative. Start with terminals and catalog compatibility that permit a legacy Manhattan comparison on the same requested connections. Use a separate board variant or subset for terminals and profile changes that require the new capabilities. Keep the reference paths out of unseeded search runs. Record whether the router finds the planted improvements, plus the physical length and catalog cost on equal verified net sets. Look for additional examples of those improvements in the existing corpus.
|
- Freeze 40 terminal pairs and independently verified reference paths. Include some direct lanes, obstacle detours, shared passages, and routes with a demonstrably cheaper legal typed or diagonal alternative. Start with terminals and catalog compatibility that permit a legacy Manhattan comparison on the same requested connections. Use a separate board variant or subset for terminals and profile changes that require the new capabilities. Keep the reference paths out of unseeded search runs. Record whether the router finds the planted improvements, plus the physical length and catalog cost on equal verified net sets. Look for additional examples of those improvements in the existing corpus.
|
||||||
- Use the 100 nm explicit lattice as the principal comparison. At that pitch the board has about 2.5 billion lattice positions before headings or profiles. Check peak memory and use sparse search. For the grid prototype, compare explicit routing with coarse guidance at 1 µm and 10 µm followed by local refinement. Include a case containing a transition or a terminal position that cannot be represented at the coarse pitch. Report results after final verification at full layout precision.
|
- Use the 100 nm explicit lattice as the principal comparison. At that pitch the board has about 2.5 billion lattice positions before headings or profiles. Check peak memory and use sparse search. For the grid prototype, compare explicit routing with coarse guidance at 1 µm and 10 µm followed by local refinement. Include a case containing a transition or a terminal position that cannot be represented at the coarse pitch. Report results after final verification at full layout precision.
|
||||||
- Report native Manhattan, Manhattan through the evaluation boundary, typed Manhattan, and eight headings separately. Record verified and completed net IDs, geometry, catalog cost, expansions, proposals per expansion, exact geometry checks, cache entries, peak memory, and repeated wall times. Compare legacy runs under the same options and dependencies. Target at most a few minutes end to end for the representative 40-net run. Measure whether seconds are attainable. Record the machine, coverage, time to first verified layout and time to final result. Use profiles and repeated runs to set phase budgets and memory targets before stabilizing the public types. Record the diagnostics for both a successful run and a budget-limited run.
|
- Report native Manhattan, Manhattan through the evaluation boundary, typed Manhattan, and eight headings separately. Record verified and completed net IDs, geometry, catalog cost, expansions, proposals per expansion, exact geometry checks, cache entries, peak memory, and repeated wall times. Compare legacy runs under the same options and dependencies. Target at most a few minutes end to end for the representative 40-net run. Measure whether seconds are attainable. Record the machine, coverage, time to first verified layout and time to final result. Use profiles and repeated runs to set phase budgets and memory targets before stabilizing the public types. Record the diagnostics for both a successful run and a budget-limited run.
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ For structured logging, `dataclasses.asdict(run)` preserves the per-net fields.
|
||||||
| `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. |
|
| `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. |
|
| `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. |
|
| `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. |
|
||||||
|
| `terminal_jog_limit` | `0` | Enables verified straight and single-turn candidates during native greedy warm start without corridors. For parallel ports with a lateral offset, it also caps the number of two-turn launch positions checked per net. Zero skips this planning step. |
|
||||||
|
|
||||||
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. If multiple outlines apply to the same move, `route()` skips that move for the affected net and sets `sbend_template_error` in the final result and iteration callbacks. Direct calls to `SearchOptions.sbend_template()` and `sbend_outline()` raise `ValueError` for an ambiguous match. Moves with no matching outline 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 an enabled outline matches a net width. Bundle mode requires circular bends for its nets.
|
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. If multiple outlines apply to the same move, `route()` skips that move for the affected net and sets `sbend_template_error` in the final result and iteration callbacks. Direct calls to `SearchOptions.sbend_template()` and `sbend_outline()` raise `ValueError` for an ambiguous match. Moves with no matching outline 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 an enabled outline matches a net width. Bundle mode requires circular bends for its nets.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,11 @@ class SearchOptions(_SearchOptionsCache):
|
||||||
proximity_range: float = 10.0
|
proximity_range: float = 10.0
|
||||||
bend_physical_length: float | None = None
|
bend_physical_length: float | None = None
|
||||||
distance_heuristic_weight: float = 1.0
|
distance_heuristic_weight: float = 1.0
|
||||||
|
terminal_jog_limit: int = 0
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
_require_budget("node_limit", self.node_limit)
|
_require_budget("node_limit", self.node_limit)
|
||||||
|
_require_budget("terminal_jog_limit", self.terminal_jog_limit)
|
||||||
_require_nonnegative("greedy_h_weight", self.greedy_h_weight)
|
_require_nonnegative("greedy_h_weight", self.greedy_h_weight)
|
||||||
_require_nonnegative("distance_heuristic_weight", self.distance_heuristic_weight)
|
_require_nonnegative("distance_heuristic_weight", self.distance_heuristic_weight)
|
||||||
if not isfinite(self.proximity_range) or self.proximity_range <= 0:
|
if not isfinite(self.proximity_range) or self.proximity_range <= 0:
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ from inire.geometry.collision import _violates_net_clearance
|
||||||
|
|
||||||
from ._catalog_guidance import Corridor, find_corridor
|
from ._catalog_guidance import Corridor, find_corridor
|
||||||
from ._catalog_matching import DelayChoice, choose_match
|
from ._catalog_matching import DelayChoice, choose_match
|
||||||
from ._catalog_search import COST_TOLERANCE, SearchResult, path_recipe, search_path
|
from ._catalog_search import COST_TOLERANCE, SearchResult, path_recipe, search_path, straight_replacements
|
||||||
from ._catalog_tuning import tune_group
|
from ._catalog_tuning import tune_group
|
||||||
from ._catalog_verify import face_reservation, replay_moves, validate_attachment, verify_path
|
from ._catalog_verify import face_reservation, replay_moves, validate_attachment, verify_path
|
||||||
|
|
||||||
|
|
@ -58,6 +58,7 @@ class LayoutSettings:
|
||||||
refinement_node_limit: int = 64
|
refinement_node_limit: int = 64
|
||||||
retry_independent: bool = True
|
retry_independent: bool = True
|
||||||
search_bias: SearchBias | None = None
|
search_bias: SearchBias | None = None
|
||||||
|
constructive: bool = False
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
if not isinstance(self.board, Polygon) or self.board.is_empty or not self.board.is_valid:
|
if not isinstance(self.board, Polygon) or self.board.is_empty or not self.board.is_valid:
|
||||||
|
|
@ -174,7 +175,11 @@ class _LayoutSearch:
|
||||||
node_limit -= guided.expanded
|
node_limit -= guided.expanded
|
||||||
coverage = self._coverage_evaluator(net)
|
coverage = self._coverage_evaluator(net)
|
||||||
reserve = node_limit * 2 // 5 if coverage is not self.evaluator else node_limit // 4
|
reserve = node_limit * 2 // 5 if coverage is not self.evaluator else node_limit // 4
|
||||||
explicit = search_path(self.evaluator, net.start, net.target, node_limit=node_limit - reserve, **settings)
|
explicit = search_path(
|
||||||
|
self.evaluator, net.start, net.target, node_limit=node_limit - reserve,
|
||||||
|
method="constructive_first" if self.settings.constructive and self.settings.search_bias is None else "detailed",
|
||||||
|
**settings,
|
||||||
|
)
|
||||||
remaining = node_limit - explicit.expanded
|
remaining = node_limit - explicit.expanded
|
||||||
if explicit.path is None and remaining > 0 and coverage is not self.evaluator:
|
if explicit.path is None and remaining > 0 and coverage is not self.evaluator:
|
||||||
fallback = search_path(coverage, net.start, net.target, node_limit=remaining, **settings)
|
fallback = search_path(coverage, net.start, net.target, node_limit=remaining, **settings)
|
||||||
|
|
@ -187,6 +192,42 @@ class _LayoutSearch:
|
||||||
explicit = explicit.including_work(guided)
|
explicit = explicit.including_work(guided)
|
||||||
return replace(explicit, coarse_expanded=coarse_expanded, guide_fallback=guide_attempted)
|
return replace(explicit, coarse_expanded=coarse_expanded, guide_fallback=guide_attempted)
|
||||||
|
|
||||||
|
def improve_straights(self, name: str) -> None:
|
||||||
|
"""Select cheaper profiles on installed straight spans without moving their ports."""
|
||||||
|
result = self.routes[name]
|
||||||
|
if result.path is None or self.nets[name].seed:
|
||||||
|
return
|
||||||
|
path = result.path
|
||||||
|
index = 0
|
||||||
|
checks = proposed = 0
|
||||||
|
while index < len(path):
|
||||||
|
original = path[index]
|
||||||
|
best = (original,)
|
||||||
|
best_cost = original.cost
|
||||||
|
for recipe in straight_replacements(self.evaluator, original):
|
||||||
|
proposed += 1
|
||||||
|
candidate = replay_moves(self.evaluator, original.start, recipe)
|
||||||
|
if candidate is None or candidate[-1].end != original.end:
|
||||||
|
continue
|
||||||
|
cost = fsum(move.cost for move in candidate)
|
||||||
|
if cost >= best_cost - COST_TOLERANCE:
|
||||||
|
continue
|
||||||
|
if original.length is None or any(move.length is None for move in candidate):
|
||||||
|
continue
|
||||||
|
if fsum(move.length for move in candidate if move.length is not None) > original.length + 1e-8:
|
||||||
|
continue
|
||||||
|
checks += 1
|
||||||
|
if self.verify(name, (*path[:index], *candidate, *path[index + 1:])):
|
||||||
|
best, best_cost = candidate, cost
|
||||||
|
if len(best) != 1 or best[0] is not original:
|
||||||
|
path = (*path[:index], *best, *path[index + 1:])
|
||||||
|
index += len(best)
|
||||||
|
self.routes[name] = replace(
|
||||||
|
result, path=path, proposed=result.proposed + proposed, geometry_checks=result.geometry_checks + checks,
|
||||||
|
)
|
||||||
|
if path is not result.path:
|
||||||
|
self._install(name, path)
|
||||||
|
|
||||||
def _coverage_evaluator(self, net: CatalogNet) -> MoveEvaluator:
|
def _coverage_evaluator(self, net: CatalogNet) -> MoveEvaluator:
|
||||||
if net.start.profile != net.target.profile:
|
if net.start.profile != net.target.profile:
|
||||||
return self.evaluator
|
return self.evaluator
|
||||||
|
|
@ -304,6 +345,7 @@ class _LayoutSearch:
|
||||||
settings["destination_attachment"] = None
|
settings["destination_attachment"] = None
|
||||||
trial = search_path(
|
trial = search_path(
|
||||||
self.evaluator, start, target, node_limit=budget, max_cost=cost - 2 * COST_TOLERANCE, corridor=corridor, **settings,
|
self.evaluator, start, target, node_limit=budget, max_cost=cost - 2 * COST_TOLERANCE, corridor=corridor, **settings,
|
||||||
|
method="constructive_only" if self.settings.constructive else "detailed",
|
||||||
)
|
)
|
||||||
budget -= trial.expanded
|
budget -= trial.expanded
|
||||||
result = result.including_work(trial)
|
result = result.including_work(trial)
|
||||||
|
|
@ -457,7 +499,7 @@ def route_layout(
|
||||||
order = tuple(nets)
|
order = tuple(nets)
|
||||||
first = _route_attempt(evaluator, nets, settings, timing, groups, members, active_windows, order, require_complete)
|
first = _route_attempt(evaluator, nets, settings, timing, groups, members, active_windows, order, require_complete)
|
||||||
if settings.refinement and len(order) > 1 and (
|
if settings.refinement and len(order) > 1 and (
|
||||||
len(first.completed) < len(order) or _routes_compete(first, nets, evaluator, settings.clearance)
|
len(first.completed) < len(order) or (not settings.constructive and _routes_compete(first, nets, evaluator, settings.clearance))
|
||||||
):
|
):
|
||||||
second = _route_attempt(evaluator, nets, settings, timing, groups, members, active_windows, tuple(reversed(order)), require_complete)
|
second = _route_attempt(evaluator, nets, settings, timing, groups, members, active_windows, tuple(reversed(order)), require_complete)
|
||||||
best = second if _layout_rank(second) < _layout_rank(first) else first
|
best = second if _layout_rank(second) < _layout_rank(first) else first
|
||||||
|
|
@ -510,6 +552,10 @@ def _route_attempt(
|
||||||
cost_at_coverage = (
|
cost_at_coverage = (
|
||||||
fsum(move.cost for route in routing.routes.values() for move in (route.path or ())) if covered_at is not None else None
|
fsum(move.cost for route in routing.routes.values() for move in (route.path or ())) if covered_at is not None else None
|
||||||
)
|
)
|
||||||
|
if settings.constructive:
|
||||||
|
for name in order:
|
||||||
|
if name not in members:
|
||||||
|
routing.improve_straights(name)
|
||||||
tuning_start = perf_counter()
|
tuning_start = perf_counter()
|
||||||
reports = {group.group_id: routing.tune(group, timing) for group in groups} if timing is not None else {}
|
reports = {group.group_id: routing.tune(group, timing) for group in groups} if timing is not None else {}
|
||||||
tuning_seconds = perf_counter() - tuning_start if groups else 0.0
|
tuning_seconds = perf_counter() - tuning_start if groups else 0.0
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass, replace
|
from dataclasses import dataclass, replace
|
||||||
from heapq import heappop, heappush
|
from heapq import heappop, heappush
|
||||||
from itertools import count, islice
|
from itertools import chain, count, islice
|
||||||
from math import ceil, floor, fsum, hypot, inf, isfinite
|
from math import ceil, floor, fsum, hypot, inf, isfinite
|
||||||
from typing import TYPE_CHECKING, Literal
|
from typing import TYPE_CHECKING, Literal
|
||||||
|
|
||||||
|
|
@ -18,6 +18,8 @@ from ._catalog_verify import (
|
||||||
verify_move, verify_path, wholly_in_attachment,
|
verify_move, verify_path, wholly_in_attachment,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from ._jog import jog_launch_steps
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from collections.abc import Iterator, Sequence
|
from collections.abc import Iterator, Sequence
|
||||||
|
|
||||||
|
|
@ -121,6 +123,40 @@ def path_recipe(path: Sequence[Evaluation]) -> tuple[Move, ...]:
|
||||||
return tuple(recipe)
|
return tuple(recipe)
|
||||||
|
|
||||||
|
|
||||||
|
def straight_replacements(evaluator: MoveEvaluator, original: Evaluation) -> Iterator[tuple[Move, ...]]:
|
||||||
|
"""Offer cheaper straight variants and centered profile changes on the same axis."""
|
||||||
|
start = original.start
|
||||||
|
steps = original.move.steps
|
||||||
|
if steps is None:
|
||||||
|
return
|
||||||
|
pitch = int(evaluator.grid.pitch)
|
||||||
|
dx, dy = HEADING_STEPS[start.heading]
|
||||||
|
denominator = pitch * (dx * dx + dy * dy)
|
||||||
|
|
||||||
|
def advance(end: Pose) -> int | None:
|
||||||
|
if end.heading != start.heading or dx * end.y != dy * end.x:
|
||||||
|
return None
|
||||||
|
along, remainder = divmod(dx * end.x + dy * end.y, denominator)
|
||||||
|
return along if not remainder and along >= 0 else None
|
||||||
|
|
||||||
|
straights: dict[str, list[str]] = {}
|
||||||
|
for name, variant in evaluator.catalog.variants.items():
|
||||||
|
if isinstance(variant, StraightVariant):
|
||||||
|
straights.setdefault(variant.profile, []).append(name)
|
||||||
|
if variant.profile == start.profile and name != original.move.variant:
|
||||||
|
yield (Move(name, steps=steps),)
|
||||||
|
for first, middle in evaluator.local_moves(start.profile, start.heading):
|
||||||
|
lead = advance(middle)
|
||||||
|
if middle.profile == start.profile or lead is None:
|
||||||
|
continue
|
||||||
|
for last, end in evaluator.local_moves(middle.profile, middle.heading):
|
||||||
|
tail = advance(end)
|
||||||
|
if end.profile != start.profile or tail is None or lead + tail >= steps:
|
||||||
|
continue
|
||||||
|
for straight in straights.get(middle.profile, ()):
|
||||||
|
yield first, Move(straight, steps=steps - lead - tail), last
|
||||||
|
|
||||||
|
|
||||||
COST_TOLERANCE = 1e-12
|
COST_TOLERANCE = 1e-12
|
||||||
_TravelState = tuple[str, int]
|
_TravelState = tuple[str, int]
|
||||||
_Position = tuple[int, int, int, str]
|
_Position = tuple[int, int, int, str]
|
||||||
|
|
@ -326,7 +362,19 @@ class _Proposals:
|
||||||
if remainder or parallel < 0:
|
if remainder or parallel < 0:
|
||||||
continue
|
continue
|
||||||
before_id, middle_id, after_id = (cheapest[profile] for profile in (start.profile, turn.profile, target.profile))
|
before_id, middle_id, after_id = (cheapest[profile] for profile in (start.profile, turn.profile, target.profile))
|
||||||
for before, after in dict.fromkeys(((0, parallel), (parallel, 0), (parallel // 2, parallel - parallel // 2))):
|
if ux * vx + uy * vy == 0:
|
||||||
|
margin = self.clearance + max(self.evaluator.catalog.profiles[p].width for p in (
|
||||||
|
start.profile, turn.profile, target.profile,
|
||||||
|
)) / 2
|
||||||
|
advance = ux * (turn.x + exit_pose.x) + uy * (turn.y + exit_pose.y)
|
||||||
|
launch_steps = jog_launch_steps(
|
||||||
|
(start.x, start.y), (ux, uy), ux * ty - uy * tx, advance, parallel, pitch,
|
||||||
|
margin * (ux * ux + uy * uy), self.blocker_bounds,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
launch_steps = dict.fromkeys((0, parallel, parallel // 2))
|
||||||
|
for before in launch_steps:
|
||||||
|
after = parallel - before
|
||||||
recipe = (
|
recipe = (
|
||||||
*((Move(before_id, steps=before),) if before else ()), first,
|
*((Move(before_id, steps=before),) if before else ()), first,
|
||||||
*((Move(middle_id, steps=across),) if across else ()), second,
|
*((Move(middle_id, steps=across),) if across else ()), second,
|
||||||
|
|
@ -339,7 +387,52 @@ class _Proposals:
|
||||||
variant = self.evaluator.catalog.variants[move.variant]
|
variant = self.evaluator.catalog.variants[move.variant]
|
||||||
assert not isinstance(variant, StraightVariant)
|
assert not isinstance(variant, StraightVariant)
|
||||||
price += variant.cost
|
price += variant.cost
|
||||||
candidates.append((price, recipe))
|
candidates.append((price, before, recipe))
|
||||||
|
for _, _, recipe in sorted(candidates, key=lambda item: item[:2]):
|
||||||
|
yield recipe
|
||||||
|
|
||||||
|
def direct_recipes(self, start: Pose) -> Iterator[tuple[Move, ...]]:
|
||||||
|
"""Connect the terminal rays with a straight or a single fixed move."""
|
||||||
|
tx, ty = self.target.x - start.x, self.target.y - start.y
|
||||||
|
ux, uy = HEADING_STEPS[start.heading]
|
||||||
|
vx, vy = HEADING_STEPS[self.target.heading]
|
||||||
|
pitch = int(self.evaluator.grid.pitch)
|
||||||
|
divisor = ux * vy - uy * vx
|
||||||
|
unit = pitch * self.evaluator.grid.meters_per_unit * 100
|
||||||
|
start_straights = self._straights[start.profile]
|
||||||
|
target_straights = self._straights[self.target.profile]
|
||||||
|
if start.heading == self.target.heading and start.profile == self.target.profile and ux * ty == uy * tx:
|
||||||
|
steps, remainder = divmod(ux * tx + uy * ty, pitch * (ux * ux + uy * uy))
|
||||||
|
if steps > 0 and not remainder:
|
||||||
|
for variant in sorted(start_straights, key=self._straight_prices.__getitem__):
|
||||||
|
yield (Move(variant, steps=steps),)
|
||||||
|
if not divisor:
|
||||||
|
return
|
||||||
|
candidates = []
|
||||||
|
for move, end in self.evaluator.local_moves(start.profile, start.heading):
|
||||||
|
if (end.heading, end.profile) != (self.target.heading, self.target.profile):
|
||||||
|
continue
|
||||||
|
x, y = tx - end.x, ty - end.y
|
||||||
|
lead, lead_rem = divmod(x * vy - y * vx, pitch * divisor)
|
||||||
|
tail, tail_rem = divmod(ux * y - uy * x, pitch * divisor)
|
||||||
|
if lead_rem or tail_rem or min(lead, tail) < 0:
|
||||||
|
continue
|
||||||
|
recipe: list[Move] = []
|
||||||
|
cost = self._fixed_offsets[start.profile, start.heading][move][1]
|
||||||
|
if lead:
|
||||||
|
if not start_straights:
|
||||||
|
continue
|
||||||
|
variant = min(start_straights, key=self._straight_prices.__getitem__)
|
||||||
|
recipe.append(Move(variant, steps=lead))
|
||||||
|
cost += self._straight_prices[variant] * lead * hypot(ux, uy) * unit
|
||||||
|
recipe.append(move)
|
||||||
|
if tail:
|
||||||
|
if not target_straights:
|
||||||
|
continue
|
||||||
|
variant = min(target_straights, key=self._straight_prices.__getitem__)
|
||||||
|
recipe.append(Move(variant, steps=tail))
|
||||||
|
cost += self._straight_prices[variant] * tail * hypot(vx, vy) * unit
|
||||||
|
candidates.append((cost, tuple(recipe)))
|
||||||
for _, recipe in sorted(candidates, key=lambda item: item[0]):
|
for _, recipe in sorted(candidates, key=lambda item: item[0]):
|
||||||
yield recipe
|
yield recipe
|
||||||
|
|
||||||
|
|
@ -508,6 +601,7 @@ def search_path(
|
||||||
corridor: Corridor | None = None,
|
corridor: Corridor | None = None,
|
||||||
scan_steps: bool = False,
|
scan_steps: bool = False,
|
||||||
bias: SearchBias | None = None,
|
bias: SearchBias | None = None,
|
||||||
|
method: Literal["detailed", "constructive_first", "constructive_only"] = "detailed",
|
||||||
) -> SearchResult:
|
) -> SearchResult:
|
||||||
"""Search physical paths while retaining a bounded number of distinct arrival histories."""
|
"""Search physical paths while retaining a bounded number of distinct arrival histories."""
|
||||||
_require_integer(node_limit)
|
_require_integer(node_limit)
|
||||||
|
|
@ -539,7 +633,10 @@ def search_path(
|
||||||
return SearchResult(None, "exhausted", 0, 0)
|
return SearchResult(None, "exhausted", 0, 0)
|
||||||
incumbent = None
|
incumbent = None
|
||||||
macro_trials = macro_checks = 0
|
macro_trials = macro_checks = 0
|
||||||
for recipe in islice(proposals.two_turn_recipes(start), min(node_limit // 2, 48)):
|
recipes = proposals.two_turn_recipes(start)
|
||||||
|
if method != "detailed":
|
||||||
|
recipes = chain(proposals.direct_recipes(start), recipes)
|
||||||
|
for recipe in islice(recipes, min(node_limit // 2, 48)):
|
||||||
macro_trials += 1
|
macro_trials += 1
|
||||||
if recipe in excluded_paths:
|
if recipe in excluded_paths:
|
||||||
continue
|
continue
|
||||||
|
|
@ -557,6 +654,10 @@ def search_path(
|
||||||
) is None:
|
) is None:
|
||||||
incumbent = path
|
incumbent = path
|
||||||
max_cost = cost
|
max_cost = cost
|
||||||
|
if method == "constructive_first":
|
||||||
|
return SearchResult(path, "verified", 0, macro_trials, geometry_checks=macro_checks)
|
||||||
|
if method == "constructive_only":
|
||||||
|
return SearchResult(incumbent, "verified" if incumbent is not None else "exhausted", 0, macro_trials, geometry_checks=macro_checks)
|
||||||
# Queue moves using only their output pose and a cost lower bound.
|
# Queue moves using only their output pose and a cost lower bound.
|
||||||
# A move that can still win is materialized and may be requeued with its
|
# A move that can still win is materialized and may be requeued with its
|
||||||
# full cost and geometry-dependent penalty before consuming an arrival.
|
# full cost and geometry-dependent penalty before consuming an arrival.
|
||||||
|
|
|
||||||
38
inire/router/_jog.py
Normal file
38
inire/router/_jog.py
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
"""Obstacle-driven launch positions for two-turn paths between parallel ports."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from itertools import pairwise
|
||||||
|
from math import ceil, floor
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from collections.abc import Iterable
|
||||||
|
|
||||||
|
|
||||||
|
def jog_launch_steps(
|
||||||
|
start: tuple[int, int],
|
||||||
|
direction: tuple[int, int],
|
||||||
|
lateral: int,
|
||||||
|
turn_advance: int,
|
||||||
|
steps: int,
|
||||||
|
pitch: int,
|
||||||
|
margin: float,
|
||||||
|
blockers: Iterable[tuple[float, float, float, float]],
|
||||||
|
) -> list[int]:
|
||||||
|
"""Sample the free longitudinal span at obstacle boundaries and between them."""
|
||||||
|
sx, sy = start
|
||||||
|
dx, dy = direction
|
||||||
|
step_forward = pitch * (dx * dx + dy * dy)
|
||||||
|
cuts = {0, steps}
|
||||||
|
for x0, y0, x1, y1 in blockers:
|
||||||
|
corners = tuple((x - sx, y - sy) for x in (x0, x1) for y in (y0, y1))
|
||||||
|
side = tuple(dx * y - dy * x for x, y in corners)
|
||||||
|
if min(side) > max(0, lateral) + margin or max(side) < min(0, lateral) - margin:
|
||||||
|
continue
|
||||||
|
forward = tuple(dx * x + dy * y for x, y in corners)
|
||||||
|
for boundary in (min(forward) - margin, max(forward) + margin):
|
||||||
|
for offset in (0, turn_advance):
|
||||||
|
position = (boundary - offset) / step_forward
|
||||||
|
cuts.update(n for n in (floor(position), ceil(position)) if 0 <= n <= steps)
|
||||||
|
return sorted(cuts | {(lo + hi) // 2 for lo, hi in pairwise(sorted(cuts))} | {steps // 2})
|
||||||
|
|
@ -4,21 +4,23 @@ from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import replace
|
from dataclasses import replace
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from itertools import combinations, islice, pairwise, product
|
from itertools import chain, combinations, islice, pairwise, product
|
||||||
from math import ceil, floor, isfinite
|
from math import ceil, floor, isfinite
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from inire.geometry.collision import RoutingWorld
|
from inire.geometry.collision import RoutingWorld
|
||||||
from inire.geometry.components import Straight, bend90_uses_circular_geometry, bend_fits_width
|
from inire.geometry.components import Straight, bend90_grid_span, bend90_uses_circular_geometry, bend_fits_width
|
||||||
from inire.geometry.primitives import Port, rotate_cardinal
|
from inire.geometry.primitives import Port, rotate_cardinal
|
||||||
from inire.model import resolve_bend_geometry
|
from inire.model import resolve_bend_geometry
|
||||||
|
from inire.router._jog import jog_launch_steps
|
||||||
from inire.router._seed_materialization import materialize_path_seed
|
from inire.router._seed_materialization import materialize_path_seed
|
||||||
from inire.router._waypoints import _direction, compile_waypoints, export_waypoints
|
from inire.router._waypoints import _direction, compile_waypoints, export_waypoints
|
||||||
from inire.seeds import Bend90Seed, PathSeed, StraightSeed
|
from inire.seeds import Bend90Seed, PathSeed, StraightSeed
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from collections.abc import Iterator
|
from collections.abc import Callable, Iterator
|
||||||
|
|
||||||
|
from inire.geometry.components import ComponentResult
|
||||||
from inire.model import NetSpec, RoutingProblem, SearchOptions
|
from inire.model import NetSpec, RoutingProblem, SearchOptions
|
||||||
from inire.router._waypoints import XY
|
from inire.router._waypoints import XY
|
||||||
|
|
||||||
|
|
@ -231,6 +233,47 @@ def terminal_link_seed(net: NetSpec, search: SearchOptions) -> PathSeed | None:
|
||||||
return seed if end == target else None
|
return seed if end == target else None
|
||||||
|
|
||||||
|
|
||||||
|
def _terminal_jogs(net: NetSpec, search: SearchOptions, world: RoutingWorld) -> Iterator[PathSeed]:
|
||||||
|
sx, sy, heading = net.start.as_tuple()
|
||||||
|
tx, ty, target_heading = net.target.as_tuple()
|
||||||
|
if heading != target_heading or not bend90_uses_circular_geometry(*resolve_bend_geometry(search)):
|
||||||
|
return
|
||||||
|
forward, lateral = map(int, rotate_cardinal(tx - sx, ty - sy, -heading))
|
||||||
|
if forward <= 0 or lateral == 0:
|
||||||
|
return
|
||||||
|
dx, dy = map(int, rotate_cardinal(1, 0, heading))
|
||||||
|
margin = world.clearance + net.width / 2
|
||||||
|
bounds = min(sx, tx) - margin, min(sy, ty) - margin, max(sx, tx) + margin, max(sy, ty) + margin
|
||||||
|
blockers = (*world.iter_static_obstacle_bounds(bounds), *world.iter_dynamic_path_bounds(bounds))
|
||||||
|
for radius in sorted(set(search.bend_radii)):
|
||||||
|
span = bend90_grid_span(radius)
|
||||||
|
if min(forward, abs(lateral)) < 2 * span or not bend_fits_width(radius, net.width):
|
||||||
|
continue
|
||||||
|
for lead in jog_launch_steps((sx, sy), (dx, dy), lateral, 2 * span, forward - 2 * span, 1, margin, blockers):
|
||||||
|
x = lead + span
|
||||||
|
ax, ay = rotate_cardinal(x, 0, heading)
|
||||||
|
bx, by = rotate_cardinal(x, lateral, heading)
|
||||||
|
points = ((sx, sy), (sx + int(ax), sy + int(ay)), (sx + int(bx), sy + int(by)), (tx, ty))
|
||||||
|
seed, end = compile_waypoints(points, net.start, radius)
|
||||||
|
if end == net.target:
|
||||||
|
yield seed
|
||||||
|
|
||||||
|
|
||||||
|
def terminal_constructive_path(
|
||||||
|
net: NetSpec, search: SearchOptions, world: RoutingWorld, *, expired: Callable[[], bool],
|
||||||
|
) -> tuple[ComponentResult, ...] | None:
|
||||||
|
"""Try verified straight, single-turn, and two-turn paths before native search."""
|
||||||
|
link = terminal_link_seed(net, search)
|
||||||
|
jogs = islice(_terminal_jogs(net, search, world), search.terminal_jog_limit)
|
||||||
|
for seed in chain((link,) if link else (), jogs):
|
||||||
|
if expired():
|
||||||
|
break
|
||||||
|
path = materialize_path_seed(seed, start=net.start, net_width=net.width, search=search, clearance=world.clearance)
|
||||||
|
if path and path[-1].end_port == net.target and world.verify_path_report(net.net_id, path).is_valid:
|
||||||
|
return path
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def _return_detours(
|
def _return_detours(
|
||||||
problem: RoutingProblem,
|
problem: RoutingProblem,
|
||||||
net: NetSpec,
|
net: NetSpec,
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ from inire.router._congestion_policy import (
|
||||||
review_verified_results,
|
review_verified_results,
|
||||||
)
|
)
|
||||||
from inire.router._pair_local import search_pair_candidate
|
from inire.router._pair_local import search_pair_candidate
|
||||||
|
from inire.router._perimeter import terminal_constructive_path
|
||||||
from inire.router._route_traces import conflict_trace_entry, iteration_trace_entry, net_attempt_trace
|
from inire.router._route_traces import conflict_trace_entry, iteration_trace_entry, net_attempt_trace
|
||||||
from inire.router._search import _distance_to_terminal, incumbent_guidance, path_guidance, route_astar
|
from inire.router._search import _distance_to_terminal, incumbent_guidance, path_guidance, route_astar
|
||||||
from inire.router._seed_materialization import materialize_path_seed, SeedMaterializationError
|
from inire.router._seed_materialization import materialize_path_seed, SeedMaterializationError
|
||||||
|
|
@ -183,7 +184,8 @@ class PathFinder:
|
||||||
state: _RoutingState,
|
state: _RoutingState,
|
||||||
) -> dict[str, tuple[ComponentResult, ...]]:
|
) -> dict[str, tuple[ComponentResult, ...]]:
|
||||||
greedy_paths: dict[str, tuple[ComponentResult, ...]] = {}
|
greedy_paths: dict[str, tuple[ComponentResult, ...]] = {}
|
||||||
greedy_node_limit = min(self.context.options.search.node_limit, 2000)
|
search = self.context.options.search
|
||||||
|
greedy_node_limit = min(search.node_limit, 2000)
|
||||||
world = self.context.cost_evaluator.collision_engine
|
world = self.context.cost_evaluator.collision_engine
|
||||||
existing = state.initial_paths or {}
|
existing = state.initial_paths or {}
|
||||||
expired = partial(self._expired, state)
|
expired = partial(self._expired, state)
|
||||||
|
|
@ -199,34 +201,38 @@ class PathFinder:
|
||||||
if net_id in existing or net_id in state.terminal_errors:
|
if net_id in existing or net_id in state.terminal_errors:
|
||||||
continue
|
continue
|
||||||
net = state.net_specs[net_id]
|
net = state.net_specs[net_id]
|
||||||
h_start = self.context.cost_evaluator.h_manhattan(
|
path = None
|
||||||
net.start,
|
if search.terminal_jog_limit and not state.corridors:
|
||||||
net.target,
|
path = terminal_constructive_path(net, search, world, expired=expired)
|
||||||
min_bend_radius=self.context.min_bend_radius,
|
if path is None:
|
||||||
)
|
h_start = self.context.cost_evaluator.h_manhattan(
|
||||||
max_cost_limit = max(h_start * 3.0, 2000.0)
|
net.start,
|
||||||
candidates = state.corridors.get(net_id, ())
|
net.target,
|
||||||
run_config = SearchRunConfig.from_options(
|
min_bend_radius=self.context.min_bend_radius,
|
||||||
self.context.options,
|
)
|
||||||
skip_congestion=True,
|
max_cost_limit = max(h_start * 3.0, 2000.0)
|
||||||
max_cost=max_cost_limit,
|
candidates = state.corridors.get(net_id, ())
|
||||||
self_collision_check=True,
|
run_config = SearchRunConfig.from_options(
|
||||||
node_limit=greedy_node_limit,
|
self.context.options,
|
||||||
corridor=candidates[0] if candidates else None,
|
skip_congestion=True,
|
||||||
corridor_strength=self.context.options.topology.guide_strength,
|
max_cost=max_cost_limit,
|
||||||
expired=expired,
|
self_collision_check=True,
|
||||||
)
|
node_limit=greedy_node_limit,
|
||||||
path = route_astar(
|
corridor=candidates[0] if candidates else None,
|
||||||
net.start,
|
corridor_strength=self.context.options.topology.guide_strength,
|
||||||
net.target,
|
expired=expired,
|
||||||
net.width,
|
)
|
||||||
context=self.context,
|
path = route_astar(
|
||||||
metrics=self.metrics,
|
net.start,
|
||||||
net_id=net_id,
|
net.target,
|
||||||
config=run_config,
|
net.width,
|
||||||
)
|
context=self.context,
|
||||||
if not path or world.verify_path_report(net_id, path).intrinsic_collision_count:
|
metrics=self.metrics,
|
||||||
continue
|
net_id=net_id,
|
||||||
|
config=run_config,
|
||||||
|
)
|
||||||
|
if not path or world.verify_path_report(net_id, path).intrinsic_collision_count:
|
||||||
|
continue
|
||||||
self.metrics.total_warm_start_paths_built += 1
|
self.metrics.total_warm_start_paths_built += 1
|
||||||
greedy_paths[net_id] = tuple(path)
|
greedy_paths[net_id] = tuple(path)
|
||||||
reserve(net_id, path)
|
reserve(net_id, path)
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,31 @@ def test_search_uses_catalog_cost_for_profile_tradeoffs(distance, transition_cos
|
||||||
assert sum(part.cost for part in result.path) == pytest.approx(cost)
|
assert sum(part.cost for part in result.path) == pytest.approx(cost)
|
||||||
|
|
||||||
|
|
||||||
|
def test_constructive_profile_selection_respects_clearance() -> None:
|
||||||
|
transition = FixedVariant(
|
||||||
|
"centered", {"in": Pose(0, 0, 0, "4"), "out": Pose(10_000, 0, 180, "5")},
|
||||||
|
(Polygon(((0, -2000), (10_000, -2500), (10_000, 2500), (0, 2000))),),
|
||||||
|
(("in", "out"), ("out", "in")), (Orientation(), Orientation(180)), 0.01, 10_000,
|
||||||
|
)
|
||||||
|
evaluator = MoveEvaluator(Grid((0, 0), 100, 1e-9), Catalog(
|
||||||
|
"constructive", {"4": Profile("ridge", 4000), "5": Profile("ridge", 5000)},
|
||||||
|
{"4-straight": StraightVariant("4", 1), "5-straight": StraightVariant("5", 0.5), "transition": transition},
|
||||||
|
))
|
||||||
|
nets = {
|
||||||
|
name: CatalogNet(Pose(10_000, y, 0, "4"), Pose(610_000, y, 0, "4"))
|
||||||
|
for name, y in (("open", 10_000), ("constrained", 30_000))
|
||||||
|
}
|
||||||
|
settings = LayoutSettings(
|
||||||
|
box(0, 0, 620_000, 50_000), (box(100_000, 33_100, 400_000, 40_000),),
|
||||||
|
clearance=1000, node_limit=8, refinement=False, constructive=True,
|
||||||
|
)
|
||||||
|
result = route_layout(evaluator, nets, settings)
|
||||||
|
assert result.completed == ("open", "constrained")
|
||||||
|
assert result.routes["open"].cost == pytest.approx(0.049)
|
||||||
|
assert result.routes["constrained"].cost == pytest.approx(0.06)
|
||||||
|
assert all(route.length == pytest.approx(600_000) and route.expanded == 0 for route in result.routes.values())
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def masque_4a3():
|
def masque_4a3():
|
||||||
masque = pytest.importorskip("masque")
|
masque = pytest.importorskip("masque")
|
||||||
|
|
|
||||||
|
|
@ -155,6 +155,23 @@ def test_search_defers_geometry_and_reorders_a_move_with_a_penalty() -> None:
|
||||||
assert verify_path(evaluator, biased.path, start, target, **geometry) is None
|
assert verify_path(evaluator, biased.path, start, target, **geometry) is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_catalog_jog_can_launch_between_obstacles(monkeypatch) -> None:
|
||||||
|
start, target = Pose(0, 10, 0, "p"), Pose(120, 40, 0, "p")
|
||||||
|
evaluator = MoveEvaluator(Grid((0, 0), 1, 1e-6), Catalog(
|
||||||
|
"jog", {"p": Profile("ridge", 2)},
|
||||||
|
{"s": StraightVariant("p", 1), "left": BendVariant("p", 90, 5, 0.01), "right": BendVariant("p", -90, 5, 0.01)},
|
||||||
|
))
|
||||||
|
geometry = {"board": box(-10, 0, 130, 60), "keepouts": (box(49, 7, 110, 13), box(-5, 37, 22, 43)), "clearance": 1}
|
||||||
|
|
||||||
|
# Isolate complete jog proposals. The source, midpoint, and destination launches all hit keepouts.
|
||||||
|
monkeypatch.setattr(_Proposals, "from_pose", lambda *_: ())
|
||||||
|
result = search_path(evaluator, start, target, node_limit=8, **geometry)
|
||||||
|
|
||||||
|
assert result.path is not None
|
||||||
|
assert [part.move.variant for part in result.path] == ["s", "left", "s", "right", "s"]
|
||||||
|
assert verify_path(evaluator, result.path, start, target, **geometry) is None
|
||||||
|
|
||||||
|
|
||||||
def test_refinement_prefers_the_cheaper_of_two_full_coverage_orders() -> None:
|
def test_refinement_prefers_the_cheaper_of_two_full_coverage_orders() -> None:
|
||||||
catalog = Catalog("order", {"g": Profile("ridge", 2)}, {
|
catalog = Catalog("order", {"g": Profile("ridge", 2)}, {
|
||||||
"s": StraightVariant("g", 1), "left": BendVariant("g", 90, 5, 0.01), "right": BendVariant("g", -90, 5, 0.01),
|
"s": StraightVariant("g", 1), "left": BendVariant("g", 90, 5, 0.01), "right": BendVariant("g", -90, 5, 0.01),
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
from dataclasses import replace
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from shapely.geometry import box
|
from shapely.geometry import box
|
||||||
|
|
||||||
|
|
@ -11,6 +13,8 @@ from inire import (
|
||||||
RoutingOptions,
|
RoutingOptions,
|
||||||
RoutingProblem,
|
RoutingProblem,
|
||||||
SearchOptions,
|
SearchOptions,
|
||||||
|
TopologyOptions,
|
||||||
|
route,
|
||||||
)
|
)
|
||||||
from inire.geometry.collision import RoutingWorld
|
from inire.geometry.collision import RoutingWorld
|
||||||
from inire.geometry.components import Bend90, Straight
|
from inire.geometry.components import Bend90, Straight
|
||||||
|
|
@ -23,6 +27,7 @@ from inire.router.danger_map import DangerMap
|
||||||
|
|
||||||
DEFAULT_BOUNDS = (0, 0, 100, 100)
|
DEFAULT_BOUNDS = (0, 0, 100, 100)
|
||||||
|
|
||||||
|
|
||||||
_PROBLEM_FIELDS = set(RoutingProblem.__dataclass_fields__) - {"bounds", "nets"}
|
_PROBLEM_FIELDS = set(RoutingProblem.__dataclass_fields__) - {"bounds", "nets"}
|
||||||
_SEARCH_FIELDS = set(SearchOptions.__dataclass_fields__)
|
_SEARCH_FIELDS = set(SearchOptions.__dataclass_fields__)
|
||||||
_CONGESTION_FIELDS = set(CongestionOptions.__dataclass_fields__)
|
_CONGESTION_FIELDS = set(CongestionOptions.__dataclass_fields__)
|
||||||
|
|
@ -105,6 +110,25 @@ def _build_manual_path(start: Port, width: float, clearance: float, steps: list[
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def test_native_warm_start_can_place_an_interior_jog() -> None:
|
||||||
|
problem = RoutingProblem(
|
||||||
|
(-10, 0, 130, 60), (NetSpec("jog", Port(0, 10, 0), Port(120, 40, 0), 2),),
|
||||||
|
(box(49, 7, 110, 13), box(-5, 37, 22, 43)), clearance=1,
|
||||||
|
)
|
||||||
|
options = RoutingOptions(
|
||||||
|
search=SearchOptions(node_limit=4, bend_radii=(5,), sbend_radii=()),
|
||||||
|
congestion=CongestionOptions(max_iterations=1),
|
||||||
|
refinement=RefinementOptions(enabled=False),
|
||||||
|
topology=TopologyOptions(mode="off"),
|
||||||
|
)
|
||||||
|
bounded = route(problem, options=options)
|
||||||
|
assert not bounded.results_by_net["jog"].is_valid
|
||||||
|
|
||||||
|
planned = route(problem, options=replace(options, search=replace(options.search, terminal_jog_limit=8)))
|
||||||
|
assert planned.results_by_net["jog"].is_valid
|
||||||
|
assert planned.metrics.nodes_expanded == 0
|
||||||
|
|
||||||
|
|
||||||
def test_frontier_replay_restores_installed_path_and_metrics(monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_frontier_replay_restores_installed_path_and_metrics(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
search_raises = True
|
search_raises = True
|
||||||
world = RoutingWorld(clearance=2.0)
|
world = RoutingWorld(clearance=2.0)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,8 @@ import argparse
|
||||||
import json
|
import json
|
||||||
import platform
|
import platform
|
||||||
import resource
|
import resource
|
||||||
from dataclasses import asdict, dataclass, field
|
from dataclasses import asdict, dataclass, field, replace
|
||||||
|
from itertools import pairwise
|
||||||
from math import fsum, pi, sqrt
|
from math import fsum, pi, sqrt
|
||||||
from statistics import median
|
from statistics import median
|
||||||
from time import perf_counter
|
from time import perf_counter
|
||||||
|
|
@ -15,12 +16,15 @@ from shapely.affinity import scale
|
||||||
from shapely.geometry import Polygon, box
|
from shapely.geometry import Polygon, box
|
||||||
|
|
||||||
from inire import NetSpec, ObjectiveWeights, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
|
from inire import NetSpec, ObjectiveWeights, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
|
||||||
from inire._catalog import BendVariant, Catalog, FixedVariant, Grid, Move, MoveEvaluator, Orientation, Pose, Profile, StraightVariant
|
from inire._catalog import (
|
||||||
|
HEADING_STEPS, BendVariant, Catalog, FixedVariant, Grid, Move, MoveEvaluator, Orientation, Pose, Profile, StraightVariant,
|
||||||
|
)
|
||||||
from inire._catalog_timing import DelayModel
|
from inire._catalog_timing import DelayModel
|
||||||
from inire.router._catalog_guidance import AutomaticGrid, CoarseGuidance
|
from inire.router._catalog_guidance import AutomaticGrid, CoarseGuidance
|
||||||
from inire.router._catalog_layout import CatalogNet, LayoutSettings, route_layout
|
from inire.router._catalog_layout import CatalogNet, LayoutSettings, route_layout
|
||||||
from inire.router._catalog_matching import MatchGroup
|
from inire.router._catalog_matching import MatchGroup
|
||||||
from inire.router._catalog_verify import replay_moves, verify_path
|
from inire.router._catalog_verify import replay_moves, verify_path
|
||||||
|
from scripts.catalog_floorplan import BLOCKS, COMPONENTS, NET_BANKS, STEPPED_BLOCKS
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True, slots=True)
|
@dataclass(frozen=True, slots=True)
|
||||||
|
|
@ -80,7 +84,53 @@ def corpus_lanes(name: str) -> ScaleCase:
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def floorplan_case() -> ScaleCase:
|
||||||
|
"""Build unseeded port pairs and rounded Manhattan references from authored waypoints."""
|
||||||
|
grid = Grid((0, 0), 100, 1e-9)
|
||||||
|
radius_um = 10
|
||||||
|
cardinal_headings = {step: heading for heading, step in HEADING_STEPS.items() if heading % 90 == 0}
|
||||||
|
nets: dict[str, CatalogNet] = {}
|
||||||
|
references: dict[str, tuple[Move, ...]] = {}
|
||||||
|
for bank, paths in NET_BANKS.items():
|
||||||
|
for index, points in enumerate(paths, 1):
|
||||||
|
name = f"{bank}-{index}"
|
||||||
|
deltas = [(x1 - x0, y1 - y0) for (x0, y0), (x1, y1) in pairwise(points)]
|
||||||
|
directions = [((dx > 0) - (dx < 0), (dy > 0) - (dy < 0)) for dx, dy in deltas]
|
||||||
|
headings = [cardinal_headings[direction] for direction in directions]
|
||||||
|
source, destination = points[0], points[-1]
|
||||||
|
nets[name] = CatalogNet(
|
||||||
|
Pose(1000 * source[0], 1000 * source[1], headings[0], "4"),
|
||||||
|
Pose(1000 * destination[0], 1000 * destination[1], headings[-1], "4"),
|
||||||
|
)
|
||||||
|
recipe: list[Move] = []
|
||||||
|
for segment, (dx, dy) in enumerate(deltas):
|
||||||
|
has_corner = segment < len(deltas) - 1
|
||||||
|
# Each rounded corner uses one radius of the incoming and outgoing straights.
|
||||||
|
length = abs(dx) + abs(dy) - radius_um * (int(segment > 0) + int(has_corner))
|
||||||
|
if length < 0:
|
||||||
|
raise ValueError(f"Reference bend exceeds its setback on {name}")
|
||||||
|
if length:
|
||||||
|
recipe.append(Move("4-straight", steps=1000 * length // grid.pitch))
|
||||||
|
if has_corner:
|
||||||
|
travel, onward = directions[segment:segment + 2]
|
||||||
|
turn = travel[0] * onward[1] - travel[1] * onward[0]
|
||||||
|
if not turn:
|
||||||
|
raise ValueError(f"Reference corner must be a quarter turn on {name}")
|
||||||
|
radius = 1000 * radius_um
|
||||||
|
offset = (radius * (travel[0] + onward[0]), radius * (travel[1] + onward[1]))
|
||||||
|
recipe.append(Move("left-90" if turn > 0 else "right-90", displacement=offset))
|
||||||
|
references[name] = tuple(recipe)
|
||||||
|
|
||||||
|
obstacles = (
|
||||||
|
*(box(*(1000 * coordinate for coordinate in block)) for block in (*BLOCKS, *COMPONENTS)),
|
||||||
|
*(Polygon([(1000 * x, 1000 * y) for x, y in block]) for block in STEPPED_BLOCKS),
|
||||||
|
)
|
||||||
|
return ScaleCase(grid, box(0, 0, 5_000_000, 5_000_000), nets, obstacles, references)
|
||||||
|
|
||||||
|
|
||||||
def scale_case(name: str) -> ScaleCase:
|
def scale_case(name: str) -> ScaleCase:
|
||||||
|
if name == "floorplan":
|
||||||
|
return floorplan_case()
|
||||||
if name in ("tuning", "retry"):
|
if name in ("tuning", "retry"):
|
||||||
return timing_case(name)
|
return timing_case(name)
|
||||||
if name in ("corpus-lanes", "corpus-open-lanes"):
|
if name in ("corpus-lanes", "corpus-open-lanes"):
|
||||||
|
|
@ -137,7 +187,7 @@ def catalog(mode: str, case: str) -> Catalog:
|
||||||
(Polygon(((0, -2000), (10_000, -2500), (10_000, 2500), (0, 2000))),),
|
(Polygon(((0, -2000), (10_000, -2500), (10_000, 2500), (0, 2000))),),
|
||||||
(("a", "b"), ("b", "a")), (Orientation(), Orientation(180)), 0.01, 10_000,
|
(("a", "b"), ("b", "a")), (Orientation(), Orientation(180)), 0.01, 10_000,
|
||||||
)
|
)
|
||||||
if case in ("constrained", "diagonal-savings", "tuning"):
|
if case in ("floorplan", "constrained", "diagonal-savings", "tuning"):
|
||||||
variants["left-90"] = BendVariant("4", 90, 10_000, 0.01, sagitta=30)
|
variants["left-90"] = BendVariant("4", 90, 10_000, 0.01, sagitta=30)
|
||||||
variants["right-90"] = BendVariant("4", -90, 10_000, 0.01, sagitta=30)
|
variants["right-90"] = BendVariant("4", -90, 10_000, 0.01, sagitta=30)
|
||||||
if mode == "octagonal":
|
if mode == "octagonal":
|
||||||
|
|
@ -172,11 +222,22 @@ def verify_references(case: ScaleCase, technology: Catalog) -> None:
|
||||||
raise AssertionError(f"Invalid reference for {name}: {error}")
|
raise AssertionError(f"Invalid reference for {name}: {error}")
|
||||||
|
|
||||||
|
|
||||||
|
def bank_order_key(net: CatalogNet) -> tuple[int, int, bool, int, int]:
|
||||||
|
"""Group by heading and put the outside of each lateral fan-out first."""
|
||||||
|
start, target = net.start, net.target
|
||||||
|
dx, dy = HEADING_STEPS[start.heading]
|
||||||
|
start_side = dx * start.y - dy * start.x
|
||||||
|
shift = dx * target.y - dy * target.x - start_side
|
||||||
|
side = (shift > 0) - (shift < 0)
|
||||||
|
return start.heading, target.heading, shift != 0, side, -side * start_side
|
||||||
|
|
||||||
|
|
||||||
def run_catalog(case: ScaleCase, technology: Catalog, args: argparse.Namespace) -> tuple[dict, float]:
|
def run_catalog(case: ScaleCase, technology: Catalog, args: argparse.Namespace) -> tuple[dict, float]:
|
||||||
settings = LayoutSettings(
|
settings = LayoutSettings(
|
||||||
case.board, case.obstacles, clearance=case.clearance, node_limit=args.node_limit, refinement=not args.no_refinement,
|
case.board, case.obstacles, clearance=case.clearance, node_limit=args.node_limit, refinement=not args.no_refinement,
|
||||||
guidance=None if args.guide_pitch is None else CoarseGuidance(args.guide_pitch),
|
guidance=None if args.guide_pitch is None else CoarseGuidance(args.guide_pitch),
|
||||||
retry_independent=not args.no_independent_retry,
|
retry_independent=not args.no_independent_retry,
|
||||||
|
constructive=args.constructive,
|
||||||
)
|
)
|
||||||
start = perf_counter()
|
start = perf_counter()
|
||||||
grid = case.grid
|
grid = case.grid
|
||||||
|
|
@ -231,7 +292,10 @@ def run_native(case: ScaleCase, args: argparse.Namespace) -> tuple[dict, float]:
|
||||||
rate = pitch * case.grid.meters_per_unit * 100
|
rate = pitch * case.grid.meters_per_unit * 100
|
||||||
radius = 10_000 / pitch
|
radius = 10_000 / pitch
|
||||||
options = RoutingOptions(
|
options = RoutingOptions(
|
||||||
search=SearchOptions(node_limit=args.node_limit, max_straight_length=50_000, bend_radii=(radius,), sbend_radii=()),
|
search=SearchOptions(
|
||||||
|
node_limit=args.node_limit, max_straight_length=50_000, bend_radii=(radius,), sbend_radii=(),
|
||||||
|
terminal_jog_limit=args.native_jog_limit,
|
||||||
|
),
|
||||||
objective=ObjectiveWeights(unit_length_cost=rate, bend_penalty=(0.01 - radius * pi / 2 * rate) * sqrt(radius / 10), danger_weight=0),
|
objective=ObjectiveWeights(unit_length_cost=rate, bend_penalty=(0.01 - radius * pi / 2 * rate) * sqrt(radius / 10), danger_weight=0),
|
||||||
topology=TopologyOptions(mode="off"),
|
topology=TopologyOptions(mode="off"),
|
||||||
refinement=RefinementOptions(enabled=not args.no_refinement),
|
refinement=RefinementOptions(enabled=not args.no_refinement),
|
||||||
|
|
@ -271,31 +335,46 @@ def main() -> None:
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
parser.add_argument("--mode", choices=("native", "manhattan", "typed", "octagonal"), default="typed")
|
parser.add_argument("--mode", choices=("native", "manhattan", "typed", "octagonal"), default="typed")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--case", default="aligned",
|
"--case", default="floorplan", help="routing fixture (default: floorplan)",
|
||||||
choices=(
|
choices=(
|
||||||
"aligned", "constrained", "diagonal-savings", "diagonal", "off-coarse", "tuning", "retry", "corpus-lanes", "corpus-open-lanes",
|
"floorplan", "aligned", "constrained", "diagonal-savings", "diagonal", "off-coarse", "tuning", "retry",
|
||||||
|
"corpus-lanes", "corpus-open-lanes",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
parser.add_argument("--guide-pitch", type=int, help="coarse pitch in nanometers")
|
parser.add_argument("--guide-pitch", type=int, help="coarse pitch in nanometers")
|
||||||
parser.add_argument("--auto-pitch", type=int, help="preferred pitch for automatic grid selection in nanometers")
|
parser.add_argument("--auto-pitch", type=int, help="preferred pitch for automatic grid selection in nanometers")
|
||||||
parser.add_argument("--repeat", type=int, default=3)
|
parser.add_argument("--repeat", type=int, default=3)
|
||||||
parser.add_argument("--node-limit", type=int, default=1000)
|
parser.add_argument("--node-limit", type=int, default=1000)
|
||||||
|
parser.add_argument("--net-order", choices=("input", "bank"), help="order for routing nets (floorplan defaults to bank order)")
|
||||||
|
parser.add_argument("--native-jog-limit", type=int, help="two-turn launch attempts per native warm start")
|
||||||
|
parser.add_argument("--constructive", action=argparse.BooleanOptionalAction, help="try constructive catalog routes first")
|
||||||
parser.add_argument("--no-refinement", action="store_true")
|
parser.add_argument("--no-refinement", action="store_true")
|
||||||
parser.add_argument("--no-independent-retry", action="store_true")
|
parser.add_argument("--no-independent-retry", action="store_true")
|
||||||
parser.add_argument("--geometry", action="store_true")
|
parser.add_argument("--geometry", action="store_true")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.repeat < 1:
|
if args.repeat < 1:
|
||||||
parser.error("--repeat must be positive")
|
parser.error("--repeat must be positive")
|
||||||
|
if args.native_jog_limit is not None and (args.mode != "native" or args.native_jog_limit < 0):
|
||||||
|
parser.error("--native-jog-limit requires native mode and a nonnegative limit")
|
||||||
if args.case == "diagonal" and args.mode != "octagonal":
|
if args.case == "diagonal" and args.mode != "octagonal":
|
||||||
parser.error("The native-diagonal terminal case requires octagonal mode")
|
parser.error("The native-diagonal terminal case requires octagonal mode")
|
||||||
if args.mode == "native" and (
|
if args.mode == "native" and (
|
||||||
args.guide_pitch is not None or args.auto_pitch is not None
|
args.guide_pitch is not None or args.auto_pitch is not None
|
||||||
or args.case not in ("constrained", "aligned", "diagonal-savings", "corpus-lanes", "corpus-open-lanes")
|
or args.case not in ("floorplan", "constrained", "aligned", "diagonal-savings", "corpus-lanes", "corpus-open-lanes")
|
||||||
):
|
):
|
||||||
parser.error("Native mode needs a case with cardinal terminals on the explicit grid")
|
parser.error("Native mode needs a case with cardinal terminals on the explicit grid")
|
||||||
case = scale_case(args.case)
|
case = scale_case(args.case)
|
||||||
technology = catalog(args.mode, args.case)
|
technology = catalog(args.mode, args.case)
|
||||||
verify_references(case, technology)
|
verify_references(case, technology)
|
||||||
|
if args.net_order is None:
|
||||||
|
args.net_order = "bank" if args.case == "floorplan" else "input"
|
||||||
|
if args.net_order == "bank":
|
||||||
|
names = sorted(case.nets, key=lambda name: bank_order_key(case.nets[name]))
|
||||||
|
case = replace(case, nets={name: case.nets[name] for name in names})
|
||||||
|
if args.mode == "native" and args.native_jog_limit is None:
|
||||||
|
args.native_jog_limit = 48 if args.case == "floorplan" else 0
|
||||||
|
if args.constructive is None:
|
||||||
|
args.constructive = args.case == "floorplan" and args.mode != "native"
|
||||||
samples = []
|
samples = []
|
||||||
measurements = {}
|
measurements = {}
|
||||||
for _ in range(args.repeat):
|
for _ in range(args.repeat):
|
||||||
|
|
|
||||||
98
scripts/catalog_floorplan.py
Normal file
98
scripts/catalog_floorplan.py
Normal file
|
|
@ -0,0 +1,98 @@
|
||||||
|
"""Synthetic photonic floorplan for the catalog routing scale benchmark."""
|
||||||
|
|
||||||
|
# Coordinates in micrometers. Each bank lists source-to-destination waypoint sequences.
|
||||||
|
NET_BANKS = {
|
||||||
|
"west-launch": (
|
||||||
|
((180, 430), (1080, 430)),
|
||||||
|
((180, 454), (1520, 454)),
|
||||||
|
((180, 478), (740, 478), (740, 518), (1660, 518)),
|
||||||
|
((180, 502), (675, 502), (675, 548), (1660, 548)),
|
||||||
|
((180, 526), (610, 526), (610, 588), (1660, 588)),
|
||||||
|
((180, 550), (545, 550), (545, 628), (1660, 628)),
|
||||||
|
((180, 574), (478, 574), (478, 668), (1660, 668)),
|
||||||
|
((180, 598), (414, 598), (414, 711), (1520, 711)),
|
||||||
|
),
|
||||||
|
"shared-trunk": (
|
||||||
|
((260, 1160), (1090, 1160), (1090, 1288), (2140, 1288)),
|
||||||
|
((260, 1198), (1010, 1198), (1010, 1302), (2140, 1302)),
|
||||||
|
((260, 1236), (930, 1236), (930, 1316), (2140, 1316)),
|
||||||
|
((260, 1274), (850, 1274), (850, 1330), (2140, 1330)),
|
||||||
|
((260, 1312), (775, 1312), (775, 1344), (2140, 1344)),
|
||||||
|
((260, 1358), (2140, 1358)),
|
||||||
|
),
|
||||||
|
"east-output": (
|
||||||
|
((2570, 2025), (3790, 2025), (3790, 1977), (4190, 1977), (4190, 2025), (4780, 2025)),
|
||||||
|
((2670, 2050), (4780, 2050)),
|
||||||
|
((2740, 2080), (3510, 2080), (3510, 2110), (4780, 2110)),
|
||||||
|
((2740, 2110), (3420, 2110), (3420, 2160), (4780, 2160)),
|
||||||
|
((2740, 2140), (3330, 2140), (3330, 2210), (4780, 2210)),
|
||||||
|
),
|
||||||
|
"east-feedback": (
|
||||||
|
((4710, 2570), (2880, 2570)),
|
||||||
|
((4710, 2606), (2470, 2606)),
|
||||||
|
((4710, 2642), (3790, 2642), (3790, 2702), (2470, 2702)),
|
||||||
|
((4710, 2678), (3860, 2678), (3860, 2752), (2470, 2752)),
|
||||||
|
((4710, 2714), (3930, 2714), (3930, 2802), (2470, 2802)),
|
||||||
|
),
|
||||||
|
"north-monitor": (
|
||||||
|
((608, 2110), (608, 4560)),
|
||||||
|
((648, 2110), (648, 4560)),
|
||||||
|
((688, 2110), (688, 3210), (752, 3210), (752, 4560)),
|
||||||
|
((728, 2110), (728, 3080), (797, 3080), (797, 4560)),
|
||||||
|
((768, 2110), (768, 2950), (842, 2950), (842, 4560)),
|
||||||
|
((808, 2230), (808, 2880), (895, 2880), (895, 4560)),
|
||||||
|
),
|
||||||
|
"south-access": (
|
||||||
|
((2970, 1730), (2970, 240)),
|
||||||
|
((3030, 1730), (3030, 240)),
|
||||||
|
((3100, 1660), (3100, 1080), (3170, 1080), (3170, 240)),
|
||||||
|
((3160, 1660), (3160, 1180), (3230, 1180), (3230, 240)),
|
||||||
|
((3220, 1660), (3220, 1280), (3290, 1280), (3290, 240)),
|
||||||
|
((3530, 1050), (3530, 720)),
|
||||||
|
),
|
||||||
|
"upper-transfer": (
|
||||||
|
((2700, 3300), (3890, 3300), (3890, 4440)),
|
||||||
|
((2700, 3365), (3790, 3365), (3790, 4470)),
|
||||||
|
((2700, 3430), (3690, 3430), (3690, 4500)),
|
||||||
|
((2700, 3495), (3590, 3495), (3590, 4530)),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
# Large keepouts reserve device, electronics, and thermal regions.
|
||||||
|
BLOCKS = (
|
||||||
|
(1220, 955, 1610, 1282),
|
||||||
|
(1250, 1364, 1660, 1745),
|
||||||
|
(1800, 435, 2240, 815),
|
||||||
|
(2050, 1480, 2520, 1830),
|
||||||
|
(2560, 675, 2840, 1210),
|
||||||
|
(1870, 2960, 2360, 3370),
|
||||||
|
(2900, 3650, 3435, 3960),
|
||||||
|
(4190, 3180, 4530, 3530),
|
||||||
|
(3970, 1135, 4420, 1470),
|
||||||
|
(3320, 2280, 3590, 2510),
|
||||||
|
(1110, 2510, 1430, 2930),
|
||||||
|
(1140, 3730, 1470, 4170),
|
||||||
|
(1960, 3970, 2310, 4235),
|
||||||
|
(113, 1590, 420, 1850),
|
||||||
|
)
|
||||||
|
# Local device and pad banks are regular within each cluster and vary between clusters.
|
||||||
|
COMPONENTS = (
|
||||||
|
(100, 268, 165, 394), (100, 416, 160, 494), (98, 510, 160, 573), (105, 594, 160, 671),
|
||||||
|
(165, 1125, 238, 1214), (171, 1234, 238, 1312), (169, 1332, 238, 1401),
|
||||||
|
(4788, 1954, 4880, 2054), (4788, 2070, 4880, 2190), (4788, 2206, 4880, 2270),
|
||||||
|
(4730, 2485, 4820, 2589), (4730, 2600, 4820, 2700), (4730, 2712, 4820, 2770),
|
||||||
|
(512, 4580, 625, 4670), (639, 4580, 701, 4670), (716, 4580, 817, 4670), (832, 4580, 924, 4670),
|
||||||
|
(2910, 115, 3005, 221), (3018, 115, 3122, 221), (3135, 115, 3232, 221), (3245, 115, 3320, 221),
|
||||||
|
(3480, 4560, 3610, 4690), (3626, 4540, 3730, 4690), (3744, 4520, 3945, 4690),
|
||||||
|
(1580, 2380, 1672, 2494), (1695, 2398, 1777, 2512), (1805, 2388, 1889, 2502),
|
||||||
|
(2510, 2980, 2610, 3180), (2640, 2930, 2824, 3130), (2870, 2912, 2980, 3090),
|
||||||
|
(4020, 375, 4170, 490), (4200, 410, 4330, 610), (4375, 505, 4490, 650), (4530, 580, 4630, 680),
|
||||||
|
(3890, 2005, 4090, 2039),
|
||||||
|
(3490, 1080, 3580, 1210), (3500, 533, 3640, 678), (3700, 654, 3820, 866),
|
||||||
|
(595, 1940, 682, 2070), (700, 1955, 787, 2070), (801, 1990, 886, 2150),
|
||||||
|
(1700, 4630, 1800, 4755), (1830, 4600, 1950, 4755), (1980, 4555, 2150, 4730),
|
||||||
|
)
|
||||||
|
STEPPED_BLOCKS = (
|
||||||
|
((800, 759), (1150, 759), (1150, 925), (1020, 925), (1020, 1025), (800, 1025)),
|
||||||
|
((3950, 3820), (4420, 3820), (4420, 4180), (4140, 4180), (4140, 4330), (3950, 4330)),
|
||||||
|
)
|
||||||
Loading…
Reference in a new issue