pub struct LinearConstraintSet { /* private fields */ }Expand description
A set of linear constraints
Useful for representing polyhedral constraints (intersection of half-spaces).
Implementations§
Source§impl LinearConstraintSet
impl LinearConstraintSet
Sourcepub fn new(constraints: Vec<LinearConstraint>) -> Self
pub fn new(constraints: Vec<LinearConstraint>) -> Self
Create a new constraint set
Sourcepub fn check_each(&self, x: &[f32]) -> Vec<bool>
pub fn check_each(&self, x: &[f32]) -> Vec<bool>
Get individual check results for each constraint
Sourcepub fn total_violation(&self, x: &[f32]) -> f32
pub fn total_violation(&self, x: &[f32]) -> f32
Compute total weighted violation
Sourcepub fn project(&self, x: &[f32], max_iters: usize) -> Vec<f32>
pub fn project(&self, x: &[f32], max_iters: usize) -> Vec<f32>
Project x onto feasible region using cyclic projection (Dykstra’s)
Iteratively projects onto each constraint. May not converge to true projection for non-convex feasible regions.
Sourcepub fn add(&mut self, constraint: LinearConstraint)
pub fn add(&mut self, constraint: LinearConstraint)
Add a constraint to the set
Sourcepub fn constraints(&self) -> &[LinearConstraint]
pub fn constraints(&self) -> &[LinearConstraint]
Get constraints
Trait Implementations§
Source§impl Clone for LinearConstraintSet
impl Clone for LinearConstraintSet
Source§fn clone(&self) -> LinearConstraintSet
fn clone(&self) -> LinearConstraintSet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LinearConstraintSet
impl Debug for LinearConstraintSet
Source§impl Default for LinearConstraintSet
impl Default for LinearConstraintSet
Source§impl<'de> Deserialize<'de> for LinearConstraintSet
impl<'de> Deserialize<'de> for LinearConstraintSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for LinearConstraintSet
impl RefUnwindSafe for LinearConstraintSet
impl Send for LinearConstraintSet
impl Sync for LinearConstraintSet
impl Unpin for LinearConstraintSet
impl UnwindSafe for LinearConstraintSet
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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