Solving CSP Instances Beyond the Phase Transition ... - CiteSeerX

2 downloads 0 Views 180KB Size Report
been done by Dozier in 2], only little work has been performed in this area of proving unsolvability with SSAs. ..... 6] J. H. Holland. Adaptation in natural and arti ...
Solving CSP Instances Beyond the Phase Transition Using Stochastic Search Algorithms Luk Schoofs, Bart Naudts Intelligent Systems Lab, Department of Mathematics and Computer Science, University of Antwerp, RUCA, Groenenborgerlaan 171, B-2020 Antwerpen. flschoofs,[email protected]

Abstract When solving constraint satisfaction problems (CSPs) with stochastic search algorithms (SSAs) using the standard penalty function, it is not possible to show that there is no solution for a problem instance. In this paper we present a hybrid function that can be generally used in conjunction with SSAs to prove unsolvability without changing the search algorithms drastically. We use eight state-of-the-art algorithms to show the general usability of the new function. We compare the algorithms with and without the new penalty function and we test the scalability of the new function.

1 Introduction Stochastic search algorithms (SSAs) are good heuristics for the NP-complete constraint satisfaction problems (CSP, e.g., [15], [11], [7], [10], [8]). The major drawback of using SSAs in conjunction with the standard penalty function is that they cannot prove that an instance has no solution. It is this drawback that we want to solve in the most general way. The new method has to be elegant and easily integratable into existing SSAs without changing the overall setting of the algorithm. We test it on state-of-the-art algorithms, like for instance di erent kinds of GAs [6], PBIL [1] and UMDA [9]. Although an earlier attempt has been done by Dozier in [2], only little work has been performed in this area of proving unsolvability with SSAs. The structure of the paper is as follows. First we de ne constraint satisfaction problems, with the standard penalty function, and the concept of path consistency. The new hybrid penalty function is discussed in Section 3 and the empirical results can be found in Section 4. We conclude this paper with an overall conclusion in Section 5.

