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

Slow constraints addition in Python vs. C++

回答済み

コメント

2件のコメント

  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    Hi Timothy,

    It looks like you are mixing matrix-friendly and term-based modeling in Python.
    Did you try to use Model.addVars() instead of Model.addMVar() ?

    Best regards,
    Marika

    0
  • Timothy Baeckelant
    First Comment
    First Question

    Hello Marika, thanks for this answer!

    I first wrote a "matrix-based modeling" but the time to build the model was even worse, so I tried like this. However, just using Model.addVars() makes the generation 50 times faster, thank you!

    0

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