pub struct Variable {
pub name: String,
pub lower_bound: f64,
pub upper_bound: f64,
pub var_type: VariableType,
}Expand description
decision variable in optimization problem
Fields§
§name: String§lower_bound: f64§upper_bound: f64§var_type: VariableTypeImplementations§
Source§impl Variable
impl Variable
Sourcepub fn new_continuous(
name: impl Into<String>,
lower_bound: f64,
upper_bound: f64,
) -> ProblemResult<Self>
pub fn new_continuous( name: impl Into<String>, lower_bound: f64, upper_bound: f64, ) -> ProblemResult<Self>
creates new continuous var w/ given name & bounds
Sourcepub fn new_integer(
name: impl Into<String>,
lower_bound: f64,
upper_bound: f64,
) -> ProblemResult<Self>
pub fn new_integer( name: impl Into<String>, lower_bound: f64, upper_bound: f64, ) -> ProblemResult<Self>
Creates a new integer variable with the given name and bounds
Sourcepub fn new_binary(name: impl Into<String>) -> Self
pub fn new_binary(name: impl Into<String>) -> Self
Creates a new binary variable with the given name
Sourcepub fn new_non_negative(name: impl Into<String>) -> Self
pub fn new_non_negative(name: impl Into<String>) -> Self
Creates a new non-negative continuous variable
Sourcepub fn new_free(name: impl Into<String>) -> Self
pub fn new_free(name: impl Into<String>) -> Self
Creates a new free (unbounded) continuous variable
Sourcepub fn is_lower_bounded(&self) -> bool
pub fn is_lower_bounded(&self) -> bool
Checks if the variable is bounded from below
Sourcepub fn is_upper_bounded(&self) -> bool
pub fn is_upper_bounded(&self) -> bool
Checks if the variable is bounded from above
Sourcepub fn is_bounded(&self) -> bool
pub fn is_bounded(&self) -> bool
Checks if the variable is bounded (both lower and upper bounds are finite)
Sourcepub fn is_feasible(&self, value: f64) -> bool
pub fn is_feasible(&self, value: f64) -> bool
Checks if a value is feasible for this variable
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Variable
impl<'de> Deserialize<'de> for Variable
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq 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