Skip to main content

Module solver

Module solver 

Source
Expand description

Session-style C ABI built on pounce_sensitivity::Solver.

Adds an opaque IpoptSolver handle that captures the converged KKT factor between calls, so C consumers can issue many cheap operations (KKT back-solves, parametric steps, reduced Hessians) against the same factorization without re-running the IPM.

IpoptProblem prob = CreateIpoptProblem(...);
AddIpoptStrOption(prob, "linear_solver", "feral");
IpoptSolver sol = IpoptCreateSolver(&prob);   // consumes prob
IpoptSolverSolve(sol, x, NULL, NULL, NULL, NULL, NULL, user_data);
IpoptSolverParametricStep(sol, 2, pin_indices, deltas, dx_out);
IpoptSolverReducedHessian(sol, 2, pin_indices, 1.0, hr_out);
IpoptFreeSolver(sol);

Ownership: IpoptCreateSolver takes the IpoptProblem by pointer to the handle and nulls it out on success — the IpoptSolver becomes the sole owner. Calling crate::FreeIpoptProblem on the now-null handle is safe (it null-checks).

Structs§

IpoptSolverInfo
Internal owned state for the session-style C handle.

Functions§

IpoptCreateSolver
Build an IpoptSolver session from a configured IpoptProblem. Consumes the IpoptProblem on success: the pointer at *prob_handle is set to NULL and ownership transfers to the returned IpoptSolver. The user should not use the original handle again, though calling crate::FreeIpoptProblem on the now-null pointer is harmless (it null-checks).
IpoptFreeSolver
Release an IpoptSolver and all owned resources, including the IpoptProblem state that was consumed by IpoptCreateSolver.
IpoptSolverGetKktDim
Total compound-KKT vector dimension. Returns -1 if no converged factor is held.
IpoptSolverKktSolve
Solve K · lhs = rhs against the converged KKT factor. Both rhs and lhs are flat buffers of length IpoptSolverGetKktDim in the x || s || y_c || y_d || z_l || z_u || v_l || v_u packing.
IpoptSolverParametricStep
First-order parametric step Δx ≈ ∂x*/∂p · Δp. pin_indices is n_pins Index values (0-based indices into g(x)); deltas is the parameter perturbation Δp of the same length; dx_out is the n-long primal step output (length matches the problem’s n).
IpoptSolverReducedHessian
Reduced Hessian H_R = obj_scal · B K⁻¹ Bᵀ over the pinned rows. hr_out receives an n_pins²-long column-major dense matrix.
IpoptSolverSolve
Run the IPM. Same output buffer contract as crate::IpoptSolve: x is in/out (initial guess in, solution out); g, obj_val, mult_g, mult_x_L, mult_x_U are out-only and may be NULL. user_data is threaded into the C callbacks unchanged.

Type Aliases§

IpoptSolver
Opaque session-style handle. Construction via IpoptCreateSolver; release via IpoptFreeSolver.