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
Number of variables
Number of linear constraints
Number of SOS constraints
Number of quadratic constraints
Number of general constraints
Number of non-zero coefficients in the constraint matrix
Number of non-zero coefficients in the constraint matrix (in double format)
Number of non-zero quadratic objective terms
Number of non-zero terms in quadratic constraints
Number of integer variables
Number of binary variables
Number of variables with piecewise-linear objective functions
Model name
Model sense (minimization or maximization)
Constant offset for objective function
Model fingerprint
Objective value for current solution
Best available objective bound (lower bound for minimization, upper bound for maximization)
Best available objective bound, without rounding (lower bound for minimization, upper bound for maximization)
Bound on best objective for solutions not in pool (lower bound for minimization, upper bound for maximization)
Objective value of alternatives solutions stored during the optimization process
Current relative MIP optimality gap
Runtime for most recent optimization
Work spent on most recent optimization
Current optimization status
Number of stored solutions
Number of simplex iterations performed in most recent optimization
Number of barrier iterations performed in most recent optimization
Number of branch-and-cut nodes explored in most recent optimization
Number of open branch-and-cut nodes at the end of most recent optimization
Winning method of most recent concurrent optimization of continuous model
Indicates whether the model is a MIP
Indicates whether the model is a QP/MIQP
Indicates whether the model is a QCP/MIQCP
Indicates whether the model has multiple objectives
Indicates whether the current IIS is minimal
Maximum constraint matrix coefficient (in absolute value)
Minimum (non-zero) constraint matrix coefficient (in absolute value)
Maximum finite variable bound
Minimum finite variable bound
Maximum linear objective coefficient (in absolute value)
Minimum (non-zero) linear objective coefficient (in absolute value)
Maximum constraint right-hand side (in absolute value)
Minimum (non-zero) constraint right-hand side (in absolute value)
Maximum quadratic constraint matrix coefficient of quadratic part (in absolute value)
Minimum (non-zero) quadratic constraint matrix coefficient of quadratic part (in absolute value)
Maximum quadratic constraint matrix coefficient in linear part (in absolute value)
Minimum (non-zero) quadratic constraint matrix coefficient in linear part (in absolute value)
Maximum quadratic constraint right-hand side (in absolute value)
Minimum (non-zero) quadratic constraint right-hand side (in absolute value)
Maximum quadratic objective coefficient (in absolute value)
Minimum (non-zero) quadratic objective coefficient (in absolute value)
Estimated basis condition number
Exact basis condition number
Magnitude of infeasibility violation in Farkas infeasibility proof
Number of improved parameter sets found by tuning tool
Number of MIP starts
For Compute Server, name of server

Variable attributes:

These attributes provide information that is associated with specific variables.

Attribute name Description
Lower bound
Upper bound
Linear objective coefficient
Variable type (continuous, binary, integer, etc.)
Variable name
Variable tag
Value in the current solution
Value in a sub-optimal MIP solution
Reduced cost
Value in the best barrier iterate (before crossover)
MIP start value (for constructing an initial MIP solution)
MIP hint value
MIP hint priority
Branching priority
Variable partition
Basis status
Simplex start vector
Indicates whether the lower bound participates in the IIS
Indicates whether the upper bound participates in the IIS
Forces variable lower bound into (1) or out of (0) the computed IIS
Forces variable upper bound into (1) or out of (0) the computed IIS
Flag variables to ignore when checking whether two solutions are identical
Indicates whether the variable has a convex piecewise-linear objective
Objective coefficient sensitivity information
Objective coefficient sensitivity information
Lower bound sensitivity information
Lower bound sensitivity information
Upper bound sensitivity information
Upper bound sensitivity information
Unbounded ray

Linear constraint attributes:

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

Attribute name Description
Constraint sense ('<', '>', or '=')
Right-hand side value
Constraint name
Constraint tag
Dual value (also known as the shadow price)
Slack in the current solution
Basis status
Simplex start vector
Determines whether a constraint is treated as a lazy constraint
Indicates whether the constraint participates in the IIS
Forces constraint into (1) or out of (0) the computed IIS
Right-hand side sensitivity information
Right-hand side sensitivity information
Farkas infeasibility proof

SOS attributes:

These attributes provide information that is associated with specific Special-Ordered Set (SOS) constraints.

Attribute name Description
Indicates whether the SOS constraint participates in the IIS
Forces the SOS constraint into (1) or out of (0) the computed IIS

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

Attribute name Description
Constraint sense ('<', '>', or '=')
Right-hand side
Dual value
Slack in the current solution
Indicates whether the quadratic constraint participates in the IIS
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
Error allowed for PWL translation
Piece length for PWL translation
Controls whether to under- or over-estimate function values in PWL approximation
Sets strategy for PWL function approximation
Type of general constraint
General constraint name
Indicates whether the general constraint participates in the IIS
Forces the general constraint into (1) or out of (0) the computed IIS

Solution quality attributes:

Attribute name Description
Maximum (unscaled) violation
Maximum (unscaled) bound violation
Maximum (scaled) bound violation
Index of variable with the largest (unscaled) bound violation
Index of variable with the largest (scaled) bound violation
Sum of (unscaled) bound violations
Sum of (scaled) bound violations
Maximum (unscaled) constraint violation
Maximum (scaled) constraint violation
Index of constraint with the largest (unscaled) violation
Index of constraint with the largest (scaled) violation
Sum of (unscaled) constraint violations
Sum of (scaled) constraint violations
Maximum (unscaled) primal constraint error
Maximum (scaled) primal constraint error
Index of constraint with the largest (unscaled) primal constraint error
Index of constraint with the largest (scaled) primal constraint error
Sum of (unscaled) primal constraint errors
Sum of (scaled) primal constraint errors
Maximum (unscaled) reduced cost violation
Maximum (scaled) reduced cost violation
Index of variable with the largest (unscaled) reduced cost violation
Index of variable with the largest (scaled) reduced cost violation
Sum of (unscaled) reduced cost violations
Sum of (scaled) reduced cost violations
Maximum (unscaled) dual constraint error
Maximum (scaled) dual constraint error
Index of variable with the largest (unscaled) dual constraint error
Index of variable with the largest (scaled) dual constraint error
Sum of (unscaled) dual constraint errors
Sum of (scaled) dual constraint errors
Maximum complementarity violation
Index of variable with the largest complementarity violation
Sum of complementarity violations
Maximum integrality violation
Index of variable with the largest integrality violation
Sum of integrality violations

Multi-objective attributes:

Attribute name Description
Objectives of multi-objectives
Constant terms of multi-objectives
Priorities of multi-objectives
Weights of multi-objectives
Relative tolerances of multi-objectives
Absolute tolerances of multi-objectives
Objective value of multi-objectives solutions
Names of multi-objectives
Number of multi-objectives

Multi-scenario attributes:

Attribute name Description
Lower bound changes of current scenario in multi-scenario model
Upper bound changes of current scenario in multi-scenario model
Objective coefficient changes of current scenario in multi-scenario model
Right-hand side changes of current scenario in multi-scenario model
Name of current scenario in multi-scenario model
Objective bound of current scenario in multi-scenario model
Objective value for current solution of current scenario in multi-scenario model
Value in the current solution of current scenario in multi-scenario model
Number of scenarios

Batch attributes:

Attribute name Description
Last error code received from the Cluster Manager
Last error message received from the Cluster Manager
ID of the remote batch
Status of the batch

Subsections