Characterizing Regular Languages with Polynomial Densities ? Andrew Szilard , Sheng Yu , Kaizhong Zhang Department of Computer Science , the University of Western Ontario London , Ontario , CANADA N6A 5B7 -LRB- syu@csd.uwo.ca -RRB- Jeffrey Shallit Department of Computer Science , University of Waterloo Waterloo , Ontario , CANADA N2L 3G1 Abstract In this paper , we prove a characterization theorem for the regular languages with polynomial densities , i.e. , the so called sparse regular languages . A language L is said to have a polynomial density if the function pL -LRB- n -RRB- = jL \ ? nj of L is a polynomial . Our main result states that the function pR -LRB- n -RRB- of a regular language R is O -LRB- nk -RRB- , for some k > = 0 , if and only if R can be represented as a finite union of the regular expressions of the form xy ? 1z1 : : : y?t zt with a nonnegative integer t < = k + 1 , where x ; y1 ; z1 ; : : : ; yt ; zt are all strings in ?? . We also prove a gap theorem for the densities of regular languages . We show that the density function of a regular language can only be polynomial or exponential , i.e. , for any integer k > = 0 , there does not exist any regular language R such that pR -LRB- n -RRB- is neither O -LRB- nk -RRB- nor ? -LRB- nk +1 -RRB- , and there is no regular language R such that pR -LRB- n -RRB- is neither polynomial nor 2 ? -LRB- n -RRB- . We also show that given an arbitrary regular language R and an integer k > = 0 , it is decidable whether pR -LRB- n -RRB- is O -LRB- nk -RRB- . Furthermore , we show that given an arbitrary regular language R , it is decidable whether R has a polynomial density . Incidentally , we have proved a characterization for the -LRB- restricted -RRB- starheight-one languages . We show that a regular language is starheight one if and only if it is the image of a regular language of a polynomial density under a finite substitution . 1 Introduction Given a regular language , it is frequently useful to know how many words of a certain length are in the language . In this paper , we study several problems related to this question . ? This research is supported in part by the Natural Sciences and Engineering Research Council of Canada grants OGP0041630 For each language L ? ?? , we define a function of L pL -LRB- n -RRB- = jL \ ? nj , where jSj denotes the cardinality of a set S . In other words , pL -LRB- n -RRB- counts the number of words of length n in L . The density function of a language L is usually defined as dL -LRB- n -RRB- = jL \ ? nj = j?nj , and pL -LRB- n -RRB- , as we defined above , is often called the population function of L. However , dL -LRB- n -RRB- is not always a good description of the sparsity of L , particularly when dL -LRB- n -RRB- ! 0 . Hence , in this paper , we use the function pL -LRB- n -RRB- rather than the function dL -LRB- n -RRB- to describe the density of a language L. For example , we say that L has a constant density if pL -LRB- n -RRB- is O -LRB- 1 -RRB- , and L has a polynomial density if pL -LRB- n -RRB- is O -LRB- nk -RRB- for some nonnegative integer k. Languages of polynomial density have been called sparse languages by many authors -LSB- 1 , 8 -RSB- . However , the term sparse has also been used to mean that limn ! 1 inf -LRB- dL -LRB- n -RRB- -RRB- = for a language L -LSB- 6 , 14 -RSB- . We link the densities of regular languages to the forms of regular expressions representing them . One of the main results of this paper is that a regular language is of polynomial density -LRB- of degree k -RRB- if and only if it can be represented as a finite union of the regular expressions of the form xy ? 1z1 : : : y?t zt -LRB- with each t < = k +1 -RRB- , where x ; y1 ; z1 ; : : : ; yt ; zt are all strings in ?? . In particular , a regular language has a constant density if and only if it can be represented as a finite union of the regular expressions of the form xy?z . This latter result has also appeared in -LSB- 13 -RSB- with a different proof . We show that , for any polynomial function f -LRB- n -RRB- , there exists a regular language R such that the density function pR -LRB- n -RRB- is ? -LRB- f -LRB- n -RRB- -RRB- . This means that there is a gap between the density functions of order nk and nk +1 for each nonnegative integer k , and between the polynomial functions and the exponential functions with a linear exponent . The density function pR -LRB- n -RRB- of a regular language R can only be of the order of a polynomial or 2cn for some constant c. For example , there exist regular languages that have a density function of the order ? -LRB- 1 -RRB- , ? -LRB- n5 -RRB- , or 27n . But , there are no regular languages having a density function of the order ? -LRB- p -LRB- n -RRB- -RRB- , ? -LRB- log n -RRB- , ? -LRB- n log n -RRB- , or 2 ? -LRB- pn -RRB- . By our characterization of regular languages with polynomial densities , it is easy to see that all regular languages with polynomial densities are of starheight one . By starheight , we mean the restricted starheight . See -LSB- 2 -RSB- for details . Note that not all starheight-one languages are of polynomial density . For example , -LRB- a + b -RRB- ? is of density 2n . However , it is not difficult to show , with our characterization theorem for the regular languages with polynomial densities , that a language is of starheight one if and only if it is the image , under a finite substitution -LSB- 12 -RSB- , of a regular language of a polynomial density . We also show that the starheight-one languages include all the regular languages with polynomial densities and their complements . In addition , we show that , given a regular language , there exists an algorithm to calculate the order of the density function of the language . At the end of the paper , we list several closure properties of the regular languages with polynomial densities . The results include that if a regular language L has a density function pL -LRB- n -RRB- = O -LRB- nk -RRB- for some integer k > = 0 , then the language that is the set of all prefixes of words in L has a density function also in O -LRB- nk -RRB- . In Section 2 , we briefly introduce the basic definitions and notations used in this paper . In Section 3 , we prove the characterization theorems for regular languages with polynomial densities and some corollaries . In Section 4 , we prove the gap theorems for the densities of regular languages . 2 Basic definitions and notations In this paper , we use ? to denote the alphabet of a language . ?? is the free monoid -LRB- with the identity ffl -RRB- generated by ? . Let S be a set . Then , jSj denotes the cardinality of S and 2S the power set , i.e. the set of all subsets , of S. Let x 2 ?? . Then jxj denotes the length of x. Let u ; v 2 ?? . Then u is a prefix of v if uw = v for some w 2 ?? , and u is a nontrivial prefix of v if u is a prefix of v and u < > ffl and u < > v . As mentioned in the introduction , for a language L ? ?? , we call the function pL -LRB- n -RRB- = jL \ ? nj the density function of L . We say that a language L has a polynomial density if pL -LRB- n -RRB- is O -LRB- nk -RRB- for some integer k > = 0 . A deterministic finite automaton -LRB- DFA -RRB- A is denoted by a 5-tuple -LRB- Q ; ? ; ffi ; q0 ; F -RRB- where Q is the finite set of states , ? is the input alphabet , ffi : Q ?? ! Q is a partial function , q0 is the initial state , and F is the set of final states . A is said to be reduced if every state in Q is reachable from q0 and every state reaches a final state . A is said to be complete if ffi is a total function . Note that a reduced DFA may not be a complete DFA . L -LRB- A -RRB- denotes the language accepted by A. Let A = -LRB- Q ; ? ; ffi ; q0 ; F -RRB- be a DFA . For each word w = a1 : : : an in ?? , the state transition sequence of A on w , denoted STSA -LRB- w -RRB- , is the sequence of states qi0 ; qi1 ; : : : ; qin where qi0 = q0 and ffi -LRB- qik ; ak +1 -RRB- = qik +1 for all < = k < n. Given two functions f -LRB- n -RRB- and g -LRB- n -RRB- , we say that f -LRB- n -RRB- is O -LRB- g -LRB- n -RRB- -RRB- or f -LRB- n -RRB- = O -LRB- g -LRB- n -RRB- -RRB- if there exist positive constants c and n0 such that < = f -LRB- n -RRB- < = cg -LRB- n -RRB- for all n > = n0 ; f -LRB- n -RRB- is ? -LRB- g -LRB- n -RRB- -RRB- or f -LRB- n -RRB- = ? -LRB- g -LRB- n -RRB- -RRB- if there is a constant c > and an infinite sequence n1 ; n2 ; : : : ; nk ; : : : such that f -LRB- ni -RRB- > = cg -LRB- ni -RRB- for all i > = 1 ; and f -LRB- n -RRB- is ? -LRB- g -LRB- n -RRB- -RRB- or f -LRB- n -RRB- = ? -LRB- g -LRB- n -RRB- -RRB- if both f -LRB- n -RRB- = O -LRB- g -LRB- n -RRB- -RRB- and f -LRB- n -RRB- = ? -LRB- g -LRB- n -RRB- -RRB- -LSB- 4 -RSB- . Let ? and ? be two alphabets . A finite substitution -LSB- 12 -RSB- is a mapping oe : ?? ! 2 ?? such that -LRB- i -RRB- oe -LRB- ffl -RRB- = ffflg , -LRB- ii -RRB- oe -LRB- xy -RRB- = oe -LRB- x -RRB- oe -LRB- y -RRB- for any x ; y 2 ?? , and -LRB- iii -RRB- oe -LRB- a -RRB- is finite for each a 2 ? . The -LRB- restricted -RRB- starheight -LSB- 2 -RSB- h of a regular expression is defined inductively as -LRB- a -RRB- h -LRB- ;-RRB- = 0 , h -LRB- ffl -RRB- = 0 , and h -LRB- a -RRB- = for each a 2 ? ; -LRB- b -RRB- h -LRB- e1 + e2 -RRB- = h -LRB- e1e2 -RRB- = max -LRB- h -LRB- e1 -RRB- ; h -LRB- e2 -RRB- -RRB- ; -LRB- c -RRB- h -LRB- e ? -RRB- = h -LRB- e -RRB- + 1 . The starheight of a regular language R is the least height of a regular expression denoting R. 3 Regular languages with polynomial densities In this section , we characterize the regular languages of density O -LRB- nk -RRB- , integer k > = 0 , with certain forms of their regular-expression presentations . For example , this characterization shows that a regular language is of density O -LRB- n2 -RRB- if and only if it can be represented as a finite union of regular expressions of the form uv?wx?y where u ; v ; w ; x ; y are words over the alphabet . We also show that there exists an algorithm to decide whether a given regular language has a polynomial density . Incidentally , we have found a new characterization for the starheight-one languages . We show that a language is starheight one if and only if it is the image , under a finite substitution , of a regular language with a polynomial density . The results shown in this section also are necessary propositions for the gap theorems for the densities of regular languages in the next section . Definition 1 Let A = -LRB- Q ; ? ; ffi ; s ; F -RRB- be a deterministic finite automaton -LRB- DFA -RRB- . A word w in ?? is said to be t-tiered , t > = , with respect to A if the state transition sequence of w is given by STSA -LRB- w -RRB- = d11 1 : : : dtt t where -LRB- 1 -RRB- = p1 : : : pl , < = l < = jQj , where the p 's are states in Q , and for each i , 1 < = i < = t , -LRB- 2 -RRB- i = qi ; 0 : : : qi ; ki and i = qi ; 0ri ; 1 : : : ri ; li , < = ki ; li < = jQj , where the q 's and r 's are in Q , -LRB- 3 -RRB- qi ; 0 appears only as the first state in i and in i , -LRB- 4 -RRB- di > . Lemma 1 Let L be accepted by a DFA A = -LRB- Q ; ? ; ffi ; s ; F -RRB- . If there exists a word w 2 L such that w is k-tiered with respect to A , then the density of L is ? -LRB- nk ? 1 -RRB- . Proof . According to the structure of STSA -LRB- w -RRB- , w can be decomposed into w = xyd11 z1 : : : ydkk zk such that ffi ? -LRB- p1 ; x -RRB- = q1 ; 0 , ffi + -LRB- qi ; 0 ; yi -RRB- = qi ; 0 , which goes through the state sequence i exactly once , and ffi + -LRB- qi ; 0 ; zi -RRB- = qi +1 ; 0 , for 1 < = i < k , ffi + -LRB- qk ; 0 ; zk -RRB- = rk ; lk . Let C = jy1jjy2j : : : jyk j and Ci = C = jyij , 1 < = i < = k. For an arbitrary integer t > 0 , let n = jxz1 : : : zkj + tC . It is clear that for any k arbitrary nonnegative integers t1 ; : : : ; tk such that t1 + : : : tk = t , the word w = xyC1t1 1 z1 : : : yCktk k zk is in L and of length n. Let Nk -LRB- t -RRB- denote the set of all such k-tuples of nonnegative integers , i.e. , Nk -LRB- t -RRB- = f -LRB- t1 ; : : : ; tk -RRB- j t1 ; : : : ; tk > = & t1 + : : : + tk = tg It can be shown -LRB- page 45-47 of -LSB- 3 -RSB- -RRB- that the cardinality of Nk -LRB- t -RRB- is t + k ? 1 k ? 1 ! = ? -LRB- tk ? 1 -RRB- = ? -LRB- nk ? 1 -RRB- since k is a constant and n is a linear function of t. Let -LRB- s1 ; : : : ; sk -RRB- and -LRB- t1 ; : : : ; tk -RRB- be two arbitrary elements in Nk -LRB- t -RRB- such that -LRB- s1 ; : : : ; sk -RRB- < > -LRB- t1 ; : : : ; tk -RRB- . Consider the two words u = xyC1s1 1 z1 : : : yCksk k zk and v = xyC1t1 1 z1 : : : yCktk k zk . Note that both u and v are in L. Now , we show that u < > v. Let i be the smallest number such that si < > ti . Without any loss of generality , we assume that si < ti . Then u and v have a common prefix u0 = xyC1s1 1 z1 : : : yCisi i , i.e. , STSA -LRB- u -RRB- and STSA -LRB- v -RRB- have a common prefix STSA -LRB- u0 -RRB- . It is clear that STSA -LRB- u -RRB- does not contain the state qi ; 0 after the prefix STSA -LRB- u0 -RRB- according to -LRB- 3 -RRB- of Definition 1 . But STSA -LRB- v -RRB- contains at least one further appearance of qi ; 0 . Thus , u < > v since A is deterministic . Therefore the number of distinct words of length n in L is ? -LRB- nk ? 1 -RRB- . 2 Lemma 2 Let L be an arbitrary regular language with L = L -LRB- A -RRB- , for some DFA A . If pL -LRB- n -RRB- is O -LRB- nk -RRB- for some integer k > = , then each word w 2 L is t-tiered with respect to A for some nonnegative integer t < = k + 1 . Proof . Let A = -LRB- Q ; ? ; ffi ; s ; F -RRB- . We prove this lemma by induction on the length of a word w in L. For any word jwj < jQj , the lemma holds trivially . We hypothesize that the lemma holds for all words w in L with jwj < n , for some n > = jQj . Consider an arbitrary word w 2 L with jwj = n . We look at STSA -LRB- w -RRB- in reverse and find the first state that repeats . Let this state be q. Denote by q -LRB- i -RRB- the ith -LRB- from the left to right -RRB- appearance of q in STSA -LRB- w -RRB- . Let q -LRB- 1 -RRB- ; : : : ; q -LRB- h +1 -RRB- be the sequence of all appearances of q in STS -LRB- w -RRB- . Clearly , h > = 1 and there are fewer than jQj states between q -LRB- h -RRB- and q -LRB- h +1 -RRB- . We write w = w0v1v2 : : : vhw1 such that ffi + -LRB- q -LRB- i -RRB- ; vi -RRB- = q -LRB- i +1 -RRB- , for 1 < = i < = h. Then , clearly , w1vn1 1 : : : vnh h w1 is in L for any nonnegative integers n1 ; : : : ; nh . We now prove that v1 = : : : = vh . Assume that vi < > vj for some i < > j . Then vi is not a prefix of vj because if it were so , there would be another appearance of q between q -LRB- j -RRB- and q -LRB- j +1 -RRB- and this is impossible . Similarly , vj is not a prefix of vi . The monoid generated by fvivj ; vjvig is isomorphic to the free monoid on two generators . For any nonnegative integer g , the regular expression -LRB- vivj + vjvi -RRB- g represents 2g distinct words , each is of length jvivj jg . Then all the 2g words represented by w0 -LRB- vivj + vjvi -RRB- gw1 have the same length , namely jw0w1j + jvivj jg , and are all in L . This contradicts the fact that L has a polynomial density . Therefore , v1 = : : : = vh and STSA -LRB- v1 -RRB- = : : : = STSA -LRB- vh -RRB- . Since w0 = w0w1 is in L and jw0j < n , then , by our induction hypothesis , w0 is t-tiered with respect to A for some t < = k + 1 , i.e. , STSA -LRB- w0 -RRB- = d11 1 : : : dtt t satisfies the conditions -LRB- 1 -RRB- to -LRB- 4 -RRB- of Definition 1 . Note that q must appear only in t and no qi ; 0 appear in STSA -LRB- w1 -RRB- due to a similar argument as above . So , all qi ; 0 , 1 < = i < = t , appear only before the first appearance of q . If t < k + 1 , then the proof is complete . Assume that t = k + 1 . Then w is -LRB- k + 2 -RRB- - tiered . By Lemma 1 , the density of L is in ? -LRB- nk +1 -RRB- . This is a contradiction and , thus , t = k + 1 is impossible . 2 Lemma 3 Let L be accepted by a DFA A = -LRB- Q ; ? ; ffi ; s ; F -RRB- . If there is an integer k > = such that each word w in L is t-tiered with respect to A , for some t < = k , then L can be represented as a finite union of the regular expressions of the following form xy ? 1z1 : : : y?t zt with < = t < = k , where x ; y1 ; : : : ; yt ; z1 ; : : : ; zt 2 ?? , jxj ; jz1j ; : : : ; jztj < jQj , and jy1j ; : : : ; jytj < = jQj . Proof . Let w be an arbitrary word in L . Since w is t-tiered with respect to A for some t < = k , according to the structure of STSA -LRB- w -RRB- w can be decomposed into w = xyn1 1 z1 : : : yntt zt such that jxj ; jz1j ; : : : ; jztj < jQj and < jy1j ; : : : ; jytj < = jQj , and w 2 xy ? 1z1 : : : y?t zt ? L : For each w 2 L , we denote this regular expression derived from w as Ed -LRB- w -RRB- . Then L = -LSB- w2L Ed -LRB- w -RRB- : Since Q is finite , there are a finite number of choices for x 's , y 's , and z 's of length less than or equal to jQj . Also because each t is bounded by the constant k , the number of distinct expressions on the righthand side of the equation is bounded by j?j2kjQj . Therefore , the lemma holds . 2 Lemma 4 Let E be a regular expression E = xy ? 1z1 : : : y?t zt where t > and x ; y1 ; z1 ; : : : ; yt ; zt are all strings in ?? , and let L = L -LRB- E -RRB- . Then the function pL -LRB- n -RRB- is O -LRB- nt ? 1 -RRB- . Proof . Note that if this lemma holds for all y 's being nonempty , then it also holds for some y 's being empty . So , we assume that all y 's are nonempty in the following proof . Let n be an arbitrary nonnegative integer . Consider all the possible words of length n in L. Let w be such a word . Then w = xyn1 1 z1 : : : yntt zt for some nonnegative integers n1 ; : : : ; nt such that n1jy1j + : : : + ntjytj + jxz1 : : : ztj = n. Let C denote jxz1 : : : ztj and m = n ? C , i.e. , m = n1jy1j + : : : + ntjytj . We know that the cardinality of the set N t -LRB- m -RRB- = f -LRB- m1 ; : : : ; mt -RRB- j < = mi ; for 1 < = i < = t ; and m1 + : : : mt = m g is m + t ? 1 t ? 1 ! = n ? C + t ? 1 t ? 1 ! = O -LRB- nt ? 1 -RRB- since C and t are constants . Define a mapping o -LRB- n1 ; : : : ; nt -RRB- = -LRB- n1jy1j ; : : : ; ntjytj -RRB- over the set of t-tuples of nonnegative integers . Then for each t-tuple -LRB- n1 ; : : : ; nt -RRB- such that xyn1 1 z1 : : : yntt zt is of length n , o -LRB- n1 ; : : : ; nt -RRB- is in N t -LRB- m -RRB- . Since o is injective , the number of such distinct t-tuples is no more than the cardinality of N t -LRB- m -RRB- , i.e. , O -LRB- nt ? 1 -RRB- . 2 By the previous three lemmas , we obtain the subsequent three theorems . Theorem 1 Let R be a regular language and A = -LRB- Q ; ? ; ffi ; s ; F -RRB- be a DFA accepting R . Then the function pR -LRB- n -RRB- is O -LRB- nk -RRB- , k > = , if and only if each word of R is t-tiered with respect to A for some t < = k + 1 . Theorem 2 Let R be a regular language and A = -LRB- Q ; ? ; ffi ; s ; F -RRB- be an arbitrary DFA accepting R . Then the function pR -LRB- n -RRB- is O -LRB- nk -RRB- , k > = , if and only if R can be represented as a finite union of regular expressions of the following form : xy ? 1z1 : : : y?t zt ; where x ; y1 ; z1 ; : : : ; yt ; zt 2 ?? ; with jxj ; jy1j ; jz1j ; : : : ; jytj ; jztj < = jQj and < = t < = k + 1 . A weaker form of the previous theorem is stated below . Theorem 3 A regular language R over ? has a density in O -LRB- nk -RRB- , k > = , if and only if R can be represented as a finite union of regular expressions of the following form : xy ? 1z1 : : : y?t zt where x ; y1 ; z1 ; : : : ; yt ; zt 2 ?? ; with < = t < = k + 1 . As a special case of the above theorem , we state a corollary for k = 0 , which was first proved by Shallit -LSB- 13 -RSB- using a different method , and also proved by Yu and Fisch independently . Corollary 1 Let R be a regular language . The number of words of the same length in R is bounded by a constant C if and only if R can be represented as a finite union of the regular expressions of the form xy?z where x ; y ; z 2 ?? : In particular , if a language can be expressed by the union of C expressions in this form , then the number of words of the same length in the language is bounded by the constant C . In what follows we assume that a regular language is given by a finite automaton or a regular expression . Theorem 4 Given a regular language R and an integer k > = , it is decidable whether the function pR -LRB- n -RRB- is O -LRB- nk -RRB- . Proof . Let A be a DFA accepting R , and let C be the number of states in A . Then there are a finite number of strings of a length less than or equal to C. So , there are a finite number of possible choices for each of the x 's , y 's , and z 's of Theorem 2 . Therefore , the problem can be decided by trying out all the possibilities . In fact , this problem can be easily decided by analyzing all the words in R that have a length less than or equal to 2C . 2 Lemma 5 Let R be a regular language accepted by a DFA of C states . If R has a polynomial density , then the function pR -LRB- n -RRB- is O -LRB- nC ? 1 -RRB- . Proof . Notice that in Definition 1 , each qi ; 0 , 1 < = i < = t , is distinct . Since there are C states in A , each word in R is at most C-tiered with respect to A. Thus , pR -LRB- n -RRB- is O -LRB- nC ? 1 -RRB- by Theorem 1 . 2 With the previous lemma , we can easily prove the following theorem : Theorem 5 Given an arbitrary regular language R , it is decidable whether R has a polynomial density . It is clear that all regular languages with polynomial densities are of starheight one . But , not all starheight-one languages are of polynomial density . For example , the language -LRB- ab + b -RRB- ? -LRB- a + ffl -RRB- is of exponential density . However , there is a relation between these two subclasses of regular languages , which is stated in the following theorem . Theorem 6 A regular language is of starheight one if and only if it is the image of a regular language of a polynomial density under a finite substitution . Proof . The if part is obvious . For the Only if part , let E be the regular expression of starheight one . We define a finite substitution ss such that for each a 2 ? , a ! fag and for each e ? in E , there is a distinct oe 62 ? such that oe ! L -LRB- e -RRB- . Let E0 be the regular expression such that the image of E0 under ss is E. Then , clearly , L -LRB- E0 -RRB- is a language of a polynomial density according to Theorem 3 . 2 4 Gap theorems on the densities of regular languages In this section , we show that only the functions that are of the order of polynomial functions and exponential functions with linear exponents can be the densities functions of regular sets . This means that there is a gap between ? -LRB- nk -RRB- and ? -LRB- nk +1 -RRB- , for each integer k > = 0 , and between polynomial functions and exponential functions of 2 ? -LRB- n -RRB- . For example , there is no regular language that has a density of the order pn , n log n , or 2 pn . We also show that for any integer k > = 0 , there exists a regular language R such that pR -LRB- n -RRB- is exactly nk . Theorem 7 For any integer k > = , there does not exist a regular language R such that the function pR -LRB- n -RRB- is neither O -LRB- nk -RRB- nor ? -LRB- nk +1 -RRB- . Proof . Assume that there exists a regular language R such that pR -LRB- n -RRB- is neither O -LRB- nk -RRB- nor ? -LRB- nk +1 -RRB- . Then pR -LRB- n -RRB- is O -LRB- nk +1 -RRB- . Let R = L -LRB- A -RRB- for some DFA A. By Lemma 2 , for each word w in R , w is t-tiered with respect to A , for some nonnegative integer t < = k + 2 . If there exists a word w in R such that w is k + 2-tiered with respect to A , then , by Lemma 1 , pR -LRB- n -RRB- is ? -LRB- nk +1 -RRB- . It is a contradiction . Otherwise , pR -LRB- n -RRB- is O -LRB- nk -RRB- by Theorem 1 . Again a contradiction . 2 Lemma 6 Let R be accepted by some reduced DFA A = -LRB- Q ; ? ; ffi ; q0 ; F -RRB- . Then each word in R is t-tiered with respect to A for some nonnegative integer t < = jQj if and only if there does not exist a state q of A such that -LRB- i -RRB- ffi + -LRB- q ; x -RRB- = q and ffi + -LRB- q ; y -RRB- = q , -LRB- ii -RRB- x < > y , and -LRB- iii -RRB- there is no nontrivial prefix x0 of x or y0 of y such that ffi + -LRB- q ; x0 -RRB- = q or ffi + -LRB- q ; y0 -RRB- = q. Proof . Assume that there is no state of A that satisfies -LRB- i -RRB- , -LRB- ii -RRB- , and -LRB- iii -RRB- above . Then every state p of A satisfies the condition that there is at most one state-sequence that takes A from p to p -LRB- without passing through p -RRB- . Since the number of states k = jQj is finite , it is easy to see that , for each w 2 R , w is t-tiered with respect to A for some nonnegative t that is at most k. Assume that each word in R is t-tiered with respect to A for some nonnegative t bounded by a constant k . Then pR -LRB- n -RRB- is O -LRB- nk ? 1 -RRB- by Theorem 1 . Suppose that there exists a state p of A that satisfies -LRB- i -RRB- , -LRB- ii -RRB- , and -LRB- iii -RRB- above . Let u ; v 2 ?? such that ffi ? -LRB- q0 ; u -RRB- = p and ffi ? -LRB- p ; v -RRB- 2 F . Let R0 = u -LRB- xy + yx -RRB- ? v. Obviously , R0 ? R and R0 has a density of 2 ? -LRB- n -RRB- . A contradiction . 2 Theorem 8 There does not exist a regular language R such that pR -LRB- n -RRB- is neither O -LRB- nk -RRB- , for some integer k > = , nor 2 ? -LRB- n -RRB- . Proof . Suppose R is a regular language and pR -LRB- n -RRB- is neither O -LRB- nk -RRB- , for some integer k > = 0 , nor 2 ? -LRB- n -RRB- . Let A be a DFA that accepts R . Then either there exists a state q in A that satisfies -LRB- i -RRB- , -LRB- ii -RRB- , and -LRB- iii -RRB- of Lemma 6 , or there does not . If there does not , then pR -LRB- n -RRB- is O -LRB- nk -RRB- , for some k > = 0 , by Lemma 6 and Theorem 1 . A contradiction . If there does , we can show that pR -LRB- n -RRB- is 2 ? -LRB- n -RRB- . Again a contradiction . Therefore , such a language R does not exist . 2 Thus , for example , there is no regular language that has a density of the order 2 kpn for any k > 1 . The following corollary holds trivially . Corollary 2 If a regular language R is of starheight k > = 2 , then pR -LRB- n -RRB- is 2 ? -LRB- n -RRB- . Besides the above results , we would also like to find more details about the density functions of regular languages . t is not difficult to see that , for each nonnegative integer k , we can construct a regular language R such that pR -LRB- n -RRB- is exactly nk . Note that not every functions pR -LRB- n -RRB- of a regular language R is exactly a polynomial function . For example , the language -LRB- aa -RRB- ? has a density -LRB- 1 + -LRB- ? 1 -RRB- n -RRB- = 2 which can not be expressed by a polynomial . Besides , not every polynomial function can be the density function of a regular language . For example , all polynomial functions that have a negative value for a positive n are not density functions of any languages . However , for each polynomial function f -LRB- n -RRB- , there exist a regular language R such that pR -LRB- n -RRB- is ? -LRB- f -LRB- n -RRB- -RRB- , and for each regular language R , either there exists a polynomial function f -LRB- n -RRB- such that pR -LRB- n -RRB- = ? -LRB- f -LRB- n -RRB- -RRB- , or pR -LRB- n -RRB- = 2 ? -LRB- n -RRB- . 5 Closure properties of regular languages with polynomial den - sities In this section , we list several closure properties of the regular languages with polynomial densities . Since most of the properties can be derived directly from the results in Section 3 , we omit the proofs . Theorem 9 Let L1 and L2 be regular languages over ? with pL1 -LRB- n -RRB- = ? -LRB- nk -RRB- and pL2 -LRB- n -RRB- = ? -LRB- nl -RRB- . Then the following statements hold : -LRB- a -RRB- If L = prefix -LRB- L1 -RRB- = fx j xy 2 L1 for some y 2 ?? g , then pL -LRB- n -RRB- = ? -LRB- nk -RRB- . -LRB- b -RRB- If L = infix -LRB- L1 -RRB- = fy j xyz 2 L1 for some x ; y 2 ?? g , then pL -LRB- n -RRB- = ? -LRB- nk -RRB- . -LRB- c -RRB- If L = suffix -LRB- L1 -RRB- = fz j xz 2 L1 for some x 2 ?? g , then pL -LRB- n -RRB- = ? -LRB- nk -RRB- . -LRB- d -RRB- If L = L1 -LSB- L2 , then pL -LRB- n -RRB- = ? -LRB- nmax -LRB- k ; l -RRB- . -LRB- e -RRB- If L = L1 \ L2 , then pL -LRB- n -RRB- = O -LRB- nmin -LRB- k ; l -RRB- . -LRB- f -RRB- If L = L1L2 , then pL -LRB- n -RRB- = O -LRB- nk + l +1 -RRB- . -LRB- g -RRB- If L = h -LRB- L1 -RRB- where h is an arbitrary morphism -LSB- 5 -RSB- , then pL -LRB- n -RRB- = O -LRB- nk -RRB- . -LRB- h -RRB- If L = 1m -LRB- L1 -RRB- = fx j xy1 : : : ym ? 1 2 L1 ; for x ; y1 ; : : : ; ym ? 1 2 ?? ; and jxj = jy1j = : : : = jym ? 1jg , then pL -LRB- n -RRB- = ? -LRB- nk -RRB- . It is clear that the set of regular languages with polynomial densities is not closed under complementation . However , we have the following result . Theorem 10 The complement of a regular language with a polynomial density is a starheight-one language . The idea of a proof is the following . Let A be a DFA accepting a regular language of a polynomial density and there is an integer k > = such that each word in L -LRB- A -RRB- is t-tiered for some t < = k . We assume that A is reduced . To make A complete , we add a new state , say , q , the so called sink state , such that all undefined transitions are directed to this state and ffi -LRB- qa -RRB- = q for each a 2 ? . Then the completement of L -LRB- A -RRB- is accepted by a DFA A which is exactly the same as the completed A except that the final states and non-final states are exchanged . Let B be another DFA which is the same as A except that the only transition for q is ffi -LRB- q ; # -RRB- = q for some # 62 ? . It is not difficult to show that each word in L -LRB- B -RRB- is t-tiered for some t < = k + 1 . Define a finite substitution oe such that oe -LRB- a -RRB- = fag for each a 2 ? and oe -LRB- # -RRB- = ? . Then oe -LRB- L -LRB- B -RRB- -RRB- = L -LRB- A -RRB- . By Theorem 6 , L -LRB- A -RRB- is of starheight one . Thus , the set of starheight-one languages includes all the regular languages with polynomial densities and their complements . References -LSB- 1 -RSB- L. Berman and J. Hartmanis , \ On Isomorphisms and Density of NP and Other Complete Sets '' , SIAM J. of Comput . 6 -LRB- 1977 -RRB- 305-322 . -LSB- 2 -RSB- J. Brzozowski , \ Open Problems about Regular Languages '' , Formal Language Theorem | Perspectives and Open Problems , pp. 23-48 , edited by R. V. Book , 1980 . -LSB- 3 -RSB- D. I. A. Cohen , Basic Techniques of Combinatorial Theory , John Wiley & Sons , New York , 1978 . -LSB- 4 -RSB- T. H. Cormen , C. E. Leiserson , R. L. Rivest , Introduction to Algorithms , the MIT Press and McGraw-Hill , 1990 . -LSB- 5 -RSB- K. Culik II , F.E. Fich and A. Salomaa , \ A Homomorphic Characterization of Regular Languages '' , Discrete Applied Mathematics 4 , -LRB- 1982 -RRB- 149-152 . -LSB- 6 -RSB- P. Enflo , A. Granville , J. Shallit , S. Yu , \ On Weakly Sparse Languages L Such That LL = ?? '' , submitted to Discrete Applied Mathematics . -LSB- 7 -RSB- J.E. Hopcroft and J.D. Ullman , Introduction to Automata Theory , Languages , and Computation , Addison Wesley -LRB- 1979 -RRB- , Reading , Mass. . -LSB- 8 -RSB- S. R. Mahaney , \ Sparse Complete Sets for NP : Solution of a Conjecture of Berman and Hartmanis '' , J. Comp . System Sci . 25 -LRB- 1982 -RRB- 130-143 . -LSB- 9 -RSB- B. Ravikumar and O. H. Ibarra , \ Relating the type of ambiguity of finite automata to the succintness of their representation '' , SIAM J. Comput . vol . 18 , no. 6 -LRB- 1989 -RRB- 1263-1282 . -LSB- 10 -RSB- T. Jiang and B. Ravikumar , \ Minimal NFA Problems are Hard '' , Proceddings of 18th ICALP , Lecture Notes in Computer Science 510 , Springer-Verlag -LRB- 1991 -RRB- 629-640 . -LSB- 11 -RSB- A. Salomaa , Theory of Automata , Pergamon Press -LRB- 1969 -RRB- , Oxford . -LSB- 12 -RSB- A. Salomaa , Computation and Automata , Encyclopedia of Mathematics and Its Applications , vol . 25 . Cambridge University Press , 1985 . -LSB- 13 -RSB- J. Shallit , \ Numeration Systems , Linear Recurrences , and Regular Sets '' , Research Report CS-91-32 , Dept. of Computer Science , Univ. of Waterloo , 1991 . -LSB- 14 -RSB- S. Yu , \ Can the Catenation of Two Weakly Sparse Languages be Dense ? '' , Discrete Applied Mathematics 20 -LRB- 1988 -RRB- 265-267 .

