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

precede(++Values, +Collection)

Constrains each value in Values to precede its succeeding value in Collection
Values
Collection of integers
Collection
Collection of integers or (domain) variables

Description

Constrains the first appearance of every value of the ordered collection of integers in Values to precede the first appearance of the next value in Values in the ordered collection of elements in Collection, i.e. the precede/3 constraint to hold for every adjacent integers in Values.

This constraint is known as int_value_precede_chain in the Global Constraint Catalog, and is implemented using Gecode's precede() constraint (variant with IntArg argument for Values).

Examples

[eclipse 18]: precede([4,0,1], [4,0,6,1,0]).   % succeed
[eclipse 19]: precede([4,0,1], [4,0,6,1,0]).  % succeed
[eclipse 20]: precede([4,0,1], [4,1,6,1,0]).   % fail

[eclipse 21]: precede([4,0,1], [A,B,C,D,E]).

A = A{[-1000000 .. -1, 2 .. 1000000]}
B = B{[-1000000 .. 0, 2 .. 1000000]}
C = C{[-1000000 .. 1000000]}
D = D{[-1000000 .. 1000000]}
E = E{[-1000000 .. 1000000]}

See Also

precede / 3, eclipse_6 : collection_to_list / 2, lists : collection_to_list / 2