Full text
IRI-TR-07-02 Exploiting single-cycle symmetries in continuous constraint problems Vicente Ruiz de Angulo Carme Torras
Abstract Symmetries in discrete constraint satisfaction problems have been explored and exploited in the last years, but symmetries in continuous constraint problems have not received the same attention. Here we focus on permutations of the variables consisting of one single cycle. We propose a procedure that takes advantage of these symmetries by interacting with a continuous constraint solver without interfering with it. A key concept in this procedure are the classes of symmetric boxes formed by bisecting a n-dimensional cube at the same point in all dimensions at the same time. We analyze these classes and quantify them as a function of the cube dimensionality. Moreover, we propose a simple algorithm to generate the representatives of all these classes for any number of variables at very high rates. A problem example from the chemical field and a kinematics solver are used to show the performance of the approach in practice. Institut de Rob`otica i Inform`atica Industrial (IRI) Consejo Superior de Investigaciones Cient´ıficas (CSIC) Universitat Polit`ecnica de Catalunya (UPC) Llorens i Artigas 4-6, 08028, Barcelona Spain Tel (fax): +34 93 401 5750 (5751) http://www-iri.upc.es Corresponding author: Vicente Ruiz de Angulo tel: +34 93 401 5752 [email protected] http://www-iri.upc.es/people/ruiz Copyright IRI, 2007
Contents 1 Introduction 1 2 Symmetry in Continuous Constraint Problems 1 3 Box symmetry 2 3.1 Box symmetry classes obtained by bisecting a n-cube................ 3 4 Algorithm to exploit box symmetry 3 5 An illustrative example 4 6 Analysis of SRn: Counting the number of classes 5 7 Generating SRn, the classes of symmetric boxes 8 8 Conclusions 12
Section 1 Introduction 1 1 Introduction Symmetry exploitation in discrete constraint problems has received a great deal of attention lately [7, 4, 5, 11]. On the contrary, symmetries have been largely disregarded in continuous constraint solving, despite the important growth in both theory and applications that this field has recently experienced [13, 1, 6, 10]. Continuous (or numerical) constraint solving is often tackled using Branch-and-Prune algorithms [14], which iteratively locate solutions inside an initial domain box, by alternating box subdivision (branching) and box reduction (pruning) steps. Motivated by a molecular conformation problem, in this paper we deal with the most simple type of box symmetry, namely that in which domain variables (i.e., box dimensions) undergo a single-cycle permutation leaving the constraints invariant. This can be seen, thus, as a form of constraint symmetry in the terminology introduced in [3]. 2 Symmetry in Continuous Constraint Problems We are interested in solving the following general continuous Constraint Satisfaction Problem (continuous CSP): Find all points x= (x1, . . . , xn) lying in an initial box of Rnsatisfying the constraints f1(x)∈C1, . . . , fm(x)∈Cm, where fiis a function fi:Rn→R, and Ciis an interval in R. The only particular feature that we require of a Continuous Constraint Solver (CCS) is that it has to work with an axis-aligned box in Rnas input. Also, we assume that the CCS returns solution boxes. Note that a CCS returning solution points is a limit case still contained in our framework. We say that a function s:Rn→Rnis a point symmetry of the problem if there exists an associated permutation σ∈Σmsuch that fi(x) = fσ(i)(s(x)) and Ci=Cσ(i),∀i= 1, . . . , m. We consider symmetry as a property that relates points that are equivalent as regards to a continuous CSP. Concretely, from the above definition one can conclude that xis a solution to the problem iff s(x) is a solution to the problem. Let sand tbe two symmetries of a continuous CSP with associated permutations σsand σt. It is easy to see that the composition of symmetries s(t(·)) is also a symmetry with associated permutation σs(σt(·)). An interesting type of symmetries are permutations (bijective functions of a set onto itself) of the components of x. Let Dbe a finite set. A cycle of length kis a permutation ψsuch that there exist distinct elements a1,...ak∈Dsuch that ψ(ai) = ψ(a(i+1)mod k) and ψ(z) = zfor any other element z∈D. Such a cycle is represented as (a1,...ak). Every permutation can be expressed as a composition of disjoint cycles (i.e, cycles without common elements), which is unique up to the order of the factors. Composition of cycles is represented as concatenation, as for example (a1,...ak)(b1,...bl). In this paper we focus on a particular type of permutations, namely those constituted by a single cycle. In its simplest form1, this is s(x1, x2,...xn) = (xθ(1), xθ(2),...xθ(n))=(x2, x3...xn, x1), where θ(i)=(i+ 1) mod n. 1In general, the variables must be arranged in a suitable order before one can apply the circular shifting. Thus, the general form of a single-cycle symmetry is s(x) = h−1(g(h(x))), where h(x1,...xn) = (xφ(1),...,xφ(n)), φ∈Σnis a general permutation that orders the variables, and g(x1,...,xn) = (xθ(1),...xθ(n)) is the circular shifting above. Thus, the cycle ψdefining the symmetry can be expressed as ψ=φ−1(θ(φ(·))). Since the reordering does not change substantially the presented concepts and algorithms, we have simplified notation in the paper by assuming that the order of the component variables is the appropriate one, i.e., that ψ=θ.
2 Exploiting single-cycle symmetries Example:n= 3, m = 4,x= (x1, x2, x3)∈[−1,1] ×[−1,1] ×[−1,1], f1(x) : x12 + x22 + x32∈[5,5] ≡x12 + x22 + x32=5 f2(x) : 2x1−x2∈[0,∞]≡2x1−x2⩾0 f3(x) : 2x2−x3∈[0,∞]≡2x2−x3⩾0 f4(x) : 2x3−x1∈[0,∞]≡2x3−x1⩾0 There exists a symmetry s(x1, x2, x3)=(x2, x3, x1), for which there is no need of reordering the variables. The constraint permutation associated to sis σ(1) = 1, σ(2) = 3, σ(3) = 4, and σ(4) = 2. For n⩾3 there is never a unique symmetry for a given problem. If there exists a symmetry s, then for example s2(x) = s(s(x)) is another symmetry. In general, using the convention of denoting s0(x) the identity mapping, {si(x), i = 0 . . . n −1}is the set of different symmetries that can be obtained composing s(x) with itself, while for i⩾nwe have that si(x) = si mod n(x). Thus, a single-cycle symmetry generates by composition n−1 symmetries, excluding the trivial identity mapping. Some of them may have different numbers of cycles. Imagine for example that in a continuous CSP with n= 4 the permutation of variables (1 2 3 4) is a symmetry. Then, the permutation obtained by composing it twice, (1 3)(2 4), is also a symmetry of the problem, but has a different number of cycles, and the longest cycle has length two instead of four. Besides, the former permutation cannot be generated from the latter. The algorithm presented in this paper deals with all the compositions of a single-cycle symmetry, even if some of them are not single-cycle symmetries. The gain obtained with the proposed algorithm will be shown to be ideally proportional to the number of different compositions of the selected symmetry. Therefore, when several single-cycle symmetries exist in a continuous CSP problem, the algorithm should be used with that generating the most symmetries by composition, i.e., with that having the longest cycle. 3 Box symmetry Since continuous constraint solvers work with boxes, we turn our attention now to the set of points symmetric to those belonging to a box B ⊆ Rn.2 Let sbe a single-cycle symmetry corresponding to the circular variable shifting θintroduced in the preceding section, and B= [x1, x1]×. . . ×[xn, xn] a box in Rn. The box symmetry function Sis defined as S(B) = {s(x)s.t. x∈ B} = [xθ(1), xθ(1)]×. . . ×[xθ(n), xθ(n)] = [x2, x2]×. . . ×[xn, xn]×[x1, x1]. The box symmetry function has also an associated constraint permutation σ, which is the same associated to s.Siwill denote Scomposed itimes. We say, then, that Si(B) and Sj(B) are symmetric boxes, 0 ⩽i, j < n,i6=j. Box symmetry is an equivalence relation defining symmetry equivalence classes. Let R(B) be the set of different boxes in the symmetry class of B,R(B) = {Si(B), i ∈ {0, . . . , n −1}}. For instance, for box B0= [0,4] ×[2,5] ×[2,5] ×[0,4] ×[2,5] ×[2,5], R(B0) is composed of S0(B0) = B0,S1(B0) = [2,5] ×[2,5] ×[0,4] ×[2,5] ×[2,5] ×[0,4] and S2(B0) = [2,5] ×[0,4] × [2,5] ×[2,5] ×[0,4] ×[2,5]. Note that S3(B0) is again B0itself and that subsequent applications of box symmetry would repeat the same sequence of boxes. We define the period P(B) of a 2This set {s(x)s.t. x∈ B} is also a box if s(x) = (s1(x),...,sn(x)) = (g1(xφ(1)),...,gn(xφ(n))), where siis the i-th component of s,φis an arbitrary permutation and gi:R→Ris any function such that if Iis an interval of Rthen {gi(x)s.t. x ∈I}is also an interval of R.
Section 4 Algorithm to exploit box symmetry 3 box Bas P(B) = |R(B)|. It is easily shown that R(B) = {Si(B), i ∈ {0, . . . , P(B)−1}}. For example, for box B0,R(B0) = {S0(B0), S1(B0), S2(B0)}and P(B0) = 3. As in the case of point symmetry, box symmetry has implications for the continuous CSP. If there is no solution inside a box B, there is no solution inside any of its symmetric boxes either. A box B∫⊆ B is a solution iff Si(B∫)⊆Si(B) is a solution box for any i∈ {1. . . P(B)−1}. In the following sections we will show that the implications of box symmetry for a continuous CSP can be exploited to save much computing time in a meta-algorithm that uses a CCS as a tool without interfering with it. 3.1 Box symmetry classes obtained by bisecting a n-cube The algorithm we will propose to exploit box symmetry makes much use of the symmetry classes formed by bisecting a n-dimensional cube In(i.e., of period 1) in all dimensions at the same time and at the same point, resulting in 2nboxes. We will denote Land Hthe two subintervals into which the original range Iis divided. For example, for n= 2, we have the following set of boxes {L×L, L ×H, H ×L, H ×H}whose periods are 1, 2, 2 and 1, respectively. And their symmetry classes are: {L×L},{L×H, H ×L}, and {H×H}. Representing the two intervals Land Has 0 and 1, respectively, and dropping the ×symbol, the sub-boxes can be coded as binary numbers. Let SRnbe the set of representatives, formed by choosing the smallest box in binary order from each class. For example, SR2={00,01,11}. Note that the cube Into be partitioned can be thought of as the the set of binary numbers of length n, and that SRnis nothing more than a subset whose elements are different under circular shift. The algorithm for exploiting symmetries and the way it uses SRnare explained in the next section. Afterwards, in Sections 6 and 7, we study how many components SRnhas, how they are distributed and, more importantly, how can they be generated. 4 Algorithm to exploit box symmetry The symmetry exploitation algorithm we propose uses the CCS as an external routine. The internals of the CCS must not be modified or known. The idea is to first divide the initial box into a number of symmetry classes. Next, one needs to process only a representative of each class with the CCS. At the end, by applying box symmetries to the solution boxes obtained in this way, one would get all the solutions lying in the space covered by the whole classes, i.e., the initial box. The advantage of this procedure is that the CCS would have to process only a fraction of the initial box. Assuming that the initial box is an-cube covering the same interval [xl, xh] in all dimensions, we can directly apply the classes associated to SRn. A procedure to exploit single-cycle symmetries in this way is presented in Algorithm 1. Since SRnis a set of codes –not real boxes– we need a translation of the codes into boxes for the given initial box. The operator GenerateSubBox(b, xl, xh, x∗) returns the box V= V1× · · · × Vncorresponding to code b=b1. . . bnwhen [xl, xh] is the range of the initial box in all dimensions and x∗is the point in which this interval is bisected: Vi=([xl, x∗] if bi= 0, [x∗, xh] if bi= 1.(1)
4 Exploiting single-cycle symmetries The point x∗calculated by SelectBisectionPoint(xl, xh) can be any such that xl< x∗< xh, but a reasonable one is (xl+xh)/2. The iterations over line 4 generate a set of representative boxes such that, together with their symmetries, cover the initial n-cube. ProcessRepresentative(B) returns all the solution boxes associated to B, that is, the solutions inside R(B), or still in other words, the solutions inside Band inside its symmetric boxes. Since the number of symmetries of Bis P(B), the benefits of exploiting the symmetries of a class representative is proportional to its period. Algorithm 1:CSym algorithm. Input: A n-cube, [xl, xh]× · · · × [xl, xh]. A single-cycle box symmetry, S. A Continuous Constraint Solver, CCS. Output: A set of boxes covering all solutions. SolutionBoxSet ←EmptySet1 x∗←SelectBisectionPoint(xl, xh)2 foreach b ∈SRndo3 B ← GenerateSubBox(b, xl, xh, x∗)4 SolutionBoxSet ←SolutionBoxSet ∪ProcessRepresentative(B)5 return SolutionBoxSet6 Algorithm 2: The ProcessRepresentative function. Input: A box, B. A single-cycle box symmetry, S. A Continuous Constraint Solver, CCS. Output: The set of solution boxes contained in Band its symmetric boxes. SolSet ←CCS(B)1 TotalSolSet ←SolSet2 for i=1: P(B)−1do3 TotalSolSet ←T otalSolSet ∪ApplySymmetry(SolSet, Si)4 return TotalSolSet5 The correctness of the algorithm is easy to check. The set of boxes in which it searches explicitly or implicitly (by means of symmetry) for solutions is U={R(B)s.t. Bis a representative}. In fact, Uis the set of boxes formed by bisecting the initial box in all dimensions at the same time and at the same point. Ucovers the whole initial box, and thus, the algorithm finds all the solutions of the problem. Moreover, it finds each solution box only once, because the boxes in Udo not have any volume in common (they share at most a “wall”). 5 An illustrative example Molecules can be modeled as mechanical chains by making some reasonable approximations. If two atoms are joined by a chemical bond, one can assume that there is a rigid link between them. Thus, the first approximation is that bond lengths are constant. The second one is that the angles between two consecutive bonds are also constant. In other words, the distances between the atoms in any subchain of three atoms are assumed to be constant. All configurations of the atoms of the molecule that satisfy these distance constraints, sometimes denoted rigid-geometry
Section 6 Analysis of SRn: Counting the number of classes 5 hypothesis, are valid conformations of the molecule in a kinematic sense. The constraints induced by the rigid-geometry hypothesis are particularly strong when the molecule topology forms loops, as in cycloalkanes. The problem of finding all valid conformations of a molecule can be formulated as a distance-geometry [2] problem in which some distances between points (atoms) are fixed and known, and one must find the set of values of unknown (variable) distances that are compatible with the embedding of the points in R3. The unknown distances can be found by solving a set of constraints consisting of equalities or inequalities of determinants formed with subsets of the fixed and variable distances [2]. The problem can be solved using a CCS [10, 9]. Figure 1 displays the known and unknown distances of the cycloheptane, a molecule basically composed of a ring of seven carbon atoms. The distance between two consecutive atoms of the ring is constant and equal everywhere. The distance between two atoms connected to a same atom is also known and constant no matter the atoms. The problem has several symmetries. One of them is s(d1, . . . , d7) = (dθ(1), dθ(2), . . . , dθ(7))=(d2, d3...,d7, d1). When this symmetry is exploited with the CSym algorithm the problem is solved in 4.64 minutes, which compares very favorably with the 31.6 minutes spent when using the algorithm in [9] alone. Thus, a reduction by a factor close to n= 7 (i.e., the length of the symmetry cycle) in computing time is obtained, which suggests that the handling of box symmetries doesn’t introduce a significant overhead. Figure 2 shows a projection into d1d2and d3of the solutions obtained using CSym. d1 d6 d3 d4 d5 d7 d2 Figure 1: Cycloheptane. Disks represent carbon atoms. Constant and variable distances between atoms are represented with continuous and dashed lines, respectively. 6 Analysis of SRn: Counting the number of classes Let us define some quantities of interest: -Nn: Number of elements of SRn. -FPn: Number of elements of SRnthat correspond to full-period boxes, i.e., boxes of period n. -Nnm: Number of elements of SRnhaving m1’s. -FPnm: Number of elements of SRnthat correspond to full-period boxes having m1’s. Polya’s theorem [8] could be used to determine some of these quantities for a given nby building a possibly huge polynomial and elucidating some of its coefficients. We present a simpler way of calculating them and, at the same time, make the reader familiar with the concepts that will be used in our algorithm to generate SRn. We begin by looking for the expression of FPn. When any number of 1’s is allowed, the total number of binary numbers is 2n. The only periods that can exist in these binary numbers are
6 Exploiting single-cycle symmetries Figure 2: Three-dimensional projection of the cycloheptane solutions. The lightest (yellow) boxes are the solutions found inside the representatives using the CCS (line 1 in Algorithm 2). The other colored boxes are the solutions obtained by applying symmetries to the yellow boxes (line 4 in Algorithm 2). divisors of n. Thus, the following equation holds: X p∈div(n) pFPp= 2n.(2) Segregating p=n, nFPn+X p∈div(n), p<n pFPp= 2n,(3) and solving for FPn: FPn=2n n−X p∈div(n), p<n p nFPp.(4) This recurrence has a simple baseline condition: FP1= 2. Then, Nnfollows easily from Nn=X p∈div(n) FPp.(5) Segregating p=n, a more efficient formula is obtained: Nn=2n n+X p∈div(n), p<n n−p nFPp.(6) This formula is valid for n > 1. The remaining case is N1= 2.
Section 8 Conclusions 13 Algorithm 4:ClassGen algorithm. Input: The sum of the numbers that remain to be written on the right (from position pos to m), sum. The index of the next position to be written, pos. The index of the current control element, whose value cannot be surpassed in the next position, ctrol. The length of the code, m. Array where class codes are being generated, A. Output: A set of codes representing classes, SR. SR ←EmptySet1 if pos =mthen2 if sum < A[ctrol]then /* otherwise, SR will remain EmptySet */3 A[m]←sum4 SR ← {A};5 else6 if pos 6= 1 then7 LowerLimit = 08 UpperLimit ←Minimum(A[ctrol], sum)9 else10 LowerLimit =dsum/me11 UpperLimit ←sum12 for i=UpperLimit to LowerLimit do13 A[pos]←i14 if i=A[ctrol]then /* i=A[ctrol] = UpperLimit */15 SR ←SR SClassGen(sum −i, pos + 1, ctrol + 1, m, A)16 else SR ←SR SClassGen(sum −i, pos + 1,1, m, A); /* i<A[ctrol]*/17 return SR18 symmetries of the representative are applied to the resulting solutions. In this way, the solutions within the whole initial domain are found, while having processed only a fraction of it –the set of representatives– with the CCS. The time savings obtained by processing a representative and applying its symmetries to the solutions tend to be proportional to the number of symmetric boxes of the representative. Therefore, symmetry exploitation is complete for full-period representatives, since they have the maximum number of symmetric boxes. We have also studied the automatic generation of the classes resulting from bisecting a ncube and analyzed their numerical properties. The algorithm for generating the classes is very powerful, eliminating the convenience of any pre-calculated table. The numerical analysis of the classes revealed that the average number of symmetries of the class representatives tends quickly to nas the number of variables, n, grows. These are good news, since nis the maximum number of symmetries attainable with single-cycle symmetries of nvariables, leading to time reductions by a factor close to n. Nevertheless, for small nthere is still a significant fraction of the representatives not having the maximum number of symmetries. Another weakness of the proposed strategy is the exponential growth in the number of classes as a function of n. The problems with small and large nshould be tackled with a more refined subdivision of the
14 REFERENCES initial domain in box symmetry classes, which is left for near future work. We are also currently approaching the extension of this work to deal with permutations of the problem variables composed of several cycles. References [1] Benhamou F., Goulard F.: Universally Quantified Interval Constraints. Proc. 6th CP (2000) 67-82 [2] Blumenthal, L.: Theory and aplications of distance geometry. Oxford University Press, 1953. [3] Cohen D., Jeavons P., Jefferson Ch., Petrie K.E., Smith B.M.: Symmetry Definitions for Constraint Satisfaction Problems. Constraints 11(2-3) (2006) 115-137 [4] Flener P., Frisch A.M., Hnich B., Kiziltan Z., Miguel I., Pearson J., Walsh, T.: Breaking Row and Column Symmetries in Matrix Models. Proc. 8th CP (2002) 462-476 [5] Gent I.P., Harvey W., Kelsey T.: Groups and Constraints: Symmetry Breaking During Search. Proc. 8th CP (2002) 415-430 [6] Jermann C., Neveu B., Trombettoni G.: Inter-Block Backtracking: Exploiting the Structure in Continuous CSPs. 2nd International Workshop on Global Constrained Optimization and Constraint Satisfaction (Cocos’03) [7] Meseguer P., Torras C.: Exploiting symmetries within constraint satisfaction search. Artificial Intelligence 129 (2001) 133-163 [8] Polya, G. and Read, R.C.: Combinatorial enumeration of groups, graphs and chemical compounds. Springer-Verlag, New York, 1987 [9] Porta, J.M., Ros Ll., Thomas F., Corcho F., Canto J. and Perez J.J.: Complete maps of molecular loop conformational spaces. Journal of Computational Chemistry 28 (13) (2007) 2170-2189 [10] Porta J.M., Ros Ll., Thomas F., Torras C.: A Branch-and Prune Solver for Distance Constraints. IEEE Trans. on Robotics 21(2) (2005) 176-187 [11] Puget J-F.: Symmetry Breaking Revisited. Constraints 10(1) (2005) 23-46 [12] Ruiz de Angulo V., Torras C.: Exploiting single-cycle symmetries in branch-and-prune algorithms. Proc. 13th CP (2007) 864-871 [13] Sam-Haroud D., Faltings B.: Consistency Techniques for Continuous Constraints. Constraints 1(1-2) (1996) 85-118 [14] Vu X-H., Silaghi M., Sam-Haroud D., Faltings B.: Branch-and-Prune Search Strategies for Numerical Constraint Solving. Swiss Federal Institute of Technology (EPFL) LIA-REPORT 7(2006)
Acknowledgements This work was supported by the I+D pro ject DPI 2004-07358 of the Spanish Ministry of Education. IRI reports This report is in the series of IRI technical reports. All IRI technical reports are available for download at the IRI website http://www-iri.upc.edu.