pub struct FdHessianUpdater {
pub pattern_source: FdPatternSource,
pub coloring: FdColoring,
pub reuse_tol: Number,
pub objective_vars: Option<Vec<Index>>,
pub nonlinear_vars: Option<Vec<Index>>,
pub reused: u64,
pub rebuilt: u64,
/* private fields */
}Fields§
§pattern_source: FdPatternSource§coloring: FdColoring§reuse_tol: NumberReuse the previous Hessian when neither the primal iterate nor the
multipliers have moved by more than this, relative to their own
magnitude (fd_hessian_reuse_tol). 0 rebuilds every iteration.
Both are tested, not just x: ∇²L = ∇²f + Σ yⱼ ∇²cⱼ depends
on the multipliers too, so a cached Hessian is stale the moment y
moves even if x has not.
objective_vars: Option<Vec<Index>>Variables the objective is nonlinear in, in the compressed x_var
space. The Jacobian-derived pattern must include
objective_vars ⊗ objective_vars: ⋃ⱼ supp(∇gⱼ) ⊗ supp(∇gⱼ)
describes the constraints only, so without this a ∇²f entry
whose two variables never co-occur in a constraint row falls
outside the pattern and is silently dropped — the pattern would be
a subset of the truth, not the superset this mode’s safety
argument rests on. None falls back to the first ∇f’s nonzeros.
nonlinear_vars: Option<Vec<Index>>Variables that enter f or g nonlinearly, in the compressed
x_var space. A variable outside this set is linear everywhere,
so every off-diagonal Hessian entry touching it is structurally
zero and it can be dropped from the Jacobian-derived cliques:
⋃_j supp(∇g_j) ⊗ supp(∇g_j)
→ ⋃_j (supp(∇g_j) ∩ N) ⊗ (supp(∇g_j) ∩ N)Still a superset of the truth, just a tighter one. The full primal diagonal stays in the pattern regardless — the barrier and the inertia correction need those rows present even where the model has no curvature. Suggested in review by @srikanth-gm.
reused: u64§rebuilt: u64Implementations§
Trait Implementations§
Source§impl HessianUpdater for FdHessianUpdater
impl HessianUpdater for FdHessianUpdater
Source§fn hessian_at_current(
&mut self,
data: &IpoptDataHandle,
cq: &IpoptCqHandle,
) -> Option<Rc<dyn SymMatrix>>
fn hessian_at_current( &mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle, ) -> Option<Rc<dyn SymMatrix>>
The finite-difference Hessian is a pure function of (x, y) — it
reads data.curr and the already-evaluated curr_grad_f / curr_jac_*
and carries no step history — so it can simply be rebuilt here. That is
what makes it different from the quasi-Newton updaters, and what
provides_exact_hessian could not express (gh#823 review, finding 1).
data.w is saved and restored around the rebuild: at this point it
holds W for the previous iterate, and the post-optimal sensitivity
hook reads it. The rebuild does refresh the reuse cache to the current
(x, y), which is correct — the cache is keyed on exactly that, so the
update_hessian call in step 3 of this same iterate then hits it
instead of paying for a second pass.
Source§fn fd_hessian_stats(&self) -> Option<FdStats>
fn fd_hessian_stats(&self) -> Option<FdStats>
None for every other updater. Read moreSource§fn update_hessian(&mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle) -> bool
fn update_hessian(&mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle) -> bool
data.w for the current iterate. Returns true on
success. Mirrors IpHessianUpdater::UpdateHessian (which is
pure-virtual; implementations write into IpData().Set_W(...)).Source§fn provides_exact_hessian(&self) -> bool
fn provides_exact_hessian(&self) -> bool
data.w is the exact Lagrangian Hessian at the iterate it was
built from, rather than a quasi-Newton approximation (gh #797). Read moreAuto Trait Implementations§
impl !RefUnwindSafe for FdHessianUpdater
impl !Send for FdHessianUpdater
impl !Sync for FdHessianUpdater
impl !UnwindSafe for FdHessianUpdater
impl Freeze for FdHessianUpdater
impl Unpin for FdHessianUpdater
impl UnsafeUnpin for FdHessianUpdater
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
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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