Preserve route identity through reservation and export

This commit is contained in:
Jan Petykiewicz 2026-11-29 00:12:59 -08:00
commit 286caa273b
23 changed files with 226 additions and 99 deletions

View file

@ -30,6 +30,7 @@ The fields below appear in constructor order. Use one layout unit for coordinate
| `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. | | `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 obstacle intersections at a move's endpoints during search. | | `safety_zone_radius` | `0.0021` | Tolerance for small obstacle 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. | | `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)`. IDs must be unique across fixed and active nets. |
## Path seeds ## Path seeds
@ -41,6 +42,7 @@ The fields below appear in constructor order. Use one layout unit for coordinate
| --- | --- | | --- | --- |
| `RoutingRunResult.results_by_net` | A mapping from net ID to `RoutingResult`. | | `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.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. 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.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. `terminal_error` identifies an inaccessible start or target face. | | `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. `terminal_error` identifies an inaccessible start or target face. |

View file

@ -90,7 +90,7 @@ For a multi-net layout, apply the validity check to every net you intend to expo
## Reuse an existing route ## 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). - **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 replay its seed in the first group of `route_profiles` with search and refinement disabled. Later groups respect it as a distinct net, including at zero clearance. Verify the groups together before [exporting the layer](fabrication.md#check-the-export-grid). - **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. Verify the groups together before [exporting the layer](fabrication.md#check-the-export-grid).
When terminal headings are inferred, store the two selected ports alongside the seed, width, and geometry options. Use those exact ports to replay the route and export the same polygons. When terminal headings are inferred, store the two selected ports alongside the seed, width, and geometry options. Use those exact ports to replay the route and export the same polygons.
@ -128,8 +128,8 @@ Route a straight net, then reserve it while routing another net on the same laye
```python ```python
from dataclasses import replace from dataclasses import replace
from inire import NetSpec, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, route from inire import FixedRoute, NetSpec, Port, RoutingOptions, RoutingProblem, SearchOptions, route
from inire.layout import route_profiles, verify_export_grid from inire.layout import verify_export_grid
bounds = (0, -50, 100, 50) bounds = (0, -50, 100, 50)
options = RoutingOptions(search=SearchOptions(bend_radii=(10,))) options = RoutingOptions(search=SearchOptions(bend_radii=(10,)))
@ -137,16 +137,14 @@ fixed_net = NetSpec("fixed", Port(10, 0, 0), Port(90, 0, 0))
detour_net = NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90)) detour_net = NetSpec("detour", Port(50, -20, 90), Port(50, 20, 90))
problem = RoutingProblem(bounds=bounds, nets=(fixed_net, detour_net), clearance=0) problem = RoutingProblem(bounds=bounds, nets=(fixed_net, detour_net), clearance=0)
fixed = route(replace(problem, nets=(fixed_net,)), options=options).results_by_net["fixed"] fixed = route(replace(problem, nets=(fixed_net,)), options=options).results_by_net["fixed"]
assert fixed.is_valid
replay_options = replace( remaining = replace(problem, nets=(detour_net,), fixed_routes=(FixedRoute.from_result(fixed),))
options, search=replace(options.search, node_limit=0), refinement=RefinementOptions(enabled=False), run = route(remaining, options=options)
) export = verify_export_grid(remaining, run.results_by_net, grid=1.0)
problem = replace(problem, initial_paths={"fixed": fixed.as_seed()})
results = route_profiles(problem, [(("fixed",), replay_options), (("detour",), options)])
export = verify_export_grid(problem, results, grid=1.0)
if not export.is_valid: if not export.is_valid:
raise ValueError(export.reports_by_net) raise ValueError(export.reports_by_net)
``` ```
For imported metal or waveguide polygons, use `FixedRoute("existing_net", imported_polygons)`. Supply fixed polygons in their final layer coordinates. Export checks new routes against them and returns the new polygons.
To compare the two paths on a plot, see the [fixed-route example](../../examples/README.md#route-around-fixed-geometry). To compare the two paths on a plot, see the [fixed-route example](../../examples/README.md#route-around-fixed-geometry).

View file

@ -1,7 +1,7 @@
from dataclasses import replace from dataclasses import replace
from inire import NetSpec, ObjectiveWeights, Port, RefinementOptions, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route from inire import FixedRoute, NetSpec, ObjectiveWeights, Port, RoutingOptions, RoutingProblem, SearchOptions, TopologyOptions, route
from inire.layout import route_profiles, verify_export_grid from inire.layout import verify_export_grid
from inire.utils.visualization import plot_routing_results from inire.utils.visualization import plot_routing_results
@ -24,16 +24,13 @@ def main() -> None:
assert fixed.is_valid assert fixed.is_valid
print("Routing detour net around locked path...") print("Routing detour net around locked path...")
replay = replace( remaining = replace(problem, nets=(detour_net,), fixed_routes=(FixedRoute.from_result(fixed),))
options, search=replace(options.search, node_limit=0), refinement=RefinementOptions(enabled=False), run = route(remaining, options=options)
) export = verify_export_grid(remaining, run.results_by_net, grid=1)
problem = replace(problem, initial_paths={"netA": fixed.as_seed()})
results = route_profiles(problem, [(("netA",), replay), (("netB",), options)])
export = verify_export_grid(problem, results, grid=1)
if not export.is_valid: if not export.is_valid:
raise ValueError(export.reports_by_net) raise ValueError(export.reports_by_net)
fig, _ax = plot_routing_results(results, [], bounds) fig, _ax = plot_routing_results({fixed.net_id: fixed, **run.results_by_net}, [], bounds)
fig.savefig("examples/03_locked_paths.png") fig.savefig("examples/03_locked_paths.png")
print("Saved plot to examples/03_locked_paths.png") print("Saved plot to examples/03_locked_paths.png")

View file

@ -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) ![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. `route_profiles` replays and reserves it, so the new connection passes to the left of the fixed route. The example verifies both routes together on the export grid. 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). The first call routes a straight waveguide. `FixedRoute.from_result()` reserves its exact polygons, so the new connection passes to the left of the fixed route. The example checks the new route on the export grid against the fixed polygons. 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).
<a id="fit-bends-to-available-room"></a> <a id="fit-bends-to-available-room"></a>

