pub enum DEError {
BoundsMismatch {
lower_len: usize,
upper_len: usize,
},
InvalidBounds {
index: usize,
lower: f64,
upper: f64,
},
PopulationTooSmall {
pop_size: usize,
},
InvalidMutationFactor {
factor: f64,
},
InvalidCrossoverRate {
rate: f64,
},
X0DimensionMismatch {
expected: usize,
got: usize,
},
IntegralityDimensionMismatch {
expected: usize,
got: usize,
},
}Expand description
Errors that can occur during Differential Evolution optimization.
Variants§
BoundsMismatch
Lower and upper bounds have different lengths.
Fields
InvalidBounds
A lower bound exceeds its corresponding upper bound.
Fields
PopulationTooSmall
Population size is too small (must be >= 4).
InvalidMutationFactor
Mutation factor is out of valid range [0, 2].
InvalidCrossoverRate
Crossover rate is out of valid range [0, 1].
X0DimensionMismatch
Initial guess (x0) has wrong dimension.
IntegralityDimensionMismatch
Integrality mask has wrong dimension.
Implementations§
Source§impl DEError
impl DEError
Sourcepub fn is_bounds_error(&self) -> bool
pub fn is_bounds_error(&self) -> bool
Returns true if this is a bounds-related error.
This includes BoundsMismatch and InvalidBounds variants.
Sourcepub fn is_config_error(&self) -> bool
pub fn is_config_error(&self) -> bool
Returns true if this is a configuration-related error.
This includes PopulationTooSmall, InvalidMutationFactor,
and InvalidCrossoverRate variants.
Sourcepub fn is_dimension_error(&self) -> bool
pub fn is_dimension_error(&self) -> bool
Returns true if this is a dimension mismatch error.
This includes X0DimensionMismatch and IntegralityDimensionMismatch.
Trait Implementations§
Source§impl Error for DEError
impl Error for DEError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for DEError
impl RefUnwindSafe for DEError
impl Send for DEError
impl Sync for DEError
impl Unpin for DEError
impl UnwindSafe for DEError
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
Mutably borrows from an owned value. Read more
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>
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 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>
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