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

Using gurobi optimize variable

回答済み

コメント

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.
  • 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

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