pub struct ConstraintHandler {
pub equality_constraints: Vec<ConstraintFunction>,
pub inequality_constraints: Vec<ConstraintFunction>,
pub bounds: Option<(Array1<f64>, Array1<f64>)>,
pub penalty_parameter: f64,
pub tolerance: f64,
}Expand description
Constraint handling utilities for constrained optimization
Fields§
§equality_constraints: Vec<ConstraintFunction>§inequality_constraints: Vec<ConstraintFunction>§bounds: Option<(Array1<f64>, Array1<f64>)>§penalty_parameter: f64§tolerance: f64Implementations§
Source§impl ConstraintHandler
impl ConstraintHandler
Sourcepub fn with_bounds(self, lower: Array1<f64>, upper: Array1<f64>) -> Self
pub fn with_bounds(self, lower: Array1<f64>, upper: Array1<f64>) -> Self
Set bounds constraints
Sourcepub fn with_penalty_parameter(self, penalty: f64) -> Self
pub fn with_penalty_parameter(self, penalty: f64) -> Self
Set penalty parameter
Sourcepub fn with_tolerance(self, tol: f64) -> Self
pub fn with_tolerance(self, tol: f64) -> Self
Set tolerance
Sourcepub fn check_violations(&self, x: &ArrayView1<'_, f64>) -> ConstraintViolation
pub fn check_violations(&self, x: &ArrayView1<'_, f64>) -> ConstraintViolation
Check constraint violations
Sourcepub fn is_feasible(&self, x: &ArrayView1<'_, f64>) -> bool
pub fn is_feasible(&self, x: &ArrayView1<'_, f64>) -> bool
Check if constraints are satisfied
Sourcepub fn penalty_function(&self, x: &ArrayView1<'_, f64>) -> f64
pub fn penalty_function(&self, x: &ArrayView1<'_, f64>) -> f64
Compute penalty function value
Trait Implementations§
Source§impl Debug for ConstraintHandler
impl Debug for ConstraintHandler
Auto Trait Implementations§
impl Freeze for ConstraintHandler
impl !RefUnwindSafe for ConstraintHandler
impl Send for ConstraintHandler
impl Sync for ConstraintHandler
impl Unpin for ConstraintHandler
impl !UnwindSafe for ConstraintHandler
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