43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
"""问题二最优实现:保证接收盘内的最坏后验半径最小化选点(生产实现)。
|
||
|
||
复用 ``mcm26b.planner.select_measurement_point``:
|
||
|
||
1. 在"保证接收盘" B(mec_center, 1000-ρ) 内环形采样候选点;
|
||
2. 对每个候选,用"目标边界点 × 读数区间端点(+near 分支)"估计
|
||
最坏后验最小包围半径,并以移动时间同分决胜;
|
||
3. 选定后按 1/4 间距加密复核,返回位置、后验半径与理由。
|
||
|
||
采样是启发式(不是连续问题全局最优证明),但保证接收是严格的。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from mcm26b.config import ProblemConfig
|
||
from mcm26b.planner import safe_disk_radius, select_measurement_point
|
||
|
||
from project.common import Method, problem_config
|
||
from project.q2.region import first_bearing_region
|
||
|
||
METHOD = Method(
|
||
key="optimal",
|
||
name="保证接收盘内最小最坏后验半径",
|
||
kind="optimal",
|
||
note="生产实现 mcm26b.planner.select_measurement_point",
|
||
)
|
||
|
||
|
||
def candidate(case: dict, config: ProblemConfig | None = None) -> dict:
|
||
config = config or problem_config()
|
||
region = first_bearing_region(case, config)
|
||
station = (case["station"][0], case["station"][1])
|
||
plan = select_measurement_point(region, station, config)
|
||
return {
|
||
"method": METHOD.key,
|
||
"position": [round(plan.position[0], 4), round(plan.position[1], 4)],
|
||
"worst_posterior_radius_m": plan.worst_posterior_radius_m,
|
||
"move_cost_s": plan.move_cost_s,
|
||
"safe_disk_radius_m": safe_disk_radius(region, config),
|
||
"initial_radius_m": region.mec()[1],
|
||
"reason": plan.reason,
|
||
}
|