pub enum OptimizerError {
Show 14 variants
LinearSolveFailed(String),
MaxIterationsReached {
max_iters: usize,
},
TrustRegionFailure {
radius: f64,
min_radius: f64,
},
DampingFailure {
damping: f64,
max_damping: f64,
},
CostIncrease {
old_cost: f64,
new_cost: f64,
},
JacobianFailed(String),
InvalidParameters(String),
NumericalInstability(String),
LinAlg(LinAlgError),
EmptyProblem,
NoResidualBlocks,
JacobiScalingCreation(String),
JacobiScalingNotInitialized,
UnknownLinearSolver(String),
}Expand description
Optimizer-specific error types for apex-solver
Variants§
LinearSolveFailed(String)
Linear system solve failed during optimization
MaxIterationsReached
Maximum iterations reached without achieving convergence
TrustRegionFailure
Trust region radius became too small
DampingFailure
Damping parameter became too large (LM-specific)
CostIncrease
Cost increased unexpectedly when it should decrease
JacobianFailed(String)
Jacobian computation failed
InvalidParameters(String)
Invalid optimization parameters provided
NumericalInstability(String)
Numerical instability detected (NaN, Inf in cost, gradient, or parameters)
LinAlg(LinAlgError)
Linear algebra operation failed
EmptyProblem
Problem has no variables to optimize
NoResidualBlocks
Problem has no residual blocks
JacobiScalingCreation(String)
Jacobi scaling matrix creation failed
JacobiScalingNotInitialized
Jacobi scaling not initialized when expected
UnknownLinearSolver(String)
Unknown or unsupported linear solver type
Implementations§
Source§impl OptimizerError
impl OptimizerError
Sourcepub fn log_with_source<E: Debug>(self, source_error: E) -> Self
pub fn log_with_source<E: Debug>(self, source_error: E) -> Self
Log the error with the original source error from a third-party library
This method logs both the OptimizerError and the underlying error from external libraries. This provides full debugging context when errors occur in third-party code.
§Arguments
source_error- The original error from the third-party library (must implement Debug)
§Example
SparseColMat::try_new_from_triplets(cols, cols, &triplets)
.map_err(|e| {
OptimizerError::JacobiScalingCreation(e.to_string())
.log_with_source(e)
})?;Trait Implementations§
Source§impl Clone for OptimizerError
impl Clone for OptimizerError
Source§fn clone(&self) -> OptimizerError
fn clone(&self) -> OptimizerError
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OptimizerError
impl Debug for OptimizerError
Source§impl Display for OptimizerError
impl Display for OptimizerError
Source§impl Error for OptimizerError
impl Error for OptimizerError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<LinAlgError> for OptimizerError
impl From<LinAlgError> for OptimizerError
Source§fn from(source: LinAlgError) -> Self
fn from(source: LinAlgError) -> Self
Source§impl From<OptimizerError> for ApexSolverError
impl From<OptimizerError> for ApexSolverError
Source§fn from(source: OptimizerError) -> Self
fn from(source: OptimizerError) -> Self
Auto Trait Implementations§
impl Freeze for OptimizerError
impl RefUnwindSafe for OptimizerError
impl Send for OptimizerError
impl Sync for OptimizerError
impl Unpin for OptimizerError
impl UnwindSafe for OptimizerError
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.