### 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\ge 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{𝚌𝚘𝚗𝚜𝚎𝚌𝚞𝚝𝚒𝚟𝚎}_\mathrm{𝚐𝚛𝚘𝚞𝚙𝚜}_\mathrm{𝚘𝚏}_\mathrm{𝚘𝚗𝚎𝚜}$ constraints associated with each row and each column. We assume that each constraint achieves arc-consistency, which is actually the case when the $\mathrm{𝚌𝚘𝚗𝚜𝚎𝚌𝚞𝚝𝚒𝚟𝚎}_\mathrm{𝚐𝚛𝚘𝚞𝚙𝚜}_\mathrm{𝚘𝚏}_\mathrm{𝚘𝚗𝚎𝚜}$ 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\le i,j\le 10\right)$ denotes the 0-1 variable associated with the ${i}^{th}$ row and the ${j}^{th}$ column of the board.