View file

@ -2,10 +2,12 @@
inire Wave-router inire Wave-router
""" """
from collections.abc import Callable from collections.abc import Callable
from dataclasses import replace
from .geometry.primitives import Port as Port # noqa: PLC0414 from .geometry.primitives import Port as Port # noqa: PLC0414
from .model import ( from .model import (
CongestionOptions as CongestionOptions, CongestionOptions as CongestionOptions,
FixedRoute as FixedRoute,
DiagnosticsOptions as DiagnosticsOptions, DiagnosticsOptions as DiagnosticsOptions,
NetSpec as NetSpec, NetSpec as NetSpec,
ObjectiveWeights as ObjectiveWeights, ObjectiveWeights as ObjectiveWeights,
@ -58,20 +60,35 @@ def route(
error = resolved_options.search.seed_geometry_error(seed) error = resolved_options.search.seed_geometry_error(seed)
if error is not None: if error is not None:
raise ValueError(f"Initial path for {net_id!r} {error}") 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": if resolved_options.topology.mode == "automatic":
from .router._automatic import route_automatic # noqa: PLC0415 from .router._automatic import route_automatic # noqa: PLC0415
return route_automatic(problem, resolved_options, iteration_callback) run = route_automatic(problem, resolved_options, callback)
else:
from .router._stack import route_explicit # noqa: PLC0415
from .router._stack import route_explicit # noqa: PLC0415 run = route_explicit(problem, options=resolved_options, iteration_callback=callback)
return replace(run, results_by_net=attach_requested(run.results_by_net))
return route_explicit(problem, options=resolved_options, iteration_callback=iteration_callback)
__all__ = [ __all__ = [
"AutomaticRoutingReport", "AutomaticRoutingReport",
"Bend90Seed", "Bend90Seed",
"CapacityLimit", "CapacityLimit",
"CongestionOptions", "CongestionOptions",
"FixedRoute",
"ComponentConflictTrace", "ComponentConflictTrace",
"ConflictTraceEntry", "ConflictTraceEntry",
"DiagnosticsOptions", "DiagnosticsOptions",

View file

@ -103,8 +103,6 @@ class RoutingWorld:
"board", "board",
"grid_cell_size", "grid_cell_size",
"metrics", "metrics",
"_reserved_obstacles",
"_reserved_geometry_ids",
"_dynamic_paths", "_dynamic_paths",
"_static_obstacles", "_static_obstacles",
) )
@ -124,8 +122,6 @@ class RoutingWorld:
self.grid_cell_size = 50.0 self.grid_cell_size = 50.0
self.metrics = None self.metrics = None
self._reserved_obstacles: dict[int, int] = {}
self._reserved_geometry_ids: set[int] = set()
self._static_obstacles = StaticObstacleIndex(self) self._static_obstacles = StaticObstacleIndex(self)
self._dynamic_paths = DynamicPathIndex(self) self._dynamic_paths = DynamicPathIndex(self)
@ -137,9 +133,11 @@ class RoutingWorld:
board=box(*problem.bounds) if board is None else board, board=box(*problem.bounds) if board is None else board,
self_clearance=problem.self_clearance, self_clearance=problem.self_clearance,
) )
reserved_ids = {id(polygon) for polygon in problem._reserved_obstacles}
for obstacle in problem.static_obstacles: for obstacle in problem.static_obstacles:
world.add_static_obstacle(obstacle, reserved=id(obstacle) in reserved_ids) 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 return world
def get_static_version(self) -> int: def get_static_version(self) -> int:
@ -166,17 +164,14 @@ class RoutingWorld:
for obj_id in self._dynamic_paths.index.intersection(query_bounds): for obj_id in self._dynamic_paths.index.intersection(query_bounds):
yield self._dynamic_paths.geometries[obj_id][1].bounds yield self._dynamic_paths.geometries[obj_id][1].bounds
def add_static_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None, *, reserved: bool = False) -> int: def iter_static_entries(self) -> Iterable[tuple[Polygon, str | None]]:
obstacle_id = self._static_obstacles.add_obstacle(polygon, dilated_geometry=dilated_geometry) index = self._static_obstacles
if reserved and not self.clearance: return ((polygon, index.owners.get(key)) for key, polygon in index.geometries.items())
self._reserved_obstacles[obstacle_id] = id(polygon)
self._reserved_geometry_ids.add(id(polygon)) def add_static_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None, *, owner: str | None = None) -> int:
return obstacle_id return self._static_obstacles.add_obstacle(polygon, dilated_geometry, owner=owner)
def remove_static_obstacle(self, obj_id: int) -> None: def remove_static_obstacle(self, obj_id: int) -> None:
polygon_id = self._reserved_obstacles.pop(obj_id, None)
if polygon_id is not None and polygon_id not in self._reserved_obstacles.values():
self._reserved_geometry_ids.discard(polygon_id)
self._static_obstacles.remove_obstacle(obj_id) self._static_obstacles.remove_obstacle(obj_id)
def _ensure_static_tree(self) -> None: def _ensure_static_tree(self) -> None:
@ -212,7 +207,7 @@ class RoutingWorld:
face = LineString(((port.x - dx, port.y - dy), (port.x + dx, port.y + dy))) face = LineString(((port.x - dx, port.y - dy), (port.x + dx, port.y + dy)))
for index in candidates: for index in candidates:
keepout = tree.geometries[index] keepout = tree.geometries[index]
if (clearance or id(keepout) in self._reserved_geometry_ids) and _violates_net_clearance(face, keepout, clearance): if (clearance or self._static_obstacles.raw_owners[index] is not None) and _violates_net_clearance(face, keepout, clearance):
return "face violates keepout clearance" return "face violates keepout clearance"
if not clearance and not face.relate_pattern(keepout, "F**F*****"): if not clearance and not face.relate_pattern(keepout, "F**F*****"):
return "face enters a keepout" return "face enters a keepout"
@ -313,7 +308,7 @@ class RoutingWorld:
clearance = self.clearance clearance = self.clearance
left, bottom, right, top = result.total_bounds left, bottom, right, top = result.total_bounds
reserved = self._reserved_geometry_ids reserved = not self.clearance and self._static_obstacles.owners
if reserved: if reserved:
x0, y0, x1, y1 = result.total_physical_bounds x0, y0, x1, y1 = result.total_physical_bounds
left, bottom, right, top = min(left, x0), min(bottom, y0), max(right, x1), max(top, y1) left, bottom, right, top = min(left, x0), min(bottom, y0), max(right, x1), max(top, y1)
@ -322,7 +317,7 @@ class RoutingWorld:
obstacles = tree.geometries obstacles = tree.geometries
for hit_idx in hits: for hit_idx in hits:
obstacle = obstacles[hit_idx] obstacle = obstacles[hit_idx]
if reserved and id(obstacle) in reserved: if reserved and self._static_obstacles.raw_owners[hit_idx] is not None:
if any(polygon.intersects(obstacle) for polygon in result.physical_geometry): if any(polygon.intersects(obstacle) for polygon in result.physical_geometry):
return True return True
continue continue
@ -735,7 +730,6 @@ class RoutingWorld:
self._ensure_static_raw_tree() self._ensure_static_raw_tree()
if static_obstacles.raw_tree is not None: if static_obstacles.raw_tree is not None:
raw_geometries = static_obstacles.raw_tree.geometries raw_geometries = static_obstacles.raw_tree.geometries
reserved = self._reserved_geometry_ids
for component in components: for component in components:
for polygon in component.physical_geometry: for polygon in component.physical_geometry:
if self.metrics is not None: if self.metrics is not None:
@ -747,7 +741,8 @@ class RoutingWorld:
# A mitre may extend past the physical clearance # A mitre may extend past the physical clearance
# radius at a component corner. Check the distance # radius at a component corner. Check the distance
# before counting an overlap with that broad phase. # before counting an overlap with that broad phase.
if (reserved and id(obstacle) in reserved) or _violates_clearance(polygon, obstacle, self.clearance): violates = _violates_net_clearance if static_obstacles.raw_owners[hit_idx] is not None else _violates_clearance
if violates(polygon, obstacle, self.clearance):
static_collision_count += 1 static_collision_count += 1
report = RoutingReport( report = RoutingReport(

View file

@ -27,6 +27,8 @@ class StaticObstacleIndex:
"bounds_array", "bounds_array",
"is_rect_array", "is_rect_array",
"raw_tree", "raw_tree",
"raw_owners",
"owners",
"net_specific_trees", "net_specific_trees",
"ray_cast_cache", "ray_cast_cache",
"id_counter", "id_counter",
@ -44,12 +46,14 @@ class StaticObstacleIndex:
self.bounds_array: numpy.ndarray | None = None self.bounds_array: numpy.ndarray | None = None
self.is_rect_array: numpy.ndarray | None = None self.is_rect_array: numpy.ndarray | None = None
self.raw_tree: STRtree | 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], tuple[STRtree, numpy.ndarray, numpy.ndarray]] = {}
self.ray_cast_cache: dict[tuple[float, float, float, float, float | None, float, type, type, type, type], float] = {} self.ray_cast_cache: dict[tuple[float, float, float, float, float | None, float, type, type, type, type], float] = {}
self.id_counter = 0 self.id_counter = 0
self.version = 0 self.version = 0
def add_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None) -> int: def add_obstacle(self, polygon: Polygon, dilated_geometry: Polygon | None = None, *, owner: str | None = None) -> int:
obj_id = self.id_counter obj_id = self.id_counter
self.id_counter += 1 self.id_counter += 1
@ -59,6 +63,8 @@ class StaticObstacleIndex:
dilated = polygon.buffer(self.engine.clearance / 2.0, join_style="mitre") dilated = polygon.buffer(self.engine.clearance / 2.0, join_style="mitre")
self.geometries[obj_id] = polygon self.geometries[obj_id] = polygon
if owner is not None:
self.owners[obj_id] = owner
self.dilated[obj_id] = dilated self.dilated[obj_id] = dilated
self.is_rect[obj_id] = is_axis_aligned_rect(dilated) self.is_rect[obj_id] = is_axis_aligned_rect(dilated)
self.index.insert(obj_id, dilated.bounds) self.index.insert(obj_id, dilated.bounds)
@ -72,6 +78,7 @@ class StaticObstacleIndex:
bounds = self.dilated[obj_id].bounds bounds = self.dilated[obj_id].bounds
self.index.delete(obj_id, bounds) self.index.delete(obj_id, bounds)
del self.geometries[obj_id] del self.geometries[obj_id]
self.owners.pop(obj_id, None)
del self.dilated[obj_id] del self.dilated[obj_id]
del self.is_rect[obj_id] del self.is_rect[obj_id]
self.invalidate_caches() self.invalidate_caches()
@ -82,6 +89,7 @@ class StaticObstacleIndex:
self.is_rect_array = None self.is_rect_array = None
self.obj_ids = [] self.obj_ids = []
self.raw_tree = None self.raw_tree = None
self.raw_owners = ()
self.net_specific_trees.clear() self.net_specific_trees.clear()
self.ray_cast_cache.clear() self.ray_cast_cache.clear()
self.version += 1 self.version += 1
@ -125,3 +133,4 @@ class StaticObstacleIndex:
if self.engine.metrics is not None: if self.engine.metrics is not None:
self.engine.metrics.total_static_raw_tree_rebuilds += 1 self.engine.metrics.total_static_raw_tree_rebuilds += 1
self.raw_tree = STRtree(list(self.geometries.values())) self.raw_tree = STRtree(list(self.geometries.values()))
self.raw_owners = tuple(self.owners.get(key) for key in self.geometries)

