Skip to main content

Branch and Bound algorithm

Answered

Comments

2 comments

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

Please sign in to leave a comment.