XSLPchgxvitem
PurposeAdd or change an item of an existing XV in an SLP problemSynopsisint XPRS_CC XSLPchgxvitem(XSLPprob Prob, int nSLPXV, int nXVitem, int Parsed, int *VarType, int *VarIndex, int *IntIndex, double *Reserved1, double *Reserved2, int *Reserved3, int *Type, double *Value);Arguments
Prob The current SLP problem. nSLPXV index of the XV. nXVitem index of the item in the XV. If this is zero then a new item will be added to the end of the XV. Parsed integer indicating whether the formula of the item is in internal unparsed format (Parsed=0) or internal parsed (reverse Polish) format (Parsed=1). VarType Address of an integer holding the token type of the XV variable. This can be zero (there is no variable), XSLP_VAR, XSLP_CVAR or XSLP_XV. VarIndex Address of an integer holding the index within the VarType of the XV variable. IntIndex Address of an integer holding the index within the Xpress-SLP string table of the internal variable name. Zero means there is no internal name. Reserved1 Reserved for future use. Reserved2 Reserved for future use. Reserved3 Reserved for future use. Type Integer array of token types to describe the value or formula for the XVitem. Value Double array of values corresponding to Type, describing the value or formula for the XVitem.ExampleThe following example adds two items to XV number 4. The first is column number 25, the second is named "SQ" and is the square root of column 19.int n, CType, VarType, VarIndex, IntIndex, Type[4]; double Value[4]; XSLPgetintcontrol(Prob, XPRS_CSTYLE, &CStyle); VarType = XSLP_VAR; VarIndex = 25 + CType; XSLPchgxvitem(Prob, 4, 0, 1, &VarType, &VarIndex, NULL, NULL, NULL, NULL, NULL, NULL); n = 0; Type[n] = XSLP_COL; Var[n++] = 19; Type[n] = XSLP_CON; Var[n++] = 0.5; Type[n] = XSLP_OP; Var[n++] = XSLP_EXPONENT; Type[n++] = XSLP_EOF; VarType = 0; XSLPsetstring(Prob,"SQ",&IntIndex); XSLPchgxvitem(Prob, 4, 0, 1, &VarType, NULL, &IntIndex, NULL, NULL, NULL, Type, Value);Note that columns used as XVitems are specified as XSLP_VAR which always counts from 1. XSLP_COL can be used within formulae. The formula is provided in parsed (reverse Polish) format (Parsed=1) which is more efficient than the unparsed form.Further informationThe XVitems for an XV will always be used in the order in which they are added.
A NULL value for any of the addresses will leave the existing value unchanged. If the XVitem is new, the default value will be used.
If VarType is zero (meaning that the XVitem is not a variable), then VarIndex is not used. If the variable is a column, do not use a VarType of XSLP_COL — use XSLP_VAR instead, and adjust the index if necessary.
The formula in Type and Value must be terminated by an XSLP_EOF token.
Related topics
If you have any comments or suggestions about these pages, please send mail to docs@dashoptimization.com.