View file

@ -3,7 +3,7 @@
from __future__ import annotations from __future__ import annotations
from dataclasses import dataclass, replace from dataclasses import dataclass, replace
from math import fsum, isfinite from math import fsum, isclose, isfinite
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from shapely import set_precision, union_all from shapely import set_precision, union_all
@ -13,7 +13,7 @@ from inire import route
from inire.constants import TOLERANCE_LINEAR from inire.constants import TOLERANCE_LINEAR
from inire.geometry.collision import RoutingWorld from inire.geometry.collision import RoutingWorld
from inire.geometry.primitives import rotate_cardinal from inire.geometry.primitives import rotate_cardinal
from inire.model import NetSpec from inire.model import FixedRoute, NetSpec
if TYPE_CHECKING: if TYPE_CHECKING:
from collections.abc import Iterable, Mapping from collections.abc import Iterable, Mapping
@ -69,11 +69,7 @@ def verify_export_grid(
raise ValueError(f"Export result {net_id!r} has no matching routing net") raise ValueError(f"Export result {net_id!r} has no matching routing net")
if not result.is_valid: if not result.is_valid:
raise ValueError(f"Export result {net_id!r} must already be verified") raise ValueError(f"Export result {net_id!r} must already be verified")
if ( _check_export_net(net, result)
result.path[0].start_port.as_tuple()[:2] != net.start.as_tuple()[:2]
or result.path[-1].end_port.as_tuple()[:2] != net.target.as_tuple()[:2]
):
raise ValueError(f"Export result {net_id!r} has different terminal positions")
paths[net_id] = tuple(_round_component(component, grid) for component in result.path) paths[net_id] = tuple(_round_component(component, grid) for component in result.path)
world = RoutingWorld.from_problem(problem) world = RoutingWorld.from_problem(problem)
@ -90,6 +86,29 @@ def verify_export_grid(
) )
def _check_export_net(net: NetSpec, result: RoutingResult) -> None:
effective = result.effective_net or net
candidates = (effective, result.requested_net) if result.effective_net is not None else (net,)
ports = (net.start, net.target)
if not any(
spec is not None and spec.net_id == net.net_id and (spec.start, spec.target) == ports
for spec in candidates
) or (result.path[0].start_port, result.path[-1].end_port) != (effective.start, effective.target):
raise ValueError(f"Export result {net.net_id!r} has different terminal ports")
if not isclose(effective.width, net.width, rel_tol=1e-12):
raise ValueError(f"Export result {net.net_id!r} has a different width")
for component in result.path:
if component.width is None:
matches = all(
face is not None and max(abs(face[0] + net.width / 2), abs(face[1] - net.width / 2)) <= TOLERANCE_LINEAR
for face in component.port_faces
)
else:
matches = isclose(component.width, net.width, rel_tol=1e-12)
if not matches:
raise ValueError(f"Export result {net.net_id!r} has a different width")
def _round_component(component: ComponentResult, grid: float) -> ComponentResult: def _round_component(component: ComponentResult, grid: float) -> ComponentResult:
# Keep the snapped vertices while allowing verification at sub-grid clearances. # Keep the snapped vertices while allowing verification at sub-grid clearances.
rounded = tuple( rounded = tuple(
@ -180,16 +199,15 @@ def route_profiles(
raise ValueError(f"Initial paths provided for unknown nets: {', '.join(sorted(unknown))}") raise ValueError(f"Initial paths provided for unknown nets: {', '.join(sorted(unknown))}")
results: dict[str, RoutingResult] = {} results: dict[str, RoutingResult] = {}
reservations: list[Polygon] = [] reservations: list[FixedRoute] = []
for net_ids, options in groups: for net_ids, options in groups:
grouped = replace( grouped = replace(
problem, problem,
nets=tuple(net_by_id[net_id] for net_id in net_ids), 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}, initial_paths={net_id: problem.initial_paths[net_id] for net_id in net_ids if net_id in problem.initial_paths},
static_obstacles=problem.static_obstacles + tuple(reservations), fixed_routes=problem.fixed_routes + tuple(reservations),
_reserved_obstacles=problem._reserved_obstacles + tuple(reservations),
) )
current = route(grouped, options=options).results_by_net current = route(grouped, options=options).results_by_net
results.update(current) results.update(current)
reservations.extend(polygon for result in current.values() if result.is_valid for polygon in result.locked_geometry) 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} return {net_id: results[net_id] for net_id in net_by_id}

View file

@ -17,6 +17,7 @@ if TYPE_CHECKING:
from collections.abc import Iterable, Iterator from collections.abc import Iterable, Iterator
from inire.geometry.components import BendCollisionModel, BendPhysicalGeometry from inire.geometry.components import BendCollisionModel, BendPhysicalGeometry
from inire.results import RoutingResult
NetOrder = Literal["user", "shortest", "longest"] NetOrder = Literal["user", "shortest", "longest"]
@ -290,6 +291,28 @@ class RoutingOptions:
topology: TopologyOptions = field(default_factory=TopologyOptions) 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", 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) @dataclass(frozen=True, slots=True)
class RoutingProblem: class RoutingProblem:
bounds: tuple[float, float, float, float] bounds: tuple[float, float, float, float]
@ -299,7 +322,11 @@ class RoutingProblem:
clearance: float = 2.0 clearance: float = 2.0
safety_zone_radius: float = 0.0021 safety_zone_radius: float = 0.0021
self_clearance: float = 0.0 self_clearance: float = 0.0
_reserved_obstacles: tuple[Polygon, ...] = field(default=(), repr=False) 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: def __post_init__(self) -> None:
bounds = tuple(self.bounds) bounds = tuple(self.bounds)
@ -316,6 +343,14 @@ class RoutingProblem:
raise ValueError(f"Duplicate net ID: {net.net_id!r}") raise ValueError(f"Duplicate net ID: {net.net_id!r}")
seen.add(net.net_id) seen.add(net.net_id)
object.__setattr__(self, "nets", nets) 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) obstacles = tuple(self.static_obstacles)
for index, obstacle in enumerate(obstacles): for index, obstacle in enumerate(obstacles):
if not isinstance(obstacle, Polygon): if not isinstance(obstacle, Polygon):

