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 associated modeling object. Attributes associated with the model take scalar values. So do attributes associated with solution quality, objectives in multi-objective models, scenarios in multi-scenario models, and batches. Attributes associated with variables, linear constraints, SOS constraints, quadratic constraints, and general constraints 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
Fingerprint Model fingerprint
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
Work Work spent on 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
OpenNodeCount Number of open branch-and-cut nodes at the end of most recent optimization
ConcurrentWinMethod Winning method of most recent concurrent optimization of continuous model
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

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
IISLBForce Forces variable lower bound into (1) or out of (0) the computed IIS
IISUBForce Forces variable upper bound into (1) or out of (0) the computed IIS
PoolIgnore Flag variables to ignore when checking whether two solutions are identical
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
IISConstrForce Forces constraint into (1) or out of (0) the computed 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
IISSOSForce Forces the SOS constraint into (1) or out of (0) the computed 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
IISQConstrForce Forces the quadratic constraint into (1) or out of (0) the computed 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
FuncNonlinear Chooses the approximation approach used to handle a function constraint
GenConstrType Type of general constraint
GenConstrName General constraint name
IISGenConstr Indicates whether the general constraint participates in the IIS
IISGenConstrForce Forces the general constraint into (1) or out of (0) the computed IIS

Solution quality attributes:

Attribute name Description
MaxVio Maximum (unscaled) violation
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

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization