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

Copy a class of model

回答済み

コメント

1件のコメント

  • 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

サインインしてコメントを残してください。