Gurobi variable object. Variables are always associated with a particular model. You create a variable object by adding a variable to a model (using GRBModel.addVar), rather than by using a GRBVar constructor.

The methods on variable objects are used to get and set variable attributes. For example, solution information can be queried by calling get(GRB.DoubleAttr.X). Note, however, that it is generally more efficient to query attributes for a set of variables at once. This is done using the attribute query method on the GRBModel object (GRBModel.get).