Compound Logic and Comparison Operators in Configuration Constraints

Both Compound Logic and Comparison operators test for the truth of their operands and are described in the following table. They return a true or false rather than a quantity.

Compound Logic operators, such as AND, NOT, OR, are used to link expressions together when creating a constraint. For example: (Condition A AND Condition B) requires Item C. Compound Logic operators are also called Boolean operators.

Operator Example Description

NOT

! (A) 

Logical negation. True when A is false and false when A is true. A can be an item or sub-expression.

AND

A AND 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.

OR

A OR 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

A XOR 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.

NOT AND

! (A AND B)

Converse of A AND B. False only when both A and B are true. When used as a top-level constraint, means that A and B cannot both be present. A and B can be items or sub-expressions.

Comparison operators compare their operands and return a true or false and are described in the following table. In the following constraint, when the quantity of item A is less than item B (when the comparison is true), then item C is required.

(Item A < Item B) requires C

If you specify an item as an operand in a comparison, the quantity of the item in the solution is used to make the comparison. If you specify an expression as an operand, the expression must resolve to a number.

If you specify an expression that resolves to true or false, then true is assigned the value 1 and false is assigned the value 0.

Operator Example Description

Greater than

A > B

A is greater than B

Not less than

A >= B

A is greater than or equal to B

Equals

A == B

A equals B

Equals (compound)

A==B==C==D

True if A=B AND A=C And A=D

Not equal to

A <> B

A does not equal B

Not greater than

A <= B

A is less than or equal to B

Less than

A < B

A is less than B

When you are building a constraint, you can compound the comparison operators. For example, you could build the following expression:

(A>B>C>D)

This expression is equivalent to the following expression:

A>B AND A>C AND A>D