Originally posted by: AnahitaHz
Hi!
I would like to attach some user_info to children of a node upon branching on it. I know this has been discussed in this link, yet it is not working for me. In the branch callback, I create a struct to hold the user_info (to simplify, say the objective of the parent node). I want to accept the vars, bounds, etc as CPLEX suggests but change the user info. Here is what I do:
/* Create a struct to store objective */
struct branchinfo{
double obj;
};
struct branchinfo *branch_info = malloc(sizeof(*branch_info));
/* Register the parent objective to the children */
branch_info->obj = objval;
printf("obj to tag children = %f \n", branch_info->obj);
status = CPXbranchcallbackbranchasCPLEX (env, cbdata, wherefrom, 0, branch_info, &seqnum1);
if (status) printf("failed to create left node\n");
status = CPXbranchcallbackbranchasCPLEX (env, cbdata, wherefrom, 1, branch_info, &seqnum2);
if (status) printf("failed to create right node\n");
if ( status ) goto TERMINATE;
*useraction_p = CPX_CALLBACK_SET;
What happens with this piece of code is that CPLEX keeps creating left nodes until it a node has to be fathomed and a backtracking is needed to the parent node to create (or select?) the right child of the parent. At this point it says:
CPLEX Error 1200: Index is outside range of valid values.
failed to create left node
CPLEX Error 1200: Index is outside range of valid values.
failed to create right node
Not sure what is going wrong. Thank you!
#CPLEXOptimizers#DecisionOptimization