SLPDATA("UF")
PurposeSynopsisprocedure SLPDATA(UF:string, Name:string, fName:string, ArgList:string, fType:string [,Param1:string] [,Param2:string] [,Param3:string])
Arguments
UF string containing "UF", indicating the SLPDATA type Name name of the function (as used within a Func expression) fName name of the function to be used when it is called. This may be different from Name (for example, it may be decorated or have a special prefix). fName can be left blank if it is the same as Name. ArgList list of the argument types to the function, as described in the Xpress-SLP Reference Manual. These must match exactly the declaration of the function. fType the function type as described in the Xpress-SLP Reference Manual. Possible types are:
- DLL
- Compiled in an external library or DLL
- XLS
- Excel spreadsheet with optional macro
- XLF
- Excel macro
- VB
- Visual basic
- COM
- COM
- MOSEL
- Mosel function in the current model
Param1-3 optional strings giving additional parameter information as required by the particular function type. Details are in the Xpress-SLP Reference Manual.ExampleThe following defines the user function PolyArea as an Excel spreadsheet (type XLS) on Sheet1 of C:\Progs\Polycalc.xls (notice the use of the single quote to surround the string, because "\" has a special meaning). It takes two arguments, both as arrays of type VARIANT: the list of input values and the Function Information Array.SLPDATA("UF", "PolyArea", "" , "VARIANT,VARIANT", "XLS", 'C:\Progs\Polycalc.xls', 'Sheet1')The following defines the user function myUF as a C or Fortran routine in an external library (type DLL) in file myProgLib. It takes two arguments: the list of input values as an array of type DOUBLE (Mosel type real) and the Function Information Array as an array of type INTEGER.SLPDATA("UF", "myUF", "DOUBLE,INTEGER", "", "DLL", "myProgLib")The final example is similar, except that the function will be used as an external callback function. In such a case, the linkage is determined by the type of callback, and is not provided through the SLPDATA procedure.SLPDATA("UF", "myCB", "", "", "DLL", "myProgLib")The callback itself can then be defined using the SLPsetcallback procedure.SLPsetcallback(xslp_iterstart, "myCB")Further informationThis procedure defines a user function for use in the Xpress-SLP optimization process. Once a function has been defined, it can be used in Func expressions. Because there is no "forward declaration" of user functions, you must put any SLPDATA procedures which define user functions at the beginning of the model.
The SLPDATA procedure is also used to define external functions for use as callbacks. In this form, the ArgList string is empty, because the arguments required are determined by the nature of the callback. The function type and any other appropriate parameters (for example, the location of the function) are still required.
If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.