View file

@ -11,6 +11,7 @@ if TYPE_CHECKING:
from shapely.geometry import Polygon from shapely.geometry import Polygon
from inire.geometry.components import ComponentResult from inire.geometry.components import ComponentResult
from inire.model import NetSpec
RoutingOutcome = Literal["completed", "colliding", "partial", "unroutable"] RoutingOutcome = Literal["completed", "colliding", "partial", "unroutable"]
@ -261,6 +262,8 @@ class RoutingResult:
path: tuple[ComponentResult, ...] path: tuple[ComponentResult, ...]
reached_target: bool = False reached_target: bool = False
report: RoutingReport = field(default_factory=RoutingReport) 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: def __post_init__(self) -> None:
object.__setattr__(self, "path", tuple(self.path)) object.__setattr__(self, "path", tuple(self.path))

View file

@ -580,7 +580,7 @@ class _AutomaticRun:
with self._time("plan", planner="corridor-seed", mode="seed", policy=policy): with self._time("plan", planner="corridor-seed", mode="seed", policy=policy):
corridors = plan_corridors( corridors = plan_corridors(
residual.bounds, residual.bounds,
residual.static_obstacles, residual._blocking_polygons,
nets, nets,
clearance=residual.clearance, clearance=residual.clearance,
bend_radius=min(options.search.bend_radii, default=0.0), bend_radius=min(options.search.bend_radii, default=0.0),

View file

@ -45,7 +45,7 @@ class _Shift:
def _identify_layout(problem: RoutingProblem, margin: float) -> _Layout: def _identify_layout(problem: RoutingProblem, margin: float) -> _Layout:
columns: dict[tuple[float, float], list[Bounds]] = defaultdict(list) columns: dict[tuple[float, float], list[Bounds]] = defaultdict(list)
for obstacle in problem.static_obstacles: for obstacle in problem._blocking_polygons:
if not obstacle.equals(box(*obstacle.bounds)): if not obstacle.equals(box(*obstacle.bounds)):
raise ValueError("Bundle routing requires axis-aligned rectangular obstacles") raise ValueError("Bundle routing requires axis-aligned rectangular obstacles")
x0, y0, x1, y1 = obstacle.bounds x0, y0, x1, y1 = obstacle.bounds

View file

@ -19,8 +19,8 @@ if TYPE_CHECKING:
def _rectangular_obstacle_bounds(problem: RoutingProblem) -> tuple[tuple[float, float, float, float], ...] | None: def _rectangular_obstacle_bounds(problem: RoutingProblem) -> tuple[tuple[float, float, float, float], ...] | None:
bounds = tuple(tuple(shape.bounds) for shape in problem.static_obstacles) 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.static_obstacles, bounds, strict=True)): if any(shape.is_empty or not shape.equals(box(*extent)) for shape, extent in zip(problem._blocking_polygons, bounds, strict=True)):
return None return None
return bounds return bounds

