I am getting troubles using lazy constriants for solving a MILP (using Gurobi).
My code is structured as follows : (here are some parts of it)
# Extract from the code : using JuMP using Gurobi m = Model(solver=GurobiSolver(Threads=1)) [...] function correctConstraints(cb) # A function has been called and has returned 1 for the variable Err if the lazy constraints # have been violated in the solution retriaved from the model (zero otherwise). if Err==0 println("No error ! The optimal solution has een found !\n \n") return end if Err==1 println("Adding lazy constraints... \n \n") # Adding several constraints to the model for k in [...] @lazyconstraint(cb,***lazy constraint***) end end return end # Model : [...] solve(m), addlazycallback(m, correctConstraints) # end of the code section.
When the line “No error ! The optimal solution has een found !” is displayed, I would expect that the
code stops running. However, it appears to loop serveral times, even if I do not remove from my model the constraints that I’d like to add lazily.
It seems that this problem does not come from parallelism.
Thank you already for your help !