nonlinear-solvers

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Nonlinear Solvers

非线性求解器

Goal

目标

Provide a universal workflow to select a nonlinear solver, configure globalization strategies, and diagnose convergence for root-finding, optimization, and least-squares problems.
提供通用工作流,为根求解、优化和最小二乘问题选择非线性求解器、配置全局策略并诊断收敛情况。

Requirements

要求

  • Python 3.10+
  • NumPy (for Jacobian diagnostics)
  • SciPy (optional, for advanced analysis)
  • Python 3.10+
  • NumPy(用于Jacobian矩阵诊断)
  • SciPy(可选,用于高级分析)

Inputs to Gather

需要收集的输入信息

InputDescriptionExample
Problem typeRoot-finding, optimization, least-squares
root-finding
Problem sizeNumber of unknowns
n = 10000
Jacobian availabilityAnalytic, finite-diff, unavailable
analytic
Jacobian costCheap or expensive to compute
expensive
ConstraintsNone, bounds, equality, inequality
none
SmoothnessIs objective/residual smooth?
yes
Residual historySequence of residual norms
1,0.1,0.01,...
输入项描述示例
问题类型根求解、优化、最小二乘
root-finding
问题规模未知量数量
n = 10000
Jacobian矩阵可用性解析形式、有限差分、不可用
analytic
Jacobian矩阵计算成本低或高
expensive
约束条件无、边界约束、等式约束、不等式约束
none
平滑性目标函数/残差是否平滑?
yes
残差历史残差范数序列
1,0.1,0.01,...

Decision Guidance

决策指南

Solver Selection Flowchart

求解器选择流程图

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 Picard
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 Picard

Quick Reference

快速参考表

Problem TypeFirst ChoiceAlternativeGlobalization
Small root-findingNewtonBroydenLine search
Large root-findingNewton-KrylovAndersonTrust region
OptimizationL-BFGSBFGSWolfe line search
Least-squaresLevenberg-MarquardtGauss-NewtonTrust region
Bound constrainedL-BFGS-BTrust-region reflectiveProjected
问题类型首选方案替代方案全局策略
小规模根求解NewtonBroyden线搜索
大规模根求解Newton-KrylovAnderson信赖域
优化问题L-BFGSBFGSWolfe线搜索
最小二乘问题Levenberg-MarquardtGauss-Newton信赖域
带边界约束问题L-BFGS-B信赖域反射法投影法

Script Outputs (JSON Fields)

脚本输出(JSON字段)

ScriptKey Outputs
scripts/solver_selector.py
recommended
,
alternatives
,
notes
scripts/convergence_analyzer.py
converged
,
convergence_type
,
estimated_rate
,
diagnosis
scripts/jacobian_diagnostics.py
condition_number
,
jacobian_quality
,
rank_deficient
scripts/globalization_advisor.py
strategy
,
line_search_type
,
trust_region_type
,
parameters
scripts/residual_monitor.py
patterns_detected
,
alerts
,
recommendations
scripts/step_quality.py
ratio
,
step_quality
,
accept_step
,
trust_radius_action
脚本核心输出
scripts/solver_selector.py
recommended
,
alternatives
,
notes
scripts/convergence_analyzer.py
converged
,
convergence_type
,
estimated_rate
,
diagnosis
scripts/jacobian_diagnostics.py
condition_number
,
jacobian_quality
,
rank_deficient
scripts/globalization_advisor.py
strategy
,
line_search_type
,
trust_region_type
,
parameters
scripts/residual_monitor.py
patterns_detected
,
alerts
,
recommendations
scripts/step_quality.py
ratio
,
step_quality
,
accept_step
,
trust_radius_action

Workflow

