Skip to main content

Extract gurobi 3-dimensional variable value to a ndarray?

Answered

Comments

2 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.
  • Mario Ruthmair
    • Gurobi Staff

    Hi Scott,

    The easiest way to get the solution values and access them in the same way as the variables is via:

    values = model.getAttr("X", self.model.getVars())

    The method returns a dictionary with the same keys as the variables. This should also be much faster than using getVarByName() for each variable.

    Best regards,
    Mario

    0

Post is closed for comments.