Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2509,11 +2509,11 @@ def visible(_plan, row, col, _theta):
assert (view.row, view.col) == same_side


def test_sweep_information_utility_prefers_efficient_gain_over_long_detour():
def test_sweep_information_utility_lets_extra_coverage_outweigh_a_detour():
nearby = search_module._coverage_travel_utility(40, 2.0, sweeping=True)
distant = search_module._coverage_travel_utility(50, 8.0, sweeping=True)

assert nearby > distant
assert distant > nearby
assert search_module._coverage_travel_utility(50, 0.0, sweeping=True) == 50


Expand Down
14 changes: 6 additions & 8 deletions workspace/innate_skills/find_next_person.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@
MAX_VIEWPOINTS = 240
MIN_NEW_CELLS = 6
INITIAL_TRAVEL_COST_CELLS_PER_M = 12.0
SWEEP_INFORMATION_DECAY_PER_M = 0.35
SWEEP_NOVELTY_BONUS_CELLS_PER_M = 2.0
SWEEP_NOVELTY_BONUS_MAX_M = 2.0
SWEEP_TRAVEL_COST_CELLS_PER_M = 1.0
SWEEP_NOVELTY_BONUS_CELLS_PER_M = 10.0
SWEEP_BACKTRACK_PENALTY_CELLS = 12.0
HANDLED_PERSON_ESTIMATED_DISTANCE_M = 1.5
HANDLED_PERSON_VIEW_PENALTY_CELLS = 220.0
Expand Down Expand Up @@ -395,10 +394,9 @@ def _distance_from_observations(x: float, y: float, observations: list[dict]) ->


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


def _backtrack_penalty(x: float, y: float, observations: list[dict]) -> float:
Expand Down Expand Up @@ -534,7 +532,7 @@ def score_candidates(candidates: list[tuple[int, int]]) -> _View | None:
)
score = (
_coverage_travel_utility(gain, evaluation_distance, sweeping=bool(observations))
+ SWEEP_NOVELTY_BONUS_CELLS_PER_M * min(novelty, SWEEP_NOVELTY_BONUS_MAX_M)
+ SWEEP_NOVELTY_BONUS_CELLS_PER_M * novelty
- _backtrack_penalty(evaluation_x, evaluation_y, observations)
- 0.5 * _angular_distance(theta, pose.theta)
- person_view_penalty
Expand Down
Loading