工作流

  1. Characterize problem - Identify type, size, Jacobian availability
  2. Select solver - Run
    scripts/solver_selector.py
  3. Choose globalization - Run
    scripts/globalization_advisor.py
  4. Analyze Jacobian - If available, run
    scripts/jacobian_diagnostics.py
  5. Monitor residuals - During solve, use
    scripts/residual_monitor.py
  6. Analyze convergence - Run
    scripts/convergence_analyzer.py
  7. Evaluate steps - For trust region, use
    scripts/step_quality.py
  1. 问题特征分析 - 确定问题类型、规模、Jacobian矩阵可用性
  2. 选择求解器 - 运行
    scripts/solver_selector.py
  3. 选择全局策略 - 运行
    scripts/globalization_advisor.py
  4. 分析Jacobian矩阵 - 若矩阵可用,运行
    scripts/jacobian_diagnostics.py
  5. 监控残差 - 求解过程中使用
    scripts/residual_monitor.py
  6. 分析收敛情况 - 运行
    scripts/convergence_analyzer.py
  7. 评估步长质量 - 针对信赖域方法,使用
    scripts/step_quality.py

Conversational Workflow Example

对话式工作流示例

User: My Newton solver for a phase-field simulation is converging very slowly. After 50 iterations, the residual only dropped from 1 to 0.1.
Agent workflow:
  1. Analyze convergence:
    bash
    python3 scripts/convergence_analyzer.py --residuals 1,0.8,0.6,0.5,0.4,0.3,0.2,0.15,0.12,0.1 --json
  2. Check globalization strategy:
    bash
    python3 scripts/globalization_advisor.py --problem-type root-finding --jacobian-quality ill-conditioned --previous-failures 0 --json
  3. Recommend: Switch to trust region with Levenberg-Marquardt regularization, or use Newton-Krylov with better preconditioning.
用户:我用于相场模拟的Newton求解器收敛非常慢。50次迭代后,残差仅从1降到0.1。
Agent工作流:
  1. 分析收敛情况:
    bash
    python3 scripts/convergence_analyzer.py --residuals 1,0.8,0.6,0.5,0.4,0.3,0.2,0.15,0.12,0.1 --json
  2. 检查全局策略:
    bash
    python3 scripts/globalization_advisor.py --problem-type root-finding --jacobian-quality ill-conditioned --previous-failures 0 --json
  3. 推荐方案:切换到带Levenberg-Marquardt正则化的信赖域方法,或使用带更好预条件子的Newton-Krylov方法。

Pre-Solve Checklist

求解前检查清单

  • Confirm problem type (root-finding, optimization, least-squares)
  • Assess Jacobian availability and cost
  • Check initial guess quality
  • Set appropriate tolerances
  • Choose globalization strategy
  • Prepare to monitor convergence
  • 确认问题类型(根求解、优化、最小二乘)
  • 评估Jacobian矩阵的可用性与计算成本
  • 检查初始猜测的质量
  • 设置合适的容差
  • 选择全局策略
  • 准备监控收敛情况

CLI Examples

CLI示例

bash
undefined
bash
undefined

Select solver for large unconstrained optimization

为大规模无约束优化选择求解器

python3 scripts/solver_selector.py --size 50000 --smooth --memory-limited --json
python3 scripts/solver_selector.py --size 50000 --smooth --memory-limited --json

Select solver for a small nonlinear least-squares (data-fitting) problem

为小型非线性最小二乘(数据拟合)问题选择求解器

python3 scripts/solver_selector.py --problem-type least-squares --size 6 --jacobian-available --smooth --json
python3 scripts/solver_selector.py --problem-type least-squares --size 6 --jacobian-available --smooth --json

Analyze convergence from residual history

根据残差历史分析收敛情况

python3 scripts/convergence_analyzer.py --residuals 1,0.1,0.01,0.001,0.0001 --tolerance 1e-6 --json
python3 scripts/convergence_analyzer.py --residuals 1,0.1,0.01,0.001,0.0001 --tolerance 1e-6 --json

Diagnose Jacobian quality

诊断Jacobian矩阵质量

python3 scripts/jacobian_diagnostics.py --matrix jacobian.txt --json
python3 scripts/jacobian_diagnostics.py --matrix jacobian.txt --json

Get globalization recommendation

获取全局策略推荐

python3 scripts/globalization_advisor.py --problem-type optimization --jacobian-quality good --json
python3 scripts/globalization_advisor.py --problem-type optimization --jacobian-quality good --json

Globalization for a distant initial guess (favors trust region)