O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

density functions
polynomial densities
regular languages

population functions of languages
starheight-one languages


Solving

Space

Planning

Problems

Using

Constraint

Technology

Philippe

CHARMAN

SECOIA

Project

CERMICS-INRIA

route

des

Lucioles

BP

SOPHIA-ANTIPOLIS

Cedex

Email

charman@snoopy.inria.fr

Tel

Abstract

Constraint

programming

techniques

have

proven

their

efficiency

in

solving

high

combinatory

problems

In

this

paper

we

study

the

adaptation

the

extension

and

the

limits

of

those

techniques

in

the

space

planning

problem

which

consists

in

finding

the

locations

and

the

sizes

of

several

objects

under

geometric

constraints

in

a

location

space

For

all

that

we

define

the

formalism

of

Geometric

Constraint

Satisfaction

Problem

-LRB-

GCSP

-RRB-

with

geometric

domains

for

representing

the

position

variables

of

the

objects

We

propose

in

particular

an

intelligent

and

geometric

backtrack

based

on

constraint

propagations

Then

we

present

our

environment

dedicated

to

problems

with

rectangles

of

variable

sizes

Introduction

Space

planning

problems

include

object

placement

problem

-LRB-

e.g.

room

arrangement

-RRB-

space

partitioning

problem

-LRB-

