Skip to main content

set an initial value for a variable in Gurobi

Answered

Comments

2 comments

  • Rahul Kowshik
    Gurobi-versary
    Collaborator
    First Question

    Hej,

    By default the lower bound and upper bound for the variables is 0 and + infinity that is set by gurobi unless you specify otherwise. I think its the reason that when you optimize and check again it takes the lowest value which in your case would be 0 same as the lower bound.

    If you use this, then it will take values in negative as well

    m.addVar(var, lb=-gp.GRB-INFINITY, vtype=___)

    or

    m.addVar(var, lb=-10000, vtype=___)
    3
  • Bin Du
    Gurobi-versary
    First Question
    First Comment

    Thanks!!! I checked my code and indeed found the issue. Thank you very much for your help!

    2

Please sign in to leave a comment.