Accumulator Rules

Accumulator Rules are a rule type that enables end-user selections to add to or subtract from a value from a variable at run time.

For example, when the end user selects the 512 MB RAM option you want to add 512 to a Total called Total RAM Selected.

Background

Accumulator Rules can only have a Rule Class of Constraint. They can't be classified as Defaults or Search Decisions.

Numeric rules express constraints between parts of a Model in terms of numeric relationships. Use Numeric rules to enable end-user selections to contribute to or consume from a numeric feature or option quantity.

If you create a statement rule with a Rule Class of either Defaults or Search Decision, and the rule's text defines an Accumulator rule (meaning that it uses either the Add or Subtract operators), then Configurator displays a message similar to this message when you validate the rule: The rules of the rule class <RULE_CLASS> may not contain the accumulator operators <ADDTO> or <SUBTRACTFROM>.

It is important to understand that Accumulator Rules don't simply add or subtract a quantity from a variable. All rules of this type defined against the same target node can be considered terms in a constraint against that node. This is because all addition and subtract expressions in a Model become a single constraint on the target node. In other words, the target node equals the sum of all addition expressions defined against it in the Model minus the sum of the SubtractFrom expressions.

Additionally, if the target node is involved in any other constraints, the equality constraint generated by its addition and subtraction expressions must be satisfied along with all the others. As with all other constraints, the equality constraint is bidirectional, so it can "push back" on the values of the participants on the left-hand-side of the rule.

Keep the following in mind when using Accumulator Rules:

  • If the Model contains more than one accumulator rule that adds to or subtract from the same target node, and that node exists in a referenced Model, generating logic creates a single constraint that equates the target to a sum of all the terms expressed in the individual rules in that model.

    If addition or subtraction rules are defined against a given target within more than one parent model in a reference model hierarchy, each of the generated equality constraints must be satisfied individually. In other words, the addition and subtraction terms are not accumulated across more than one referencing model.

  • When a numeric rule compares two decimal values, they may be interpreted as not being equal even when they're, due to their representation by the Java double data type. The decimal tolerance value (also referred to as epsilon value) is set to 0.000000001 (scale of 9), which will then be used by the configurator engine to convert the decimal comparison to a mathematical equation for evaluation.For example, the expression a=b could be converted to Abs(a-b) <= epsilon. This would give an accurate result as long as the scale is less than or equal to the number of decimal digits specified in the epsilon (the decimal tolerance value, which is 0.000000001).

Procedure

To create an Accumulator Rule::

  1. Create a Rule of type Statement Rule.

  2. Enter the text of the Statement Rule, using the addition or subtraction operator according to the following syntax:

    ADD n TO x

    or

    SUBTRACT n FROM x

    Where n is a number and x is a numeric feature.