Select and verify topological and constructive routing plans

This commit is contained in:
Jan Petykiewicz 2026-11-26 11:57:43 -08:00
commit be3222e5ae

View file

@ -159,6 +159,13 @@ def add_node(
parent_p = parent.port
end_p = result.end_port
corridor = config.corridor
if (
corridor is not None
and config.restrict_to_corridor
and any(not corridor.footprint.covers(shape) for shape in result.physical_geometry)
):
return
if cache_key in context.hard_collision_set:
if frontier_trace is not None:
@ -219,6 +226,9 @@ def add_node(
move_cost = max(0.001, move_cost - applied_bonus)
next_seed_index = parent.seed_index + 1
if corridor is not None and config.corridor_strength:
move_cost += result.length * config.corridor_strength * (corridor.distance(parent_p) + corridor.distance(end_p)) / 2
if config.max_cost is not None and parent.g_cost + move_cost > config.max_cost:
if frontier_trace is not None:
frontier_trace.record("cost", move_type, parent.port.as_tuple(), state, result.total_dilated_bounds)
@ -267,6 +277,8 @@ def add_node(
context.metrics.total_congestion_candidate_precheck_skips += 1
else:
context.metrics.total_congestion_presence_skips += 1
if total_overlaps and config.hard_congestion:
return
move_cost += total_overlaps * context.congestion_penalty
g_cost = parent.g_cost + move_cost
@ -277,11 +289,7 @@ def add_node(
metrics.total_pruned_closed_set += 1
return
h_cost = context.cost_evaluator.h_manhattan(
result.end_port,
target,
min_bend_radius=context.min_bend_radius,
)
h_cost = config.estimate_remaining_cost(result.end_port, target, context)
heapq.heappush(
open_set,
AStarNode(