@louisultra/dsh-verymath 0.0.0-stage → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +133 -0
- package/LICENSE +21 -0
- package/NOTICE.md +35 -0
- package/README.md +108 -2
- package/README_EN.md +105 -0
- package/UPSTREAM.json +106 -0
- package/cordis.patch.yml +12 -0
- package/docs/capability-examples.md +581 -0
- package/docs/examples/README.md +32 -0
- package/docs/examples/bad_scan.md +10 -0
- package/docs/examples/broken-proof.lean +9 -0
- package/docs/examples/claims.md +7 -0
- package/docs/examples/knapsack.json +10 -0
- package/docs/examples/matrix.json +1 -0
- package/docs/examples/points.csv +21 -0
- package/docs/examples/qp.json +8 -0
- package/docs/examples/research-ws/project/GOALS.yaml +4 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/report.md +13 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/reviews/r1.json +1 -0
- package/docs/examples/research-ws/workstreams/ws-lsa/status.yaml +1 -0
- package/docs/examples/source.csv +4 -0
- package/lib/core/error.d.ts +20 -0
- package/lib/core/error.js +25 -0
- package/lib/core/gates.d.ts +42 -0
- package/lib/core/gates.js +217 -0
- package/lib/core/glossary.d.ts +101 -0
- package/lib/core/glossary.js +243 -0
- package/lib/core/graph.d.ts +118 -0
- package/lib/core/graph.js +460 -0
- package/lib/core/index.d.ts +120 -0
- package/lib/core/index.js +197 -0
- package/lib/core/paper.d.ts +163 -0
- package/lib/core/paper.js +73 -0
- package/lib/core/paths.d.ts +2 -0
- package/lib/core/paths.js +12 -0
- package/lib/core/sage.d.ts +61 -0
- package/lib/core/sage.js +212 -0
- package/lib/core/skills.d.ts +11 -0
- package/lib/core/skills.js +110 -0
- package/lib/tool/index.d.ts +21 -0
- package/lib/tool/index.js +1144 -0
- package/package.json +92 -4
- package/skills/after-ocr/SKILL.md +123 -0
- package/skills/after-ocr/references/audit-schema.md +94 -0
- package/skills/after-ocr/references/error-taxonomy.md +179 -0
- package/skills/after-ocr/scripts/merge_audit_logs.py +329 -0
- package/skills/after-ocr/scripts/scan_markdown_ocr.py +350 -0
- package/skills/after-ocr/tests/test_scripts.py +84 -0
- package/skills/discover-math-problems/SKILL.md +115 -0
- package/skills/discover-math-problems/references/artifact-contract.md +93 -0
- package/skills/discover-math-problems/references/autonomous-research-protocol.md +86 -0
- package/skills/discover-math-problems/references/conjecture-generation-protocol.md +63 -0
- package/skills/discover-math-problems/references/extremal-graph-variants.md +53 -0
- package/skills/graph-theory-paper-reading/SKILL.md +600 -0
- package/skills/invariant-computation/SKILL.md +169 -0
- package/skills/invariant-computation/examples/invariant_summary.example.json +51 -0
- package/skills/invariant-computation/manifest.yaml +46 -0
- package/skills/invariant-computation/references/INDEX.md +20 -0
- package/skills/invariant-computation/references/failure_modes.md +40 -0
- package/skills/invariant-computation/references/method_route_map.md +177 -0
- package/skills/invariant-computation/references/source_notes.md +19 -0
- package/skills/invariant-computation/references/tool_catalog.md +65 -0
- package/skills/invariant-computation/references/validation_checks.md +52 -0
- package/skills/invariant-computation/schema/invariant_summary.schema.json +260 -0
- package/skills/lean-formalization/SKILL.md +111 -0
- package/skills/lean-formalization/lean-runtime/config/env.example +5 -0
- package/skills/lean-formalization/lean-runtime/config/lean_agent.example.toml +28 -0
- package/skills/lean-formalization/lean-runtime/config/numina_runtime.example.toml +12 -0
- package/skills/lean-formalization/lean-runtime/examples/smoke/LocalLeanSmoke.lean +7 -0
- package/skills/lean-formalization/lean-runtime/prompts/complete_sorries.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/formalize_statement.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/prove_theorem.md +3 -0
- package/skills/lean-formalization/lean-runtime/prompts/repair_lean_file.md +3 -0
- package/skills/lean-formalization/lean-runtime/references/backend_adapter_checklist.md +36 -0
- package/skills/lean-formalization/lean-runtime/references/direct_lean_workflow.md +48 -0
- package/skills/lean-formalization/lean-runtime/references/failure_taxonomy.md +17 -0
- package/skills/lean-formalization/lean-runtime/references/interactive_orchestration.md +83 -0
- package/skills/lean-formalization/lean-runtime/references/lean_agent_capability_map.md +116 -0
- package/skills/lean-formalization/lean-runtime/references/lean_lsp_mcp_adapter.md +219 -0
- package/skills/lean-formalization/lean-runtime/references/lean_runtime_configuration.md +92 -0
- package/skills/lean-formalization/lean-runtime/references/numina_reverse_analysis.md +80 -0
- package/skills/lean-formalization/lean-runtime/references/numina_runtime.md +41 -0
- package/skills/lean-formalization/lean-runtime/references/numina_subagent_troubleshooting.md +77 -0
- package/skills/lean-formalization/lean-runtime/references/review_checklist.md +10 -0
- package/skills/lean-formalization/lean-runtime/references/specialist_agent_patterns.md +65 -0
- package/skills/lean-formalization/lean-runtime/schemas/config.schema.json +12 -0
- package/skills/lean-formalization/lean-runtime/schemas/result.schema.json +33 -0
- package/skills/lean-formalization/lean-runtime/schemas/task.schema.json +30 -0
- package/skills/lean-formalization/lean-runtime/scripts/ai4m_lean.py +222 -0
- package/skills/lean-formalization/lean-runtime/scripts/check_lean_project.py +134 -0
- package/skills/lean-formalization/lean-runtime/scripts/common.py +296 -0
- package/skills/lean-formalization/lean-runtime/scripts/configure_lean.py +222 -0
- package/skills/lean-formalization/lean-runtime/scripts/detect_sorry.py +49 -0
- package/skills/lean-formalization/lean-runtime/scripts/direct_task.py +100 -0
- package/skills/lean-formalization/lean-runtime/scripts/extract_minimal_failure.py +74 -0
- package/skills/lean-formalization/lean-runtime/scripts/numina_runtime.py +414 -0
- package/skills/lean-formalization/lean-runtime/scripts/smoke_test.py +75 -0
- package/skills/lean-formalization/lean-runtime/scripts/tool_status.py +79 -0
- package/skills/lean-formalization/lean-runtime/scripts/validate_patch.py +81 -0
- package/skills/lean-formalization/lean-runtime/scripts/verify_delivery.py +484 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/after_bad.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/after_statement_changed.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/before.lean +4 -0
- package/skills/lean-formalization/lean-runtime/tests/fixtures/failure.lean +7 -0
- package/skills/lean-formalization/lean-runtime/tests/test_check_lean_project.py +59 -0
- package/skills/lean-formalization/lean-runtime/tests/test_cli.py +377 -0
- package/skills/lean-formalization/lean-runtime/tests/test_common_config.py +84 -0
- package/skills/lean-formalization/lean-runtime/tests/test_configure_lean.py +138 -0
- package/skills/lean-formalization/lean-runtime/tests/test_detect_sorry.py +24 -0
- package/skills/lean-formalization/lean-runtime/tests/test_direct_task.py +69 -0
- package/skills/lean-formalization/lean-runtime/tests/test_numina_runtime.py +168 -0
- package/skills/lean-formalization/lean-runtime/tests/test_validate_patch.py +29 -0
- package/skills/lean-setup/SKILL.md +99 -0
- package/skills/least-squares/README.md +85 -0
- package/skills/least-squares/SKILL.md +613 -0
- package/skills/least-squares/examples.md +380 -0
- package/skills/math-beamer/SKILL.md +325 -0
- package/skills/math-beamer/references/build-and-layout-audit.md +63 -0
- package/skills/math-beamer/references/math-domain-patterns.md +56 -0
- package/skills/math-beamer/references/template-policy.md +43 -0
- package/skills/math-beamer/references/template-source-index.md +51 -0
- package/skills/math-beamer/templates/catalog.yaml +235 -0
- package/skills/math-beamer/templates/packs/algebra-number-theory-talk/main.tex +45 -0
- package/skills/math-beamer/templates/packs/algebra-number-theory-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/algorithm-talk/main.tex +43 -0
- package/skills/math-beamer/templates/packs/algorithm-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/analysis-core-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/analysis-core-talk/template.yaml +19 -0
- package/skills/math-beamer/templates/packs/backup-heavy-talk/main.tex +40 -0
- package/skills/math-beamer/templates/packs/backup-heavy-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/beamerposter-a0/main.tex +45 -0
- package/skills/math-beamer/templates/packs/beamerposter-a0/template.yaml +12 -0
- package/skills/math-beamer/templates/packs/combinatorics-graph-talk/main.tex +53 -0
- package/skills/math-beamer/templates/packs/combinatorics-graph-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/control-systems-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/control-systems-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/course-lecture-zh/main.tex +43 -0
- package/skills/math-beamer/templates/packs/course-lecture-zh/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/data-experiment-results/main.tex +45 -0
- package/skills/math-beamer/templates/packs/data-experiment-results/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/dynamical-systems-talk/main.tex +42 -0
- package/skills/math-beamer/templates/packs/dynamical-systems-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/geometry-topology-talk/main.tex +43 -0
- package/skills/math-beamer/templates/packs/geometry-topology-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/information-coding-crypto-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/information-coding-crypto-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/logic-foundations-category-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/logic-foundations-category-talk/template.yaml +18 -0
- package/skills/math-beamer/templates/packs/numerical-analysis-talk/main.tex +51 -0
- package/skills/math-beamer/templates/packs/numerical-analysis-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/optimization-talk/main.tex +58 -0
- package/skills/math-beamer/templates/packs/optimization-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/pde-analysis-talk/main.tex +49 -0
- package/skills/math-beamer/templates/packs/pde-analysis-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/probability-statistics-talk/main.tex +52 -0
- package/skills/math-beamer/templates/packs/probability-statistics-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/reading-group-paper/main.tex +46 -0
- package/skills/math-beamer/templates/packs/reading-group-paper/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-en/main.tex +60 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-en/template.yaml +13 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-zh/main.tex +60 -0
- package/skills/math-beamer/templates/packs/seminar-minimal-zh/template.yaml +13 -0
- package/skills/math-beamer/templates/packs/theorem-proof-talk/main.tex +60 -0
- package/skills/math-beamer/templates/packs/theorem-proof-talk/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/thesis-defense/main.tex +42 -0
- package/skills/math-beamer/templates/packs/thesis-defense/template.yaml +9 -0
- package/skills/math-beamer/templates/packs/workshop-tutorial/main.tex +32 -0
- package/skills/math-beamer/templates/packs/workshop-tutorial/template.yaml +9 -0
- package/skills/math-beamer/templates/preview-gallery.md +32 -0
- package/skills/math-beamer/templates/previews/algebra-number-theory-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/algebra-number-theory-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/algorithm-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/algorithm-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/analysis-core-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/analysis-core-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/backup-heavy-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/backup-heavy-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/beamerposter-a0-content.png +0 -0
- package/skills/math-beamer/templates/previews/beamerposter-a0-cover.png +0 -0
- package/skills/math-beamer/templates/previews/combinatorics-graph-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/combinatorics-graph-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/control-systems-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/control-systems-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/course-lecture-zh-content.png +0 -0
- package/skills/math-beamer/templates/previews/course-lecture-zh-cover.png +0 -0
- package/skills/math-beamer/templates/previews/data-experiment-results-content.png +0 -0
- package/skills/math-beamer/templates/previews/data-experiment-results-cover.png +0 -0
- package/skills/math-beamer/templates/previews/dynamical-systems-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/dynamical-systems-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/geometry-topology-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/geometry-topology-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/information-coding-crypto-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/information-coding-crypto-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/logic-foundations-category-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/logic-foundations-category-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/numerical-analysis-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/numerical-analysis-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/optimization-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/optimization-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/pde-analysis-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/pde-analysis-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/probability-statistics-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/probability-statistics-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/reading-group-paper-content.png +0 -0
- package/skills/math-beamer/templates/previews/reading-group-paper-cover.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-en-content.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-en-cover.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-zh-content.png +0 -0
- package/skills/math-beamer/templates/previews/seminar-minimal-zh-cover.png +0 -0
- package/skills/math-beamer/templates/previews/theorem-proof-talk-content.png +0 -0
- package/skills/math-beamer/templates/previews/theorem-proof-talk-cover.png +0 -0
- package/skills/math-beamer/templates/previews/thesis-defense-content.png +0 -0
- package/skills/math-beamer/templates/previews/thesis-defense-cover.png +0 -0
- package/skills/math-beamer/templates/previews/workshop-tutorial-content.png +0 -0
- package/skills/math-beamer/templates/previews/workshop-tutorial-cover.png +0 -0
- package/skills/math-beamer/templates/review-report.md +54 -0
- package/skills/math-beamer/templates/slide-source-ledger.md +22 -0
- package/skills/math-beamer/templates/source-packet.md +50 -0
- package/skills/math-glossary/SKILL.md +347 -0
- package/skills/math-glossary/references/glossary-schema.md +71 -0
- package/skills/math-glossary/references/glossary-usage-guide.md +176 -0
- package/skills/math-glossary/references/glossary-web-template.md +127 -0
- package/skills/math-glossary/references/glossary.schema.json +76 -0
- package/skills/math-glossary/references/user-manual.md +435 -0
- package/skills/math-glossary/requirements-ai.txt +3 -0
- package/skills/math-glossary/requirements.txt +3 -0
- package/skills/math-glossary/scripts/glossary_backup.py +42 -0
- package/skills/math-glossary/scripts/glossary_build.py +467 -0
- package/skills/math-glossary/scripts/glossary_enrich_examples.py +283 -0
- package/skills/math-glossary/scripts/glossary_export.py +333 -0
- package/skills/math-glossary/scripts/glossary_web.py +1265 -0
- package/skills/math-paper-reading/README.md +163 -0
- package/skills/math-paper-reading/SKILL.md +48 -0
- package/skills/math-paper-reading/agent_router.md +36 -0
- package/skills/math-paper-reading/references/proof_pattern_taxonomy.md +123 -0
- package/skills/math-paper-reading/references/quality_rubric.md +36 -0
- package/skills/math-paper-reading/skill_base.md +627 -0
- package/skills/math-paper-reading/skill_literature_search.md +866 -0
- package/skills/math-paper-reading/skill_paper_deep_read.md +1024 -0
- package/skills/math-paper-reading/skill_pathway_proof.md +718 -0
- package/skills/math-paper-reading/skill_reference_manager.md +746 -0
- package/skills/matlab-runner/SKILL.md +217 -0
- package/skills/matlab-runner/examples/README.md +33 -0
- package/skills/matlab-runner/examples/matrix_report.m +28 -0
- package/skills/matlab-runner/examples/plot_damped_sine.m +64 -0
- package/skills/matlab-runner/examples/test_vector_norm.m +12 -0
- package/skills/matlab-runner/references/client-setup.md +24 -0
- package/skills/matlab-runner/references/file-session-safety.md +86 -0
- package/skills/matlab-runner/references/numerical-safety.md +126 -0
- package/skills/matlab-runner/references/resource-safety.md +125 -0
- package/skills/mixed-integer-programming/SKILL.md +119 -0
- package/skills/mixed-integer-programming/lp-examples.md +251 -0
- package/skills/mixed-integer-programming/mip-examples-verified.md +118 -0
- package/skills/open-problem-research-pipeline/SKILL.md +76 -0
- package/skills/open-problem-research-pipeline/skill_literature_analysis.md +201 -0
- package/skills/open-problem-research-pipeline/skill_literature_proof_framework.md +206 -0
- package/skills/open-problem-research-pipeline/skill_literature_search.md +172 -0
- package/skills/open-problem-research-pipeline/skill_qskill.md +177 -0
- package/skills/osqp-solver/SKILL.md +245 -0
- package/skills/osqp-solver/references/citation.md +25 -0
- package/skills/osqp-solver/references/dual-infeasible-example.json +14 -0
- package/skills/osqp-solver/references/feasible-example.json +21 -0
- package/skills/osqp-solver/references/primal-infeasible-example.json +17 -0
- package/skills/osqp-solver/references/python-api.md +95 -0
- package/skills/osqp-solver/references/verification.md +94 -0
- package/skills/osqp-solver/scripts/check_osqp_environment.py +120 -0
- package/skills/osqp-solver/scripts/solve_qp.py +943 -0
- package/skills/paper-writing/SKILL.md +115 -0
- package/skills/paper-writing/skill_claim_evidence_ledger.md +55 -0
- package/skills/paper-writing/skill_formula_environment_and_readability.md +41 -0
- package/skills/paper-writing/skill_latex_build_and_layout_audit.md +73 -0
- package/skills/paper-writing/skill_notation_and_variable_consistency.md +42 -0
- package/skills/paper-writing/skill_paper_skeleton_and_logical_architecture.md +54 -0
- package/skills/paper-writing/skill_proof_obligation_and_assumption_audit.md +57 -0
- package/skills/paper-writing/templates/claim-evidence-ledger.md +23 -0
- package/skills/paper-writing/templates/proof-obligation-ledger.md +22 -0
- package/skills/paper-writing/templates/rapid-prototype-paper-skeleton.md +46 -0
- package/skills/paper-writing/templates/source-packet.md +37 -0
- package/skills/paper-writing/templates/submission-readiness.md +41 -0
- package/skills/proof-blueprint-review/SKILL.md +129 -0
- package/skills/proof-blueprint-review/references/agent-mediated-proof-protocol.md +57 -0
- package/skills/proof-blueprint-review/references/generation-agent.md +45 -0
- package/skills/proof-blueprint-review/references/proof-acceptance-contract.md +41 -0
- package/skills/proof-blueprint-review/references/verification-agent.md +37 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: qskill
|
|
3
|
+
description: 最终的组合大skill。对用户输入的数学公开问题,依次调用 literature-search、literature-analysis、literature-proof-framework,输出完整的文献调研—方法分析—证明框架三合一报告。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# QSkill — 完整问题分析管线
|
|
7
|
+
|
|
8
|
+
## 功能
|
|
9
|
+
|
|
10
|
+
对用户输入的**一个或多个数学公开问题**,自动依次调用三个子skill:
|
|
11
|
+
1. **literature-search**(skill1)— 文献调研:搜索问题研究现状
|
|
12
|
+
2. **literature-analysis**(skill2)— 方法分析:提取各文献的方法、技术、思想
|
|
13
|
+
3. **literature-proof-framework**(skill3)— 证明框架构建:基于现有方法构建多个可行的证明方案
|
|
14
|
+
|
|
15
|
+
最终输出一个**完整的三合一报告**(PDF),包含上述所有子skill的输出,并保存到 `outputs/qs_reports/` 下。
|
|
16
|
+
|
|
17
|
+
## 状态边界
|
|
18
|
+
|
|
19
|
+
- 文献事实必须带可核验来源;旧资料不能单独证明问题的当前状态。
|
|
20
|
+
- 方法分析只覆盖已读取的证据,不能从标题或摘要重建证明细节。
|
|
21
|
+
- 证明框架属于候选路线;未闭合 proof obligations 时不得声称得到证明。
|
|
22
|
+
- “新问题”“新方法”和“可行”均为待核验标签,除非已完成对应检索或验证。
|
|
23
|
+
|
|
24
|
+
## 触发方式
|
|
25
|
+
|
|
26
|
+
用户输入 `qskill: <数学问题描述>` 即可调用。
|
|
27
|
+
|
|
28
|
+
### 多问题处理
|
|
29
|
+
|
|
30
|
+
如果用户输入多个问题,需明确说明(如"两个问题"、"问题1:... 问题2:..."),对每个问题**独立执行**完整的 skill1→skill2→skill3 管线。
|
|
31
|
+
|
|
32
|
+
## 工作流程
|
|
33
|
+
|
|
34
|
+
### Phase 0:输入解析
|
|
35
|
+
|
|
36
|
+
- 判断用户输入是**单个问题**还是**多个问题**
|
|
37
|
+
- 如果是多个问题,分割为独立的问题列表
|
|
38
|
+
- 对每个问题,生成唯一 slug(英文缩写,CamelCase)
|
|
39
|
+
|
|
40
|
+
### Phase 1:调用 skill1 — 文献调研
|
|
41
|
+
|
|
42
|
+
对每个问题:
|
|
43
|
+
|
|
44
|
+
1. **问题精确化确认**(skill1 Step 0):
|
|
45
|
+
- 快速联网搜索最匹配的已知数学问题
|
|
46
|
+
- 如果问题不明确,向用户展示精确表述并确认
|
|
47
|
+
- 如果问题已明确,直接继续
|
|
48
|
+
|
|
49
|
+
2. 执行 skill1 完整流程(Step 1-5):
|
|
50
|
+
- 分析问题 → 联网搜索 → 信息整理 → 输出报告
|
|
51
|
+
- 保存到 `outputs/literature_reports/<slug>_文献调研报告_<date>.json`
|
|
52
|
+
|
|
53
|
+
3. 将 skill1 的 JSON 输出摘要嵌入最终报告
|
|
54
|
+
|
|
55
|
+
### Phase 2:调用 skill2 — 方法分析
|
|
56
|
+
|
|
57
|
+
对每个问题:
|
|
58
|
+
|
|
59
|
+
1. 读取 skill1 输出的 `<slug>_文献调研报告_<date>.json`
|
|
60
|
+
2. 执行 skill2 完整流程(Step 1-6):
|
|
61
|
+
- 提取方法 → 方法分类 → 演化图谱 → 输出报告
|
|
62
|
+
- 保存到 `outputs/literature_analysis_reports/<slug>_方法分析报告_<date>.json`
|
|
63
|
+
|
|
64
|
+
3. 将 skill2 的 JSON 输出摘要嵌入最终报告
|
|
65
|
+
|
|
66
|
+
### Phase 3:调用 skill3 — 证明框架构建
|
|
67
|
+
|
|
68
|
+
对每个问题:
|
|
69
|
+
|
|
70
|
+
1. 读取 skill2 输出的 `<slug>_方法分析报告_<date>.json`
|
|
71
|
+
2. 执行 skill3 完整流程(Step 1-6):
|
|
72
|
+
- 方法评估 → 框架构建 → 对比推荐 → 输出报告
|
|
73
|
+
- 保存到 `outputs/literature_proof_reports/<slug>_证明框架报告_<date>.json`
|
|
74
|
+
|
|
75
|
+
3. 将 skill3 的 JSON 输出摘要嵌入最终报告
|
|
76
|
+
|
|
77
|
+
### Phase 4:组装最终报告
|
|
78
|
+
|
|
79
|
+
对每个问题,将 Phases 1-3 的输出汇总为一个章节。
|
|
80
|
+
|
|
81
|
+
#### 单问题报告结构
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
# [问题名称] — 完整分析报告
|
|
85
|
+
|
|
86
|
+
## 第一章:文献调研(来自 literature-search)
|
|
87
|
+
- 问题概述
|
|
88
|
+
- 当前状态
|
|
89
|
+
- 已知结果
|
|
90
|
+
- 关键文献
|
|
91
|
+
- 综合评述
|
|
92
|
+
|
|
93
|
+
## 第二章:方法分析(来自 literature-analysis)
|
|
94
|
+
- 方法分类总览
|
|
95
|
+
- 逐篇方法分析
|
|
96
|
+
- 方法演化图谱
|
|
97
|
+
- 跨方法关系
|
|
98
|
+
|
|
99
|
+
## 第三章:证明框架(来自 literature-proof-framework)
|
|
100
|
+
- 方法可行性评估
|
|
101
|
+
- 证明框架列表(每个含逻辑链条)
|
|
102
|
+
- 框架对比与推荐
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### 多问题报告结构
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
# 多问题完整分析报告
|
|
109
|
+
|
|
110
|
+
## 问题一:[名称]
|
|
111
|
+
[章节1-3同上]
|
|
112
|
+
|
|
113
|
+
## 问题二:[名称]
|
|
114
|
+
[章节1-3同上]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Phase 5:输出 PDF 并保存
|
|
118
|
+
|
|
119
|
+
1. 使用 `python3 <package-root>/skills/qskill/md2pdf.py <md文件路径>` 将 Markdown 报告转换为 PDF
|
|
120
|
+
2. 该脚本使用 pdflatex(需系统预装)编译,需 ctex 宏包(TeX Live 中文支持)
|
|
121
|
+
3. 如果 pdflatex 不可用,回退到仅保存 Markdown 源文件
|
|
122
|
+
4. 保存到 `outputs/qs_reports/`
|
|
123
|
+
|
|
124
|
+
**文件命名**:
|
|
125
|
+
```
|
|
126
|
+
<问题英文缩写(CamelCase)>_完整分析报告_<YYYY-MM-DD>.pdf (单问题)
|
|
127
|
+
MultiProblem_完整分析报告_<YYYY-MM-DD>.pdf (多问题)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
同时保存对应的 Markdown 源文件:
|
|
131
|
+
```
|
|
132
|
+
<问题英文缩写(CamelCase)>_完整分析报告_<YYYY-MM-DD>.md
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 输出产物清单
|
|
136
|
+
|
|
137
|
+
| 文件 | 用途 |
|
|
138
|
+
|------|------|
|
|
139
|
+
| `outputs/qs_reports/<slug>_完整分析报告_<YYYY-MM-DD>.md` | Markdown 源文件(可嵌入其他skill) |
|
|
140
|
+
| `outputs/qs_reports/<slug>_完整分析报告_<YYYY-MM-DD>.pdf` | PDF 文档(直接阅读) |
|
|
141
|
+
| `outputs/literature_reports/<slug>_文献调研报告_<YYYY-MM-DD>.json` | skill1 中间产物 |
|
|
142
|
+
| `outputs/literature_analysis_reports/<slug>_方法分析报告_<YYYY-MM-DD>.json` | skill2 中间产物 |
|
|
143
|
+
| `outputs/literature_proof_reports/<slug>_证明框架报告_<YYYY-MM-DD>.json` | skill3 中间产物 |
|
|
144
|
+
|
|
145
|
+
## skill1 的"问题精确化确认"说明
|
|
146
|
+
|
|
147
|
+
在调用 skill1 的 Step 0 时,需注意:
|
|
148
|
+
- 如果用户输入的问题本身就是精确的数学猜想名(如 "P vs NP"、"孪生素数猜想"、"Vizing猜想"),**直接跳过确认步骤**
|
|
149
|
+
- 如果用户输入描述模糊(如 "那个关于素数的猜想"、"图论中乘积的问题"),则需要联网搜索找出最匹配的问题,展示给用户确认
|
|
150
|
+
- 确认过程只做**一次**,如果用户否认则要求输入更精确的描述
|
|
151
|
+
|
|
152
|
+
## 嵌入其他Skill
|
|
153
|
+
|
|
154
|
+
由于 qskill 本身就是顶层 skill,其他更大的 skill 可以直接:
|
|
155
|
+
|
|
156
|
+
1. 在 prompt 中引用:
|
|
157
|
+
```
|
|
158
|
+
如需对数学公开问题进行完整分析(文献调研+方法分析+证明框架),使用 qskill。
|
|
159
|
+
触发词:qskill: <问题描述>
|
|
160
|
+
输出:outputs/qs_reports/<slug>_完整分析报告_<date>.json(含三阶段的全部数据)
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
2. 读取 `outputs/qs_reports/*.json` 中的 `literature_review`、`method_analysis`、`proof_frameworks` 三字段分别获取各阶段结果。
|
|
164
|
+
|
|
165
|
+
## MWE
|
|
166
|
+
|
|
167
|
+
用户输入:
|
|
168
|
+
```
|
|
169
|
+
qskill: Vizing猜想
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
输出过程:
|
|
173
|
+
1. skill1 Step 0:问题已明确,跳过确认
|
|
174
|
+
2. skill1:搜索文献 → 保存到 `outputs/literature_reports/VizingConjecture_文献调研报告_2026-07-10.json`
|
|
175
|
+
3. skill2:方法分析 → 保存到 `outputs/literature_analysis_reports/VizingConjecture_方法分析报告_2026-07-10.json`
|
|
176
|
+
4. skill3:构建框架 → 保存到 `outputs/literature_proof_reports/VizingConjecture_证明框架报告_2026-07-10.json`
|
|
177
|
+
5. 组装报告 → 保存到 `outputs/qs_reports/VizingConjecture_完整分析报告_2026-07-10.pdf`
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: osqp-solver
|
|
3
|
+
description: "Model, solve, update, reproduce, and diagnose continuous convex quadratic programs with the OSQP Python interface, including canonical-form conversion, sparse CSC data, solver-status gates, residual checks, infeasibility certificates, warm starts, repeated parametric QPs, and academic citation. Use when a task names OSQP, osqp Python, operator-splitting QP, convex QP, model-predictive-control QP, portfolio QP, or asks to reproduce or debug OSQP results. Do not use for mixed-integer, nonconvex quadratic, nonlinear-constraint, or general conic/SOCP problems. In DSH use verymath_osqp_check for environment probing and verymath_osqp_solve for deterministic JSON-contract solving with independent verification."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OSQP Solver
|
|
7
|
+
|
|
8
|
+
## DSH Integration Notes
|
|
9
|
+
|
|
10
|
+
- 本技能由 `@louisultra/dsh-verymath` 插件提供。工具优先:
|
|
11
|
+
`verymath_osqp_check` 探测 osqp/numpy/scipy(含 osqp 主版本门 >=1,<2),
|
|
12
|
+
`verymath_osqp_solve` 直接求解 JSON 契约的 QP(内置 11 态状态门与独立 KKT/证书验证,exit 0/2/3)。
|
|
13
|
+
- 工具不可用或问题超出工具护栏(稠密规模上限、n≤1000)时,回退到 `scripts/solve_qp.py` shell 执行。
|
|
14
|
+
- 数值证据(verification.json 等)写入 outputs/<run_id>/,可作为 paper-writing 技能 experiment 型断言的标准证据。
|
|
15
|
+
- 上游 status:VeryMath 仓内候选(未正式合并);本插件钉住适配的 commit(见 UPSTREAM.json)。
|
|
16
|
+
|
|
17
|
+
## Scope
|
|
18
|
+
|
|
19
|
+
Work only with the continuous convex QP
|
|
20
|
+
|
|
21
|
+
\[
|
|
22
|
+
\begin{array}{ll}
|
|
23
|
+
\operatorname{minimize} & \frac12 x^\top P x + q^\top x \\
|
|
24
|
+
\operatorname{subject\ to} & l \leq A x \leq u,
|
|
25
|
+
\end{array}
|
|
26
|
+
\qquad P=P^\top\succeq 0.
|
|
27
|
+
\]
|
|
28
|
+
|
|
29
|
+
Treat OSQP as a numerical solver, not as a modeling oracle. Derive the model,
|
|
30
|
+
check dimensions and convexity, solve, and then independently verify what the
|
|
31
|
+
returned status means.
|
|
32
|
+
|
|
33
|
+
Route elsewhere when the task contains integer variables, a genuinely
|
|
34
|
+
indefinite \(P\), nonlinear constraints, or cones that cannot be represented by
|
|
35
|
+
linear bounds. Do not claim that failure to detect nonconvexity proves
|
|
36
|
+
convexity.
|
|
37
|
+
|
|
38
|
+
## Workflow
|
|
39
|
+
|
|
40
|
+
### 1. Freeze the interpreted model
|
|
41
|
+
|
|
42
|
+
Write a short modeling checkpoint before executable code:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
source:
|
|
46
|
+
variables and units:
|
|
47
|
+
objective before conversion:
|
|
48
|
+
constraints before conversion:
|
|
49
|
+
canonical P, q, A, l, u:
|
|
50
|
+
dimensions and expected sparsity:
|
|
51
|
+
why P is positive semidefinite:
|
|
52
|
+
requested accuracy and runtime budget:
|
|
53
|
+
ambiguities:
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Confirm any interpretation that changes the mathematics. Keep the factor
|
|
57
|
+
\(\tfrac12\) visible: if the original quadratic is \(x^\top Qx\), then OSQP
|
|
58
|
+
usually needs \(P=2Q\).
|
|
59
|
+
|
|
60
|
+
### 2. Inspect the environment
|
|
61
|
+
|
|
62
|
+
Run the non-mutating probe:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
python3 scripts/check_osqp_environment.py --json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Require `osqp`, `numpy`, and `scipy`. If they are missing, report:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
python3 -m pip install 'osqp>=1,<2'
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Obtain approval before changing an existing environment. Do not infer solver
|
|
75
|
+
availability from a package listing alone; import it with the probe. Require
|
|
76
|
+
`ready: true`: an importable but unsupported OSQP major version is not ready
|
|
77
|
+
for this runner.
|
|
78
|
+
|
|
79
|
+
### 3. Construct solver data deliberately
|
|
80
|
+
|
|
81
|
+
- Store `P` and `A` as `scipy.sparse.csc_matrix`.
|
|
82
|
+
- Reject materially asymmetric input. For differences within the declared
|
|
83
|
+
symmetry tolerance, construct one canonical symmetric `P` and use that same
|
|
84
|
+
matrix for the PSD, objective, stationarity, setup, and update checks. Pass
|
|
85
|
+
its upper triangle to OSQP because the solver uses upper-triangular storage.
|
|
86
|
+
- Encode one row of \(l\leq Ax\leq u\) per equality, interval, lower bound, or
|
|
87
|
+
upper bound. Use `numpy.inf` for open sides.
|
|
88
|
+
- Check `P.shape == (n, n)`, `q.shape == (n,)`, `A.shape == (m, n)`, and
|
|
89
|
+
`l.shape == u.shape == (m,)`.
|
|
90
|
+
- Check `l <= u`, finite `P`, `q`, and `A`, and the scale of every row and
|
|
91
|
+
column. Avoid accidental dense construction for large problems.
|
|
92
|
+
|
|
93
|
+
For small reviewable JSON problems, use
|
|
94
|
+
`scripts/solve_qp.py`. Read `references/python-api.md` before adapting the
|
|
95
|
+
runner to a production sparse model. The dense runner rejects inputs above
|
|
96
|
+
32 MiB, `n > 1000`, or more than `2,000,000` logical entries across `P` and
|
|
97
|
+
`A`.
|
|
98
|
+
|
|
99
|
+
### 4. Establish a baseline solve
|
|
100
|
+
|
|
101
|
+
Prefer the native Python interface for transparent solver data:
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
import numpy as np
|
|
105
|
+
import osqp
|
|
106
|
+
from scipy import sparse
|
|
107
|
+
|
|
108
|
+
P = sparse.csc_matrix(...)
|
|
109
|
+
q = np.asarray(..., dtype=float)
|
|
110
|
+
A = sparse.csc_matrix(...)
|
|
111
|
+
l = np.asarray(..., dtype=float)
|
|
112
|
+
u = np.asarray(..., dtype=float)
|
|
113
|
+
|
|
114
|
+
model = osqp.OSQP()
|
|
115
|
+
model.setup(
|
|
116
|
+
P=P,
|
|
117
|
+
q=q,
|
|
118
|
+
A=A,
|
|
119
|
+
l=l,
|
|
120
|
+
u=u,
|
|
121
|
+
verbose=False,
|
|
122
|
+
)
|
|
123
|
+
result = model.solve()
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Run defaults first unless the task already specifies settings. Record every
|
|
127
|
+
non-default setting. The bundled runner supports `osqp>=1,<2`. Use the OSQP v1
|
|
128
|
+
names `polishing` and `warm_starting`; consult `references/python-api.md` when
|
|
129
|
+
reproducing v0.6 code that used `polish` or `warm_start`, but preserve that
|
|
130
|
+
older reproduction in a separate pinned environment instead of passing it to
|
|
131
|
+
this runner.
|
|
132
|
+
|
|
133
|
+
Do not tune `rho`, `alpha`, scaling, or tolerances from folklore. First preserve
|
|
134
|
+
the baseline status, iteration count, residuals, and timing; then change one
|
|
135
|
+
justified setting at a time.
|
|
136
|
+
|
|
137
|
+
### 5. Apply the status gate
|
|
138
|
+
|
|
139
|
+
Interpret `result.info.status_val`, not a substring match on a log:
|
|
140
|
+
|
|
141
|
+
| Status class | Treatment |
|
|
142
|
+
| --- | --- |
|
|
143
|
+
| `solved` | Candidate solution; verify before accepting. |
|
|
144
|
+
| `solved inaccurate` | Tentative only; report the relaxed-status boundary and verify. |
|
|
145
|
+
| `primal infeasible` / `dual infeasible` | Candidate classification; verify the returned certificate. |
|
|
146
|
+
| inaccurate infeasibility | Tentative certificate only. |
|
|
147
|
+
| maximum iterations / time limit | No accepted solution; diagnose or revise the budget. |
|
|
148
|
+
| non convex | Reject the solve and revisit \(P\); detection is not exhaustive. |
|
|
149
|
+
| interrupted / unsolved / setup error | No mathematical conclusion. |
|
|
150
|
+
|
|
151
|
+
Never replace the status with a bare objective value or a visually plausible
|
|
152
|
+
vector.
|
|
153
|
+
|
|
154
|
+
### 6. Verify independently
|
|
155
|
+
|
|
156
|
+
For a feasible candidate \(x,y\), compute at minimum:
|
|
157
|
+
|
|
158
|
+
\[
|
|
159
|
+
\max\{\|(l-Ax)_+\|_\infty,\|(Ax-u)_+\|_\infty\},
|
|
160
|
+
\qquad
|
|
161
|
+
\|Px+q+A^\top y\|_\infty,
|
|
162
|
+
\]
|
|
163
|
+
|
|
164
|
+
also check the normal-cone/complementarity condition
|
|
165
|
+
\(y\in N_{[l,u]}(Ax)\), and recompute
|
|
166
|
+
\(\frac12x^\top Px+q^\top x\). Compare all residuals with the requested
|
|
167
|
+
absolute/relative tolerances and problem scaling.
|
|
168
|
+
|
|
169
|
+
Do not treat an objective below a known feasible optimum as an improvement
|
|
170
|
+
until feasibility has passed: a slightly infeasible numerical point can have a
|
|
171
|
+
spuriously lower objective.
|
|
172
|
+
|
|
173
|
+
For an infeasibility claim, verify the returned certificate using
|
|
174
|
+
`references/verification.md`. Reject zero or non-finite directions, normalize
|
|
175
|
+
the certificate by its infinity norm, and require a scale-aware strict negative
|
|
176
|
+
margin rather than accepting a value that is merely below zero. Distinguish:
|
|
177
|
+
|
|
178
|
+
- OSQP's reported residuals;
|
|
179
|
+
- an independent recomputation;
|
|
180
|
+
- the requested tolerances;
|
|
181
|
+
- any looser threshold used only for diagnosis.
|
|
182
|
+
|
|
183
|
+
### 7. Reuse setup for parametric QPs
|
|
184
|
+
|
|
185
|
+
For repeated problems with fixed dimensions and sparsity:
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
model.update(q=q_new, l=l_new, u=u_new)
|
|
189
|
+
model.update(Px=Px_new, Ax=Ax_new)
|
|
190
|
+
result = model.solve()
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
OSQP automatically warm starts from the previous solution. Use
|
|
194
|
+
`model.warm_start(x=x0, y=y0)` only when supplying an intentional external
|
|
195
|
+
initial point.
|
|
196
|
+
|
|
197
|
+
Matrix updates may change numerical values but not the sparsity pattern. Re-run
|
|
198
|
+
`setup` when a pattern or dimension changes. Benchmark setup time separately
|
|
199
|
+
from update and solve time. Do not infer a speedup from one tiny, warm-started,
|
|
200
|
+
microsecond-scale observation.
|
|
201
|
+
|
|
202
|
+
### 8. Preserve evidence
|
|
203
|
+
|
|
204
|
+
Save durable artifacts under `outputs/<run_id>/`:
|
|
205
|
+
|
|
206
|
+
```text
|
|
207
|
+
model.md interpreted mathematics and assumptions
|
|
208
|
+
problem.json exact small runner input, when used
|
|
209
|
+
settings.json OSQP version and non-default settings
|
|
210
|
+
result.json status, solution or certificate, and timings
|
|
211
|
+
verification.json independently recomputed checks
|
|
212
|
+
run.log command and diagnostics
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Report:
|
|
216
|
+
|
|
217
|
+
1. the exact QP and interface version;
|
|
218
|
+
2. status and whether it passed the gate;
|
|
219
|
+
3. objective, residuals, and certificate checks;
|
|
220
|
+
4. settings and warm-start/update behavior;
|
|
221
|
+
5. limitations and unresolved numerical concerns.
|
|
222
|
+
|
|
223
|
+
For published work, read `references/citation.md` and include the relevant
|
|
224
|
+
official OSQP citation.
|
|
225
|
+
|
|
226
|
+
When using the bundled CLI, preserve its machine-readable stream contract:
|
|
227
|
+
success writes exactly one JSON document to standard output, and errors write
|
|
228
|
+
exactly one JSON document to standard error. Reject `settings.verbose: true`.
|
|
229
|
+
Never use the input path as `--output`; use a run-specific destination because
|
|
230
|
+
a distinct existing output may be atomically replaced.
|
|
231
|
+
|
|
232
|
+
## Bundled Resources
|
|
233
|
+
|
|
234
|
+
- `scripts/check_osqp_environment.py`: inspect Python and OSQP dependencies
|
|
235
|
+
without installing anything.
|
|
236
|
+
- `scripts/solve_qp.py`: solve and independently check a small dense JSON QP;
|
|
237
|
+
use it as an auditable runner, not a large sparse-data format.
|
|
238
|
+
- `references/python-api.md`: source-backed Python setup, update, warm-start,
|
|
239
|
+
settings, and version notes.
|
|
240
|
+
- `references/verification.md`: residual and infeasibility-certificate checks.
|
|
241
|
+
- `references/citation.md`: official publication citations.
|
|
242
|
+
- `references/*-example.json`: feasible, primal-infeasible, and
|
|
243
|
+
dual-infeasible smoke problems.
|
|
244
|
+
- `requirements-test.txt`: minimal OSQP 1.x dependency for isolated numerical
|
|
245
|
+
tests.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Citing OSQP
|
|
2
|
+
|
|
3
|
+
Use the official citation page for the current list of papers:
|
|
4
|
+
<https://osqp.org/citing/>.
|
|
5
|
+
|
|
6
|
+
For the main algorithm, OSQP lists:
|
|
7
|
+
|
|
8
|
+
```bibtex
|
|
9
|
+
@article{osqp,
|
|
10
|
+
author = {Stellato, B. and Banjac, G. and Goulart, P. and Bemporad, A. and Boyd, S.},
|
|
11
|
+
title = {{OSQP}: an operator splitting solver for quadratic programs},
|
|
12
|
+
journal = {Mathematical Programming Computation},
|
|
13
|
+
year = {2020},
|
|
14
|
+
volume = {12},
|
|
15
|
+
number = {4},
|
|
16
|
+
pages = {637--672},
|
|
17
|
+
doi = {10.1007/s12532-020-00179-2},
|
|
18
|
+
url = {https://doi.org/10.1007/s12532-020-00179-2},
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Add the official infeasibility, GPU, code-generation, or mixed-integer paper
|
|
23
|
+
only when the work actually uses that contribution. Do not cite the
|
|
24
|
+
mixed-integer extension as evidence that the core OSQP solver accepts integer
|
|
25
|
+
variables.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "official-two-variable-qp",
|
|
3
|
+
"P": [
|
|
4
|
+
[4.0, 1.0],
|
|
5
|
+
[1.0, 2.0]
|
|
6
|
+
],
|
|
7
|
+
"q": [1.0, 1.0],
|
|
8
|
+
"A": [
|
|
9
|
+
[1.0, 1.0],
|
|
10
|
+
[1.0, 0.0],
|
|
11
|
+
[0.0, 1.0]
|
|
12
|
+
],
|
|
13
|
+
"l": [1.0, 0.0, 0.0],
|
|
14
|
+
"u": [1.0, 0.7, 0.7],
|
|
15
|
+
"settings": {
|
|
16
|
+
"eps_abs": 1e-08,
|
|
17
|
+
"eps_rel": 1e-08,
|
|
18
|
+
"polishing": true,
|
|
19
|
+
"verbose": false
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# OSQP Python API Notes
|
|
2
|
+
|
|
3
|
+
Use this reference after the mathematical model has been converted to OSQP's
|
|
4
|
+
canonical QP form.
|
|
5
|
+
|
|
6
|
+
The bundled environment probe and JSON runner support `osqp>=1,<2`. Keep an
|
|
7
|
+
older OSQP reproduction in a separately pinned environment; do not interpret
|
|
8
|
+
successful imports from OSQP v0.6 as runner readiness.
|
|
9
|
+
|
|
10
|
+
## Source ledger
|
|
11
|
+
|
|
12
|
+
- Problem form and algorithm: <https://osqp.org/docs/solver/>
|
|
13
|
+
- Python interface: <https://osqp.org/docs/interfaces/python.html>
|
|
14
|
+
- Solver settings: <https://osqp.org/docs/interfaces/solver_settings.html>
|
|
15
|
+
- Status values and errors:
|
|
16
|
+
<https://osqp.org/docs/interfaces/status_values.html>
|
|
17
|
+
- Python installation: <https://osqp.org/docs/get_started/python.html>
|
|
18
|
+
- Migration from v0.6 to v1:
|
|
19
|
+
<https://osqp.org/docs/get_started/migration_guide.html>
|
|
20
|
+
- Code generation: <https://osqp.org/docs/codegen/index.html>
|
|
21
|
+
|
|
22
|
+
The URLs above are the official OSQP documentation and should be rechecked when
|
|
23
|
+
version-specific behavior matters.
|
|
24
|
+
|
|
25
|
+
## Setup and result
|
|
26
|
+
|
|
27
|
+
Use `P` and `A` as SciPy CSC sparse matrices, and `q`, `l`, and `u` as NumPy
|
|
28
|
+
vectors:
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
model = osqp.OSQP()
|
|
32
|
+
model.setup(P=P, q=q, A=A, l=l, u=u, verbose=False)
|
|
33
|
+
result = model.solve()
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
OSQP uses only the upper-triangular part of `P`. Reject materially asymmetric
|
|
37
|
+
input, explicitly canonicalize within-tolerance asymmetry, and use the same
|
|
38
|
+
symmetric matrix for setup and every independent check. The result exposes
|
|
39
|
+
`x`, `y`, `prim_inf_cert`, `dual_inf_cert`, and an `info` record containing the
|
|
40
|
+
status, objective, residuals, iterations, and timing.
|
|
41
|
+
|
|
42
|
+
## Repeated solves
|
|
43
|
+
|
|
44
|
+
Update vectors without a new setup:
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
model.update(q=q_new, l=l_new, u=u_new)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Update matrix values while preserving the original sparsity pattern:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
model.update(Px=Px_new, Ax=Ax_new)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
OSQP automatically warm starts from its previous solution. Supply an external
|
|
57
|
+
initial point only when it is intentional:
|
|
58
|
+
|
|
59
|
+
```python
|
|
60
|
+
model.warm_start(x=x0, y=y0)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Re-run `setup` if dimensions or sparsity patterns change.
|
|
64
|
+
|
|
65
|
+
## Settings discipline
|
|
66
|
+
|
|
67
|
+
Start from defaults and record non-default values. Common v1 settings include
|
|
68
|
+
`eps_abs`, `eps_rel`, `eps_prim_inf`, `eps_dual_inf`, `max_iter`,
|
|
69
|
+
`time_limit`, `polishing`, `warm_starting`, `adaptive_rho`, `rho`, and
|
|
70
|
+
`alpha`.
|
|
71
|
+
|
|
72
|
+
OSQP v1 renamed the v0.6 setting `polish` to `polishing` and `warm_start` to
|
|
73
|
+
`warm_starting`. Preserve the original OSQP version when reproducing old code;
|
|
74
|
+
do not silently mix names or compare timings across changed backends.
|
|
75
|
+
|
|
76
|
+
The small JSON runner rejects `verbose: true` to keep standard output as one
|
|
77
|
+
machine-readable JSON document. Treat its settings object as a controlled
|
|
78
|
+
runner interface, not as an unrestricted pass-through to OSQP.
|
|
79
|
+
|
|
80
|
+
## Interface choice
|
|
81
|
+
|
|
82
|
+
Use the native Python interface when exact `P`, `q`, `A`, `l`, `u`, update
|
|
83
|
+
behavior, or OSQP diagnostics matter. A modeling layer such as CVXPY can be
|
|
84
|
+
useful for expression conversion, but record the modeling-layer version, the
|
|
85
|
+
selected `OSQP` backend, solver options, and the final status. Do not assume a
|
|
86
|
+
modeling-layer status exposes every native OSQP diagnostic.
|
|
87
|
+
|
|
88
|
+
Use code generation only for a fixed family of QPs after the native model and
|
|
89
|
+
update contract have been validated. The official generator fixes dimensions;
|
|
90
|
+
matrix-parameter mode also assumes fixed sparsity patterns.
|
|
91
|
+
|
|
92
|
+
The bundled dense JSON runner accepts at most a 32 MiB input, `n <= 1000`, and
|
|
93
|
+
`2,000,000` logical entries across `P` and `A`. Larger models should use the
|
|
94
|
+
native sparse interface and application-specific storage rather than weakening
|
|
95
|
+
this review guard.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# OSQP Result Verification
|
|
2
|
+
|
|
3
|
+
Use these checks after reading the exact OSQP status. They are independent
|
|
4
|
+
recomputations, not substitutes for a derivation of the model.
|
|
5
|
+
|
|
6
|
+
## Feasible candidate
|
|
7
|
+
|
|
8
|
+
For the canonical QP and returned \(x,y\), recompute:
|
|
9
|
+
|
|
10
|
+
\[
|
|
11
|
+
r_{\mathrm{bound}}=
|
|
12
|
+
\max\{\|(l-Ax)_+\|_\infty,\|(Ax-u)_+\|_\infty\},
|
|
13
|
+
\]
|
|
14
|
+
|
|
15
|
+
\[
|
|
16
|
+
r_{\mathrm{stat}}=\|Px+q+A^\top y\|_\infty,
|
|
17
|
+
\qquad
|
|
18
|
+
f(x)=\tfrac12x^\top Px+q^\top x.
|
|
19
|
+
\]
|
|
20
|
+
|
|
21
|
+
Also check the normal-cone condition \(y\in N_{[l,u]}(Ax)\). With OSQP's dual
|
|
22
|
+
sign convention, use an activity tolerance and verify, row by row:
|
|
23
|
+
|
|
24
|
+
- \(y_i\approx0\) when no finite bound is active, including a free row;
|
|
25
|
+
- \(y_i\leq0\) at a lower bound that is not also an upper bound;
|
|
26
|
+
- \(y_i\geq0\) at an upper bound that is not also a lower bound;
|
|
27
|
+
- an equality row may have either sign.
|
|
28
|
+
|
|
29
|
+
Report the resulting normal-cone/complementarity residual separately. Primal
|
|
30
|
+
feasibility plus stationarity alone is not a complete optimality check.
|
|
31
|
+
|
|
32
|
+
Check \(P=P^\top\succeq0\) independently. Compare residuals against both the
|
|
33
|
+
requested tolerances and problem scale. OSQP's documented stopping tolerances
|
|
34
|
+
use absolute and relative terms; do not compare every scaled problem to one
|
|
35
|
+
unexplained hard-coded threshold.
|
|
36
|
+
|
|
37
|
+
If the application has stronger domain checks—dynamics defects in MPC, budget
|
|
38
|
+
balance in a portfolio, or physical units—run those as separate checks.
|
|
39
|
+
|
|
40
|
+
## Primal infeasibility
|
|
41
|
+
|
|
42
|
+
Reject a non-finite or numerically zero returned \(v\). Normalize a valid
|
|
43
|
+
direction as \(\hat v=v/\|v\|_\infty\), then check:
|
|
44
|
+
|
|
45
|
+
\[
|
|
46
|
+
\|A^\top \hat v\|_\infty\leq\epsilon_{\mathrm{prim\_inf}},
|
|
47
|
+
\qquad
|
|
48
|
+
u^\top \hat v_+ + l^\top \hat v_- < -\tau_{\mathrm{neg}}.
|
|
49
|
+
\]
|
|
50
|
+
|
|
51
|
+
Interpret the support expression with extended bounds. A positive component of
|
|
52
|
+
\(\hat v\) paired with \(u_i=+\infty\), or a negative component paired with
|
|
53
|
+
\(l_i=-\infty\), invalidates the direction beyond tolerance. Choose and record
|
|
54
|
+
the scale-aware strict-negative margin \(\tau_{\mathrm{neg}}>0\). Preserve the
|
|
55
|
+
raw certificate, normalized direction, norm, scale, and recomputed values.
|
|
56
|
+
|
|
57
|
+
## Dual infeasibility
|
|
58
|
+
|
|
59
|
+
Reject a non-finite or numerically zero returned \(s\). Normalize a valid
|
|
60
|
+
direction as \(\hat s=s/\|s\|_\infty\), then check:
|
|
61
|
+
|
|
62
|
+
\[
|
|
63
|
+
\|P\hat s\|_\infty\leq\epsilon_{\mathrm{dual\_inf}},
|
|
64
|
+
\qquad q^\top \hat s<-\tau_{\mathrm{neg}}.
|
|
65
|
+
\]
|
|
66
|
+
|
|
67
|
+
For each component of \(A\hat s\), also check:
|
|
68
|
+
|
|
69
|
+
- \( (As)_i\approx0 \) when both bounds are finite;
|
|
70
|
+
- \( (As)_i\geq0 \) when only the lower bound is finite;
|
|
71
|
+
- \( (As)_i\leq0 \) when only the upper bound is finite.
|
|
72
|
+
|
|
73
|
+
Rows open on both sides impose no direction restriction.
|
|
74
|
+
|
|
75
|
+
Choose and record a scale-aware \(\tau_{\mathrm{neg}}>0\). A tiny unnormalized
|
|
76
|
+
vector that only makes the expression negative by floating-point noise is not
|
|
77
|
+
an accepted infeasibility certificate.
|
|
78
|
+
|
|
79
|
+
## Status policy
|
|
80
|
+
|
|
81
|
+
The official status table states that inaccurate statuses satisfy conditions
|
|
82
|
+
with tolerances ten times larger than configured. Keep `solved inaccurate` and
|
|
83
|
+
inaccurate infeasibility classifications visibly tentative, even when a
|
|
84
|
+
downstream application elects to accept them.
|
|
85
|
+
|
|
86
|
+
Maximum-iteration, time-limit, interrupted, unsolved, and setup-error statuses
|
|
87
|
+
do not establish a solution or infeasibility conclusion. A `problem non convex`
|
|
88
|
+
status rejects the run, but the absence of that status does not prove that
|
|
89
|
+
\(P\succeq0\).
|
|
90
|
+
|
|
91
|
+
Official sources:
|
|
92
|
+
|
|
93
|
+
- <https://osqp.org/docs/solver/>
|
|
94
|
+
- <https://osqp.org/docs/interfaces/status_values.html>
|