Download LINDO API USER MANUAL
Transcript
310 CHAPTER 2 LSsetUsercalc () Description: Supplies LINDO API with the addresses of a) the pUsercalc() (see Chapter 7) that will be called each time LINDO API needs to compute the value of the user-defined function and b) the address of the user data area to be passed through to the pUsercalc() routine. Returns: 0 if successful, else one of the error codes listed in Appendix A, Error Codes. Prototype: int LSsetFuncalc ( pLSmodel pModel, user_callback_t *pUsercalc, void *pUserData) Input Arguments: Name Description pModel A pointer to an instance of LSmodel. pUsercalc A pointer to the subroutine that computes the value of a userdefined function. See the definition of pUsercalc() in Chapter 7, Solving Nonlinear Programs, for details on this function’s prototype. pUserData A pointer to a “pass through” data area in which your calling application may place information about the functions to be calculated. Whenever LINDO API calls your subroutine pUsercalc(), it passes through the pointer pUserData which could contain data to be used in the computation of the final value. Passing data in this manner will ensure that your application remains thread safe. Remarks: LSsetGradcalc() need not be called. In that case, gradients will be approximated by finite differences.