Get branch-and-bound node depth with JuMP

CPXcallbackgetinfolong(cb_data, CPXCALLBACKINFO_NODEDEPTH, depth)

You need to check the return code to see if the call succeeded. I’m guessing it didn’t. Probably because there was no node and the problem was solved at the root node via heuristics?

More generally, you need to read the CPLEX documentation in more detail: IBM Documentation

You say you only want to add cuts at the root, but CPX_CALLBACKCONTEXT_CANDIDATE indicates that you have a valid integer solution. Perhaps you want CPXCALLBACKINFO_NODECOUNT or CPXCALLBACKINFO_NODEUID? instead?

1 Like