Originally posted by: AndreaTramontani
Hello,
I'm sorry but I don't think that what you have in mind would be correct.
If you change the problem (e.g., you fix one variable or more generally you add a constraint), then the tree search associated with the first run becomes invalid.
This is because by adding a constraint you are changing the set of feasible solutions, and potentially the set of optimal solutions.
Thus, any dual reduction that CPLEX might have decided to apply in the first run might become invalid.
And, even if you explicitly disabled dual reductions (this could be done with a parameter), the tree search would be invalid anyway.
Indeed, suppose that the set of feasible solutions in the first problem is S1, while the set of feasible solutions for the second problem is S2, that is a subset of S1.
Then, in the first run, CPLEX is allowed to prune nodes as it prefers, provided that at least one optimal solution in S1 is kept along the process.
This means that all optimal solutions of S2 could be pruned along the run, and thus, after modifying the problem, you need to restart the run from scratch.
What you could try to do is to retrieve the best feasible solution or, better, all the feasible solutions stored in the solution pool, and the end of the first run.
For this, you don't need to use any callback, but just the "regular" APIs to query the solution pool at the end of optimization.
Then, if any of these solutions remain feasible even after changing the problem, it can be used as mipstart for the second run, and hopefully it will speed up the solution process.
If the solutions you get from CPLEX, after the first run, become all infeasible because of the additional constraints, you can think of trying some heuristic, exploiting the knowledge you have about your problem, to "repair" them and find a solution feasible for the new problem.
Or you can just give those infeasible solutions to CPLEX as mipstarts. In that case, CPLEX will do some quick try to repair them, in order to find a feasible solution for the new run. Of course, CPLEX might fail to repair an infeasible solution provided from the user, and in this case it will just start without an incumbent (as in the first run).
#CPLEXOptimizers#DecisionOptimization