Hi, I am trying to insert user cuts in a mixed-integer linear programming model (Location-routing problem).
I’m using the sintax presented in JuMP documentation (Callbacks · JuMP), and model in direct mode (model1 = direct_model(Gurobi.Optimizer()).
The model is running and it seems that callback is working, but when analyzing the output I noticed that the added constraints are not being applied effectively.
Example: I add a constraint to avoid subtour. The output shows a solution with a subtour that should be cutted off in the first iteration remaining the same in many iterations.
How to make cut effective in the model?
You need to use a lazy constraint, not a user cut.
See here for a TSP tutorial with subtour elimination: Traveling Salesperson Problem · JuMP
(In more detail, a user cut can only refine a fractional solution, it cannot remove integer feasible points. See the explanation and warning here: Solver-independent Callbacks · JuMP)