Skip to main content

Module check_x0

Module check_x0 

Source
Expand description

pounce check-x0 <problem.nl> — starting-point preflight.

§Why this exists

A local NLP solver’s fate is largely decided at iteration 0, but the solver only reports starting-point trouble after it has tripped over it (Invalid_Number_Detected mid-solve, immediate restoration, a slow crawl caused by scaling). This subcommand evaluates the model once at its starting point, before any solve, and reports what the initializer and the first iteration will actually see:

  • Non-finite evaluations — NaN/inf in f, ∇f, g, the Jacobian, or the Hessian at x0. These are fatal: the solve would abort.
  • Bound violations of x0 and components sitting exactly on a bound (the interior clamp will move both; see below).
  • Interior-clamp displacement — the bound_push / bound_frac clamp (DefaultIterateInitializer) applied to x0, so “the solver silently moved my point” is visible up front.
  • Initial constraint violation per row (infeasibility is fine for the IPM, but very large violations usually mean a wrong or missing starting point).
  • Derivative scale spread — max/min nonzero magnitudes of ∇f and the Jacobian at x0, the early-warning signal for scaling trouble.
  • Automatic scaling — the objective and per-row factors nlp_scaling_method=gradient-based (the default) will pick at this x0, computed by the solver’s own arithmetic; plus, for a .nl model, the coefficient magnitudes of its quadratic rows, which that sample cannot report. See ScalingPreview.

The checks are read-only and cost one evaluation of each callback: O(nnz) work, no factorization, no solve.

Verdict / exit code: 0 when the model evaluates cleanly at x0 (warnings allowed); 21 when an evaluation produced NaN/inf (the solver would fail); 2 on a usage or I/O error.

User-facing background: docs/src/initialization.md.

Structs§

CheckX0Args
Parsed check-x0 subcommand arguments.
CheckX0Outcome
The fully-evaluated preflight result.
ClampMove
One interior-clamp displacement entry.
NonFinite
One non-finite evaluation entry.
NonFiniteEntry
One Jacobian/Hessian non-finite entry (row/col in matrix coordinates).
QuadRowCoef
Point-free coefficient magnitudes of one quadratic constraint row.
QuadRowScale
The coefficient magnitudes of one quadratic constraint row, read off the .nl without reference to any point, paired with what the gradient sample at x0 made of it.
RowScaleBlock
One row block’s share of the gradient-based scaling preview.
ScaleSpread
Max/min-nonzero magnitude summary of a derivative array at x0.
ScalingPreview
What nlp_scaling_method=gradient-based will do to this model at this x0 — the solver’s own arithmetic (gradient_obj_scale / gradient_row_scale), not a copy of it.

Constants§

NLP_SCALING_MAX_GRADIENT
nlp_scaling_max_gradient’s default — the cutoff above which gradient-based scaling fires. Overridable with --scaling-max-gradient so a preflight can preview the same cutoff the solve will run under.
NLP_SCALING_MIN_VALUE
nlp_scaling_min_value’s default — the floor on a computed scale.

Functions§

check_tnlp
The core preflight over any TNLP. Public so the debugger / tests can reuse it without going through a file.
check_tnlp_with_quadratics
check_tnlp plus the quadratic-row coefficients read off the model’s .nl (see quad_row_coefs), which is the half of the scaling report no evaluation at x0 can produce.
clamp_to_interior
The per-component interior clamp from DefaultIterateInitializer::push_to_interior (see crates/pounce-algorithm/src/init/default.rs and docs/src/initialization.md).
quad_row_coefs
Read every constraint row’s quadratic coefficients out of an NlProblem.
run
run_from_argv
Entry point dispatched from main when argv[1] == “check-x0”.