pub struct Variable {
pub id: u32,
pub bounds: (i64, i64),
}
Expand description
Variable data structure has two properties, “id” and “bounds”. An instance of Variable is used to reference to Statement or an input into a Theory.
Fields§
§id: u32
§bounds: (i64, i64)
Implementations§
Source§impl Variable
impl Variable
Sourcepub fn to_lineq_neg(&self) -> GeLineq
pub fn to_lineq_neg(&self) -> GeLineq
A negated linear inequality representation of a Variable.
§Example:
use puanrs::polyopt::Variable;
use puanrs::polyopt::GeLineq;
let variable: Variable = Variable {
id : 0,
bounds : (0,1)
};
let actual: GeLineq = variable.to_lineq_neg();
assert_eq!(actual.bias, 0);
assert_eq!(actual.bounds, vec![(0,1)]);
assert_eq!(actual.coeffs, vec![-1]);
assert_eq!(actual.indices, vec![0]);
pub fn to_variable_float(&self) -> VariableFloat
Trait Implementations§
impl Copy for Variable
impl Eq for Variable
Auto Trait Implementations§
impl Freeze for Variable
impl RefUnwindSafe for Variable
impl Send for Variable
impl Sync for Variable
impl Unpin for Variable
impl UnwindSafe for Variable
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