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.
AttributeError if the requested attribute doesn't
exist or can't be queried.
attrname: Name of the attribute.
objs (optional): List or dictionary containing either constraints or variables
print(model.numintvars) print(model.getAttr("numIntVars")) print(model.getAttr(GRB.Attr.NumIntVars)) print(model.getAttr("X", model.getVars())) print(model.getAttr("Pi", model.getConstrs()))