View file

@ -68,7 +68,7 @@ def _columns(problem: RoutingProblem, start: int, finish: int) -> tuple[_Column,
# A bounding rectangle only reserves extra space in this candidate # A bounding rectangle only reserves extra space in this candidate
# planner. Capacity proofs still require the actual rectangular obstacles. # planner. Capacity proofs still require the actual rectangular obstacles.
extents: dict[Window, list[Gap]] = defaultdict(list) extents: dict[Window, list[Gap]] = defaultdict(list)
for obstacle in problem.static_obstacles: for obstacle in problem._blocking_polygons:
if obstacle.is_empty: if obstacle.is_empty:
continue continue
left, bottom, right, top = obstacle.bounds left, bottom, right, top = obstacle.bounds

View file

@ -47,7 +47,7 @@ def _shift_positions(
available: int, available: int,
) -> list[int]: ) -> list[int]:
positions = {i * available // 8 for i in range(9)} positions = {i * available // 8 for i in range(9)}
for obstacle in problem.static_obstacles: for obstacle in problem._blocking_polygons:
if obstacle.is_empty: if obstacle.is_empty:
continue continue
low, high = sorted(sign * (y - origin) - radius for y in (obstacle.bounds[1], obstacle.bounds[3])) low, high = sorted(sign * (y - origin) - radius for y in (obstacle.bounds[1], obstacle.bounds[3]))

View file

@ -2,10 +2,10 @@
from __future__ import annotations from __future__ import annotations
from dataclasses import replace
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from inire.geometry.collision import RoutingWorld from inire.geometry.collision import RoutingWorld
from inire.model import RoutingProblem
from inire.results import RoutingResult from inire.results import RoutingResult
from inire.router._astar_types import AStarContext, AStarMetrics, SearchRunConfig from inire.router._astar_types import AStarContext, AStarMetrics, SearchRunConfig
from inire.router._congestion_policy import can_reserve from inire.router._congestion_policy import can_reserve
@ -31,9 +31,8 @@ def _build_pair_local_context(
clearance=live_world.clearance, safety_zone_radius=live_world.safety_zone_radius, board=live_world.board, clearance=live_world.clearance, safety_zone_radius=live_world.safety_zone_radius, board=live_world.board,
self_clearance=live_world.self_clearance, self_clearance=live_world.self_clearance,
) )
reserved_ids = {id(polygon) for polygon in problem._reserved_obstacles} for obstacle, owner in live_world.iter_static_entries():
for obstacle in static_obstacles: world.add_static_obstacle(obstacle, owner=owner)
world.add_static_obstacle(obstacle, reserved=id(obstacle) in reserved_ids)
for net in ordered_nets: for net in ordered_nets:
if net.net_id in pair_order: if net.net_id in pair_order:
continue continue
@ -42,7 +41,7 @@ def _build_pair_local_context(
continue continue
for component in result.path: for component in result.path:
for polygon in component.physical_geometry: for polygon in component.physical_geometry:
world.add_static_obstacle(polygon, reserved=True) world.add_static_obstacle(polygon, owner=net.net_id)
danger_map = proximity_map(problem, context.options.search.proximity_range) danger_map = proximity_map(problem, context.options.search.proximity_range)
if context.options.objective.danger_weight: if context.options.objective.danger_weight:
@ -56,13 +55,7 @@ def _build_pair_local_context(
) )
return AStarContext( return AStarContext(
evaluator, evaluator,
RoutingProblem( replace(problem, nets=ordered_nets, initial_paths={}),
bounds=problem.bounds,
nets=ordered_nets,
static_obstacles=static_obstacles,
clearance=problem.clearance,
safety_zone_radius=problem.safety_zone_radius,
),
context.options, context.options,
metrics=AStarMetrics(), metrics=AStarMetrics(),
) )
@ -114,7 +107,7 @@ def search_pair_candidate(
replacements[net_id] = RoutingResult(net_id, tuple(path), reached_target=True, report=report) replacements[net_id] = RoutingResult(net_id, tuple(path), reached_target=True, report=report)
for component in path: for component in path:
for polygon in component.physical_geometry: for polygon in component.physical_geometry:
world.add_static_obstacle(polygon, reserved=True) world.add_static_obstacle(polygon, owner=net_id)
local.clear_static_caches() local.clear_static_caches()
return replacements, local.metrics.total_nodes_expanded return replacements, local.metrics.total_nodes_expanded

View file

@ -48,7 +48,7 @@ def residual_dogleg_candidates(problem: RoutingProblem, search: SearchOptions) -
pad = problem.clearance + half_width pad = problem.clearance + half_width
_, floor_y, _, ceiling_y = extent(problem.bounds) _, floor_y, _, ceiling_y = extent(problem.bounds)
obstacles = [] obstacles = []
for shape in problem.static_obstacles: for shape in problem._blocking_polygons:
if shape.is_empty: if shape.is_empty:
continue continue
a, b, c, d = extent(shape.bounds) a, b, c, d = extent(shape.bounds)
@ -237,7 +237,7 @@ def perimeter_detour_candidates(problem: RoutingProblem, search: SearchOptions)
bend = min(search.bend_radii, default=0.0) 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): if problem.initial_paths or physical_geometry != "arc" or not isfinite(bend) or bend <= 0 or bend != int(bend):
return return
obstacles = tuple(shape.bounds for shape in problem.static_obstacles if not shape.is_empty) obstacles = tuple(shape.bounds for shape in problem._blocking_polygons if not shape.is_empty)
radius = int(bend) radius = int(bend)
for net in problem.nets: for net in problem.nets:
if net.start.r != 0 or net.target.r != 0: if net.start.r != 0 or net.target.r != 0:

