2
This commit is contained in:
+20
-1
@@ -9,7 +9,8 @@ from mcm26b.belief import CandidateRegion
|
||||
from mcm26b.config import ProblemConfig
|
||||
from mcm26b.geometry.localization import Measurement
|
||||
from mcm26b.geometry.planning import first_bearing_candidate_disk
|
||||
from mcm26b.planner import (bearing_deg, clear_certificate, select_measurement_point,
|
||||
from mcm26b.planner import (_worst_posterior_radius, bearing_deg,
|
||||
clear_certificate, select_measurement_point,
|
||||
select_second_point)
|
||||
from mcm26b.protocol.client import SimulatorClient
|
||||
from mcm26b.sim import LocalSimTransport, LocalSimulator
|
||||
@@ -71,6 +72,24 @@ class SelectionGuaranteeTests(TestCase):
|
||||
self.assertTrue(probe.polygon and probe.contains(g, tol_m=0.05),
|
||||
f"后验剪掉了生成读数的边界点 {g}")
|
||||
|
||||
def test_posterior_scores_near_branch(self):
|
||||
"""后验评分必须包含 near 分支,否则低报最坏后验半径。
|
||||
|
||||
候选集为线段 [-4,4]×{0}、测点为原点时,任意合法读数必为 near
|
||||
(源距原点 <=4 < 5m),后验仍为整段线段(半径 4m);只枚举
|
||||
direction 端点会错误报出 2m。
|
||||
"""
|
||||
region = CandidateRegion([(-4.0, 0.0), (4.0, 0.0)])
|
||||
half = 1.005
|
||||
witnesses = region.witnesses(60.0)
|
||||
self.assertEqual(witnesses, [(-4.0, 0.0), (4.0, 0.0)])
|
||||
worst = _worst_posterior_radius(region, (0.0, 0.0), witnesses, half,
|
||||
CONFIG.field.near_radius_m,
|
||||
CONFIG.search.polygon_sides)
|
||||
self.assertGreaterEqual(worst, 4.0 - 1e-6,
|
||||
"near 分支后验半径应逼近候选集半径 4m")
|
||||
self.assertLessEqual(worst, 4.0 + region.slack_m + 0.1)
|
||||
|
||||
def test_move_cost_recorded_and_reason_explains(self):
|
||||
region = _k1_region()
|
||||
plan = select_measurement_point(region, (500.0, 500.0), CONFIG)
|
||||
|
||||
Reference in New Issue
Block a user