See here for a much better version of this code by @lyeskhalil
-
Callback function is in
Callback.cpp
-
To use the callback function, add it to the CPLEX env before calling CPXmipopt:
status = CPXsetusercutcallbackfunc(mainEnv, cutCallbackShareRootCuts, this); DBG_IF_RETURN(status, 1, "Error setting cut callback");
Thanks a lot yo you for sharing your version, Elias. It's a huge improvement!
Just a heads up, my name is Rodolfo :) I don't want to be confused with my nemesis: Rodrigo Carvajal.