[ library(gfd) | Reference Manual | Alphabetic Index ]
# <ConsistencyModule:> bool_channeling(?Var, +DomainBools, +Min)

Channel the domain values of Vars to the 0/1 boolean variables in DomainBools
*Var*
- A (domain) variable (array notation accepted)
*DomainBools*
- A collection of N 0/1 (domain) variables or integers
*Min*
- An integer

## Description

Var is a domain variable whose initial interval is Min..(Min+N),
and this constraint links the domain values of Var with the N 0/1
variables in DomainBools such that the i'th variable in DomainBools
represents the value Min+i, and its value is 0 if the value is not in
Var's domain, and 1 if Var is assigned the value [Thus, only one variable
in DomainBools can take the value 1].

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

A variant of this constraint, called 'domain_constraint' is in the global
constraint catalog. There, instead of having DomainBools and Min, there
is a collection of Value-Bool pairs, representing a possible domain value
and its associated 0/1 variable. This constraint is implemented using
Gecode's channel() constraint (variant with BoolVarArgs and IntVar).

## Examples

[eclipse 53]: bool_channeling(V, [0,1,1,0,1,0,0], 3). % fail
[eclipse 54]: bool_channeling(V, [0,0,1,0,0,0,B], 3).
V = 5
B = 0
[eclipse 55]: bool_channeling(V, [B1,B2,B3,B4,B5], 6), B4 = 0.
V = V{[6 .. 8, 10]}
B1 = B1{[0, 1]}
B2 = B2{[0, 1]}
B3 = B3{[0, 1]}
B4 = 0
B5 = B5{[0, 1]}

## See Also

fd_global : bool_channeling / 3, ic_global : bool_channeling / 3