Loading...
Loading...
Compare original and translation side by side
| Input | Description | Example |
|---|---|---|
| Problem type | Root-finding, optimization, least-squares | |
| Problem size | Number of unknowns | |
| Jacobian availability | Analytic, finite-diff, unavailable | |
| Jacobian cost | Cheap or expensive to compute | |
| Constraints | None, bounds, equality, inequality | |
| Smoothness | Is objective/residual smooth? | |
| Residual history | Sequence of residual norms | |
| 输入项 | 描述 | 示例 |
|---|---|---|
| 问题类型 | 根求解、优化、最小二乘 | |
| 问题规模 | 未知量数量 | |
| Jacobian矩阵可用性 | 解析形式、有限差分、不可用 | |
| Jacobian矩阵计算成本 | 低或高 | |
| 约束条件 | 无、边界约束、等式约束、不等式约束 | |
| 平滑性 | 目标函数/残差是否平滑? | |
| 残差历史 | 残差范数序列 | |
Is Jacobian available and cheap?
├── YES → Problem size?
│ ├── Small (n < 1000) → Newton (full)
│ └── Large (n ≥ 1000) → Newton-Krylov
└── NO → Is objective smooth?
├── YES → Memory limited?
│ ├── YES → L-BFGS or Broyden
│ └── NO → BFGS
└── NO → Anderson acceleration or PicardIs Jacobian available and cheap?
├── YES → Problem size?
│ ├── Small (n < 1000) → Newton (full)
│ └── Large (n ≥ 1000) → Newton-Krylov
└── NO → Is objective smooth?
├── YES → Memory limited?
│ ├── YES → L-BFGS or Broyden
│ └── NO → BFGS
└── NO → Anderson acceleration or Picard| Problem Type | First Choice | Alternative | Globalization |
|---|---|---|---|
| Small root-finding | Newton | Broyden | Line search |
| Large root-finding | Newton-Krylov | Anderson | Trust region |
| Optimization | L-BFGS | BFGS | Wolfe line search |
| Least-squares | Levenberg-Marquardt | Gauss-Newton | Trust region |
| Bound constrained | L-BFGS-B | Trust-region reflective | Projected |
| 问题类型 | 首选方案 | 替代方案 | 全局策略 |
|---|---|---|---|
| 小规模根求解 | Newton | Broyden | 线搜索 |
| 大规模根求解 | Newton-Krylov | Anderson | 信赖域 |
| 优化问题 | L-BFGS | BFGS | Wolfe线搜索 |
| 最小二乘问题 | Levenberg-Marquardt | Gauss-Newton | 信赖域 |
| 带边界约束问题 | L-BFGS-B | 信赖域反射法 | 投影法 |
| Script | Key Outputs |
|---|---|
| |
| |
| |
| |
| |
| |
| 脚本 | 核心输出 |
|---|---|
| |
| |
| |
| |
| |
| |
scripts/solver_selector.pyscripts/globalization_advisor.pyscripts/jacobian_diagnostics.pyscripts/residual_monitor.pyscripts/convergence_analyzer.pyscripts/step_quality.pyscripts/solver_selector.pyscripts/globalization_advisor.pyscripts/jacobian_diagnostics.pyscripts/residual_monitor.pyscripts/convergence_analyzer.pyscripts/step_quality.pypython3 scripts/convergence_analyzer.py --residuals 1,0.8,0.6,0.5,0.4,0.3,0.2,0.15,0.12,0.1 --jsonpython3 scripts/globalization_advisor.py --problem-type root-finding --jacobian-quality ill-conditioned --previous-failures 0 --jsonpython3 scripts/convergence_analyzer.py --residuals 1,0.8,0.6,0.5,0.4,0.3,0.2,0.15,0.12,0.1 --jsonpython3 scripts/globalization_advisor.py --problem-type root-finding --jacobian-quality ill-conditioned --previous-failures 0 --jsonundefinedundefinedundefinedundefined| Error | Cause | Resolution |
|---|---|---|
| Invalid size | Check problem dimension |
| Size above 10 billion cap | Re-check the unit/value |
| Unknown constraint | Use: none, bound, equality, inequality |
| Unknown problem type | Use: root-finding, optimization, least-squares |
| Invalid residual data | Check residual computation |
| NaN/Inf in residual data | Sanitize residual history |
| More than 100,000 entries | Downsample the history |
| Invalid path | Verify Jacobian file exists |
| Matrix file too large | Use a smaller / sparser matrix |
| 错误信息 | 原因 | 解决方法 |
|---|---|---|
| 无效规模值 | 检查问题维度 |
| 规模超过100亿上限 | 重新检查单位/数值 |
| 未知约束类型 | 使用以下值:none, bound, equality, inequality |
| 未知问题类型 | 使用以下值:root-finding, optimization, least-squares |
| 无效残差数据 | 检查残差计算逻辑 |
| 残差数据包含NaN/Inf | 清理残差历史数据 |
| 条目超过10万条 | 对历史数据进行下采样 |
| 路径无效 | 确认Jacobian矩阵文件存在 |
| 矩阵文件过大 | 使用更小/更稀疏的矩阵 |
| Type | Meaning | Action |
|---|---|---|
| quadratic | Optimal Newton (order p ≈ 2) | Continue, near solution |
| superlinear | Ratios shrinking toward 0 (1 < p < 2); quasi-Newton working | Monitor for stagnation |
| linear | Constant contraction ratio (p ≈ 1); a small constant ratio is fast-linear, not superlinear | May improve with preconditioner |
| sublinear | Too slow (ratio → 1) | Change method or formulation |
| stagnated | No progress | Check Jacobian, preconditioner |
| diverged | Increasing residual | Add globalization, check Jacobian |
| 类型 | 含义 | 操作建议 |
|---|---|---|
| quadratic | 最优Newton收敛(阶数p≈2) | 继续执行,已接近解 |
| superlinear | 收缩比趋近于0(1 < p < 2);拟Newton方法生效 | 监控是否出现停滞 |
| linear | 收缩比恒定(p≈1);小恒定比属于快速线性收敛,而非超线性 | 可考虑添加预条件子 |
| sublinear | 收敛过慢(收缩比趋近于1) | 更换方法或重新构建问题 |
| stagnated | 无进展 | 检查Jacobian矩阵、预条件子 |
| diverged | 残差增大 | 添加全局策略,检查Jacobian矩阵 |
| Quality | Condition Number | Action |
|---|---|---|
| good | < 10⁶ | Standard Newton works |
| moderately-conditioned | 10⁶ - 10¹⁰ | Consider scaling |
| ill-conditioned | > 10¹⁰ | Use regularization |
| near-singular | ∞ | Reformulate or use LM |
| 质量等级 | 条件数 | 操作建议 |
|---|---|---|
| good | < 10⁶ | 标准Newton方法可行 |
| moderately-conditioned | 10⁶ - 10¹⁰ | 考虑进行缩放处理 |
| ill-conditioned | > 10¹⁰ | 使用正则化方法 |
| near-singular | ∞ | 重新构建问题或使用LM方法 |
| Ratio ρ | Quality | Trust Radius |
|---|---|---|
| ρ < 0 | very_poor | Shrink aggressively |
| ρ < 0.25 | marginal | Shrink |
| 0.25 ≤ ρ < 0.75 | good | Maintain |
| ρ ≥ 0.75 | excellent | Expand if at boundary |
| 比值ρ | 质量等级 | 信赖域半径操作 |
|---|---|---|
| ρ < 0 | very_poor | 大幅缩小半径 |
| ρ < 0.25 | marginal | 缩小半径 |
| 0.25 ≤ ρ < 0.75 | good | 保持半径 |
| ρ ≥ 0.75 | excellent | 若步长触达边界则扩大半径 |
convergence_analyzer.py --residuals <history>convergence_typeestimated_rateconverged: true1e-10residual_monitor.pypatterns_detecteddivergingoscillatingplateauslow_convergencejacobian_diagnostics.py --matrix J.txtcondition_numberjacobian_quality--finite-diff-matrixfinite_diff_errorrank_deficientjacobian_diagnostics.pyfalsestep_quality.pyratioratio >= 0.25very_poorpoortrust_radius_actionsolver_selector.pyglobalization_advisor.pyconvergence_analyzer.py --residuals <history>convergence_typeestimated_rateconverged: true1e-10residual_monitor.pypatterns_detecteddivergingoscillatingplateauslow_convergencejacobian_diagnostics.py --matrix J.txtcondition_numberjacobian_quality--finite-diff-matrixfinite_diff_errorjacobian_diagnostics.pyrank_deficientfalsestep_quality.pyratioratio >= 0.25very_poorpoortrust_radius_actionsolver_selector.pyglobalization_advisor.py| Tempting shortcut | Why it's wrong / what to do |
|---|---|
| "The residual ratio is a small constant (~0.1), so it's converging superlinearly." | A constant contraction ratio is linear, not superlinear — |
| "It stopped without erroring, so the solver converged." | Run completion is not convergence. Check |
| "Two iterations look like they're shrinking, so the rate is fine." | Order estimation needs at least 3 strictly decreasing positive residuals; with fewer, |
| "I coded the analytic Jacobian, so it must be right." | A wrong Jacobian still produces some step. Run |
| "Newton diverged, so I'll just shrink the global tolerance and call it close enough." | Divergence ( |
| "Trust-region step decreased the objective, so accept and expand the radius." | Acceptance and radius growth depend on the reduction ratio ρ, not just sign. |
| "The Jacobian is large and expensive, but full Newton is the gold standard, so I'll form it anyway." | For n ≥ 1000 or expensive Jacobians, |
| 诱人的捷径 | 错误原因/正确做法 |
|---|---|
| “残差比是一个小常数(≈0.1),所以是超线性收敛。” | 恒定收缩比属于线性收敛,而非超线性—— |
| “求解器未报错就停止了,所以已经收敛。” | 运行完成不等于收敛。检查 |
| “两次迭代看起来在收缩,所以收敛速率没问题。” | 阶数估计至少需要3个严格递减的正残差;若残差数量不足, |
| “我编写了解析形式的Jacobian矩阵,所以肯定是正确的。” | 错误的Jacobian矩阵仍会产生步长。运行 |
| “Newton方法发散了,我只要缩小全局容差就可以认为足够接近了。” | 发散( |
| “信赖域步长降低了目标函数,所以接受并扩大半径。” | 接受步长和扩大半径取决于收缩比ρ,而非仅符号。只有当ρ≥0.75且步长触达边界时, |
| “Jacobian矩阵规模大且计算成本高,但全Newton方法是黄金标准,所以我还是要构建它。” | 当n≥1000或Jacobian矩阵计算成本高时, |
--size--residuals--tolerance--target-tolerance--problem-type--constraint-type--jacobian-qualitygoodill-conditionedpredicted-reductionactual-reductionstep-normgradient-normtrust-radius--size--residuals--tolerance--target-tolerance--problem-type--constraint-type--jacobian-qualitygoodill-conditionedpredicted-reductionactual-reductionstep-normgradient-normtrust-radiusjacobian_diagnostics.py--matrixallow_pickle=Falsejacobian_diagnostics.py--matrixallow_pickle=Falsesolver_selector.pyconvergence_analyzer.pyjacobian_diagnostics.pyglobalization_advisor.pyresidual_monitor.pystep_quality.pysolver_selector.pyconvergence_analyzer.pyjacobian_diagnostics.pyglobalization_advisor.pyresidual_monitor.pystep_quality.pyeval()exec()shell=Trueeval()exec()shell=Truereferences/solver_decision_tree.mdreferences/method_catalog.mdreferences/convergence_diagnostics.mdreferences/globalization_strategies.mdreferences/solver_decision_tree.mdreferences/method_catalog.mdreferences/convergence_diagnostics.mdreferences/globalization_strategies.md--problem-typesolver_selector.py--far-from-solutionglobalization_advisor.py-Infinitysolver_selector.py--problem-typeglobalization_advisor.py--far-from-solution-Infinity