Library functions and the programming interface
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, the indices always count from 1. This includes types XSLP_VAR and XSLP_CONSTRAINT: the index is the matrix column or row index +1.
Note that for input of function arrays, types XSLP_COL and XSLP_ROW can be used, but will be converted into standard XSLP_VAR or XSLP_CONSTRAINT references. When a function array is returned from Xpress NonLinear, the XSLP_VAR or XSLP_CONSTRAINT type will always be used.
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 XSLPload... functions
The XSLPload... 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 XPRSloadglobal. Then the appropriate parts of the Xpress NonLinear problem can be loaded. After all the XSLPload... 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 XSLPadd... 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 XPRSloadqglobal can be used to load quadratic problems (or quadratically constrained problmes using XPRSloadqcqp and XPRSloadqcqpglobal). 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.
XSLPaddcoefs |
Add non-linear coefficients to the SLP problem
|
XSLPaddcvars |
Add character variables (CVs) to the SLP problem
|
XSLPadddfs |
Add a set of distribution factors
|
XSLPaddnames |
Set the names of a set of SLP entities in an SLP problem.
|
XSLPaddtolsets |
Add sets of standard tolerance values to an SLP problem
|
XSLPadduserfuncs |
Add user function definitions to an SLP problem.
|
XSLPaddvars |
Add SLP variables defined as matrix columns to an SLP problem
|
XSLPcalcslacks |
Calculate the slack values for the provided solution in the non-linear problem
|
XSLPcalluserfunc |
Call a user function from a program or from within another user function
|
XSLPcascade |
Re-calculate consistent values for SLP variables based on the current values of the remaining variables.
|
XSLPcascadeorder |
Establish a re-calculation sequence for SLP variables with determining rows.
|
XSLPchgcascadenlimit |
Set a variable specific cascade iteration limit
|
XSLPchgccoef |
Add or change a single matrix coefficient using a character string for the formula
|
XSLPchgcoef |
Add or change a single matrix coefficient using a parsed or unparsed formula
|
XSLPchgcvar |
Add or change the value of the character string corresponding to an SLP character variable
|
XSLPchgdeltatype |
Changes the type of the delta assigned to a nonlinear variable
|
XSLPchgdf |
Set or change a distribution factor
|
XSLPchgfuncobject |
Change the address of one of the objects which can be accessed by the user functions
|
XSLPchgrowstatus |
Change the status setting of a constraint
|
XSLPchgrowwt |
Set or change the initial penalty error weight for a row
|
XSLPchgtolset |
Add or change a set of convergence tolerances used for SLP variables
|
XSLPchguserfunc |
Add or change a user function in an SLP problem after the problem has been input
|
XSLPchguserfuncaddress |
Change the address of a user function
|
XSLPchguserfuncobject |
Change or define one of the objects which can be accessed by the user functions
|
XSLPchgvar |
Define a column as an SLP variable or change the characteristics and values of an existing SLP variable
|
XSLPconstruct |
Create the full augmented SLP matrix and data structures, ready for optimization
|
XSLPcopycallbacks |
Copy the user-defined callbacks from one SLP problem to another
|
XSLPcopycontrols |
Copy the values of the control variables from one SLP problem to another
|
XSLPcopyprob |
Copy an existing SLP problem to another
|
XSLPcreateprob |
Create a new SLP problem
|
XSLPdecompose |
Decompose nonlinear constraints into linear and nonlinear parts
|
XSLPdelcoefs |
Delete coefficients from the current problem
|
XSLPdelcvars |
Delete character variables from the current problem
|
XSLPdeltolsets |
Delete tolerance sets from the current problem
|
XSLPdeluserfuncs |
Delete user functions from the current problem
|
XSLPdelvars |
Convert SLP variables to normal columns. Variables must not appear in SLP structures
|
XSLPdestroyprob |
Delete an SLP problem and release all the associated memory
|
XSLPevaluatecoef |
Evaluate a coefficient using the current values of the variables
|
XSLPevaluateformula |
Evaluate a formula using the current values of the variables
|
XSLPfilesol |
Prints the last SLP iterations solution to file
|
XSLPfixpenalties |
Fixe the values of the error vectors
|
XSLPformatvalue |
Format a double-precision value in the style of Xpress NonLinear
|
XSLPfree |
Free any memory allocated by Xpress NonLinear and close any open Xpress NonLinear files
|
XSLPgetbanner |
Retrieve the Xpress NonLinear banner and copyright messages
|
XSLPgetccoef |
Retrieve a single matrix coefficient as a formula in a character string
|
XSLPgetcoefformula |
Retrieve a single matrix coefficient as a formula split into tokens
|
XSLPgetcoefs |
Retrieve the list of positions of the nonlinear coefficients in the problem
|
XSLPgetcolinfo |
Get current column information.
|
XSLPgetcvar |
Retrieve the value of the character string corresponding to an SLP character variable
|
XSLPgetdblattrib |
Retrieve the value of a double precision problem attribute
|
XSLPgetdblcontrol |
Retrieve the value of a double precision problem control
|
XSLPgetdf |
Get a distribution factor
|
XSLPgetdtime |
Retrieve a double precision time stamp in seconds
|
XSLPgetfuncinfo |
Retrieve the argument information for a user function
|
XSLPgetfuncinfoV |
Retrieve the argument information for a user function
|
XSLPgetfuncobject |
Retrieve the address of one of the objects which can be accessed by the user functions
|
XSLPgetfuncobjectV |
Retrieve the address of one of the objects which can be accessed by the user functions
|
XSLPgetfunctioninstance |
Retrieve the base signature of a user function instance
|
XSLPgetindex |
Retrieve the index of an Xpress NonLinear entity with a given name
|
XSLPgetintattrib |
Retrieve the value of an integer problem attribute
|
XSLPgetintcontrol |
Retrieve the value of an integer problem control
|
XSLPgetlasterror |
Retrieve the error message corresponding to the last Xpress NonLinear error during an SLP run
|
XSLPgetmessagetype |
Retrieve the message type corresponding to a message number
|
XSLPgetnames |
Retrieve the names of a set of Xpress NonLinear entities
|
XSLPgetparam |
Retrieve the value of a control parameter or attribute by name
|
XSLPgetptrattrib |
Retrieve the value of a problem pointer attribute
|
XSLPgetrowinfo |
Get current row information.
|
XSLPgetrowstatus |
Retrieve the status setting of a constraint
|
XSLPgetrowwt |
Get the initial penalty error weight for a row
|
XSLPgetslpsol |
Obtain the solution values for the most recent SLP iteration
|
XSLPgetstrattrib |
Retrieve the value of a string problem attribute
|
XSLPgetstrcontrol |
Retrieve the value of a string problem control
|
XSLPgetstring |
Retrieve the value of a string in the Xpress NonLinear string table
|
XSLPgettime |
Retrieve an integer time stamp in seconds and/or milliseconds
|
XSLPgettolset |
Retrieve the values of a set of convergence tolerances for an SLP problem
|
XSLPgetuserfunc |
Retrieve the type and parameters for a user function
|
XSLPgetuserfuncaddress |
Retrieve the address of a user function
|
XSLPgetuserfuncobject |
Retrieve the address of one of the objects which can be accessed by the user functions
|
XSLPgetvar |
Retrieve information about an SLP variable
|
XSLPgetversion |
Retrieve the Xpress NonLinear major and minor version numbers
|
XSLPglobal |
Initiate the Xpress NonLinear mixed integer SLP (MISLP) algorithm
|
XSLPinit |
Initializes the Xpress NonLinear system
|
XSLPinterrupt |
Interrupts the current SLP optimization
|
XSLPitemname |
Retrieves the name of an Xpress NonLinear entity or the value of a function token as a character string.
|
XSLPloadcoefs |
Load non-linear coefficients into the SLP problem
|
XSLPloadcvars |
Load character variables (CVs) into the SLP problem
|
XSLPloaddfs |
Load a set of distribution factors
|
XSLPloadtolsets |
Load sets of standard tolerance values into an SLP problem
|
XSLPloaduserfuncs |
Load user function definitions into an SLP problem.
|
XSLPloadvars |
Load SLP variables defined as matrix columns into an SLP problem
|
XSLPmaxim |
Maximize an SLP problem
|
XSLPminim |
Minimize an SLP problem
|
XSLPmsaddcustompreset |
A combined version of XSLPmsaddjob and XSLPmsaddpreset. The preset described is loaded, topped up with the specific settings supplied
|
XSLPmsaddjob |
Adds a multistart job to the multistart pool
|
XSLPmsaddpreset |
Loads a preset of jobs into the multistart job pool.
|
XSLPmsclear |
Removes all scheduled jobs from the multistart job pool
|
XSLPnlpoptimize |
Maximize or minimize an SLP problem
|
XSLPparsecformula |
Parse a formula written as a character string into internal parsed (reverse Polish) format
|
XSLPparseformula |
Parse a formula written as an unparsed array of tokens into internal parsed (reverse Polish) format
|
XSLPpostsolve |
Restores the problem to its pre-solve state
|
XSLPpreparseformula |
Perform an initial scan of a formula written as a character string, identifying the operators but not attempting to identify the types of the individual tokens
|
XSLPpresolve |
Perform a nonlinear presolve on the problem
|
XSLPprintevalinfo |
Print a summary of any evaluation errors that may have occurred during solving a problem
|
XSLPprintmemory |
Print the dimensions and memory allocations for a problem
|
XSLPprintmsg |
Print a message string according to the current settings for Xpress NonLinear output
|
XSLPqparse |
Perform a quick parse on a free-format character string, identifying where each token starts
|
XSLPreadprob |
Read an Xpress NonLinear extended MPS format matrix from a file into an SLP problem
|
XSLPreinitialize |
Reset the SLP problem to match a just augmented system
|
XSLPremaxim |
Continue the maximization of an SLP problem
|
XSLPreminim |
Continue the minimization of an SLP problem
|
XSLPrestore |
Restore the Xpress NonLinear problem from a file created by XSLPsave
|
XSLPsave |
Save the Xpress NonLinear problem to file
|
XSLPsaveas |
Save the Xpress NonLinear problem to a named file
|
XSLPscaling |
Analyze the current matrix for largest/smallest coefficients and ratios
|
XSLPsetcbcascadeend |
Set a user callback to be called at the end of the cascading process, after the last variable has been cascaded
|
XSLPsetcbcascadestart |
Set a user callback to be called at the start of the cascading process, before any variables have been cascaded
|
XSLPsetcbcascadevar |
Set a user callback to be called after each column has been cascaded
|
XSLPsetcbcascadevarfail |
Set a user callback to be called after cascading a column was not successful
|
XSLPsetcbcoefevalerror |
Set a user callback to be called when an evaluation of a coefficient fails during the solve
|
XSLPsetcbconstruct |
Set a user callback to be called during the Xpress-SLP augmentation process
|
XSLPsetcbdestroy |
Set a user callback to be called when an SLP problem is about to be destroyed
|
XSLPsetcbdrcol |
Set a user callback used to override the update of variables with small determining column
|
XSLPsetcbformula |
Set a callback to be used in formula evaluation when an unknown token is found
|
XSLPsetcbintsol |
Set a user callback to be called during MISLP when an integer solution is obtained
|
XSLPsetcbiterend |
Set a user callback to be called at the end of each SLP iteration
|
XSLPsetcbiterstart |
Set a user callback to be called at the start of each SLP iteration
|
XSLPsetcbitervar |
Set a user callback to be called after each column has been tested for convergence
|
XSLPsetcbmessage |
Set a user callback to be called whenever Xpress NonLinear outputs a line of text
|
XSLPsetcbmsjobend |
Set a user callback to be called every time a new multistart job finishes. Can be used to overwrite the default solution ranking function
|
XSLPsetcbmsjobstart |
Set a user callback to be called every time a new multistart job is created, and the pre-loaded settings are applied
|
XSLPsetcbmswinner |
Set a user callback to be called every time a new multistart job is created, and the pre-loaded settings are applied
|
XSLPsetcboptnode |
Set a user callback to be called during MISLP when an optimal SLP solution is obtained at a node
|
XSLPsetcbprenode |
Set a user callback to be called during MISLP after the set-up of the SLP problem to be solved at a node, but before SLP optimization
|
XSLPsetcbslpend |
Set a user callback to be called at the end of the SLP optimization
|
XSLPsetcbslpnode |
Set a user callback to be called during MISLP after the SLP optimization at each node.
|
XSLPsetcbslpstart |
Set a user callback to be called at the start of the SLP optimization
|
XSLPsetcurrentiv |
Transfer the current solution to initial values
|
XSLPsetdblcontrol |
Set the value of a double precision problem control
|
XSLPsetdefaultcontrol |
Set the values of one SLP control to its default value
|
XSLPsetdefaults |
Set the values of all SLP controls to their default values
|
XSLPsetfuncobject |
Change the address of one of the objects which can be accessed by the user functions
|
XSLPsetfunctionerror |
Set the function error flag for the problem
|
XSLPsetintcontrol |
Set the value of an integer problem control
|
XSLPsetlogfile |
Define an output file to be used to receive messages from Xpress NonLinear
|
XSLPsetparam |
Set the value of a control parameter by name
|
XSLPsetstrcontrol |
Set the value of a string problem control
|
XSLPsetstring |
Set a value in the Xpress NonLinear string table
|
XSLPsetuniqueprefix |
Find a prefix character string which is different from all the names currently in use within the SLP problem
|
XSLPsetuserfuncaddress |
Change the address of a user function
|
XSLPsetuserfuncinfo |
Set up the argument information array for a user function call
|
XSLPsetuserfuncobject |
Set or define one of the objects which can be accessed by the user functions
|
XSLPtime |
Print the current date and time
|
XSLPtokencount |
Count the number of tokens in a free-format character string
|
XSLPunconstruct |
Reset the SLP problem and removes the augmentation structures
|
XSLPupdatelinearization |
Updates the current linearization
|
XSLPuserfuncinfo |
Get or set user function declaration information
|
XSLPvalidate |
Validate the feasibility of constraints in a converged solution
|
XSLPvalidatekkt |
Validates the first order optimality conditions also known as the Karush-Kuhn-Tucker (KKT) conditions versus the currect solution
|
XSLPvalidateprob |
Validates the current problem formulation and statement
|
XSLPvalidaterow |
Prints an extensive analysis on a given constraint of the SLP problem
|
XSLPvalidatevector |
Validate the feasibility of constraints for a given solution
|
XSLPvalidformula |
Check a formula in internal (parsed or unparsed) format for unknown tokens
|
XSLPwriteprob |
Write the current problem to a file in extended MPS or text format
|
XSLPwriteslxsol |
Write the current solution to an MPS like file format
|