Initializing help system before first use

problem.setcbpreupdatelinearization

Purpose
Set a user callback to be called before the linearization is updated
Synopsis

problem.setcbpreupdatelinearization(callback, data)

ifRepeat = callback(my_prob, my_object, when)


Arguments
callback 
The function to be called before the linearization is updated. If callback returns True, another call to the callback will be scheduled. If it returns False, a final call with when == -1 will be made.
my_prob 
The problem passed to the callback function.
my_object 
The user-defined object passed as data to setcbpreupdatelinearization.
when 
Indicates the call number, starting at 1. A value of -1 indicates the end of the linearization update.
Further information

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.

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 returning False. Between each callback invocation, the solver evaluates the user functions without requesting derivatives. After the callback has returned False, 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.

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, and returns True to request another call.
  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 returns False 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.

© 2001-2025 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.