• No results found

Arc-Consistency for a Chain of Lexicographic Ordering Constraints

N/A
N/A
Protected

Academic year: 2021

Share "Arc-Consistency for a Chain of Lexicographic Ordering Constraints"

Copied!
14
0
0

Loading.... (view fulltext now)

Full text

(1)Arc-Consistency for a Chain of Lexicographic Ordering Constraints Mats Carlsson and Nicolas Beldiceanu SICS, Lägerhyddsv. 18, SE-752 37 UPPSALA, Sweden {matsc,nicolas}@sics.se October 17, 2002 SICS Technical Report T2002:18 ISRN: SICS-T–2002/18-SE ISSN: 1100-3154. Abstract. We present an arc-consistency algorithm for a chain of lexicographic ordering constraints on vectors of variables each. The algorithm maintains arc-consistency and runs in time per invocation, where is the cost of certain domain operations. Keywords: Constraint Programming, Global Constraints, Lexicographic Ordering, Symmetry..    . . 1 Introduction Given two vectors, and of

(2) variables,   and   , let ! "$#&% denote the lexicographic ordering constraint on and . The constraint holds iff

(3) ('*) or ,+  or  '  and    -."$#&% /01 23 . This constraint is available e.g. in ECLiPSe 5.4 [1], where it is named lexico_le/2. An 4657

(4) 98 filtering algorithm maintaining arc-consistency of the constraint was described in [3]. Similarly, the constraint + "$#&% holds iff  + : or ; ' : and <1 3 + "$#&% / 23 . we consider a chain of "$#=% constraints, >@?0A _InBCDEGFHthis I5 report,  IK J  8ML I NO"$#=%QPPPR."$#&% IK J  . As mentioned in [3], chains of lexicographic ordering constraints are commonly used for breaking symmetries arising in problems modelled with matrices of decision variables. The authors conclude that finding an arc-consistency algorithm for >@?0A _BCDEGF “may be quite challenging”. This report addresses this challenge. >@?0A _BCDEGF , which maintains Our contribution is a filtering algorithm for arc-consistency and runs in 4657

(5) S-T/8 time per invocation, where T is the cost of certain domain operations..

(6) At the heart of the algorithm is a procedure for pruning a vector of variables wrt. fixed, feasible lower and upper bounds. This procedure was derived from a finite automaton operating on a signature of the relation U( V"$#=% W O"$#&% X , a methodology which to our knowledge has not been used before in filtering algorithm construction. The point is that we have to consider globally both the lower and upper bound, lest we may miss some pruning, as illustrated by the following example. Consider the following system of domain and lexicographic ordering constraints:. Y1.Z []\_^a`b1c Y0d]Z H.\_^ ) e1c Y0f]Z [d]\_^ ) e1c YghZ `eVb:iO"$#&%     d  Y0j]Z [l'n k m Y0o]Z     d OO"$#&% Vb  ) ` pq_ pq_ pq_ pq_ pq_ pq_ pq_ pq_ q_ q_ q_ q_ q_ q_ q_ qpqp pqp_q_ pq_ pq_ pq_ pq_ pq_ pq_ pq_ p p p p p p p qpqp 5 q_ pq_ pq_ pq_ pq_ pq_ pq_ pq_ qp_ q_ q_ q_ q_ q_ q_ p p p p p p p qp_ qpqp pqp_4 q_ pq_ pq_ pq_ pq_ pq_ pq_ pq_ q_ q_ q_ q_ q_ q_ q_ p p p p p p p qpqp pp q_ pq_ pq_ pq_ pq_ pq_ pq_ qp_ q_ q_ q_ q_ q_ q_ 3 q_ p p p p p p qp_ qpqp pqp_2 q_ pq_ pq_ pq_ pq_ pq_ pq_ pq_ q_ q_ q_ q_ q_ q_ q_ p p p p p p p qpqp pq_ pq_ pq_ pq_ pq_ pq_ pq_ qp_ q_ q_ q_ q_ q_ q_ q_ p p p p p p p qp_ qpqp pqp_1 q_ pq_ pq_ pq_ pq_ pq_ pq_ pq_ q_ q_ q_ q_ q_ q_ q_ p p p p p p p qp pq_ pq_ pq_ pq_ pq_ pq_ pq_ qp_ p q_ p q_ p q_ p q_ p q_ p q_ p qpqp qp_0 q_. X2. X2. 5 4 3 2 1 0 0. 1. 2. 3. 4. 5. 0. 1. 2. X1 X0=1. rs_ rs_ s_ sr rsr_s_ rs_ r srsr. 3. 4. X2 5 4 3 2 1 0. 5. 0. 1. 2. X1 X0=2. 3. 4. 5 X1. X0=3. Forbidden triples from constraint c4 Forbidden triples from constraint c5 Forbidden triples from constraint c6. Fig. 1. Pruning globally according to lower and upper bounds. Fig. 1 shows the forbidden triples of values according to constraints Y g tYj and Y o . From the figure, we see that / should be restricted to interval ^a`b1c , and that.  and d should be respectively restricted to u) ev and u) `bVwxev . Removing value 2 from Vd is impossible if we consider the three constraints Y g tY0j and 2.

(7) Yo. independently. One can also observe that, unlike the standard lexicographic ordering constraint between two vectors of variables, the pruning according to a fixed lower and upper bound can create holes in the domains. Furthermore it can also take advantage of holes in the domains since the previous pruning would not occur any more if  could take value 2. The rest of the report is organized as follows: We first define some necessary X "$#&% notions and notation. We then give a filtering algorithm for the constraint Uy X X. z O" $ & # % U. U. where and are feasible vectors of integers, i.e. 'W and ' are. both solutions to the constraint. We then show how to compute lexicographically largest and smallest feasible vectors of values, given a vector of variables and upper and lower bound vectors. We then have the necessary building blocks >@?0A _B3C{DEGF . We conclude with some comments on for a filtering algorithm for possible extensions and improvements.. 2 Preliminaries We need the following notation: ^ |t~}c stands for the interval u€ |h  ‚}xv ; ^ |t~} 8 is a shorthand for ^ |t~}„ƒ(`c ; 5 |t~} 8 is a shorthand for ^ |† W`~}„ƒ(`c ; the subvector of with start index | and last index } is denoted by  ‡ ˆ7‰ Š‹ . I I A constraint store 5 tŒ 8 is a set of variables, and for each variable z\ a domain Œ 5 8 , which is a finite set of integers. In the context of a current conA ?0AV _‘D >G’{? 5 HtU 8 straint store: denotes 6EŽF5 Œ 5 88 ; denotes 6D 5 Œ 5 88 ; F ? >G’x? 5 9tU denotes 6EGF[u |“\„Œ 5 8.€ |•”–Uv , if it exists, and ˜— otherwise; and ™š ‘ _‘D A denotes 6D u |›\œŒ 5 86€ | + U{v , if it exists, and ƒ— otherwise. The former two operations run in constant time whereas the latter two have cost T . The domain store is pruned by applying the following operations to a variA ? > X X able :  _EŽF št‘D 5 HtU; 8 removes from Œ 5 8 any value that is not in ^ U c ’ ? ? > X and runs in constant time; and ™š F _EGF š‘D 5 9tU 8 removes from Œ 5 8 any X value that is in ^ U c and has cost T . Each operation succeeds iff Œ 5 8 remains non-empty afterwards. For a constraint ž , a variable mentioned by ž , and a value  , the assignment 'Ÿ has support iff  \ Œ 5 8 and ž has a solution such that '¡ . A constraint ž is arc-consistent iff, for each such variable and value  \¢Œ 5 8 ,. '£ has support. A filtering algorithm maintains arc-consistency of ž iff it removes any value  \„Œ 5 8 such that '‚ does not have support. A string ¤ over some alphabet ¥ is a finite sequence =¤ 1 ¤ ¦ of letters chosen from ¥ . A regular expression § denotes a regular language ¨5©§l8 , i.e. a subset of all the possible strings over ¥ , recursively defined as usual: a single letter U denotes the language with the single string Ux ;  denotes any string over 3. 8.

(8) ¥ ;› § §_ª. denotes ¨5©§l8«¨5©§ ªG8 (concatenation); §¬€§.ª denotes ¨5©§­8¯® ¨5©§°ªŽ8 (union); and §“± denotes ¨5©§l8 ± (closure). Parentheses are used for grouping. X Given two vectors, U and of

(9) integers, and a vector of

(10) variables,  ? ~  “ ³  ? ? X let ² F95U;  H  8 denote the constraint U¢ ´"$#&% _ ."$#&% X . It has the following precondition, which always holds in the algorithms presented herein:. µ |•\_^ ) 

(11) 98 Z2U ˆ \-Œ 5 ˆ 8 ¶ X ˆ \-Œ 5 ˆ 8. (1). Let · be the alphabet u +  ¸+  '  ' ¸  ”  ¸”  ¹ v . The signature of a ?»³¼?? FH5U[  9  X 8 wrt. the current constraint store ½ is a string ¤ constraint žŸLº² over · of length

(12) Ÿ` where ¤  ' ¹ , to mark the end of the string, and for ) œ| +

(13) :. ¾¿¿¿ +  ¿¿¿ ¿ ¸+  À  ¤ ˆ ' ¿¿¿¿ '' ¸  ¿¿¿Á ”  ¸” . if U if U if U if U if U if U. ˆ + Xˆ  ¶ ½Ã€ 'Ä5 ˆ –U ˆ{Å ˆÇÆ X ˆ 8 ˆ + X ˆ ¶Â½ €k'Ä5 ˆ –U ˆ{Å ˆÇÆ X ˆ 8 ˆ ' X ˆ ¶Â½Ã€ ' U ˆ ' ˆ ' X ˆ ˆ ' X ˆ ¶Â½ €k' U ˆ ' ˆ ' X ˆ ˆ ” X ˆ ¶Â½Ã€ ' X ˆ œ ˆ –U ˆ ˆ ” X ˆ ¶Â½ €k' X ˆ œ ˆ –U ˆ X. ˆ From a complexity point of view, we note that the tests ½È€ ' U ˆ ' ˆ ' X ˆ ˆ ˆ Ê. ‚U and ½É€ ' can be implemented with domain bound inspection and X ˆ 8 requires the run in constant time, whereas the test ½!€ '!5 ˆ ËU ˆHÅ ˆÌÆ 0 ? / A  G > { ’ ? ? G > x ’ ? use of F _ ‘D or ™š ‘ _‘D , and has cost T ; see Table 1. Each letter ¤ ˆ is | called the signature letter at pos. of ž wrt. ½ . Table 1. Computing the signature letter at pos.. Î:Ï Ð Ðá â âá å åá. ×Ø _ÙÚÛÝÜ Ö0@ÞÏ&ß Ñ Ï [à Ò Ï ÑÏÓ Ð Ò ÏÔ.ÕÖ«Condition Ñ Ï ÐÓÒ ÏÔ.ÕÖ«×Ø _ÙÚÛÝÜ Ö0@ÞÏ&ß Ñ Ï  ÐÓÒ Ï Þ Ï â Þ Ï â ÑÏ â ÒÏ ÞÏ â ã Ñ Ï â Ò Ïä ÞÏHâ ã Ñ Ï â Ò Ï Ñ Ï åæÒ Ï Ô Ò Ïç Þ Ï ç Þ Ï{ç Ñ Ï Ñ Ï åæÒ Ïԛ@ÞÏ ÐÓÒ Ïä Ñ Ï Ð ÞÏ . 4. Í.

(14) ñ]î ð ;òî ó. 3 Filtering for èOé{êëyééìíïi î ð 3.1. Declarative Semantics. ?»³¼??. X. X. F´5tU  9  8 where U and are feasible vectors Consider a constraint žÄL¡². of integers of size

(15) and is a vector of

(16) variables. It is straightforward to see that the declarative semantics is: ¾¿¿¿. ¿¿

(17) z'‚) À U ' [ '+ ž¡Lõô ¿¿¿¿ U ' [ Á¿ U + [ ' U + [ + and hence, for all |•\ö^ ) 

(18) 98 :. X ö U X  ¶¶öU X  ¶ø X. ‡  ‰ ÷ O"$#=% ‡  ‰ ÷ O"$#=% X ‡  ‰ ÷ ‡  ‰ ÷ O"$#=% ‡  ‰ ÷ ‡  ‰ ÷ O"$#&% X ‡  ‰ ÷. žø¶ 5 UV ' X  8 ¶ P PP   ¶ 5 U ˆ  ' X ˆ  8•ù U ˆ œ ˆ. 3.2. (2.1) (2.2) (2.3) (2.4) (2.5). Xˆ. (2). (3). A Finite Automaton. Fig. 2 shows a deterministic finite automaton BFA for signature strings, from which we will derive the filtering algorithm. State 1 is the initial state. There are three terminal states, F1, T1 and T2, each corresponding to a separate case. State F1 is the failure case, whereas states T1–T2 are success cases.. (/).T2O *+-,. /(.)T1O *+-, Ðá ú. '!"#&GF%$ EDBC.  /1. start. ú â âá Ð. Ð Ðá âá åá. &2GF%$ EDBC /'!"#. â å. å åá. (/).F1 *+-, Fig. 2. Case analysis of. þ û Ö»Ø7ü<Ö«ÖýÕV~Ñ þ ßÞVþ ß Ò . 5. as finite automaton BFA.

(19) 3.3. Case Analysis. We now discuss three regular expressions covering all possible cases of signatures of ž . Where relevant, we also derive pruning rules for maintaining arcconsistency. Each regular expression corresponds to one of the terminal states of BFA. Note that, without loss of generality, each regular expression has a common prefix ÿ(' 5 ' € ' ¸ 8 ± . For ž to hold, clearly for each pos. | in the correX sponding prefix of , by (2.2) the filtering algorithm must enforce U ˆ ' ˆ ' ˆ . In the regular expressions,  and  denote the position of the transition out of state 1 and 2 respectively. We now discuss the cases one by one. Case F1.. 5 ' . We have that U false.. € ' ¸ 8 ±   5 ” € ¸” 8  .  .  ' X  ¶ P PP ¶ U   ' X  ¶ U ” X , and so by (3), ž. Case T1. . 5 '. (F1). € ' ¸ 8 ±   5 ¸+  € ¹ 8  .  . must be. (T1). X   ' X  ¶Ó5  'º

(20) Å U + X 8 . If  'º

(21) , we are We have that U  '  ¶ P PP ¶ U  X k

(22) . Thus done by (2.1) and (2.2). If  +

(23) , we also have that 5 U  8 Œ 5 8 ' X . by (2.5), all we have to do after ÿ for ž to hold is to enforce U œ Case T2. . 5 '. € ' ¸ 8 ±  +  5 ” € ' 8 ±  5 + € ¸+ € ' ¸ € ¸” € ¹ 8  .  . (T2). . We have that:. ¾¿¿¿ U  X  PPP U  X  ¶ ' ¿ U '+ X ¶. À  ¿¿¿ 5 U  X 8 Œ 5 8•'

(24) ¿Á U   Æ X   ¶ PPP ¶ U   Æ X   µ |•\ 5 V 28 Z X ˆ œ ˆ ˆ –U ˆ X and 5 U  X 8 Œ 5 8˜'

(25) hold. Since by (3) Consider pos.  , where U + X X U n should also hold, must be either U or , and we know from X (1) that both ' U and ' have support. We will now show by induction that there are exactly two possible values X for the subvector ‡  ‰  ÷ : U ‡  ‰  ÷ and ‡  ‰  ÷ . 6.

(26) X. Base step. We have already established that ' U Å ' holds, and for X the prefix ÿ we have that U ‡  ‰ ÷ ' ‡  ‰ ÷ ' ‡  ‰ ÷ . X Induction step. Now consider pos. | where  + | +  . Recall that ˆ œ ˆ –U ˆ X must hold. If ¤ ˆ ' ' , then U ˆ ' ˆ ' ˆ , and we are done. If ¤ ˆ ' ” and. ˆ  ' U ˆ  , then ˆ + U ˆ would contradict (2.3). If ¤ ˆ ' ” and ˆ  ' X ˆ  , then X ˆ ”R ˆ would contradict (2.4). Thus, ˆ ' U ˆ iff ˆ  ' U ˆ  , X X and ˆ ' ˆ iff ˆ  ' ˆ  . Thus for ž to hold, after ÿ we have to enforce. From (2.3) and (2.4), we now have that ž holds iff. ˆ \ u U ˆXˆv. for 6ø|. +.  .. ‡  ‰  ÷ ' U ‡  ‰  ÷ ö ¶ U ‡  ‰ ÷ O"$#&% X ‡  ‰ ÷ X ô ‡  ‰  ÷ W ' ‡  ‰  ÷ ¶ø ‡  ‰ ÷ O"$#&% ‡  ‰ ÷. i.e.. ¾¿¿¿. ¿¿¿ Ì'º

(27) æ¶ø ‡  ‰  ÷ ¿ Ì'º

(28) æ¶ø ‡  ‰  ÷ À ” ¶ø ‡  ‰  ÷ ô ¿¿¿¿  ”

(29) æ. 9‡  ‰ ÷ ¿¿¿Á ”

(30) æ¶ø 9 ‡  ‰  ÷ 

(31) æ¶ø  ” 

(32) æ¶ø ‡  ‰  ÷. 'WUX ‡  ‰  ÷ ' ‡ ‰ ÷ 'WU ‡  ‰  ÷ 'WUX ‡  ‰  ÷ ' X ‡  ‰  ÷ ' ‡ ‰ ÷. ” U ¶  –. ¶  ' XU  ö ¶ U   ‰ ÷ O"$#=%    ‰ ÷ ¶  + X ¶  '  ¶ø   ‰ ÷ O"$#=% X   ‰ ÷. (4.1) (4.2) (4.3) (4.4) (4.5) (4.6). (4). Finally, consider the possible cases for pos.  , which are:. ¹ . We are done by (4.1) and (4.2). X U  +  , signature letters + and ¸+ . Then from (1) we know that we have solutions corresponding to both (4.3) and (4.5). Thus, all values for ‡  ‰ ÷ have support, and we are done. U  Æ X  , signature letters ¸” and ' ¸ . Then from (1) and from the signature. – Ì'º

(33) , signature letter –. –. letter, we know that we have solutions corresponding to both (4.4), (4.6), and one or both of (4.3) and (4.5). Thus, all values  for  such that  X  Å  Æ U  , and all values for   ‰ ÷ , have support. Hence, we must enforce.  \ k 5 X  tU  8 . 3.4. A Filtering Algorithm. By augmenting BFA with the pruning actions mentioned in Sect. 3.3, we arrive ’ ?0A (Alg. 1) for ² ?~³“?? F95U;  9  X 8 . When a conat a filtering algorithm  F!!" _# straint is posted, the algorithm will delay or fail, depending on where BFA stops. ’ ?0A in the following proposition. We summarize the properties of  F!!" _# 7.

(34) Proposition 1. 1.    2.      3. . ’ F!!" _# 0? A ’ F!!" _# 0? A ’ F!!" _# 0? A. doesn’t remove any solutions. removes all domain values that cannot be part of any solution. runs in 4Ó57

(35) TV8 time.. Proof. 1. BFA has one failure case, F1. In Sect. 3.3, we showed that the corresponding instances have no solutions. Furthermore, no pruning action removes any value that has support. 2. BFA has two success cases, T1–T2. We have showed that all corresponding ground instances are solutions, provided that: X ˆ for ) œ|“$ . – We enforce U ˆ œ ˆ X – In state T2, we enforce (i) ˆ \ u U ˆ  ˆ v for  + | +  , and (ii)  \ k 5 X  tU  8 . 3. At most

(36)  ` signature letters are examined, and each decision and pruning %& action costs at most T .. 4 Computing Feasible Upper and Lower Bounds In this section, we show how to compute tight, i.e. lexicographically largest and smallest, and feasible vectors of values, given a vector of variables, an upper bound vector, and a lower bound vector, where the bound vectors are not necessarily feasible. The computed vectors are called feasible upper and lower ’ ?0A , where bounds. The feasibility is equivalent to precondition (1) of  F!" _ # these vectors will be used. 4.1. Upper Bounds. We address the following problem: given a vector of variables and a vector X of integers, we want to compute the lexicographically largest vector ' such that:. O"$#&% X ¶ µ |•\_^ ) 

(37) 98 Z(' ˆ \¢Œ 5 ˆ 8 (5) x ’   +* ? X 9.   ' h5 8 , has two steps. The key point is to The algorithm, ):K™ X | compute , as the smallest such that ' ‡  ‰ ˆ¦‹ ' ‡  ‰ ˆ¦‹ is not a prefix of the computed '. upper bound. 1. Compute , as the smallest |. Æ ƒ˜`. such that one of the following holds: 8.

(38) Õ Ö«×:~Ñ þ ßÞVþ ß Òþ   @ß  ß  Ü  Ñ Ï @ÞÏ  Ô Ò Ï @ ÞÏ  þ û Ö«Ø ü<ÖýÖýÕ~Ñ þ ßÞþ ß Ò  ß  Ï  ß  @Þ Í  Ô ÑÏ â ÒÏ Õ Ø=Ö ÙÚÛ @Þ Ï ß Ñ Ï ß Ò Ï  â. 1032 /5 7698;:=< ?>@A<78CB PROCEDURE -/. _4 /5 Require: D EGF H EJI EJI 698;:K< Ensure: If , then has no solution. >@A<78;B Ensure: If , then for each ELF H and value M ENI /5 M9QRESI Q . that D3OEPF H 1: UTVH 2: while do ZY 6A8;:=< 3: if W _X then 698;:=< 4: return 5: end if 6: \T ^]`_ 7: end while ZY 698C:=< then 8: if 69W 8;:=< _X 9: return 10: end if 11: if then >@A<78CB _ 12: return 13: end if 14: bT ^]`_ 15: while do Y AY e d 698;:=< _X then 16: if c ` ] _ _ 698C:=< 17: return 18: end if bT (]h_ 19: 20: end while Y AY (d 6A8;:=< 21: if _X then ]i_ _ 69c 8C:=< 22: return 23: else >@A<78CB 24: return 25: end if. Í. Í. Ð ×Í. @Þ Ï . there is a solution. Þ þ â Mþ. such. // enter state 1 // prune inside [. Í ŸÍ Í Ð  Ô × ÕØ=Ö ÙÚÛ @Þ Ï ß Ñ Ï ß Ò Ï  â. // prune pos. a. Í â  äiÕÖ«×Ø Ù3Ú3Û Ü Ö0@Þ Ï ß Ñ Ï  ÐÓÒ Ï. Í ¡Í Ð ÔiÞ Ï â Ò Ï Ô Þ Ï â Ñ Ï Í ÕÖ  Õ Ø=Ö @ÞÏ©ß Ò Ï ß Ñ Ï Ü Ù3Ú3Û Í ŸÍ Í Ð  Ô. Ü Õ1Ö ÕØ=Ö Ù3Ú3Û @ÞÏ©ß Ò Ï. â. ßÑ Ï. // enter state 2.  â. Algorithm 1: Filtering algorithm for ². 9.  gß f . // prune inside a. ?~³“?? F95[U  9  X 8. // prune pos.. f.

(39) X. X. k Œ 5 ˆ 8¶ ˆ ”œ ˆ (a) | Æ )¶ ˆ \¢ X (b)  ˆ7‰ ÷ + "$#&%  ˆ7‰ ÷ The intuition behind the two cases is: X k Œ 5 ˆ8. (a) ˆ + ˆ \X X Xkj  ' j  ¶ X;j + j . (b) We have that ˆ ”œ ˆ ¶ ˆ   ' ˆ   ¶ PPP ¶ In both cases, a smaller value for ' ˆ must be chosen from Œ 5 ˆ 8 . If no such | exists, let ,Ê'Ë

(40) . If ,‚' ƒ˜` , the algorithm fails, meaning that Ê <"$#&% X can’t hold. 2. ' ˆ is computed as follows for ) œ| +

(41) :. ¾ Xˆ | + if , À ? G > x ’ Á ' ˆ ' ™š ‘ _‘D ? 5 ˆ  X ˆ 8  if | ',. ˆ  if |¼” , ’x+? *  in the following lemma. We summarize the properties of ):6™ ’x+? *  implements the specification (5) and runs in 4Ó57

(42) T/8 Lemma 1. ):K™ time.. X. µ. Proof. It should be clear from the above that 'Ÿ <"$#&% and that |6\Ä^ ) 

(43) 98 Z ' ˆ \nŒ ˆ 5 8 . It remains to be shown that there does not exist any  such that ' + "$#&%.  O"$#=% X andX µ |•\_^ ) 

(44) 98 Z  ˆ \„Œ 5 ˆ 8 . If , 'Ê

(45) , ' ' , so we are done. Otherwise, construct the lexicographically smallest  such that ' + "$#&%  as follows. Let l be the least significant position | such that ' ˆ + ˆ . If no such l exists, we are done. Otherwise, compute  ˆ as follows for ) –| +

