Skip to main content

confusion about adding MVar.fromlist()

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.
  • Riley Clement
    • Gurobi Staff

    Hi Thomas,

    Our example is incomplete in the sense that it doesn't show the imports.  It's working on the assumption that the following import exists:

    from gurobipy import *

    You can make it work in your example like this:

    x_1d = gp.MVar.fromlist([x0, x1, x2, x3])  # 1-D MVar
    x_2d = gp.MVar.fromlist([[x0, x1], [x2, x3]])  # 2-D MVar

    - Riley

    0
  • Thomas Leveringhaus
    • Gurobi-versary
    • Collaborator
    • Investigator

    Thanks, that works :-)

    0

Post is closed for comments.