pub struct Linearizer { /* private fields */ }Expand description
Manages the linearization process for expressions and constraints.
Implementations§
Source§impl Linearizer
impl Linearizer
Sourcepub fn new_from(
constraints: Vec<Constraint>,
domain: IndexMap<String, DomainVariable>,
) -> Self
pub fn new_from( constraints: Vec<Constraint>, domain: IndexMap<String, DomainVariable>, ) -> Self
Creates a Linearizer with initial constraints and domain.
§Arguments
constraints- Initial constraints to processdomain- Variable domain information
Sourcepub fn add_constraint(&mut self, constraint: Constraint)
pub fn add_constraint(&mut self, constraint: Constraint)
Sourcepub fn constraints(&self) -> &VecDeque<Constraint>
pub fn constraints(&self) -> &VecDeque<Constraint>
Returns a reference to the current constraints.
Sourcepub fn pop_constraint(&mut self) -> Option<Constraint>
pub fn pop_constraint(&mut self) -> Option<Constraint>
Removes and returns the next constraint to process.
Sourcepub fn declare_variable(
&mut self,
name: String,
as_type: VariableType,
) -> Result<(), LinearizationError>
pub fn declare_variable( &mut self, name: String, as_type: VariableType, ) -> Result<(), LinearizationError>
Sourcepub fn used_variables(&self) -> Vec<String>
pub fn used_variables(&self) -> Vec<String>
Returns names of all variables that are used in constraints.
Sourcepub fn linearize(model: Model) -> Result<LinearModel, LinearizationError>
pub fn linearize(model: Model) -> Result<LinearModel, LinearizationError>
Trait Implementations§
Source§impl Default for Linearizer
impl Default for Linearizer
Source§fn default() -> Linearizer
fn default() -> Linearizer
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for Linearizer
impl RefUnwindSafe for Linearizer
impl Send for Linearizer
impl Sync for Linearizer
impl Unpin for Linearizer
impl UnsafeUnpin for Linearizer
impl UnwindSafe for Linearizer
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