e.g.

floor

plan

of

an

apartment

-RRB-

cuttingstock

problems

and

placement/routing

problems

Most

of

the

times

a

space

planning

problem

can

be

viewed

as

a

Constraint

Satisfaction

Problem

-LRB-

CSP

-RRB-

Since

many

years

constraint

programming

has

succeeded

in

solving

high

combinatory

problems

-LSB-

-RSB-

After

a

short

presentation

of

space

planning

problems

we

study

how

the

constraint

technology

can

be

applied

on

space

planning

problem

and

what

are

its

limits

Then

we

present

the

interactive

environment

we

have

developed

for

that

kind

of

problems

EAAS

Space

planning

problem

Definition

A

space

planning

problem

can

be

defined

as

follows

given

a

location

space

and

constrained

objects

find

the

locations

and

the

sizes

of

the

objects

inside

the

location

space

to

satisfy

the

constraints

The

main

constraints

which

arise

in

a

space

planning

problem

can

be

expressed

with

geometric

constraints

Among

the

concerned

domains

we

can

mention

Architecture

Electronics

and

Mechanical

Engineering

Related

works

Many

works

are

related

to

space

planning

problems

we

will

only

present

here

the

main

approaches

issued

from

the

Artificial

Intelligence

field

Exhaustive

search

