@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.
Files changed (284) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE.md +35 -0
  4. package/README.md +108 -2
  5. package/README_EN.md +105 -0
  6. package/UPSTREAM.json +106 -0
  7. package/cordis.patch.yml +12 -0
  8. package/docs/capability-examples.md +581 -0
  9. package/docs/examples/README.md +32 -0
  10. package/docs/examples/bad_scan.md +10 -0
  11. package/docs/examples/broken-proof.lean +9 -0
  12. package/docs/examples/claims.md +7 -0
  13. package/docs/examples/knapsack.json +10 -0
  14. package/docs/examples/matrix.json +1 -0
  15. package/docs/examples/points.csv +21 -0
  16. package/docs/examples/qp.json +8 -0
  17. package/docs/examples/research-ws/project/GOALS.yaml +4 -0
  18. package/docs/examples/research-ws/workstreams/ws-lsa/report.md +13 -0
  19. package/docs/examples/research-ws/workstreams/ws-lsa/reviews/r1.json +1 -0
  20. package/docs/examples/research-ws/workstreams/ws-lsa/status.yaml +1 -0
  21. package/docs/examples/source.csv +4 -0
  22. package/lib/core/error.d.ts +20 -0
  23. package/lib/core/error.js +25 -0
  24. package/lib/core/gates.d.ts +42 -0
  25. package/lib/core/gates.js +217 -0
  26. package/lib/core/glossary.d.ts +101 -0
  27. package/lib/core/glossary.js +243 -0
  28. package/lib/core/graph.d.ts +118 -0
  29. package/lib/core/graph.js +460 -0
  30. package/lib/core/index.d.ts +120 -0
  31. package/lib/core/index.js +197 -0
  32. package/lib/core/paper.d.ts +163 -0
  33. package/lib/core/paper.js +73 -0
  34. package/lib/core/paths.d.ts +2 -0
  35. package/lib/core/paths.js +12 -0
  36. package/lib/core/sage.d.ts +61 -0
  37. package/lib/core/sage.js +212 -0
  38. package/lib/core/skills.d.ts +11 -0
  39. package/lib/core/skills.js +110 -0
  40. package/lib/tool/index.d.ts +21 -0
  41. package/lib/tool/index.js +1144 -0
  42. package/package.json +92 -4
  43. package/skills/after-ocr/SKILL.md +123 -0
  44. package/skills/after-ocr/references/audit-schema.md +94 -0
  45. package/skills/after-ocr/references/error-taxonomy.md +179 -0
  46. package/skills/after-ocr/scripts/merge_audit_logs.py +329 -0
  47. package/skills/after-ocr/scripts/scan_markdown_ocr.py +350 -0
  48. package/skills/after-ocr/tests/test_scripts.py +84 -0
  49. package/skills/discover-math-problems/SKILL.md +115 -0
  50. package/skills/discover-math-problems/references/artifact-contract.md +93 -0
  51. package/skills/discover-math-problems/references/autonomous-research-protocol.md +86 -0
  52. package/skills/discover-math-problems/references/conjecture-generation-protocol.md +63 -0
  53. package/skills/discover-math-problems/references/extremal-graph-variants.md +53 -0
  54. package/skills/graph-theory-paper-reading/SKILL.md +600 -0
  55. package/skills/invariant-computation/SKILL.md +169 -0
  56. package/skills/invariant-computation/examples/invariant_summary.example.json +51 -0
  57. package/skills/invariant-computation/manifest.yaml +46 -0
  58. package/skills/invariant-computation/references/INDEX.md +20 -0
  59. package/skills/invariant-computation/references/failure_modes.md +40 -0
  60. package/skills/invariant-computation/references/method_route_map.md +177 -0
  61. package/skills/invariant-computation/references/source_notes.md +19 -0
  62. package/skills/invariant-computation/references/tool_catalog.md +65 -0
  63. package/skills/invariant-computation/references/validation_checks.md +52 -0
  64. package/skills/invariant-computation/schema/invariant_summary.schema.json +260 -0
  65. package/skills/lean-formalization/SKILL.md +111 -0
  66. package/skills/lean-formalization/lean-runtime/config/env.example +5 -0
  67. package/skills/lean-formalization/lean-runtime/config/lean_agent.example.toml +28 -0
  68. package/skills/lean-formalization/lean-runtime/config/numina_runtime.example.toml +12 -0
  69. package/skills/lean-formalization/lean-runtime/examples/smoke/LocalLeanSmoke.lean +7 -0
  70. package/skills/lean-formalization/lean-runtime/prompts/complete_sorries.md +3 -0
  71. package/skills/lean-formalization/lean-runtime/prompts/formalize_statement.md +3 -0
  72. package/skills/lean-formalization/lean-runtime/prompts/prove_theorem.md +3 -0
  73. package/skills/lean-formalization/lean-runtime/prompts/repair_lean_file.md +3 -0
  74. package/skills/lean-formalization/lean-runtime/references/backend_adapter_checklist.md +36 -0
  75. package/skills/lean-formalization/lean-runtime/references/direct_lean_workflow.md +48 -0
  76. package/skills/lean-formalization/lean-runtime/references/failure_taxonomy.md +17 -0
  77. package/skills/lean-formalization/lean-runtime/references/interactive_orchestration.md +83 -0
  78. package/skills/lean-formalization/lean-runtime/references/lean_agent_capability_map.md +116 -0
  79. package/skills/lean-formalization/lean-runtime/references/lean_lsp_mcp_adapter.md +219 -0
  80. package/skills/lean-formalization/lean-runtime/references/lean_runtime_configuration.md +92 -0
  81. package/skills/lean-formalization/lean-runtime/references/numina_reverse_analysis.md +80 -0
  82. package/skills/lean-formalization/lean-runtime/references/numina_runtime.md +41 -0
  83. package/skills/lean-formalization/lean-runtime/references/numina_subagent_troubleshooting.md +77 -0
  84. package/skills/lean-formalization/lean-runtime/references/review_checklist.md +10 -0
  85. package/skills/lean-formalization/lean-runtime/references/specialist_agent_patterns.md +65 -0
  86. package/skills/lean-formalization/lean-runtime/schemas/config.schema.json +12 -0
  87. package/skills/lean-formalization/lean-runtime/schemas/result.schema.json +33 -0
  88. package/skills/lean-formalization/lean-runtime/schemas/task.schema.json +30 -0
  89. package/skills/lean-formalization/lean-runtime/scripts/ai4m_lean.py +222 -0
  90. package/skills/lean-formalization/lean-runtime/scripts/check_lean_project.py +134 -0
  91. package/skills/lean-formalization/lean-runtime/scripts/common.py +296 -0
  92. package/skills/lean-formalization/lean-runtime/scripts/configure_lean.py +222 -0
  93. package/skills/lean-formalization/lean-runtime/scripts/detect_sorry.py +49 -0
  94. package/skills/lean-formalization/lean-runtime/scripts/direct_task.py +100 -0
  95. package/skills/lean-formalization/lean-runtime/scripts/extract_minimal_failure.py +74 -0
  96. package/skills/lean-formalization/lean-runtime/scripts/numina_runtime.py +414 -0
  97. package/skills/lean-formalization/lean-runtime/scripts/smoke_test.py +75 -0
  98. package/skills/lean-formalization/lean-runtime/scripts/tool_status.py +79 -0
  99. package/skills/lean-formalization/lean-runtime/scripts/validate_patch.py +81 -0
  100. package/skills/lean-formalization/lean-runtime/scripts/verify_delivery.py +484 -0
  101. package/skills/lean-formalization/lean-runtime/tests/fixtures/after_bad.lean +4 -0
  102. package/skills/lean-formalization/lean-runtime/tests/fixtures/after_statement_changed.lean +4 -0
  103. package/skills/lean-formalization/lean-runtime/tests/fixtures/before.lean +4 -0
  104. package/skills/lean-formalization/lean-runtime/tests/fixtures/failure.lean +7 -0
  105. package/skills/lean-formalization/lean-runtime/tests/test_check_lean_project.py +59 -0
  106. package/skills/lean-formalization/lean-runtime/tests/test_cli.py +377 -0
  107. package/skills/lean-formalization/lean-runtime/tests/test_common_config.py +84 -0
  108. package/skills/lean-formalization/lean-runtime/tests/test_configure_lean.py +138 -0
  109. package/skills/lean-formalization/lean-runtime/tests/test_detect_sorry.py +24 -0
  110. package/skills/lean-formalization/lean-runtime/tests/test_direct_task.py +69 -0
  111. package/skills/lean-formalization/lean-runtime/tests/test_numina_runtime.py +168 -0
  112. package/skills/lean-formalization/lean-runtime/tests/test_validate_patch.py +29 -0
  113. package/skills/lean-setup/SKILL.md +99 -0
  114. package/skills/least-squares/README.md +85 -0
  115. package/skills/least-squares/SKILL.md +613 -0
  116. package/skills/least-squares/examples.md +380 -0
  117. package/skills/math-beamer/SKILL.md +325 -0
  118. package/skills/math-beamer/references/build-and-layout-audit.md +63 -0
  119. package/skills/math-beamer/references/math-domain-patterns.md +56 -0
  120. package/skills/math-beamer/references/template-policy.md +43 -0
  121. package/skills/math-beamer/references/template-source-index.md +51 -0
  122. package/skills/math-beamer/templates/catalog.yaml +235 -0
  123. package/skills/math-beamer/templates/packs/algebra-number-theory-talk/main.tex +45 -0
  124. package/skills/math-beamer/templates/packs/algebra-number-theory-talk/template.yaml +9 -0
  125. package/skills/math-beamer/templates/packs/algorithm-talk/main.tex +43 -0
  126. package/skills/math-beamer/templates/packs/algorithm-talk/template.yaml +9 -0
  127. package/skills/math-beamer/templates/packs/analysis-core-talk/main.tex +49 -0
  128. package/skills/math-beamer/templates/packs/analysis-core-talk/template.yaml +19 -0
  129. package/skills/math-beamer/templates/packs/backup-heavy-talk/main.tex +40 -0
  130. package/skills/math-beamer/templates/packs/backup-heavy-talk/template.yaml +9 -0
  131. package/skills/math-beamer/templates/packs/beamerposter-a0/main.tex +45 -0
  132. package/skills/math-beamer/templates/packs/beamerposter-a0/template.yaml +12 -0
  133. package/skills/math-beamer/templates/packs/combinatorics-graph-talk/main.tex +53 -0
  134. package/skills/math-beamer/templates/packs/combinatorics-graph-talk/template.yaml +18 -0
  135. package/skills/math-beamer/templates/packs/control-systems-talk/main.tex +51 -0
  136. package/skills/math-beamer/templates/packs/control-systems-talk/template.yaml +18 -0
  137. package/skills/math-beamer/templates/packs/course-lecture-zh/main.tex +43 -0
  138. package/skills/math-beamer/templates/packs/course-lecture-zh/template.yaml +9 -0
  139. package/skills/math-beamer/templates/packs/data-experiment-results/main.tex +45 -0
  140. package/skills/math-beamer/templates/packs/data-experiment-results/template.yaml +9 -0
  141. package/skills/math-beamer/templates/packs/dynamical-systems-talk/main.tex +42 -0
  142. package/skills/math-beamer/templates/packs/dynamical-systems-talk/template.yaml +9 -0
  143. package/skills/math-beamer/templates/packs/geometry-topology-talk/main.tex +43 -0
  144. package/skills/math-beamer/templates/packs/geometry-topology-talk/template.yaml +9 -0
  145. package/skills/math-beamer/templates/packs/information-coding-crypto-talk/main.tex +49 -0
  146. package/skills/math-beamer/templates/packs/information-coding-crypto-talk/template.yaml +18 -0
  147. package/skills/math-beamer/templates/packs/logic-foundations-category-talk/main.tex +51 -0
  148. package/skills/math-beamer/templates/packs/logic-foundations-category-talk/template.yaml +18 -0
  149. package/skills/math-beamer/templates/packs/numerical-analysis-talk/main.tex +51 -0
  150. package/skills/math-beamer/templates/packs/numerical-analysis-talk/template.yaml +9 -0
  151. package/skills/math-beamer/templates/packs/optimization-talk/main.tex +58 -0
  152. package/skills/math-beamer/templates/packs/optimization-talk/template.yaml +9 -0
  153. package/skills/math-beamer/templates/packs/pde-analysis-talk/main.tex +49 -0
  154. package/skills/math-beamer/templates/packs/pde-analysis-talk/template.yaml +9 -0
  155. package/skills/math-beamer/templates/packs/probability-statistics-talk/main.tex +52 -0
  156. package/skills/math-beamer/templates/packs/probability-statistics-talk/template.yaml +9 -0
  157. package/skills/math-beamer/templates/packs/reading-group-paper/main.tex +46 -0
  158. package/skills/math-beamer/templates/packs/reading-group-paper/template.yaml +9 -0
  159. package/skills/math-beamer/templates/packs/seminar-minimal-en/main.tex +60 -0
  160. package/skills/math-beamer/templates/packs/seminar-minimal-en/template.yaml +13 -0
  161. package/skills/math-beamer/templates/packs/seminar-minimal-zh/main.tex +60 -0
  162. package/skills/math-beamer/templates/packs/seminar-minimal-zh/template.yaml +13 -0
  163. package/skills/math-beamer/templates/packs/theorem-proof-talk/main.tex +60 -0
  164. package/skills/math-beamer/templates/packs/theorem-proof-talk/template.yaml +9 -0
  165. package/skills/math-beamer/templates/packs/thesis-defense/main.tex +42 -0
  166. package/skills/math-beamer/templates/packs/thesis-defense/template.yaml +9 -0
  167. package/skills/math-beamer/templates/packs/workshop-tutorial/main.tex +32 -0
  168. package/skills/math-beamer/templates/packs/workshop-tutorial/template.yaml +9 -0
  169. package/skills/math-beamer/templates/preview-gallery.md +32 -0
  170. package/skills/math-beamer/templates/previews/algebra-number-theory-talk-content.png +0 -0
  171. package/skills/math-beamer/templates/previews/algebra-number-theory-talk-cover.png +0 -0
  172. package/skills/math-beamer/templates/previews/algorithm-talk-content.png +0 -0
  173. package/skills/math-beamer/templates/previews/algorithm-talk-cover.png +0 -0
  174. package/skills/math-beamer/templates/previews/analysis-core-talk-content.png +0 -0
  175. package/skills/math-beamer/templates/previews/analysis-core-talk-cover.png +0 -0
  176. package/skills/math-beamer/templates/previews/backup-heavy-talk-content.png +0 -0
  177. package/skills/math-beamer/templates/previews/backup-heavy-talk-cover.png +0 -0
  178. package/skills/math-beamer/templates/previews/beamerposter-a0-content.png +0 -0
  179. package/skills/math-beamer/templates/previews/beamerposter-a0-cover.png +0 -0
  180. package/skills/math-beamer/templates/previews/combinatorics-graph-talk-content.png +0 -0
  181. package/skills/math-beamer/templates/previews/combinatorics-graph-talk-cover.png +0 -0
  182. package/skills/math-beamer/templates/previews/control-systems-talk-content.png +0 -0
  183. package/skills/math-beamer/templates/previews/control-systems-talk-cover.png +0 -0
  184. package/skills/math-beamer/templates/previews/course-lecture-zh-content.png +0 -0
  185. package/skills/math-beamer/templates/previews/course-lecture-zh-cover.png +0 -0
  186. package/skills/math-beamer/templates/previews/data-experiment-results-content.png +0 -0
  187. package/skills/math-beamer/templates/previews/data-experiment-results-cover.png +0 -0
  188. package/skills/math-beamer/templates/previews/dynamical-systems-talk-content.png +0 -0
  189. package/skills/math-beamer/templates/previews/dynamical-systems-talk-cover.png +0 -0
  190. package/skills/math-beamer/templates/previews/geometry-topology-talk-content.png +0 -0
  191. package/skills/math-beamer/templates/previews/geometry-topology-talk-cover.png +0 -0
  192. package/skills/math-beamer/templates/previews/information-coding-crypto-talk-content.png +0 -0
  193. package/skills/math-beamer/templates/previews/information-coding-crypto-talk-cover.png +0 -0
  194. package/skills/math-beamer/templates/previews/logic-foundations-category-talk-content.png +0 -0
  195. package/skills/math-beamer/templates/previews/logic-foundations-category-talk-cover.png +0 -0
  196. package/skills/math-beamer/templates/previews/numerical-analysis-talk-content.png +0 -0
  197. package/skills/math-beamer/templates/previews/numerical-analysis-talk-cover.png +0 -0
  198. package/skills/math-beamer/templates/previews/optimization-talk-content.png +0 -0
  199. package/skills/math-beamer/templates/previews/optimization-talk-cover.png +0 -0
  200. package/skills/math-beamer/templates/previews/pde-analysis-talk-content.png +0 -0
  201. package/skills/math-beamer/templates/previews/pde-analysis-talk-cover.png +0 -0
  202. package/skills/math-beamer/templates/previews/probability-statistics-talk-content.png +0 -0
  203. package/skills/math-beamer/templates/previews/probability-statistics-talk-cover.png +0 -0
  204. package/skills/math-beamer/templates/previews/reading-group-paper-content.png +0 -0
  205. package/skills/math-beamer/templates/previews/reading-group-paper-cover.png +0 -0
  206. package/skills/math-beamer/templates/previews/seminar-minimal-en-content.png +0 -0
  207. package/skills/math-beamer/templates/previews/seminar-minimal-en-cover.png +0 -0
  208. package/skills/math-beamer/templates/previews/seminar-minimal-zh-content.png +0 -0
  209. package/skills/math-beamer/templates/previews/seminar-minimal-zh-cover.png +0 -0
  210. package/skills/math-beamer/templates/previews/theorem-proof-talk-content.png +0 -0
  211. package/skills/math-beamer/templates/previews/theorem-proof-talk-cover.png +0 -0
  212. package/skills/math-beamer/templates/previews/thesis-defense-content.png +0 -0
  213. package/skills/math-beamer/templates/previews/thesis-defense-cover.png +0 -0
  214. package/skills/math-beamer/templates/previews/workshop-tutorial-content.png +0 -0
  215. package/skills/math-beamer/templates/previews/workshop-tutorial-cover.png +0 -0
  216. package/skills/math-beamer/templates/review-report.md +54 -0
  217. package/skills/math-beamer/templates/slide-source-ledger.md +22 -0
  218. package/skills/math-beamer/templates/source-packet.md +50 -0
  219. package/skills/math-glossary/SKILL.md +347 -0
  220. package/skills/math-glossary/references/glossary-schema.md +71 -0
  221. package/skills/math-glossary/references/glossary-usage-guide.md +176 -0
  222. package/skills/math-glossary/references/glossary-web-template.md +127 -0
  223. package/skills/math-glossary/references/glossary.schema.json +76 -0
  224. package/skills/math-glossary/references/user-manual.md +435 -0
  225. package/skills/math-glossary/requirements-ai.txt +3 -0
  226. package/skills/math-glossary/requirements.txt +3 -0
  227. package/skills/math-glossary/scripts/glossary_backup.py +42 -0
  228. package/skills/math-glossary/scripts/glossary_build.py +467 -0
  229. package/skills/math-glossary/scripts/glossary_enrich_examples.py +283 -0
  230. package/skills/math-glossary/scripts/glossary_export.py +333 -0
  231. package/skills/math-glossary/scripts/glossary_web.py +1265 -0
  232. package/skills/math-paper-reading/README.md +163 -0
  233. package/skills/math-paper-reading/SKILL.md +48 -0
  234. package/skills/math-paper-reading/agent_router.md +36 -0
  235. package/skills/math-paper-reading/references/proof_pattern_taxonomy.md +123 -0
  236. package/skills/math-paper-reading/references/quality_rubric.md +36 -0
  237. package/skills/math-paper-reading/skill_base.md +627 -0
  238. package/skills/math-paper-reading/skill_literature_search.md +866 -0
  239. package/skills/math-paper-reading/skill_paper_deep_read.md +1024 -0
  240. package/skills/math-paper-reading/skill_pathway_proof.md +718 -0
  241. package/skills/math-paper-reading/skill_reference_manager.md +746 -0
  242. package/skills/matlab-runner/SKILL.md +217 -0
  243. package/skills/matlab-runner/examples/README.md +33 -0
  244. package/skills/matlab-runner/examples/matrix_report.m +28 -0
  245. package/skills/matlab-runner/examples/plot_damped_sine.m +64 -0
  246. package/skills/matlab-runner/examples/test_vector_norm.m +12 -0
  247. package/skills/matlab-runner/references/client-setup.md +24 -0
  248. package/skills/matlab-runner/references/file-session-safety.md +86 -0
  249. package/skills/matlab-runner/references/numerical-safety.md +126 -0
  250. package/skills/matlab-runner/references/resource-safety.md +125 -0
  251. package/skills/mixed-integer-programming/SKILL.md +119 -0
  252. package/skills/mixed-integer-programming/lp-examples.md +251 -0
  253. package/skills/mixed-integer-programming/mip-examples-verified.md +118 -0
  254. package/skills/open-problem-research-pipeline/SKILL.md +76 -0
  255. package/skills/open-problem-research-pipeline/skill_literature_analysis.md +201 -0
  256. package/skills/open-problem-research-pipeline/skill_literature_proof_framework.md +206 -0
  257. package/skills/open-problem-research-pipeline/skill_literature_search.md +172 -0
  258. package/skills/open-problem-research-pipeline/skill_qskill.md +177 -0
  259. package/skills/osqp-solver/SKILL.md +245 -0
  260. package/skills/osqp-solver/references/citation.md +25 -0
  261. package/skills/osqp-solver/references/dual-infeasible-example.json +14 -0
  262. package/skills/osqp-solver/references/feasible-example.json +21 -0
  263. package/skills/osqp-solver/references/primal-infeasible-example.json +17 -0
  264. package/skills/osqp-solver/references/python-api.md +95 -0
  265. package/skills/osqp-solver/references/verification.md +94 -0
  266. package/skills/osqp-solver/scripts/check_osqp_environment.py +120 -0
  267. package/skills/osqp-solver/scripts/solve_qp.py +943 -0
  268. package/skills/paper-writing/SKILL.md +115 -0
  269. package/skills/paper-writing/skill_claim_evidence_ledger.md +55 -0
  270. package/skills/paper-writing/skill_formula_environment_and_readability.md +41 -0
  271. package/skills/paper-writing/skill_latex_build_and_layout_audit.md +73 -0
  272. package/skills/paper-writing/skill_notation_and_variable_consistency.md +42 -0
  273. package/skills/paper-writing/skill_paper_skeleton_and_logical_architecture.md +54 -0
  274. package/skills/paper-writing/skill_proof_obligation_and_assumption_audit.md +57 -0
  275. package/skills/paper-writing/templates/claim-evidence-ledger.md +23 -0
  276. package/skills/paper-writing/templates/proof-obligation-ledger.md +22 -0
  277. package/skills/paper-writing/templates/rapid-prototype-paper-skeleton.md +46 -0
  278. package/skills/paper-writing/templates/source-packet.md +37 -0
  279. package/skills/paper-writing/templates/submission-readiness.md +41 -0
  280. package/skills/proof-blueprint-review/SKILL.md +129 -0
  281. package/skills/proof-blueprint-review/references/agent-mediated-proof-protocol.md +57 -0
  282. package/skills/proof-blueprint-review/references/generation-agent.md +45 -0
  283. package/skills/proof-blueprint-review/references/proof-acceptance-contract.md +41 -0
  284. package/skills/proof-blueprint-review/references/verification-agent.md +37 -0
