Algorithms for Quantified Constraint Satisfaction Problems Nikos Mamoulis Department of Computer Science and Information Systems University of Hong Kong
[email protected] Kostas Stergiou Department of Information and Communication Systems Engineering University of the Aegean
[email protected] January 29, 2004 Abstract Many propagation and search algorithms have been developed for constraint satisfaction problems (CSPs). In a standard CSP all variables are existentially quantified. The CSP formalism can be extended to allow universally quantified variables, in which case the complexity of the basic reasoning tasks rises from NP-complete to PSPACE-complete. Such problems have been studied in the context of quantified boolean formulae and CSPs with continuous domains. Little work has been done on problems with discrete non-boolean domains. We try to address this by extending propagation and search algorithms from standard CSPs to the quantified case. We first describe an arc consistency algorithm that can deal with arbitrary binary constraints. We then extend standard search algorithms so that they can handle quantification. We also show how the notion of value interchangeability can be exploited to break symmetries and speed up search by orders of magnitude. We test experimentally the algorithms and methods proposed and make a preliminary analysis of the phase transition.
1
Introduction
A wide variety of problems in Artificial Intelligence, Engineering, Databases, and other disciplines can be modelled as Constraint Satisfaction Problems (CSPs). The basic decision task in a CSP is to determine whether there exist values for all variables such that all constraints in the problem are satisfied. It is well known that in standard CSPs, where all variables are existentially quantified, this task is NPcomplete. A natural generalization of the standard CSP formalism is to consider the case where some of the variables may be universally quantified. A CSP that allows universal quantification of variables is called a Quantified Constraint Satisfaction Problem (QCSP) [Bordeaux & Monfroy2002, Boerner et al.2003]. The generalization of CSPs to QCSPs increases the expressibility of the framework, but at the same time 1
the complexity of the decision task rises from NP-complete to PSPACE-complete [Boerner et al.2003]. As an example consider the problem ∃xi ∃xj ∀xk (xi > xk ∧ xj 6= xk ). This is a CSP where one of the variables is universally quantified, and it reads “there exist values for xi and xj such that for every value of xk the constraints xi > xk and xj 6= xk are satisfied”. Assuming that the domains of xi , xj , xk are {1, 2}, {2, 3} and {0, 1} respectively then the problem is satisfiable. If the domain of xi was {0, 1} then the problem would be unsatisfiable. QCSPs can be used to model various PSPACE-complete problems from domains like game playing [Schaefer1978], planning [Bylander1994], and belief revision [Eiter & Gottlob1992]. Recently, there is an increasing interest in algorithms for QCSPs, especially in the cases of Quantified Propositional Satisfiability (QSAT or QBF) (e.g. [Cadoli, Giovanardi, & Schaerf1998, Gent & Walsh1999, Giunchiglia, Narizzano, & Tacchella2001, Giunchiglia, Narizzano, & Tacchella2002]) and QCSPs with continuous domains (e.g. [Benhamou & Goualard2000, Ratschan2002]). Most of the proposed algorithms are extensions of already existing algorithms from the standard case (e.g. SAT) to the quantified one. Also, a series of complexity results for problems with quantified constraints have been obtained (e.g. [Creignou, Khanna, & M.2001, Boerner et al.2003]). [Ratschan2003] gives numerous references to papers on QCSPs, mainly for problems with continuous domains. However, very little has been done as far as algorithms for QCSPs with discrete non-boolean domains are concerned. The only work we are aware of is [Bordeaux & Monfroy2002], where ways to implement arc consistency for some classes of constraints in QCSPs are proposed. In this paper we extend standard propagation and search algorithms for CSPs to the case of QCSPs. We first describe an arc consistency (AC) algorithm that can deal with arbitrary binary constraints. This algorithm is an extension of the AC algorithms of [Bessi`ere & R´egin2001, Zhang & Yap2001] augmented with rules for consistency checking and value deletions depending on variable quantification. We then extend the chronological backtracking (BT) and forward checking (FC) algorithms so that they can handle quantification. We also propose a modification of FC that is better suited to QCSPs. We show how the notion of value interchangeability [Freuder1991] can be exploited in QCSPs to break symmetries and speed up search by orders of magnitude. We test experimentally the algorithms and methods proposed and make a preliminary analysis of the phase transition in binary QCSPs. To our knowledge, this is the first time these issues are addressed in detail for general QCSPs with discrete non-boolean domains.
2 Preliminaries A Constraint Satisfaction Problem (CSP) consists of a set of variables X = {x1 , . . . xn }, a set of domains D = {D(x1 ), . . . , D(xn )}, where D(xi ) is the finite set of possible values for variable xi , and a set C of constraints over subsets of the variables. A constraint c on variables xi , . . . , xj is a subset of the Cartesian product D(xi )×. . .×D(xj ) that specifies the allowed combinations of values for variables xi , . . . , xj . The operation performed to determine whether a constraint is satisfied is called a consistency check. An assignment of a value a to variable xi is denoted by (xi , a). In standard CSPs all variables are considered to be existentially quantified. A constraint cij = (xi , xj ) is arc consistent (AC) iff for each value a in D(xi ) there exists a value b in D(xj ) so that the assignments (xi , a) and (xj , b) satisfy cij . 2
In this case we say that b is a support for a on constraint cij . A binary CSP is arc consistent if all its constraints are arc consistent. In what follows we assume that the set Supports(i,a),j holds all values in D(xj ) that support value a ∈ D(xi ) on constraint cij . We now give a formal definition of QCSPs. Definition 1 A Quantified Constraint Satisfaction Problem (QCSP) is a formula of the form Q1 x1 . . . Qn xn (c1 ∧ . . . ∧ cm ), where each Qi denotes a quantifier (∀ or ∃) and each ci is a constraint relating some variables among x1 , . . . , xn . The quantification formula Q1 x1 . . . Qn xn specifies a certain order on the variables. We can group together consecutive variables with the same quantification resulting in a formula with alternating quantifiers where a ∀ follows a ∃ and vice-versa. In this way we rewrite the example of the Introduction as ∃xi , xj ∀xk (xi > xk ∧xj 6= xk ). In what follows we restrict our attention to binary constraints. In the rest of the paper we use the notation Q(xi ), where Q ∈ {∃, ∀}, to refer to the quantification of variable xi . That is, a statement “if xi is universally quantified” is expressed as “if ∀xi ”. We also assume that for any constraint cij , variable xi is before xj in the quantification order, unless explicitly specified otherwise.
3
Arc Consistency
[Bordeaux & Monfroy2002] extends the definition of AC to QCSPs and gives rules to compute AC for constraints on boolean variables (e.g. ¬x = y) and numerical constraints (e.g. x + y = z). We complement the work of [Bordeaux & Monfroy2002] by describing an AC algorithm for arbitrary binary constraints that is a natural extension of the recent optimal algorithms of [Bessi`ere & R´egin2001, Zhang & Yap2001] for standard CSPs. When applying AC on a constraint cij , the filtering achieved depends on the type of quantification for variables xi , xj and on the order in which the variables appear in the quantification formula. For a binary constraint there are four possible orders. Binary constraints in are, in general, considered symmetric. That is, for any directed binary constraint cij , between variables xi and xj , a constraint cji is defined allowing the same pairs of values in the reverse order. If a value a ∈ D(xi ) is supported by a value b ∈ D(xj ) on constraint cij then b is supported by a on the inverse constraint cji . This property is called bidirectionality. Arc consistency algorithms like AC-2001 [Bessi`ere & R´egin2001] consider the constraints as being directed and revise inverse constraints in separate steps. Note that the bidirectionality property holds in QCSPs as in standard CSPs. This property has to do with the microstructure (i.e. the allowed and disallowed tuples) of each constraint rather than the quantification of the variables involved in the constraint. We can define AC for an arbitrary binary constraint cij and its inverse constraint cji using the following general rules; one for each order of quantification. ∃ xi ∃ xj - This is the case of standard CSPs. Constraint cij is AC iff each value a ∈ D(xi ) is supported by at least one value b ∈ D(xj ). If a value a ∈ D(xi ) has no support in D(xj ) then AC will remove a from D(xi ). Accordingly, the inverse constraint cji is AC iff each value b ∈ D(xj ) is supported by at least one value in D(xi ). 3
∀ xi ∀ xj - Constraint cij is AC iff each value a ∈ D(xi ) is supported by all values in D(xj ). If a value a ∈ D(xi ) is not supported by all values in D(xj ) then the problem is unsatisfiable. Accordingly, the inverse constraint cji is AC iff each b ∈ D(xj ) is supported by each value in D(xi ). ∀ xi ∃ xj - Constraint cij is AC iff each value a ∈ D(xi ) is supported by at least one value in D(xj ). If a value a ∈ D(xi ) has no support in D(xj ) then the problem is unsatisfiable. The inverse constraint cji is AC iff Supports(j,b1 ),i ∪, . . . , ∪ Supports(j,bd ),i = D(xi ). Or in words, iff the union of the support sets (for constraint cji ) of all values bk of D(xj ) is equal to D(xi ). If it is not then there is (are) some value(s) in D(xi ) that is (are) not supported in D(xj ), in which case the constraint cannot be satisfied. AC removes all values from D(xj ) that have no support in D(xi ). ∃ xi ∀ xj - Constraint cij is AC iff each value a ∈ D(xi ) is supported by all values in D(xj ). If a value a ∈ D(xi ) is not supported by all values in D(xj ) then AC will remove a from D(xi ). The inverse constraint cji is AC iff Supports(j,b1 ),i ∩, . . . , ∩Supports(j,bd ),i 6= ∅. Or in words, iff the intersection of the support sets (for constraint cji ) of all values bk of D(xj ) is non-empty. If the intersection is empty then there is no value in D(xi ) that is supported by all values in D(xj ), in which case the constraint cannot be satisfied. AC removes all values in D(xi ) that do not belong to the intersection of the support sets. In Figure 1 we sketch an AC algorithm for quantified binary CSPs. The algorithm takes a QCSP with a set X of existentially or universally quantified variables in a given order, and and a set C of binary constraints, and computes the arc consistent subdomains in case the problem is arc consistent or returns FALSE in case the problem is not arc consistent. The algorithm uses the previously defined rules to check the consistency of a constraint according to the type and order of quantification of the variables involved in the constraint. The algorithm performs constraint-based propagation. That is, it uses a stack of constraints that are propagated instead of a stack of variables. Apart from this, it has similar structure to AC-2001 augmented with the handling of universal variables. As in AC-2001, currentSupportxi ,a,xj points to the value in D(xj ) that currently supports value a ∈ D(xi ). Constraints of the form ∃ xi ∀ xj , cij and ∀ xi ∀ xj , cij are dealt by a preprocessing step in Function AC QCSP. For the former, each value of xi that is not supported by all values of xj is removed from the domain of xi . For the latter, if there a value of xi that is not supported by all values of xj then we can determine that the problem is unsatisfiable. Such constraints are thereafter not considered during the propagation phase. This is achieved by adding all such constraints to a set S and removing this set from C before calling function Propagation. The worst-case time complexity of the algorithm can be measured by examining the two for loops in Function AC QCSP and also Function Propagation. All three have O(ed2 ) worst-case complexity, where e is the number of binary constraints, and d is the maximum domain size. So, overall the complexity of the algorithm is O(ed2 ).
4 Search Algorithms Figures 2 and 3 describe BT and FC for binary QCSPs. Before applying search, we assume that the input QCSP has been made AC using the algorithm of Figure 1. Under 4
function AC QCSP(X, C) S←∅ for each cij where ∀(xi ) and ∀(xj ) for each a ∈ D(xi ) if Supports(i,a),j 6= D(xj ) then return FALSE add ci j to S for each cij where ∃(xi ) and ∀(xj ) for each a ∈ D(xi ) if Supports(i,a),j 6= D(xj ) then remove a from D(xi ) if D(x) = ∅ then return FALSE else add cij to S Q ← C −S return P ropagation(Q) function P ropagation(Q : stack) while Q 6= ∅ pick a constraint cij from Q if Revise(xi , xj ) = T RU E then if ∀(xi ) or D(xi ) = ∅ then return FALSE put in Q all constraints cki return TRUE function Revise(xi , xj ) DELETION ← FALSE for each a ∈ D(xi ) if currentSupportxi ,a,xj is not valid then if exists valid b(∈ D(xj )) > currentSupportxi ,a,xj and b supports a then currentSupportxi ,a,xj ← b else remove a from D(xi ) if ∀(xi ) then return TRUE DELETION ← TRUE return DELETION
Figure 1: AC for binary QCSPs.
this assumption, we do not have to consider constraints of the form ∃ xi ∀ xj , cij or ∀ xi ∀ xj , cij in the algorithms. All values of variable xi , in such constraints, are definitely consistent with all values of variable xj . If some value was not consistent then it would have been removed by AC. This implies that, during search, we can safely ignore the last variables in the quantification order if they are universally quantified. For instance, if a problem ∃xi ∀xj ∃xk ∀xl (cij ∧ cjk ∧ ckl ) is AC, then it suffices to apply search for problem ∃xi ∀xj ∃xk (cij ∧ cjk ). BT is an extension of the corresponding algorithm for standard CSPs. It proceeds by checking assignments of values to variables until the truthness of the quantified problem is proved or disproved. BT terminates successfully if all the values of the first universal variable are found to be part of a solution (line 14). If the current variable is existential and a dead-end occurs then the algorithm backtracks to the previously instantiated existential variable, possibly jumping over some universal variables (lines 4–5). Otherwise (i.e. no dead-end), the next valid value of the current variable is checked against the previous assignments (line 8). If the value is consistent and BT has reached a consistent leaf node (i.e. the current variable is the last one) then it backjumps to the last univeral variable (lines 9–10). If BT is not at a leaf node, it proceeds by mov5
ing to the next variable (line 11). If the current variable is universal then there are two cases. If all of its values have been proved to be consistent (according to the current assignments), BT backjumps to the last universal variable (lines 13–15) to check its next value. If not all of its values have been checked, BT assigns the current variable with its next value and proceeds with the next variable (lines 16–17). Note that when BT assigns a value to a universal variable it does not backward check this value against the previous assignments. The reason is that, due to AC preprocessing, all values of a universal variable xi are consistent with all values of the variables before xi in the quantification order. If an assignment (xi , a), where xi is universally quantified, is incosistent then this will be proved when BT encounters a dead-end at the first existential variable after xi in the quantification order. boolean BT(X, C) 1: cur var ← leftmost variable 2: while there are unassigned variables 3: if ∃(cur var) 4: if no more values in D(cur var) 5: cur var ← last assigned existential variable 6: else 7: assign cur var with next valid value a ∈ D(cur var) 8: if (cur var, a) is consistent 9: if there are no more unassigned variables 10: cur var ← last assigned universal variable 11: else cur var ← next unassigned variable 12: else //∀(cur var)// 13: if no more values in D(cur var) 14: if cur var is the first universal return TRUE 15: else cur var ← last assigned universal variable 16: else assign cur var with next value a ∈ D(cur var) 17: cur var ← next unassigned variable 18: if there is a backtrack from the first existential return FALSE 19: return TRUE
Figure 2: Chronological Backtracking for binary QCSPs.
The algorithm FC0 shown in Figure 3 is an extention of standard FC to QCSPs. It operates in a way similar to BT with the difference that each variable assignment is forward checked against values of future existential variables constrained with the current one (lines 1–2 and 2–3). As mentioned, constraints of the form ∃ xi ∀ xj , cij or ∀ xi ∀ xj , cij have already been handled by preprocessing. When the algorithm backtracks, all values removed by FC are restored in their domains. We have also experimented with a modified version of FC, which we call FC1, that is better suited to QCSPs. FC1 has the exactly same behavior as FC0 when the current variable is existentially quantified. If the current variable xi is universally quantified then we forward check each value of xi against all future variables before assigning a specific value to xi . If one of xi ’s values causes a domain wipeout then we backtrack to the last existential variable. Otherwise, we proceed in the usual way by instantiating the next available value b of xi and removing all values of future variables that are inconsistent with the assignment (xi , b). In this way we can discover dead-ends earlier and avoid fruitless exploration of search tree branches. It is easy to see that FC1 will always 6
boolean FC0 (X, C) cur var ← leftmost variable while there are unassigned variables if ∃(cur var) if no more values in D(cur var) cur var ← last assigned existential variable else assign cur var with next valid value a ∈ D(cur var) 1: for each future ∃(xi ) for each b ∈ D(xi ) if (xi , b) inconsistent with (cur var, a) 2: D(xi ) ← D(xi ) − b if there is no domain wipeout if there are no more unassigned variables cur var ← last assigned universal variable restore removed values by all variables ≥ cur var else cur var ← next unassigned variable else restore values removed by cur var else //∀(cur var)// if no more values in D(cur var) if cur var is the first universal return TRUE else cur var ← last assigned universal variable else assign cur var with next value a ∈ D(cur var) 3: for each future ∃(xi ) for each b ∈ D(xi ) if (xi , b) inconsistent with (cur var, a) 4: D(xi ) ← D(xi ) − b if there is no domain wipeout cur var ← next unassigned variable else cur var ← last assigned existential variable restore removed values by all variables ≥ cur var if there is a backtrack from the first existential return FALSE return TRUE
Figure 3: FC0: Forward Checking for binary QCSPs.
visit at most the same number of search tree nodes as FC0. The two algorithms are incomparable in the number of consistency checks they perform. Based on the above, we can easily adapt the MAC algorithm for QCSPs. MAC can also be modified in the same way as FC to yield and algorithm analogous to FC1.
5
Symmetry Breaking via Value Interchangeability
Many CSPs contain symmetries which means that for a given solution there are equivalent solutions. This can have a profound effect on the search cost when looking for one or (mainly) all solutions to a CSP. Various methods for symmetry breaking have been proposed (e.g. [Gent & Smith2000]). Most of these methods add symmetry breaking constraints to the problem either statically, before search, or dynamically during search. QCSPs, in particular, can greatly benefit from symmetry breaking techniques, since we 7
have to check the satisfiability of all values for all universally quantified variables. We propose the exploitation of value interchangeability as a dynamic symmetry breaking technique in QCSPs. The notion of interchangeable values was defined by [Freuder1991]. A value a of a variable xi is fully interchangeable with a value b of xi , iff every solution which contains the assignment (xi , a) remains a solution if we substitute b for a, and vice versa. Since determining full interchangeability would require finding all solutions to the problem, Freuder also defined various local interchangeabilities. A value a of a variable xi is neighborhood interchangeable (NI) with a value b of xi , if a and b are supported by exactly the same values of all variables adjacent to xi . Neighborhood interchangeability is a sufficient (but not necessary) condition for full interchangeability [Freuder1991]. A set of NI values can be replaced by a single representative of the set without in effect losing any solutions. Experiments showed that this can reduce the search effort in standard CSPs when applied as a preprocessing step or during search, and especially when looking for all solutions to a problem [Haselbock1993, Beckwith & Choueiry2001]. In what follows we will often refer to NI values simply as interchangeable. In the context of QCSPs we can exploit interchangeability to break symmetries by “pruning” the domains of universal variables. That is, for each set (sometimes called bundle) of NI values we can keep one representative and remove the others, either permanently before search, or temporarily during search. If the algorithm proves that the representative value is consistent (i.e. satisfies the QCSP) then so are the rest of the NI values. Therefore, checking the consistency of such values is redundant. Consider the following example. Example 1 We have the formula ∀x∃xj , xk (xi 6= xj , xi 6= xk ), where the domains of the variables are D(xi ) = {0, 1, 2, 3, 4}, D(xj ) = {0, 1}, D(xk ) = {0, 2}. Values 3 and 4 of xi are NI since they are supported by the same values in both xj and xk . Therefore, they can be replaced by a single value or to put it differently one of them can be pruned out of the domain. We can detect NI values as a preprocessing step in QCSPs to remove values from the domains of universal variables, or we detect them dynamically during search to avoid repeated exploration of similar subtrees. Example 2 Assume that the formula ∀xi ∃xj , xk , xl cij , cik , cil is part of QCSP and the variable domains are D(xi ) = {a, b}, D(xj ) = D(xk ) = D(xl ) = {c, d, e, f }. Assume also that value a is supported by values c, d, e in each of xj ,xk and xl , and b is supported by c, d, f . If the current variable at some stage of search is xi and values e and f have been previously removed from the domains of xj ,xk and xl then at that stage a and b are NI. We can proceed to check if the assignment (xi , a) can be part of a solution. If it is consistent, when we backtrack to universal variable xi , we do not need to check the assignment (xi , b). If we backtrack further back and undo the deletions of values e, f from the domains of xj ,xk and xl then the next time we reach variable xi the values a and b may not be NI. We have implemented a procedure that detects bundles of NI values in universal variables as a preprocessing step, keeps one representative of each bundle and removes the rest from the domains. We have also embedded a routine in FC that dynamically detects bundles of NI values each time the algorithm reaches a universal variable xi . 8
In this case, one representative of each value is kept, and the rest of the values are temporarily removed from D(xi ). The values are restored if the algorithm backtracks to a level before xi . Note that we only need to look at constraints of the form ∀xi ∃xj cij when looking for NI values in universal variables. In a constraint of the form ∀xi ∀xj cij all values are NI (with respect to this constraint). Otherwise the problem is unsatisfiable. As Freuder points out, interchangeability techniques complement the usual inconsistency detection techniques. Experimental results presented in the next section show that the use of value interchangeability for symmetry breaking can reduce the search effort by orders of magnitude.
6
Experimental Results
We implemented the presented algorithms and ran some preliminary experiments on randomly generated QCSPs. We used two models for random generation of QCSP instances. The first one is based on the k−SAT model widely used for the evaluation of algorithms in QSAT [Gent & Walsh1999]. We call this model k−QCSP. A k−QCSP is a QCSP in which there are k alternating quantifiers applied to disjoint sets of variables, with the innermost quantifier being existential.1 A 1-QCSP problem is a standard CSP. We experimented with 2-QCSP problems where in the quantification formula we have a set of existential variables followed by a set of universal variables followed by another set of existential variables. The constraint graph and the constraint matrices are generated according to the widely used model B of standard CSPs. A problem is specified by the following parameters: the number n of variables, the domain size d of each variable, the number n∀ of universally quantified variables, the density p of the constraint graph (i.e., the fraction of variable pairs with a constraint), the looseness q of the constraints (i.e., the fraction of allowed tuples in each constraint), and f irst∀ , the position of the first universal variable in the quantification formula. For each generated constraint cij the quantification of the variables is either ∃xi ∃xj or ∀xi ∃xj . That is, we do not generate constraints that can be handled by preprocessing alone. Figures 4 and 7 present a comparison of algorithms BT, FC0, and FC1, for 2-QCSP problems with n = 20, d = 5, p = 0.2, n∀ = 7, f irst∀ = 7, and varying q. For each value of q, the number of node visits and consistency checks were averaged for 100 problem instances. Note, that CPU times were relative to the number of consistency checks performed. We can clearly see an easy-hard-easy pattern in the search cost. The hardness peak coincides with the phase transition from insoluble to soluble problems. As in standard CSPs and QSAT, the hardest instances occur in the region where approximately half of the instances are satisfiable. Algorithm FC1 is marginally better than FC0. For harder instances, with 30, 40, and 50 variables, FC1 is significantly faster than FC0. As expected, BT is much worse than FC. Figures 5 and 8 show the effect of symmetry breaking through value interchangeability, again on 2-QCSP problems. We compare FC1 to FC1 + static NI (denoted by FC1+sNI) and FC1 + dynamic NI (denoted by FC1+dNI). The problem settings here are n = 20, d = 5, p = 0.2, and n∀ = 7. This time we vary the position f irst∀ of the first universal variable in the quantifier sequence, while we fix q so that all problems are from the hard phase transition region. As the sequence of universal variables 1 Recall that if the innermost set of variables is universally quantified then any constraints on these variables can be handled by preprocessing alone and ignored thereafter.
9
1.2e+009 1e+009
1e+011
FC0 FC1 BT
1e+010
FC1+sNI FC1+dNI FC1
1e+010
1e+009
FC1+dNI FC1
8e+008 6e+008 4e+008
average node visits
average node visits
average node visits
1e+008 1e+009 1e+008 1e+007
1e+007 1e+006 100000 10000 1000
2e+008
1e+006 100
0 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 looseness q of constraints
Figure 4: Average nodes visited by BT, FC0, and FC1
1e+011
FC0 FC1 BT
2e+009 1.5e+009 1e+009
10
2
4 6 8 10 12 number of universal variables
14
Figure 6: Average nodes visited by FC1 and FC1+dNI 1e+010
FC1+sNI FC1+dNI FC1
1e+010
2.5e+009
2 4 6 8 position of first universal variable
Figure 5: Average nodes visited by FC1, FC1+sNI, and FC1+dNI average checks
average checks
3e+009
10 0
1e+009
FC1+dNI FC1
1e+008 average checks
3.5e+009
100000
1e+009
1e+008
1e+007 1e+006 100000 10000
1e+007 5e+008
1000
0 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1 looseness q of constraints
Figure 7: Average checks performed by BT, FC0, and FC1
1e+006
100 0
2
4
6
8
10
position of first universal variable
Figure 8: Average checks performed by FC1, FC1+sNI, and FC1+dNI
2
4
6
8
10
12
14
number of universal variables
Figure 9: Average checks performed by FC1 and FC1+dNI
moves to the end of the formula problems become harder. As we can see, exploiting value interchangeability can speed up search significantly. Finally, in Figures 6 and 9 we compare FC1 to FC1+dNI; this time varying the number of universal variables and using a different random generation model. In this model we randomly pick n∀ variables and assign them universal quantification. We also allow constraints of the form ∃xi ∀xj . The problem settings here are n = 20, d = 5, and p = 0.12. Again q is fixed so that all problems are from the phase transition region. As we increase the number of universal variables problems become very hard for FC1, while FC1+dNI scales much better and can be orders of magnitude faster than FC1.
7 Conclusion In this paper we studied algorithms for quantified CSPs with discrete non-boolean domains. We first described an AC algorithm that can deal with arbitrary binary constraints. We then extended the BT and FC algorithms so that they can handle quantification. We also proposed a modification of FC that is better suited to QCSPs. We showed how value interchangeability can be exploited in QCSPs to break symmetries and speed up search by orders of magnitude. We tested experimentally the algorithms and methods proposed and made a preliminary analysis of the phase transition in binary QCSPs. There is a lot of future work to be done. We intend to consider dynamic variable ordering heuristics, extensions of the algorithms to non-binary constraints, a detailed investigation of phase transition phenomenae in QCSPs, and, very importantly, the application of the algorithms in real problems. 10
References [Beckwith & Choueiry2001] Beckwith, A., and Choueiry, B. 2001. On the dynamic detection of interchangeability in finite constraint satisfaction problems. In Proceedings of CP-2001, 760. [Benhamou & Goualard2000] Benhamou, F., and Goualard, F. 2000. Universally quantified interval constraints. In Proceedings of CP-2000, 67–82. [Bessi`ere & R´egin2001] Bessi`ere, C., and R´egin, J. 2001. Refining the basic constraint propagation algorithm. In Proceedings of IJCAI-2001, 309–315. [Boerner et al.2003] Boerner, F.; Bulatov, A.; Jeavons, P.; and Krokhin, A. 2003. Quantified constraints: algorithms and complexity. In Proceedings of CSL-2003, 244–258. [Bordeaux & Monfroy2002] Bordeaux, L., and Monfroy, E. 2002. Beyond NP: Arcconsistency for quantified constraints. In Proceedings of CP-2002. [Bylander1994] Bylander, T. 1994. The computational complexity of propositional strips planning. Artificial Intelligence 69:165–204. [Cadoli, Giovanardi, & Schaerf1998] Cadoli, M.; Giovanardi, A.; and Schaerf, M. 1998. An algorithm to evaluate quantified boolean formulae. In Proceedings of AAAI-98, 262–267. [Creignou, Khanna, & M.2001] Creignou, N.; Khanna, S.; and M., S., eds. 2001. Complexity Classifications of Boolean Constraint Satisfaction Problems. SIAM Monographs in Discrete Mathematis and Applications. [Eiter & Gottlob1992] Eiter, T., and Gottlob, G. 1992. On the complexity of propositional knowledge base revision, updates and conterfactuals. Artificial Intelligence 57:227–270. [Freuder1991] Freuder, E. 1991. Eliminating interchangeable values in constraint satisfaction problems. In Proceedings of AAAI-91, 227–233. [Gent & Smith2000] Gent, I., and Smith, B. 2000. Symmetry Breaking in Constraint Programming. In Proceedings of ECAI, 599–603. [Gent & Walsh1999] Gent, I., and Walsh, T. 1999. Beyond NP: The QSAT phase transition. In Proceedings of AAAI-99, 648–653. [Giunchiglia, Narizzano, & Tacchella2001] Giunchiglia, E.; Narizzano, M.; and Tacchella, A. 2001. Backjumping for quantified boolean logic satisfiability. In Proceedings of IJCAI-2001, 275–281. [Giunchiglia, Narizzano, & Tacchella2002] Giunchiglia, E.; Narizzano, M.; and Tacchella, A. 2002. Learning for quantified boolean logic satisfiability. In Proceedings of AAAI-2001, 649–654. [Haselbock1993] Haselbock, A. 1993. Exploiting interchangeabilities in constraint satisfaction problems. In Proceedings of IJCAI-93, 282–287. [Ratschan2002] Ratschan, S. 2002. Quantified Constraints under Perturbations. Journal of Symbolic Computation 33(4):493–505. 11
[Ratschan2003] Ratschan, S. 2003. Applications of quantified constraint solving over the reals bibliography, http://www.mpi-sb.mpg.de/ ˜ratschan/appqcs.html. [Schaefer1978] Schaefer, T. 1978. Complexity of decision problems based on finite two-person perfect information games. Journal of Computer and System Sciences 16:185–225. [Zhang & Yap2001] Zhang, Y., and Yap, R. 2001. Making AC-3 an optimal algorithm. In Proceedings of IJCAI-2001, 316–321.
12