Most of the information associated with a Gurobi model is stored in a set of attributes. Attributes can be associated with:
- The Gurobi model
- Linear constraints
- Quadratic constraints
- General constraints
- SOS constraints
- After optimizing a model, the Runtime model attribute stores the amount of time (in seconds) Gurobi spent solving the model
- After optimizing a model, the X variable attribute stores a variable's solution value
- The LB and UB variable attributes store a variable's lower and upper bounds, respectively
- The ConstrName linear constraint attribute stores the name of a linear constraint
Attributes computed by the Gurobi optimizer (such as X and Runtime) cannot be modified directly by the user. Attributes representing input data (such as LB, UB, and ConstrName), can be modified directly by the user.
Querying and modifying attributes
Each of the Gurobi language interfaces contains routines for querying or modifying attribute values. To retrieve or modify the value of a particular attribute, you simply pass the name of the attribute to the appropriate query or modification routine.
For examples of how to access attributes, see:
- The Attribute Examples section of the documentation:
- How do I retrieve variable values after optimizing?
- Gurobi's Functional Code Examples