Skip to main content

Using gurobi optimize variable

Answered

Comments

1 comment

  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    Your example is not reproducible. But I think the issue is that you need to define PN as Gurobi variables as well if you want to change the values.

    This is not possible:

    A= m.addVar(vtype='B')
    B= 3
    m.addConstr((A==1) >> (B==2))

    and will produce the error

     TypeError: unsupported operand type(s) for -=: 'NoneType' and 'float'

    B needs to be defined as a variable as well

    A= m.addVar(vtype='B')
    B= m.addVar(vtype='I')
    m.addConstr((A==1) >> (B==2))
    0

Please sign in to leave a comment.