I am working on a problem where I use MIP's to find the optimal solution. Given the data by the user, I construct the constraints and optimize the mathematical program, while adding lazy constraints in the callback whenever they are violated. This way I can find optimal solutions to my problem.
My problem is, sometimes I need to re-optimize the mathematical program, after adding new variables and change the objective function. To test this approach, I simply re-set the objective to its current value (in my case that is the sum of a set of variables) and ran the optimization process again. I was expecting the same (or an even better) solution, but I got a worse one that doesn't satisfy the lazy constraints. My guess is that, since the previous solution was optimal, Gurobi found a new solution with the same objective value and simply returned it as optimal.
First of all, does Gurobi forget the lazy constraints it used, right after the optimization ? If that's the case, is there a way to add these constraints to the model permanently, so that the subsequent optimization procedures can make use of them ? Finally, is there a way to apply lazy constraints after an optimal solution is found ? Right now I am adding them in the MIPNODE callback.
Hope that made sense. Thank you in advance,
Please sign in to leave a comment.