pub struct IpoptAlgorithm {Show 23 fields
pub data: IpoptDataHandle,
pub cq: IpoptCqHandle,
pub bundle: AlgorithmBundle,
pub nlp: Option<Rc<RefCell<dyn IpoptNlp>>>,
pub tnlp: Option<Rc<RefCell<dyn TNLP>>>,
pub search_dir: Option<PdSearchDirCalc>,
pub restoration: Option<Box<dyn RestorationPhase>>,
pub kappa_sigma: Number,
pub max_iter: Index,
pub alpha_init: Number,
pub tiny_step_tol: Number,
pub diverging_iterates_tol: Number,
pub tiny_step_y_tol: Number,
pub dual_diverging_streak: usize,
pub tiny_step_last_iteration: bool,
pub resto_decline_deferrals: usize,
pub resto_decline_progress_ratio: Number,
pub kkt_fidelity_tol: Number,
pub resto_calls: Index,
pub resto_inner_iters: Index,
pub resto_outer_iters: Index,
pub resto_wall_secs: Number,
pub print_iter_output: bool,
/* private fields */
}Fields§
§data: IpoptDataHandle§cq: IpoptCqHandle§bundle: AlgorithmBundle§nlp: Option<Rc<RefCell<dyn IpoptNlp>>>Optional NLP handle. Required for any step that evaluates problem functions or pulls bound expansion matrices (init, search direction, line-search trial-point evaluation). Absent in the structural unit tests of Phases 5-6.
tnlp: Option<Rc<RefCell<dyn TNLP>>>Optional TNLP handle — the user-facing problem. When present,
iterate() fires TNLP::intermediate_callback once per outer
iteration so callers can monitor progress or request early
termination (returning false from the callback surfaces as
SolverReturn::UserRequestedStop). Kept separate from nlp
because the algorithm-side NLP is the compressed OrigIpoptNlp
view (fixed-variable elimination, c/d split) while the callback
payload needs to expose the original-coordinate iterate.
search_dir: Option<PdSearchDirCalc>Search-direction calculator (PdSearchDirCalc). Lands once a
concrete SymLinearSolver backend (MUMPS / FERAL) is wired
through AlgBuilder in Phase 7’s tail.
restoration: Option<Box<dyn RestorationPhase>>Restoration-phase strategy. Invoked when the line search
returns Outcome::Failed (port of upstream
IpBacktrackingLineSearch::ActivateLineSearch’s resto
fallback). Optional: in its absence, line-search failure maps
directly to SolverReturn::RestorationFailure so the main
loop’s exit-code semantics match upstream’s “no resto built”
case.
kappa_sigma: Numberkappa_sigma for the post-AcceptTrialPoint multiplier reset
(IpIpoptAlg.cpp:correct_bound_multiplier, line 1055-1134).
max_iter: Index§alpha_init: NumberInitial primal step length offered to the line search at the
top of each iteration. Mirrors IpBacktrackingLineSearch’s
fraction-to-the-boundary primal step (with τ = data.curr_tau).
In v1.0 the structural value here is 1.0 and the FTB cap is
applied per-component when the line-search driver computes
trial slacks; the simplification holds for non-degenerate runs.
tiny_step_tol: NumberTiny-step relative tolerance — port of upstream
IpBacktrackingLineSearch::tiny_step_tol_ (default 10·EPSILON).
Step is “tiny” when max_i |δx_i|/(1+|x_i|) ≤ tiny_step_tol
(and same for s, and c_viol ≤ 1e-4).
diverging_iterates_tol: NumberPort of upstream IpIpoptAlg.cpp divergence guard: when
max_i |x_i| exceeds this threshold the optimization aborts with
SolverReturn::DivergingIterates. Default 1e20 matches the
registered diverging_iterates_tol option. Catches MESH and
similar cases where the normal-mode IPM heads off to infinity
(orig f to ±1e33 by iter 90) before line-search failure forces
a degenerate restoration entry.
tiny_step_y_tol: NumberCompanion threshold on the dual step — when both primal and dual
steps are tiny in two consecutive iterations the algorithm
declares convergence at the best attainable accuracy. Default
1e-2 matches upstream.
dual_diverging_streak: usizedual_diverging_streak (pounce#246) — number of consecutive
iterations of growing dual infeasibility (in the elevated regime,
inf_du > [DUAL_DIV_COUNT_FLOOR]) that must accumulate before the
dual-divergence guard fires. When the streak reaches the limit and
inf_du > [DUAL_DIV_FIRE_TOL], the outer routes to restoration.
0 (off) is the default, set from the option of the same name
(application.rs). It defaulted to 15 when introduced; see the option
help in upstream_options.rs for why that changed, and
Self::honour_best_acceptable_after_dual_guard for what protects a
solve when it is enabled. See the guard itself in Self::iterate.
tiny_step_last_iteration: boolSet true when the previous iterate was tagged tiny; on the
second consecutive tiny step the loop sets data.tiny_step_flag
so the mu update can attempt to terminate. Mirrors
IpBacktrackingLineSearch::tiny_step_last_iteration_.
resto_decline_deferrals: usizeresto_decline_deferrals (gh #534) — how many times the
acceptable-point restoration decline in Self::invoke_restoration may
be deferred on a solve whose NLP error is still contracting. 0
restores the pre-#534 behaviour (decline immediately, always).
See Self::may_defer_acceptable_decline for the progress test and
Self::honour_decline_floor for what makes a spent deferral harmless.
resto_decline_progress_ratio: Numberresto_decline_progress_ratio (gh #534) — the contraction each of the
last [DECLINE_PROGRESS_SAMPLES] - 1 iterations must have achieved for
the decline to be deferred. Default
[DEFAULT_DECLINE_PROGRESS_RATIO]. A value of 1 admits any
non-increasing window and a large one drops the progress requirement
altogether, which is the “patch the guard and see” experiment the issue
asks for, available without patching.
kkt_fidelity_tol: Numberkkt_fidelity_tol (pounce#173), needed here — not just at termination —
because the fallback’s tiebreak has to predict the post-solve status
gate. See Self::honour_refused_certificate. Zero (the default)
disables the gate, and with it every tiebreak effect it has.
resto_calls: IndexNumber of invoke_restoration entries.
resto_inner_iters: IndexSum of inner-IPM iter counts across every restoration call.
resto_outer_iters: IndexNumber of outer iters that ran in restoration mode (R-line
equivalents in print_level=5 output).
resto_wall_secs: NumberCumulative wall-clock seconds spent inside perform_restoration.
print_iter_output: boolWhen false, the per-iteration table that iterate() writes
straight to stdout is suppressed. Wired from
IpoptApplication’s print_level option: level 0 turns this
off (matches upstream’s “no console output” contract). Default
true so CLI / direct-driver users keep the familiar trace.
Implementations§
Source§impl IpoptAlgorithm
impl IpoptAlgorithm
pub fn new( data: IpoptDataHandle, cq: IpoptCqHandle, bundle: AlgorithmBundle, ) -> Self
pub fn with_nlp(self, nlp: Rc<RefCell<dyn IpoptNlp>>) -> Self
Sourcepub fn with_tnlp(self, tnlp: Rc<RefCell<dyn TNLP>>) -> Self
pub fn with_tnlp(self, tnlp: Rc<RefCell<dyn TNLP>>) -> Self
Install a user-facing TNLP handle. Enables per-iteration
TNLP::intermediate_callback invocation from optimize().
pub fn with_search_dir(self, sd: PdSearchDirCalc) -> Self
pub fn with_restoration(self, resto: Box<dyn RestorationPhase>) -> Self
Sourcepub fn with_diagnostics(self, diag: Rc<DiagnosticsState>) -> Self
pub fn with_diagnostics(self, diag: Rc<DiagnosticsState>) -> Self
Install the shared diagnostics state. The state is propagated
to the augmented-system solver at the top of Self::optimize
so dump sites can consult per-iter gating.
Sourcepub fn with_debug_hook(self, hook: Rc<RefCell<dyn DebugHook>>) -> Self
pub fn with_debug_hook(self, hook: Rc<RefCell<dyn DebugHook>>) -> Self
Install an interactive debugger hook. Fired at each checkpoint
in Self::optimize; returning crate::debug::DebugAction::Stop
ends the solve with SolverReturn::UserRequestedStop.
Sourcepub fn debug_hook(&self) -> Option<Rc<RefCell<dyn DebugHook>>>
pub fn debug_hook(&self) -> Option<Rc<RefCell<dyn DebugHook>>>
Shared handle to the installed debugger, if any — used to forward it into the restoration inner IPM.
Sourcepub fn optimize(&mut self) -> SolverReturn
pub fn optimize(&mut self) -> SolverReturn
Outer entry point — port of IpoptAlgorithm::Optimize(). Calls
the iterate-initializer once, then loops iterate() until a
terminal status. The exception → SolverReturn mapping
(TINY_STEP_DETECTED → STEP_BECOMES_TINY,
RESTORATION_FAILED → RESTORATION_FAILURE, etc.) lands in
Phase 9 alongside the restoration phase.
Run the solve and finalize its result.
A thin wrapper on purpose. The gh #200 fallback must see every exit
of the driver loop, and wiring it into individual termination sites was
tried and failed — there are sixteen, and the ones easiest to overlook
are the ones most likely to matter. Keeping the loop in a separate
function means every return inside it, present or future, flows through
Self::honour_refused_certificate by construction rather than by the
author remembering to.
This got more important once the fallback started changing the status in
both directions: it can now hand back StopAtAcceptablePoint for a
Success it was given. Anything reading result before the hook is
reading a status that is not the one reported.
Auto Trait Implementations§
impl !RefUnwindSafe for IpoptAlgorithm
impl !Send for IpoptAlgorithm
impl !Sync for IpoptAlgorithm
impl !UnwindSafe for IpoptAlgorithm
impl Freeze for IpoptAlgorithm
impl Unpin for IpoptAlgorithm
impl UnsafeUnpin for IpoptAlgorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T, U> Imply<T> for U
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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