针对远离解的初始猜测的全局策略(优先信赖域)

python3 scripts/globalization_advisor.py --problem-type root-finding --jacobian-quality good --far-from-solution --json
python3 scripts/globalization_advisor.py --problem-type root-finding --jacobian-quality good --far-from-solution --json

Monitor residual patterns

监控残差模式

python3 scripts/residual_monitor.py --residuals 1,0.8,0.9,0.7,0.75,0.6 --target-tolerance 1e-8 --json
python3 scripts/residual_monitor.py --residuals 1,0.8,0.9,0.7,0.75,0.6 --target-tolerance 1e-8 --json

Evaluate step quality for trust region

评估信赖域方法的步长质量

python3 scripts/step_quality.py --predicted-reduction 0.5 --actual-reduction 0.4 --step-norm 0.8 --gradient-norm 1.0 --trust-radius 1.0 --json
undefined
python3 scripts/step_quality.py --predicted-reduction 0.5 --actual-reduction 0.4 --step-norm 0.8 --gradient-norm 1.0 --trust-radius 1.0 --json
undefined

Error Handling

错误处理

ErrorCauseResolution
problem_size must be positive
Invalid sizeCheck problem dimension
problem_size (...) exceeds maximum (...)
Size above 10 billion capRe-check the unit/value
constraint_type must be one of...
Unknown constraintUse: none, bound, equality, inequality
problem_type must be one of...
Unknown problem typeUse: root-finding, optimization, least-squares
residuals must be non-negative
Invalid residual dataCheck residual computation
residuals must be finite
NaN/Inf in residual dataSanitize residual history
residual list length (...) exceeds limit (...)
More than 100,000 entriesDownsample the history
Matrix file not found
Invalid pathVerify Jacobian file exists
Matrix file exceeds size limit ...
Matrix file too largeUse a smaller / sparser matrix
错误信息原因解决方法
problem_size must be positive
无效规模值检查问题维度
problem_size (...) exceeds maximum (...)
规模超过100亿上限重新检查单位/数值
constraint_type must be one of...
未知约束类型使用以下值:none, bound, equality, inequality
problem_type must be one of...
未知问题类型使用以下值:root-finding, optimization, least-squares
residuals must be non-negative
无效残差数据检查残差计算逻辑
residuals must be finite
残差数据包含NaN/Inf清理残差历史数据
residual list length (...) exceeds limit (...)
条目超过10万条对历史数据进行下采样
Matrix file not found
路径无效确认Jacobian矩阵文件存在
Matrix file exceeds size limit ...
矩阵文件过大使用更小/更稀疏的矩阵

Interpretation Guidance

解读指南

Convergence Type

收敛类型

TypeMeaningAction
quadraticOptimal Newton (order p ≈ 2)Continue, near solution
superlinearRatios shrinking toward 0 (1 < p < 2); quasi-Newton workingMonitor for stagnation
linearConstant contraction ratio (p ≈ 1); a small constant ratio is fast-linear, not superlinearMay improve with preconditioner
sublinearToo slow (ratio → 1)Change method or formulation
stagnatedNo progressCheck Jacobian, preconditioner
divergedIncreasing residualAdd globalization, check Jacobian
类型含义操作建议
quadratic最优Newton收敛(阶数p≈2)继续执行,已接近解
superlinear收缩比趋近于0(1 < p < 2);拟Newton方法生效监控是否出现停滞
linear收缩比恒定(p≈1);小恒定比属于快速线性收敛,而非超线性可考虑添加预条件子
sublinear收敛过慢(收缩比趋近于1)更换方法或重新构建问题
stagnated无进展检查Jacobian矩阵、预条件子
diverged残差增大添加全局策略,检查Jacobian矩阵

Jacobian Quality

Jacobian矩阵质量

QualityCondition NumberAction
good< 10⁶Standard Newton works
moderately-conditioned10⁶ - 10¹⁰Consider scaling
ill-conditioned> 10¹⁰Use regularization
near-singularReformulate or use LM
质量等级条件数操作建议
good< 10⁶标准Newton方法可行
moderately-conditioned10⁶ - 10¹⁰考虑进行缩放处理
ill-conditioned> 10¹⁰使用正则化方法
near-singular重新构建问题或使用LM方法

