The phase transition in constraint satisfaction problems: A closer look at the mushy region

This paper examines the phase transition, in which the probability that there is a solution decreases from 1 to 0 as the constraints become increasingly tight, for a class of binary constraint satisfaction problems. In particular, it considers the mushy region, i.e. those values of the constraint tightness for which random samples of problems contain both soluble and insoluble instances. The paper reports a series of experiments with randomly-generated problems, using a standard search algorithm, intended to be representative of this class of algorithm. It attempts to describe the changing behaviour of these problems in more detail than the simple `easy-hard-easy' phase transition description; it relates the location of the maximum search cost to an algorithm-independent measure, namely the expected number of solutions; and it relates the phase transition phenomena observed when nding a single solution to the behaviour of the search algorithm when nding all solutions to the problem. Introduction Cheeseman, Kanefsky and Taylor [2] note that for many NP-complete or NPhard problems, a phase transition can be seen as an order parameter is varied; the transition is from problems that are under-constrained, and so relatively easy to solve, to problems that are over-constrained, and so relatively easy to prove insoluble. They observed that the problems which are on average hardest to solve occur between these two types of relatively easy problem, and further that, in the cases they considered, the sharpness of the phase transition increases with a size parameter. For instance, for Hamiltonian Circuit problems, the order parameter giving the phase transition is the connectivity of the graph and the sharpness of the phase transition increases with graph size. Mitchell, Selman and Levesque [6] report similar experience for satis ability problems, and Williams and Hogg [9] have developed approximate cost models for classes of NP problems and classes of algorithm in order to estimate where the phase transition occurs and where the maximum average search cost occurs; a more recent paper [10] carries out a similar analysis for constraint satisfaction problems. This paper looks more closely at the phase transition for a class of binary constraint satisfaction problems (CSPs) and reports a series of experiments with randomly-generated problems, using a standard search algorithm, intended to be representative of this class of algorithm. It attempts to describe the changing behaviour of these problems in more detail than the simple `easy-hard-easy' phase transition description; it relates the location of 1 the maximum search cost to an algorithm-independent measure, namely the expected number of solutions; and it relates the phase transition phenomena observed when nding a single solution to the behaviour of the search algorithm when nding all solutions to the problem. In phase transitions of the kind modelled by applied mathematicians, for instance from a solid to a liquid phase, the cause of the phase transition may be modelled by an instantaneous change in some environmental parameter. However, the e ect of the change may take place over a nite spatial region; this region (in which the material is neither completely liquid nor completely solid) is referred to as the mushy region. The term is used in this paper to denote the range of values of the order parameter over which the phase transition from solubility to insolubility takes place, in order to emphasise that the transition is not instantaneous. The Experimental CSPs A series of experiments has been carried out using sets of randomly-generated binary constraint satisfaction problems. Each set of problems is characterised by four parameters: n, the number of variables; m, the number of values in each variable's domain; p1, the probability that there is a constraint between a pair of variables, and p2, the conditional probability that a pair of values is inconsistent for a pair of variables, given that there is a constraint between the variables. Previous work with randomly-generated CSPs (see for instance [3]) has also de ned problems by these four parameters, albeit using di erent terminology. There are several possible ways of treating the probabilities p1 and p2; one is to apply the appropriate value independently to each pair of variables and then to each pair of values, where a constraint has been generated. This would give a set of problems in which, on average, the number of constrained pairs of variables is p1n(n 1)=2, and for each pair of constrained variables, the average number of inconsistent pairs of values is m2p2. However, within a set of randomly-generated problems, there may be considerable variation. (This will be referred to below as Model 1.) Since the ultimate aim in considering sets of randomly-generated CSPs is to be able to make predictions about the behaviour of problems of a given size, with particular observed numbers of constraints and numbers of inconsistent pairs of values, it was decided to generate sets of problems in which p1 and p2 specify precisely, rather than on average, how many constraints and pairs of inconsistent values there should be. Hence, for each set of randomlygenerated problems, the number of constrained pairs of variables is exactly p1n(n 1)=2, and for each pair of constrained variables, the number of inconsistent pairs of values is exactly m2p2. This is done by randomly permuting 2 a list of the possible variable pairs and choosing the rst p1n(n 1)=2, and then for each constrained pair of variables, randomly permuting the m2 possible pairs of values and choosing the rst m2p2. This model is used for all the experiments described in this paper. As far as generating the constraint graph is concerned, the two models correspond to the random graph models discussed by Bollobas [1]. In each of the sets of experiments described below, n, m and p1 were xed, and p2 was the varying order parameter. One minor disadvantage of Model 2, compared with Model 1, is that one cannot vary p2 in steps of less than 1=m2; in the experiments, the value of m is 10, allowing p2 to be varied in steps of 0.01. The Phase Transition in Random CSPs In order to observe the phase transition experimentally, it is necessary to choose an algorithm and to solve a set of problems. For these experiments, the forward checking algorithm was chosen, with the failrst heuristic to select the next variable to be instantiated [4]. Although not the best available search algorithm for CSPs, it is reasonably e cient and can be used to nd either just one solution, or all solutions. It was hoped that it would prove to be representative of its class of CSP algorithms, i.e. depthrst search algorithms which seek to extend consistent partial solutions, backtracking when failure is detected. Figure 1 shows the median cost, measured by the number of consistency checks required to nd one solution or prove that there is no solution for each of a set of problems with n=8, m=10 and p1=1.0, and p2 varying. These are relatively small problems: this was necessary because it was required to nd all solutions for these problems, as well as the rst, and in order to investigate the phase transition behaviour in detail, 500 problems were generated for each value of p2 over the phase transition (0:43 p2 0:55). It would be prohibitively time-consuming to carry out this kind of detailed investigation with large problems. The vertical lines in Figure 1 show the boundaries of the mushy region: they mark the value of p2 at which the rst insoluble problems appear, as p2 increases, and the value at which the last soluble problem is found. The most notable feature of Figure 1 is the sharp peak in the median cost which occurs during the phase transition. For smaller values of p2, for which all problems are soluble, problems are much easier to solve on average, until there is a sharp increase in di culty as p2 increases and insoluble problems begin to occur. For larger values of p2, as problems become uniformly insoluble, the fall in the median consistency checks is much more gradual, and it is an oversimpli cation to describe this side of the phase transition as a region of easy 3 100 200 50