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

# sequence_total(+Min, +Max, +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, and the total occurrences of 1 in ZeroOnes is between Min and Max

Min
  Non-negative integer
Max
  Positive integer
Low
  Non-negative integer
High
  Positive integer
K
  Postive integer
ZeroOnes
  A list 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, and at least Min and at most Max in total for all 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_total/7 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_total / 7, ic : element / 3, ic_global_gac : sequence / 4, ic_global_gac : sequence / 5