I am solving a TSP with an academic Gurobi licence and and I pretty much used the following code for my solution.(from gurobi itself) https://gurobi.github.io/modeling-examples/traveling_salesman/tsp.html About 25 minutes after I start running I get the following error:
File "...", line 109, in <module>
m.optimize(subtourelim)
File "src\gurobipy\model.pxi", line 864, in gurobipy.Model.optimize
gurobipy.GurobiError
That's the method subtourelim I implemented which maybe is the origin of the problem because it is the only input in m.optimize(subtourelim).
def subtourelim(model, where):
if where == GRB.Callback.MIPSOL:
# make a list of edges selected in the solution
vals = model.cbGetSolution(model._vars)
selected = gp.tuplelist((i, j) for i, j in model._vars.keys()
if vals[i, j] > 0.5)
# find the shortest cycle in the selected edge list
tour = subtour(selected)
if len(tour) < len(Kundenliste):
# add subtour elimination constr. for every pair of cities in subtour
model.cbLazy(gp.quicksum(model._vars[i, j] for i, j in combinations(tour, 2))
<= len(tour)-1)
But I am wondering because I just copied the code example (from the link above). Others who have an gurobipy.GurobiError have a more specific explanation of what exactly went wrong. (like "model too large for academic licence") What could be the reason for this error?