Initializing help system before first use

# XSLPsetcbpreupdatelinearization, XPRSsetcbslppreupdatelinearization

Purpose
Set a user callback to be called before the linearization is updated
Topic areas
Callback, SLP
Synopsis
`int XPRS_CC XSLPsetcbpreupdatelinearization(XSLPprob prob, int (XPRS_CC *preupdatelinearization) (XSLPprob cbprob, void *cbdata, int *when), void *data);`
Arguments

prob | The current SLP problem.
preupdatelinearization | The function to be called before the linearization is updated. preupdatelinearization returns an integer value. If the return value is nonzero, the optimization will return an error code and the "User Return Code" error will be set.
cbprob | The problem passed to the callback function.
cbdata | The user-defined object passed as data to XSLPsetcbpreupdatelinearization.
when | Indicates the call number, starting at 1. If returned nonzero, another call to the callback will be scheduled. If returned zero, a final call with *when == -1 will be made.
data | A user-defined object, which can be used for any purpose by the function. data is passed to preupdatelinearization as cbdata.

Further information
1. When the linearization is updated, all user functions are evaluated and their derivatives calculated at the current base point. In some models, it is cheaper to compute the derivatives for all user functions at the same time, thereby avoiding repeated calculations for each function. This callback is intended to be used in such cases.
2. During each SLP iteration, the callback is invoked repeatedly, with *when indicating the current call number (starting from 1), until the callback indicates that no further calls are needed, by setting *when = 0. Between each callback invocation, the solver evaluates the user functions without requesting derivatives. After the callback has set *when = 0, the user functions are evaluated one more time, this time requesting derivatives, and then finally the callback is called with *when == -1, marking the end of the linearization update. The only time derivatives will be requested outside of this sequence is during KKT validation. This can be disabled during the solve by clearing the XSLP_CONVERGEBIT_VALIDATION_K bit in XSLP_CONVERGENCEOPS, ensuring that derivatives can always be precomputed.
3. One way that this callback can be used to precompute derivatives for user functions is as follows:

1. On each SLP iteration, the callback is first called with *when = 1. This is a signal that derivatives will be needed soon. The callback sets a flag to indicate that user functions should capture their input values.
2. When the callback returns, the user functions are evaluated without requesting derivatives. Each user function captures its input values somewhere, and returns the correct function value.
3. The callback is called again, with *when == 2. The callback now computes derivates for all user functions using the captured input values. The callback clears the flag so that user functions no longer capture their input values, and sets *when = 0 to indicate that no further calls are needed.
4. When the callback returns, the user functions are evaluated again. Derivatives are requested, and the user functions return the precomputed derivative values.
5. The callback is invoked one more time for this iteration with *when == -1, marking the end of the linearization update. User functions should behave normally from this point.

Related topics
User functions, XSLPdeluserfunction, XSLPimportlibfunc
Parent Topic Library functions and the programming interface

© 2001-2026 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.