More on the Logical Equivalence Operator

As a top level constraint, 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 constraint states that if the quantity of [A]>2, then [B] is required.

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

This expression constrains the solution as follows:

  • If there are more than two A's in the solution, there must be at least one B.

  • If there cannot be any B's in the solution, there cannot be any more than two A's.

  • If B is in the solution, there must be more than two A's.

  • If A is limited to two or less, B is excluded.