XSLPparsecformula
| XSLPparsecformula | 
  Purpose
 
 Parse a formula written as a character string into internal parsed (reverse Polish) format
 
  Synopsis
 
int XPRS_CC XSLPparsecformula(XSLPprob Prob, char *Formula, int *nToken, int *Type, double *Value);
 
  Arguments
 
| 
     Prob 
     | 
     The current SLP problem.
     | 
| 
     Formula 
     | 
     Character string containing the formula, written in the same free-format style as used in formulae in Extended MPS format, with spaces separating tokens.
     | 
| 
     nToken 
     | 
     Address of an integer to receive the number of tokens in the parsed formula (not counting the terminating
     XSLP_EOF token). May be
     NULL if not required.
     | 
| 
     Type 
     | 
     Array of token types providing the parsed formula.
     | 
| 
     Value 
     | 
     Array of values corresponding to the types in
     Type.
     | 
  Example
 
 Assuming that
 x and
 y are already defined as columns, the following example converts the formula "sin(x+y)" into internal parsed format, and then writes it out as a sequence of tokens.
 
int n, Type[20];
double Value[20];
XSLPparsecformula(Prob, "sin ( x + y )", NULL, Type, Value);
printf("\n");
for (n=0;Type[n] != XSLP_EOF;n++) {
  XSLPitemname(Prob, Type[n], Value[n], Buffer);
  printf(" %s", Buffer);
}
  Further information
 
Tokens are identified by name, so any columns or user functions which appear in the formula must already have been defined. Unidentified tokens will appear as type XSLP_UNKNOWN.
  Related topics
 
 