Step Quality (Trust Region)

步长质量(信赖域)

Ratio ρQualityTrust Radius
ρ < 0very_poorShrink aggressively
ρ < 0.25marginalShrink
0.25 ≤ ρ < 0.75goodMaintain
ρ ≥ 0.75excellentExpand if at boundary
比值ρ质量等级信赖域半径操作
ρ < 0very_poor大幅缩小半径
ρ < 0.25marginal缩小半径
0.25 ≤ ρ < 0.75good保持半径
ρ ≥ 0.75excellent若步长触达边界则扩大半径

Verification checklist

验证检查清单

Do not trust a "solved" claim until these concrete artifacts are recorded:
  • Logged the full residual norm history and ran
    convergence_analyzer.py --residuals <history>
    ; recorded
    convergence_type
    and
    estimated_rate
    , and confirmed
    converged: true
    against the actual solver tolerance (not the default
    1e-10
    ).
  • Confirmed the residual sequence is monotone-decreasing or fed it to
    residual_monitor.py
    ; recorded
    patterns_detected
    and verified it does NOT include
    diverging
    ,
    oscillating
    ,
    plateau
    , or
    slow_convergence
    while still above tolerance.
  • If a Jacobian is available, ran
    jacobian_diagnostics.py --matrix J.txt
    and recorded
    condition_number
    and
    jacobian_quality
    ; for an analytic Jacobian, passed
    --finite-diff-matrix
    and confirmed
    finite_diff_error
    is below ~1e-2 (no "Large discrepancy" note).
  • Checked
    rank_deficient
    from
    jacobian_diagnostics.py
    is
    false
    (or documented why a rank-deficient/near-singular Jacobian is expected and that Levenberg-Marquardt regularization is in use).
  • For a trust-region solve, evaluated accepted steps with
    step_quality.py
    and recorded the reduction
    ratio
    ; confirmed accepted steps have
    ratio >= 0.25
    (not
    very_poor
    /
    poor
    ) and that the
    trust_radius_action
    matches the recorded ρ.
  • Recorded the solver and globalization actually used and confirmed they match
    solver_selector.py
    and
    globalization_advisor.py
    recommendations for the stated problem type, size, and Jacobian quality (e.g., large/expensive-Jacobian → Newton-Krylov; least-squares → Levenberg-Marquardt trust region).
  • Re-confirmed convergence after any change to tolerance, initial guess, or preconditioner — the convergence type can flip (e.g., quadratic → linear/stagnated) and must be re-classified, not assumed.
在记录以下具体成果前,不要轻信“已求解”的结论:
  • 记录完整的残差范数历史,并运行
    convergence_analyzer.py --residuals <history>
    ;记录
    convergence_type
    estimated_rate
    ,并确认
    converged: true
    与求解器实际容差匹配(而非默认的
    1e-10
    )。
  • 确认残差序列单调递减,或已将其输入
    residual_monitor.py
    ;记录
    patterns_detected
    ,并验证在容差之上时不包含
    diverging
    oscillating
    plateau
    slow_convergence
  • 若Jacobian矩阵可用,运行
    jacobian_diagnostics.py --matrix J.txt
    并记录
    condition_number
    jacobian_quality
    ;对于解析形式的Jacobian矩阵,传入
    --finite-diff-matrix
    并确认
    finite_diff_error
    低于约1e-2(无“Large discrepancy”提示)。
  • 检查
    jacobian_diagnostics.py
    返回的
    rank_deficient
    false
    (或记录为何Jacobian矩阵是秩亏/近奇异的,并确认已使用Levenberg-Marquardt正则化)。
  • 对于信赖域求解,使用
    step_quality.py
    评估已接受的步长并记录收缩
    ratio
    ;确认已接受步长的
    ratio >= 0.25
    (非
    very_poor
    /
    poor
    ),且
    trust_radius_action
    与记录的ρ匹配。
  • 记录实际使用的求解器和全局策略,并确认它们与
    solver_selector.py
    globalization_advisor.py
    针对所述问题类型、规模和Jacobian矩阵质量给出的推荐一致(例如,大规模/高成本Jacobian矩阵→Newton-Krylov;最小二乘问题→Levenberg-Marquardt信赖域)。
  • 在修改容差、初始猜测或预条件子后,重新确认收敛情况——收敛类型可能会变化(例如,二次→线性/停滞),必须重新分类,而非假设不变。

