feat+test: 换向率 reverse_rate 进闭环指标(按轴方向翻转/活动步,站住不重置),带正对照单测

This commit is contained in:
cbb
2026-10-20 22:26:34 +08:00
parent 078f7cd451
commit 3e015b7485
4 changed files with 20 additions and 1 deletions
+3
View File
@@ -820,6 +820,9 @@ class TravelPenaltySelectTest(unittest.TestCase):
self.assertAlmostEqual(p0['traj'][0, 1, 0].item(), 0.9 * 1.2, places=5)
p1 = self.run1(1.0) # 加惩罚:行程 10.8 vs 3.6 ⇒ 选匀速那条
self.assertAlmostEqual(p1['traj'][0, 1, 0].item(), 0.225 * 1.2, places=5)
# 换向率指标要有灵敏度:抖动轨迹必须报出高换向,匀速轨迹必须接近 0(正对照,不然等于没测)
self.assertGreater(float(p0['reverse_rate'][0]), 0.4)
self.assertLess(float(p1['reverse_rate'][0]), 1e-6)
def test_waste_penalty_also_separates_them(self):
"""换成"白费比例"(1 − 同轴净位移/累计行程)也必须能分开,且罚度按当前误差缩放: