XPRSsetcbintsol


Purpose
Declares a user integer solution callback function, called every time an integer solution is found by heuristics or during the Branch and Bound search.
Synopsis
int XPRS_CC XPRSsetcbintsol(XPRSprob prob, void (XPRS_CC *fuis)(XPRSprob my_prob, void *my_object), void *object);
Arguments
prob 
The current problem.
fuis 
The callback function which takes two arguments, my_prob and my_object, and has no return value. This function is called if the current node is found to have an integer feasible solution, i.e. every time an integer feasible solution is found.
my_prob 
The problem passed to the callback function, fuis.
my_object 
The user-defined object passed as object when setting up the callback with XPRSsetcbintsol.
object 
A user-defined object to be passed to the callback function, fuis.
Example
The following example prints integer solutions as they are discovered in the global search, without using the solution file:
XPRSsetcbintsol(prob,printsol,NULL);
XPRSmaxim(prob,"g");
The callback function might resemble:
void XPRS_CC printsol(XPRSprob my_prob, void *my_object)
{
  int i, cols, *x;
  double objval;

  XPRSgetintattrib(my_prob, XPRS_COLS, &cols);
  XPRSgetdblattrib(my_prob, XPRS_LPOBJVAL, &objval);
  x = malloc(cols * sizeof(int));
  XPRSgetlpsol(my_prob, x, NULL, NULL, NULL);

  printf("\nInteger solution found: %f\n", objval);
  for(i=0;i<cols;i++) printf(" x[%d] = %d\n", i, x[i]);
}
Further information
This callback is useful if the user wants to retrieve the integer solution when it is found.
Related topics
XPRSsetcbchgnode, XPRSsetcboptnode, XPRSsetcbinfnode, XPRSsetcbnodecutoff, XPRSsetcbchgbranch, XPRSsetcbprenode.


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.