2.1.3. Filtering view

Once we know that a constraint for which not all variables are fixed yet is potentially feasible, the next question is to identify variable-value pairs of the form (π‘£π‘Žπ‘Ÿ,π‘£π‘Žπ‘™) such that, if value π‘£π‘Žπ‘™ is assigned to variable π‘£π‘Žπ‘Ÿ, the constraint has no solution. Since removing such values reduces a priori the search space, filtering is strongly supported by the implicit motto of constraint programming that the more you prune the better. Assuming that you already have a necessary and sufficient condition that can be evaluated in polynomial time for checking whether a constraint has at least one solution or not, you can directly reuse it for checking whether a value can be assigned or not to a variable. Since the number of variable-value pairs to check may be quadratic with respect to the total number of variables and values one usually prefers developing a dedicated filtering algorithm that is less costly than checking the feasibility condition on each variable-value pair.

For the πšŠπš•πš•πšπš’πšπšπšŽπš›πšŽπš—πš constraint a first filtering algorithmΒ [Regin94] is based on a characterisation of the edges of the variable-value graph that belong to a maximum matching but not to all. A matching on a graph is a set of edges of the graph such that no two edges have a vertex in common; it is maximum if its number of edges is maximum. We first introduce a digraph G β†’ M that is associated with a matching M that matches all variables of the πšŠπš•πš•πšπš’πšπšπšŽπš›πšŽπš—πš constraint. The vertices of G β†’ M are defined as the variables and the values that can be assigned to the variables of the πšŠπš•πš•πšπš’πšπšπšŽπš›πšŽπš—πš constraint. To each value π‘£π‘Žπ‘™ that can be assigned to a variable π‘£π‘Žπ‘Ÿ corresponds an arc of G β†’ M from π‘£π‘Žπ‘Ÿ to π‘£π‘Žπ‘™. Finally, if value π‘£π‘Žπ‘™ is matched to variable π‘£π‘Žπ‘Ÿ in the matching M we add the reverse arc from π‘£π‘Žπ‘™ to π‘£π‘Žπ‘Ÿ to the arcs of G β†’ M . Now a variable π‘£π‘Žπ‘Ÿ can be assigned a value π‘£π‘Žπ‘™ if and only if π‘£π‘Žπ‘Ÿ and π‘£π‘Žπ‘™ belong to the same strongly connected component of G β†’ M or if there is a path consisting of distinct vertices and arcs of G β†’ M that start with (π‘£π‘Žπ‘Ÿ,π‘£π‘Žπ‘™) and ends up in an unmatched value with respect to matching M, seeΒ [Thiel04].

Figure 2.1.1. Illustration of the filtering for πšŠπš•πš•πšπš’πšπšπšŽπš›πšŽπš—πš(〈V 1 ,V 2 ,V 3 ,V 4 ,V 5 ,V 6 ,V 7 ,V 8 βŒͺ) with V 1 ∈[1,2], V 2 ∈[1,3], V 3 ∈[3,4], V 4 ∈[3,5], V 5 ∈[4,5], V 6 ∈[6,7], V 7 ∈[6,8], V 8 ∈[8,9] with respect to the maximum matching M defined by V i =i (1≀i≀8) and the corresponding digraph and its five strongly connected components s.c.c.Β k (1≀k≀5): 8 can be assigned to V 7 (blue arc) since the path (V 7 8 V 8 9) ends up in an unmatched value, but 3 cannot be assigned to V 2 (red arc) since 3 and V 2 do not belong to the same strongly connected component and since there is no path from V 2 to the unique unmatched value 9.
ctrs/preface-1-tikz

