3.7.132. Logigraphe

A constraint which can be used for modelling the logigraphe problem. The logigraphe problem, see FigureΒ 3.7.29 for an instance taken fromΒ [Pitrat08], consists of colouring a board of squares in black or white, so that each row and each column contains a specific number of sequences of black squares of given size. A sequence of integers ${s}_{1},{s}_{2},...,{s}_{m}$ $\left(p\beta ₯1\right)$ enforces:

• a first block of ${s}_{1}$ consecutive black squares,

• a second block of ${s}_{2}$ consecutive black squares,

• .............................................,

• a last block of ${s}_{p}$ consecutive black squares.

Each block of consecutive black squares must be separated by at least one white square. Finally, white squares may eventually precede (respectively follow) the first (respectively the last) block of black squares. The logigraphe problem is NP -complete

PartΒ (A) of FigureΒ 3.7.29 shows an instance of a logigraphe and the corresponding initial deductions achieved after posting the $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi }_\mathrm{\pi \pi \pi \pi }$ constraints associated with each row and each column. We assume that each constraint achieves arc-consistency, which is actually the case when the $\mathrm{\pi \pi \pi \pi \pi \pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi \pi \pi \pi \pi }_\mathrm{\pi \pi }_\mathrm{\pi \pi \pi \pi }$ constraint is represented as a counter free automaton. A white or black square indicates an initial deduction (i.e.,Β setting a variable to 0 or to 1). PartΒ (B) of FigureΒ 3.7.29 provides the unique solution found after developing three choices,Each time we try to assign a value to a not yet fixed variable, the number of choices is incremented by 1 just before making the assignment. assuming that variables are assigned from the uppermost to the lowermost row. Within a given row, variables are assigned from the leftmost to the rightmost column. Value 0 is tried first before value 1. Seven additional choices are required for proving that this solution is unique. FigureΒ 3.7.30 displays the corresponding search tree. Within this figure, a variable ${V}_{i,j}$ $\left(1\beta €i,j\beta €10\right)$ denotes the 0-1 variable associated with the ${i}^{th}$ row and the ${j}^{th}$ column of the board.