Try our new documentation site (beta).
Model.getAttr()
getAttr ( attrname, objs=None )
Query the value of an attribute. When called with a single argument, it returns the value of a model attribute. When called with two arguments, it returns the value of an attribute for either a list or a dictionary containing either variables or constraints. If called with a list, the result is a list. If called with a dictionary, the result is a dictionary that uses the same keys, but is populated with the requested attribute values. The full list of available attributes can be found in the Attributes section.
Raises an AttributeError
if the requested attribute doesn't
exist or can't be queried.
Arguments:
attrname: Name of the attribute.
objs (optional): List or dictionary containing either constraints or variables
Example usage:
print model.numintvars print model.getAttr("numIntVars") print model.getAttr(GRB.Attr.numIntVars) print model.getAttr("X", m.getVars()) print model.getAttr("Pi", m.getConstrs())