setcallback


Purpose
Set optimizer callback functions and procedures.
Synopsis
procedure setcallback(cbtype:integer, cb:string)
Arguments
cbtype 
Type of the callback:
XPRS_CB_LPLOG 
Simplex log callback
XPRS_CB_CUTLOG 
Cut log callback
XPRS_CB_GLOBALLOG 
Global log callback
XPRS_CB_BARLOG 
Barrier log callback
XPRS_CB_CHGNODE 
User select node callback
XPRS_CB_PRENODE 
User preprocess node callback
XPRS_CB_OPTNODE 
User optimal node callback
XPRS_CB_INFNODE 
User infeasible node callback
XPRS_CB_INTSOL 
User integer solution callback
XPRS_CB_NODECUTOFF 
User cut-off node callback
XPRS_CB_NEWNODE 
New node callback
XPRS_CB_BARITER 
Barrier iteration callback
XPRS_CB_CUTMGR 
Cut manager (branch-and-bound node) callback
XPRS_CB_CHGBRANCH 
User choose branching variable callback
XPRS_CB_PREINTSOL 
Integer solution callback called before acceptation
XPRS_CB_GAPNOTIFY 
Gap notify callback
XPRS_CB_SOLNOTIFY 
Integer notify callback called each time a solution added with addmipsol is processed
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:boolean 
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(parent:integer,new:integer,branch:integer) 
XPRS_CB_NEWNODE
function cb:integer 
XPRS_CB_BARITER
function cb:boolean 
XPRS_CB_CUTMGR
procedure cb(e:integer,u:integer,d:real) 
XPRS_CB_CHGBRANCH
procedure cb(isheur:boolean,cutoff:real) 
XPRS_CB_PREINTSOL
procedure cb(rt:real,at:real,aot:real,abt:real) 
XPRS_CB_GAPNOTIFY
procedure cb(solid:string,status:integer) 
XPRS_CB_SOLNOTIFY
Example
The 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 information
1. This procedure sets the optimizer callback functions and procedures. For a detailed description of these callbacks the user is referred to the Xpress-Optimizer Reference Manual.
2. Passing an empty string ("") as the function name disables the corresponding callback.
3. 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.
4. The function setucbdata can be used to return information to the optimizer from the callback `CHGBRANCH'.
5. The functions rejectintsol and setcbcutoff can be used to return information to the optimizer from the callback `PREINTSOL'.
6. The function setgndata can be used to return information to the optimizer from the callback `GAPNOTIFY'.
7. When the mmxnlp model is used, this function can also be used to set the callbacks relevant to non-linear problems only. Please see the documentation of the mmxnlp module for the list of extra callbacks.
Module
mmxprs


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

© Copyright 2001-2013 Fair Isaac Corporation. All rights reserved.