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
+11
View File
@@ -0,0 +1,11 @@
"""问题三:全向源搜索—定位—清除闭环。
- ``optimal.py`` :贝叶斯网格粒子滤波 + 信息增益选点 + 滚动 2-opt(``bayes``);
- ``baseline.py``:49 点网格发现 + 就近服务(``grid``,历史基线),
以及七点解析覆盖批量扫频(``seven``,中间对照);
- ``compare.py`` :冻结基准集配对对比并落盘。
"""
from . import baseline, optimal
__all__ = ["optimal", "baseline"]
+28
View File
@@ -0,0 +1,28 @@
"""问题三基线实现:两条不共享贝叶斯决策的对照策略。
- ``OmnidirectionalLoop``(grid):49 点(700 m 步长)网格保证发现,
发现后就近进入定位子循环;策略简单、无信息增益选点、无任务排序优化。
- ``SevenBatch``(seven):七点解析覆盖 + 同站批量扫频 + 最近候选服务队列,
是"覆盖证明 + 批量调度"的中间对照(官方演练 12/12 全清)。
"""
from __future__ import annotations
from mcm26b.planner import OmnidirectionalLoop
from mcm26b.planner.seven import SevenBatch
from project.common import Method
GRID = Method(key="baseline", name="49 点网格 + 就近服务 (grid)",
kind="baseline", note="历史基线,无信息增益与滚动排序")
SEVEN = Method(key="seven", name="七点解析覆盖 + 批量扫频 (seven)",
kind="baseline", note="覆盖证明与批量调度的中间对照")
def build_grid(client, config):
"""工厂:49 点网格基线闭环。"""
return OmnidirectionalLoop(client, config)
def build_seven(client, config):
"""工厂:七点批量扫频中间对照。"""
return SevenBatch(client, config)
+32
View File
@@ -0,0 +1,32 @@
"""问题三冻结基准集配对对比:bayes(最优) vs grid(基线) vs seven(中间)。"""
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.q3 import baseline, optimal
VARIANTS = (
("optimal", optimal.build_loop),
("seven", baseline.build_seven),
("baseline", baseline.build_grid),
)
LABELS = [label for label, _ in VARIANTS]
BASE_LABEL = "baseline"
def run(quick: bool = False) -> dict:
from mcm26b.harness.suites import suite
scenes = suite("core", 3)
if quick:
scenes = scenes[:6]
config = problem_config()
rows = execute_variants(scenes, VARIANTS, config)
payload = closed_loop_payload(3, "core", scenes, VARIANTS, rows,
LABELS, BASE_LABEL, config)
write_json(RESULTS_DIR / "q3.json", payload)
write_text(RESULTS_DIR / "q3.md",
episodes_markdown("问题三:全向闭环配对对比(core 基准集)",
rows, LABELS, BASE_LABEL))
return payload
+19
View File
@@ -0,0 +1,19 @@
"""问题三最优实现:``mcm26b.planner.bayes_loop.BayesLoop``(bayes 策略)。
要点:逐频道网格粒子滤波维护幸存集;以期望信息增益选探点、
滚动时域 2-opt 排序任务;证书(凸证书或 PF 幸存集 MEC)达到 20 m 即清除;
全频道"已清除或证明不存在"后立即 /exit(虚拟时间即成绩口径)。
自建消融相对 SevenBatch 再降约 30%(docs/algo-3-bayes.md)。
"""
from __future__ import annotations
from mcm26b.planner.bayes_loop import BayesLoop
from project.common import Method
METHOD = Method(key="optimal", name="贝叶斯粒子滤波闭环 (bayes)",
kind="optimal", note="生产默认策略,虚拟时间口径")
def build_loop(client, config):
"""工厂:返回生产 bayes 闭环实例。"""
return BayesLoop(client, config)