pub struct BacktrackingLineSearch {Show 15 fields
pub acceptor: Box<dyn BacktrackingLsAcceptor>,
pub alpha_red_factor: Number,
pub alpha_red_factor_min: Number,
pub max_soc: i32,
pub kappa_soc: Number,
pub soc_method: i32,
pub watchdog_shortened_iter_trigger: i32,
pub watchdog_trial_iter_max: i32,
pub alpha_min: Number,
pub max_trials: i32,
pub soft_resto_pderror_reduction_factor: Number,
pub max_soft_resto_iters: i32,
pub accept_every_trial_step: bool,
pub alpha_for_y: AlphaForY,
pub accept_after_max_steps: i32,
/* private fields */
}Fields§
§acceptor: Box<dyn BacktrackingLsAcceptor>§alpha_red_factor: Number§alpha_red_factor_min: Numberalpha_red_factor_min — the floor on one backtracking
reduction, which is what turns the fixed geometric sequence into
a safeguarded interpolation (gh#818). See
BacktrackingLineSearch::next_alpha. Setting it equal to
alpha_red_factor collapses the clamp and restores the plain
alpha *= alpha_red_factor sequence.
The 0.05 here is the direct-construction default (tests and
drivers that assemble a line search by hand).
AlgorithmBuilder::build overwrites it from
LineSearchOptions::alpha_red_factor_min, which resolves to
0.05 under limited-memory and to alpha_red_factor — i.e.
off — under an exact Hessian; that field’s doc carries the
measurement behind the split.
max_soc: i32§kappa_soc: NumberThreshold for the SOC outer-loop convergence test
theta_trial <= kappa_soc * theta_soc_old. Mirrors upstream’s
kappa_soc (default 0.99).
soc_method: i32SOC RHS variant. 0 = upstream default (“old”), 1 = scaled
gradient-block variant. Both correspond to upstream’s
soc_method option.
watchdog_shortened_iter_trigger: i32Number of consecutive shortened iterations before the watchdog
procedure activates. Disabled when <= 0. Mirrors upstream’s
watchdog_shortened_iter_trigger (default 10).
watchdog_trial_iter_max: i32Maximum number of outer iterations the watchdog will accept
non-decreasing trial points before reverting to the snapshot.
Mirrors upstream’s watchdog_trial_iter_max (default 3).
alpha_min: NumberLower bound on α; below this we declare a tiny step (mirrors
alpha_min_frac flow, IpBacktrackingLineSearch.cpp:CalculateAlphaMin).
max_trials: i32Maximum trial-iteration cap before declaring failure.
soft_resto_pderror_reduction_factor: NumberRequired relative reduction in the primal-dual system error for
a soft-resto step to be accepted. 0 disables soft restoration.
Mirrors upstream soft_resto_pderror_reduction_factor
(default 1 - 1e-4).
max_soft_resto_iters: i32Cap on consecutive soft-resto iterations before full
restoration is forced. Mirrors upstream max_soft_resto_iters
(default 10).
accept_every_trial_step: boolaccept_every_trial_step — when true, the alpha loop and filter
are bypassed: the FTB-truncated alpha_init/alpha_dual step
is set as the trial and accepted unconditionally. Mirrors
upstream’s IpBacktrackingLineSearch.cpp:accept_every_trial_step_
short-circuit at the top of FindAcceptableTrialPoint.
alpha_for_y: AlphaForYalpha_for_y policy applied to the equality multipliers y_c,
y_d when constructing the trial iterate. See AlphaForY.
accept_after_max_steps: i32accept_after_max_steps — once this many backtracking steps have
been taken in one line search, the trial point is accepted
without consulting the acceptor. -1 (the default, and
upstream’s) disables the escape hatch entirely, so the field is
inert unless a caller sets it.
Port of IpBacktrackingLineSearch.cpp:759-770: upstream
evaluates the trial barrier objective and constraint violation
first (so an evaluation error still backtracks — the finiteness
check in the alpha loop is pounce’s equivalent), tags the
iteration MaxS, and calls Reset() — leaving the soft
restoration phase and resetting the acceptor — before accepting.
Like accept_every_trial_step, this drops the global
convergence guarantee: the accepted point satisfies neither the
filter nor the Armijo condition.
Implementations§
Source§impl BacktrackingLineSearch
impl BacktrackingLineSearch
pub fn new(acceptor: Box<dyn BacktrackingLsAcceptor>) -> Self
pub fn acceptor(&self) -> &dyn BacktrackingLsAcceptor
pub fn acceptor_mut(&mut self) -> &mut dyn BacktrackingLsAcceptor
Sourcepub fn reset_after_restoration(&mut self)
pub fn reset_after_restoration(&mut self)
Clear the globalization heuristics’ cross-iteration counters
after the full restoration phase has succeeded — port of
IpBacktrackingLineSearch.cpp:624-631.
Upstream calls PerformRestoration() from inside
FindAcceptableTrialPoint, so these four assignments sit
directly after it and the state is in scope. pounce hands the
restoration off to the caller (IpoptAlgorithm::invoke_restoration)
and returns Outcome::Failed, so the reset has to be driven from
there instead — see the RestorationOutcome::Recovered arm.
Getting this wrong is not cosmetic. watchdog_shortened_iter
counts consecutive shortened steps, and the watchdog arms at
watchdog_shortened_iter_trigger (default 10). A restoration
episode is not a shortened step — it is a different point — so
carrying the count across one lets runs of shortened steps that
are separated by restoration accumulate as if they were
consecutive. On steenbrf that is exactly what happened: five
shortened steps before restoration plus five after reached the
trigger, the watchdog armed, spent its three trial iterations
and reverted to the pre-watchdog point, and the line search then
collapsed to alpha ~1e-08 with 20+ backtracks. That cycle
repeated 105 times and the solve hit max_iter; with the reset
in place the counter never reaches the trigger (upstream
Ipopt’s longest run on this problem is 6) and the same
trajectory converges.
count_successive_shortened_steps_ (cpp:624) is not ported —
upstream reads it only under expect_infeasible_problem_
(cpp:798-804), which pounce does not implement.
Sourcepub fn find_acceptable_trial_point(
&mut self,
data: &IpoptDataHandle,
cq: &IpoptCqHandle,
delta: &IteratesVector,
alpha_init: Number,
alpha_dual: Number,
nlp: Option<&Rc<RefCell<dyn IpoptNlp>>>,
search_dir: Option<&mut PdSearchDirCalc>,
) -> Outcome
pub fn find_acceptable_trial_point( &mut self, data: &IpoptDataHandle, cq: &IpoptCqHandle, delta: &IteratesVector, alpha_init: Number, alpha_dual: Number, nlp: Option<&Rc<RefCell<dyn IpoptNlp>>>, search_dir: Option<&mut PdSearchDirCalc>, ) -> Outcome
Public line-search entry point. Wraps the regular filter line
search (Self::run_filter_line_search) with the soft
restoration phase — port of the in_soft_resto_phase_ state
machine in IpBacktrackingLineSearch::FindAcceptableTrialPoint
(IpBacktrackingLineSearch.cpp:439-465 for the in-phase
continuation, :528-556 for entering the phase).
Outcomes:
Accepted: a trial point is indata.trial— either a regular filter/watchdog step or a soft-resto step (info char ‘s’ = stay in soft resto, ‘S’ = step also satisfies the original filter so soft resto is left).TinyStep/Failed: neither the regular line search nor a soft-resto step could make progress; the caller hands off to the full restoration phase.
Auto Trait Implementations§
impl !RefUnwindSafe for BacktrackingLineSearch
impl !Send for BacktrackingLineSearch
impl !Sync for BacktrackingLineSearch
impl !UnwindSafe for BacktrackingLineSearch
impl Freeze for BacktrackingLineSearch
impl Unpin for BacktrackingLineSearch
impl UnsafeUnpin for BacktrackingLineSearch
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