Skip to main content

PdFullSpaceSolver

Struct PdFullSpaceSolver 

Source
pub struct PdFullSpaceSolver {
    pub min_refinement_steps: Index,
    pub max_refinement_steps: Index,
    pub residual_ratio_max: Number,
    pub residual_ratio_singular: Number,
    pub residual_improvement_factor: Number,
    pub neg_curv_test_tol: Number,
    /* private fields */
}

Fields§

§min_refinement_steps: Index§max_refinement_steps: Index§residual_ratio_max: Number§residual_ratio_singular: Number§residual_improvement_factor: Number§neg_curv_test_tol: Number

Negative-curvature test tolerance (neg_curv_test_tol_). Zero disables the heuristic; matches upstream’s RegisterOptions default. The non-zero branch is not exercised in v1.0.

Implementations§

Source§

impl PdFullSpaceSolver

Source

pub fn new( aug_solver: Box<dyn AugSystemSolver>, perturb: Rc<RefCell<PdPerturbationHandler>>, ) -> Self

Source

pub fn aug_solver(&self) -> &dyn AugSystemSolver

Source

pub fn aug_solver_mut(&mut self) -> &mut dyn AugSystemSolver

Source

pub fn wrap_aug_solver<F>(&mut self, wrap: F)
where F: FnOnce(Box<dyn AugSystemSolver>) -> Box<dyn AugSystemSolver>,

Replace the underlying AugSystemSolver by passing the existing one through the supplied wrapper closure. Used by the restoration phase to decorate the inner StdAugSystemSolver with AugRestoSystemSolver (which performs the 8-block → 4-block Schur reduction before delegating).

Source

pub fn solve( &mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle, nlp: &Rc<RefCell<dyn IpoptNlp>>, alpha: Number, beta: Number, rhs: &IteratesVector, res: &mut IteratesVectorMut, allow_inexact: bool, improve_solution: bool, ) -> bool

Solve the full PD system. res = α · M⁻¹ · rhs + β · res_in, matching IpPDFullSpaceSolver::Solve. Returns true on success. The iterate fields used to assemble the system are pulled from data (W, curr) and cq (jacobians, slacks, sigmas).

Source

pub fn solve_many_cached<F1, F2>( &mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle, nlp: &Rc<RefCell<dyn IpoptNlp>>, n_rhs: usize, write_rhs: F1, write_lhs: F2, ) -> Option<bool>

Batched back-substitution against the cached KKT factor for n_rhs right-hand sides, sharing one pounce_linsol::TSymLinearSolver::multi_solve call with nrhs > 1. Each column k pulls its RHS through write_rhs(k, &mut iv) and emits its solution through write_lhs(k, &iv) — closures over the caller’s flat / strided buffer keep the rhs/sol IteratesVectorMut scratch out of the API surface.

Returns:

  • Some(true) — fast path executed against the cached factor.
  • Some(false) — fast path was attempted but the linsol reported a back-solve failure.
  • None — fast path not taken. Either the matrix tags differ from the last successful Self::solve (cache miss), the matrix has not been considered yet, or the underlying AugSystemSolver does not implement AugSystemSolver::try_resolve_many_flat. The caller should fall back to looping Self::solve.

Used by pounce_sensitivity::PdSensBacksolver::solve_many for the JaxProblem jacrev backward path, where every cotangent re-solves against the same converged factor (pounce#77 follow-up).

Source

pub fn solve_many_cached_flat( &mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle, nlp: &Rc<RefCell<dyn IpoptNlp>>, n_rhs: usize, rhs_flat: &[Number], lhs_flat: &mut [Number], block_dims: [usize; 8], ) -> Option<bool>

Flat-slice cached-factor multi-RHS path. Same cache-check semantics as Self::solve_many_cached but operates on row-major (n_rhs, total) flat buffers without going through IteratesVectorMut or any dyn Vector / dyn Matrix dispatch in the per-RHS inner loops — the eight source blocks (slack_{x,s}_{l,u}, z_{l,u}, v_{l,u}) get downcast to DenseVector once at the top, the four bound-expansion matrices (px_l, px_u, pd_l, pd_u) get downcast to ExpansionMatrix once, and Phase 1 / Phase 3 then run as raw &[Number] / &mut [Number] arithmetic on the flat buffers.

total is the sum of the eight block_dims entries (in the same (x, s, y_c, y_d, z_l, z_u, v_l, v_u) order that IteratesVector uses); rhs_flat.len() == lhs_flat.len() == n_rhs * total.

Returns None (caller should fall back to Self::solve_many_cached) when:

  • the cache check fails (matrix tags differ),
  • any block source vector is not a DenseVector or is homogeneous (uniform-scalar) on a non-empty block,
  • any bound-expansion matrix is not an ExpansionMatrix,
  • the underlying AugSystemSolver doesn’t implement AugSystemSolver::try_resolve_many_flat.

Returns Some(true) on success, Some(false) on linsol back- solve failure.

Used by pounce_sensitivity::PdSensBacksolver::solve_many as the fastest tier of the JaxProblem jacrev backward path (pounce#77 follow-up).

Trait Implementations§

Source§

impl PdSystemSolver for PdFullSpaceSolver

Source§

fn solve_status(&self) -> ESymSolverStatus

Run the configured iterative-refinement loop on the 8-block system. Phase 6 placeholder for the full-signature method; super::pd_full_space_solver::PdFullSpaceSolver::solve will implement it once IteratesVector is wired through.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more