Enum GenConstrType

Source
#[non_exhaustive]
#[repr(i32)]
pub enum GenConstrType {
Show 18 variants Max = 0, Min = 1, Abs = 2, And = 3, Or = 4, Norm = 5, Indicator = 6, Pwl = 7, Polynomial = 8, NaturalExp = 9, Exp = 10, NaturalLog = 11, Log = 12, Logistic = 13, Pow = 14, Sin = 15, Cos = 16, Tan = 17,
}
Expand description

Type of general constraint

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Max = 0

The constraint $r = \max{x_1,\ldots,x_k,c}$ states that the resultant variable $r$ should be equal to the maximum of the operand variables $x_1,\ldots,x_k$ and the constant $c$.

For example, a solution $(r=3, x_1=2, x_2=3, x_3=0)$ would be feasible for the constraint $r = \max{x_1,x_2,x_3,1.7}$ because $3$ is indeed the maximum of $2$, $3$, $0$, and $1.7$.

§

Min = 1

The constraint $r = \min{x_1,\ldots,x_k,c}$ states that the resultant variable $r$ should be equal to the minimum of the operand variables $x_1,\ldots,x_k$ and the constant $c$.

§

Abs = 2

The constraint $r = \mbox{abs}{x}$ states that the resultant variable $r$ should be equal to the absolute value of the operand variable $x$.

For example, a solution $(r=3, x=-3)$ would be feasible for the constraint $r = \mbox{abs}{x}$.

§

And = 3

The constraint $r = \mbox{and}{x_1,\ldots,x_k}$ states that the binary resultant variable $r$ should be $1$ if and only if all of the binary operand variables $x_1,\ldots,x_k$ are equal to $1$.

For example, a solution $(r=1, x_1=1, x_2=1, x_3=1)$ would be feasible for the constraint $r = \mbox{and}{x_1,x_2,x_3}$.

Note that any involved variables that are not already binary are converted to binary.

§

Or = 4

Similar to an AND constraint, the constraint $r = \mbox{or}{x_1,\ldots,x_k}$ states that the binary resultant variable $r$ should be $1$ if and only if at least one of the binary operand variables $x_1,\ldots,x_k$ is equal to $1$.

Note that any involved variables that are not already binary are converted to binary.

§

Norm = 5

The constraint $r = \mbox{norm}{x_1,\ldots,x_k}$ states that the resultant variable $r$ should be equal to the vector norm of the operand variables $x_1,\ldots,x_k$.

A few options are available: the 0-norm, 1-norm, 2-norm, and infinity-norm.

§

Indicator = 6

An indicator constraint $y = f \rightarrow a^Tx \leq b$ states that if the binary indicator variable $y$ is equal to $f$ in a given solution, where $f \in {0,1}$, then the linear constraint $a^Tx \leq b$ has to be satisfied. On the other hand, if $y \neq f$ (i.e., $y = 1-f$) then the linear constraint may be violated.

Note that the sense of the linear constraint can also be $=$ or $\geq$; refer to this earlier section for a more detailed description of linear constraints.

Note also that declaring an INDICATOR constraint implicitly declares the indicator variable to be of binary type.

§

Pwl = 7

A piecewise-linear constraint $y = f(x)$ states that the point $(x, y)$ must lie on the piecewise-linear function $f()$ defined by a set of points $(x_1, y_1), (x_2, y_2), …, (x_n, y_n)$.

Refer to the description of piecewise-linear objectives for details of how piecewise-linear functions are defined.

§

Polynomial = 8

$y = p_0 x^n + p_1 x^{n-1} + … + p_n x + p_{n+1}$

§

NaturalExp = 9

$y = exp(x)$ or $y = e^x$

§

Exp = 10

$y = a^x$, where $a > 0$ is the base for the exponential function

§

NaturalLog = 11

: $y = \log_e(x)$ or $y = \ln(x)$

§

Log = 12

$y = \log_a(x)$, where $a > 0$ is the base for the logarithmic function

§

Logistic = 13

$y = \frac{1}{1 + exp(-x)}$ or $y = \frac{1}{1 + e^{-x}}$

§

Pow = 14

$y = x^a$, where $x \geq 0$ for any $a$ and $x > 0$ for $a < 0$

§

Sin = 15

$y = \sin(x)$

§

Cos = 16

$y = \cos(x)$

§

Tan = 17

$y = \tan(x)$

Trait Implementations§

Source§

impl Clone for GenConstrType

Source§

fn clone(&self) -> GenConstrType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Hash for GenConstrType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GenConstrType

Source§

fn eq(&self, other: &GenConstrType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<i32> for GenConstrType

Source§

type Error = String

The type returned in the event of a conversion error.
Source§

fn try_from(val: i32) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for GenConstrType

Source§

impl Eq for GenConstrType

Source§

impl StructuralPartialEq for GenConstrType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.