Skip to main content

IpoptCalculatedQuantities

Struct IpoptCalculatedQuantities 

Source
pub struct IpoptCalculatedQuantities {
    pub s_max: Number,
    pub kappa_d: Number,
    pub slack_move: Number,
    /* private fields */
}
Expand description

Calculated-quantities object. Holds shared handles on data and the NLP; per-quantity caches live in RefCells here.

Fields§

§s_max: Number

Optimality scaling cap from IpOptErrorConvCheck defaults.

§kappa_d: Number

Damping coefficient for the bound-multiplier complementarity term (kappa_d in upstream’s RegisterOptions).

§slack_move: Number

Correction size for very small slacks (slack_move option, default mach_eps^{3/4}). Drives calculate_safe_slack’s upper cap on the moved bound — port of upstream’s slack_move_ (IpIpoptCalculatedQuantities.cpp:525).

Implementations§

Source§

impl IpoptCalculatedQuantities

Source

pub fn new(data: IpoptDataHandle, nlp: Rc<RefCell<dyn IpoptNlp>>) -> Self

Source

pub fn data(&self) -> &IpoptDataHandle

Source

pub fn nlp(&self) -> &Rc<RefCell<dyn IpoptNlp>>

Source

pub fn curr_slack_x_l(&self) -> Rc<dyn Vector>

Source

pub fn curr_slack_x_u(&self) -> Rc<dyn Vector>

Source

pub fn curr_slack_s_l(&self) -> Rc<dyn Vector>

Source

pub fn curr_slack_s_u(&self) -> Rc<dyn Vector>

Source

pub fn trial_slack_x_l(&self) -> Rc<dyn Vector>

Source

pub fn trial_slack_x_u(&self) -> Rc<dyn Vector>

Source

pub fn trial_slack_s_l(&self) -> Rc<dyn Vector>

Source

pub fn trial_slack_s_u(&self) -> Rc<dyn Vector>

Source

pub fn adjusted_trial_bounds(&self) -> Option<AdjustedBounds>

Compute the four trial slacks with safe-slack flooring and, if any component was corrected, the adjusted variable bounds that make the trial slacks exactly representable. Port of the bound-adjustment block in IpoptAlgorithm::AcceptTrialPoint (IpIpoptAlg.cpp:664-706): new_x_L = Px_L^T x - safe_slack_x_L, new_x_U = Px_U^T x + safe_slack_x_U, likewise for s/d. Returns None when no slack needed correcting.

Source

pub fn curr_grad_f(&self) -> Rc<dyn Vector>

Source

pub fn trial_grad_f(&self) -> Rc<dyn Vector>

Source

pub fn curr_c(&self) -> Rc<dyn Vector>

Source

pub fn trial_c(&self) -> Rc<dyn Vector>

Source

pub fn curr_d(&self) -> Rc<dyn Vector>

Source

pub fn trial_d(&self) -> Rc<dyn Vector>

Source

pub fn curr_jac_c(&self) -> Rc<dyn Matrix>

Source

pub fn curr_jac_d(&self) -> Rc<dyn Matrix>

Source

pub fn curr_exact_hessian(&self) -> Rc<dyn SymMatrix>

Source

pub fn curr_d_minus_s(&self) -> Rc<dyn Vector>

curr_d - s — port of IpIpoptCalculatedQuantities.cpp:1185-1206.

Source

pub fn trial_d_minus_s(&self) -> Rc<dyn Vector>

Source

pub fn curr_jac_c_t_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>

J_c^T y_c — for a generic vec argument (IpIpoptCalculatedQuantities.cpp:1373-1404).

Source

pub fn curr_jac_d_t_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>

J_d^T y_d for arbitrary vec.

Source

pub fn curr_jac_c_t_times_curr_y_c(&self) -> Rc<dyn Vector>

Source

pub fn curr_jac_d_t_times_curr_y_d(&self) -> Rc<dyn Vector>

