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 associated 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