This commit is contained in:
Horldsence
2026-09-12 16:58:25 +08:00
parent 1fa2264a17
commit 892451dca9
36 changed files with 8767 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
"""问题四:含定向干扰源的检测与清除。
- ``optimal.py`` :``DirectionalExtension``(保证覆盖 + 定向观测推理 +
(位置×朝向) 联合信念 + ≤20 m 有限圆盘后备清除);
- ``baseline.py``:把问题三最优策略**直接搬用**的两条基线——
``bayes``(七站全向缺席证明)与 ``grid``(49 点全向覆盖,无后备清除);
- ``compare.py`` :core + boundary 基准集配对对比并落盘。
"""
from . import baseline, optimal
__all__ = ["optimal", "baseline"]
+29
View File
@@ -0,0 +1,29 @@
"""问题四基线实现:把问题三策略原样搬用的两条对照。
- ``bayes``:问题三最优策略直接用于混合源。它用七站环的**全向**缺席证明,
对"定向源朝外发射"场景会错误地把真源判为 ABSENT,属于"快而错"的典型;
- ``grid``:49 点全向网格(对定向源发现是完备的),但缺少定向观测推理与
≤20 m 后备清除,定位停滞时只能停在 DETECTED,属于"稳而不全"。
两条基线都不共享最优实现的联合信念与后备清除逻辑。
"""
from __future__ import annotations
from mcm26b.planner import OmnidirectionalLoop
from mcm26b.planner.bayes_loop import BayesLoop
from project.common import Method
BAYES = Method(key="baseline", name="问题三最优策略直接搬用 (bayes)",
kind="baseline", note="七站全向缺席证明在定向源上失效")
GRID = Method(key="baseline_grid", name="49 点网格全向策略 (grid)",
kind="baseline", note="覆盖完备但无定向推理与后备清除")
def build_bayes(client, config):
"""工厂:问题三 bayes 策略直接搬用。"""
return BayesLoop(client, config)
def build_grid(client, config):
"""工厂:49 点网格全向策略直接搬用。"""
return OmnidirectionalLoop(client, config)
+32
View File
@@ -0,0 +1,32 @@
"""问题四 core+boundary 基准集配对对比:directional(最优) vs 两条搬用基线。"""
from __future__ import annotations
from project.common import (RESULTS_DIR, closed_loop_payload, episodes_markdown,
execute_variants, problem_config, write_json,
write_text)
from project.q4 import baseline, optimal
VARIANTS = (
("optimal", optimal.build_loop),
("baseline_grid", baseline.build_grid),
("baseline", baseline.build_bayes),
)
LABELS = [label for label, _ in VARIANTS]
BASE_LABEL = "baseline"
def run(quick: bool = False) -> dict:
from mcm26b.harness.suites import suite
scenes = suite("core", 4) + suite("boundary", 4)
if quick:
scenes = scenes[:4]
config = problem_config()
rows = execute_variants(scenes, VARIANTS, config)
payload = closed_loop_payload(4, "core+boundary", scenes, VARIANTS, rows,
LABELS, BASE_LABEL, config)
write_json(RESULTS_DIR / "q4.json", payload)
write_text(RESULTS_DIR / "q4.md",
episodes_markdown("问题四:混合源闭环配对对比(core+boundary 基准集)",
rows, LABELS, BASE_LABEL))
return payload
+22
View File
@@ -0,0 +1,22 @@
"""问题四最优实现:``mcm26b.planner.DirectionalExtension``(directional 策略)。
三点相对全向闭环的加装:
1. 发现覆盖改用经全向/定向双口径证伪的 31 点最小命中集
(``q4_mincover_v2``,15 m/72 档验证零缺口);
2. 保证接收盘内 ``no_signal`` 只可能由朝向遮挡解释:记为"观测到定向",
对 MEC 圆心取对跖点复核,并用 (位置×朝向) 联合可行集选可见性探点;
3. 定位停滞时对有界候选集构造 ≤20 m 网格圆盘覆盖,预算核对后逐格 /clear
(清除与朝向无关),是定向源不依赖可见性的完备后备。
"""
from __future__ import annotations
from mcm26b.planner import DirectionalExtension
from project.common import Method
METHOD = Method(key="optimal", name="定向扩展闭环 (directional)",
kind="optimal", note="联合信念 + 后备清除 + 定向覆盖计划")
def build_loop(client, config):
"""工厂:返回定向扩展闭环实例。"""
return DirectionalExtension(client, config)