(46) :. ¾ ' ˆ | + l if À  ˆ ' Á F ?0VA  _‘D >G’x? 5 ˆ ' ˆ 8 . ˆ  if |•” l. By construction, l. if | m ' l. , . Consider the two cases:. X. X. ?0AV. >Ž’x?. X. ‡  ‰ n ÷ and n +  n 'ŸF _‘D 5 n  n 8 . Case l + , : We have that  ‡  ‰ n ÷ ' X Hence, + "$#=%  , a contradiction, so we are done. X ‡  ‰ n ÷ and  n '‚F ?0A/ _‘D >G’{? 5 n  ™{š ? ‘ _‘D >Ž’x? Case l ', : We have that  ‡  ‰ n ÷ ' X k Œ 5 n 8 . Then X n +  n . Assume instead that X n \-Œ 5 n 8 . Assume that n \X X Then n '£ n , but then we also have that on2‰ ÷ + "$#&%  pn‰ ÷ ' on2‰ ÷ . In X both cases, + "$#&%  , a contradiction, so we are done. Given , , ' is computed in 4657

(47). TV8. %& time. Alg. 2 computes , in 4657

(48) 98 time.. 10. 5 n  X n 8 8 ..

(49) 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:. ÍUTVH d. Ð Ô ÒÏ Ò ÏÍ å Þ Ï ŸÍ Í ŸÍ Í â  ä ÒÏ å Þ Ï õÍ. @ÞÏ . qrT _ while EsI if then qNT end if \T ^]`_ end while if then qNT end if. 4.2. do. Algorithm 2: Computing , for ):K™. ’x?+* . Lower Bounds. We address the following problem: given a vector of variables and a vector U of integers, we want to compute the lexicographically smallest vector t such that:. U O"$#&% t ¶ µ |•\_^ ) 

(50) 98 Z t ˆ \-Œ 5 ˆ 8 y (6) x ’   ? X t ´.  . The algorithm, ):6™ #u]5 8 , has two steps. The key point is to comt pute , as the smallest | such that ‡  ‰ ˆ ‹ 'MU ‡  ‰ ˆ¦‹ is not a prefix of the computed lower bound.. 1. Compute , as the smallest | Æ ƒ˜` such that one of the following holds: k Œ 5 ˆ 8¶ U ˆ + ˆ (a) | Æ )¶ U ˆ \+ . ¦  7 ˆ ‰ $ " & # % U  ˆ7‰ ÷   ÷ (b) The intuition behind the two cases is: k Œ 5 ˆ8. (a) ˆ ”–U ˆ \j j j j (b) We have that U ˆ + ˆ ¶ U ˆ   ' t ˆ   ¶ PPP ¶ U  '  ¶ U ” . ˆ ˆ Œ. In both cases, a larger value for must be chosen from 5 8 . If no such | exists, let ,º'W

