Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
本 PR 为
pyqpanda-algorithm新增pyqpanda_alg.BFDCQO,提供模块化 BF-DCQO 算法族、QUBO/原生 HUBO 问题表示、组合优化应用、PyQPanda3 CPUQVM 后端和可复现的小规模验证。PR 以中文文档为主,并保留 NumPy 参考后端用于逐基态与概率分布交叉检查。主要改动
BFDCQOConfig/BFDCQOSolverAPI,以及 Basic、CVaR、自适应 shot、Adaptive-CVaR、Hybrid 变体。IsingProblem、PolynomialIsingProblem,支持二次 Ising/QUBO 与一般阶对角 Pauli-Z/HUBO。pyqpanda_alg.QAOA的 CPUQVM shot execution;适配器记录实际 optimizer/circuit 调用和观测 shots。API 示例
CPUQVM 验证
本地环境为 Python 3.13.9、pyqpanda-algorithm 2.0.0、PyQPanda3 0.3.5。CPUQVM 验证覆盖:
001的 q0/小端序检查;PASS;92 passed(含无PYTHONPATHverifier 回归)、仓库test全量110 passed in 36.44s。BF benchmark 的执行模型是
PyQPanda3 CPUQVM ideal probabilities + seeded NumPy multinomial feedback sampling。BF 的total_shots是反馈采样预算/资源代理,并非 CPUQVM measurement 实测数。上游 QAOA 的执行模型是pyqpanda_alg.QAOA.CPUQVM shot execution,其total_shots按observed circuit_evaluations × shots记录。上游 QAOA 预算核算
官方小规模 benchmark 使用 3 个种子。目标预算为
(max_evals + 2) × shots,下表记录实际观测结果:pyqpanda_alg.QAOA.CPUQVMpyqpanda_alg.QAOA.CPUQVMpyqpanda_alg.QAOA.CPUQVMBenchmark 边界
证据只覆盖允许精确求解校验的小实例,每组 3 个种子。MAX-3-SAT 的 native HUBO 在两个 fixture 中使用 5 个逻辑量子比特,而 Rosenberg 二次化 QAOA 使用 8–9 个量子比特和 3–4 个辅助变量;与此同时,native 路径观测到的最大 Pauli 权重为 3,QAOA 二次路径为 2,因此不能只以量子比特数判断总资源。
MWIS 等成本消融中,Hybrid-random 跨实例平均 best-weight ratio 为 0.970314,Hybrid-confidence 为 1.000000;两者使用相同的 72 shot 预算与每次 16 个局部评估。这只是固定小图上的观测结果,不外推到其他图族。
这些数据不构成量子优势证据,也不支持 BF-DCQO 对 QAOA 或其他优化器普遍优越的结论。
方法归属与贡献边界
本 PR 的工程贡献是面向 PyQPanda 的独立实现、统一 API、通用多项式 Ising 表示、有限采样/预算记录、CPUQVM 交叉验证与可复现实验基础设施。
测试与工具状态
python -m pytest -q -c NUL test/BFDCQO:92 passed(含无PYTHONPATHverifier 回归)。python -m pytest -q -c NUL test:110 passed in 36.44s。python scripts/verify_pyqpanda_cpuqvm.py:PASS。compileall:通过。[]。sphinx-autoapi和sphinx-material后,Sphinx HTML 构建退出码 0,BFDCQO 页面已生成。构建结果为build succeeded, 222 warnings;警告主要来自全仓已有的旧模块 docstring、Graphviz 和静态资源问题。applications/max3sat.py、applications/mwis.py、solvers/bfdcqo.py三个数学冻结文件,未擅自修改算法。扩展性限制
当前求解器保留完整概率分布和精确基态诊断,NumPy 参考路径使用完整状态向量。这些机制适用于小规模回归和研究 benchmark,但会随变量数指数增长。count-only 后端、可选精确诊断以及面向设备的编译/噪声评估不在本 PR 范围内。
Relates to #13