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

<ConsistencyModule:> table(+Vars, ++Table, +Option)

Constrain Vars' solutions to be those defined by the tuples in Table.
Collection of N (domain) variables or integers, or a collection of a collection of N (domain) variables or integers.
Collection of tuples, each of which is a collection of N integer values
the atom 'mem' or 'speed' or 'default'


table is a user defined constraint, i.e. the solutions for the each posted constraint is explicitly defined within the constraint. Each table constraint specifies the solutions to N variables, with all the solutions for this constraint specified in Table, in the form of tuples, each of N values that is one solution to the constraint.

Vars represents the variables that are to be satisfied for this constraint. It can be one collection of N variables (or integers), or a collection of a collections of N variables (or integers), if the constraint is to be satisfied by more than one collection of variables. Posting the constraint with multiple collections of variables is logically equivalent to posting individual table constraint with the same Table for each collection, but should be more efficient as the same Table is shared by all the collections.

Option currently allows the selection of algorithm to use for the propagation: mem for an algorithm that prefer smaller memory consumption over amount of computation, speed for an algorithm that prefer reducing computation over memory consumption, and default for the default algorithm (as defined by Gecode). Note that table/2 is mapped to table/3 with Option set to default.

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).

This constraint is known as in_relation in the global constraint catalog, with the allowance for multiple collections of variables taken from SICStus Prolog's table/2 constraint. This constraint is implemented in Gecode as the extensional() constraint with the variant that takes a TupleSet as an argument.


[eclipse 9]: table([5,3,3], [[](5,2,3),[](5,2,6),[](5,3,3)], speed).  % succeed
[eclipse 10]: table([[5,3,3],[5,2,3]],  
                     [[](5,2,3),[](5,2,6),[](5,3,3)], default).       % succeed

[eclipse 11]: table([5,3,2], [[](5,2,3),[](5,2,6),[](5,3,3)], mem).   % fail

See Also

table / 2