XSLPloadformulas
XSLPloadformulas |
Purpose
Load non-linear formulas into the SLP problem
Synopsis
int XPRS_CC XSLPloadformulas(XSLPprob Prob, int nFormula, int *RowIndex, int *FormulaStart, int Parsed, int *Type, double *Value);
Arguments
Prob
|
The current SLP problem.
|
nFormula
|
Number of non-linear coefficients to be loaded.
|
RowIndex
|
Integer array holding index of row for the coefficient.
|
FormulaStart
|
Integer array of length
nFormula+1 holding the start position in the arrays
Type and
Value of the formula for the coefficients.
FormulaStart[nFormula] should be set to the next position after the end of the last formula.
|
Parsed
|
Integer indicating 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 formula for each coefficient.
|
Value
|
Array of values corresponding to the types in
Type.
|
Example
Assume that the rows and columns of
Prob are named
Row0,
Row1 ...,
Col0,
Col1 ... The following example adds coefficients representing:
Col2 * Col3 * Col6 ˆ2 into Row1 and
Col2 * Col3 ˆ 2 into Row3.
Col2 * Col3 * Col6 ˆ2 into Row1 and
Col2 * Col3 ˆ 2 into Row3.
int RowIndex[3], FormulaStart[4], Type[8]; int n, nFormula; double Value[8]; RowIndex[0] = 1; RowIndex[1] = 1; RowIndex[2] = 3; n = nFormula = 0; FormulaStart[nFormula++] = n; Type[n] = XSLP_COL; Value[n++] = 3; Type[n++] = XSLP_EOF; FormulaStart[nFormula++] = n; Type[n] = XSLP_COL; Value[n++] = 2; Type[n] = XSLP_COL; Value[n++] = 3; Type[n] = XSLP_OP; Value[n++] = XSLP_MULTIPLY; Type[n] = XSLP_COL; Value[n++] = 6; Type[n] = XSLP_CON; Value[n++] = 2; Type[n] = XSLP_OP; Value[n++] = XSLP_EXPONENT; Type[n] = XSLP_OP; Value[n++] = XSLP_MULTIPLY; Type[n++] = XSLP_EOF; FormulaStart[nFormula++] = n; Type[n] = XSLP_COL; Value[n++] = 2; Type[n] = XSLP_COL; Value[n++] = 3; Type[n] = XSLP_CON; Value[n++] = 2; Type[n] = XSLP_OP; Value[n++] = XSLP_EXPONENT; Type[n] = XSLP_OP; Value[n++] = XSLP_MULTIPLY; Type[n++] = XSLP_EOF; FormulaStart[nFormula] = n; XSLPloadformulas(Prob, nFormula, RowIndex, FormulaStart, 1, Type, Value);
Further information
Formula j is made up of a list of tokens in Type and Value starting at FormulaStart[j]. The tokens follow the rules for parsed or unparsed formulae as indicated by the setting of Parsed. The formula must be terminated with an XSLP_EOF token. If several formulas share the same nonlinear expressions, they can have the same value in FormulaStart. For possible token types and values see the chapter on Xpress NonLinear Formulae.
The XSLPload... functions load items into the SLP problem. Any existing items of the same type are deleted first. The corresponding XSLPadd... functions add or replace items leaving other items of the same type unchanged.
Related topics
XSLPgetformulatext,
XSLPaddformulas,
XSLPchgformulatext,
XSLPchgformula,
XSLPloadformulas,
XSLPgetformularows,
XSLPgetformula,
XSLPdelformulas