VarDoubleAttr

Enum VarDoubleAttr 

Source
pub enum VarDoubleAttr {
Show 22 variants ScenNX, BarX, LB, Obj, ObjN, PStart, RC, SALBLow, SALBUp, SAObjLow, SAObjUp, SAUBLow, SAUBUp, ScenNLB, ScenNObj, ScenNUB, Start, UB, UnbdRay, VarHintVal, X, Xn,
}

Variants§

§

ScenNX

  • Modifiable: No
  • Type: double (f64)

When the model has multiple scenarios, this attribute is used to query the variable value in the current solution of scenario $n$. You set $n$ using the ScenarioNumber parameter.

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.

§

BarX

  • Modifiable: No
  • Type: double (f64)

The variable value in the best barrier iterate (before crossover). Only available when the barrier algorithm was selected.

Reference manual.

§

LB

  • Modifiable: Yes
  • Type: double (f64)

Variable lower bound. Note that any value less than -1e20 is treated as negative infinity.

Reference manual.

§

Obj

  • Modifiable: Yes
  • Type: double (f64)

Linear objective coefficient. In our object-oriented interfaces, you typically use the setObjective method to set the objective, but this attribute provides an alternative for setting or modifying linear objective terms.

Note that this attribute interacts with our piecewise-linear objective feature. If you set a piecewise-linear objective function for a variable, that will automatically set the Obj attribute to zero. Similarly, if you set the Obj attribute for a variable, that will automatically delete any previously specified piecewise-linear objective.

Reference manual.

§

ObjN

  • Modifiable: Yes
  • Type: double (f64)

When the model has multiple objectives, this attribute is used to query or modify objective coefficients for objective $n$. You set $n$ using the ObjNumber parameter. Note that when ObjNumber is equal to 0, ObjN is equivalent to Obj.

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

Please refer to the discussion of Multiple Objectives for more information on the use of alternative objectives.

Reference manual.

§

PStart

  • Modifiable: Yes
  • Type: double (f64)

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

