Skip to main content

about gurobi constraint name

Awaiting user input

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.
  • Eli Towle
    • Gurobi Staff

    Which version of Gurobi are you using? If \(\texttt{p_select}\) are your variables, how exactly do you define them?

    I wonder if you are defining the variables as two-dimensional MVar objects:

    p_select = m_dis.addMVar((5, 1), name="p_select")

    If that's the case, your call to Model.addConstr() adds an array of constraints (of length 1), and Gurobi adds indices to the names of each constraint. Instead, try defining the variables as one-dimensional MVar objects:

    p_select = m_dis.addMVar((5,), name="p_select")

    Also, including spaces in variable/constraint names is not recommended, as such names cannot be written to an LP file.

    0

Post is closed for comments.