A fltering algorithm for constraints of difference in CSPs

A fltering algorithm for constraints of difference in CSPs

1. Summary

  1. Alldierent constrains them to be decorated by a set of tuples on the variable subset, and the values ​​that appear in the same tuple are all different.
  2. This paper proposes a new filtering algorithm for these constraints. Generalized arc consistency conditions for these non-binary constraints are obtained. It is based on matching theory and has low complexity.

2. Introduction

  1. The existence of CSP solutions is NP-complete. Therefore, several methods have been developed to simplify the search for solutions before or during CSP. Consistency techniques are the most commonly used techniques. Several algorithms to achieve arc consistency are proposed for binary CSP and N-ary CSP.

  2. The introduced special constraints algorithm AC-4 was improved to study monotonic and functional binary constraints. In this work, we are interested in a special case of n-gram constraints: "distinct constraints", for which we propose a filtering algorithm.

  3. A constraint is called a "distinct constraint" if it is defined by a set of tuples on a subset of variables, and the values ​​occurring in the same tuple are all different. They exist in many problems in real life.

  4. These constraints can be expressed as n-gram constraints and layered with the generalized arc consensus algorithm GAC4. This filtering reduces domains, but its complexity can be expensive. In fact, it depends on the length and number of all admissible tuples. Let us consider "distinct constraints" of p variables whose values ​​are taken from a set of base D. Thus, the number of allowed tuples corresponds to the number of permutations of p elements selected from d elements without repetition: d Pp = d! /(d-p)! .

  5. Therefore, some constraint resolution systems represent these n-ary constraints as a set of binary constraints. In this case, a distinct binary constraint is established for each pair of variables belonging to the same "distinct constraint".

  6. But due to these constraints, arc-consistent pruning performs poorly. In fact, for a binary Alldierent constraint between two variables i and j, arc consistency removes a value from the domain of i only when the domain of j is reduced to a value.

  7. Let us assume we have a CSP with 3 variables x1, x2, x3 and a different constraint between these variables (Fig. 1) The domain of the variables is D 1 = {a, b} , D 2 = {a, b} and D 3 ={a, b,c} . GAC4 Different constraints expressed by a ternary constraint eliminate the a and b values ​​in the x3 domain, while arc consistency of different constraints expressed by different binary constraints No values ​​are removed.
    insert image description here
    insert image description here
    insert image description here
    insert image description here

  8. This paper presents an efficient way to implement the generalized arc consistency condition in order to get better results from its pruning performance. Its space complexity is O(Pd) and time complexity is O(P2d2).

The rest of the paper is organized as follows. Section 2 makes some preliminary explorations of the constraint satisfaction problem and the matching problem, and proposes an arc-consistent constraint representation involving only constraints: dual-arc consistency. Section 3 proposes a new condition to guarantee dual-arc consistency in CSPS. In Section 4, we propose an ECIANT implementation to achieve this condition and analyze its complexity. In Section V, we illustrate its performance and its interest with an example. Section VI gives the conclusion.

3. Preparations

  • Basic Definition
    insert image description here
    A value ai in the domain of a variable xi is consistent with a given n-ary constraint if all other variables in the constraint have values ​​such that these values ​​and ai simultaneously satisfy the constraint. More generally, the arc consistency or generalized arc consistency of n-ary CSP is as follows [Mohr and Masini, 1988a].
    insert image description here
    From the previous definition, we propose a special arc consistency, which only involves "distinct constraints":
    insert image description here
    insert image description here
    insert image description here

    A match(M) covers a set X if every vertex in X is an endpoint of an edge in match(M).
    Note that the matching covering X in the bipartite graph G=(X; Y; E) must be the maximum matching. (The set of edges without common nodes is called matching, so all nodes correspond to one edge, the number of which is the largest, and the maximum number of matches must be four.) In the next section,
    we start from the definition of matching and the definition of value graph, and give a New requirement to guarantee diff-arc-consistency on CSPs of constraints of difference.

4. CSPs have a new condition of constraints of difference constraints

The following theorem establishes the connection between diff-arc-consistency and matching concepts in the value graph of constraints of difference.
insert image description here
Proof:
=> Let us consider a constraint of differences and its value graph GV©. From each admissible tuple of C, a set of pairs can be built. Pairs consist of variables in tuples and their assignments. The pair set contains pairs for each variable. This set corresponds to a set of edges, denoted A in GV©. Since p is double-arc consistent, the values ​​in each tuple are double-arc consistent. Therefore, it is impossible for two edges of A to have a common vertex, and A is a match covering XC. Also, every value of every variable in a constraint belongs to at least one tuple. Thus, every edge of GV© belongs to a matching covering X
<=
Let us consider a variable xi and a value a of its domain. For each constraint of the constraints of difference C, the pair (xi,a) belongs to the matching that covers xc in GV©. Since no two edges in the match share a vertex in common, all other variables in the constraint have values ​​such that these values ​​simultaneously satisfy the constraint. So P is double-arc consistent.
insert image description here
This theorem gives us an efficient way to express constraints of difference constraints in CSP. In fact, a constraint of differences can only be represented by its value graph, with a space complexity of O(pd). It also allows us to give a basic algorithm (Algorithm 1) to filter the variable domain of a set over which constraints of difference are constrained. The algorithm calculates a matching covering Xc by establishing a value graph of iteration constraints to delete every edge which belongs to no matching covering Xc (delete every edge which belongs to no matching covering Xc). Figure 3 shows this lightweight application.
insert image description here

insert image description here

5. Delete unmatched edges covering X

insert image description here
To simplify the notation, we consider a bipartite graph G = (x, y, e) instead of a bipartite graph G = (Xc, D(Xc), e) and a matching M that covers X in G. In order to understand how we remove all edges that are not part of a match (no match), we come up with some definitions about matching theory. For more information, the reader is referred to [Berge, 1970] or [Lovasz and Plummer, 1986]
insert image description here
It is crucial that an edge belongs to each maximal matching.

Figure 3 gives an example of matching that covers x in a bipartite graph. The thick side is the matching side. Vertex 7 is free. Path (7,x6,6,x5,5) is an alternate path starting from a free vertex. Loop(1,x3,3,x2,2,x1,1) is an alternating loop. The edge (x4,4) is crucial.

insert image description here

Each matching sequence has elements (x4,4) so ​​it is vital
insert image description here

According to this property, we can get an arbitrary matching M covering X, delete every edge which belongs to no matching covering Xc (delete every edge which belongs to no matching covering Xc). There are edges that neither belong to M (not important), nor to even alternate paths from free vertices, nor to even alternate cycles.
insert image description here
Proof
1) If we ignore equivalence, it is clear that this proposition is true. In the first case, since G is bipartite, it does not have any odd cycles.
2) In the second case, we have to prove that every directed simple path of GO starting from a free vertex corresponds to an even alternate path of G starting from a free vertex. M is a match that covers X, so there are no free vertices in X. Since G is bipartite, and since every path begins with a free vertex, every odd directed simple path in Y ends with a vertex in X. From this vertex, we can always find a vertex in Y that does not belong to the path, because every vertex in X has a successor, and a vertex in Y has a predecessor. Therefore, from an odd directed simple path, we can always build an even directed simple path.

  • Starting from this proposition, we derive a linear algorithm (Algorithm 2) that removes all edges that do not belong to the matching cover X. (does not belong to any matching which covers X.)
  • Step 2 finds the edges of all directed simple paths belonging to GO, which start from a free vertex. In addition, it also gets some edges belonging to the directed cycle of GO.
  • Step 3 calculates the strongly connected component of GO, because the edge connecting two vertices in the same strongly connected component belongs to the directed cycle, otherwise it does not belong to the directed cycle. These edges belong to the even alternating cycle of G (cf point 1 of proposition 1). After this step, the set A belonging to all edges covering some but not all matches of X is known. (property1)
  • The set Re of edges removed in G is: Re=E(A[m)
    This is done by step 4. Algorithmic complexity is the same as the search for strongly connected components
  • That is O(m+n) for a graph with m edges and n vertices. We give a constraint on the constraints of difference, how to remove all unmatched edges that cover xc (o no matching which covers Xc). However, a variable may be subject to multiple constraints, requiring propagation removal. In fact, let us consider Xi as a variable of Xc, xi can be subject to several constraints.
  • Therefore, the value of Di can be removed for reasons independent of C. This deletion involves deleting an edge from GV©. Therefore, it is necessary to study the consequences of this GV© adjustment structure.
    insert image description here

6. Delete propagation

  1. Removal of the value of a constraint of difference may involve some modification of other constraints. For the other constraints of the constraints of difference, we can do better than repeating the first algorithm by exploiting the fact that matches that cover X are known before deletion.
  2. Our proposed propagation algorithm has two sets of sets as parameters. The first represents the set of edges to be removed from the bipartite graph, and the second represents the set of edges to be removed by filtering. The algorithm requires a function denoted MatchingCoveringX(G, M1, M2), which computes a matching M2 covering X from a matching M1 that is not the maximum. Returns true if M2 exists, false otherwise. The new filtering is represented by Algorithm 3.
  3. The full text is divided into three parts. First, it removes edges from the bipartite graph. Second, it finally computes a new match that covers Xc. Third, remove edges that do not belong to any matching cover Xc. The algorithm returns false if ER contains significant edges or there is no match covering Xc
  4. Now, let's calculate its complexity. Let M be the number of edges in G and N be the number of vertices. Suppose we have to remove K edges G from it (|ER| = k). The complexity of Algorithm 1 is in O(k). In the worst case, step 2 consists in computing the matching cover Xc from the matching of base |MK|. The cost of this computation is O(root K times M) (see [Hopcroft and Karp, 1973]). The complexity of step 3 is O(m).
  5. In the worst case, the edges of G can be deleted one by one. Then the previous function will be called m times. So the global complexity is in O(M2). If p=|Xc| and d is the maximum cardinality of the variable field of xc, then for a constraint of difference constraint, the complexity is O(p2d2).
    insert image description here

6. An example: the zebra problem

  • There are 5 houses there, each house has a bright color, live with men of different nationalities, have pets, drinks and cigarettes.
  • The Englishman lives in the red house.
  • The Spaniard had a dog.
  • Coee got drunk at the green house
  • Ukrainians drink tea
  • The green house is to the right of the ivory house.
  • old gold smoker owns a snail
  • In the yellow house, Coors is being smoked
  • Milk drinks in the middle house.
  • The Norwegian lives in the first house on the left
  • Chesterfield smoker lives next to fox owner
  • Coors was fumigated in a house next to the house where the horses were kept.
  • Lucky smoker drinks orange juice
  • Japanese smoking council
  • The Norwegian lives next to the blue house.
  • The question is: who drinks the water and who owns the zebras?

This problem can be expressed as a constraint network with 25 variables, each corresponding to 5 colors, beverages, nationalities, cigarettes and pets:
insert image description here
each variable has domain values ​​{1, 2, 3, 4, 5}, each The number corresponds to a house location (eg assigning a value of 2 to a variable horse means that the horse owner lives in the second house) [Dechter, 1990]. Assertions 2 through 15 are converted to unary and binary constraints. Furthermore, there are three ways of expressing the first assertion, which means that variables in the same cluster (color, drink, nationality, cigarette, and pet) must take on different values: the first notation is usually used to solve this problem [
insert image description here
Dechter , 1990; Bessiere and Cordier, 1993]. Starting from these three representations, we can study some results of arc coincidence. They are given in Figures 4 and 5. Constraints corresponding to assertions 2 to 15 are expressed in extensions. For clarity, the uncertainty constraints among the clustering variables are omitted.

  1. For the first representation, the results of the arc alignment are given in Fig. 4.
  2. For the second representation, a generalized arc coincidence algorithm is used. Figure 5 shows the new results. It trims more values ​​than the previous one.
  3. For the third representation, an arc consensus algorithm is used for binary constraints combined with a new iterative algorithm for binary constraints. The result obtained is the same as the second method.
    insert image description here
    insert image description here
    Let us denote by the number of binary constraints corresponding to assertions 2 to 15, p denote the size of a cluster, c the number of clusters, d the number of values ​​in a domain, o(ed2) denote arcs in binary CSPs Consistency 2 complexity. Let's calculate the complexity of these three methods:
    insert image description here
    the second lightweight eliminates more values ​​than the first. But it's more complex. The representation and algorithm proposed in this paper give comparable pruning results to the second approach with the same complexity as the first approach. Therefore, we can conclude that the new filter is good to solve the problem of looking like a zebra.

7. Conclusion

This paper presents a filtering algorithm with discrete constraints in CSPS. This algorithm can be regarded as an effective way to realize generalized arc consistency conditions for a class of special constraints & discrete constraints. It allows us to gain performance gains from previous conditional pruning at lower complexity. In fact, for a constraint, its space complexity is O(Pd) and time complexity is O(P2,d2). It has been proven to be very effective for zebra problems. And it has been successfully used to solve the subgraph isomorphism problem in Resyn [Vismara et al., 1992], a computer-aided design system for complex organic synthesis schemes.

For more questions, please pay attention to the WeChat public account "Houdian Programming" background private message for further communication

Guess you like

Origin blog.csdn.net/lockhou/article/details/129771318