Originally posted by: SystemAdmin
Let's call the proposed incumbent solution to A that you intercept X, the modified version X', and the incumbent (if any) in effect at the time that X is discovered Y. If X' is worse than X but better than Y, you can use the reject() method in an incumbent callback to reject X and the setSolution method in a heuristic callback to insert X'. (If X' is worse than Y, CPLEX will ignore it, so no value to trying to insert it.) If the integer variables are all binary, you could replace the incumbent callback with a lazy constraint callback that adds a cut requiring at least one binary variable to be different from its value in X (which would effectively reject it). Rejection via cut is not very practical if X contains general integer variables.
The virtue of the lazy constraint approach, if all integer variables are binary, is that you avoid the need for a third callback. If you use the incumbent callback to reject X, I think you may also need a branch callback to tell CPLEX what to do in the event that X was the solution to the node LP relaxation.
Paul
Mathematicians are like Frenchmen: whenever you say something to them, they translate it into their own language, and at once it is something entirely different. (Goethe)
#CPLEXOptimizers#DecisionOptimization