Fletcher

-LSB-

-RSB-

used

recursive

macros

to

fit

without

overlapping

into

a

plane

area

The

search

for

solutions

consists

of

an

orderly

exhaustion

of

possible

placings

of

patterns

Howden

-LSB-

-RSB-

used

an

exhaustive

approach

for

the

sofa

problem

-LRB-

i.e.

move

an

irregular

shaped

object

through

a

two-dimensional

room

-RRB-

Exhaustive

search

strategies

are

not

efficient

even

when

the

objects

are

simple

Heuristics

GPS

-LSB-

-RSB-

and

DPS

-LSB-

-RSB-

are

space

planners

using

heuristics

to

reduce

the

search

space

The

heuristics

sort

the

objects

and

the

locations

-LRB-

e.g.

place

the

biggest

objects

first

prefer

corners

etc.

-RRB-

The

tried

locations

for

placing

an

object

depend

on

the

existing

layout

The

result

is

that

the

generated

configurations

depend

on

the

order

in

which

objects

enter

the

layout

Since

they

try

only

one

ordering

they

may

miss

possible

solutions

Their

completeness

is

not

guaranteed

In

both

systems

the

sizes

of

the

objects

must

be

defined

Expert

systems

The

layout

synthesis

system

LOOS

-LSB-

-RSB-

