Skip to main content

IpoptCreateSolver

Function IpoptCreateSolver 

Source
#[unsafe(no_mangle)]
pub unsafe extern "C" fn IpoptCreateSolver( prob_handle: *mut IpoptProblem, ) -> IpoptSolver
Expand description

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).

Returns NULL if prob_handle is NULL, *prob_handle is NULL, or the IpoptProblem hasn’t been fully initialized.

Also returns NULL — without consuming the problem: the caller still owns *prob_handle and frees it with crate::FreeIpoptProblem — when the problem has declared complementarity pairs (gh#1147). A session keeps the KKT factor of the model it solved, and with pairs that is the lowered model (extra product rows, possibly lifted variables), so IpoptSolverParametricStep and IpoptSolverReducedHessian over the caller’s rows would answer a different system. At print_level >= 1 one line on stderr says why. Python’s pounce.Solver refuses pairs for the same reason.

§Safety

prob_handle must be a valid pointer to an IpoptProblem previously returned by crate::CreateIpoptProblem (or NULL).