[ library(gfd) | Reference Manual | Alphabetic Index ]

# <ConsistencyModule:> xor(+ConX,+ConY,Bool)

Bool is the reified truth of one of the constraints ConX or ConY being true.

ConX
  Constraint
ConY
  Constraint
Bool
  Reified truth value of the constraint (array notation accepted)

## Description

Equivalent to BX #= (ConX), BY #= (ConY), Bool #= (BX + BY #= 1)

The two constraints are reified in such a way that Bool reflects the truth of one (and only one) being true. ConX and ConY must be constraints that have a corresponding reified form.

ConsistencyModule is the optional module specification to give the consistency level for the propagation for this constraint: gfd_bc for bounds consistency, and gfd_gac for domain (generalised arc) consistency.

This constraint is implemented using Gecode's MiniModel's rel() for both integer and boolean expressions, with sub-expressions/constraints not supported by MiniModel factored out and posted as auxiliary constraints.

A more restricted version of this constraint is defined in the global constraint catalog as 'xor', in that the reified truth value is the logical exclusive disjunction of 0/1 variables rather than constraints.

### Modules

This predicate is sensitive to its module context (tool predicate, see @/2).

## See Also

or / 2, neg / 2, and / 3, xor / 3, => / 3, <=> / 3, suspend : =< / 3, suspend : #\= / 3, ic : #\= / 3, fd : #\= / 3