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

<ConsistencyModule:> mem(+Vars,?Member,?Bool)

Reflect into Bool the truth of Member being a member element of Vars.
Vars
Collection (a la collection_to_list/2) of (domain) variables or integers (NOT arbitrary expressions)
Member
Member element of Vars (domain variable or integer, array notation accepted)
Bool
Reified truth value (0/1 integer or (domain) variable, array notation accepted)

Description

Reified form of the mem/2 constraint, which constrains Member to be one of the elements in Vars.

This constraint is implemented by Gecode's member() constraint (reified version).

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

Examples

[eclipse 11]: A :: 1..10, B :: 2..20, mem([A,B], M, Bool), M #< 2.

A = A{[1 .. 10]}
B = B{[2 .. 20]}
M = M{[-1000000 .. 1]}
Bool = Bool{[0, 1]}


Delayed goals:
        gfd : gfd_do_propagate(gfd_prob(nvars(4)))
Yes (0.00s cpu)
[eclipse 12]: A :: 1..10, B :: 2..20, mem([A,B], M, Bool), M #< 2, Bool = 1.

A = A{[1 .. 10]}
B = B{[2 .. 20]}
M = 1
Bool = 1

[eclipse 13]: A :: 1..10, B :: 2..20, mem([A,B], M, Bool), M #< 2, Bool = 0.

A = A{[1 .. 10]}
B = B{[2 .. 20]}
M = M{[-1000000 .. 1]}
Bool = 0

See Also

mem / 2, eclipse_6 : collection_to_list / 2, lists : collection_to_list / 2