pounce_algorithm/init/trait.rs
1//! `IterateInitializer` trait — port of `IpIterateInitializer.hpp`.
2
3use crate::init::default::LeastSquareInitReport;
4use crate::ipopt_cq::IpoptCqHandle;
5use crate::ipopt_data::IpoptDataHandle;
6use crate::ipopt_nlp::IpoptNlp;
7use crate::kkt::aug_system_solver::AugSystemSolver;
8use std::cell::RefCell;
9use std::rc::Rc;
10
11pub trait IterateInitializer {
12 /// Populate `IpoptData::curr` with an initial iterate. Mirrors
13 /// `IterateInitializer::SetInitialIterates`. The implementation
14 /// can use `aug_solver` for least-square multiplier estimates;
15 /// callers that don't need that may pass any solver — concrete
16 /// initializers consult it only if their option settings require
17 /// it.
18 fn set_initial_iterates(
19 &mut self,
20 data: &IpoptDataHandle,
21 cq: &IpoptCqHandle,
22 nlp: &Rc<RefCell<dyn IpoptNlp>>,
23 aug_solver: &mut dyn AugSystemSolver,
24 ) -> bool;
25
26 /// Diagnostics from the safeguarded `least_square_init_primal`
27 /// step (gh#605): initial/final nonlinear violation, accepted step
28 /// norm, rejected-trial count, termination reason. `None` for
29 /// initializers that do not run that step, or when it was not
30 /// attempted on this solve.
31 fn least_square_report(&self) -> Option<LeastSquareInitReport> {
32 None
33 }
34}