Skip to content

Commit 40cf55e

Browse files
committed
perf(search): let coverage dominate sweep route cost
1 parent 47ef48c commit 40cf55e

2 files changed

Lines changed: 8 additions & 10 deletions

File tree

ros2_ws/src/brain/brain_client/test/test_household_resident_roster.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2509,11 +2509,11 @@ def visible(_plan, row, col, _theta):
25092509
assert (view.row, view.col) == same_side
25102510

25112511

2512-
def test_sweep_information_utility_prefers_efficient_gain_over_long_detour():
2512+
def test_sweep_information_utility_lets_extra_coverage_outweigh_a_detour():
25132513
nearby = search_module._coverage_travel_utility(40, 2.0, sweeping=True)
25142514
distant = search_module._coverage_travel_utility(50, 8.0, sweeping=True)
25152515

2516-
assert nearby > distant
2516+
assert distant > nearby
25172517
assert search_module._coverage_travel_utility(50, 0.0, sweeping=True) == 50
25182518

25192519

workspace/innate_skills/find_next_person.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@
4444
MAX_VIEWPOINTS = 240
4545
MIN_NEW_CELLS = 6
4646
INITIAL_TRAVEL_COST_CELLS_PER_M = 12.0
47-
SWEEP_INFORMATION_DECAY_PER_M = 0.35
48-
SWEEP_NOVELTY_BONUS_CELLS_PER_M = 2.0
49-
SWEEP_NOVELTY_BONUS_MAX_M = 2.0
47+
SWEEP_TRAVEL_COST_CELLS_PER_M = 1.0
48+
SWEEP_NOVELTY_BONUS_CELLS_PER_M = 10.0
5049
SWEEP_BACKTRACK_PENALTY_CELLS = 12.0
5150
HANDLED_PERSON_ESTIMATED_DISTANCE_M = 1.5
5251
HANDLED_PERSON_VIEW_PENALTY_CELLS = 220.0
@@ -395,10 +394,9 @@ def _distance_from_observations(x: float, y: float, observations: list[dict]) ->
395394

396395

397396
def _coverage_travel_utility(gain: int, route_distance_m: float, *, sweeping: bool) -> float:
398-
"""Score information against actual route cost without rewarding long trips."""
399-
if not sweeping:
400-
return gain - INITIAL_TRAVEL_COST_CELLS_PER_M * route_distance_m
401-
return gain / (1.0 + SWEEP_INFORMATION_DECAY_PER_M * route_distance_m)
397+
"""Keep the first view local, then let coverage gain dominate route length."""
398+
travel_cost = SWEEP_TRAVEL_COST_CELLS_PER_M if sweeping else INITIAL_TRAVEL_COST_CELLS_PER_M
399+
return gain - travel_cost * route_distance_m
402400

403401

404402
def _backtrack_penalty(x: float, y: float, observations: list[dict]) -> float:
@@ -534,7 +532,7 @@ def score_candidates(candidates: list[tuple[int, int]]) -> _View | None:
534532
)
535533
score = (
536534
_coverage_travel_utility(gain, evaluation_distance, sweeping=bool(observations))
537-
+ SWEEP_NOVELTY_BONUS_CELLS_PER_M * min(novelty, SWEEP_NOVELTY_BONUS_MAX_M)
535+
+ SWEEP_NOVELTY_BONUS_CELLS_PER_M * novelty
538536
- _backtrack_penalty(evaluation_x, evaluation_y, observations)
539537
- 0.5 * _angular_distance(theta, pose.theta)
540538
- person_view_penalty

0 commit comments

Comments
 (0)