chore: 初始化 MCM/ICM Toolkit 仓库骨架

审查并精简 ChatGPT 的建库建议后落地的第一版骨架,只定接口不写实现。

- 建议审查:14 个包 → 7 个;约 250 个函数 → 约 40 个;5 个 Result 类 → 1 个
  (docs/01-suggestion-review.md)
- docs/:架构、路线图(含永久不做清单)、环境、Git 工作流、函数卡片模板
- src/mcm_toolkit/:core / data / stats / models / solve / decision / viz
  共 23 个模块,均为签名 + docstring + NotImplementedError
- tests/:9 个文件,其中 test_api_surface.py 已通过(20 passed)
- examples/ problems/ notebooks/ figures/ tables/ 骨架
- pyproject.toml(核心依赖 4 个 + 6 组 extras)、environment.yml
- scripts/:setup-venv.ps1(ASCII + LF)、setup-conda.ps1、doctor.ps1
- 环境:.venv(system-site-packages)与 conda 环境 mcm-toolkit 均已建好,
  数值栈版本与 base 完全对齐(numpy 2.4.6 / scipy 1.18.1 / pandas 3.0.6,MKL 后端)
This commit is contained in:
guzhujushi committed 2026-10-01 17:43:48 +08:00
commit 5319589dfd
76 files changed
+6812

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
"""pytest 公共夹具。"""
from __future__ import annotations
import numpy as np
import pytest
@pytest.fixture
def rng():
"""固定种子的随机数生成器——所有含随机的测试都必须用它,保证可复现。"""
return np.random.default_rng(20260101)
@pytest.fixture
def linear_data(rng):
"""带噪声的线性数据,用于回归类测试(真值 y = 2x + 1)。"""
x = rng.uniform(-5, 5, size=200)
y = 2.0 * x + 1.0 + rng.normal(0, 0.1, size=200)
return x, y
@pytest.fixture
def decision_matrix():
"""3 个方案 × 4 个指标的决策矩阵,用于评价类测试。"""
return np.array(
[
[9.0, 0.3, 120.0, 8.5],
[7.5, 0.5, 90.0, 9.0],
[8.8, 0.2, 150.0, 7.0],
]
)