Han Zhu
Han Zhu

Reputation: 31

Will Ortools/gurobi runs faster if given more constraints?

Hi I'm trying to solve Operation problems with ortools or gurobi. I'm wondering if I provide some explicit constraints, like the variables should fall in [a,b], will that accelerate running speed or make it even more complicated than before?

Upvotes: 0

Views: 2206

Answers (2)

SimonT
SimonT

Reputation: 493

In mixed integer optimization it is often advisable to add additional constraints if they cut of linear solutions that do not fulfil the integrability constraints. These mixed-integer cuts are designed to bring the optimal linear solution closer to the optimal integer solution and can sometime yield significant speed-ups. Commercial solvers like gurobi will generate some of these cuts automatically.

Additionally commercial solvers will most likely ignore redundant constraints that you added if they don't help. So normally you don't loose any performance.

So usually it is a good idea to add these kinds of constraints.

Note that sometimes changing the problem will also change the branch and cut order. So it might happen that you were lucky before and got an integer solution fast and the new solutions needs longer due to other branching. So when solving MIPs you sometimes see counter-intuitive runtime behaviours.

Upvotes: 2

Laurent Perron
Laurent Perron

Reputation: 11064

Reduced domains will most likely help. Adding more constraints may help. It depends on their complexity and their number.

When you say or-tools, what do you refer to?

Upvotes: 0

Related Questions