4
$\begingroup$

I am using the incumbent callback CPXsetincumbentcallbackfunc to identify integral solutions that do not satisfy nonlinear constraints that are not explicitly part of the constraint set. When such a solution is found, I declare the solution to be infeasible by setting:

*isfeas_p = 0;
*useraction_p = CPX_CALLBACK_SET;

My question is if I have a heuristic to convert the infeasible solution into a feasible one, could I modify the values in the provided x[] array of the callback accordingly and set *isfeas_p = 1? Would that make CPLEX use the incumbent that I constructed?

$\endgroup$
2
$\begingroup$

Disclaimer: I do not use the C API. That said, I am rather confident that there is no way to set a heuristic solution inside the incumbent callback. What you can do is identify the feasible solution inside the incumbent callback and queue it up somewhere in your program memory. Add a heuristic callback, and in the heuristic callback check to see if there is a solution queued and, if so, whether it is better in objective terms than the current incumbent (which might have improved between the last call to the incumbent callback and the current call to the heuristic callback). If you do have a superior solution queued up, add it in the heuristic callback (and delete it from the queue).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.