pounce_algorithm/sqp/iterates.rs
1//! SQP iterate state — `(x, λ_g, λ_x)` plus the working set
2//! carried across QP subproblem solves for warm-starting (the
3//! §5/§6 design-note contract).
4//!
5//! Distinct from [`crate::iterates_vector::IteratesVector`] (which
6//! is IPM-shaped with slacks and barrier multipliers). The SQP
7//! iterate is simpler: primal `x`, constraint multipliers
8//! `λ_g`, packed bound multipliers `λ_x = z_l − z_u`, and the
9//! `pounce_qp::WorkingSet` from the previous QP solve.
10
11use pounce_common::Number;
12use pounce_qp::WorkingSet;
13
14#[derive(Debug, Clone)]
15pub struct SqpIterates {
16 pub x: Vec<Number>,
17 pub lambda_g: Vec<Number>,
18 pub lambda_x: Vec<Number>,
19 pub working: Option<WorkingSet>,
20}
21
22impl SqpIterates {
23 pub fn cold(n: usize, m: usize) -> Self {
24 Self {
25 x: vec![0.0; n],
26 lambda_g: vec![0.0; m],
27 lambda_x: vec![0.0; n],
28 working: None,
29 }
30 }
31
32 pub fn n(&self) -> usize {
33 self.x.len()
34 }
35
36 pub fn m(&self) -> usize {
37 self.lambda_g.len()
38 }
39}