Library functions and the programming interface
Topics covered in this chapter:
Counting
All Xpress NonLinear entities are numbered from 1. The 0th item is defined, and is an empty entity of the appropriate type. Therefore, whenever an Xpress NonLinear function returns a zero value, it means that there is no data of that type.
In parsed and unparsed function arrays, types XSLP_COL and XSLP_ROW use indices counted from zero, the same as the Xpress Optimizer library.
The Xpress NonLinear problem pointer
Xpress NonLinear uses the same concept as the Optimizer library, with a "pointer to a problem". The optimizer problem must be initialized first in the normal way. Then the corresponding Xpress NonLinear problem must be initialized, including a pointer to the underlying optimizer problem. For example:
{ ... XPRSprob prob=NULL; XSLPprob SLPprob=NULL; XPRSinit(""); XSLPinit(); XPRScreateprob(&prob); XSLPcreateprob(&SLPprob,&prob); ... }
At the end of the program, the Xpress NonLinear problem should be destroyed. You are responsible for destroying the underlying XPRSprob linear problem afterwards. For example:
{ ... XSLPdestroyprob(SLPprob); XPRSdestroyprob(prob); XSLPfree(); XPRSfree(); ... }
The following functions are provided to manage Xpress NonLinear problems. See the documentation below on the individual functions for more details.
XSLPcopycontrols(XSLPprob prob1, XSLPprob prob2)
Copy the settings of control variables
XSLPcopycallbacks(XSLPprob prob1, XSLPprob prob2)
Copy the callback settings
XSLPcopyprob(XSLPprob prob1, XSLPprob prob2, char *ProbName)
Copy a problem completely
XSLPcreateprob(XSLPprob *prob1, XPRSprob *prob2)
Create an Xpress NonLinear problem
XSLPdestroyprob(XSLPprob prob1)
Delete an Xpress NonLinear problem from memory
XSLPrestore(XSLPprob prob1)
Restore Xpress NonLinear data structures from file
XSLPsave(XSLPprob prob1)
Save Xpress NonLinear data structures to file
The load functions
The load functions can be used to load an Xpress NonLinear problem directly into the Xpress data structures. Because there are so many additional items which can be loaded apart from the basic (linear) matrix, the loading process is divided into several functions.
The best practice is to load the linear part of the problem irst, using the normal Optimizer Library functions XPRSloadlp or XPRSloadmip. Then the appropriate parts of the Xpress NonLinear problem can be loaded. After all the load functions have been called, XSLPconstruct should be called to create the SLP matrix and data structures. If XSLPconstruct is not invoked before a call to one of the Xpress NonLinear optimization routines, then it will be called by the optimization routine itself.
All of these functions initialize their data areas. Therefore, if a second call is made to the same function for the same problem, the previous data will be deleted. If you want to include additional data of the same type, then use the corresponding add function.
It is possible to remove parts of the SLP strcutures with the various XSLPdel functions, and XSLPunconstruct can also be used to remove the augmentation.
Xpress NonLinear is compatible with the Xpress quadratic programming optimizer. XPRSloadqp and XPRSloadmiqp can be used to load quadratic problems (or quadratically constrained problmes using XPRSloadqcqp and XPRSloadmiqcqp). The quadratic objective will be optimized using the Xpress quadratic optimizer; the nonlinear constraints will be handled with the normal SLP procedures. Please note, that this separation is only useful for a convex quadratic objective and convex quadratic inequality constraints. All nonconvex quadratic matrices should be handled as SLP strctures.
For a description on when it's more beneficial to use the XPRS library to solve QP or QCQP problems, please see Selecting the right algorithm for a nonlinear problem - when to use the XPRS library instead of XSLP.
Library functions
A large number of routines are available for Library users of Xpress NonLinear, ranging from simple routines for the input and solution of problems from matrix files to sophisticated callback functions and greater control over the solution process. Library users have access to a set of functions providing advanced control over their program's interaction with the SLP module and catering for more complicated problem development. When called from the SLP library, these functions have an XSLP prefix and take an SLP problem as their first argument. They are also exported to the XPRS library, where they can be called on an XPRSprob without having to explicitly create an XSLPprob first.
Add or replace a single matrix formula using a character string for the formula.
[ Problem Modification] |
|
Retrieve a single matrix formula in a character string.
[ Problem Information] |
|
Add or change a single matrix coefficient using a character string for the formula.
[ Problem Modification, SLP] |
|
Retrieve a single matrix coefficient as a formula in a character string.
[ Problem Information, SLP] |
|
Add non-linear formulas to the SLP problem.
[ Problem Modification] |
|
Add user function definitions to an SLP problem.
[ User Functions] |
|
Calculate the slack values for the provided solution in the non-linear problem
[ Solution] |
|
Re-calculate consistent values for SLP variables based on the current values of the remaining variables.
[ Cascading, SLP, Solution Process] |
|
Add or change a single matrix coefficient using a parsed or unparsed formula.
[ Problem Modification, SLP] |
|
Add or replace a single matrix formula using a parsed or unparsed formula
[ Problem Modification] |
|
Create the full augmented SLP matrix and data structures, ready for optimization
[ SLP, Solution Process] |
|
Copy the user-defined callbacks from one SLP problem to another
[ Callback] |
|
Copy the values of the control variables from one SLP problem to another
[ Controls and Attributes] |
|
Copy an existing SLP problem to another
[ Problem Creation] |
|
Create a new SLP problem
[ Problem Creation] |
|
Delete nonlinear formulas from the current problem
[ Problem Modification] |
|
Delete a user function from the current problem
[ User Functions] |
|
Delete an SLP problem and release all the associated memory
[ Problem Creation] |
|
Evaluate a coefficient using the current values of the variables
[ Solution] |
|
Evaluate a formula using the current values of the variables
[ Solution] |
|
Fixe the values of the error vectors
[ Solution Process] |
|
Free any memory allocated by Xpress NonLinear and close any open Xpress NonLinear files
[ Licensing] |
|
Retrieve the list of positions of the nonlinear coefficients in the problem.
[ Problem Information, SLP] |
|
Retrieve the value of a double precision problem attribute
[ Controls and Attributes] |
|
Retrieve the value of a double precision problem control
[ Controls and Attributes] |
|
Retrieve a single matrix formula as a formula split into tokens.
[ Problem Information] |
|
Retrieve the list of positions of the nonlinear formulas in the problem
[ Problem Information] |
|
Retrieve the index of an Xpress NonLinear entity with a given name
[ Problem Information, User Functions] |
|
Retrieve the value of an integer problem attribute
[ Controls and Attributes] |
|
Retrieve the value of an integer problem control
[ Controls and Attributes] |
|
Retrieve the error message corresponding to the last Xpress NonLinear error during an SLP run
[ Misc] |
|
Retrieve the value of a problem pointer attribute
[ Controls and Attributes] |
|
Retrieve the value of a string problem attribute
[ Controls and Attributes] |
|
Retrieve the value of a string problem control
[ Controls and Attributes] |
|
Imports a function from a library file to be called as a user function
[ User Functions] |
|
Initializes the Xpress NonLinear system
[ Licensing] |
|
Interrupts the current SLP optimization
[ Solution Process] |
|
Retrieves the name of an Xpress NonLinear entity or the value of a function token as a character string.
[ Names Manager] |
|
Load non-linear formulas into the SLP problem
[ Problem Information] |
|
Removes all scheduled jobs from the multistart job pool
[ Multistart] |
|
Maximize or minimize an SLP problem
[ Solution Process] |
|
Restores the problem to its pre-solve state
[ Presolve] |
|
Perform a nonlinear presolve on the problem
[ Presolve] |
|
Print a summary of any evaluation errors that may have occurred during solving a problem
[ Logging] |
|
Print the dimensions and memory allocations for a problem
[ Logging] |
|
Read an Xpress NonLinear extended MPS format matrix from a file into an SLP problem
[ File IO, Problem Creation] |
|
Analyze the current matrix for largest/smallest coefficients and ratios
[ Numerics] |
|
Set a user callback to be called when an SLP problem is about to be destroyed
[ Callback] |
|
Set a user callback to be called after each column has been tested for convergence
[ Callback, SLP, SLP-convergence] |
|
Set a user callback to be called every time a new multistart job is created, and the pre-loaded settings are applied
[ Callback, Multistart] |
|
Set a user callback to be called every time a multistart winner has been declared
[ Callback, Multistart] |
|
Transfer the current solution to initial values
[ Data Input] |
|
Set the value of a double precision problem control
[ Controls and Attributes] |
|
Set the values of one SLP control to its default value
[ Controls and Attributes] |
|
Set the values of all SLP controls to their default values
[ Controls and Attributes] |
|
Set the function error flag for the problem
[ Misc] |
|
Set the initial value of a variable
[ Data Input] |
|
Set the value of an integer problem control
[ Controls and Attributes] |
|
Set the value of a control parameter by name
[ Controls and Attributes] |
|
Set the value of a string problem control
[ Controls and Attributes] |
|
Removes the augmentation and returns the problem to its pre-linearization state
[ SLP, Solution Process] |
|
Validate the feasibility of constraints in a converged solution
[ Solution] |
|
Validates the first order optimality conditions also known as the Karush-Kuhn-Tucker (KKT) conditions versus the currect solution
[ Solution] |
|
Validates the current problem formulation and statement
[ Solution] |
|
Prints an extensive analysis on a given constraint of the SLP problem
[ Solution] |
|
Validate the feasibility of constraints for a given solution
[ Solution] |
|
© 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.