(51) . If ,Ê' ƒ˜` , the algorithm fails, meaning that U_ ["$#=% can’t hold. tˆ 2. is computed as follows for ) œ| +

(52) :. ¾ U ˆ | + if , À tˆ ? 0 / A  Ž > x ’ Á ' F _‘D ? 5 ˆ t U ˆ 8  if | ',. ˆ  if |•” , ’x? #u in the following lemma. We summarize the properties of ):6™ ’x? #v implements the specification (6) and runs in 4Ó57

(53) TV8 Lemma 2. ):K™ time. %&. Proof. Analogous to the proof of Lemma 1. 11.

(54) Strict Versions of wrx/y{z}|u~3€i‚. 4.3. and wrxƒy„z}|~3b ‚. Suppose that we want to replace the H"$#&% constraint in (5,6) by + "$#&% . To achieve that, all we have to to is to modify the definition of , , replacing x"$#&% by + "$#&% . X In Alg. 2, the condition on line 8 is changed to | +

(55) æ¶ ˆ ”œ ˆ .. 5 A Filtering Algorithm for †=éU‡ _ ˆe‰RŠ‹~ì We now have the necessary building blocks for constructing a filtering algo>@?0A _BC{DEGF ; see Alg. 3. The idea is as follows. For each vector IL Œ in rithm for the chain, we first compute a tight and feasible upper bound by starting from IK J  . We then compute a tight and feasible lower bound for each vector by I starting from  . Finally for each vector, we restrict the domains of its variables according to the bounds that were computed in the previous steps.. Ö«×. þ þ Ú Õ/ ß ýß.   Gß. . ‘ 9’9’A’ ‘“u”b• /5 7698;:K< >@A<78;B PROCEDURE 4 _ /Ž ;X ‘– 1: // is variable vector — ˜^™š– 2: // is the upper bound vector — › ™ – \ 3: // is the lower bound vector — ˜^™š“v”• J“v”• 4: T dLœ 5: for —T 0 do 9Ÿ downto 698;:K< – ˜^™}–=  • ˜(™– then 6: if /.;žc 698;:=< 7: return 8: end if 9: end for ›\™    T 10: d 11: for —!T¡_ to _ do 698;:K< ‘– ›\™– ”• ›\™– 12: if /.kžc  4 then 698C:=< 13: return 14: end if 15: end for d 16: for —!T¢H to _ do 1032 698;:=< ›\™– – ˜^™– 17: if -/. _4 then 698C:=< 18: return 19: end if 20: end for >@A<78;B 21: return. þ. Ü Ø=Ö.  þ ß þ. ß þ â. 1Ü Ø=Ö.  þ ß þ. ß þ â. þ. þ. þ. þ. Ü Õ. Ö«×2 þ ß þ ß þ  â. Algorithm 3: Filtering algorithm for a chain of We summarize the properties of #. ?0A _ )C{DEGF. Proposition 2. 1. #. ?0A _ )C{DEGF. maintains arc-consistency. 12. "$#&%. constraints. in the following proposition..

(56) 2. If there is no variable aliasing, # 3. If there is no variable aliasing, #. ?0A _ )C{DEGF ?0A _ )O{C DEGF. reaches a fixpoint after one run. runs in 4657

(57) S-TV8 time.. Proof.. ’x?+*. ’{?. 1. We have already shown that ):K™ and ):K™ #u are correct and ’ ?0A removes exactly those values that  F!" _# that do not have support. ’x?+*  and ):K™ ’x? #u are Furthermore, the vectors computed by ):6™ ’ ?0A . LŒ I vectors of values that can take, which is required by  F!" _# ?0A _ )C{DEGF computes tight lower and upper It remains to be shown that # bounds for each vector £ . We will reason over the feasible vectors of values K 'à 7      i.e. µ |•\_^ ) 

