pub trait ConvCheck {
// Required method
fn check_convergence(
&mut self,
nlp_err: Number,
iter_count: Index,
) -> ConvergenceStatus;
// Provided methods
fn certificate_vetoed(&self) -> bool { ... }
fn acceptable_certificate_vetoed(&self) -> bool { ... }
fn check_convergence_with_state(
&mut self,
nlp_err: Number,
iter_count: Index,
_data: &IpoptDataHandle,
_cq: &IpoptCqHandle,
) -> ConvergenceStatus { ... }
fn current_passes_strict(
&self,
_nlp_err: Number,
_data: &IpoptDataHandle,
_cq: &IpoptCqHandle,
) -> bool { ... }
fn current_is_acceptable(&self, _nlp_err: Number) -> bool { ... }
fn current_is_acceptable_with_state(
&self,
nlp_err: Number,
_data: &IpoptDataHandle,
_cq: &IpoptCqHandle,
) -> bool { ... }
fn set_curr_acceptable_obj(&mut self, _obj: Number) { ... }
fn tol_or_default(&self) -> Number { ... }
fn constr_viol_tol_or_default(&self) -> Number { ... }
fn acceptable_constr_viol_tol_or_default(&self) -> Number { ... }
fn set_tolerance(&mut self, _name: &str, _value: Number) -> bool { ... }
}Required Methods§
fn check_convergence( &mut self, nlp_err: Number, iter_count: Index, ) -> ConvergenceStatus
Provided Methods§
Sourcefn certificate_vetoed(&self) -> bool
fn certificate_vetoed(&self) -> bool
State-aware convergence check. The main loop calls this on
every iteration so policies that need access to the iterate
(e.g. RestoConvCheckAdapter’s orig-NLP inf_pr evaluation
for the kappa-reduction early-exit) can read data.curr and
the cq layer. Default impl delegates to
Self::check_convergence, so scalar-only policies don’t
need to override.
Whether this policy ever refused a termination certificate it judged
masked by an extreme objective scale (gh #200).
The main loop reads it on the failure exits: a run that was held back
from stopping must not end up worse off than it would have been, so
when it later stalls the stored acceptable point is restored rather
than a bare failure surfaced. Policies that never veto keep the
default false and the failure paths behave exactly as before.
Sourcefn acceptable_certificate_vetoed(&self) -> bool
fn acceptable_certificate_vetoed(&self) -> bool
Whether this policy ever refused an acceptable-level termination it
judged masked (gh #200). Undone differently from a strict refusal — see
OptErrorConvCheck::acceptable_veto_fired.
fn check_convergence_with_state( &mut self, nlp_err: Number, iter_count: Index, _data: &IpoptDataHandle, _cq: &IpoptCqHandle, ) -> ConvergenceStatus
Sourcefn current_passes_strict(
&self,
_nlp_err: Number,
_data: &IpoptDataHandle,
_cq: &IpoptCqHandle,
) -> bool
fn current_passes_strict( &self, _nlp_err: Number, _data: &IpoptDataHandle, _cq: &IpoptCqHandle, ) -> bool
Whether the current iterate passes the strict per-component convergence
tolerances — the Self::check_convergence_with_state strict test with
the masked-certificate veto (gh #200) removed. In other words: would this
iterate have certified Success were it not for the objective-scale
masking?
gh #327 reads it on the veto’s fallback path to distinguish a point the
veto refused only because of masking — a would-be strict certificate,
e.g. the true optimum a continued run reached but could never certify
there — from one that never converged at all (an unbounded / diverging
iterate whose gradient never vanishes). Only the former may displace the
point the baseline stopped at. Default false for policies that expose no
strict test.
Sourcefn current_is_acceptable(&self, _nlp_err: Number) -> bool
fn current_is_acceptable(&self, _nlp_err: Number) -> bool
Whether the supplied nlp_err is at or below the acceptable
tolerance — port of upstream
OptimalityErrorConvergenceCheck::CurrentIsAcceptable. Used by
the main loop to gate StoreAcceptablePoint /
RestoreAcceptablePoint. Default returns false so policies
that don’t track an acceptable level (e.g. resto-of-resto inner
adapters) silently skip the rollback machinery.
Sourcefn current_is_acceptable_with_state(
&self,
nlp_err: Number,
_data: &IpoptDataHandle,
_cq: &IpoptCqHandle,
) -> bool
fn current_is_acceptable_with_state( &self, nlp_err: Number, _data: &IpoptDataHandle, _cq: &IpoptCqHandle, ) -> bool
State-aware acceptance check. Mirrors upstream
OptimalityErrorConvergenceCheck::CurrentIsAcceptable which
reads the per-component residuals and current f to gate the
acceptable_dual_inf_tol / acceptable_constr_viol_tol /
acceptable_compl_inf_tol / acceptable_obj_change_tol
triplet. Default delegates to the scalar Self::current_is_acceptable.
Sourcefn set_curr_acceptable_obj(&mut self, _obj: Number)
fn set_curr_acceptable_obj(&mut self, _obj: Number)
Record the current objective at the iterate the main loop just
stashed as the latest “acceptable point” — mirrors upstream
OptimalityErrorConvergenceCheck::SetCurrAcceptableF. The
recorded value feeds the acceptable_obj_change_tol stability
cross-check on subsequent iterates. Default no-op for policies
that don’t track acceptable points.
Sourcefn tol_or_default(&self) -> Number
fn tol_or_default(&self) -> Number
Outer NLP convergence tolerance, as used by the main loop’s
almost-feasible bypass guard (port of
IpBacktrackingLineSearch.cpp:580). Default 1e-8 matches
upstream’s default tol.
Sourcefn constr_viol_tol_or_default(&self) -> Number
fn constr_viol_tol_or_default(&self) -> Number
Primal-feasibility tolerance constr_viol_tol, in the unscaled max-norm
space curr_unscaled_primal_infeasibility_max reports — the option that
declares what a violated constraint is.
Read by the status-decision sites that have to answer “is this violation
real” (gh #508). That question is about the constraint violation, so it
must be asked with the constraint-violation tolerance; asking it with
tol — a tolerance on the KKT error, a different quantity in
different units — makes the answer move when the user retunes
convergence and stand still when they retune feasibility. Default 1e-4
matches upstream’s default constr_viol_tol; policies that track no such
tolerance keep it.
Sourcefn acceptable_constr_viol_tol_or_default(&self) -> Number
fn acceptable_constr_viol_tol_or_default(&self) -> Number
Acceptable-level primal-feasibility band acceptable_constr_viol_tol, in
the unscaled max-norm space curr_unscaled_primal_infeasibility_max
reports. Read by the best-acceptable fallback’s feasibility-aware ranking
(gh #267), which caps it at the upstream default so a user-widened band
cannot let the fallback spend feasibility to buy objective. Default
1e-2 matches upstream’s default acceptable_constr_viol_tol; policies
that track no such tolerance keep it.
Sourcefn set_tolerance(&mut self, _name: &str, _value: Number) -> bool
fn set_tolerance(&mut self, _name: &str, _value: Number) -> bool
Live-update a named convergence tolerance mid-solve, for the
debugger’s in-place option hot-swap. Returns true if name
matched a tolerance this policy owns (so the caller can report
whether it took). Default: this policy exposes no live
tolerances → false.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".