Overhead of adding lazy constraints via callback in Python
回答済みDear all,
I am adding cuts to a MILP via lazy constraints with
model.cbLazy()
in a callback routine at
where == GRB.Callback.MIPSOL
I am looking at the time it takes to add the lazy constraints via the callback to identify levers for reducing runtime. I see that about 80% of the time in the callback is spent on adding the lazy constraint by calling
model.cbLazy()
, which equates to up to 10 seconds in some instances.
Is there information available on the overhead (in terms of runtime) of adding lazy constraints?
Thank you!
-
Hi Mike,
Could you please share a minimal reproducible example? Or at least one such hard coded lazy constraint which takes a long time to be added to the model? In particular, it is of interest how dense and numerically stable is your lazy constraint.
Best regards,
Jaromił0 -
Hi Jaromił,
thank you for the answer. Can I send the example to you somehow? Even the reduced version is a bit large to post it here.
Thank you!
Mike
0 -
The issue has been resolved internally. The problem was an inefficient usage of Python data structures. The Knowledge Base article How do I improve the time to build my model? holds many useful tips.
0
サインインしてコメントを残してください。
コメント
3件のコメント