Product Administration Guide > Configuration Rule Assembly Language >

Boolean Operators


When you specify this type of operator, the eConfigurator engine interprets it as true when the item is in the solution, and as false if the item is not in the solution. If you specify a resource or an arithmetic sub-expression as an operand, the eConfigurator engine interprets it as true if the expression is greater than zero, and false if the expression is less than or equal to zero.

The requires operator (req()) is an example of this type of operator. The eConfigurator engine interprets the following rule to mean item A requires item B. In other words, if A is in the solution, B must be in the solution.

req([A], [B])

The eConfigurator engine does not interpret this rule to mean the current quantity of item A requires the same quantity of item B. That rule would be written as follows:

==([A], [B])

The Boolean operators are shown in Table 37.

Table 37.  Boolean Operators
Operator
Syntax               
Properties
Not
!(A)
Logical negation. True when A is false and false when A is true. A can be an item or sub-expression.
Requires
req(A, B)
A implies B. False only when A is true and B is false. B does not require A. However, excluding B, excludes A. A and B can be items or sub-expressions.
Excludes
excl(A, B)
A excludes B and B excludes A. Same as "not both A and B." False only when A and B are both true. A and B can be items or sub-expressions.
And
and(A, B)
Both A and B. True only when both A and B are true. When used as a top-level constraint, means that only solutions where both A and B are true are allowed. A and B can be items or sub-expressions.
Inclusive Or
or(A, B)
Either A or B or both. False only when both A and B are false. A and B can be items or sub-expressions.
Exclusive Or
xor(A, B)
A or B but not both. A and B must have opposite truth states. False when A and B are either both true or both false. A and B can be items or sub-expressions.
Logically Equivalent
eqv(A, B)
A requires B and B requires A. True only when A and B are either both true or both false. A and B can be items or sub-expressions.

Table 38 provides the truth-state definition of how the Boolean operators work. The first two columns contain the operands A and B. These could be items or arithmetic expressions, in which case A>0 means that A is in the solution.

Table 38.  Truth Table for Boolean Operators
A >0?
B>0?
req(A, B)
excl(A, B)
and(A, B)
or(A, B)
xor(A, B)
eqv(A, B)
T
T
T
F
T
T
F
T
T
F
F
T
F
T
T
F
F
T
T
T
F
T
T
F
F
F
T
T
F
F
F
T

More on the Requires Operator

The requires operator is not an incremental add. For example, you write the rule req(A, B). If the user picks A and there are no B's in the solution, the eConfigurator engine will add at least one B. The next time the user picks A, the engine does not add another B.

If you want to add a B each time an A is added, use the inc() operator.

More on the Logical Equivalence Operator

As a top level rule, the logical-equivalence operator (eqv()) creates a mutually-requires relationship between its operands. The operands can be either items or sub-expressions. For example eqv([A], [B]) means than if item A is in the solution, then at least one item B must be in the solution. Also, if item B is in the solution, then at least one item A must be in the solution. Note that the relationship between [A] and [B] is noncumulative. (Use the inc() operator to create cumulative-requires relationships.)

For example, the following rule states that if the quantity of [A]>2, then [B] is required.

eqv(>([A],2),[B])

This expression constrains the solution as follows:

More on the Excludes Operator

As a top-level rule, the excludes operator (excl(A, B)) creates a mutually exclusive relationship. The expression excl([A], [B]) means that if item A is in the solution, item B cannot be in the solution. It also means that if item B is in the solution, item A cannot be in the solution.

The exclude rule can also be used with sub-expressions. For example, the following rule excludes item B when item A's quantity is greater than 2. It also prevents item A from being greater than 2 when item B is in the solution.

excl(>([A],2),[B])

Multiple Operands for Require and Exclude Operators

You can use multiple operands in requires and exclude rules. For example, you could write the following rule:

excl([A],[B],[C])

This syntax is interpreted by the eConfigurator engine as if you had written two rules:

excl([A],[B])

excl([A],[C])

In other words, [A] excludes both [B] and [C]. Note that [A] is the first operand in both the rules. The eConfigurator takes the first operand and creates expressions between it and each remaining operands.

This works the same way for require rules:

req([A],[B],[C])

This syntax is interpreted by the eConfigurator engine as if you had written two rules:

req([A],[B])

req([A],[C])

In other words, [A] requires both [B] and [C]. There is no limitation on the number of operands you can use in this type of expression.


 Product Administration Guide 
 Published: 23 June 2003