Landscape of solutions in constraint satisfaction problems

We present a theoretical framework for characterizing the geometrical properties of the space of solutions in constraint satisfaction problems, together with practical algorithms for studying this structure on particular instances. We apply our method to the coloring problem, for which we obtain the total number of solutions and analyze in detail the distribution of distances between solutions.

We present a theoretical framework for characterizing the geometrical properties of the space of solutions in constraint satisfaction problems, together with practical algorithms for studying this structure on particular instances. We apply our method to the coloring problem, for which we obtain the total number of solutions and analyze in detail the distribution of distances between solutions. Constraint satisfaction problems (CSPs) offer a unified language describing many complex systems. Originally investigated by computer scientists in relation with algorithmic complexity [1], CSPs have recently attracted much interest within the physics community, following the discovery of their close ties with spin-glass theory [2,3]. They are currently used to tackle systems as diverse as, among others, error-correcting codes [4], rigidity models [5], and regulatory genetic networks [6]. The ubiquity of CSPs stems from their general nature: given a set of N discrete variables subject to M constraints, a CSP consists in deciding whether there are assignments of the variables satisfying all the constraints. Of special interest is the class of NP-complete problems [1], for which no algorithm is known that guarantees to decide the satisfiability of a problem instance in a time polynomial in N . A well-studied example is the q-coloring problem (q-COL): given a graph with N nodes and M edges connecting certain pairs of nodes, and given q colors, can we color the nodes so that no two connected nodes share a common color?
Much insight into CSPs is gained by focusing on typical instances drawn from an ensemble with a fixed density of constraints α = M/N . As α is varied, a threshold phenomenon is generically observed. Below a critical value α c , instances are typically satisfiable (SAT phase): at least one satisfying assignment (or solution) exists with probability one when N → ∞; above α c they are typically unsatisfiable (UNSAT phase). Rigorous bounds on α c have been derived [7]. The running time of algorithms often increases greatly near α c [8].
CSPs enter the standard framework of statistical physics by associating to each assignment of the N vari- defined as the number of constraints violated by σ. The satisfiability problem reduces to the determination of the ground-state energy In recent years, several methods borrowed from statistical physics [3,9,10] have pointed to the existence of a second threshold α d < α c , associated with clustering of the space S of all solutions. For α < α d (Easy-SAT phase), S is typically connected: any two solutions are joined by a path of moves involving a finite number of variables. For α d < α < α c (Hard-SAT phase), S is typically disconnected: solutions gather into clusters far apart from each other (as illustrated in Fig. 1a), which can only be joined by moves involving a finite fraction of the variables. This scenario, which has been confirmed rigorously in some cases [11], suggests that computational hardness may be caused by the trapping of local algorithms in metastable clusters, which are exponentially more numerous than clusters of solutions.
In this Letter, we introduce methods to analyze in detail the structure of the solution space of CSPs in the Hard-SAT phase. The first aspect we analyze is the entropic structure. A cluster λ typically contains an exponential number of solutions, M λ ≍ exp(N s λ ), where N s λ is the internal entropy of λ (we write a N ≍ b N when ln a N / ln b N → 1 as N → ∞). We introduce the entropic complexity Σ s (s) that counts the number N N (s) ≍ exp[N Σ s (s)] of clusters with internal entropy N s, and a method for computing Σ s (s) and the total entropy density s tot , yielding the total number of solutions, |S| ≍ exp(N s tot ), for individual instances of any CSP. The problem of counting the number of solutions of a CSP is in general #P -complete [1,12], a class of problems even harder than NP-complete [13]. Estimating |S| is important in applications such as graph reliability [12], and computing partition functions.
A second, related aspect of the structure of S is its geometry. We introduce a method to compute the geometric complexity Σ d (d), which counts the number of clusters at a given distance N d from a reference assignment (see Fig. 1a), and the related weight enumerator function, of direct interest in coding theory [14]. Finally, we indicate several generalizations of these methods.
Our methods are based on extensions of the "energetic" cavity method (CM) of Ref. 15. We illustrate them for q-COL and show numerical results for q = 3, but we emphasize that any CSP can be studied along the same lines. The energy function associated to q-COL is that of the antiferromagnetic Potts model, E[σ] = (i,j) δ σi,σj , where σ i ∈ {1, . . . , q} and the sum is over the M graph edges. We study Erdős-Rényi random graphs [16], con- gives the probability that node i has color σ in the absence of node j. structed by connecting any pair of nodes with probability 2α/N . For large N this gives M = αN and a Poissondistributed connectivity with mean 2α.
In the unclustered phase ("replica symmetric" phase in the language of spin-glass theory) the zero-temperature energetic CM [15] computes the ground state energy recursively by adding one node at a time. For large enough α, the recursion no longer admits a unique solutions and is generalized, via the one-step replica symmetry breaking Ansatz (1RSB), to a distributional recursion which can be solved self-consistently, yielding the "energetic" complexity Σ ǫ (ǫ), which counts the number The method was applied to q-COL in Refs. 17, 18, that report α Counting solutions -The energetic CM has the virtue of being simple enough, and it thus allows a precise determination of α c , and the development of a powerful new class of algorithms (survey propagation [10]). This simplicity is obtained because one focuses only on clusters in which some of the variables are frozen, i.e. constrained to adopt a unique color. Computing the entropy requires a more detailed information, and thus a different formalism, as first identified in Ref. 9 within the replica framework. Our approach to computing entropies is illustrated in Fig. 1b. The basic quantity we consider is the number Z (i→j) σi of solutions for the "cavity" graph obtained from the original graph by removing node j, when the color of node i is fixed to σ i . In the unclustered phase, due to the locally tree-like structure of large random graphs, the quantities Z (k→i) σ k , with k denoting any of the nodes connected to i except j (in symbols, k ∈ i − j), are independent of each other for large N . Hence a recursion relation holds, Z By defining a cavity field as the probability of having color σ on node i in the absence of j, ψ , the recursion relation translates to with Z fixed by normalization. The ensemble of these equations on all oriented links, known as belief propagation equations [21], has a unique solution for α < α d . In refers to the onset of clusters with frozen variables while at α d clusters without frozen variables may also appear. It is not difficult to show that the total entropy of the whole graph is given by N s tot = i ∆S (i) − (i,j) ∆S (i,j) where, similarly to the energetic CM [3], we need to substract the link con- ) to avoid double counting. Above α d , following the 1RSB Ansatz [22], we assume the existence of many clusters. We then compute a potential φ(x) related to the entropic complexity Σ s (s) through where x is a Lagrange multiplier which fixes the internal entropy and s min , s max are the points at which Σ s (s) vanishes. Assuming the independence of the quantities Z (k→i) σ k within each cluster, we introduce probability distributions of the cavity fields P (i→j) (ψ (i→j) ) with respect to the clusters, and generalize the cavity recursion to After solving Eq. (3), the potential is computed as where ∆S (i) , ∆S (i,j) are given above. A saddle point evaluation of Eq. (2) gives x = −∂ s Σ s (s). Hence, from φ(x) we obtain Σ s (s) via the Legendre transform s(x) = ∂ x φ(x), Σ s (x) = φ(x) − xs(x). We solve numerically Eq. (3) on individual graphs by representing the distributions P (i→j) with a population of N P cavity fields on each oriented link. The resulting message passing algorithm is an entropic generalization of survey propagation [10]. Our entropic CM provides greater information at the price of greater computational difficulty, due to the continuous nature of the cavity fields. Figure 2 displays some of our results for 3-COL, for three individual graphs with N = 5000. In particular, the total entropy of solutions is given by s tot = φ(1) = s max where the last equality holds because, according to our numerical results in Fig. 2 Therefore, for 3-COL the total entropy is dominated by a subexponential number of giant clusters: a randomly chosen solution falls almost surely in one of such rare clusters. We also find that the fraction of frozen variables is finite in the interval [s min , s max ].
We also implemented a version of Eq. (3) averaged over Erdős-Rényi graphs, by considering a population of links with Poisson connectivity and a population of cavity fields on each link. Figure 3 shows the graph averages obtained in this way for s tot , the typical internal entropy s typ = arg max s Σ s (s), and the typical complexity Σ typ = Σ s (s typ )[= Σ ǫ (0)], as a function of α. The graph-averaged complexity curves Σ s (s) (not shown) resemble those in Fig. 2. (Graph-to-graph fluctuations for N = 5000 are significant: for α = 2.3, the standard deviation of Σ typ is about 27% of the mean). The negative complexities in Fig. 2 have no direct interpretation on individual graphs, but for the graph-averaged case they are related to rare atypical graphs [24].
The above formalism can be generalized to yield Σ ǫ,s (ǫ, s), the complexity associated with metastable clusters of energy N ǫ > 0 and entropy N s, with Σ ǫ,s (0, s) = Σ s (s), by adding a second multiplier y [25]. An equivalent information is contained in the finite temperature complexity Σ f (f ; β) [22], where f is the free energy and β the inverse temperature, based on the identity e N [Σǫ,s(ǫ,s)−yǫ+xs] dǫ ds = e N [Σ f (f ;β)−xβf ] df, (5) with f = ǫ − s/β and y = βx. The energetic CM is recovered for β → ∞ and x → 0 with y = βx fixed, which amounts to ignore all entropic effects [26].
Counting clusters at a given distance -We now turn to the geometric structure and show how the CM can be used to investigate inter-cluster distances. We illustrate this by addressing the problem of counting the number of clusters as a function of their distance from a fixed reference configuration ς, which we rephrase as a new CSP, named dCSP, whose thermodynamics reflect the geometry of the solution space of the initial CSP. The valid assignments of dCSP are the solutions σ ∈ S of the initial CSP: these are configurations of zero energy, and in this sense dCSP concentrates on the zero temperature case of the original problem. But we introduce in dCSP a new energy function which is the Hamming distance from ς, . Therefore the clusters (resp., assignments) of dCSP with energy E D are the zero-energy clusters (resp., solutions) at distance E D from ς in the initial CSP.
The optimization problem for dCSP consists in finding the maximal (or the minimal) distance between ς and a solution of the original problem. By applying the energetic CM to this problem [27], we obtain a geometric complexity Σ d (d) giving the number of clusters at dis- Ansatz is unstable [19]. The straight line is the "liquid" or infinite-temperature solution, s liq = (1−α) ln(q)+α ln(q −1). that the size of this plateau coincides with the typical diameter computed within the entropic CM [25]. Generalizations -The above method can be extended to count the number of solutions at distance N d from ς, known as the weight enumerator function A N (d) in coding theory [14]. This can be deduced from the complexity Σ d,s (d, s) which gives the number of clusters with internal entropy N s at distance N d from the reference configuration ς. Such a complexity can be obtained by studying the dCSP with a finite value of a new inverse temperature β D , which is conjugate to the energy E D (keeping the original temperature β −1 to zero) [25]. Once Σ d,s (d, s) has been found, one obtains the leading behaviour of the weight enumerator as In the same spirit, our analysis can be extended to metastable configurations: in order to compute the complexity Σ ǫ,d,s (ǫ, d, s) counting clusters with energy N ǫ, entropy N s, at distance N d from ς, one needs to introduce three Lagrange multipliers x, y, z. All the previous complexities are particular limits of this more general framework [25].
Conclusions -We have presented methods to analyze the entropic and geometric structure of the clustered phase in q-COL, which give access to quantities such as internal cluster entropies not accessible to previous methods. Our results for 3-COL show the existence of giant, atypical clusters which contain the majority of solutions. Generalization to other CSPs such as k-SAT, where a similar picture may hold, is straightforward.
Notice that the present results were obtained within a 1RSB ansatz, and the stability of our solution should thus be checked (extending the method of Ref. 20) to assess whether the solution is exact or only an approximation to a more complicated one involving higher order RSB.
The new information extracted with our entropic CM could be exploited to design new algorithms for finding solutions to individual instances, improving on present survey propagation algorithms which only use energetic information [10]. We also envision applications to inference problems such as Bayesian belief networks [28].
We thank D. Battaglia and R. Zecchina for discussions, and A. Pagnani for sending the SP code used in Refs. 17, 18. This work was supported in part by the European Community's Human Potential Programme under contracts HPRN-CT-2002-00319 (STIPCO) and by the Community's EVERGROW Integrated Project.
Note added: the recent paper [29] addresses similar questions.