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 variablesXSLPcopycallbacks(XSLPprob prob1, XSLPprob prob2)
Copy the callback settingsXSLPcopyprob(XSLPprob prob1, XSLPprob prob2, char *ProbName)
Copy a problem completelyXSLPcreateprob(XSLPprob *prob1, XPRSprob *prob2)
Create an Xpress-SLP problemXSLPdestroyprob(XSLPprob prob1)
Delete an Xpress-SLP problem from memoryXSLPrestore(XSLPprob prob1)
Restore Xpress-SLP data structures from fileXSLPsave(XSLPprob prob1)
Save Xpress-SLP data structures to fileThe 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 problemXSLPaddcvars Add character variables (CVs) to the SLP problemXSLPadddcs Add delayed constraints (DCs) to the SLP problemXSLPaddnames Set the names of a set of SLP entities in an SLP problem.XSLPaddtolsets Add sets of standard tolerance values to an SLP problemXSLPadduserfuncs Add user function definitions to an SLP problem.XSLPaddvars Add SLP variables defined as matrix columns to an SLP problemXSLPaddxvs Add a set of extended variable arrays (XVs) to an SLP problemXSLPcalluserfunc Call a user function from a program or from within another user functionXSLPcascade Re-calculate consistent values for SLP variables. based on the current values of the remaining variablesXSLPcascadeorder 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 formulaXSLPchgcoef Add or change a single matrix coefficient using a parsed or unparsed formulaXSLPchgcvar Add or change the value of the character string corresponding to an SLP character variableXSLPchgdc 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 functionsXSLPchgrow Change the status setting of a constraintXSLPchgtolset Add or change a set of convergence tolerances used for SLP variablesXSLPchguserfunc Add or change a user function in an SLP problem after the problem has been inputXSLPchguserfuncaddress Change the address of a user functionXSLPchguserfuncobject Change or define one of the objects which can be accessed by the user functionsXSLPchgvar Define a column as an SLP variable or change the characteristics and values of an existing SLP variableXSLPchgxv Add or change an extended variable array (XV) in an SLP problemXSLPchgxvitem Add or change an item of an existing XV in an SLP problemXSLPconstruct Create the full augmented SLP matrix and data structures, ready for optimizationXSLPcopycallbacks Copy the user-defined callbacks from one SLP problem to anotherXSLPcopycontrols Copy the values of the control variables from one SLP problem to anotherXSLPcopyprob Copy an existing SLP problem to anotherXSLPcreateprob Create a new SLP problemXSLPdestroyprob Delete an SLP problem and release all the associated memoryXSLPevaluatecoef Evaluate a coefficient using the current values of the variablesXSLPevaluateformula Evaluate a formula using the current values of the variablesXSLPformatvalue Format a double-precision value in the style of Xpress-SLPXSLPfree Free any memory allocated by Xpress-SLP and close any open Xpress-SLP filesXSLPgetbanner Retrieve the Xpress-SLP banner and copyright messagesXSLPgetccoef Retrieve a single matrix coefficient as a formula in a character stringXSLPgetcoef Retrieve a single matrix coefficient as a formula split into tokensXSLPgetcvar Retrieve the value of the character string corresponding to an SLP character variableXSLPgetdblattrib Retrieve the value of a double precision problem attributeXSLPgetdblcontrol Retrieve the value of a double precision problem controlXSLPgetdc Retrieve information about a delayed constraint in an SLP problemXSLPgetdtime Retrieve a double precision time stamp in secondsXSLPgetfuncinfo Retrieve the argument information for a user functionXSLPgetfuncinfoV Retrieve the argument information for a user functionXSLPgetfuncobject Retrieve the address of one of the objects which can be accessed by the user functionsXSLPgetfuncobjectV Retrieve the address of one of the objects which can be accessed by the user functionsXSLPgetindex Retrieve the index of an Xpress-SLP entity with a given nameXSLPgetintattrib Retrieve the value of an integer problem attributeXSLPgetintcontrol Retrieve the value of an integer problem controlXSLPgetlasterror Retrieve the error message corresponding to the last Xpress-SLP error during an SLP runXSLPgetmessagetype Retrieve the message type corresponding to a message numberXSLPgetnames Retrieve the names of a set of Xpress-SLP entitiesXSLPgetparam Retrieve the value of a control parameter or attribute by nameXSLPgetptrattrib Retrieve the value of a problem pointer attributeXSLPgetrow Retrieve the status setting of a constraintXSLPgetslpsol Obtain the solution values for the most recent SLP iterationXSLPgetstrattrib Retrieve the value of a string problem attributeXSLPgetstrcontrol Retrieve the value of a string problem controlXSLPgetstring Retrieve the value of a string in the Xpress-SLP string tableXSLPgettime Retrieve an integer time stamp in seconds and/or millisecondsXSLPgettolset Retrieve the values of a set of convergence tolerances for an SLP problemXSLPgetuserfunc Retrieve the type and parameters for a user functionXSLPgetuserfuncaddress Retrieve the address of a user functionXSLPgetuserfuncobject Retrieve the address of one of the objects which can be accessed by the user functionsXSLPgetvar Retrieve information about an SLP variableXSLPgetversion Retrieve the Xpress-SLP major and minor version numbersXSLPgetxv Retrieve information about an extended variable arrayXSLPgetxvitem Retrieve information about an item in an extended variable arrayXSLPglobal Initiate the Xpress-SLP mixed integer SLP (MISLP) algorithmXSLPinit Initializes the Xpress-SLP systemXSLPitemname 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 problemXSLPloadcvars Load character variables (CVs) into the SLP problemXSLPloaddcs Load delayed constraints (DCs) into the SLP problemXSLPloadtolsets Load sets of standard tolerance values into an SLP problemXSLPloaduserfuncs Load user function definitions into an SLP problem.XSLPloadvars Load SLP variables defined as matrix columns into an SLP problemXSLPloadxvs Load a set of extended variable arrays (XVs) into an SLP problemXSLPmaxim Maximize an SLP problemXSLPminim Minimize an SLP problemXSLPopt Maximize or minimize an SLP problemXSLPparsecformula Parse a formula written as a character string into internal parsed (reverse Polish) formatXSLPparseformula Parse a formula written as an unparsed array of tokens into internal parsed (reverse Polish) formatXSLPpreparseformula 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 tokensXSLPpresolve Perform a nonlinear presolve on the problemXSLPprintmsg Print a message string according to the current settings for Xpress-SLP outputXSLPqparse Perform a quick parse on a free-format character string, identifying where each token startsXSLPreadprob Read an Xpress-SLP extended MPS format matrix from a file into an SLP problemXSLPremaxim Continue the maximization of an SLP problemXSLPreminim Continue the minimization of an SLP problemXSLPrestore Restore the Xpress-SLP problem from a file created by XSLPsaveXSLPrevise Revise the unaugmented SLP matrix with data from a fileXSLPsave Save the Xpress-SLP problem to fileXSLPsaveas Save the Xpress-SLP problem to a named fileXSLPscaling Analyze the current matrix for largest/smallest coefficients and ratiosXSLPsetcbcascadeend Set a user callback to be called at the end of the cascading process, after the last variable has been cascadedXSLPsetcbcascadestart Set a user callback to be called at the start of the cascading process, before any variables have been cascadedXSLPsetcbcascadevar Set a user callback to be called after each column has been cascadedXSLPsetcbcascadevarF Set a user callback to be called after each column has been cascadedXSLPsetcbdestroy Set a user callback to be called when an SLP problem is about to be destroyedXSLPsetcbintsol Set a user callback to be called during MISLP when an integer solution is obtainedXSLPsetcbiterend Set a user callback to be called at the end of each SLP iterationXSLPsetcbiterstart Set a user callback to be called at the start of each SLP iterationXSLPsetcbitervar Set a user callback to be called after each column has been tested for convergenceXSLPsetcbitervarF Set a user callback to be called after each column has been tested for convergenceXSLPsetcbmessage Set a user callback to be called whenever Xpress-SLP outputs a line of textXSLPsetcbmessageF Set a user callback to be called whenever Xpress-SLP outputs a line of textXSLPsetcboptnode Set a user callback to be called during MISLP when an optimal SLP solution is obtained at a nodeXSLPsetcbprenode 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 optimizationXSLPsetcbslpend Set a user callback to be called at the end of the SLP optimizationXSLPsetcbslpnode 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 optimizationXSLPsetdblcontrol Set the value of a double precision problem controlXSLPsetdefaultcontrol Set the values of one SLP control to its default valueXSLPsetdefaults Set the values of all SLP controls to their default valuesXSLPsetfuncobject Change the address of one of the objects which can be accessed by the user functionsXSLPsetfunctionerror Set the function error flag for the problemXSLPsetintcontrol Set the value of an integer problem controlXSLPsetlogfile Define an output file to be used to receive messages from Xpress-SLPXSLPsetparam Set the value of a control parameter by nameXSLPsetstrcontrol Set the value of a string problem controlXSLPsetstring Set a value in the Xpress-SLP string tableXSLPsetuniqueprefix Find a prefix character string which is different from all the names currently in use within the SLP problemXSLPsetuserfuncaddress Change the address of a user functionXSLPsetuserfuncinfo Set up the argument information array for a user function callXSLPsetuserfuncobject Set or define one of the objects which can be accessed by the user functionsXSLPtime Print the current date and timeXSLPtokencount Count the number of tokens in a free-format character stringXSLPtoVBString Return a string to VB given its address in Xpress-SLPXSLPuprintmemory Print the dimensions and memory allocations for a problemXSLPvalidate Validate the feasibility of constraints in a converged solutionXSLPvalidformula Check a formula in internal (parsed or unparsed) format for unknown tokensXSLPwriteprob 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.