Library functions and the programming interface



Counting

All Xpress-SLP entities are numbered from 1. The 0th item is defined, and is an empty entity of the appropriate type. Therefore, whenever an Xpress-SLP 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 + XPRS_CSTYLE.

Note that for input of function arrays, types XSLP_COL and XSLP_ROW can be used; these do honor the setting of XPRS_CSTYLE, but will be converted into standard XSLP_VAR or XSLP_CONSTRAINT references. When a function array is returned from Xpress-SLP, the XSLP_VAR or XSLP_CONSTRAINT type will always be used.

Matrix row and column indices do honor the setting of XPRS_CSTYLE: that is, they count from zero if XPRS_CSTYLE=1, and from 1 if XPRS_CSTYLE=0.

Xpress-SLP functions affected by XPRS_CSTYLE

Function Arguments affected
XSLPaddcoefs RowIndex, ColIndex
XSLPadddcs RowIndex
XSLPaddvars ColIndex, DetRow
XSLPchgccoef RowIndex, ColIndex
XSLPchgcoef RowIndex, ColIndex
XSLPchgdc RowIndex
XSLPchgrow RowIndex
XSLPchgvar ColIndex, DetRow
XSLPevaluatecoef RowIndex, ColIndex
XSLPgetccoef RowIndex, ColIndex
XSLPgetcoef RowIndex, ColIndex
XSLPgetdc RowIndex
XSLPgetrow RowIndex
XSLPgetvar ColIndex, DetRow, Delta, PenaltyDelta, UpdateRow
XSLPloadcoefs RowIndex, ColIndex
XSLPloaddcs RowIndex
XSLPloadvars ColIndex, DetRow
also user callbacks defined by:
XSLPsetcbcascadevar ColIndex
XSLPsetcbitervar ColIndex
and all functions which have arguments which are indices into arrays.

The Xpress-SLP problem pointer

Xpress-SLP 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-SLP 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-SLP 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-SLP 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-SLP problem

XSLPdestroyprob(XSLPprob prob1)
   Delete an Xpress-SLP problem from memory

XSLPrestore(XSLPprob prob1)
   Restore Xpress-SLP data structures from file

XSLPsave(XSLPprob prob1)
   Save Xpress-SLP data structures to file

The XSLPload... functions

The XSLPload... functions can be used to load an Xpress-SLP 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 linear part of the problem should be loaded first, using the normal Optimizer Library functions XPRSloadlp or XPRSloadglobal. Then the appropriate parts of the Xpress-SLP 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-SLP 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.

Xpress-SLP is compatible with the Xpress quadratic programming optimizer. XPRSloadqp and XPRSloadqglobal can be used to load quadratic problems. The quadratic objective will be optimized using the Xpress quadratic optimizer; the nonlinear constraints will be handled with the normal SLP procedures.

Library functions

A large number of routines are available for Library users of Xpress-SLP, 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
XSLPadddcs
Add delayed constraints (DCs) to the SLP problem
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
XSLPaddxvs
Add a set of extended variable arrays (XVs) to an SLP 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.
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
XSLPchgdc
Add or change the settings for a delayed constraint (DC)
XSLPchgfuncobject
Change the address of one of the objects which can be accessed by the user functions
XSLPchgrow
Change the status setting of a constraint
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
XSLPchgxv
Add or change an extended variable array (XV) in an SLP problem
XSLPchgxvitem
Add or change an item of an existing XV in an SLP problem
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
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
XSLPformatvalue
Format a double-precision value in the style of Xpress-SLP
XSLPfree
Free any memory allocated by Xpress-SLP and close any open Xpress-SLP files
XSLPgetbanner
Retrieve the Xpress-SLP banner and copyright messages
XSLPgetccoef
Retrieve a single matrix coefficient as a formula in a character string
XSLPgetcoef
Retrieve a single matrix coefficient as a formula split into tokens
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
XSLPgetdc
Retrieve information about a delayed constraint in an SLP problem
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
XSLPgetindex
Retrieve the index of an Xpress-SLP 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-SLP error during an SLP run
XSLPgetmessagetype
Retrieve the message type corresponding to a message number
XSLPgetnames
Retrieve the names of a set of Xpress-SLP entities
XSLPgetparam
Retrieve the value of a control parameter or attribute by name
XSLPgetptrattrib
Retrieve the value of a problem pointer attribute
XSLPgetrow
Retrieve the status setting of a constraint
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-SLP 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-SLP major and minor version numbers
XSLPgetxv
Retrieve information about an extended variable array
XSLPgetxvitem
Retrieve information about an item in an extended variable array
XSLPglobal
Initiate the Xpress-SLP mixed integer SLP (MISLP) algorithm
XSLPinit
Initializes the Xpress-SLP system
XSLPitemname
Retrieves the name of an Xpress-SLP 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
XSLPloaddcs
Load delayed constraints (DCs) into the SLP problem
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
XSLPloadxvs
Load a set of extended variable arrays (XVs) into an SLP problem
XSLPmaxim
Maximize an SLP problem
XSLPminim
Minimize an SLP problem
XSLPopt
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
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
XSLPprintmsg
Print a message string according to the current settings for Xpress-SLP output
XSLPqparse
Perform a quick parse on a free-format character string, identifying where each token starts
XSLPreadprob
Read an Xpress-SLP extended MPS format matrix from a file into an SLP problem
XSLPremaxim
Continue the maximization of an SLP problem
XSLPreminim
Continue the minimization of an SLP problem
XSLPrestore
Restore the Xpress-SLP problem from a file created by XSLPsave
XSLPrevise
Revise the unaugmented SLP matrix with data from a file
XSLPsave
Save the Xpress-SLP problem to file
XSLPsaveas
Save the Xpress-SLP 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
XSLPsetcbcascadevarF
Set a user callback to be called after each column has been cascaded
XSLPsetcbdestroy
Set a user callback to be called when an SLP problem is about to be destroyed
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
XSLPsetcbitervarF
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-SLP outputs a line of text
XSLPsetcbmessageF
Set a user callback to be called whenever Xpress-SLP outputs a line of text
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
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-SLP
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-SLP 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
XSLPtoVBString
Return a string to VB given its address in Xpress-SLP
XSLPuprintmemory
Print the dimensions and memory allocations for a problem
XSLPvalidate
Validate the feasibility of constraints in a converged 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


If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.