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

unsupported operand type(s) for >>: 'bool' and 'TempConstr'

回答済み

コメント

2件のコメント

  • 正式なコメント
    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.
  • Matthias Miltenberger
    • Gurobi Staff

    The code works fine. You must have done something wrong with defining the variables. Here is a minimal working snippet that uses exactly your formulation, except for a correct way to define the x variables:

    import gurobipy as gp
    from gurobipy import GRB

    model = gp.Model()
    x = model.addVars(1, 1, 9, vtype=GRB.BINARY, name="dx")
    dx = model.addVars(9, vtype=GRB.BINARY, name="dx")
    i = 0
    j = 0
    model.addConstrs((dx[k + 1] == 1) >> (x[i, j, k + 1] >= 1) for k in range(4))
    0

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