Skip to main content

Help: GurobiError: Unrecognized argument to getAttr

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Simon Bowly
    • Gurobi Staff

    Hi Abhishek,

    The Model.getAttr function expects a list or dictionary of gurobipy modelling objects as its second object, you cannot pass a single variable object. The following will return a list of the solution values for X1 -> X4, in order:

    m.getAttr('X', [X1, X2, X3, X4])

    Alternatively, you can access the solution values one by one using the 'X' attribute of the variables themselves:

    X1out = X1.X
    X2out = X2.X
    ...
    0
  • Abhishek Solomon
    • Gurobi-versary
    • Curious
    • Conversationalist

    Thank you Simon!

    0

Post is closed for comments.