pounce-algorithm 0.3.0

Algorithm-side core for POUNCE (port of Ipopt's src/Algorithm/): IteratesVector, IpoptData, CalculatedQuantities, KKT solvers, line search, mu update, conv check, initializer, IpoptAlg main loop, AlgBuilder.
Documentation
//! Exact Hessian — port of `IpExactHessianUpdater.{hpp,cpp}`.
//! Pulls `eval_h` from the NLP at every iterate via
//! `IpoptCalculatedQuantities::curr_exact_hessian` and stashes the
//! result into `IpoptData::w`.

use crate::hess::r#trait::HessianUpdater;
use crate::ipopt_cq::IpoptCqHandle;
use crate::ipopt_data::IpoptDataHandle;

pub struct ExactHessianUpdater;

impl ExactHessianUpdater {
    pub fn new() -> Self {
        Self
    }
}

impl Default for ExactHessianUpdater {
    fn default() -> Self {
        Self::new()
    }
}

impl HessianUpdater for ExactHessianUpdater {
    fn update_hessian(&mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle) -> bool {
        let w = cq.borrow().curr_exact_hessian();
        data.borrow_mut().w = Some(w);
        true
    }
}