fix(spatial): 有隐藏内容时改用单调规则给标签
旧规则只比较"全状态"和"观测自己的世界"这两个世界。于是"底座在零件后面,而在这 个具体场景里它本来也帮不上忙"被判成可判 false——这不是 agent 能知道的事实:另一个 同样符合观测的世界把底座挪到形心底下,答案就翻了。 隐藏内容只会增加证据(导通的边只会连上、接触只会支撑、配合只会锁轴),不会推翻 观测里已有的证明。所以:可见结构已经证明 → 可判 true;没证明 → unknown,不管手上 那一个全状态怎么裁。这一条同时把上一轮 area.sup2h 那 36 条假"可判"消掉。
This commit is contained in:
1 parent
c44a191f8b
commit
813be2906b
1 file changed
+44
-15
+44
-15
@@ -254,22 +254,51 @@ def validate_evidence(full: FullState, query: Query, evidence) -> bool:
|
||||
|
||||
def label(obs: Observation, full: FullState, query: Query,
|
||||
alternatives: Iterable[FullState] = ()) -> Label:
|
||||
"""Full state decides; the observation decides whether we may say so."""
|
||||
worlds = [full] + list(alternatives)
|
||||
answers = [evaluate(w.entities, w.edges, query) for w in worlds]
|
||||
if any(a is None for a in answers) or len(set(answers)) != 1:
|
||||
# the observation admits more than one truth: this is the real
|
||||
# "insufficient evidence" case, not an occlusion tag
|
||||
"""Full state decides; the observation decides whether we may say so.
|
||||
|
||||
When something is withheld the rule is *monotone*: a hidden conduct edge can
|
||||
only connect, a hidden contact can only support, a hidden mate can only lock
|
||||
an axis. None of them can undo a proof the observation already contains. So
|
||||
|
||||
* the visible structure already proves the answer -> decidable "true";
|
||||
* it does not -> the withheld item could be exactly the missing piece, and
|
||||
the answer is unknown, however the one full state we happen to hold
|
||||
resolves it.
|
||||
|
||||
The cheaper rule -- compare the full state against the observation's own
|
||||
world -- marks "the pedestal is behind the part and in this particular scene
|
||||
it would not have helped" as decidable false. That is not a fact the agent
|
||||
can know: another equally consistent world puts the pedestal under the
|
||||
centroid and the answer flips. Measured: area.sup2h came out 36 decidable /
|
||||
92 not, and the model swung between answering all of them and abstaining
|
||||
from all of them, because the split is not in the observation.
|
||||
"""
|
||||
ans_full = evaluate(full.entities, full.edges, query)
|
||||
alt = list(alternatives)
|
||||
ans_vis = evaluate(alt[0].entities, alt[0].edges, query) if alt else ans_full
|
||||
withheld = bool(obs.dangling) or bool((obs.hidden or {}).get("entity")) \
|
||||
or bool((obs.hidden or {}).get("edge"))
|
||||
|
||||
if withheld:
|
||||
if ans_vis is True:
|
||||
# the observation proves it on its own; nothing withheld can break it
|
||||
return Label(answer="true", change=_change(full, query, True),
|
||||
evidence=evidence_for(alt[0], query) if alt else [], sufficient=True)
|
||||
return Label(answer="unknown", change="unknown", evidence=[], sufficient=False)
|
||||
|
||||
ans_after = answers[0]
|
||||
if ans_full is None or ans_vis is None or ans_full != ans_vis:
|
||||
return Label(answer="unknown", change="unknown", evidence=[], sufficient=False)
|
||||
|
||||
return Label(answer="true" if ans_full else "false",
|
||||
change=_change(full, query, ans_full),
|
||||
evidence=evidence_for(full, query), sufficient=True)
|
||||
|
||||
|
||||
def _change(full: FullState, query: Query, ans_after) -> str:
|
||||
if query.edit is None:
|
||||
return "same"
|
||||
before = Query(kind=query.kind, a=query.a, b=query.b, edit=None)
|
||||
ans_before = evaluate(full.entities, full.edges, before)
|
||||
if query.edit is None:
|
||||
change = "same"
|
||||
elif ans_before is None:
|
||||
change = "unknown"
|
||||
else:
|
||||
change = "changed" if ans_before != ans_after else "same"
|
||||
return Label(answer="true" if ans_after else "false", change=change,
|
||||
evidence=evidence_for(full, query), sufficient=True)
|
||||
if ans_before is None:
|
||||
return "unknown"
|
||||
return "changed" if ans_before != ans_after else "same"
|
||||
Reference in new issue
Block a user