Source

pub fn curr_jac_c_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>

J_c vIpIpoptCalculatedQuantities.cpp:1303-1321.

Source

pub fn curr_jac_d_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>

J_d vIpIpoptCalculatedQuantities.cpp:1323-1343.

Source

pub fn curr_grad_lag_x(&self) -> Rc<dyn Vector>

∇_x L = ∇f(x) + J_c^T y_c + J_d^T y_d - P_L z_L + P_U z_U per IpIpoptCalculatedQuantities.cpp:1993-2030.

Source

pub fn curr_grad_lag_s(&self) -> Rc<dyn Vector>

∇_s L = -y_d - P_L v_L + P_U v_U (IpIpoptCalculatedQuantities.cpp:2069-2098).

Source

pub fn curr_compl_x_l(&self) -> Rc<dyn Vector>

Source

pub fn curr_compl_x_u(&self) -> Rc<dyn Vector>

Source

pub fn curr_compl_s_l(&self) -> Rc<dyn Vector>

Source

pub fn curr_compl_s_u(&self) -> Rc<dyn Vector>

Source

pub fn curr_relaxed_compl_x_l(&self) -> Rc<dyn Vector>

s_L .* z_L - mu — relaxed complementarity used in the KKT RHS. IpIpoptCalculatedQuantities.cpp:2406-2430.

Source

pub fn curr_relaxed_compl_x_u(&self) -> Rc<dyn Vector>

Source

pub fn curr_relaxed_compl_s_l(&self) -> Rc<dyn Vector>

Source

pub fn curr_relaxed_compl_s_u(&self) -> Rc<dyn Vector>

Source

pub fn curr_sigma_x(&self) -> Rc<dyn Vector>

Source

pub fn curr_sigma_s(&self) -> Rc<dyn Vector>

Source

pub fn curr_f(&self) -> Number

Source

pub fn unscaled_curr_f(&self) -> Number

Unscaled objective at the current iterate. curr_f returns the internally scaled value (f · df_); upstream IPOPT prints the unscaled objective in its iteration log, so this divides the scaling back out. Mirrors IpoptCalculatedQuantities:: unscaled_curr_f. A zero factor (scaling never determined) is treated as the identity.

Source

pub fn curr_unscaled_dual_infeasibility_max(&self) -> Number

Max-norm dual infeasibility in the unscaled (user-original) space. Self::curr_dual_infeasibility_max is evaluated in the internally-scaled NLP space (objective × df, constraints × dc); because POUNCE applies no variable scaling, every term of the Lagrangian gradient ∇f + Jᵀy − z carries the same objective factor df, so the unscaling is a single divide by df = obj_scaling_factor. A zero or unit factor returns the scaled value unchanged — the common no-scaling path stays division-free.

Source

pub fn curr_unscaled_complementarity_max(&self) -> Number

Max-norm complementarity in the unscaled space. Each bound block s · z scales uniformly by df: the slack’s dc/dd factor and the multiplier’s df/dc (df/dd) factor cancel in the product, leaving df. So this is the scaled max-norm divided by df. See Self::curr_unscaled_dual_infeasibility_max.

Source

pub fn curr_unscaled_primal_infeasibility_max(&self) -> Number

Max-norm primal infeasibility in the unscaled space. Unlike the dual/complementarity terms the constraint scaling is per-row (c_scaled = dc ⊙ c_user, (d−s)_scaled = dd ⊙ (d−s)_user), so each block is unscaled element-by-element before the max-norm. When no row scaling is active (c_scale_vec/d_scale_vec both None — the common case) this is exactly Self::curr_primal_infeasibility_max.

Source

pub fn obj_scaling_factor(&self) -> Number

The objective scaling factor df currently in force (1.0 when no objective scaling is active).

