Skip to main content

Copy a class of model

Answered

Comments

1 comment

  • Riley Clement
    • Gurobi Staff

    Hi Farzane,

    Creating a (deep) copy of your model should be done with Model.copy().

    Note however the object is just the model, it does not include the branch and bound tree (which exists inside the Gurobi Optimizer and not Python), solutions or anything related to prior optimizations and so optimization on the new model would start from scratch:

    m = gp.read("mymodel.mps")
    m.optimize()
    print(m.Status) # prints 2 (= OPTIMAL)
    m2 = m.copy()
    print(m2.Status) # prints 1 (= LOADED)

    - Riley

    0

Please sign in to leave a comment.