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

sequence(+Low, +High, +K, +ZeroOnes)

The number of occurrences of the value 1 is between Low and High for all sequences of K variables in ZeroOnes
Low
Non-negative integer
High
Positive integer
K
Postive integer
ZeroOnes
A collection of 0/1 variables or integers

Description

This constraint ensures that the number of occurrences of the value 1 is at least Low and at most High for all sequences of K consecutive variables/values in ZeroOnes. ZeroOnes are 0/1 variables (or integers), i.e. they have the domain [0,1].

The ZeroOnes can be interpreted as the fulfillment of various conditions if the variables are linked to these conditions. For example, sequence/5 is implemented by linking the N ZeroOnes variables to a matching collection of N finite domain `original' variables using element/3 constraints to constrain the ZeroOnes to be 1 if the corresponding original value takes one of the specified values. The ZeroOnes can then be used in further constraint reasoning.

This is currently a prototype -- the constraint has not been tested very extensively and little effort has been spent to optimise performance. We welcome any feedback on using this constraint.

See Also

sequence / 5, ic : element / 3, ic_global : sequence_total / 6, ic_global : sequence_total / 7