constructs

and

evaluates

configurations

by

using

operators

or

rules

that

work

on

configurations

There

are

three

types

of

rules

generation

propagation

and

test

rules

Watanabe

-LSB-

WNY

-RSB-

developed

an

expert

system

using

knowledge

engineering

which

produces

layout

plan

for

a

computer

room

His

system

is

composed

of

a

knowledge

base

consisting

of

heuristics

to

determine

the

positioning

the

size

and

the

shapes

of

the

facilities

and

an

inference

engine

which

executes

a

l'Am

enagement

Spatial

pentomino

is

a

plane

figure

consisting

of

five

contiguous

equal

squares

the

layout

determining

interpreting

and

executing

the

knowledge

stored

in

the

knowledge

base

Constraints

The

constraint-directed

search

has

been

examined

by

Baykan

and

Fox

-LSB-

-RSB-

Constraints

reduce

search

complexity

by

choosing

the

most

constrained

decision

The

measures

that

identify

opportunistic

decisions

are

variable

tightness

constraint

reliance

and

constraint

tightness

Least

commitment

representations

delay

decisions

until

enough

information

becomes

available

Abstractions

reduce

complexity

by

allowing

abstract

constraints

to

prune

away

the

entire

design

subsets

Du

Verdier

-LSB-

-RSB-

has

associated

constraint

satisfaction

techniques

to

a

configuration

space

modeling

allowing

to

represent

position

and

orientation

of

the

objects

He

has

developed

dynamic

consistency

algorithms

for

underconstrained

problems

and

a

variable

precision

solving

technique

Donikian

and

H?egron

-LSB-

-RSB-

have

developed

a

declarative

method

devoted

to

sketch

creation

of

architectural

environments

The

solving

is

based

on

the

cooperation

between

two

inference

techniques

namely

a

logical

stemming

from

Allen

's

temporal

logic

-LSB-

-RSB-

and

a

numerical

inference

based

on

optimization

under

constraint

algorithms

Among

these

systems

some

are

not

adapted

for

real

cases

-LSB-

-RSB-

some

can

not

avoid

a

combinatory

explosion

-LSB-

-RSB-

and

some

are

specific

to

a

particular

problem

-LSB-

WNY

-RSB-

Generally

the

conflicting

and

dynamic

aspects

are

often

ignored

and

the

combinatory

aspect

is

not

well

handled

Formulation

of

a

GCSP

A

CSP

is

defined

by

a

set

of

variables

belonging

to

a

finite

domain

of

values

and

a

set

of

constraints

on

these

variables

-LSB-

-RSB-

To

solve

a

CSP

means

to

instantiate

the

variables

in

order

to

satisfy

all

the

constraints

Many

research

works

are

related

to

CSP

-LSB-

-RSB-

We

call

GCSP

-LRB-

Geometric

Constraint

Satisfaction

Problem

-RRB-

a

CSP

with

geometric

constraints

on

objects

to

place

and

to

size

An

object

is

characterized

by

its

location

its

orientation

its

shape

and

its

sizes

The

position

of

an

object

is

the

position

of

a

particular

point

named

the

reference

point

The

configuration

of

an

object

represents

the

whole

locations

orientations

shapes

and

sizings

admitted

for

that

object

The

objects

in

a

GCSP

are

analogous

to

the

variables

in

a

CSP

Solving

a

GCSP

means

finding

all

the

locations

the

orientations

the

shapes

and

the

sizes

of

the

objects

to

satisfy

all

the

constraints

A

constraint

C

on

objects

-LRB-

Oi

-RRB-

i

n

is

said

to

be

consistent

if

for

all

the

configurations

of

an

object

Ok

there

is

at

least

one

configuration

of

the

others

objects

-LRB-

Oj

-RRB-

j

k

such

that

the

constraint

can

be

satisfied

A

graph

of

constraints

is

said

to

be

arc-consistent

if

all

the

constraints

are

consistent

The

propagation

method

of

a

constraint

reduces

the

configurations

of

the

objects

in

order

to

make

it

consistent

Configuration

of

the

objects

In

the

CSP

formalism

the

domains

of

the

variables

are

unidimensional

and

generally

discrete

We

will

show

that

such

domains

can

not

correctly

formalize

most

of

the

space

planning

problems

Multidimensional

domains

When

the

position

variables

are

expressed

in

a

unidimensional

way

-LSB-

-RSB-

the

filtering

of

these

variables

can

not

be

efficient

We

can

see

on

Figure

that

in

the

location

space

the

object

has

already

been

placed

but

no

filtering

on

position

variables

of

can

be

done

The

domains

of

the

position

variables

are

x

-LSB-

L

-RSB-

and

y

-LSB-

l

-RSB-

LP

-LRB-

x

y

-RRB-

Figure

Two

modelings

for

the

position

variables

By

expressing

the

reference

point

of

every

object

as

a

whole

variable

belonging

to

a

geometric

region

the

domains

are

