Skip to main content

Module solver

Module solver 

Source
Expand description

Solver — value-typed session API that holds an IpoptApplication, its TNLP, and the converged KKT factor between calls.

This is Phase 3a of the factor-reuse work tracked in pounce#16. It is the public surface for callers who want to:

  1. Run a normal IPM solve, then
  2. Issue many cheap operations against the converged factor (kkt_solve, parametric_step) without going through the set_on_converged callback shape that crate::SensSolve requires.

§Usage

use pounce_sensitivity::Solver;
use std::cell::RefCell;
use std::rc::Rc;

let app = make_configured_app();
let tnlp: Rc<RefCell<dyn TNLP>> = Rc::new(RefCell::new(MyTnlp));
let mut solver = Solver::new(app, tnlp);

let status = solver.solve();
assert!(solver.converged().is_some());

// Issue any number of back-solves against the same factor:
let dim = solver.kkt_dim().unwrap();
let mut lhs = vec![0.0; dim];
let rhs = vec![1.0; dim];
solver.kkt_solve(&rhs, &mut lhs).unwrap();

// Parametric step with respect to a set of pinned equality
// constraints (same interpretation as [`crate::SensSolve`]):
let dx = solver.parametric_step(&[2, 3], &[-0.5, 0.0]).unwrap();

§Scope of Phase 3a

  • In: solve(), converged(), kkt_solve(), parametric_step(), block_dims() / kkt_dim().
  • Deferred to Phase 3b: resolve() (warm-start that reuses the linear backend pool), compute_reduced_hessian() on the Solver (currently only available through crate::SensSolve), and the parametric_mpc / sensitivity_session example binaries.

Structs§

ConvergedState
State captured at convergence: the user-visible iterate plus the PdSensBacksolver that wraps the converged KKT factor.
Solver
Session-style solver: holds an IpoptApplication, its TNLP, and the converged factor between calls.

Enums§

SolverError
Errors returned by post-convergence operations on Solver.