pounce_algorithm/kkt/perturbation_handler.rs
1//! Primal-dual perturbation handler — the shared implementation now lives in
2//! [`pounce_common::pd_perturbation`].
3//!
4//! It moved there so the active-set QP (`pounce-qp`) can use the same tested
5//! state machine. The dependency runs `pounce-algorithm -> pounce-qp`, so a
6//! shared lower crate was the only way to reach it without duplicating 674
7//! lines of IPOPT-ported logic. This module keeps the names other
8//! `pounce-algorithm` code imports, and supplies the `PerturbationSink`
9//! implementation over `IpoptDataHandle`.
10
11use crate::ipopt_data::IpoptDataHandle;
12use pounce_common::types::{Index, Number};
13
14pub use pounce_common::pd_perturbation::{
15 DegenType, Deltas, PdPerturbationHandler, PerturbationSink, TrialStatus,
16};
17
18/// Adapts `IpoptDataHandle` to the sink the shared handler writes through.
19pub struct IpoptDataSink<'a>(pub &'a IpoptDataHandle);
20
21impl PerturbationSink for IpoptDataSink<'_> {
22 fn append_info(&self, s: &str) {
23 self.0.borrow_mut().append_info_string(s);
24 }
25 fn set_regu_x(&self, v: Number) {
26 self.0.borrow_mut().info_regu_x = v;
27 }
28 fn iter_count(&self) -> Index {
29 self.0.borrow().iter_count
30 }
31 fn debug(&self, msg: &str) {
32 tracing::debug!(target: "pounce::linsol", "{msg}");
33 }
34}