View file

@ -159,14 +159,14 @@ class PathFinder:
self.context.cost_evaluator.collision_engine.install_path(net_id, path) self.context.cost_evaluator.collision_engine.install_path(net_id, path)
@contextmanager @contextmanager
def _temporary_path_reservations(self) -> Iterator[Callable[[Sequence[ComponentResult]], None]]: def _temporary_path_reservations(self) -> Iterator[Callable[[str, Sequence[ComponentResult]], None]]:
world = self.context.cost_evaluator.collision_engine world = self.context.cost_evaluator.collision_engine
temporary: list[int] = [] temporary: list[int] = []
def reserve(path: Sequence[ComponentResult]) -> None: def reserve(net_id: str, path: Sequence[ComponentResult]) -> None:
for component in path: for component in path:
for shape in component.physical_geometry: for shape in component.physical_geometry:
temporary.append(world.add_static_obstacle(shape, reserved=True)) temporary.append(world.add_static_obstacle(shape, owner=net_id))
try: try:
yield reserve yield reserve
@ -187,7 +187,7 @@ class PathFinder:
with self._temporary_path_reservations() as reserve: with self._temporary_path_reservations() as reserve:
for net_id, path in existing.items(): 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: if path[-1].end_port == state.net_specs[net_id].target and world.verify_path_report(net_id, path).is_valid:
reserve(path) reserve(net_id, path)
if existing: if existing:
self.context.clear_static_caches() self.context.clear_static_caches()
for net_id in state.ordered_net_ids: for net_id in state.ordered_net_ids:
@ -226,7 +226,7 @@ class PathFinder:
continue 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(path) reserve(net_id, path)
self.context.clear_static_caches() self.context.clear_static_caches()
return greedy_paths return greedy_paths
@ -240,7 +240,7 @@ class PathFinder:
with self._temporary_path_reservations() as reserve: with self._temporary_path_reservations() as reserve:
for net_id, path in existing.items(): 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: if path and path[-1].end_port == state.net_specs[net_id].target and world.verify_path_report(net_id, path).is_valid:
reserve(path) reserve(net_id, path)
preserved.add(net_id) preserved.add(net_id)
for net_id in state.ordered_net_ids: for net_id in state.ordered_net_ids:
if expired(): if expired():
@ -271,7 +271,7 @@ class PathFinder:
if path and path[-1].end_port == net.target and world.verify_path_report(net_id, path).is_valid: if path and path[-1].end_port == net.target and world.verify_path_report(net_id, path).is_valid:
seeds[net_id] = tuple(path) seeds[net_id] = tuple(path)
self.metrics.total_warm_start_paths_built += 1 self.metrics.total_warm_start_paths_built += 1
reserve(path) reserve(net_id, path)
break break
return seeds return seeds
@ -1147,7 +1147,7 @@ class PathFinder:
evaluator = self.context.cost_evaluator evaluator = self.context.cost_evaluator
weights = options.refinement.objective or options.objective weights = options.refinement.objective or options.objective
if evaluator.danger_map is not None and weights.danger_weight: if evaluator.danger_map is not None and weights.danger_weight:
evaluator.danger_map.precompute(self.context.problem.static_obstacles) evaluator.danger_map.precompute(self.context.problem._blocking_polygons)
proximity_ready = True proximity_ready = True
net = state.net_specs[net_id] net = state.net_specs[net_id]
self.metrics.total_refine_path_calls += 1 self.metrics.total_refine_path_calls += 1

