Kuifje02 / vrpy

A python framework for solving the VRP and its variants with column generation.
MIT License
173 stars 42 forks source link

Why I use gurobi is slower than not use it? #137

Closed river7816 closed 1 year ago

river7816 commented 1 year ago

System: Windows 11 Pro 21H2 Core: i7 12700H Python:3.9 Gurobi:9.5.2 When I write prob.solve(cspy=False,solver='gurobi'), it stuck at the iteration 0, however, when I use prob.solve(), it can iterate for several times. I thought it would be faster when I use gurobi. You can see in the picture, when I use gurobi, my cpu is working but not iterating. image here is my code and data VRP.zip

Kuifje02 commented 1 year ago

With cspy=True, you are solving part of the problem with cspy (dynamic programming), and part of the problem with linear programming. With cspy=False, you are solving everything with linear programming, which is typically slower. What you want is probably cspy=True and solver='gurobi'. This way, you are solving part of the problem with cspy, and part of the problem with linear programming with gurobi.

So in summary, try prob.solve(cspy=True,solver='gurobi').