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

Problems around general indicator constraints using MVar (& matrix multiplication operator)

回答済み

コメント

3件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three 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 why not try our AI Gurobot?.
  • Jaromił Najman
    • Gurobi Staff

    Hi Amir,

    Currently, MVar objects are not compatible with general constraints. You can use the tolist function and add the general constraints in a sequential fashion, e.g.,

    x = m.addMVar(3, vtype=GRB.BINARY)
    y = m.addMVar(3, vtype=GRB.BINARY)
    z = m.addMVar(3, vtype=GRB.BINARY)

    x_list = x.tolist()
    y_list = y.tolist()
    z_list = z.tolist()

    for i in range(3):
    m.addConstr((x_list[i] == 1) >> (y_list[i] + z_list[i] == 1))

    This behavior will very likely be improved in an upcoming release.

    Best regards,
    Jaromił

     

    0
  • amir b
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you so much for the guide.

    Sincerely,

    Amir

    0

投稿コメントは受け付けていません。