View file

@ -12,7 +12,7 @@ from inire.constants import TOLERANCE_LINEAR
from inire.geometry.collision import RoutingWorld from inire.geometry.collision import RoutingWorld
from inire.geometry.components import Straight from inire.geometry.components import Straight
from inire.geometry.primitives import port_local_coordinates from inire.geometry.primitives import port_local_coordinates
from inire.model import resolve_bend_geometry from inire.model import FixedRoute, resolve_bend_geometry
from inire.results import RoutingResult, RoutingStage from inire.results import RoutingResult, RoutingStage
from inire.router._congestion_policy import ordered_nets from inire.router._congestion_policy import ordered_nets
from inire.router._seed_materialization import materialize_path_seed from inire.router._seed_materialization import materialize_path_seed
@ -96,7 +96,7 @@ def _direct_paths(
if path and path[-1].end_port == net.target: if path and path[-1].end_port == net.target:
report = world.verify_path_report(net.net_id, path) report = world.verify_path_report(net.net_id, path)
if report.is_valid: if report.is_valid:
paths[net.net_id] = RoutingResult(net.net_id, path, reached_target=True, report=report) paths[net.net_id] = RoutingResult(net.net_id, path, reached_target=True, report=report, effective_net=net)
world.install_path(net.net_id, path) world.install_path(net.net_id, path)
for net in ordered: for net in ordered:
if net.net_id in problem.initial_paths: if net.net_id in problem.initial_paths:
@ -107,7 +107,7 @@ def _direct_paths(
component = Straight.generate(net.start, forward, net.width, dilation=problem.clearance / 2) component = Straight.generate(net.start, forward, net.width, dilation=problem.clearance / 2)
report = world.verify_path_report(net.net_id, (component,)) report = world.verify_path_report(net.net_id, (component,))
if report.is_valid: if report.is_valid:
paths[net.net_id] = RoutingResult(net.net_id, (component,), reached_target=True, report=report) paths[net.net_id] = RoutingResult(net.net_id, (component,), reached_target=True, report=report, effective_net=net)
world.install_path(net.net_id, (component,)) world.install_path(net.net_id, (component,))
return paths return paths
@ -125,7 +125,7 @@ def _disconnected_nets(
residual = [net for net in problem.nets if net.net_id not in direct] residual = [net for net in problem.nets if net.net_id not in direct]
if not residual: if not residual:
return frozenset() return frozenset()
obstacles = problem.static_obstacles + tuple(shape for result in direct.values() for shape in result.locked_geometry) obstacles = problem._blocking_polygons + tuple(shape for result in direct.values() for shape in result.locked_geometry)
by_width: dict[float, list[NetSpec]] = {} by_width: dict[float, list[NetSpec]] = {}
for net in residual: for net in residual:
by_width.setdefault(net.width, []).append(net) by_width.setdefault(net.width, []).append(net)
@ -200,11 +200,10 @@ def _residual_problem(problem: RoutingProblem, locks: LockPlan) -> RoutingProble
if not locks.direct and not locks.disconnected: if not locks.direct and not locks.disconnected:
return problem 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) 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(shape for result in locks.direct.values() for shape in result.locked_geometry) 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} 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( return replace(
problem, nets=residual, static_obstacles=problem.static_obstacles + locked, initial_paths=initial_paths, problem, nets=residual, initial_paths=initial_paths, fixed_routes=problem.fixed_routes + locked,
_reserved_obstacles=problem._reserved_obstacles + locked,
) )

View file

@ -42,7 +42,7 @@ def build_routing_stack(problem: RoutingProblem, options: RoutingOptions) -> Rou
if options.search.node_limit > 0 and options.congestion.max_iterations > 0 and ( if options.search.node_limit > 0 and options.congestion.max_iterations > 0 and (
options.objective.danger_weight or (refinement.enabled and refinement.objective is not None and refinement.objective.danger_weight) options.objective.danger_weight or (refinement.enabled and refinement.objective is not None and refinement.objective.danger_weight)
): ):
danger_map.precompute(problem.static_obstacles) danger_map.precompute(problem._blocking_polygons)
evaluator = CostEvaluator.from_objective( evaluator = CostEvaluator.from_objective(
world, world,
@ -76,7 +76,18 @@ def route_once(
started_at = time.monotonic() started_at = time.monotonic()
finder = build_routing_stack(problem, options).finder finder = build_routing_stack(problem, options).finder
results = finder.route_all(iteration_callback=iteration_callback, phase_timer=phase_timer, corridors=corridors, started_at=started_at) 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)
results = attach_effective(results)
if options.topology.mode == "bundle": if options.topology.mode == "bundle":
for result in results.values(): for result in results.values():
if not result.is_valid: if not result.is_valid:

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