Download LINDO API USER MANUAL

Transcript
FUNCTION DEFINITIONS
303
LSsetCallback()
Description:
Supplies LINDO API with the address of the callback function that will be called at various
points throughout all components of LINDO API. The user supplied callback function can be
used to report the progress of the solver routines to a user interface, interrupt the solver, etc.
Returns:
0 if successful, else one of the error codes listed in Appendix A, Error Codes.
Prototype:
int
LSsetCallback( pLSmodel pModel, int (CALLBACKTYPE
*pcbFunc)( LSmodel*, int, void*), void *pvData)
Input Arguments:
Name
Description
pModel
A pointer to an instance of LSmodel.
pcbFunc
A pointer to the user supplied callback function.
pvData
A pointer to any data you wish to access within the callback
function. Of course, this can be a pointer to a structure,
allowing any amount of information to be passed.
Remarks:





To disable the callback function, call this routine with the callback function set to NULL.
To control the frequency of callbacks, use LSsetEnvDouParameter() to set parameter
LS_DPARAM_CALLBACKFREQ. This parameter is the number of seconds
(approximately) between callbacks.
If the value returned by the callback function is nonzero, the solver will interrupt and the
control of the application program will pass to the user.
Refer to the lindo.h file for CALLBACKTYPE macro definition.
Refer to Chapter 9, Using Callback Functions, for additional information.