Common pitfalls & rationalizations

常见陷阱与误区

Tempting shortcutWhy 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 —
convergence_analyzer.py
reports this as
linear
(annotated "fast linear"). Superlinear requires the ratio to tend to zero (order p > 1.2). Don't claim Newton-quality convergence from a flat ratio.
"It stopped without erroring, so the solver converged."Run completion is not convergence. Check
converged
from
convergence_analyzer.py
/
residual_monitor.py
against the real tolerance; a
stagnated
or
plateau
result also "stops" but has not solved
f(x)=0
.
"Two iterations look like they're shrinking, so the rate is fine."Order estimation needs at least 3 strictly decreasing positive residuals; with fewer,
convergence_analyzer.py
returns
unknown
/falls back to rate-only. Gather more iterations before quoting a convergence type.
"I coded the analytic Jacobian, so it must be right."A wrong Jacobian still produces some step. Run
jacobian_diagnostics.py --finite-diff-matrix
and confirm
finite_diff_error
is small; a "Large discrepancy with finite-diff" note means the analytic Jacobian is buggy, which silently degrades Newton to linear convergence.
"Newton diverged, so I'll just shrink the global tolerance and call it close enough."Divergence (
convergence_type: diverged
, or
diverging
pattern) signals a bad step direction or far-from-solution start — add globalization. Run
globalization_advisor.py
(use
--far-from-solution
/ report failures) and switch to a trust region or damped step instead of loosening the target.
"Trust-region step decreased the objective, so accept and expand the radius."Acceptance and radius growth depend on the reduction ratio ρ, not just sign.
step_quality.py
only flags
expand
when ρ ≥ 0.75 and the step hit the boundary; a small positive ρ (
marginal
) means accept-but-shrink. Use the recorded
trust_radius_action
.
"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,
solver_selector.py
routes to matrix-free Newton-Krylov (JFNK) precisely because forming/factoring J is infeasible; use Jacobian-vector products plus a preconditioner instead.
诱人的捷径错误原因/正确做法
“残差比是一个小常数(≈0.1),所以是超线性收敛。”恒定收缩比属于线性收敛,而非超线性——
convergence_analyzer.py
会将其标记为
linear
(注释为“fast linear”)。超线性收敛要求收缩比趋近于0(阶数p>1.2)。不要根据恒定比值声称达到Newton级收敛。
“求解器未报错就停止了,所以已经收敛。”运行完成不等于收敛。检查
convergence_analyzer.py
/
residual_monitor.py
返回的
converged
是否符合实际容差;
stagnated
plateau
结果也会“停止”,但并未解决
f(x)=0
“两次迭代看起来在收缩,所以收敛速率没问题。”阶数估计至少需要3个严格递减的正残差;若残差数量不足,
convergence_analyzer.py
会返回
unknown
/仅返回速率。在引用收敛类型前,收集更多迭代数据。
“我编写了解析形式的Jacobian矩阵,所以肯定是正确的。”错误的Jacobian矩阵仍会产生步长。运行
jacobian_diagnostics.py --finite-diff-matrix
并确认
finite_diff_error
较小;若出现“Large discrepancy with finite-diff”提示,说明解析Jacobian矩阵存在bug,会悄无声息地将Newton收敛降级为线性收敛。
“Newton方法发散了,我只要缩小全局容差就可以认为足够接近了。”发散(
convergence_type: diverged
diverging
模式)表明步长方向错误或初始猜测远离解——应添加全局策略。运行
globalization_advisor.py
(使用
--far-from-solution
/报告失败情况),切换到信赖域或阻尼步长,而非放宽目标容差。
“信赖域步长降低了目标函数,所以接受并扩大半径。”接受步长和扩大半径取决于收缩比ρ,而非仅符号。只有当ρ≥0.75且步长触达边界时,
step_quality.py
才会标记
expand
;小正ρ(
marginal
)意味着接受步长但缩小半径。使用记录的
trust_radius_action
“Jacobian矩阵规模大且计算成本高,但全Newton方法是黄金标准,所以我还是要构建它。”当n≥1000或Jacobian矩阵计算成本高时,
solver_selector.py
会引导使用无矩阵Newton-Krylov(JFNK)方法,正是因为构建/分解J矩阵不可行;应使用Jacobian-向量乘积加预条件子替代。

