67 lines
4.9 KiB
Markdown
67 lines
4.9 KiB
Markdown
# Tune and troubleshoot a route
|
|
|
|
## Read the result
|
|
|
|
Get the route with `result = run.results_by_net[net_id]`.
|
|
|
|
| `result.outcome` | What to inspect |
|
|
| --- | --- |
|
|
| `completed` | The path reached its target and passed verification. Read its length in `report.total_length` and [save its placement recipe](route-a-layout.md#save-a-placement-recipe). |
|
|
| `colliding` | Reached the target and failed verification. Check `result.report` for collisions, invalid polygons, or a board boundary violation. |
|
|
| `partial` | Read the position and heading of `result.path[-1].end_port`. Check room for the path to continue from that heading. If the next turn fits, compare search limits. |
|
|
| `unroutable` | The path is empty. Check the launch heading and room for the first straight or bend. |
|
|
|
|
Place the result when `result.is_valid` is true.
|
|
|
|
## Why a net stopped short
|
|
|
|
1. **Check the bound in automatic mode.** If `run.automatic.max_routed` is below the requested count, check `capacity_limit` for a bottleneck and `port_conflicts` for ports that are too close.
|
|
2. **Check room for the next turn.** For a [partial result](#read-the-result), start at `result.path[-1].end_port`. Compare the allowed radii and clearance with the room to reach the target heading.
|
|
3. **Try a larger search budget.** If the approach fits, increase `node_limit` in [`SearchOptions`](api-reference.md#searchoptions) and compare the endpoint and verified count. The limit is per search, and a run can search a net more than once.
|
|
|
|

|
|
|
|
Rerun the [best-effort example](../../examples/09_unroutable_best_effort.py) with `node_limit` raised from 3 to 500.
|
|
|
|
## Choose a routing mode
|
|
|
|
Set `TopologyOptions(mode=...)` and pass it as `topology` in `RoutingOptions`.
|
|
|
|
- **`automatic`.** Start here. Inire chooses from constructive planners and search stages and keeps the best verified coverage it finds.
|
|
- **`off`.** Run lattice search directly to measure what search can do without corridor suggestions.
|
|
- **`guide`.** Suggest a passage through free space. Search can leave it to make a turn.
|
|
- **`seed`.** Try to build a valid starting path inside the suggested passage before the detailed search.
|
|
- **`bundle`.** Route supported ordered rectangular bundles with an empty `initial_paths` mapping. Use circular physical bends and configure a usable positive integer radius in both `bend_radii` and `sbend_radii`. Unsupported layouts and invalid schedules raise `ValueError` when routing iterations are enabled.
|
|
|
|
### Mode requirements
|
|
|
|
- Inire requires Shapely 2.1 or newer with GEOS 3.10 or newer. In guide and seed modes, nets that receive no corridor can use ordinary lattice search. Set `node_limit=0` to verify supplied seeds without planning corridors. [Constrained triangulation requirements](https://shapely.readthedocs.io/en/2.1.2/reference/shapely.constrained_delaunay_triangles.html)
|
|
- Seed mode gives complete caller-supplied paths priority when they can be reserved without collisions. Partial paths are hints. Seed mode may replace them with complete paths generated from a corridor before the main search.
|
|
- Use `infer_terminal_headings` with automatic or bundle mode if your ports may change direction and the layout supports bundle planning. Compare fixed and flexible headings in [complex-routing example 1](../../examples/advanced.md#complex-routing-example-1).
|
|
- Automatic starts with smaller budgets and can retry up to your ceiling. It can try lattice search after constructive planning and corridor-guided search leave unresolved nets.
|
|
|
|
[Compare all five modes on one board](../complex-routing-example-1.md#compare-all-routing-modes)
|
|
|
|
## Choose the next setting
|
|
|
|
| Observation | Next comparison |
|
|
| --- | --- |
|
|
| Multiple routes reach their ports and collide with one another | Change `net_order` or `max_iterations` one at a time. Compare which nets remain unresolved. See the accepted values in [`CongestionOptions`](api-reference.md#congestionoptions). |
|
|
| Valid routes use too many turns | Increase `bend_penalty` for 90-degree turns or `sbend_penalty` for S-bends. Compare the number of each type and the resulting path length. See [`ObjectiveWeights`](api-reference.md#objectiveweights). |
|
|
| Refinement dominates runtime | Try `max_windows_per_net=1`. Compare runtime, cost, and verified paths before adopting the smaller limit. See [`RefinementOptions`](api-reference.md#refinementoptions). |
|
|
|
|
For a shorter refinement pass, derive the new settings from the `options` already used for the layout.
|
|
|
|
```python
|
|
from dataclasses import replace
|
|
from inire import route
|
|
|
|
short_pass = replace(
|
|
options.refinement,
|
|
max_windows_per_net=1,
|
|
)
|
|
faster_refinement = replace(
|
|
options, refinement=short_pass,
|
|
)
|
|
run = route(problem, options=faster_refinement)
|
|
```
|