(58) 98 Z  ˆ \-Œ 5 I Œ ‰ ˆ 8 . ?0A _ )C{DEGF computes ¤u ¥¦Œ Consider the lower bounds for £ ” ) . For £ ” ) , # ¤u¥¦Œ ÂO"$#=%  . Any ' + "$#&% ¤u ¥¦Œ as the smallest such feasible  such that u ¤ ¦ ¥ Œ + "$#&% ' would remove would admit a non-solution (namely ' ), and any ¤u¥ Œ ¤v¥ Œ is correct. An analogous argument holds a solution (namely ), so for the upper bounds for £ + S ƒ–` . ¥ Œ ‰j ¤v¥ Œ ‰ j 2. From Proposition 1 (item 1), we have that § and remain in j I Œ Œ 5 ‰ 8 for all variables on exit, and by assumption there is no communica?0A _ )OC{DEGF tion caused by aliasing among the variables. Assume that we run # { ’   +* ? L I Œ  § ¥JŒ   § ¥ ª Œ a second time. Then by inspection, we see that ):K™ ˜5 ¥ Œ ¥ Œ + S ƒ˜` , and similarly for ):6™ ’x? #u . will compute § for ) ' § £ ª ?0A _ )C{DEŽF did reach a fixpoint after the first run. Hence, # ?0A _ )C{DEGF calls ):K™ ’x?+*  and ):6™ ’x? #u¢S ƒ 3. By the previous item, # ` times each and  ’ F!!" _# ?0A S times. From this fact, Proposition 1, and ?0A _ )C{DEGF runs in 4Ó57

