Skip to main content

Module ipopt_cq

Module ipopt_cq 

Source
Expand description

Lazy-cache layer — port of Algorithm/IpIpoptCalculatedQuantities.{hpp,cpp}.

Upstream’s CQ object exposes ~80 cached quantities (curr_f, curr_grad_f, curr_jac_c, curr_grad_lag_x, curr_compl_*, curr_nlp_error, etc.). All of them are pure derivations from (x, s, y_c, y_d, z_l, z_u, v_l, v_u) and the NLP function evaluations.

Phase 5 ships the priority subset needed by the KKT layer (Phase 6) and the convergence check / line search (Phase 7). Caching is intentionally deferred — every accessor recomputes its value on each call. Tag-based invalidation lands once the inner loop benchmarks justify the bookkeeping; correctness does not depend on it.

All accessors take &self and return Rc<dyn Vector>. NLP evaluations require a brief borrow_mut() on the Nlp handle; callers must not hold an outstanding borrow() across an accessor call.

Structs§

AdjustedBounds
Result of IpoptCalculatedQuantities::adjusted_trial_bounds: the new x_L / x_U / d_L / d_U to install on the NLP when one or more trial slacks were corrected by the safe-slack mechanism.
IpoptCalculatedQuantities
Calculated-quantities object. Holds shared handles on data and the NLP; per-quantity caches live in RefCells here.

Constants§

ROW_NOISE_KAPPA
Safety factor on the per-row noise floor of IpoptCalculatedQuantities::row_noise_floor. The floor prices one component of x at eps · ‖x‖_∞ and passes it through the row at max_j |a_ij|; the row’s residual accumulates that over all of its nonzeros, and the linear solve’s conditioning widens it further, so the bare product is short by a problem-dependent factor. 64 covers a typical sparse row without reaching far enough to swallow a declared magnitude a model could have meant: at the ‖x‖_∞ ~ 1 of a well-posed problem the floor sits near 1.4e-14, still nine orders under constr_viol_tol’s default. Rows it silences fall back on the absolute feasibility test, which is already scale-invariant on a row whose declared magnitude is numerically zero.

Functions§

unscaled_block_amax
Max-norm of v after dividing each entry by its per-row scale factor (max_i |v_i / scale_i|). scale == None means “no row scaling” and returns the plain v.amax(); a zero factor for an entry is treated as the identity (no divide) so a degenerate scale never yields infinities. Falls back to v.amax() for a non-dense backing — POUNCE is dense-only, so that branch is defensive.

Type Aliases§

IpoptCqHandle
Convenience handle. Mirrors upstream’s SmartPtr<CQ> flow.