feat(spatial): 观测声明自己的盲区(按类别计数,不含身份)

cond.p1 从 0.602 到 1.000 证实了这一点:缺的不是容量,是"我看不到什么"这个输入。
剩下 area.sup2h / dof.c6h 弃权率仍为 0,是同一个病在另两个域——生成器把底座/配合
藏起来了,却不让观测声明。

schema 增加 Observation.hidden:{entity: {kind: 数量}, edge: {kind: 数量}},
由 _observe 从"全状态减可见"自动导出,所以新增遮挡物不可能忘记声明。
只记数量不记身份:"少了一条接触"是能据以行动的事实,"少的是 kPT"是泄题。
scene 特征扩到 17 维:隐藏层指示、未见面的数量、各实体类别缺失数、各边类别缺失数、
是否有任何缺失、场景规模。
This commit is contained in:
liuhuajie committed 2026-12-03 18:33:20 +08:00
1 parent 08153b987d
commit 515bee2f01
4 files changed
+37 -7

No files matched your search

+9
View File
@@ -12,6 +12,7 @@ restricting the full state to what the observation shows.
from __future__ import annotations
import random
from collections import Counter
from dataclasses import replace
from . import checker
@@ -39,12 +40,20 @@ DOMAIN_OF = {f: spec["domain"] for f, spec in FAMILIES.items()}
def _observe(entities, edges, visible_edges, visible_ents, hidden_layers, cameras, units):
vis_e = [e for e in edges if e.eid in visible_edges]
keep = set(visible_ents) | {e.a for e in vis_e} | {e.b for e in vis_e}
# derived, not hand-written: the gap between the full state and this view is
# exactly what an agent has to know in order to decide it cannot decide.
# Computing it here means a new occluder cannot silently go undeclared.
hidden = {
"entity": dict(Counter(e.kind for e in entities if e.eid not in keep)),
"edge": dict(Counter(e.kind for e in edges if e.eid not in visible_edges)),
}
return Observation(
entities=[e for e in entities if e.eid in keep],
edges=vis_e,
cameras=list(cameras),
units=dict(units),
hidden_layers=sorted(hidden_layers),
hidden=hidden,
)