(59) S-TV8 time. Lemmas 1 and 2, we conclude that # %&. 6 Extensions Strict version. A filtering algorithm for a chain of + "$#&% constraints can be de’x?+*  and )‘:K™ ’x? #v that were rived easily by making the changes to ):K™ mentioned in Section 4.3. The other algorithms remain unchanged.. >@?0A. I. IKJ. I. IKJ. Entailment. _BCDEGFH5 1  8OL lO"$#&%6PPP."$#&%  is entailed I I ˆ ˆ ." $ & # % .  is entailed for all ) –| + S ƒö` . Our filtering algorithm does iff not detect entailment. In [2], we report an 4657

(60) 98 filtering algorithm for /"$#&% , which does detect entailment. So one could use the entailment detection part of >@?0A _B3C{DEGF in 4Ó57

(61) Sz8 time. the algorithm in [2] for detecting entailment of 13. 8.

(62) I. I. I. Decomposition. If ˆ  ."$#&% ˆ ."$#&% ˆ   is entailed for some | , we can I ignore ˆ on future resumptions of the filtering algorithm. I I I I If ˆ KO"$#&% ˆ and ˆ  l."$#&% ˆ  d are entailed for some | , we can use 0 ? A I I the algorithm in [2] instead of # _ )C{DEŽF for solving ˆ O"$#&% ˆ   . Handling a DAG of lexicographic ordering constraints. It should be straightfor>@?0A _BC{DEGF to handling a directed acyclic graph of lexicographic ward to extend ordering constraints over vectors of size

