Purpose
Declares an optimal
node
callback function, called after an optimal solution for the current node has been found during the
Branch and Bound search.
Synopsis
int XPRS_CC XPRSsetcboptnode(XPRSprob prob, void (XPRS_CC *fuon)(XPRSprob my_prob, void *my_object, int
*feas), void *object);
Arguments
prob
|
The current problem.
|
fuon
|
The callback function which takes three arguments, my_prob, my_object and feas, and has no return value.
|
my_prob
|
The problem passed to the callback function, fuon.
|
my_object
|
The user-defined object passed as object when setting up the callback with XPRSsetcboptnode.
|
feas
|
The feasibility status. If set to a nonzero value by the user, the current node will be declared infeasible.
|
object
|
A user-defined object to be passed to the callback function, fuon.
|
Example
The following prints an optimal solution once found:
XPRSsetcboptnode(prob,nodeOptimal,NULL);
XPRSmaxim(prob,"g");
The callback function might resemble:
void XPRS_CC nodeOptimal(XPRSprob prob, void *obj, int *feas)
{
int node;
double objval;
XPRSgetintattrib(prob, XPRS_NODES, &node);
printf("NodeOptimal: node number %d\n", node);
XPRSgetdblattrib(prob, XPRS_LPOBJVAL, &objval);
printf("\tObjective function value = %f\n", objval);
}
See the example depthfirst.c on the Xpress‑MP CD-ROM.
Further information
The cost of optimizing the node will be avoided if the node is declared to be
infeasible from this callback function.
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.