<< Prev | - Up - |

**Exercise 7.1** (See solution)

Magic Sequence

A magic sequence of length is a sequence

of integers such that for every

is an integer between 0 and .

the number occurs exactly times in the sequence.

Write a parameterized script that, given , can enumerate all magic sequences of length .

The script should use the procedure

`{FD.exactly`

K

S

I`}`

that creates a propagator for the constraint saying that exactly

Kfields of the recordSare equal to the integerI.You can drastically reduce the search space of the script by having propagators for the redundant constraints

and

Explain why these constraints are redundant.

<< Prev | - Up - |

Christian Schulte and Gert Smolka

Version 1.4.0 (20080702)