Struct good_lp::variable::VariableDefinition[][src]

pub struct VariableDefinition { /* fields omitted */ }

Defines the properties of a variable, such as its lower and upper bounds.

Implementations

impl VariableDefinition[src]

pub fn new() -> Self[src]

Creates an unbounded continuous linear variable

pub fn bounds<N: Into<f64> + Copy, B: RangeBounds<N>>(self, bounds: B) -> Self[src]

Set the lower and/or higher bounds of the variable

Examples

assert_eq!(
    variable().bounds(1..2),
    variable().min(1).max(2)
);

assert_eq!(
    variable().bounds(1..),
    variable().min(1)
);

assert_eq!(
    variable().bounds(..=2),
    variable().max(2)
);

pub fn min<N: Into<f64>>(self, min: N) -> Self[src]

Set the lower bound of the variable

pub fn max<N: Into<f64>>(self, max: N) -> Self[src]

Set the higher bound of the variable

pub fn clamp<N1: Into<f64>, N2: Into<f64>>(self, min: N1, max: N2) -> Self[src]

Set both the lower and higher bounds of the variable

Trait Implementations

impl Clone for VariableDefinition[src]

impl Debug for VariableDefinition[src]

impl Default for VariableDefinition[src]

Creates an unbounded continuous linear variable

impl PartialEq<VariableDefinition> for VariableDefinition[src]

impl StructuralPartialEq for VariableDefinition[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.