XSLPaddxvs


Purpose
Add a set of extended variable arrays (XVs) to an SLP problem
Synopsis
int XPRS_CC XSLPaddxvs(XSLPprob Prob, int nSLPXV, int *XVStart, int Parsed, int *Type, double *Value);
Arguments
Prob 
The current SLP problem.
nSLPXV 
Number of XVs to be added.
XVStart 
Integer array of length nSLPXV+1 holding the start position in the arrays Type and Value of the formula or value data for the XVs. XVStart[nSLPXV] should be set to one after the end of the last XV.
Parsed 
Integer indicating the whether the token arrays are formatted as internal unparsed (Parsed=0) or internal parsed reverse Polish (Parsed=1).
Type 
Array of token types providing the description and formula for each XV item.
Value 
Array of values corresponding to the types in Type.
Example
The following example adds two XVs to the current problem. The first XV contains two items: columns 3 and 6, named "Temperature" and "Pressure" respectively. The second XV has four items: column 1, the constant 1.42, the square of column 3, and column 2.
int n, CType, TempIndex, PressIndex, XVStart[3], Type[10];
double Value[10];

XSLPgetintcontrol(Prob,XSLP_CTYPE,CType);
n = 0;
XSLPsetstring(Prob,&TempIndex,"Temperature");
XSLPsetstring(Prob,&PressIndex,"Pressure");

XVStart[0] = n;
Type[n] = XSLP_XVVARTYPE;  Value[n++] = XSLP_VAR;
Type[n] = XSLP_XVVARINDEX; Value[n++] = 3 + CType;
Type[n] = XSLP_XVINTINDEX; Value[n++] = TempIndex;
Type[n++] = XSLP_EOF;
Type[n] = XSLP_XVVARTYPE;  Value[n++] = XSLP_VAR;
Type[n] = XSLP_XVVARINDEX; Value[n++] = 6 + CType;
Type[n] = XSLP_XVINTINDEX; Value[n++] = TempIndex;
Type[n++] = XSLP_EOF;

XVStart[1] = n;
Type[n] = XSLP_XVVARTYPE;  Value[n++] = XSLP_VAR;
Type[n] = XSLP_XVVARINDEX; Value[n++] = 1 + CType;
Type[n++] = XSLP_EOF;
Type[n] = XSLP_CON;        Value[n++] = 1.42;
Type[n++] = XSLP_EOF;
Type[n] = XSLP_VAR;       Value[n++] = 3 + CType;
Type[n] = XSLP_CON;       Value[n++] = 2;
Type[n] = XSLP_OP;        Value[n++] = XSLP_EXPONENT;
Type[n++] = XSLP_EOF;
Type[n] = XSLP_VAR;       Value[n++] = 2 + CType;
Type[n++] = XSLP_EOF;

XVStart[2] = n;
XSLPaddxvs(Prob, 2, XVStart, 1, Type, Value);

When a variable is used directly as an item in an XV, it is described by two tokens: XSLP_XVVARTYPE and XSLP_VARINDEX. When used in a formula, it appears as XSLP_VAR or XSLP_COL.

Note that XSLP_COL cannot be used in an XSLP_XVVARINDEX; instead, use the setting of XPRS_CTYPE to convert it to a value which counts from 1, and use XSLP_VAR.

Because Parsed is set to 1, the formulae are written in internal parsed (reverse Polish) form.


Further information

The token type and value arrays Type and Value are formatted in a similar way to the unparsed internal format function stack. For possible token types and values see the chapter on "Formula Parsing". Each formula must be terminated by an XSLP_EOF token.

The XSLPadd... functions load additional items into the SLP problem. The corresponding XSLPload... functions delete any existing items first.


Related topics
XSLPchgxv, XSLPgetxv, XSLPloadxvs


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