Formulas
Each formula has the following form:
identifier = expression
A formula consists of an identifier (the formula name, also referred to as the left-hand side) followed by “=” followed by an expression (referred to as the formula’s expression or the right hand side). Each formula ends with a line break.
When the cost engine evaluates a formula, it does the following:
Evaluates the formula’s expression. (See Expressions for information on expression evaluation.)
Assigns the result of the expression evaluation to the formula’s identifier.
The cost engine, in the course of evaluating a formula’s expression, sometimes evaluates other formulas. In particular, if the expression contains an identifier that is not one of the current module’s input identifiers, the cost engine determines the identifier’s value by evaluating the rule or formula (in the current module) that has this identifier as its name.
When the cost engine evaluates a module, it evaluates the following formulas:
All the module’s output formulas, that is, all formulas whose left-hand side is an output identifier
All formulas in the module’s set blocks
All the module’s formulas whose left-hand side appears as an identifier in an expression that the cost engine evaluates.
The cost engine evaluates only these formulas. Some formulas in a module might not be evaluated.
(The cost engine caches the results of formula evaluation, so that it typically evaluates each formula at most once during evaluation of a given module.)
See the following sections for information on each syntactic category mentioned above: