Try our new documentation site (beta).
Attributes
The primary mechanism for querying and modifying properties of a Gurobi model is through the attribute interface. A variety of different attributes are available. Some are only populated at certain times (e.g., those related to the solution of a model), while others are available at all times (e.g., the number of variables in the model). Attributes can be associated with variables (e.g., lower bounds), constraints (e.g., the right-hand side), SOSs (e.g., IIS membership), or with the model as a whole (e.g., the objective value for the current solution).
The following tables list the full set of Gurobi attributes. The attributes have been grouped by type: model attributes take scalar values, while variable, linear constraint, SOS constraint, quadratic constraint, and general constraint attributes contain one entry per variable or constraint in the model. The APIs provide methods to query attribute values for individual constraints or variables, or to query their values for arrays of constraints or variables (refer to our Attribute Examples section for examples). Array queries are generally more efficient.
Note that the attributes that provide solution quality information have been split off into a separate table at the end of this section. These attributes are also associated with the model as a whole.
Some solution attributes require information that is only computed by
certain Gurobi algorithms. Such cases are noted in the
detailed attribute descriptions that follow. For
example, the VBasis
and CBasis
attributes can only be
queried when a simplex basis is available (a basis is available when a
continuous model has been solved using primal simplex, dual simplex,
or barrier with crossover). Sensitivity information
(SAObjLow
, SAObjUp
, etc.) is also only available
for basic solutions.
Model attributes:
These attributes provide information about the overall model (as opposed to information about individual variables or constraints in the model).
Attribute name | Description |
---|---|
NumVars | Number of variables |
NumConstrs | Number of linear constraints |
NumSOS | Number of SOS constraints |
NumQConstrs | Number of quadratic constraints |
NumGenConstrs | Number of general constraints |
NumNZs | Number of non-zero coefficients in the constraint matrix |
DNumNZs | Number of non-zero coefficients in the constraint matrix (in double format) |
NumQNZs | Number of non-zero quadratic objective terms |
NumQCNZs | Number of non-zero terms in quadratic constraints |
NumIntVars | Number of integer variables |
NumBinVars | Number of binary variables |
NumPWLObjVars | Number of variables with piecewise-linear objective functions |
ModelName | Model name |
ModelSense | Model sense (minimization or maximization) |
ObjCon | Constant offset for objective function |
ObjVal | Objective value for current solution |
ObjBound | Best available objective bound (lower bound for minimization, upper bound for maximization) |
ObjBoundC | Best available objective bound, without rounding (lower bound for minimization, upper bound for maximization) |
PoolObjBound | Bound on best objective for solutions not in pool (lower bound for minimization, upper bound for maximization) |
PoolObjVal | Objective value of alternatives solutions stored during the optimization process |
MIPGap | Current relative MIP optimality gap |
Runtime | Runtime for most recent optimization |
Status | Current optimization status |
SolCount | Number of stored solutions |
IterCount | Number of simplex iterations performed in most recent optimization |
BarIterCount | Number of barrier iterations performed in most recent optimization |
NodeCount | Number of branch-and-cut nodes explored in most recent optimization |
IsMIP | Indicates whether the model is a MIP |
IsQP | Indicates whether the model is a QP/MIQP |
IsQCP | Indicates whether the model is a QCP/MIQCP |
IsMultiObj | Indicates whether the model has multiple objectives |
IISMinimal | Indicates whether the current IIS is minimal |
MaxCoeff | Maximum constraint matrix coefficient (in absolute value) |
MinCoeff | Minimum (non-zero) constraint matrix coefficient (in absolute value) |
MaxBound | Maximum finite variable bound |
MinBound | Minimum finite variable bound |
MaxObjCoeff | Maximum linear objective coefficient (in absolute value) |
MinObjCoeff | Minimum (non-zero) linear objective coefficient (in absolute value) |
MaxRHS | Maximum constraint right-hand side (in absolute value) |
MinRHS | Minimum (non-zero) constraint right-hand side (in absolute value) |
MaxQCCoeff | Maximum quadratic constraint matrix coefficient of quadratic part (in absolute value) |
MinQCCoeff | Minimum (non-zero) quadratic constraint matrix coefficient of quadratic part (in absolute value) |
MaxQCLCoeff | Maximum quadratic constraint matrix coefficient in linear part (in absolute value) |
MinQCLCoeff | Minimum (non-zero) quadratic constraint matrix coefficient in linear part (in absolute value) |
MaxQCRHS | Maximum quadratic constraint right-hand side (in absolute value) |
MinQCRHS | Minimum (non-zero) quadratic constraint right-hand side (in absolute value) |
MaxQObjCoeff | Maximum quadratic objective coefficient (in absolute value) |
MinQObjCoeff | Minimum (non-zero) quadratic objective coefficient (in absolute value) |
Kappa | Estimated basis condition number |
KappaExact | Exact basis condition number |
FarkasProof | Magnitude of infeasibility violation in Farkas infeasibility proof |
TuneResultCount | Number of improved parameter sets found by tuning tool |
NumStart | Number of MIP starts |
LicenseExpiration | License expiration date |
Server | For Compute Server, name of server |
Variable attributes:
These attributes provide information that is associated with specific variables.
Attribute name | Description |
---|---|
LB | Lower bound |
UB | Upper bound |
Obj | Linear objective coefficient |
VType | Variable type (continuous, binary, integer, etc.) |
VarName | Variable name |
VTag | Variable tag |
X | Value in the current solution |
Xn | Value in a sub-optimal MIP solution |
RC | Reduced cost |
BarX | Value in the best barrier iterate (before crossover) |
Start | MIP start value (for constructing an initial MIP solution) |
VarHintVal | MIP hint value |
VarHintPri | MIP hint priority |
BranchPriority | Branching priority |
Partition | Variable partition |
VBasis | Basis status |
PStart | Simplex start vector |
IISLB | Indicates whether the lower bound participates in the IIS |
IISUB | Indicates whether the upper bound participates in the IIS |
PWLObjCvx | Indicates whether the variable has a convex piecewise-linear objective |
SAObjLow | Objective coefficient sensitivity information |
SAObjUp | Objective coefficient sensitivity information |
SALBLow | Lower bound sensitivity information |
SALBUp | Lower bound sensitivity information |
SAUBLow | Upper bound sensitivity information |
SAUBUp | Upper bound sensitivity information |
UnbdRay | Unbounded ray |
Linear constraint attributes:
These attributes provide information that is associated with specific linear constraints.
Attribute name | Description |
---|---|
Sense | Constraint sense ('<', '>', or '=') |
RHS | Right-hand side value |
ConstrName | Constraint name |
CTag | Constraint tag |
Pi | Dual value (also known as the shadow price) |
Slack | Slack in the current solution |
CBasis | Basis status |
DStart | Simplex start vector |
Lazy | Determines whether a constraint is treated as a lazy constraint |
IISConstr | Indicates whether the constraint participates in the IIS |
SARHSLow | Right-hand side sensitivity information |
SARHSUp | Right-hand side sensitivity information |
FarkasDual | Farkas infeasibility proof |
SOS attributes:
These attributes provide information that is associated with specific Special-Ordered Set (SOS) constraints.
Attribute name | Description |
---|---|
IISSOS | Indicates whether the SOS constraint participates in the IIS |
Quadratic constraint attributes:
These attributes provide information that is associated with specific quadratic constraints.
Attribute name | Description |
---|---|
QCSense | Constraint sense ('<', '>', or '=') |
QCRHS | Right-hand side |
QCName | Quadratic constraint name |
QCPi | Dual value |
QCSlack | Slack in the current solution |
QCTag | Quadratic constraint tag |
IISQConstr | Indicates whether the quadratic constraint participates in the IIS |
General constraint attributes:
These attributes provide information that is associated with specific general constraints. Those starting with "Func" are only for function constraints.
Attribute name | Description |
---|---|
FuncPieceError | Error allowed for PWL translation |
FuncPieceLength | Piece length for PWL translation |
FuncPieceRatio | Controls whether to under- or over-estimate function values in PWL approximation |
FuncPieces | Sets strategy for PWL function approximation |
GenConstrType | Type of general constraint |
GenConstrName | General constraint name |
IISGenConstr | Indicates whether the general constraint participates in the IIS |
Solution quality attributes:
Attribute name | Description |
---|---|
BoundVio | Maximum (unscaled) bound violation |
BoundSVio | Maximum (scaled) bound violation |
BoundVioIndex | Index of variable with the largest (unscaled) bound violation |
BoundSVioIndex | Index of variable with the largest (scaled) bound violation |
BoundVioSum | Sum of (unscaled) bound violations |
BoundSVioSum | Sum of (scaled) bound violations |
ConstrVio | Maximum (unscaled) constraint violation |
ConstrSVio | Maximum (scaled) constraint violation |
ConstrVioIndex | Index of constraint with the largest (unscaled) violation |
ConstrSVioIndex | Index of constraint with the largest (scaled) violation |
ConstrVioSum | Sum of (unscaled) constraint violations |
ConstrSVioSum | Sum of (scaled) constraint violations |
ConstrResidual | Maximum (unscaled) primal constraint error |
ConstrSResidual | Maximum (scaled) primal constraint error |
ConstrResidualIndex | Index of constraint with the largest (unscaled) primal constraint error |
ConstrSResidualIndex | Index of constraint with the largest (scaled) primal constraint error |
ConstrResidualSum | Sum of (unscaled) primal constraint errors |
ConstrSResidualSum | Sum of (scaled) primal constraint errors |
DualVio | Maximum (unscaled) reduced cost violation |
DualSVio | Maximum (scaled) reduced cost violation |
DualVioIndex | Index of variable with the largest (unscaled) reduced cost violation |
DualSVioIndex | Index of variable with the largest (scaled) reduced cost violation |
DualVioSum | Sum of (unscaled) reduced cost violations |
DualSVioSum | Sum of (scaled) reduced cost violations |
DualResidual | Maximum (unscaled) dual constraint error |
DualSResidual | Maximum (scaled) dual constraint error |
DualResidualIndex | Index of variable with the largest (unscaled) dual constraint error |
DualSResidualIndex | Index of variable with the largest (scaled) dual constraint error |
DualResidualSum | Sum of (unscaled) dual constraint errors |
DualSResidualSum | Sum of (scaled) dual constraint errors |
ComplVio | Maximum complementarity violation |
ComplVioIndex | Index of variable with the largest complementarity violation |
ComplVioSum | Sum of complementarity violations |
IntVio | Maximum integrality violation |
IntVioIndex | Index of variable with the largest integrality violation |
IntVioSum | Sum of integrality violations |
Multi-objective attributes:
Attribute name | Description |
---|---|
ObjN | Objectives of multi-objectives |
ObjNCon | Constant terms of multi-objectives |
ObjNPriority | Priorities of multi-objectives |
ObjNWeight | Weights of multi-objectives |
ObjNRelTol | Relative tolerances of multi-objectives |
ObjNAbsTol | Absolute tolerances of multi-objectives |
ObjNVal | Objective value of multi-objectives solutions |
ObjNName | Names of multi-objectives |
NumObj | Number of multi-objectives |
Multi-scenario attributes:
Attribute name | Description |
---|---|
ScenNLB | Lower bound changes of current scenario in multi-scenario model |
ScenNUB | Upper bound changes of current scenario in multi-scenario model |
ScenNObj | Objective coefficient changes of current scenario in multi-scenario model |
ScenNRHS | Right-hand side changes of current scenario in multi-scenario model |
ScenNName | Name of current scenario in multi-scenario model |
ScenNObjBound | Objective bound of current scenario in multi-scenario model |
ScenNObjVal | Objective value for current solution of current scenario in multi-scenario model |
ScenNX | Value in the current solution of current scenario in multi-scenario model |
NumScenarios | Number of scenarios |
Batch attributes:
Attribute name | Description |
---|---|
BatchErrorCode | Last error code received from the Cluster Manager |
BatchErrorMessage | Last error message received from the Cluster Manager |
BatchID | ID of the remote batch |
BatchStatus | Status of the batch |
Subsections
- Model Attributes
- NumConstrs
- NumVars
- NumSOS
- NumQConstrs
- NumGenConstrs
- NumNZs
- DNumNZs
- NumQNZs
- NumQCNZs
- NumIntVars
- NumBinVars
- NumPWLObjVars
- ModelName
- ModelSense
- ObjCon
- ObjVal
- ObjBound
- ObjBoundC
- PoolObjBound
- PoolObjVal
- MIPGap
- Runtime
- Status
- SolCount
- IterCount
- BarIterCount
- NodeCount
- IsMIP
- IsQP
- IsQCP
- IsMultiObj
- IISMinimal
- MaxCoeff
- MinCoeff
- MaxBound
- MinBound
- MaxObjCoeff
- MinObjCoeff
- MaxRHS
- MinRHS
- MaxQCCoeff
- MinQCCoeff
- MaxQCLCoeff
- MinQCLCoeff
- MaxQCRHS
- MinQCRHS
- MaxQObjCoeff
- MinQObjCoeff
- Kappa
- KappaExact
- FarkasProof
- TuneResultCount
- NumStart
- LicenseExpiration
- Server
- Variable Attributes
- LB
- UB
- Obj
- VarName
- VTag
- VType
- X
- Xn
- RC
- BarX
- Start
- VarHintVal
- VarHintPri
- BranchPriority
- Partition
- VBasis
- PStart
- IISLB
- IISUB
- PWLObjCvx
- SAObjLow
- SAObjUp
- SALBLow
- SALBUp
- SAUBLow
- SAUBUp
- UnbdRay
- Linear Constraint Attributes
- SOS Attributes
- Quadratic Constraint Attributes
- General Constraint Attributes
- Quality Attributes
- BoundVio
- BoundSVio
- BoundVioIndex
- BoundSVioIndex
- BoundVioSum
- BoundSVioSum
- ConstrVio
- ConstrSVio
- ConstrVioIndex
- ConstrSVioIndex
- ConstrVioSum
- ConstrSVioSum
- ConstrResidual
- ConstrSResidual
- ConstrResidualIndex
- ConstrSResidualIndex
- ConstrResidualSum
- ConstrSResidualSum
- DualVio
- DualSVio
- DualVioIndex
- DualSVioIndex
- DualVioSum
- DualSVioSum
- DualResidual
- DualSResidual
- DualResidualIndex
- DualSResidualIndex
- DualResidualSum
- DualSResidualSum
- ComplVio
- ComplVioIndex
- ComplVioSum
- IntVio
- IntVioIndex
- IntVioSum
- Multi-objective Attributes
- Multi-Scenario Attributes
- Batch Attributes
- Attribute Examples