Function Derivatives
Xpress NonLinear normally expects to obtain a set of partial derivatives from a user function at a particular base-point and then to use them as required, depending on the evaluation settings for the various functions. If for any reason this is not appropriate, then the integer control parameter XSLP_EVALUATE can be set to 1, which will force re-evaluation every time.
A function instance is not re-evaluated if all of its arguments are unchanged.
A simple function which does not have a function instance is evaluated every time.
If XSLP_EVALUATE is not set, then it is still possible to by-pass the re-evaluation of a function if the values have not changed significantly since the last evaluation. If the input values to a function have all converged to within their strict convergence tolerance (CTOL, ATOL_A, ATOL_R), and bit 4 of XSLP_FUNCEVAL is set to 1, then the existing values and derivatives will continue to be used. At the option of the user, an individual function, or all functions, can be re-evaluated in this way or at each SLP iteration. If a function is not re-evaluated, then all the required values will be calculated from the base point and the partial derivatives; the input and return values used in making the original function calculation are unchanged.
Bits 3-5 of integer control parameter XSLP_FUNCEVAL determine the nature of function evaluations. The meaning of each bit is as follows:
- Bit 3
- evaluate functions whenever independent variables change.
- Bit 4
- evaluate functions when independent variables change outside tolerances.
- Bit 5
- apply evaluation mode to all functions.
If bit 5 is zero, then the settings in bits 3-4 apply only to functions which do not have their own specific evaluation modes set.
Examples:
- Bits 3-5 = 1 (set bit 3)
- Evaluate functions whenever their input arguments (independent variables) change, unless the functions already have their own evaluation options set.
- Bits 3-5 = 5 (set bits 3 and 5)
- Evaluate all functions whenever their input arguments (independent variables) change.
- Bits 3-5 = 6 (set bits 4 and 5)
- Evaluate functions whenever input arguments (independent variables) change outside tolerance. Use existing calculation to estimate values otherwise.
Bits 6-8 of integer control parameter XSLP_FUNCEVAL determine the nature of derivative calculations. The meaning of each bit is as follows:
- Bit 6
- tangential derivatives.
- Bit 7
- forward derivatives.
- Bit 8
- apply evaluation mode to all functions.
If bit 8 is zero, then the settings in bits 6-7 apply only to functions which do not have their own specific derivative calculation modes set.
Examples:
- Bits 6-8 = 1 (set bit 6)
- Use tangential derivatives for all functions which do not already have their own derivative options set.
- Bits 6-8 = 5 (set bits 6 and 8)
- Use tangential derivatives for all functions.
- Bits 6-8 = 6 (set bits 7 and 8)
- Use forward derivatives for all functions.
The following constants are provided for setting these bits:
Setting bit 3 | XSLP_RECALC |
Setting bit 4 | XSLP_TOLCALC |
Setting bit 5 | XSLP_ALLCALCS |
Setting bit 6 | XSLP_2DERIVATIVE |
Setting bit 7 | XSLP_1DERIVATIVE |
Setting bit 8 | XSLP_ALLDERIVATIVES |
A function can make its own determination of whether to re-evaluate. If the function has already calculated and returned a full set of values and partial derivatives, then it can request Xpress NonLinear to estimate the values required from those already provided.
The function must be defined as using the ReturnArray argument, so that the return value from the function itself is a double precision status value as follows:
- 0
- normal return. The function has calculated the values and they are in ReturnArray.
- 1
- error return. The function has encountered an unrecoverable error. The values in ReturnArray are ignored and the optimization will normally terminate.
- -1
- no calculation. Xpress NonLinear should recalculate the values from the previous results. The values in ReturnArray are ignored.
Analytic Derivatives of Instantiated User Functions not Returning their own Derivatives
When analytical derivatives are used, SLP will calculate approximated derivatives using finite differences for instantiated functions and use these values when deriving analytical derivatives. Functions returning multiple arguments will always be instantiated, otherwise functions can be forced to be instantiated on a per function basis.
© 2001-2019 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.