(63) . The only change consists in computing a tight lower bound for each vector by considering the vectors in topological sort order, and by maintaining the greatest lower bound obtained from each predecessor of a vector. A similar change needs to be done for the upper bounds.. Acknowledgements We are thankful to Justin Pearson for helpful discussions on this work.. References 1. Pascal Brisset, Hani El Sakkout, Thom Frühwirth, Carmen Gervet, Warwick Harvey, Micha Meier, Stefano Novello, Thierry Le Provost, Joachim Schimpf, Kish Shen, and Mark Wallace. ECLiPSe Constraint Library Manual. IC-PARC, release 5.4 edition, July 2002. 2. Mats Carlsson and Nicolas Beldiceanu. Revisiting the Lexicographic Ordering Constraint. Technical Report T2002-17, Swedish Institute of Computer Science, 2002. 3. Alan Frisch, Brahim Hnich, Zeynep Kızıltan, Ian Miguel, and Toby Walsh. Global Constraints for Lexicographic Orderings. In Pascal Van Hentenryck, editor, Proc. CP’2002, Int. Conf. on Principles and Practice of Constraint Programming, volume 2470 of LNCS, pages 93–108. Springer-Verlag, 2002.. 14.

(64)

References

Related documents

And if SBEC represent the kind of school that Gambian parents want to put their children in has it then become a question of class distinctions whether or not your child will get

The Matrix is about the most extreme fear the humans have towards their creation: In this movie, Artificial Intelligence attacked the humans, and started growing human bodies as

Margareta Gynning Curator 15 May – 31 August 2014.. 4 Art Bulletin of Nationalmuseum Volume 21, 2014..

Re-examination of the actual 2 ♀♀ (ZML) revealed that they are Andrena labialis (det.. Andrena jacobi Perkins: Paxton &amp; al. -Species synonymy- Schwarz &amp; al. scotica while

Utseendemässigt hade Hannah haft en del i ett mer accepterande synsätt där flera av respondenterna sade sig ha inspirerats till en bättre kroppssyn, att bry sig mindre om sitt

The aim of this thesis is to explore and elaborate how the practice of key account management (KAM) is colored by cultural conflicts, dilemmas and more

The aim of this research paper is to investigate how Aboriginal social workers apply the knowledge they’ve gained as part of their formal social work education to working

Questions stated are how migrants organize their trajectory and with the help of which actors, how migrants experience corruption during their trajectory and what this might