correctly

reduced

when

placing

the

objects

The

domain

of

the

position

variables

are

now

-LRB-

x

y

-RRB-

polygon

-LRB-

-RRB-

Geometric

domains

Representing

a

space

planning

problem

with

discretized

domains

presents

two

drawbacks

achieving

arc-consistency

could

be

slow

when

a

lot

of

values

are

in

the

domain

and

the

completeness

is

not

guaranteed

the

discretization

could

have

deleted

some

solutions

So

a

discrete

representation

is

therefore

not

adapted

for

real

problems

Solving

a

space

planning

problem

with

continuous

domains

is

theoretically

possible

-LSB-

-RSB-

Nevertheless

the

complexity

is

exponential

and

the

method

is

too

slow

when

the

number

of

objects

is

important

So

we

consider

geometric

domains

for

both

position

variables

and

dimension

variables

for

the

objects

to

be

placed

and

discretize

the

object

parameters

only

when

it

will

be

placed

Moreover

orientations

are

discretized

Adaptation

and

extension

of

CSP

techniques

to

space

planning

problems

In

the

rest

of

the

paper

we

suppose

that

the

position

variables

belong

to

multidimensional

and

geometric

domains

and

that

orientation

variables

are

discretized

Determination

of

available

location

space

-LRB-

domain

fil

tering

-RRB-

The

determination

of

the

object

configurations

before

placing

them

corresponds

to

the

arc-consistency

of

the

graph

If

for

each

constraint

a

propagation

method

is

defined

the

algorithm

of

arc-consistency

can

be

inspired

from

Waltz

-LSB-

-RSB-

procedure

GAC

-LRB-

inout

P

-RRB-

Pre

is

a

GCSP

Post

either

P

is

the

closure

by

arc-consistency

of

or

exit

with

failure

Begin

Q

f

C

P

g

while

Q

O

select

and

delete

C

from

Q

Result

Revise

-LRB-

C

-RRB-

if

Result

fail

then

exit

with

failure

if

Result

O

then

Q

Q

-LSB-

P

j

X

-LRB-

-RRB-

T

Resultg

end

while

end

Gac

The

principle

is

to

reduce

the

configurations

of

the

objects

until

all

the

constraints

are

consistent

The

function

Revise

is

the

propagation

method

of

the

constraint

On

Figure

objects

and

must

verify

the

following

constraints

ffl

must

touch

the

left

side

of

E

ffl

must

be

right

of

ffl

has

a

fixed

orientation

Before

the

arc-consistency

is

achieved

the

reference

point

of

and

must

be

inside

the

location

space

E

After

the

arc-consistency

is

achieved

the

reference

point

of

must

be

inside

the

grey

regions

If

it

is

inside

the

right

grey

region

then

the

constraint

must

be

right

of

will

be

satisfied

for

all

the

configurations

of

Figure

Example

of

configuration

determination

The

function

Revise

returns

either

fail

if

the

domain

of

a

variable

becomes

empty

or

the

list

of

variables

which

the

domain

has

been

reduced

-LRB-

that

list

can

be

empty

-RRB-

Let

e

be

the

number

of

constraints

and

d

the

maximal

number

of

quanta

of

a

geometric

region

according

to

a

certain

accuracy

The

run-time

complexity

of

the

arc-consistency

algorithm

is

bounded

by

O

-LRB-

e

-RRB-

and

O

-LRB-

-RRB-

computed

in

respect

to

the

number

of

the

geometric

differences

of

two

polygons

or

polyhedrons

depending

on

whether

they

are

in

or

Note

that

the

complexity

of

the

geometric

differences

depends

of

the

number

of

vertices

Build-up

placement

of

objects

A

simultaneous

placement

algorithm

has

been

proposed

by

Avnaim

-LSB-

-RSB-

for

and

polygons

But

for

a

larger

number

of

polygons

the

algorithm

has

not

a

tractable

run-time

complexity

So

the

best

way

to

place

objects

seems

to

be

the

build-up

way

that

places

the

objects

one

by

one

The

order

of

placement

is

dynamic

the

criterion

for

selecting

the

next

object

to

place

takes

account

of

dynamic

criteria

-LRB-

number

of

constraints

with

the

already

placed

objects

etc.

-RRB-

and

static

criteria

-LRB-

the

size

of

the

object

etc.

-RRB-

After

each

placement

a

filtering

on

the

configurations

of

the

non-placed

objects

can

be

carried

out

in

order

to

achieve

arc-consistency

If

during

the

placement

the

system

can

not

place

an

object

then

it

must

determine

the

object

to

be

displaced

procedure

Place

-LRB-

L

-RRB-

Pre

L

is

a

set

of

non

placed

objects

Post

either

all

the

objects

have

been

placed

or

exit

with

failure

Begin

sort

L

according

to

selection

criteria

O

first

object

to

be

placed

for

each

placement

and

sizing

of

O

do

if

the

placement

and

sizing

are

correct

then

filter

the

configurations

of

the

non-placed

objects

linked

with

O

if

the

reduced

configurations

induced

no

inconsistency

then

if

all

objects

have

been

placed

then

a

solution

is

found

else

Place

-LRB-

L

O

-RRB-

if

it

is

impossible

to

place

O

then

if

O

is

the

very

first

object

then

exit

with

failure

-LRB-

the

problem

has

no

solution

-RRB-

else

find

the

object

which

caused

the

fail

continue

the

placement

from

that

object

end

Place

Backtrack

We

will

see

the

main

backtrack

mechanisms

which

can

be

applied

on

a

GCSP

The

chronological

backtrack

will

not

be

examined

for

it

can

be

applied

to

any

CSP

Backjumping

Backjumping

is

a

backtrack

directed

by

the

topology

of

the

graph

-LSB-

-RSB-

The

principle

is

to

return

in

case

of

failure

on

the

variable

Xi

to

the

last

variable

Xj

connected

with

Xi

On

Figure

we

see

on

the

left

picture

that

the

CSP

is

composed

of

ordered

variables

and

The

constraints

between

variables

are

represented

on

their

left

instantiation

of

is

correct

As

the

variables

and

are

not

connected

with

they

can

not

be

the

failure

cause

The

instantiation

must

continue

from

That

technique

is

efficient

when

the

graph

is

sparse

But

in

the

case

of

space

planning

problems

the

graph

is

generally

complete

by

the

non-overlap

constraints

between

objects

in

that

case

the

backjumping

can

not

be

applied

constraints

Constraints

between

variables

Instantiation

order

Figure

Principle

of

the

backjumping

Propagation-directed

backtrack

We

present

a

backtrack

which

needs

to

record

for

each

object

Oi

the

list

of

the

objects

which

have

reduced

the

configuration

of

Oi

On

Figure

the

constraints

which

have

not

reduced

the

configurations

have

been

drawn

with

a

dotted

line

The

placements

of

and

have

not

reduced

the

configuration

of

For

every

placement

and

sizing

of

can

not

be

placed

after

and

are

not

the

cause

of

failure

so

the

placement

must

continue

from

order

Figure

Intelligent

and

geometric

backtrack

The

principle

of

that

backtrack

is

to

return

to

the

last

located

and

placed

object

which

reduced

the

configuration

of

the

object

Oi

or

one

of

the

non-placed

objects

and

which

the

configuration

has

been

reduced

when

placing

Oi

The

search

of

such

an

object

can

be

done

by

this

algorithm

function

Misplaced-Object-Search

-LRB-

Oi

-RRB-

Pre

Oi

is

a

set

of

already

placed

objects

Post

returns

the

object

which

caused

the

failure

Begin

L

objects

which

configuration

has

been

reduced

when

placing

Oi

M

O

while

L

O

do

let

O

the

first

object

of

L

L

L

fOg

if

O

has

already

been

placed

then

M

M

fOg

else

L

L+R

educing-Objects

-LRB-

O

-RRB-

return

the

last

placed

object

from

M

end

Misplaced-Object-Search

The

function

Reducing-Objects

returns

the

set

of

objects

which

caused

the

reduction

of

the

configurations

of

an

object

O.

Learning

backtrack

The

propagation-directed

backtrack

and

the

backjumping

do

not

record

the

failures

and

can

do

them

again

On

Figure

after

placing

and

we

can

not

place

and

If

the

next

placement

of

reduces

in

the

same

way

the

configurations

of

and

then

the

same

failure

will

appear

To

avoid

that

we

can

in

the

case

of

failure

record

the

configurations

of

the

non-placed

objects

and

check

that

another

similar

situation

will

not

appear

during

the

placement

Graph

preprocessing

Problem

symmetry

By

adapting

the

interchangeability

between

values

-LRB-

notion

formalized

by

Freuder

-LSB-

-RSB-

-RRB-

we

define

a

geometric

interchangeability

in

order

to

exploit

the

problem

symmetry

A

constraint

is

said

to

be

symmetric

when

the

order

of

the

objects

does

not

change

the

semantics

of

constraint

-LRB-

