ConstrDoubleAttr

Enum ConstrDoubleAttr 

Source
pub enum ConstrDoubleAttr {
    DStart,
    FarkasDual,
    Pi,
    RHS,
    SARHSLow,
    SARHSUp,
    ScenNRHS,
    Slack,
}

Variants§

§

DStart

  • Modifiable: Yes
  • Type: double (f64)

The current simplex start vector. If you set DStart values for every linear constraint in the model and PStart values for every variable, then simplex will use those values to compute a warm start basis. If you’d like to retract a previously specified start, set any DStart value to GRB_UNDEFINED.

Note that any model modifications which are pending or are made after setting DStart (adding variables or constraints, changing coefficients, etc.) will discard the start. You should only set this attribute after you are done modifying your model.

Note also that you’ll get much better performance if you warm start your linear program from a simplex basis (using VBasis and CBasis). The DStart attribute should only be used in situations where you don’t have a basis or you don’t want to disable presolve.

If you’d like to provide a feasible starting solution for a MIP model, you should input it using the Start attribute.

Only affects LP models; it will be ignored for QP, QCP, or MIP models.

Note that if you provide a valid starting extreme point, either through PStart, DStart, or through VBasis, CBasis, then LP presolve will be disabled by default. For models where presolve greatly reduces the problem size, this might hurt performance. To allow presolve, it needs to set parameter LPWarmStart to 2.

Reference manual.

§

FarkasDual

  • Modifiable: No
  • Type: double (f64)

Together, attributes FarkasDual and FarkasProof provide a certificate of infeasibility for the given infeasible problem. Specifically, FarkasDual can be used to form the following inequality from the original constraints that is infeasible within the bounds of the variables:

$\lambda^tAx \leq \lambda^tb.$

This Farkas constraint is valid, because $\lambda_i \geq 0$ if the $i$-th constraint has a $\leq$ sense and $\lambda_i \leq 0$ if the $i$-th constraint has a $\geq$ sense.

Let

$\bar{a} := \lambda^tA$

be the coefficients of this inequality and

$\bar{b} := \lambda^tb$

be its right hand side. With $L_j$ and $U_j$ being the lower and upper bounds of the variables $x_j$ we have $\bar{a}_j \geq 0$ if $U_j = \infty$, and $\bar{a}_j \leq 0$ if $L_j = -\infty$.

The minimum violation of the Farkas constraint is achieved by setting $x^_j := L_j$ for $\bar{a}_j > 0$ and $x^_j := U_j$ for $\bar{a}_j < 0$. Then, we can calculate the minimum violation as

$\beta := \bar{a}^tx^* - \bar{b} = \sum\limits_{j:\bar{a}_j>0}\bar{a}jL_j + \sum\limits{j:\bar{a}_j<0}\bar{a}_jU_j - \bar{b}$

where $\beta>0$.

The FarkasProof attribute provides $\beta$, and the FarkasDual attributes provide the $\lambda$ multipliers for the original constraints.

These attributes are only available when parameter InfUnbdInfo is set to 1.

Reference manual.

§

Pi

  • Modifiable: No
  • Type: double (f64)

The constraint dual value in the current solution (also known as the shadow price).

Given a linear programming problem

$\begin{array}{ll} \mathrm{minimize} & c’x \ \mathrm{subject\ to} & Ax \ge b \ & x \ge 0 \end{array}$

and a corresponding dual problem

$\begin{array}{ll} \mathrm{maximize} & b’y \ \mathrm{subject\ to} & A’y \le c \ & y \ge 0 \end{array}$

the Pi attribute returns $y$.

Of course, not all models fit this canonical form. In general, dual values have the following properties:

Dual values for $\ge$ constraints are $\ge 0$.

Dual values for $\le$ constraints are $\le 0$.

Dual values for $=$ constraints are unconstrained.

For models with a maximization sense, the senses of the dual values are reversed: the dual is $\ge 0$ for a $\le$ constraint and $\le 0$ for a $\ge$ constraint.

Note that constraint dual values for linear constraints of QCP models are only available when the QCPDual parameter is set to 1. To query the duals of the quadratic constraints in a QCP model, see QCPi.

Only available for convex, continuous models.

Reference manual.

§

RHS

  • Modifiable: Yes
  • Type: double (f64)

Constraint right-hand side.

Reference manual.

§

SARHSLow

  • Modifiable: No
  • Type: double (f64)

Right-hand side sensitivity information: smallest right-hand side value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

SARHSUp

  • Modifiable: No
  • Type: double (f64)

Right-hand side sensitivity information: largest right-hand side value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

ScenNRHS

  • Modifiable: Yes
  • Type: double (f64)

When the model has multiple scenarios, this attribute is used to query or modify changes of the linear constraint right- hand sides in scenario $n$ w.r.t. the base model. You set $n$ using the ScenarioNumber parameter.

If an element of this array attribute is set to the undefined value (GRB_UNDEFINED in C and C++, or GRB.UNDEFINED in Java, .NET, and Python), it means that the corresponding value in the scenario is identical to the one in the base model.

The number of scenarios in the model can be queried (or modified) using the NumScenarios attribute.

Please refer to the Multiple Scenarios discussion for more information.

Reference manual.

§

Slack

  • Modifiable: No
  • Type: double (f64)

The constraint slack in the current solution.

Reference manual.

Trait Implementations§

Source§

impl AsCStr for ConstrDoubleAttr

Source§

fn as_cstr(&self) -> &'static CStr

Represent self as a &CStr
Source§

impl Clone for ConstrDoubleAttr

Source§

fn clone(&self) -> ConstrDoubleAttr

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 Debug for ConstrDoubleAttr

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromCStr for ConstrDoubleAttr

Source§

type Err = &'static str

The error type returned if parsing fails. Read more
Source§

fn from_cstr(s: &CStr) -> Result<Self, Self::Err>

Parse the &CStr for an instance of Self. Read more
Source§

impl Hash for ConstrDoubleAttr

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 ConstrDoubleAttr

Source§

fn eq(&self, other: &ConstrDoubleAttr) -> 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 Copy for ConstrDoubleAttr

Source§

impl Eq for ConstrDoubleAttr

Source§

impl StructuralPartialEq for ConstrDoubleAttr

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<A> ObjAttrGet<<A as ObjAttr>::Obj, f64> for A
where A: DoubleAttr + ObjAttr + AsCStr,

Source§

fn get(&self, model: &Model, idx: i32) -> Result<f64, Error>

Get the value for this attribute
Source§

fn get_batch<I>(&self, model: &Model, inds: I) -> Result<Vec<f64>, Error>
where I: IntoIterator<Item = Result<i32, Error>>,

Get multiple values for this attribute at once
Source§

impl<A> ObjAttrSet<<A as ObjAttr>::Obj, f64> for A
where A: DoubleAttr + ObjAttr + AsCStr,

Source§

fn set(&self, model: &Model, idx: i32, val: f64) -> Result<(), Error>

Set the value for this attribute
Source§

fn set_batch<I>(&self, model: &Model, idx_val_pairs: I) -> Result<(), Error>
where I: IntoIterator<Item = (Result<i32, Error>, f64)>,

Set multiple values for this attribute at once
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.