Sample proximity only for objectives that use it

This commit is contained in:
Jan Petykiewicz 2026-11-27 00:48:37 -08:00
commit 15c2714f1f

View file

@ -45,7 +45,11 @@ def build_routing_stack(problem: RoutingProblem, options: RoutingOptions) -> Rou
world.add_static_obstacle(obstacle)
danger_map = DangerMap(bounds=problem.bounds)
danger_map.precompute(list(problem.static_obstacles))
refinement = options.refinement
if options.objective.danger_weight or (
refinement.enabled and refinement.objective is not None and refinement.objective.danger_weight
):
danger_map.precompute(list(problem.static_obstacles))
evaluator = CostEvaluator.from_objective(
world,