Skip to main content

Using gurobi optimize variable

Answered

Comments

2 comments

  • Official comment
    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.
  • Marika Karbstein
    • 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

Post is closed for comments.