Security

安全说明

Input Validation

输入验证

  • --size
    (problem size) is validated as a positive integer, bounded at 10 billion
  • --residuals
    are validated as finite non-negative numbers, capped at 100,000 entries
  • --tolerance
    and
    --target-tolerance
    are validated as finite positive numbers
  • --problem-type
    and
    --constraint-type
    are validated against fixed allowlists
  • --jacobian-quality
    is validated against a fixed allowlist (
    good
    ,
    ill-conditioned
    , etc.)
  • Step quality parameters (
    predicted-reduction
    ,
    actual-reduction
    ,
    step-norm
    ,
    gradient-norm
    ,
    trust-radius
    ) are validated as finite numbers
  • --size
    (问题规模)会被验证为正整数,上限为100亿
  • --residuals
    会被验证为有限非负数,条目上限为10万条
  • --tolerance
    --target-tolerance
    会被验证为有限正数
  • --problem-type
    --constraint-type
    会与固定允许列表进行验证
  • --jacobian-quality
    会与固定允许列表(
    good
    ,
    ill-conditioned
    等)进行验证
  • 步长质量参数(
    predicted-reduction
    ,
    actual-reduction
    ,
    step-norm
    ,
    gradient-norm
    ,
    trust-radius
    )会被验证为有限数

File Access

文件访问

  • jacobian_diagnostics.py
    reads a single matrix file specified by
    --matrix
    ; no directory traversal beyond the given path
  • Matrix files are size-limited and loaded with
    allow_pickle=False
    to prevent code execution
  • All other scripts read no external files; inputs are provided via CLI arguments
  • Scripts write only to stdout (JSON output)
  • jacobian_diagnostics.py
    仅读取
    --matrix
    指定的单个矩阵文件;不会遍历给定路径之外的目录
  • 矩阵文件有大小限制,加载时设置
    allow_pickle=False
    以防止代码执行
  • 所有其他脚本不读取外部文件;输入通过CLI参数提供
  • 脚本仅向标准输出(stdout)写入JSON结果

Tool Restrictions

工具限制

  • Read: Used to inspect script source, references, and user configuration files
  • Bash: Used to execute the six Python analysis scripts (
    solver_selector.py
    ,
    convergence_analyzer.py
    ,
    jacobian_diagnostics.py
    ,
    globalization_advisor.py
    ,
    residual_monitor.py
    ,
    step_quality.py
    ) with explicit argument lists
  • Write: Used to save analysis results or solver recommendations; writes are scoped to the user's working directory
  • Grep/Glob: Used to locate relevant files and search references
  • 读取: 用于检查脚本源码、参考资料和用户配置文件
  • Bash: 用于执行6个Python分析脚本(
    solver_selector.py
    ,
    convergence_analyzer.py
    ,
    jacobian_diagnostics.py
    ,
    globalization_advisor.py
    ,
    residual_monitor.py
    ,
    step_quality.py
    ),并使用明确的参数列表
  • 写入: 用于保存分析结果或求解器推荐;写入范围限定在用户工作目录
  • Grep/Glob: 用于定位相关文件和搜索参考资料

Safety Measures

