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

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

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

Description

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.

Examples

```[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

```
{"ft_lang_label":"__label__en","ft_lang_prob":0.8474473,"math_prob":0.98552626,"size":1637,"snap":"2019-26-2019-30","text_gpt3_token_len":382,"char_repetition_ratio":0.16105327,"word_repetition_ratio":0.01746725,"special_character_ratio":0.25839952,"punctuation_ratio":0.18484849,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.966569,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-06-19T08:55:27Z\",\"WARC-Record-ID\":\"<urn:uuid:60a1ba70-01f4-4c73-8f55-4c9ed11dd8eb>\",\"Content-Length\":\"3449\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:421ce072-ba81-4dea-82f7-b69aefad4df5>\",\"WARC-Concurrent-To\":\"<urn:uuid:f5bdbd60-31a8-48fc-9292-841f56fc9afc>\",\"WARC-IP-Address\":\"87.230.21.58\",\"WARC-Target-URI\":\"http://eclipseclp.org/doc/bips/lib/gfd/table-3.html\",\"WARC-Payload-Digest\":\"sha1:HPPW653W6K62YTWYRZUNSKNFID2WQK3D\",\"WARC-Block-Digest\":\"sha1:CMQZXCNYYXW4LKX3RETES6LXEOKFOIEW\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-26/CC-MAIN-2019-26_segments_1560627998943.53_warc_CC-MAIN-20190619083757-20190619105757-00239.warc.gz\"}"}