@@ -0,0 +1,125 @@
1
+ # Resource Safety Reference
2
+
3
+ > Path note: this file is addressed from `SKILL.md` as `./references/resource-safety.md` and must be resolved relative to the directory containing that loaded `SKILL.md`.
4
+
5
+ Load this reference only for tasks involving memory, large arrays, Monte Carlo simulations, batching, long runtimes, large outputs, spectral computations, or resource-feasibility decisions.
6
+
7
+ ## Assess before allocating
8
+
9
+ Before a potentially large computation:
10
+
11
+ 1. calculate the minimum primary-data size;
12
+ 2. identify the computational order and output volume;
13
+ 3. determine whether MATLAB environment measurements are required;
14
+ 4. distinguish primary storage from additional working memory;
15
+ 5. keep runtime feasibility separate from memory feasibility.
16
+
17
+ Do not create data or start a computation when a lightweight assessment already indicates serious risk of exhausting memory, freezing the system, or producing impractically large work.
18
+
19
+ ## Exact storage versus peak working memory
20
+
21
+ Exact storage may be reported only for arrays whose element count and data type are known.
22
+
23
+ For example, `N` two-dimensional double points require at least:
24
+
25
+ ```text
26
+ N × 2 × 8 bytes
27
+ ```
28
+
29
+ This is the coordinate storage only. Peak working memory may additionally include:
30
+
31
+ - temporary arithmetic arrays;
32
+ - logical masks;
33
+ - copies created by expression evaluation;
34
+ - solver workspaces;
35
+ - returned results;
36
+ - file buffers and serialization overhead.
37
+
38
+ Do not label one input array or one batch's coordinates as the total peak memory. Unless measured or rigorously bounded, describe peak working memory as unmeasured and larger than the known primary storage.
39
+
40
+ ## Official Windows MATLAB memory inspection
41
+
42
+ When the user asks for `MaxPossibleArrayBytes`, `MemAvailableAllArrays`, `MemUsedMATLAB`, or a Windows MATLAB memory-safety decision, use the official interface:
43
+
44
+ ```matlab
45
+ m = memory;
46
+ ```
47
+
48
+ Read these fields from the returned MATLAB structure:
49
+
50
+ - `m.MaxPossibleArrayBytes`
51
+ - `m.MemAvailableAllArrays`
52
+ - `m.MemUsedMATLAB`
53
+
54
+ Do not substitute:
55
+
56
+ - Java preferences;
57
+ - `ArraySizeLimit`;
58
+ - undocumented internal APIs;
59
+ - registry or environment values;
60
+ - static configuration limits.
61
+
62
+ `MaxPossibleArrayBytes` is the upper bound MATLAB reports for the largest array it can create at that time. It is not physical RAM.
63
+
64
+ Have MATLAB print raw bytes and requested decimal-GB and binary-GiB conversions in the same successful lightweight call.
65
+
66
+ If a required field is missing, empty, zero, nonfinite, or implausible:
67
+
68
+ 1. confirm the official `memory` interface and correct field were used;
69
+ 2. run one minimal official recheck when safe;
70
+ 3. if no valid value is obtained, report that the environment measurement is unavailable;
71
+ 4. do not compute a misleading ratio or infer “unlimited” or “not configured.”
72
+
73
+ ## Units
74
+
75
+ Use consistent labels:
76
+
77
+ - decimal GB: bytes divided by `1e9`;
78
+ - binary GiB: bytes divided by `2^30`.
79
+
80
+ Prefer MATLAB-generated conversions in the same call. Copy the printed values and labels accurately.
81
+
82
+ ## Batching and Monte Carlo
83
+
84
+ A chunked design can make memory usage bounded without making total work small.
85
+
86
+ - State the exact coordinate storage for one batch when known.
87
+ - State that derived arrays and temporary values add unmeasured overhead unless measured.
88
+ - Keep only accumulators when the task does not require retaining all points.
89
+ - Do not run demonstration batching code when the user asked only to see it.
90
+ - Do not give a concrete per-batch or total runtime without an authorized benchmark or other defensible evidence.
91
+ - “Memory-bounded” is not the same as “safe,” “fast,” or “practical.”
92
+
93
+ ## Large outputs
94
+
95
+ Avoid printing or returning complete large arrays. Prefer:
96
+
97
+ - dimensions;
98
+ - minima and maxima;
99
+ - means and standard deviations with stated conventions;
100
+ - selected entries;
101
+ - residuals;
102
+ - counts and checksums;
103
+ - saved-file paths when output was explicitly requested.
104
+
105
+ ## Spectral and sparse alternatives
106
+
107
+ Suggest alternatives only when mathematically appropriate:
108
+
109
+ - sparse storage for genuinely sparse data;
110
+ - operator forms when the algorithm supports them;
111
+ - `eigs` for a small subset of eigenvalues;
112
+ - chunked accumulation when all samples need not be retained;
113
+ - lower precision only when accuracy requirements allow it.
114
+
115
+ Do not imply that streaming can recover the complete spectrum of an arbitrary dense matrix, or that sparse storage helps dense random coordinates.
116
+
117
+ ## Runtime claims
118
+
119
+ No concrete runtime estimate is supported merely because a loop count is known.
120
+
121
+ If runtime matters:
122
+
123
+ - run a small benchmark only with user authorization;
124
+ - make clear that extrapolation can be unreliable;
125
+ - otherwise state that the total work is large and runtime was not measured.
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: mixed-integer-programming
3
+ description: "Models and solves mixed-integer linear programs (MILP), including binary, integer, and continuous decision variables with linear objectives and constraints: knapsack, assignment, siting, covering, scheduling, TSP-style routing. Verified examples in mip-examples-verified.md (PuLP+CBC tested); LP-basics in lp-examples.md. Author: 李爽夕. In DSH check the Python stack first (verymath_python_check)."
4
+ metadata:
5
+ author: "李爽夕"
6
+ ---
7
+
8
+ <!-- 作者:李爽夕 -->
9
+
10
+ # 混合整数规划(Mixed-Integer Programming, MIP)求解
11
+
12
+ ## DSH Integration Notes
13
+
14
+ - 本技能由 `@louisultra/dsh-verymath` 插件提供。示例文件:
15
+ `mip-examples-verified.md`(背包/指派,PuLP+CBC **已实测**,解已人工核对)与
16
+ `lp-examples.md`(连续 LP 基础,恢复自上游历史版本 191a4e3^)。
17
+ - 上游原 examples.md 是 SOCP 示例的错版拷贝(CBLIB 头 + cvx.SOC 内容,与 README 宣称的
18
+ 8 个 MIP 示例不符)——本插件以实测文件替代;README 中"100 问题 100% 通过率"等基准
19
+ 数字无复现脚本背书,**引用时不采信**。
20
+ - 求解器默认 PuLP 内置 CBC(开源免许可);安装前先 `verymath_python_check`,
21
+ `pip install pulp` 需用户批准。PuLP 4.x API 与 2.x 不兼容(LpVariable 不再收 cat 参数),
22
+ 示例代码按 2.8 写。
23
+
24
+ ## 适用场景
25
+
26
+ - **混合整数线性规划**:线性目标、线性约束,部分或全部变量为整数。
27
+ - **二进制决策问题**:选址、指派、覆盖、启停、固定费用建模。
28
+ - **组合优化建模**:背包、TSP、排产、车辆路径、网络设计等。
29
+ - **可线性化问题**:逻辑约束、Big-M、indicator、SOS1/SOS2 等。
30
+
31
+ **输入**:可以是自然语言/应用题,也可以是矩阵、JSON、已有模型代码或求解器报错。
32
+
33
+ ## Quick Start(先做这个)
34
+
35
+ 按下面清单执行并在回答中保留结构。环境准备必须先于求解。
36
+
37
+ - [ ] **求解器选择与环境准备**:
38
+ 1. 本建模任务先确认问题类型为 MIP/MILP,并明确用户或当前任务已选定的求解器和接口。
39
+ 2. 目标需要安装或配置时,将求解器名称、接口、Python 环境及实际报错交给 `../or-solver/SKILL.md`;该 skill 只配置指定目标。
40
+ 3. 配置后由本任务继续求解;配置失败时,由本任务决定下一步,必要时走 GitHub 搜索路径。
41
+ - [ ] 路径判断:用户给的是自然语言、矩阵/JSON、代码,还是要求从 GitHub 找代码。
42
+ - [ ] 符号化:列变量、变量类型、目标、约束和单位。
43
+ - [ ] 数值化:给出矩阵、JSON,或直接用求解器 API 建模。
44
+ - [ ] 求解并报告:状态、目标值、变量值、MIP gap、求解时间。
45
+ - [ ] 验证:检查约束可行性和整数变量取值。
46
+
47
+ ## 执行流程(三条路径)
48
+
49
+ ```mermaid
50
+ flowchart LR
51
+ A[Matrix_or_JSON]
52
+ B[Natural_language]
53
+ C[GitHub_search]
54
+ A --> A1[Build_or_solve_mip]
55
+ B --> B1[Restate]
56
+ B1 --> B2[Clarify_or_assume]
57
+ B2 --> B3[Symbolic_model]
58
+ B3 --> B4[Numeric_or_solver_API]
59
+ B4 --> B5[Solve_and_report]
60
+ A1 --> B5
61
+ C --> C1[Search_GitHub_for_MIP_code]
62
+ C1 --> C2[Fetch_and_adapt_code]
63
+ C2 --> C3[Run_and_report]
64
+ ```
65
+
66
+ ### 路径 A:已有矩阵、JSON 或模型
67
+
68
+ 1. 核对维度、变量类型、上下界、约束方向和目标方向。
69
+ 2. 优先复用已有建模结构,避免把稀疏模型强行转成稠密矩阵。
70
+ 3. 使用可用求解器求解,并保存求解器状态和日志要点。
71
+
72
+ ### 路径 B:自然语言 / 应用题
73
+
74
+ 用户未给数字矩阵时,不要先索要 JSON。按下面顺序推进:
75
+
76
+ | 步骤 | 内容 |
77
+ | --- | --- |
78
+ | 1. 重述 | 用一两句话复述题意,便于用户确认。 |
79
+ | 2. 变量 | 列出变量名称、含义、单位、类型(binary/integer/continuous)。 |
80
+ | 3. 模型 | 写出目标函数和约束,并标明 `<=` / `>=` / `=`。 |
81
+ | 4. 求解 | 建模求解,报告目标值、变量值、gap 和状态。 |
82
+ | 5. 解释 | 用 1-2 句解释业务含义,必要时说明假设。 |
83
+
84
+ ### 路径 C:GitHub 搜索开源代码
85
+
86
+ 当本地无可用求解器,或用户明确要求从 GitHub 找代码时,搜索:
87
+
88
+ ```text
89
+ site:github.com mixed integer programming solver python <problem feature>
90
+ ```
91
+
92
+ 优先选择近期维护、有 README、纯 Python 或主流求解器接口的项目。抓取
93
+ README 和关键文件后,适配用户数据并注明来源。
94
+
95
+ ## 输出模板(推荐)
96
+
97
+ ```markdown
98
+ ### 环境与依赖
99
+ - Python 版本:...
100
+ - 可用求解器:...
101
+ - 选用求解器:...
102
+
103
+ ### 问题重述
104
+ ...
105
+
106
+ ### 符号化模型
107
+ - 决策变量:...
108
+ - 目标函数:...
109
+ - 约束:...
110
+
111
+ ### 求解结果
112
+ - status: ...
113
+ - objective: ...
114
+ - variables: ...
115
+ - mip_gap: ...
116
+
117
+ ### 验证与解释
118
+ ...
119
+ ```
@@ -0,0 +1,251 @@
1
+ # 线性规划参考示例
2
+
3
+ <!-- 作者:李爽夕 -->
4
+
5
+ > 模型:deepseek-v4-pro
6
+
7
+ ---
8
+
9
+ ## 示例 1:两产品生产(max)
10
+
11
+ ### 问题描述
12
+
13
+ 工厂生产产品 A、B。每单位利润分别为 3 与 5。每单位 A 消耗原料 1、工时 2;每单位 B 消耗原料 2、工时 1。原料总量不超过 100,工时总量不超过 120;产量非负。求利润最大。
14
+
15
+ ### 符号化模型
16
+
17
+ - 决策变量:`x1`(A 产量)、`x2`(B 产量),均 `>= 0`
18
+ - 目标函数:`max 3*x1 + 5*x2`
19
+ - 约束:
20
+ - 原料:`x1 + 2*x2 <= 100`
21
+ - 工时:`2*x1 + x2 <= 120`
22
+
23
+ ```json
24
+ {
25
+ "sense": "max",
26
+ "c": [3, 5],
27
+ "A_ub": [[1, 2], [2, 1]],
28
+ "b_ub": [100, 120],
29
+ "bounds": [[0, null], [0, null]]
30
+ }
31
+ ```
32
+
33
+ ### 代码实现
34
+
35
+ ```python
36
+ from scipy.optimize import linprog
37
+
38
+ c = [-3, -5] # linprog 默认最小化,取负
39
+ A_ub = [[1, 2], [2, 1]]
40
+ b_ub = [100, 120]
41
+
42
+ result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=(0, None), method='highs')
43
+ print(f"status: {result.status}, obj: {-result.fun}, x: {result.x}")
44
+ ```
45
+
46
+ ---
47
+
48
+ ## 示例 2:运输分配(min)
49
+
50
+ ### 问题描述
51
+
52
+ 仓库 W1、W2 向门店 S1、S2 供货。单位运费:W1→S1=4,W1→S2=6;W2→S1=5,W2→S2=3。W1 最多供 80,W2 最多供 70;S1 至少需 60,S2 至少需 50。求最低运费。
53
+
54
+ ### 符号化模型
55
+
56
+ - 决策变量:`x11, x12, x21, x22 >= 0`
57
+ - 目标函数:`min 4*x11 + 6*x12 + 5*x21 + 3*x22`
58
+ - 约束:
59
+ - 供给:`x11 + x12 <= 80`,`x21 + x22 <= 70`
60
+ - 需求:`x11 + x21 >= 60`,`x12 + x22 >= 50`
61
+
62
+ ```json
63
+ {
64
+ "sense": "min",
65
+ "c": [4, 6, 5, 3],
66
+ "A_ub": [[1, 1, 0, 0], [0, 0, 1, 1], [-1, 0, -1, 0], [0, -1, 0, -1]],
67
+ "b_ub": [80, 70, -60, -50],
68
+ "bounds": [[0, null], [0, null], [0, null], [0, null]]
69
+ }
70
+ ```
71
+
72
+ ### 代码实现
73
+
74
+ ```python
75
+ from scipy.optimize import linprog
76
+
77
+ c = [4, 6, 5, 3]
78
+ A_ub = [[1, 1, 0, 0], [0, 0, 1, 1], [-1, 0, -1, 0], [0, -1, 0, -1]]
79
+ b_ub = [80, 70, -60, -50]
80
+
81
+ result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=(0, None), method='highs')
82
+ print(f"status: {result.status}, obj: {result.fun}, x: {result.x}")
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 示例 3:配方混合(min)
88
+
89
+ ### 问题描述
90
+
91
+ 配制产品需两种原料 A、B。单位成本 A=9,B=7。指标 P 至少 100(A 每单位提供 3,B 提供 2),指标 Q 至少 80(A 每单位提供 1,B 提供 2)。求最低成本。
92
+
93
+ ### 符号化模型
94
+
95
+ - 决策变量:`xA, xB >= 0`
96
+ - 目标函数:`min 9*xA + 7*xB`
97
+ - 约束:
98
+ - 指标 P:`3*xA + 2*xB >= 100`
99
+ - 指标 Q:`xA + 2*xB >= 80`
100
+
101
+ ```json
102
+ {
103
+ "sense": "min",
104
+ "c": [9, 7],
105
+ "A_ub": [[-3, -2], [-1, -2]],
106
+ "b_ub": [-100, -80],
107
+ "bounds": [[0, null], [0, null]]
108
+ }
109
+ ```
110
+
111
+ ### 代码实现
112
+
113
+ ```python
114
+ from scipy.optimize import linprog
115
+
116
+ c = [9, 7]
117
+ A_ub = [[-3, -2], [-1, -2]]
118
+ b_ub = [-100, -80]
119
+
120
+ result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=(0, None), method='highs')
121
+ print(f"status: {result.status}, obj: {result.fun}, x: {result.x}")
122
+ ```
123
+
124
+ ---
125
+
126
+ ## 示例 4:产销计划(max,含上界)
127
+
128
+ ### 问题描述
129
+
130
+ 产品 A、B 的单位利润分别为 8、11。资源 R 最多 120(A 占 2,B 占 3),资源 T 最多 90(A 占 1,B 占 1)。市场上限:A<=30,B<=25。求最大利润。
131
+
132
+ ### 符号化模型
133
+
134
+ - 决策变量:`xA, xB`
135
+ - 目标函数:`max 8*xA + 11*xB`
136
+ - 约束:
137
+ - 资源 R:`2*xA + 3*xB <= 120`
138
+ - 资源 T:`xA + xB <= 90`
139
+ - 边界:`0 <= xA <= 30`,`0 <= xB <= 25`
140
+
141
+ ```json
142
+ {
143
+ "sense": "max",
144
+ "c": [8, 11],
145
+ "A_ub": [[2, 3], [1, 1]],
146
+ "b_ub": [120, 90],
147
+ "bounds": [[0, 30], [0, 25]]
148
+ }
149
+ ```
150
+
151
+ ### 代码实现
152
+
153
+ ```python
154
+ from scipy.optimize import linprog
155
+
156
+ c = [-8, -11]
157
+ A_ub = [[2, 3], [1, 1]]
158
+ b_ub = [120, 90]
159
+ bounds = [(0, 30), (0, 25)]
160
+
161
+ result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=bounds, method='highs')
162
+ print(f"status: {result.status}, obj: {-result.fun}, x: {result.x}")
163
+ ```
164
+
165
+ ---
166
+
167
+ ## 示例 5:最大化 c^T x(不等式约束)
168
+
169
+ ### 问题描述
170
+
171
+ 最大化 `x1 + 2x2 + 3x3`,受两个不等式约束和变量非负限制。
172
+
173
+ ### 符号化模型
174
+
175
+ - 决策变量:`x1, x2, x3 >= 0`
176
+ - 目标函数:`max x1 + 2*x2 + 3*x3`
177
+ - 约束:
178
+ - `x1 + 2*x3 <= 10`
179
+ - `x2 + x3 <= 7`
180
+
181
+ ```json
182
+ {
183
+ "sense": "max",
184
+ "c": [1, 2, 3],
185
+ "A_ub": [[1, 0, 2], [0, 1, 1]],
186
+ "b_ub": [10, 7],
187
+ "bounds": [[0, null], [0, null], [0, null]]
188
+ }
189
+ ```
190
+
191
+ ### 代码实现
192
+
193
+ ```python
194
+ from scipy.optimize import linprog
195
+
196
+ c = [-1, -2, -3]
197
+ A_ub = [[1, 0, 2], [0, 1, 1]]
198
+ b_ub = [10, 7]
199
+
200
+ result = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=(0, None), method='highs')
201
+ print(f"status: {result.status}, obj: {-result.fun}, x: {result.x}")
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 示例 6:最小化 c^T x(等式约束)
207
+
208
+ ### 问题描述
209
+
210
+ 最小化 `5x1 + 8x2 + 2x3 + 4x4 + 7x5`,受四个等式约束和变量非负限制。
211
+
212
+ ### 符号化模型
213
+
214
+ - 决策变量:`x1, x2, x3, x4, x5 >= 0`
215
+ - 目标函数:`min 5*x1 + 8*x2 + 2*x3 + 4*x4 + 7*x5`
216
+ - 约束:
217
+ - `x1 + 2*x3 + x4 + 3*x5 = 200`
218
+ - `x2 + x3 + 2*x4 + x5 = 150`
219
+ - `3*x1 + 2*x2 + x4 = 250`
220
+ - `x1 + x2 + x3 + x4 + x5 = 100`
221
+
222
+ ```json
223
+ {
224
+ "sense": "min",
225
+ "c": [5, 8, 2, 4, 7],
226
+ "A_eq": [
227
+ [1, 0, 2, 1, 3],
228
+ [0, 1, 1, 2, 1],
229
+ [3, 2, 0, 1, 0],
230
+ [1, 1, 1, 1, 1]
231
+ ],
232
+ "b_eq": [200, 150, 250, 100],
233
+ "bounds": [[0, null], [0, null], [0, null], [0, null], [0, null]]
234
+ }
235
+ ```
236
+
237
+ ### 代码实现
238
+
239
+ ```python
240
+ from scipy.optimize import linprog
241
+
242
+ c = [5, 8, 2, 4, 7]
243
+ A_eq = [[1, 0, 2, 1, 3],
244
+ [0, 1, 1, 2, 1],
245
+ [3, 2, 0, 1, 0],
246
+ [1, 1, 1, 1, 1]]
247
+ b_eq = [200, 150, 250, 100]
248
+
249
+ result = linprog(c, A_eq=A_eq, b_eq=b_eq, bounds=(0, None), method='highs')
250
+ print(f"status: {result.status}, message: {result.message}")
251
+ ```
@@ -0,0 +1,118 @@
1
+ # 混合整数规划参考示例(已实测)
2
+
3
+ <!--
4
+ 本文件由 @louisultra/dsh-verymath 插件补写(上游 mixed-integer-programming/examples.md
5
+ 是 SOCP 示例的错版拷贝,见 UPSTREAM.json 记录)。以下两个示例均用 PuLP 2.8 + CBC
6
+ 实测通过,解已人工核对。
7
+ 作者:LouisUltra(dsh-verymath)
8
+ 求解器:PuLP 内置 CBC(开源,无需商业许可)
9
+ -->
10
+
11
+ ## 示例 M1:0-1 背包(max,实测最优 220)
12
+
13
+ ### 问题描述
14
+
15
+ 背包容量 50。三件物品:价值 60/100/120,重量 10/20/30。每件要么全带要么不带,价值最大。
16
+
17
+ ### 符号化模型
18
+
19
+ - 决策变量:`x_i ∈ {0,1}`(物品 i 是否带走)
20
+ - 目标函数:`max 60x₁ + 100x₂ + 120x₃`
21
+ - 约束:`10x₁ + 20x₂ + 30x₃ ≤ 50`
22
+
23
+ ```json
24
+ {
25
+ "type": "MIP",
26
+ "sense": "max",
27
+ "c": [60, 100, 120],
28
+ "binary_variables": ["x1", "x2", "x3"],
29
+ "constraints": [{"weights": [10, 20, 30], "op": "<=", "rhs": 50}]
30
+ }
31
+ ```
32
+
33
+ ### 代码实现(PuLP + CBC,已实测)
34
+
35
+ ```python
36
+ import pulp
37
+
38
+ values = [60, 100, 120]
39
+ weights = [10, 20, 30]
40
+ capacity = 50
41
+
42
+ prob = pulp.LpProblem('knapsack', pulp.LpMaximize)
43
+ x = [pulp.LpVariable(f'x{i}', cat='Binary') for i in range(3)]
44
+ prob += pulp.lpSum(values[i] * x[i] for i in range(3))
45
+ prob += pulp.lpSum(weights[i] * x[i] for i in range(3)) <= capacity
46
+
47
+ status = prob.solve(pulp.PULP_CBC_CMD(msg=False))
48
+ chosen = [i for i in range(3) if x[i].value() == 1]
49
+ print(pulp.LpStatus[status], chosen, pulp.value(prob.objective))
50
+ # → Optimal [1, 2] 220.0(物品 2、3,总重 50,价值 220)
51
+ ```
52
+
53
+ ### 验证
54
+
55
+ - 枚举全部 8 种组合确认最优:{x₂,x₃} 价值 220 重量 50(恰好装满),优于 {x₁,x₂}=160、{x₁,x₃}=180、{x₂,x₃}=220(同值,解不唯一但目标值一致)。
56
+ - 松弛 LP(去掉 0-1 约束)给出上界 233.3,整数最优 220 ≤ 233.3,间隙合理。
57
+
58
+ ## 示例 M2:3×3 指派问题(min,实测最优 9)
59
+
60
+ ### 问题描述
61
+
62
+ 三人三任务,成本矩阵如下(行=人,列=任务),每人恰做一项,每项恰归一人,总成本最小。
63
+
64
+ ```
65
+ 任务1 任务2 任务3
66
+ 人A 9 2 7
67
+ 人B 6 4 3
68
+ 人C 5 8 1
69
+ ```
70
+
71
+ ### 符号化模型
72
+
73
+ - 决策变量:`y_ij ∈ {0,1}`(人 i 分配到任务 j)
74
+ - 目标函数:`min Σ c_ij·y_ij`
75
+ - 约束:每行和 =1(每人一项);每列和 =1(每项一人)
76
+
77
+ ```json
78
+ {
79
+ "type": "MIP",
80
+ "sense": "min",
81
+ "c_matrix": [[9, 2, 7], [6, 4, 3], [5, 8, 1]],
82
+ "binary_variables": "y_ij",
83
+ "row_constraints": "=1",
84
+ "col_constraints": "=1"
85
+ }
86
+ ```
87
+
88
+ ### 代码实现(PuLP + CBC,已实测)
89
+
90
+ ```python
91
+ import pulp
92
+
93
+ costs = [[9, 2, 7], [6, 4, 3], [5, 8, 1]]
94
+ n = 3
95
+
96
+ prob = pulp.LpProblem('assignment', pulp.LpMinimize)
97
+ y = [[pulp.LpVariable(f'y{i}{j}', cat='Binary') for j in range(n)] for i in range(n)]
98
+ prob += pulp.lpSum(costs[i][j] * y[i][j] for i in range(n) for j in range(n))
99
+ for i in range(n):
100
+ prob += pulp.lpSum(y[i][j] for j in range(n)) == 1
101
+ for j in range(n):
102
+ prob += pulp.lpSum(y[i][j] for i in range(n)) == 1
103
+
104
+ status = prob.solve(pulp.PULP_CBC_CMD(msg=False))
105
+ pairs = [(i, j) for i in range(n) for j in range(n) if y[i][j].value() == 1]
106
+ print(pulp.LpStatus[status], pairs, pulp.value(prob.objective))
107
+ # → Optimal [(0,1), (1,0), (2,2)] 9.0(A→任务2=2,B→任务1=6,C→任务3=1,总计 9)
108
+ ```
109
+
110
+ ### 验证
111
+
112
+ - 匈牙利算法交叉验证:最优指派成本 9(A→2, B→1, C→3)。
113
+ - 对偶检查:行位势 (0, -3, -5) 与列位势 (10, 2, 6) 下所有 reduced cost ≥ 0,证实最优。
114
+
115
+ ## 与 LP 的关系
116
+
117
+ - LP 基础示例(连续变量、scipy/COPT 形式)见 `lp-examples.md`(恢复自上游历史版本)。
118
+ - 整数变量出现的信号(台数、选/不选、开/关)→ 用本文件的 MIP 形式;不要把整数松弛成连续变量后当作原问题的解。
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: open-problem-research-pipeline
3
+ description: Research one or more open mathematical problems through a staged literature-search, method-analysis, and proof-framework workflow. Use when a user requests a source-grounded survey of an open problem, a comparison of methods across verified papers, or candidate proof frameworks with explicit evidence and uncertainty boundaries.
4
+ ---
5
+
6
+ # Open Problem Research Pipeline
7
+
8
+ ## DSH Integration Notes
9
+
10
+ - 本技能由 `@louisultra/dsh-verymath` 插件提供;四个子技能已扁平化为 `skill_*.md` 模块文件
11
+ (literature_search / literature_analysis / literature_proof_framework / qskill),按需读取。
12
+ - 文献检索优先复用 `@eduwork/dsh-literature` 插件(arXiv/DBLP 检索与全文获取);
13
+ 无该插件时用 web 工具并如实记录来源。
14
+ - 各阶段产物(verified papers、method comparisons、proof frameworks)写入当前会话工作区。
15
+
16
+
17
+ Run a four-part course workflow while keeping literature facts, method
18
+ interpretations, and candidate proof ideas distinct.
19
+
20
+ ## Package Map
21
+
22
+ - `skills/literature-search/`: identify the exact problem and build a
23
+ source-linked literature report.
24
+ - `skills/literature-analysis/`: extract and compare methods from the verified
25
+ source packet.
26
+ - `skills/literature-proof-framework/`: turn supported methods into candidate
27
+ proof frameworks and explicit proof obligations.
28
+ - `skills/qskill/`: route a complete `search -> analysis -> framework -> report`
29
+ run.
30
+
31
+ Read the relevant nested `SKILL.md` before each stage. Use `qskill` only when
32
+ the user asks for the complete pipeline.
33
+
34
+ ## Workflow
35
+
36
+ 1. Normalize the exact problem, graph class or mathematical setting,
37
+ quantifiers, parameter range, and current claimed status.
38
+ 2. Ask before starting network research when browsing was not already
39
+ requested. Search primary sources first and record URLs and access dates.
40
+ 3. Produce the literature report under a user-approved output root, defaulting
41
+ to `outputs/literature_reports/`.
42
+ 4. Analyze only papers whose text or adequate source evidence is available.
43
+ Mark missing method details rather than reconstructing them from titles or
44
+ abstracts.
45
+ 5. Build candidate proof frameworks. Label every unsupported step as a proof
46
+ obligation; never present a framework as a proof or a proposed variant as
47
+ novel without verification.
48
+ 6. Assemble Markdown and optional PDF output under `outputs/`. PDF conversion
49
+ is best effort and requires local `pandoc` and XeLaTeX.
50
+
51
+ ## Evidence Contract
52
+
53
+ - Separate `source states`, `inference`, `candidate direction`, and
54
+ `verified result`.
55
+ - Verify citation title, authors, year, venue, and URL before treating a source
56
+ as confirmed.
57
+ - Do not infer that a problem remains open from an old survey alone.
58
+ - Do not claim novelty, feasibility, or proof completion without the relevant
59
+ literature check or mathematical verification.
60
+ - Preserve every intermediate JSON artifact so downstream stages can identify
61
+ exactly what evidence they consumed.
62
+
63
+ ## Outputs
64
+
65
+ The default package-relative output layout is:
66
+
67
+ ```text
68
+ outputs/
69
+ ├── outputs/literature_reports/
70
+ ├── outputs/literature_analysis_reports/
71
+ ├── outputs/literature_proof_reports/
72
+ └── outputs/qs_reports/
73
+ ```
74
+
75
+ Never overwrite an existing report. Add a version suffix and keep generated
76
+ outputs out of git.