pub struct VarBuilder<'a> {
pub model: &'a mut Model,
pub var: VarId,
}Expand description
A builder for setting properties of a variable using a fluent API.
Returned by Model::add_var(), this allows setting bounds, integrality,
and other properties before finalizing the variable with finish().
§Examples
let mut model = Model::new();
let x = model
.add_var()
.integer()
.finish();Fields§
§model: &'a mut Model§var: VarIdImplementations§
Source§impl<'a> VarBuilder<'a>
Methods for configuring a variable using a fluent API.
impl<'a> VarBuilder<'a>
Methods for configuring a variable using a fluent API.
Returned by Model::add_var(). Use these methods to set bounds,
integrality, or mark a variable as binary before calling finish().
Sourcepub fn lower_bound(self, lb: f64) -> Self
pub fn lower_bound(self, lb: f64) -> Self
Sets a lower bound for the variable.
This method currently panics because lower bounds are not yet implemented.
§Examples
let mut model = Model::new();
let x = model.add_var().lower_bound(0.0).finish();Sourcepub fn upper_bound(self, ub: f64) -> Self
pub fn upper_bound(self, ub: f64) -> Self
Sets an upper bound for the variable.
This method currently panics because upper bounds are not yet implemented.
§Examples
let mut model = Model::new();
let x = model.add_var().upper_bound(10.0).finish();Sourcepub fn integer(self) -> Self
pub fn integer(self) -> Self
Mark the variable as an integer.
§Examples
let mut model = Model::new();
let x = model.add_var().integer().finish();Auto Trait Implementations§
impl<'a> Freeze for VarBuilder<'a>
impl<'a> RefUnwindSafe for VarBuilder<'a>
impl<'a> Send for VarBuilder<'a>
impl<'a> Sync for VarBuilder<'a>
impl<'a> Unpin for VarBuilder<'a>
impl<'a> UnsafeUnpin for VarBuilder<'a>
impl<'a> !UnwindSafe for VarBuilder<'a>
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