Note that any model modifications which are pending or are made after setting PStart (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 using a simplex basis (using VBasis and CBasis). The PStart 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.

§

RC

  • Modifiable: No
  • Type: double (f64)

The reduced cost in the current solution. Only available for convex, continuous models.

Reference manual.

§

SALBLow

  • Modifiable: No
  • Type: double (f64)

Lower bound sensitivity information: smallest lower bound value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

SALBUp

  • Modifiable: No
  • Type: double (f64)

Lower bound sensitivity information: largest lower bound value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

SAObjLow

  • Modifiable: No
  • Type: double (f64)

Objective coefficient sensitivity information: smallest objective value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

SAObjUp

  • Modifiable: No
  • Type: double (f64)

Objective coefficient sensitivity information: largest objective value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

SAUBLow

  • Modifiable: No
  • Type: double (f64)

Upper bound sensitivity information: smallest upper bound value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

SAUBUp

  • Modifiable: No
  • Type: double (f64)

Upper bound sensitivity information: largest upper bound value at which the current optimal basis would remain optimal. Only available for basic solutions.

Reference manual.

§

ScenNLB

  • Modifiable: Yes
  • Type: double (f64)

When the model has multiple scenarios, this attribute is used to query or modify changes of the variable lower bounds 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.

§

ScenNObj

  • Modifiable: Yes
  • Type: double (f64)

When the model has multiple scenarios, this attribute is used to query or modify changes of the variable objective coefficients 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.

§

ScenNUB

  • Modifiable: Yes
  • Type: double (f64)

When the model has multiple scenarios, this attribute is used to query or modify changes of the variable upper bounds 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.

§

Start

  • Modifiable: Yes
  • Type: double (f64)

The current MIP start vector. The MIP solver will attempt to build an initial solution from this vector when it is available. Note that the start can be partially populated – the MIP solver will attempt to fill in values for missing start values. If you wish to leave the start value for a variable undefined, you can either avoid setting the Start attribute for that variable, or you can set it to a special undefined value (GRB_UNDEFINED in C and C++, or GRB.UNDEFINED in Java, .NET, and Python).

If the Gurobi MIP solver log indicates that your MIP start didn’t produce a new incumbent solution, note that there can be multiple explanations. One possibility is that your MIP start is infeasible. Another, more common possibility is that one of the Gurobi heuristics found a solution that is as good as the solution produced by the MIP start, so the MIP start solution was cut off. Finally, if you specified a partial MIP start, it is possible that the limited MIP exploration done on this partial start was insufficient to find a new incumbent solution. You can try setting the StartNodeLimit parameter to a larger value if you want Gurobi to work harder to try to complete the partial start.

If you solve a sequence of models, where one is built by modifying the previous one, and if you don’t provide a MIP start, then Gurobi will try to construct one automatically from the solution of the previous model. If you don’t want it to try this, you should reset the model before starting the subsequent solve. If you provided a MIP start but would prefer to use the previous solution as the start instead, you should clear your start (by setting the Start attribute to undefined for all variables).

If you have multiple start vectors, you can provide them to Gurobi by using the Start attribute in combination with the NumStart attribute and the StartNumber parameter. Specifically, use the NumStart attribute to indicate how many start vectors you will supply. Then set the StartNumber parameter to a value between 0 and NumStart-1 to indicate which start you are supplying. For each value of StartNumber, populate the Start attribute to supply that start. Gurobi will use all of the provided starts. As an alternative, you can append new MIP start vectors to your model by setting the StartNumber parameter to -1. In this case, whenever you read a MIP start, or use a function to set a MIP start value for a set of variables, a new MIP start will be created, the parameter NumStart will be increased, and any unspecified variable will be left as undefined.

If you want to diagnose an infeasible MIP start, you can try fixing the variables in the model to their values in your MIP start (by setting their lower and upper bound attributes). If the resulting MIP model is infeasible, you can then compute an IIS on this model to get additional information that should help to identify the cause of the infeasibility.

Only affects MIP models.

Reference manual.

§

UB

  • Modifiable: Yes
  • Type: double (f64)

Variable upper bound. Note that any value greater than 1e20 is treated as infinite.

Reference manual.

§

UnbdRay

  • Modifiable: No
  • Type: double (f64)

Unbounded ray (for unbounded linear models only). Provides a vector that, when added to any feasible solution, yields a new solution that is also feasible but improves the objective. Only available when parameter InfUnbdInfo is set to 1.

Reference manual.

§

VarHintVal

  • Modifiable: Yes
  • Type: double (f64)

A set of user hints. If you know that a variable is likely to take a particular value in high quality solutions of a MIP model, you can provide that value as a hint. You can also (optionally) provide information about your level of confidence in a hint with the VarHintPri attribute.

The Gurobi MIP solver will use these variable hints in a number of different ways. Hints will affect the heuristics that Gurobi uses to find feasible solutions, and the branching decisions that Gurobi makes to explore the MIP search tree. In general, high quality hints should produce high quality MIP solutions faster. In contrast, low quality hints will lead to some wasted effort, but shouldn’t lead to dramatic performance degradations.

Variables hints and MIP starts are similar in concept, but they behave in very different ways. If you specify a MIP start, the Gurobi MIP solver will try to build a single feasible solution from the provided set of variable values. If you know a solution, you should use a MIP start to provide it to the solver. In contrast, variable hints provide guidance to the MIP solver that affects the entire solution process. If you have a general sense of the likely values for variables, you should provide them through variable hints.

If you wish to leave the hint value for a variable undefined, you can either avoid setting the VarHintVal attribute for that variable, or you can set it to a special undefined value (GRB_UNDEFINED in C and C++, GRB.UNDEFINED in Java, .NET, and Python, NA in R or nan in Matlab).

Note that deleting variables from your model will cause several attributes to be discarded (variable hints and branch priorities). If you’d like them to persist, your program will need to repopulate them after deleting the variables and making a subsequent model update call.

Only affects MIP models.

Reference manual.

§

X

  • Modifiable: No
  • Type: double (f64)

Variable value in the current solution.

Reference manual.

§

Xn

  • Modifiable: No
  • Type: double (f64)

The variable value in a sub-optimal MIP solution. Use parameter SolutionNumber to indicate which alternate solution to retrieve. Solutions are sorted in order of worsening objective value. Thus, when SolutionNumber is 1, Xn returns the second-best solution found. When SolutionNumber is equal to its default value of 0, querying attribute Xn is equivalent to querying attribute X.

The number of sub-optimal solutions found during the MIP search will depend on the values of a few parameters. The most important of these are PoolSolutions, PoolSearchMode, and PoolGap. Please consult the section on Solution Pools for a more detailed discussion of this topic.

Reference manual.

Trait Implementations§

Source§

impl AsCStr for VarDoubleAttr

Source§

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

Represent self as a &CStr
Source§

impl Clone for VarDoubleAttr

Source§

fn clone(&self) -> VarDoubleAttr

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 VarDoubleAttr

Source§

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

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

impl FromCStr for VarDoubleAttr

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 VarDoubleAttr

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 VarDoubleAttr

Source§

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

Source§

impl Eq for VarDoubleAttr

Source§

impl StructuralPartialEq for VarDoubleAttr

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.