#[unsafe(no_mangle)]pub unsafe extern "C" fn GetIpoptCurrentViolations(
ipopt_problem: IpoptProblem,
scaled: Bool,
n: Index,
x_l_violation: *mut Number,
x_u_violation: *mut Number,
compl_x_l: *mut Number,
compl_x_u: *mut Number,
grad_lag_x: *mut Number,
m: Index,
nlp_constraint_violation: *mut Number,
compl_g: *mut Number,
) -> BoolExpand description
Port of IpStdCInterface.cpp:GetIpoptCurrentViolations (Ipopt 3.14+).
Same contract as GetIpoptCurrentIterate; returns FALSE when
called outside an active intermediate callback.
scaled keeps upstream’s meaning (TNLP::get_curr_violations):
FALSE— the user’s problem, unscaled: objective, constraint and per-variable scaling undone, fullnwith fixed variables, rows ingorder. Computed from the live iterateGetIpoptCurrentIteratereads (so with presolve on, the user’s own rows and columns) against the declared bounds:x_L_violation = max(0, x_L − x),compl_x_L = (x − x_L^alg)·z_Lwithx_L^algthe bound the algorithm’s slack is measured to (declared, widened bybound_relax_factor: upstream’scurr_compl_x_L / obj, except under per-variable user scaling, where pounce relaxes in the scaled frame and Ipopt in the unscaled one),grad_lag_x = ∇f + Jᵀλ − z_L + z_U(0at fixed variables, as upstream’sResortXleaves them;∇fandJcome from this problem’seval_grad_f/eval_jac_g, called only whengrad_lag_xis requested), per-row violation|g − g_L|/max(0, g_L − g, g − g_U)andcompl_gwith upstream’s signs. Both arms.TRUE— upstream’sget_curr_violations(scaled = true): the same quantities in the algorithm’s scaled space, each a fixed factor of its unscaled counterpart (pounce_nlp::live_iterate::scale_violations): bound violations× d, complementarities× obj,grad_lag_x × obj/d, row violations× s— the factorsGetIpoptCurrentIterate(scaled = TRUE) applies. Both arms (the SQP arm’s scaled space isdand theobj_scaling_factoroption: it runs no other scaling), and under presolve, where a removed column or row carries factor 1.
§Safety
ipopt_problem must be a valid IpoptProblem. Each output buffer,
when non-NULL, must hold at least the declared length.