Another filtering algorithm for πšŠπš•πš•πšπš’πšπšπšŽπš›πšŽπš—πš based on Hall intervals just focuses on adjusting the minimum and maximum values of the variables. Given a set of domain variables, a Hall interval is an interval of values [π‘™π‘œπ‘€,𝑒𝑝] denoted by β„‹ [π‘™π‘œπ‘€,𝑒𝑝] such that there are 𝑒𝑝-π‘™π‘œπ‘€+1 variables whose domains are contained in β„‹ [π‘™π‘œπ‘€,𝑒𝑝] . A minimal Hall interval β„‹ [π‘™π‘œπ‘€,𝑒𝑝] is a Hall interval that does not contain any Hall interval β„‹ [π‘™π‘œπ‘€ ' ,𝑒𝑝 ' ] such that either π‘™π‘œπ‘€=π‘™π‘œπ‘€ ' or 𝑒𝑝=𝑒𝑝 ' . Given a Hall interval β„‹ and a variable V whose domain is not included in β„‹ but intersects β„‹, the idea is to adjust the minimum (respectively maximum) value of variable V to the smallest (respectively largest) value that does not belong to β„‹. FigureΒ 2.1.2 illustrates this idea on the constraint πšŠπš•πš•πšπš’πšπšπšŽπš›πšŽπš—πš(〈V 1 ,V 2 ,V 3 ,V 4 ,V 5 ,V 6 ,V 7 ,V 8 ,V 9 βŒͺ) with V 1 ∈[1,2], V 2 ∈[1,2], V 3 ∈[2,5], V 4 ∈[4,5], V 5 ∈[5,6], V 6 ∈[4,6], V 7 ∈[1,9], V 8 ∈[8,9], V 9 ∈[8,9].

  • PartΒ (A) of FigureΒ 2.1.2 shows in light blue, in light pink and in light yellow the three minimal Hall intervals associated with the initial domains of variables V 1 ,V 2 ,β‹―,V 9 .

    • β„‹ [1,2] corresponds to interval [1,2], which contains the domains of V 1 and V 2 .

    • β„‹ [4,6] corresponds to interval [4,6], which contains the domains of V 4 , V 5 and V 6 .

    • β„‹ [8,9] corresponds to interval [8,9], which contains the domains of V 8 and V 9 .

  • PartΒ (B) of FigureΒ 2.1.2 shows the first propagation step with respect to the Hall intervals β„‹ [1,2] , β„‹ [4,6] and β„‹ [8,9] . First note that variables V 3 and V 7 are the only variables whose domain is not included in a Hall interval. Consequently V 3 and V 7 are candidates for adjusting their minimum or maximum domain values.

    • Since the minimum value of V 3 , that is i.e. value 2, belongs to the Hall interval β„‹ [1,2] we adjust the minimum of V 3 to the smallest value that does not yet belong to any Hall interval, i.e. value 3.

    • Since the maximum value of V 3 , that is i.e. value 5, belongs to the Hall interval β„‹ [4,6] we adjust the maximum value of V 3 to the largest value that does not yet belong to any Hall interval, i.e. value 3.

    • Since the minimum value of V 7 , that is i.e. value 1, belongs to the Hall interval β„‹ [1,2] we adjust the minimum of V 7 to the smallest value that does not yet belong to any Hall interval, i.e. value 3.

    • Since the maximum value of V 7 , that is i.e. value 9, belongs to the Hall interval β„‹ [8,9] we adjust the maximum of V 7 to the largest value that does not yet belong to any Hall interval, that is i.e. value 7.

  • PartΒ (C) of FigureΒ 2.1.2 shows the second propagation step with respect to the new Hall interval β„‹ [3,3] . Now V 7 is the only variable whose domain is not included in a Hall interval so it is a candidate for adjusting its minimum or maximum domain value.

    • Since the minimum value of V 7 , i.e. value 3, belongs to the new Hall interval β„‹ [3,3] we adjust the minimum of V 7 to the smallest value that does not yet belong to any Hall interval, i.e. value 7.

  • Finally, partΒ (D) of FigureΒ 2.1.2 shows all the minimal Hall intervals after reaching the fix point of the filtering, where β„‹ [7,7] is a new minimal Hall interval.

Figure 2.1.2. Steps (A), (B), (C) and (D) for filtering the minimum and maximum values wrt Hall intervals β„‹ [π‘™π‘œπ‘€,𝑒𝑝] for πšŠπš•πš•πšπš’πšπšπšŽπš›πšŽπš—πš(〈V 1 ,V 2 ,V 3 ,V 4 ,V 5 ,V 6 ,V 7 ,V 8 ,V 9 βŒͺ) with V 1 ∈[1,2], V 2 ∈[1,2], V 3 ∈[2,5], V 4 ∈[4,5], V 5 ∈[5,6], V 6 ∈[4,6], V 7 ∈[1,9], V 8 ∈[8,9], V 9 ∈[8,9]. Each horizontal grey strip corresponds to a set of consecutive values that do not belong to the domain of a variable, while each horizontal red strip represents an adjustment of the minimum or the maximum value of the domain of a variable.
ctrs/preface-2-tikz