setcallback
PurposeSynopsisprocedure setcallback(cbtype:integer, cb:string)
Arguments
cbtype Type of the callback:
XPRS_CB_LPLOG XPRS_CB_CUTLOG XPRS_CB_GLOBALLOG XPRS_CB_BARLOG XPRS_CB_CHGNODE XPRS_CB_PRENODE XPRS_CB_OPTNODE XPRS_CB_INFNODE XPRS_CB_INTSOL XPRS_CB_NODECUTOFF XPRS_CB_INITCUTMGR XPRS_CB_FREECUTMGR XPRS_CB_CUTMGR XPRS_CB_CHGBRANCH cb Name of the callback function/procedure; the parameters and the type of the return value (if any) vary depending on the type of the callback:
function cb:boolean XPRS_CB_LPLOG function cb:boolean XPRS_CB_CUTLOG function cb:boolean XPRS_CB_GLOBALLOG function cb:boolean XPRS_CB_BARLOG function cb(node:integer):integer XPRS_CB_CHGNODE function cb(node:integer):integer XPRS_CB_PRENODE function cb:boolean XPRS_CB_OPTNODE procedure cb XPRS_CB_INFNODE procedure cb XPRS_CB_INTSOL procedure cb(node:integer) XPRS_CB_NODECUTOFF procedure cb XPRS_CB_INITCUTMGR procedure cb XPRS_CB_FREECUTMGR function cb:boolean XPRS_CB_CUTMGR procedure cb(e:integer,u:integer,d:real) XPRS_CB_CHGBRANCHExampleThe following example defines a procedure to handle solution printing and sets it to be called whenever an integer solution is found using the integer solution callback:procedure printsol declarations objval:real end-declarations objval:= getparam("XPRS_lpobjval") writeln("Solution value: ", objval) end-procedure setcallback(XPRS_CB_INTSOL, "printsol")Further informationThis procedure sets the optimizer callback functions and procedures. Passing an empty string ("") as the function name disables the corresponding callback. For a detailed description of these callbacks the user is referred to the Xpress-Optimizer Reference Manual. Note that whilst the solution values can be accessed from Mosel in any callback function/procedure, all other information such as the problem status or the value of the objective function must be obtained directly from the Optimizer using function getparam. Note further that the function setucbdata can be used to return information to the optimizer from the callback `CHGBRANCH'.
If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.