constraint

A-and-B-don-t-overlap

is

symmetric

but

A-is-right-from-B

is

not

-RRB-

Two

objects

are

interchangeable

when

they

have

exactly

the

same

constraints

and

when

the

constraints

between

them

are

symmetric

A

problem

is

said

to

be

symmetric

if

some

objects

are

interchangeable

The

symmetry

notion

efficiently

reduces

the

depth

search

by

prohibiting

to

place

two

interchangeable

objects

at

the

same

location

order

First

placement

of

OSecond

placement

of

Figure

Learning

backtrack

Redundant

constraints

A

constraint

is

redundant

if

it

does

not

modify

the

set

of

solutions

-LSB-

-RSB-

For

instance

constraint

A-and-B-don-t-overlap

is

redundant

with

respect

to

the

constraint

A-is-right-from-B

When

a

propagation

method

is

associated

to

each

constraint

we

could

not

take

into

account

the

redundant

constraints

for

solving

the

problem

Space

partitioning

If

the

problem

brings

back

to

a

space

partitioning

problem

i.e.

all

objects

must

cover

location

space

without

overlapping

a

special

algorithm

based

on

corners

can

be

used

for

the

placement

rather

than

the

general

placement

algorithm

Consistency

maintenance

of

a

placement

When

an

arrangement

is

realized

the

user

can

modify

some

constraints

In

that

case

we

can

maintain

consistency

by

applying

simple

transformations

-LRB-

rotation

and/or

translation

-RRB-

on

the

objects

To

take

the

modifications

into

account

it

is

not

necessary

to

enumerate

again

all

the

variables

That

approach

is

inspired

from

the

system

of

Arbab

-LSB-

-RSB-

Consistency

maintenance

method

Each

constraint

has

its

method

to

maintain

the

consistency

of

an

arrangement

These

methods

indicate

the

transformations

on

the

objects

e.g.

the

consistency

maintenance

method

of

two-objectsdon

t-overlap

constraint

can

be

expressed

like

this

Operational

Transformation

Planning

non-overlapping-consistency-maintenance-method

-LRB-

A

B

-RRB-

place

A

right

from

B

or

place

A

left

from

B

or

That

method

presents

a

double

interest

we

get

a

close

solution

without

important

modifications

and

a

solution

is

found

quickly

without

starting

the

enumeration

from

the

beginning

Consistency

maintenance

algorithm

The

basic

idea

of

the

consistency

maintenance

algorithm

is

based

on

minimal

local

move

which

chooses

the

move

which

will

locally

satisfy

the

maximal

number

of

the

constraints

Note

that

this

local

minimal

consistency

maintenance

does

not

guarantee

the

global

minimal

one

In

order

to

avoid

an

infinite

loop

the

stop

criterion

is

to

retrieve

an

identical

disposition

of

objects

The

consistency

maintenance

algorithm

is

the

following

procedure

CM

-LRB-

states

-RRB-

Pre

some

constraints

in

are

not

satisfied

Post

all

the

constraints

in

P

are

satisfied

or

exit

with

failure

Begin

Q

f

C

j

Satisfied

-LRB-

C

-RRB-

false

g

T

f

TD

R

j

C

Q

such

that

after

Execute

-LRB-

TD

R

-RRB-

then

Satisfied

-LRB-

C

-RRB-

true

g

while

T

O

select

and

delete

a

transformation

TD

R

from

T

Execute

-LRB-

TD

R

-RRB-

if

current-state

states

then

exit

from

CM

-LRB-

endless

loop

-RRB-

else

if

C

j

Satisfied

-LRB-

C

-RRB-

false

then

CM

-LRB-

states

-LSB-

f

current-state

g

-RRB-

else

exit

with

success

end

while

end

CM

The

function

Satisfied

returns

true

if

the

constraint

is

satisfied

and

the

procedure

Execute

perfoms

the

transformations

on

the

objects

Example

of

consistency

maintenance

We

wish

to

have

five

rectangles

left

aligned

Rectangles

A

B

D

and

E

can

move

vertically

while

rectangle

C

has

no

restriction

on

its

moves

Figure

shows

the

disposition

on

an

initial

inconsistent

state

Figure

shows

how

the

maintenance

mechanism

restores

the

consistency

Finally

Figure

corresponds

to

a

consistent

state

with

a

global

minimal

move

of

the

rectangles

ABCDEABCDEABCDEInitial

inconsistant

stateOptimum

statea

-RRB-

b

-RRB-

c

-RRB-

Final

consistant

state

Figure

Example

of

consistency

maintenance

Limits

The

arc-consistency

algorithms

we

presented

are

efficient

only

when

the

propagation

methods

are

defined

for

reducing

the

configurations

of

the

other

objects

If

we

want

to

define

a

new

geometric

constraint

it

will

be

interesting

to

collaborate

with

a

computer

algebra

system

for

deducing

the

propagation

method

from

the

constraint

predicate

The

most

recent

research

on

CSPs

has

not

yet

proposed

an

efficient

methodology

when

the

number

of

variables

is

not

predetermined

That

is

also

valid

for

the

GCSPs

and

so

we

can

not

for

instance

solve

problems

in

which

a

maximal

number

of

objects

must

be

placed

in

a

bounded

location

space

To

optimize

GCSPs

the

same

remark

can

be

done

in

a

less

degree

We

can

incorporate

optimization

constraints

in

a

GCSP

and

apply

optimization

arborescent

search

algorithms

like

the

branch

and

bound

algorithm

But

if

the

problem

is

known

for

being

solved

by

other

techniques

-LRB-

simulated

annealing

tabu

search

etc.

-RRB-

the

constraint

approach

will

not

fit

Validation

In

order

to

validate

our

previous

purpose

we

present

our

space

planner

prototype

Eaas

based

on

the

previously

constraint

programming

techniques

and

on

geometric

aspects

of

the

objects

The

constraint

interpretation

in

Eaas

is

ffl

either

in

satisfaction

no

one

object

is

placed

the

system

can

find

one

or

more

locations

of

the

object

in

order

to

satisfy

the

constraints

ffl

or

in

consistency

maintenance

when

the

objects

are

already

placed

and

some

constraints

are

not

satisfied

the

system

can

find

a

solution

by

a

sequence

of

displacements

on

the

objects

Manipulated

objects

First

we

consider

for

our

study

only

oriented

rectangles

in

the

plane

and

boolean

The

parameters

of

a

rectangle

refer

to

its

coordinates

-LRB-

abscissa

and

ordinate

-RRB-

its

orientation

-LRB-

angle

related

to

the

absolute

reference

-RRB-

and

its

dimensions

-LRB-

length

and

width

-RRB-

The

solution

must

lead

to

the

instantiation

of

the

parameters

of

the

rectangles

to

satisfy

all

the

constraints

The

domains

of

the

position

variables

are

expressed

by

a

union

of

rectangles

On

Figure

object

has

already

been

placed

and

the

position

variables

of

must

belong

to

-LSB-

-LSB-

-LSB-

Figure

Modeling

of

the

variable

position

Let

e

the

number

of

constraints

and

d

the

maximal

number

of

rectangles

for

defining

the

domains

of

the

position

variables

The

complexity

for

achieving

arcconsistency

in

respect

to

the

number

of

geometric

difference

between

rectangles

is

bounded

by

O

-LRB-

e

-RRB-

and

O

-LRB-

-RRB-

Geometric

constraints

Constraints

include

a

passive

part

composed

of

a

predicate

and

geometric

properties

and

an

active

part

composed

of

a

propagation

method

and

a

consistency

maintenance

method

Constraint

predicate

The

predicate

which

indicates

if

a

constraint

is

satisfied

or

not

is

functionally

expressed

with

logical

operators

-LRB-

and

or

etc.

-RRB-

and

numerical

operators

-LRB-

etc.

-RRB-

The

system

handles

a

conjunction

of

constraints

A

disjunctive

constraint

can

be

defined

with

a

disjunctive

predicate

Geometric

properties

of

a

constraint

Constraints

can

be

defined

to

be

symmetric

and

redundant

in

respect

to

another

constraint

A

difficulty

factor

is

attached

to

each

constraint

It

represents

the

estimated

difficulty

to

satisfy

the

rectangle

is

defined

to

be

rectilinear

when

its

sides

are

parallel

to

the

reference

axis

constraint

is

satisfied

or

not

there

is

no

degree

in

the

satisfaction

constraint

That

difficulty

arises

in

the

heuristics

for

selecting

the

next

rectangle

to

place

and

has

been

used

in

many

systems

-LSB-

-RSB-

Methods

associated

to

a

constraint

For

each

constraint

are

associated

a

propagation

method

to

reduce

the

parameter

domains

and

a

consistency

maintenance

method

for

restoring

consistency

The

propagation

method

is

absolutely

necessary

in

space

planning

problems

where

discretization

leads

to

a

large

number

of

combinations

Satisfaction

constraint

problem

solving

The

problem

solving

is

done

in

