pub struct Model { /* private fields */ }Expand description
Represents a complete optimization model.
Contains:
- An objective function to optimize
- A set of constraints that must be satisfied
- Domain information for variables
Implementations§
Source§impl Model
impl Model
Sourcepub fn new(
objective: Objective,
constraints: Vec<Constraint>,
domain: IndexMap<String, DomainVariable>,
) -> Self
pub fn new( objective: Objective, constraints: Vec<Constraint>, domain: IndexMap<String, DomainVariable>, ) -> Self
Creates a new optimization model.
§Arguments
objective- The objective function to optimizeconstraints- Vector of constraints that must be satisfieddomain- Map of variable names to their domains
Sourcepub fn into_components(
self,
) -> (Objective, Vec<Constraint>, IndexMap<String, DomainVariable>)
pub fn into_components( self, ) -> (Objective, Vec<Constraint>, IndexMap<String, DomainVariable>)
Sourcepub fn constraints(&self) -> &Vec<Constraint>
pub fn constraints(&self) -> &Vec<Constraint>
Gets a reference to the constraints.
Sourcepub fn domain(&self) -> &IndexMap<String, DomainVariable>
pub fn domain(&self) -> &IndexMap<String, DomainVariable>
Gets a reference to the variable domains.
Sourcepub fn domain_mut(&mut self) -> &mut IndexMap<String, DomainVariable>
pub fn domain_mut(&mut self) -> &mut IndexMap<String, DomainVariable>
Gets a mutable reference to the variable domains.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Model
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
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> 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