メインコンテンツへスキップ

about gurobi constraint name

ユーザーの入力を待っています。

コメント

1件のコメント

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

サインインしてコメントを残してください。