安全措施

  • No
    eval()
    ,
    exec()
    , or dynamic code generation
  • All subprocess calls use explicit argument lists (no
    shell=True
    )
  • Matrix dimension limits prevent memory exhaustion when loading Jacobian files
  • Residual history analysis operates on bounded-length numeric arrays only
  • 不使用
    eval()
    exec()
    或动态代码生成
  • 所有子进程调用使用明确的参数列表(不使用
    shell=True
  • 矩阵维度限制可防止加载Jacobian文件时内存耗尽
  • 残差历史分析仅对有限长度的数值数组进行操作

Limitations

局限性

  • No global convergence guarantee: All methods may fail for pathological problems
  • Jacobian accuracy: Finite-difference Jacobian may be inaccurate near discontinuities
  • Large dense problems: May require specialized solvers not covered here
  • Constrained optimization: Complex constraints need SQP or interior point methods
  • 无全局收敛保证: 所有方法在面对病态问题时都可能失败
  • Jacobian矩阵精度: 有限差分Jacobian矩阵在不连续点附近可能不准确
  • 大规模稠密问题: 可能需要此处未涵盖的专用求解器
  • 约束优化: 复杂约束需要SQP或内点法

References

参考资料

  • references/solver_decision_tree.md
    - Problem-based solver selection
  • references/method_catalog.md
    - Method details and parameters
  • references/convergence_diagnostics.md
    - Diagnosing convergence issues
  • references/globalization_strategies.md
    - Line search and trust region
  • references/solver_decision_tree.md
    - 基于问题的求解器选择指南
  • references/method_catalog.md
    - 方法细节与参数说明
  • references/convergence_diagnostics.md
    - 收敛问题诊断指南
  • references/globalization_strategies.md
    - 线搜索与信赖域策略

Version History

版本历史

  • v1.2.2 (2026-06-24): Added a "Verification checklist" (evidence tied to each script's JSON outputs — convergence type/rate, residual patterns, Jacobian condition/finite-diff error, rank, trust-region step ratio, and solver/globalization agreement) and a "Common pitfalls & rationalizations" table covering constant-ratio-vs-superlinear, run-completion-vs-convergence, too-few-iterations, unverified analytic Jacobians, divergence handling, trust-region acceptance, and large/expensive-Jacobian routing
  • v1.2.0 (2026-06-23): Added
    --problem-type
    to
    solver_selector.py
    with a nonlinear least-squares path (Levenberg-Marquardt / Gauss-Newton); reordered solver selection so problem size dominates high-accuracy and routes large/expensive-Jacobian problems to Newton-Krylov; added
    --far-from-solution
    to
    globalization_advisor.py
    and surfaced Levenberg-Marquardt as the trust-region type for least-squares; corrected convergence classification so constant-ratio sequences are linear (not superlinear); RFC-8259-safe JSON (no
    -Infinity
    ); input-validation hardening
  • v1.1.0 (2026-03-26): Optimized agent-discovery description, evaluation suite, security review docs, standardized metadata block, CHANGELOG
  • v1.0.0: Initial release with 6 analysis scripts
  • v1.2.2 (2026-06-24): 添加“验证检查清单”(与各脚本JSON输出绑定的证据——收敛类型/速率、残差模式、Jacobian矩阵条件数/有限差分误差、秩、信赖域步长比、求解器/全局策略一致性)和“常见陷阱与误区”表格,涵盖恒定比值vs超线性、运行完成vs收敛、迭代次数不足、未验证的解析Jacobian矩阵、发散处理、信赖域接受规则、大规模/高成本Jacobian矩阵路由等内容
  • v1.2.0 (2026-06-23): 为
    solver_selector.py
    添加
    --problem-type
    参数,支持非线性最小二乘路径(Levenberg-Marquardt / Gauss-Newton);调整求解器选择逻辑,使问题规模优先于高精度需求,将大规模/高成本Jacobian矩阵问题引导至Newton-Krylov;为
    globalization_advisor.py
    添加
    --far-from-solution
    参数,并将Levenberg-Marquardt作为最小二乘问题的信赖域类型;修正收敛分类逻辑,将恒定比值序列标记为线性(而非超线性);支持符合RFC-8259标准的JSON(无
    -Infinity
    );强化输入验证
  • v1.1.0 (2026-03-26): 优化Agent发现描述、评估套件、安全审查文档,标准化元数据块,添加CHANGELOG
  • v1.0.0: 初始版本,包含6个分析脚本