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

set an initial value for a variable in Gurobi

回答済み

コメント

3件のコメント

  • 正式なコメント
    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.
  • 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

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