2 Constraint satisfaction problems A binary constraint satisfaction problem consists of the following components: { a set of variables 0 1 ?1 ; { a domain corresponding to each variable; x ; x ; :::; xn

Di

{ a subset   for each pair of variables ( ), with 0  , which represents a constraint when it di ers from the Cartesian product  . It can be shown that every CSP can be transformed into an equivalent binary CSP [15]. The goal of a CSP is to assign to the variables a value from their domain in such a way that all constraints are satis ed. Formally, we say that a constraint is satis ed if and only if ( ) 2 . The couple ( ) is then called a valid assignment. When ( ) 2 we say that the assignment ( ) violates the constraint . Besides the number of variables and the number of elements in the domains , there are two other parameters that have to be set to generate a random CSP instance. The rst one is the connectivity: the probability that a constraint is created between two variables. The second parameter is the probability that a couple ( ) is removed from the set  . This is called the tightness of the constraints in the CSP. A phase transition from solvable to unsolvable is observed when the tightness goes from 0 to 1, at a value depending on the connectivity, the number of variables and their domain sizes. The mushy region is the area around the phase transition where solvable and unsolvable CSP instances coexist in signi cant proportions. With every CSP instance, a constraint graph = ( ) can be associated in the following way: { every variable is a node in , { every constraint between the variables and is an edge in between the nodes in that correspond to the variables and . The constraint graph of a CSP can be directed or undirected, in particular the couples in can be ordered or unordered. Cij

Di

Di

Dj

i; j

i < j < n

Dj

xi

Di

Cij

x i ; xj

x i ; xj

xi ; x j

Cij

x i ; xj

= Cij

Cij

Di

i; j

Di

Dj

G

i

V; E

V

i

V

j

i

E

j

E

2.1 The standard penalty function

The diculty with using black-box algorithms like evolutionary algorithms for nding solutions of a CSP is that the problem has no explicit objective function to be optimized. It is clear that one has to be constructed. The most obvious choice is the standard penalty function, which simply counts the number of constraints violated by one assignment. An assignment is a solution of the CSP if and only if the penalty function becomes zero. It is clear that assignments with an equal number of constraint violations share the same tness value, and that no distinction is made between the constraints. In particular, no distinction is made between what one intuitively experiences as easy and hard constraints. x

2.2 Path consistency

To make the search space of the search problem smaller, we can eliminate the values from the domains which will certainly not lead to a solution. To do this we need the notion of path consistency [15]. Suppose = f 0 ?1 g is a path in constraint graph = ( ), with 2 . If for every edge ( ) 2 the following two conditions hold P

vi

V

v ; : : : ; vn

v i ; vj

G

P

V; E

1. we can assign a value to the corresponding variables from their respective domains in such a way that no constraint between the two variables is violated, and 2. we can assign to the corresponding variable of every vertex 2 n f g a value from its domain in such a way that no constraint between every two adjacent variables on the path is violated, then the path is said to be path consistent. A CSP is said to be path consistent if and only if every path in the corresponding constraint graph is path consistent. Intuitively, path consistency means that every value in the domains can lead to a solution of the CSP. In general, randomly generated instances are not path consistent. Path consistency can be enforced by eliminating values from the domains that do not follow the conditions stated above. When during the elimination phase a domain becomes empty, the CSP instance has no solution, because an assignment to that variable is impossible. In [15] one nds deterministic algorithms to make CSP instances path consistent. x i ; xj

D i ; Dj

Cij

xk

vi ; vj

vk

V

Dk

P

P

G

3 The hybrid penalty function The new penalty function we present is a hybrid between the standard penalty function and a path consistency algorithm. The SSA in conjunction with the hybrid penalty function stops its search when a domain becomes empty. In this way it is used to eciently prove that there is no solution for typical instances beyond the mushy region. As the empirical results show, the path consistency algorithm is not able to decide solvability in the mushy region. Decreasing the domain size of a variable makes the search space smaller. When the function detects that a certain value, for a certain position, cannot lead to a solution it is eliminated and the SSA does not have to search that region of the search space anymore.

3.1 The algorithm

During the evaluation of a candidate solution, couples ( ) are eliminated from the set =  when a con ict between the variables and with these values is detected. If the couple was already eliminated in a previous cycle, the elimination has no e ect and the evaluation continues. At the same time the penalty is increased with the appropriate value. When a value for a variable has no more couples in , the value can be eliminated from the domain . Because is eliminated from the domain it cannot be used in any other combination containing variable and all couples with are eliminated from every other set , 0  . When is eliminated from , all couples containing value are eliminated from the set . When this is done, it is possible that value is no more represented in (for 6= ). If this is the case, the value is also eliminated from . This recursive elimination is done until no values can be deleted anymore. When a domain turns out to be empty, the evaluation is stopped and a \no solution" token is returned to the SSA. After processing a variable of the candidate solution, the evaluation continues with the next variable until x i ; xj

Pij

Di

Dj

i

xi

i

Di

Pij

xi

i

xi

Pkl

xi

Di

Pij

Pjk

Dj

k; l < n

xi

xj

k

i

j

all are checked. When this is done and no empty sets are detected, the function returns the tness value for this candidate solution and the SSA can continue its search. The hybrid penalty function is detailed in Figure 1. eliminate values(i; j; xi ; xj ) eliminate the tuple xi ; xj from Pij (if possible) if 9 empty domain return `no solution' if no tuples xi ;  in Pij then eliminate xi form Di 8k such that xi ; xk 2 Cik eliminate values(i; k; xi ; xk ) 8k such that xk ; xi 2 Cki eliminate values(k; i; xk ; xi ) if no tuples ; xj in Pij then eliminate xj form Dj 8k such that xj ; xk 2 Cjk eliminate values(j; k; xj ; xk ) 8k such that xk ; xj 2 Ckj eliminate values(k; j; xk ; xj )

(

(

(

)

)

(

)

(

)

(

)

(

)

)

=

fx0 ; x1 ; :::; xn?1 g) penalty function(X for every variable i for every variable j other than i if conflict between i xi and j xj then if eliminate values(i; j; xi , xj ) = `no solution' then return `no solution' increment the penalty pen return the penalty value pen

=

=

Figure 1: The hybrid penalty function in pseudo code. It is composed of two parts: the rst part implements the path consistency algorithm. The second part is the main body of the penalty function as described in Section 3.1. The expression ( i ) is the set of all couple with as rst variable with the value i . The value in the second position does not matter. We assume that the sets ij are already created. x ;

i

x

P

3.2 Remarks

The SSA works with the univariate information of the hybrid penalty function to generate new candidate solutions. The interaction information, however, is not used. This means that bad combinations of values can be used several times during the search. Tabu search [4] can prevent this, but experiments along this line have failed up to now. The algorithms that use the hybrid penalty function have to generate a high diversity of values for the path consistency algorithm to be ecient. This is not

the case for a few algorithms like UMDA, as we will see later on. We want to reduce the search space as quickly as possible. Therefore the hybrid penalty function eliminates as many values as possible from as many domains as possible in one evaluation of a candidate solution. This is why most of the evaluation time is spent at making an instance path consistent. The e ect of eliminating an element from a domain is only noticable when new values are introduced. GA-like algorithms only generate new values through the mutation operator. Algorithms like MIMIC, PBIL, ANT, etc. construct completely new populations and for this reason introduce a lot more new values than GA-like algorithms.

4 Experimental results To study the e ectiveness of the new penalty function, we applied it to several SSAs. This also shows that the hybrid penalty function can be generally used with a great variety of algorithms. { { { { { { { {

random hill climbing, HC population-based incremental learning, PBIL [1] mutual-information-maximizing input clustering, MIMIC [3] simple genetic algorithm, SGA [6], [5] genetic algorithm with bit-based simulated crossover, GA-BSC [14] adaptive genetic algorithm, AGA [12] univariate marginal distribution algorithm, UMDA [9] ant colony algorithms, ANT [13]

The experiments were set up to show the di erence between the search with the standard penalty function and with the hybrid penalty function. The algorithms are run with optimal values for there parameters. These optimal values are found experimentally, as one can see in [13]. The runs are rst done for small problem instances: 10 variables, 4 elements in the domains, a connectivity of 1.0. The tightness is changed between 0 and 1 with 0.05 as step size. This can be summarized as (10, 4, 1.0). As a second experiment we use larger problem instances to show that the hybrid penalty function is also e ective for larger problems. The larger CSP model is presented as (30, 5, 0.5). In what follows the gures are always shown in pairs, for the same algorithm, so one can clearly see what happens when going from a smaller to a larger problem. A gure always shows the median number of evaluations over 30 runs for every tightness value. A distinction is made between the runs with the standard penalty function (lines with the stars) and those with the hybrid penalty function (lines with the boxes). Because of space limitations only the most relevant gures are shown. In Figure 2 we used a deterministic backjumper (cf. [15]) to solve random instances of the two previously described problem classes. With this deterministic algorithm we can determine the location of the mushy region. For the

6.5

12

6

11

5.5

10

5

9

4.5

8

4

7

3.5

6

3

5

2.5

4 0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0

0.1

0.2

0.3

0.4

(a)

0.5

0.6

0.7

0.8

0.9

1

(b)

Figure 2: Two plots which represent the median number of evaluations needed by a

backjumper when solving (a) (10, 4, 1.0) respectively (b) (30, 5, 0.5) CSP instances as described in Section 4. On the x-axis the tightness is represented and the y-axis gives the median number of evaluations in a logarithmic scale over 30 experiments. Solid lines indicate the median number of evaluations needed when a solution is found. Dotted lines denote the median number of evaluations needed when no solution is found. Search is stopped after 100,000 evaluations and the instance is classi ed with the ones for which no solution is found. The mushy region is the area where the solid and the dotted lines overlap.

12

12

10

10

8

8

6

6

4

4

2

2

0

0 0

0.1

0.2

0.3

0.4

0.5

(a)

0.6

0.7

0.8

0.9

1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

(b)

Figure 3: Two plots for a HC. The left plot describes the median number of evaluations needed to solve a (10, 4, 1.0) CSP class. On the right side the same is shown for a (30, 5, 0.5) CSP class. The x-axis presents the tightness and the y-axis gives the median number of evaluations in a logarithmic scale over 30 experiments. On both plots the curve with the stars represents the runs with the standard penalty function and the lines with the boxes indicate the runs with the hybrid penalty function.

12

12

10

10

8

8

6

6

4

4

2

2

0

0 0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0

0.1

0.2

0.3

(a)

0.4

0.5

0.6

0.7

0.8

0.9

1

0.9

1

0.9

1

(b)

Figure 4: The plots for PBIL. Same explanation as for Figure 3 12

12

10

10

8

8

6

6

4

4

2

2

0

0 0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

0

0.1

0.2

0.3

(a)

0.4

0.5

0.6

0.7

0.8

(b)

Figure 5: The plots for SGA. Same explanation as for Figure 3 12

12

10

10

8

8

6

6

4

4

2

2

0

0 0

0.1

0.2

0.3

0.4

0.5

(a)

0.6

0.7

0.8

0.9

1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

(b)

Figure 6: The plots for AGA. Same explanation as for Figure 3

12

12

10

10

8

8

6

6

4

4

2

2

0

0 0

0.1

0.2

0.3

0.4

0.5

(a)

0.6

0.7

0.8

0.9

1

0

0.1

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

(b)

Figure 7: The plots for ANT. Same explanation as for Figure 3 problem with 10 variables it is found between tightness values 0.18 and 0.31. In the larger problem this is between 0.12 and 0.18. As we can see in Figures 3{7, the performance of the algorithms before the mushy region is not a ected by the hybrid penalty function. It can be clearly seen that the two curves are located on top of each other. Also instances in the mushy region cannot be solved or proved unsolvable. None of the algorithms was able to solve instances in the mushy region in an ecient way, as expected. They even perform badly near the mushy region. The peak around the mushy region reaches the maximum number of evaluations, which means that the algorithms cannot solve the instances in a proper way. This unsolvability can be seen for solvable instances before of the mushy region as well as for unsolvable instances beyond the mushy region. For instance the SGA (Figure 5) and the GA-BSC perform so badly that even for very small tightness values no solution can be found. This is due to the fact that a very large population size had to be used and as a result the maximum number of evaluations is reached in fewer generations. Even though the same unsolvability checker is applied, the area around the mushy region is not the same for every algorithm. This can be seen on Figures 5 and 6 where the bump for SGA is larger than the one for AGA. It can also be seen that beyond the phase transition all algorithms nd proof that there is no solution on the same tightness value. The bump is larger before the phase transition where all instances are solvable. As a result, the shape around the mushy region is determined by the algorithm itself and not by the path consistency algorithm. In the case of the deterministic algorithm used to locate the mushy region, we observe that beyond the mushy region the median number of evaluations is decreasing slowly. All SSAs using the standard penalty function cannot prove there is no solution. They keep searching for a solution forever (which means 100,000 evaluations). Once the curve reaches the maximum, it never decreases again. When the SSAs use the hybrid penalty function, the curve suddenly falls down, meaning that is very easy to prove there is no solution. It is obvious to see that this rst population carries enough information to prove there is no

solution. This drop is for every algorithm very sudden and very steep, but it does not coincide with the edge of the mushy region. We notice that in the region where the deterministic algorithm needs a lot of evaluations to prove there is no solution, the SSAs cannot nd the proof.

5 Conclusions In this paper we presented a hybrid method for determining the unsolvability of CSP instances. The method is based on the standard penalty function which is hybridized with a path consistency algorithm. The new penalty function can easily be added to every SSA solving CSPs without in uencing the whole setting of the algorithm. The new hybrid penalty function is not usable for instances in the mushy region itself and on average it does not a ect the performance of the algorithms on instances before the mushy region.

Acknowledgments The second author is a post-doctoral researcher of the Fund for Scienti c Research { Flanders (Belgium) (F.W.O.).

References [1] S. Baluja and R. Caruana. Removing the genetics from the standard genetic algorithm. In A. Prieditis and S. Russel, editors, Proceedings of ICML95, pages 38{46. Morgan Kaufmann Publishers, 1995. [2] J. Bowen and G. Dozier. Solving constraint satisfaction problems using a genetic/systematic search hybrid that realizes when to quit. In Larry J. Eshelman, editor, Proceedings of the 6th international conference on Genetic Algorithms, pages 122{128, 1995. [3] J. S. De Bonet, C. L. Isbell, and P. Viola. MIMIC: Finding optima by estimating probability densities. In M. Mozer, M. Jordan, and Th. Petsche, editors, Advances in Neural Information Processing Systems 9, pages 424{ 431. MIT Press, 1997. [4] F. Glover and M. Laguna. Tabu Search. Kluwer Academic Publishers, 1997. [5] D. E. Goldberg. Simple genetic algorithms and the minimal deceptive problem. In Davis L., editor, Genetic algorithms and simulated annealing, pages 74{88. Morgan Kaufmann Publishers, 1987. [6] J. H. Holland. Adaptation in natural and arti cial systems. University of Michigan Press, Ann Arbor, 1975. [7] V. Kumar. Algorithms for constraint satisfaction problems: A survey. AI Magazine, 13(1):32{44, 1992. [8] Z. Michalewicz. Genetic Algorithms + Data Structures = Evolution Programs. Springer Verlag, New-York, 1996. 3rd edition.

[9] H. Muhlenbein, Th. Mahnig, and A. Ochoa Rodriguez. Schemata, distributions and graphical models in evolutionary optimization. Technical report, RWCP Theoretical Foundations GMD Laboratory, 1999. [10] J. Paredis. Coevolutionary constraint satisfaction. In Y. Davidor, H.-P. Schwefel, and R. Manner, editors, Proceedings of the 3rd Conference on Parallel Problem Solving from Nature, pages 46{55. Springer Verlag, 1994. [11] P. Prosser. An emperical study of phase transitions in binary constraint satisfaction problems. Arti cial Intelligence, 81:81{110, 1996. [12] P. Ross and E. Hart. An adaptive mutation scheme for a penalty-based graph-coloring GA. In A. E. Eiben, Th. Back, M. Schoenauer, and H.-P. Schwefel, editors, Proceedings of the 5th Conference on Parallel Problem Solving from Nature, pages 795{802. Springer Verlag, LNCS 1498, 1998. [13] L. Schoofs and B. Naudts. Ant colonies are good at solving constraint satisfaction problems. In Proceedings of the 2000 Congress on Evolutionary Computation. IEEE press, 2000. [14] G. Syswerda. A study of reproduction in generational and steady state genetic algorithm. In G. J. E. Rawlins, editor, Foundations of Genetic Algorithms, pages 94{101. Morgan Kaufmann Publishers, 1991. [15] E. Tsang. Foundations of Constraint Satisfaction. Academic Press Ltd, 1993.

Suggest Documents