Model.printAttr()

printAttr ( attrs, filter='*' )

Print the value of one or more attributes. If attrs is a constraint or variable attribute, print all non-zero values of the attribute, along with the associate constraint or variable names. If attrs is a list of attributes, print attribute values for all listed attributes. The method takes an optional filter argument, which allows you to select which specific attribute values to print (by filtering on the constraint or variable name).

See the Attributes section for a list of all available attributes.

Arguments:

attrs: Name of attribute or attributes to print. The value can be a single attribute or a list of attributes. If a list is given, all listed attributes must be of the same type (model, variable, or constraint).

filter (optional): Filter for values to print -- name of constr/var must match filter to be printed.

Example usage:

  model.printAttr('x')          # all non-zero solution values
  model.printAttr('lb', 'x*')   # bounds for vars whose names begin with 'x'
  model.printAttr(['lb', 'ub']) # lower and upper bounds

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