pub struct IpoptCalculatedQuantities {
pub s_max: Number,
pub kappa_d: 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: NumberOptimality scaling cap from IpOptErrorConvCheck defaults.
kappa_d: NumberDamping coefficient for the bound-multiplier complementarity
term (kappa_d in upstream’s RegisterOptions).
Implementations§
Source§impl IpoptCalculatedQuantities
impl IpoptCalculatedQuantities
pub fn new(data: IpoptDataHandle, nlp: Rc<RefCell<dyn IpoptNlp>>) -> Self
pub fn data(&self) -> &IpoptDataHandle
pub fn nlp(&self) -> &Rc<RefCell<dyn IpoptNlp>>
pub fn curr_slack_x_l(&self) -> Rc<dyn Vector>
pub fn curr_slack_x_u(&self) -> Rc<dyn Vector>
pub fn curr_slack_s_l(&self) -> Rc<dyn Vector>
pub fn curr_slack_s_u(&self) -> Rc<dyn Vector>
pub fn trial_slack_x_l(&self) -> Rc<dyn Vector>
pub fn trial_slack_x_u(&self) -> Rc<dyn Vector>
pub fn trial_slack_s_l(&self) -> Rc<dyn Vector>
pub fn trial_slack_s_u(&self) -> Rc<dyn Vector>
pub fn curr_grad_f(&self) -> Rc<dyn Vector>
pub fn trial_grad_f(&self) -> Rc<dyn Vector>
pub fn curr_c(&self) -> Rc<dyn Vector>
pub fn trial_c(&self) -> Rc<dyn Vector>
pub fn curr_d(&self) -> Rc<dyn Vector>
pub fn trial_d(&self) -> Rc<dyn Vector>
pub fn curr_jac_c(&self) -> Rc<dyn Matrix>
pub fn curr_jac_d(&self) -> Rc<dyn Matrix>
pub fn curr_exact_hessian(&self) -> Rc<dyn SymMatrix>
Sourcepub fn curr_d_minus_s(&self) -> Rc<dyn Vector>
pub fn curr_d_minus_s(&self) -> Rc<dyn Vector>
curr_d - s — port of IpIpoptCalculatedQuantities.cpp:1185-1206.
pub fn trial_d_minus_s(&self) -> Rc<dyn Vector>
Sourcepub fn curr_jac_c_t_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>
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).
Sourcepub fn curr_jac_d_t_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>
pub fn curr_jac_d_t_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>
J_d^T y_d for arbitrary vec.
pub fn curr_jac_c_t_times_curr_y_c(&self) -> Rc<dyn Vector>
pub fn curr_jac_d_t_times_curr_y_d(&self) -> Rc<dyn Vector>
Sourcepub fn curr_jac_c_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>
pub fn curr_jac_c_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>
J_c v — IpIpoptCalculatedQuantities.cpp:1303-1321.
Sourcepub fn curr_jac_d_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>
pub fn curr_jac_d_times_vec(&self, vec: &dyn Vector) -> Rc<dyn Vector>
J_d v — IpIpoptCalculatedQuantities.cpp:1323-1343.
Sourcepub fn curr_grad_lag_x(&self) -> Rc<dyn Vector>
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.
Sourcepub fn curr_grad_lag_s(&self) -> Rc<dyn Vector>
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).
pub fn curr_compl_x_l(&self) -> Rc<dyn Vector>
pub fn curr_compl_x_u(&self) -> Rc<dyn Vector>
pub fn curr_compl_s_l(&self) -> Rc<dyn Vector>
pub fn curr_compl_s_u(&self) -> Rc<dyn Vector>
Sourcepub fn curr_relaxed_compl_x_l(&self) -> Rc<dyn Vector>
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.
pub fn curr_relaxed_compl_x_u(&self) -> Rc<dyn Vector>
pub fn curr_relaxed_compl_s_l(&self) -> Rc<dyn Vector>
pub fn curr_relaxed_compl_s_u(&self) -> Rc<dyn Vector>
pub fn curr_sigma_x(&self) -> Rc<dyn Vector>
pub fn curr_sigma_s(&self) -> Rc<dyn Vector>
pub fn curr_f(&self) -> Number
Sourcepub fn unscaled_curr_f(&self) -> Number
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.
pub fn trial_f(&self) -> Number
pub fn curr_barrier_obj(&self) -> Number
pub fn trial_barrier_obj(&self) -> Number
Sourcepub fn curr_grad_barrier_obj_x(&self) -> Rc<dyn Vector>
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.
Sourcepub fn curr_grad_barrier_obj_s(&self) -> Rc<dyn Vector>
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
Sourcepub fn curr_grad_barr_t_delta(
&self,
delta_x: &dyn Vector,
delta_s: &dyn Vector,
) -> Number
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).
Sourcepub fn curr_dwd(&self, delta_x: &dyn Vector, delta_s: &dyn Vector) -> Number
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).
pub fn curr_constraint_violation(&self) -> Number
pub fn trial_constraint_violation(&self) -> Number
Sourcepub fn curr_primal_infeasibility_max(&self) -> Number
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).
Sourcepub fn curr_dual_infeasibility_max(&self) -> Number
pub fn curr_dual_infeasibility_max(&self) -> Number
Max-norm dual infeasibility — max(||∇_x L||_∞, ||∇_s L||_∞).
Mirrors IpIpoptCalculatedQuantities.cpp:CurrDualInfeasibility(NORM_MAX).
Sourcepub fn curr_infeasibility_stationarity(&self) -> Number
pub fn curr_infeasibility_stationarity(&self) -> Number
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.
Sourcepub fn curr_avrg_compl(&self) -> Number
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).
Sourcepub fn curr_complementarity_min(&self) -> Number
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.
Sourcepub fn curr_complementarity_max(&self) -> Number
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.
Sourcepub fn curr_centrality_measure(&self) -> Number
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.
Sourcepub fn curr_barrier_error(&self) -> Number
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 · μ.
Sourcepub fn curr_nlp_error(&self) -> Number
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).
pub fn trial_jac_c(&self) -> Rc<dyn Matrix>
pub fn trial_jac_d(&self) -> Rc<dyn Matrix>
Sourcepub fn trial_grad_lag_x(&self) -> Rc<dyn Vector>
pub fn trial_grad_lag_x(&self) -> Rc<dyn Vector>
∇_x L at the trial iterate — analog of Self::curr_grad_lag_x.
Sourcepub fn trial_grad_lag_s(&self) -> Rc<dyn Vector>
pub fn trial_grad_lag_s(&self) -> Rc<dyn Vector>
∇_s L at the trial iterate — analog of Self::curr_grad_lag_s.
pub fn trial_compl_x_l(&self) -> Rc<dyn Vector>
pub fn trial_compl_x_u(&self) -> Rc<dyn Vector>
pub fn trial_compl_s_l(&self) -> Rc<dyn Vector>
pub fn trial_compl_s_u(&self) -> Rc<dyn Vector>
Sourcepub fn curr_primal_dual_system_error(&self, mu: Number) -> Number
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.
Sourcepub fn trial_primal_dual_system_error(&self, mu: Number) -> Number
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.
Sourcepub fn curr_grad_lag_with_damping_x(&self) -> Rc<dyn Vector>
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.
pub fn curr_grad_lag_with_damping_s(&self) -> Rc<dyn Vector>
Sourcepub fn grad_kappa_times_damping_x(&self) -> Rc<dyn Vector>
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.
pub fn grad_kappa_times_damping_s(&self) -> Rc<dyn Vector>
Sourcepub fn aff_step_alpha_primal_max(
&self,
delta_aff: &IteratesVector,
tau: Number,
) -> Number
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.
Sourcepub fn aff_step_alpha_dual_max(
&self,
delta_aff: &IteratesVector,
tau: Number,
) -> Number
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).
Sourcepub fn aff_step_compl_avrg(
&self,
delta_aff: &IteratesVector,
alpha_primal: Number,
alpha_dual: Number,
) -> Number
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§
impl !Freeze for IpoptCalculatedQuantities
impl !RefUnwindSafe for IpoptCalculatedQuantities
impl !Send for IpoptCalculatedQuantities
impl !Sync for IpoptCalculatedQuantities
impl Unpin for IpoptCalculatedQuantities
impl UnsafeUnpin for IpoptCalculatedQuantities
impl !UnwindSafe for IpoptCalculatedQuantities
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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