Initializing help system before first use

XSLPsetuserfuncobject

XSLPsetuserfuncobject


Purpose
Set or define one of the objects which can be accessed by the user functions
Synopsis
int XPRS_CC XSLPsetuserfuncobject(XSLPprob Prob, int Entity, void *Address);
Arguments
Prob 
The current SLP problem.
Entity 
An integer indicating which object is to be defined. The value is interpreted as follows:
The Global Function Object;
n > 0 
The User Function Object for user function number n;
n < 0 
The Instance Function Object for user function instance number -n.
Address 
The address of the object.
Example
The following example sets the Global Function Object. It then sets the User Function Object for the function ProfitCalcs.
double *GlobObj;
void *ProfitObj;
int iUF;

XSLPsetuserfuncobject(Prob, 0, GlobObj);

if (!XSLPgetindex(Prob, XSLP_USERFUNCNAMESNOCASE,
             "ProfitCalcs", &iUF)) {
  XSLPsetuserfuncobject(Prob, iUF, ProfitObj);
}
The function objects can be of any type. The index of the user function is obtained using the case-insensitive search for names. If the name is not found, XSLPgetindex returns a nonzero value.
Further information
As instance numbers are not normally meaningful, this function should only be used with a negative value of n to reset all Instance Function Objects to NULL when a model is being re-optimized within the same program execution.
Related topics