Skip to main content

setObjective() not updating when called on GRBModel object

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff
    This post is more than two 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.
  • Jaromił Najman
    • Gurobi Staff

    You have to call the update method first before querying any model objects.

    obj = mod.setObjective(x+y, GRB.MAXIMIZE)
    mod.update()
    print(mod.getObjective())

    This is due to the lazy update mechanism.

    0
  • Sam Garvin
    • Gurobi-versary
    • Conversationalist
    • First Question

    Thank you for your prompt response!

    0

Post is closed for comments.