Skip to main content

DefaultIterateInitializer

Struct DefaultIterateInitializer 

Source
pub struct DefaultIterateInitializer {
    pub bound_push: Number,
    pub bound_frac: Number,
    pub slack_bound_push: Number,
    pub slack_bound_frac: Number,
    pub constr_mult_init_max: Number,
    pub bound_mult_init_val: Number,
    pub bound_mult_init_method: String,
    pub eq_mult_calculator: Option<Box<dyn EqMultCalculator>>,
    pub least_square_init_primal: bool,
    pub least_square_init_max_trials: Index,
    pub least_square_init_accept_ratio: Number,
    pub last_least_square_report: Option<LeastSquareInitReport>,
}

Fields§

§bound_push: Number§bound_frac: Number§slack_bound_push: Number§slack_bound_frac: Number§constr_mult_init_max: Number§bound_mult_init_val: Number§bound_mult_init_method: String

bound_mult_init_method. Must be "constant" — upstream’s "mu-based" is registered for ipopt.opt compatibility but not implemented, and set_initial_iterates returns false on it rather than serving a third, undocumented behaviour (gh#604).

§eq_mult_calculator: Option<Box<dyn EqMultCalculator>>

Equality-multiplier calculator used by the least_square_mults step at the end of set_initial_iterates, matching upstream IpDefaultIterateInitializer.cpp:334-341. If None, the LS step is skipped (y_c, y_d remain at zero).

§least_square_init_primal: bool

least_square_init_primal — port of IpDefaultIterateInitializer.cpp:200-222. When on, the initializer replaces the user’s starting x with the min-norm solution of the linearized equality + inequality constraints, then pushes that to the interior. Used by the Mehrotra cascade (IpIpoptAlg.cpp:182) to dramatically reduce iter-0 primal infeasibility on LP-shaped problems.

§least_square_init_max_trials: Index

least_square_init_primal_max_trials — how many backtracking trials the safeguard in Self::safeguarded_least_square_x may take before it gives up and keeps the user’s point. Each trial costs one constraint evaluation (c and d); none of them costs a Jacobian or a KKT solve, because the step direction is computed once and only its length changes.

§least_square_init_accept_ratio: Number

Armijo-style acceptance ratio for the safeguard: a trial at step fraction alpha is accepted when the true nonlinear violation satisfies theta(alpha) <= (1 - eta*alpha) * theta_0, i.e. when the actual feasibility reduction is at least eta times the reduction the linearization predicted.

§last_least_square_report: Option<LeastSquareInitReport>

Diagnostics from the most recent safeguarded least-square initialization: initial/final violation, accepted step norm, rejected trial count, termination reason. None when the step was never attempted.

Implementations§

Source§

impl DefaultIterateInitializer

Source

pub fn new() -> Self

Source

pub fn with_eq_mult_calculator(eq_mult: Box<dyn EqMultCalculator>) -> Self

Source

pub fn accepts_trial( theta_0: Number, theta: Number, alpha: Number, eta: Number, ) -> bool

The safeguard’s accept test, as a pure predicate of the four numbers it actually reads.

A trial at step fraction alpha whose true nonlinear violation is theta is accepted when theta <= (1 - eta*alpha) * theta_0 — the linear model predicts theta -> 0 at alpha = 1, so the predicted reduction at alpha is alpha * theta_0 and the test is exactly “the actual reduction is at least eta times the predicted one”. The trailing theta < theta_0 makes the contract independent of eta: however small eta is set, a trial that does not strictly reduce the violation is never accepted.

Split out of the trial loop for gh#616, whose conclusion rests on what this predicate can express. eta is confined to (0, 1] — at eta > 1 the alpha = 1 trial would demand a negative violation and the full step could never be taken — and over that whole range the reachable rejections are bounded. The tests in tests/issue_616_ls_init_accept_test.rs pin the consequence: no eta rejects eigenb2’s accepted trial, so retuning eta is not a route to its old SolveSucceeded status.

Source

pub fn push_to_interior( bound_push: Number, bound_frac: Number, x: Number, lower: Option<Number>, upper: Option<Number>, ) -> Number

Trait Implementations§

Source§

impl Default for DefaultIterateInitializer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl IterateInitializer for DefaultIterateInitializer

Source§

fn least_square_report(&self) -> Option<LeastSquareInitReport>

Diagnostics from the safeguarded least_square_init_primal step (gh#605): initial/final nonlinear violation, accepted step norm, rejected-trial count, termination reason. None for initializers that do not run that step, or when it was not attempted on this solve.
Source§

fn set_initial_iterates( &mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle, nlp: &Rc<RefCell<dyn IpoptNlp>>, aug_solver: &mut dyn AugSystemSolver, ) -> bool

Populate IpoptData::curr with an initial iterate. Mirrors IterateInitializer::SetInitialIterates. The implementation can use aug_solver for least-square multiplier estimates; callers that don’t need that may pass any solver — concrete initializers consult it only if their option settings require it.

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> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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