three

phases

Symbolic

manipulation

on

constraints

in

order

to

detect

incompatible

constraints

-LRB-

rule-based

detection

-RRB-

and

to

remove

redundant

constraints

Determination

of

the

problem

characteristics

-LRB-

problem

symmetry

space

partitioning

etc.

-RRB-

Numeric

solving

of

the

effective

placement

of

the

objects

Objects

are

located

in

three

phases

-LRB-

a

-RRB-

first

the

determination

of

location

space

for

every

rectangle

-LRB-

virtual

placement

-RRB-

-LRB-

b

-RRB-

then

the

detection

of

a

numeric

inconsistency

-LRB-

c

-RRB-

and

finally

the

build-up

placement

of

rectangles

-LRB-

effective

placement

-RRB-

Computational

results

Table

compares

Eaas

with

other

space

planner

systems

Wright

-LSB-

-RSB-

Atlas

-LSB-

-RSB-

and

with

a

programming

logic

language

with

constraints

Chip

-LSB-

-RSB-

We

give

the

total

number

of

choice

points

and

the

time

of

search

The

more

pertinent

parameter

is

the

number

of

choice

points

The

time

of

search

is

indicated

for

information

but

not

really

for

comparison

since

the

computer

configuration

is

not

the

same

for

all

the

systems

Eaas

has

been

developed

with

LeLisp

-LSB-

-RSB-

and

runs

on

a

Sun

A

dash

indicates

that

the

result

is

not

available

We

have

tested

on

two

examples

one

issued

from

Pfefferkorn

-LSB-

-RSB-

rectangles

of

fixed

dimension

and

fixed

orientation

-LRB-

and

-RRB-

must

be

placed

in

a

rectangle

and

the

other

from

Tong

-LSB-

-RSB-

rectangles

of

minimal

width

and

height

must

be

placed

on

the

perimeter

of

a

rectangle

The

abbreviation

cp

represents

the

total

number

of

choice

points

s

the

number

of

generated

states

and

t

the

time

expressed

in

seconds

We

can

notice

a

good

behavior

for

the

choice

points

Space

planners

CSP

tools

Eaas

Wright

Atlas

Chip

Pfefferkorn

cp

First

sol

s

t

Pfefferkorn

cp

All

sol

s

57 119 118

t

Tong

cp

All

sol

s

t

Table

Comparison

results

for

rectangle

problems

Conclusion

Finally

we

notice

a

good

adaptation

of

algorithms

and

techniques

of

constraint

programming

for

solving

space

planning

problems

However

the

efficiency

is

guaranteed

only

when

we

can

propagate

constraints

for

reducing

search

space

A

constraint

approach

is

relevant

for

satisfying

mandatory

constraints

For

optimization

constraints

this

approach

is

still

relevant

if

the

problem

can

be

solved

with

classical

optimization

search

algorithms

-LRB-

branch

and

bound

etc.

-RRB-

Domain

filtering

reduces

complexity

Collaboration

with

a

computing

algebra

system

for

deducing

propagation

methods

from

the

predicate

seems

essential

to

improve

the

interaction

with

the

user

This

paper

showed

that

space

planning

problems

are

an

interesting

experimentation

framework

for

constraint

technology

and

in

conclusion

we

think

that

to

handle

the

complexity

of

the

space

planning

problems

a

constraintbased

approach

combined

with

a

computing

algebra

and

a

rule-based

system

is

a

promising

approach

Acknowledgements

I

would

like

to

thank

Bertrand

NEVEU

and

Brigitte

TROUSSE

for

many

helpful

discussions

References

-LSB-

-RSB-

A.

Aggoun

and

N.

Beldiceanu

Extending

CHIP

in

order

to

solve

complex

scheduling

and

placement

problems

Math

and

Comp

Modeling

-LRB-

-RRB-

-LCB-

-LSB-

-RSB-

J.

Allen

Maintaining

knowledge

about

temporal

intervals

Communications

of

the

ACM

-LRB-

-RRB-

-LSB-

-RSB-

F.

Avnaim

Placement

and

displacement

of

rigid

or

articulated

forms

Ph.D.

Thesis

University

of

Franche-Comt

e

-LRB-

in

french

-RRB-

-LSB-

-RSB-

F.

Arbab

and

B.

Wang

A

constraint-based

design

system

based

on

operational

transformation

planning

In

J.

Gero

editor

AI

in

Engineering

July

-LSB-

-RSB-

P.

Berlandier

A

Study

of

Constraint

Interpretation

Mechanisms

and

of

their

Integration

in

a

Knowledge

Representation

Language

Ph.D.

Thesis

Universit?e

de

Nice

-LRB-

in

french

-RRB-

-LSB-

-RSB-

C.

Baykan

and

M.

Fox

Constraint

satisfaction

techniques

for

spatial

techniques

In

Intelligent

CAD

Systems

III

-LCB-

Practical

Experience

and

Evaluation

pages

-LCB-

-LSB-

-RSB-

B.

Benson

and

E.

Freuder

Interchangeability

preprocessing

can

improve

forward

checking

search

In

Proc

ECAI

pages

-LCB-

-LSB-

-RSB-

A.

Dechter

and

R.

Dechter

Removing

redundancies

in

constraint

networks

In

Proc

of

the

AAAI

pages

-LCB-

-LSB-

-RSB-

R.

Dechter

Enhancement

schemes

for

constraint

processing

backjumping

learning

and

cutset

decomposition

Artificial

Intelligence

-LCB-

-LSB-

-RSB-

S.

Donikian

and

G.

Hegron

Towards

a

declarative

method

for

scene

sketch

modeling

Technical

Report

IRISA

Rennes

April

-LSB-

-RSB-

M.

Dincbas

H.

Simonis

and

al.

Solving

a

cutting

-LCB-

stock

problem

in

constraint

logic

programming

In

Proc

of

the

Fifth

Int

Conf

and

Symp.

pages

-LCB-

MIT

Press

August

-LSB-

-RSB-

M.

Dincbas

H.

Simonis

and

al.

Solving

the

car-sequencing

problem

in

constraint

logic

programming

In

Proc

of

the

ECAI

pages

-LCB-

-LSB-

-RSB-

F.

du

Verdier

Solving

layout

problems

using

constraint

satisfaction

PhD

thesis

Claude

Bernard

Lyon

I

University

July

-LRB-

in

french

-RRB-

-LSB-

-RSB-

C.

Eastman

Automated

space

planning

Artificial

Intelligence

-LCB-

-LSB-

-RSB-

U.

Flemming

R.

Coyne

and

al.

A

generative

expert

system

for

the

design

of

building

layouts

Technical

report

EDRC

Carnegie

Mellon

University

-LSB-

-RSB-

J.

Fletcher

A

program

to

solve

the

pentomino

problem

by

the

recursive

use

of

macros

Communications

of

the

ACM

-LRB-

-RRB-

-LCB-

October

-LSB-

-RSB-

E.

Freuder

Eliminating

interchangeable

values

in

constraint

satisfaction

problems

In

Proc

AAAI

pages

-LCB-

-LSB-

-RSB-

J.

Gaschnig

Performance

Measurement

and

Analysis

of

Certain

Search

Algorithms

PhD

thesis

Carnegie

-LCB-

Mellon

University

-LSB-

-RSB-

W.

Howden

The

sofa

problem

The

Computer

Journal

-LRB-

-RRB-

-LCB-

November

-LSB-

-RSB-

ILOG

Av

Galli?eni

Gentilly

Le

Lisp

Version

Users

Reference

Manual

-LSB-

-RSB-

A.

Mackworth

Consistency

in

networks

of

relations

in

artificial

intelligence

Artificial

Intelligence

-LCB-

-LSB-

-RSB-

R.

Maculet

Representation

of

spatial

knowledges

and

spatial

reasoning

based

on

constraints

PhD

thesis

PARIS

December

-LRB-

in

french

-RRB-

-LSB-

-RSB-

C.

Pfefferkorn

A

heuristic

problem

solving

design

system

for

equipment

or

furniture

layouts

Commmunications

of

the

ACM

-LRB-

-RRB-

-LCB-

May

-LSB-

-RSB-

C.

Tong

Toward

an

engineering

science

of

knowledge-based

design

Artificial

Intelligence

in

Engineering

-LRB-

-RRB-

July

-LSB-

-RSB-

D.

L.

Waltz

Generating

semantic

descriptions

from

drawings

of

scenes

with

shadows

In

The

Psychology

of

Computer

Vision

McGraw

Hill

-LSB-

WNY

-RSB-

T.

Watanabe

Y.

Nagai

C.

Yasunobu

Y.

Lizuka

and

K.

Sasaki

An

expert

system

for

computer

room

facility

layout

Proc

of

the

Seventh

International

Conference

-LCB-

Expert

Systems

and

their

applications

O B I O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O B O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O B O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O B O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O B O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O B I O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O O

constraint programming
csp
geometric constraints
partitioning
placement
space planning