Expand description
Parametric-sensitivity and reduced-Hessian post-processing for the
pounce driver.
This is the suffix-driven sIPOPT path: when an AMPL .nl declares
the sIPOPT-style suffixes (sens_state_1, sens_state_value_1,
sens_init_constr), pounce runs a normal solve and then performs
the post-optimal sensitivity step via pounce-sensitivity, writing
the perturbed primal back into the .sol as a sens_sol_state_1
suffix. The --compute-red-hessian flag additionally computes the
reduced Hessian over the variables tagged by the red_hessian
integer var-suffix.
Mirror of upstream sIPOPT’s ipopt_sens AMPL binary
(ref/Ipopt/contrib/sIPOPT/src/AmplTNLP.cpp etc.),
limited to the metadata-measurement path that the
parametric_ampl example exercises.
The required suffixes (otherwise the solve is a plain nominal solve):
sens_state_1— integer var-suffix tagging each parameter (value = 1..n_params, 0 for non-parameters).sens_state_value_1— real var-suffix carrying the perturbed parameter values.sens_init_constr— integer con-suffix tagging which constraint pins each parameter to its nominal value (value = 1..n_params, 0 otherwise).
See ref/Ipopt/contrib/sIPOPT/examples/parametric_cpp/parametricTNLP.cpp
get_var_con_metadata for the canonical suffix shape upstream
emits, and pounce#16’s parametric_cpp.rs for an end-to-end
cross-check against upstream’s golden output.
Structs§
- RedHessian
Result - Outputs of
try_compute_red_hessian: the column-majorn × nreduced Hessian (hr), the variable indicesvar_indicesthat label its rows/cols (so a downstream JSON consumer can map back to AMPL var names), and the optional eigendecomposition.
Functions§
- compute_
sens_ perturbed_ x - Run the post-optimal sensitivity step and return the perturbed
primal lifted onto the full-x grid (length
n_full). ReturnsNone(quietly) when the required suffixes are missing — the caller then writes just the nominal solution. - is_
sensitivity_ input - True when the
.nldeclares the three sIPOPT-style suffixes that drive the parametric sensitivity step. When this returnsfalse,pounceruns a plain nominal solve. - print_
red_ hessian_ to_ stderr - Format a reduced Hessian (and optional eigendecomp) onto stderr.
Matches the style of upstream sIPOPT’s
SensReducedHessianCalculator.cppS->Print(...)/eigenvalues->Print(...)calls — informational, not parsed. - sol_
suffix_ to_ report - Convert a
.sol-shaped suffix block into the JSON report’s flat representation. - try_
compute_ red_ hessian - Read the AMPL
red_hessianinteger var-suffix from.nl, select the tagged free variables, and compute the reduced Hessian viaSensApplication::compute_reduced_hessian(optionally also the eigendecomposition). ReturnsNone(quietly) when the suffix is missing or empty.