# Attributes

Filter Content By
Version
Languages

## 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
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
JobID For Compute Server, ID of current job
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
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 participate in the IIS
IISUB Indicates whether the upper bound participate 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
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

These attributes provide information that is associated with specific quadratic constraints.

Attribute name Description
QCSense Constraint sense ('<', '>', or '=')
QCRHS Right-hand side
QCPi Dual value
QCSlack Slack in the current solution
IISQConstr Indicates whether the quadratic constraint participates in the IIS

General constraint attributes:

These attributes provide information that is associated with specific general constraints.

Attribute name Description
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

Subsections