Reserve search budget for deferred turns

This commit is contained in:
Jan Petykiewicz 2026-11-29 00:24:00 -08:00
commit 9ba1dc048a

View file

@ -26,12 +26,12 @@ def _build_pair_local_context(
) -> AStarContext:
problem = context.problem
live_world = context.cost_evaluator.collision_engine
static_obstacles = tuple(live_world.iter_static_geometries())
static_entries = tuple(live_world.iter_static_entries())
world = RoutingWorld(
clearance=live_world.clearance, safety_zone_radius=live_world.safety_zone_radius, board=live_world.board,
self_clearance=live_world.self_clearance,
)
for obstacle, owner in live_world.iter_static_entries():
for obstacle, owner in static_entries:
world.add_static_obstacle(obstacle, owner=owner)
for net in ordered_nets:
if net.net_id in pair_order:
@ -45,7 +45,7 @@ def _build_pair_local_context(
danger_map = proximity_map(problem, context.options.search.proximity_range)
if context.options.objective.danger_weight:
danger_map.precompute(list(static_obstacles))
danger_map.precompute([obstacle for obstacle, _ in static_entries])
evaluator = CostEvaluator.from_objective(
world,
danger_map,
@ -55,7 +55,10 @@ def _build_pair_local_context(
)
return AStarContext(
evaluator,
replace(problem, nets=ordered_nets, initial_paths={}),
replace(
problem, nets=ordered_nets, initial_paths={},
static_obstacles=tuple(obstacle for obstacle, owner in static_entries if owner is None),
),
context.options,
metrics=AStarMetrics(),
)