setcallback
| setcallback | 
  Purpose
 
  
  Synopsis
 
 procedure setcallback(cbtype:integer, cb:string)
 
  Arguments
 
 | 
     cbtype 
     | 
     Type of the callback:
     
 | ||||||||||||||||||||||||||||||||||
| 
     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:
     
 | 
  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:
 
 public 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. The arguments of the Mosel subroutines implementing callback functions correspond to the arguments documented in the
 Xpress Optimizer Reference Manual, with the exception of arguments that are used for passing back information to the solver: these are replaced by the subroutine return values. For the logging callbacks, the return value
 true interrupts the solving. For the
 PRENODE and
 OPTNODE callbacks the return value
 true declares the current node to be infeasible. The return value of the
 BARITER callback is the selected barrier action (see
 XPRSaddcbbariteraction in the
 Xpress Optimizer Reference Manual for details). The cut manager routine is called repeatedly at each node until it returns
 false.
 
 
 4. 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.
 
 
 5. The function
 setucbdata can be used to return information to the optimizer from the callback `CHGBRANCH'.
 
 
 6. The functions
 rejectintsol and
 setcbcutoff can be used to return information to the optimizer from the callback `PREINTSOL'.
 
 
 7. The function
 setgndata can be used to return information to the optimizer from the callback `GAPNOTIFY'.
 
 
 8. 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
 
  
