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

Branch and Bound algorithm

回答済み

コメント

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.
  • David Torres Sanchez
    • Gurobi Staff

    Hi Chiara,

    The best way to do this is to simply keep your variables in memory.

    model = gp.Model()
    x = model.addVars(N)

    def update_values(N, x): values = [] for i in range(N): value = x[i].X values.append(value)
    # also values = [x[i].X for i in range(N)] return values

    This will give you easy access to the solution values without having to call \(\texttt{model.getVarByName}\).

    Cheers, 
    David

    0
  • Chiara
    • Gurobi-versary
    • First Comment
    • First Question

    Thanks a lot David :) 

    This is the perfect way to solve my problem. 

    Have a nice day!

    0

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