Exposed because the termination logic must be able to tell an honest certificate from one an extreme scale has masked (gh #200): the scale factor itself is the discriminating signal, not the error.

Source

pub fn computed_obj_scaling_factor(&self) -> Number

The solver-computed part of the objective scale — see IpoptNlp::computed_obj_scaling_factor. The masked-certificate test keys on this, not on the product, so a user who deliberately scales a well-conditioned objective down is not second-guessed.

Source

pub fn curr_unscaled_nlp_error(&self) -> Number

Overall unscaled max-norm KKT error — max of the unscaled dual infeasibility, primal infeasibility, and complementarity. This is the honest “distance from a KKT point in the user’s own units”, as opposed to Self::curr_nlp_error, which additionally applies the s_d/s_c optimality scaling. Used by the status-fidelity gate and surfaced to callers that must independently verify a returned certificate (pounce#173).

Source

pub fn trial_f(&self) -> Number

Source

pub fn curr_barrier_obj(&self) -> Number

Source

pub fn trial_barrier_obj(&self) -> Number

Source

pub fn curr_grad_barrier_obj_x(&self) -> Rc<dyn Vector>

Gradient of the barrier objective wrt x: ∇_x φ = ∇f(x) − μ · [P_L · (1/s_L) − P_U · (1/s_U)] + damping Mirrors IpIpoptCalculatedQuantities.cpp:CalcGradBarrierObjectiveX.

Source

pub fn curr_grad_barrier_obj_s(&self) -> Rc<dyn Vector>

Gradient of the barrier objective wrt s: ∇_s φ = − μ · [P_L · (1/s_s_L) − P_U · (1/s_s_U)] + damping

Source

pub fn curr_grad_barr_t_delta( &self, delta_x: &dyn Vector, delta_s: &dyn Vector, ) -> Number

Directional derivative of the barrier objective along (δx, δs): gradBarrTDelta = ∇_x φ · δx + ∇_s φ · δs. Port of IpIpoptCalculatedQuantities.cpp:CurrGradBarrTDelta (called IpCq().curr_gradBarrTDelta() in upstream after the search dir has been computed).

Source

pub fn curr_dwd(&self, delta_x: &dyn Vector, delta_s: &dyn Vector) -> Number

δᵀ(W + Σ_x + δ_pert_x I)δ_x + δ_sᵀ(Σ_s + δ_pert_s I)δ_s — the quadratic-model term used by IpPenaltyLSAcceptor.cpp: InitThisLineSearch:101-129. Reads W and the active PD perturbations from crate::ipopt_data::IpoptData. Returns 0 if the result would be negative (matching upstream’s if dWd <= 0 then dWd = 0 guard at line 133).

Source

pub fn curr_constraint_violation(&self) -> Number

Source

pub fn trial_constraint_violation(&self) -> Number

Source

pub fn curr_primal_infeasibility_max(&self) -> Number

Max-norm primal infeasibility — max(||c||_∞, ||d − s||_∞). Used by the iteration output’s inf_pr column when inf_pr_output == INTERNAL. Mirrors IpIpoptCalculatedQuantities.cpp:CurrPrimalInfeasibility(NORM_MAX).

Source

pub fn curr_dual_infeasibility_max(&self) -> Number

Max-norm dual infeasibility — max(||∇_x L||_∞, ||∇_s L||_∞). Mirrors IpIpoptCalculatedQuantities.cpp:CurrDualInfeasibility(NORM_MAX).

Source

pub fn infeasibility_descent_available(&self) -> bool

Scaled stationarity of the infeasibility measure ½‖(c, d−s)‖²‖J_cᵀ c + J_dᵀ (d−s)‖_∞ / max(1, ‖(c, d−s)‖_∞). The numerator is the x-gradient of the squared constraint violation; a value near zero with the violation itself bounded away from zero marks an iterate converging to a stationary point of the infeasibility — i.e. a locally infeasible problem. No linear solve: two transpose-products. Mirrors the gradient term behind Ipopt’s IpRestoConvCheck.cpp LOCALLY_INFEASIBLE test, applied here in the main loop. Does a short step along −∇θ actually reduce the constraint violation?

LocalInfeasibility asserts the iterate has converged to a stationary point of the constraint violation — that no local move reduces it. That is a checkable claim, and this checks it directly instead of trusting a threshold on a proxy.

Why a probe rather than a better proxy: the detector’s surrogate is ‖Jᵀc‖ / max(1, ‖c‖) against an absolute tolerance, and no variant of it separates the cases. Measured over 800 MINLPLib models plus targeted infeasible problems, the scaled form produces a confirmed false verdict (HS13 from x₀ = (1e4, 1e4), where the constraint scaling dc ≈ 3.3e-7 drives the surrogate to 5e-14 at a point whose violation is 0.51); the unscaled form needs a tolerance ≥ 1e-2 to fire at all, which introduces new false infeasibility on 3+ corpus models while still losing 2 correct detections; and a scale-invariant ‖Jᵀc‖ / ‖c‖² is not separable even on the targeted set. A single absolute threshold on a surrogate cannot do this job.

Comparing θ at two points is scale-free by construction — the row scaling cancels out of the ratio — so this needs no calibration at all.

Costs one eval_c/eval_d pair per probed step, and runs only where the detector was about to fire (both gates already passed for a full streak), which is rare. Steps are clamped to the variable bounds, so descent that only exists outside the box is correctly not counted — that direction would suppress a correct infeasibility verdict.

Returns true when descent is available, i.e. the iterate is not stationary and LocalInfeasibility must not be declared.

Source

pub fn curr_infeasibility_stationarity(&self) -> Number

Source

pub fn curr_avrg_compl(&self) -> Number

(z_L · s_L + z_U · s_U + v_L · s_L^d + v_U · s_U^d) / N where N is the total number of bound multipliers (IpIpoptCalculatedQuantities.cpp:3553-3606).

Source

pub fn curr_complementarity_min(&self) -> Number

min_i (s_i · z_i) over all four bound complementarity blocks. Mirrors IpIpoptCalculatedQuantities.cpp:CurrComplxMin (lines 3608-3640) — the smallest pairwise product s · z, signalling how close the iterate is to the central path. Empty bound sets contribute +∞; returns 0 if no bounds at all.

Source

pub fn curr_complementarity_max(&self) -> Number

Max-norm of the unbarriered complementarity blocks max_i |s_i · z_i| across all four (x_L, x_U, s_L, s_U) pairs. Mirrors upstream IpIpoptCalculatedQuantities.cpp:CurrComplementarity(0., NORM_MAX) — used by OptimalityErrorConvergenceCheck to gate the per-component compl_inf_tol test independently of the scaled scalar curr_nlp_error.

Source

pub fn curr_centrality_measure(&self) -> Number

Centrality measure ξ = min_i(s_i z_i) / avrg(s · z). Mirrors IpIpoptCalculatedQuantities.cpp:CurrCentralityMeasure. Used by crate::mu::oracle::loqo::LoqoMuOracle to bias σ toward the central path when the iterate is unbalanced. Returns 1.0 (perfectly central) when there are no bound multipliers.

Source

pub fn curr_barrier_error(&self) -> Number

Barriered KKT error E_μ(x,y,z) — port of IpIpoptCalculatedQuantities.cpp:CurrBarrierError. Same as Self::curr_nlp_error but uses the relaxed complementarity s ⊙ z − μ so the residual is zero when the iterate sits on the μ-perturbed central path. The monotone barrier-update strategy reduces μ only once this error drops below barrier_tol_factor · μ.

Source

pub fn curr_nlp_error(&self) -> Number

Optimality-scaled max-norm KKT error — port of IpIpoptCalculatedQuantities.cpp:3050-3104.

  E = max( ||∇_x L, ∇_s L||_∞ / s_d ,
           ||c, d − s||_∞ ,
           ||compl||_∞ / s_c )

where s_d / s_c are the asum-based scalings from ComputeOptimalityErrorScaling (see §4 of MAIN_LOOP.md). Uses mu_target = 0 (the unbarriered KKT residual). The barriered variant is curr_barrier_error (TODO in Phase 7).

Source

pub fn trial_jac_c(&self) -> Rc<dyn Matrix>

Source

pub fn trial_jac_d(&self) -> Rc<dyn Matrix>

Source

pub fn trial_grad_lag_x(&self) -> Rc<dyn Vector>

∇_x L at the trial iterate — analog of Self::curr_grad_lag_x.

Source

pub fn trial_grad_lag_s(&self) -> Rc<dyn Vector>

∇_s L at the trial iterate — analog of Self::curr_grad_lag_s.

Source

pub fn trial_compl_x_l(&self) -> Rc<dyn Vector>

Source

pub fn trial_compl_x_u(&self) -> Rc<dyn Vector>

Source

pub fn trial_compl_s_l(&self) -> Rc<dyn Vector>

Source

pub fn trial_compl_s_u(&self) -> Rc<dyn Vector>

Source

pub fn curr_primal_dual_system_error(&self, mu: Number) -> Number

Unscaled primal-dual KKT system error at the current iterate — port of IpIpoptCalculatedQuantities.cpp:curr_primal_dual_system_error. Each block uses the 1-norm scaled by its entry count; the result is the sum of the dual-infeasibility, primal-infeasibility, and complementarity terms. Used by the soft restoration phase’s sufficient-reduction test.

Source

pub fn trial_primal_dual_system_error(&self, mu: Number) -> Number

Unscaled primal-dual KKT system error at the trial iterate — trial-side analog of Self::curr_primal_dual_system_error.

Source

pub fn curr_grad_lag_with_damping_x(&self) -> Rc<dyn Vector>

curr_grad_lag_x plus the kappa_d · μ · (Px_L · 1 − Px_U · 1) damping term on singly-bounded primals — port of IpIpoptCalculatedQuantities.cpp:2131-2180. When kappa_d == 0 returns the un-damped gradient.

Source

pub fn curr_grad_lag_with_damping_s(&self) -> Rc<dyn Vector>

Source

pub fn grad_kappa_times_damping_x(&self) -> Rc<dyn Vector>

kappa_d · (P_L · damping_l − P_U · damping_u) in the full x space — port of IpIpoptCalculatedQuantities.cpp::grad_kappa_times_damping_x (lines 912-949). Unlike curr_grad_lag_with_damping_x this does NOT include grad_lag_x and is NOT scaled by mu; the centering RHS in the quality-function oracle multiplies the returned vector by -avrg_compl per upstream IpQualityFunctionMuOracle.cpp:229.

Source

pub fn grad_kappa_times_damping_s(&self) -> Rc<dyn Vector>

Source

pub fn aff_step_alpha_primal_max( &self, delta_aff: &IteratesVector, tau: Number, ) -> Number

Max primal step that keeps s + α · Δs > 0 for the four slack blocks (x_L, x_U, s_L, s_U), bounded by the fraction-to-the- boundary parameter τ ∈ (0, 1]. Mirrors CalcFracToBound against the projected step P_L^T Δx, −P_U^T Δx, P_L^T Δs, −P_U^T Δs.

Source

pub fn aff_step_alpha_dual_max( &self, delta_aff: &IteratesVector, tau: Number, ) -> Number

Max dual step that keeps z + α · Δz > 0 (and same for v).

Source

pub fn aff_step_compl_avrg( &self, delta_aff: &IteratesVector, alpha_primal: Number, alpha_dual: Number, ) -> Number

Predicted average complementarity after the affine step: (1/N) · Σ (s + α_pri · Δs) · (z + α_du · Δz) summed over the four bound blocks. Returns 0 when there are no bounds.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more