Skip to main content

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

Answered

Comments

1 comment

  • Matthias Miltenberger
    • Gurobi Staff 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

Please sign in to leave a comment.