pub struct Variable { /* private fields */ }Expand description
A lightweight handle to a decision variable.
Variable is Copy, so it can be used in expressions multiple times
without being consumed: x + y does not move x.
Internally, a Variable carries its index and the ID of the model that
created it. The model ID is used by checked variants such as
crate::Model::try_var_name and crate::ModelResult::try_value to detect
cross-model variable misuse at runtime.
Implementations§
Trait Implementations§
Source§impl Add for Variable
impl Add for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+ operator.Source§impl Add<Expression> for Variable
impl Add<Expression> for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+ operator.Source§fn add(self, rhs: Expression) -> Expression
fn add(self, rhs: Expression) -> Expression
Performs the
+ operation. Read moreSource§impl Add<Variable> for Expression
impl Add<Variable> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+ operator.Source§impl Add<Variable> for f64
impl Add<Variable> for f64
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+ operator.Source§impl Add<f64> for Variable
impl Add<f64> for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
+ operator.impl Copy for Variable
impl Eq for Variable
Source§impl From<Variable> for Expression
impl From<Variable> for Expression
Source§impl Index<Variable> for ModelResult
Index a ModelResult by Variable to get the primal solution value.
impl Index<Variable> for ModelResult
Index a ModelResult by Variable to get the primal solution value.
§Example
println!("x = {}", result[x]);Source§impl Mul<Expression> for Variable
impl Mul<Expression> for Variable
Source§impl Mul<Variable> for Expression
impl Mul<Variable> for Expression
Source§impl Mul<Variable> for f64
impl Mul<Variable> for f64
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
* operator.Source§impl Mul<f64> for Variable
impl Mul<f64> for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
* operator.Source§impl Neg for Variable
impl Neg for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
- operator.Source§fn neg(self) -> Expression
fn neg(self) -> Expression
Performs the unary
- operation. Read moreimpl StructuralPartialEq for Variable
Source§impl Sub for Variable
impl Sub for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
- operator.Source§impl Sub<Expression> for Variable
impl Sub<Expression> for Variable
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
- operator.Source§fn sub(self, rhs: Expression) -> Expression
fn sub(self, rhs: Expression) -> Expression
Performs the
- operation. Read moreSource§impl Sub<Variable> for Expression
impl Sub<Variable> for Expression
Source§type Output = Expression
type Output = Expression
The resulting type after applying the
- operator.Auto Trait Implementations§
impl Freeze for Variable
impl RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl UnsafeUnpin for Variable
impl UnwindSafe for Variable
Blanket Implementations§
impl<T> Boilerplate for T
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> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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