Reformulating global constraints: the Slide and Regular constraints

Size: px
Start display at page:

Download "Reformulating global constraints: the Slide and Regular constraints"

Transcription

1 Reformulting glol constrints: the Slide nd Regulr constrints Christin Bessiere 1, Emmnuel Herrd 2, Brhim Hnich 3, Zeynep Kiziltn 4, Clude-Guy Quimper 5, nd Toy Wlsh 6 1 LIRMM, University of Montpellier, Frnce. essiere@lirmm.fr 2 Emmnuel Herrd, 4C, University College Cork, Irelnd. eherrd@4c.ucc.ie 3 Brhim Hnich, Fculty of Computer Science, Izmir University of Economics, Turkey. rhim.hnich@ieu.edu.tr 4 Zeynep Kiziltn, Deprtment of Computer Science, University of Bologn, Itly. zeynep@cs.unio.it 5 Clude-Guy Quimper, Omeg Optimistion, Cnd. quimper@lumni.uwterloo.c 6 Toy Wlsh NICTA nd University of New South Wles, Sydney, Austrli. tw@cse.unsw.edu.u Astrct. Glol constrints re useful for modelling nd resoning out rel-world comintoril prolems. Unfortuntely, developing propgtion lgorithms to reson out glol constrints efficiently nd effectively is usully difficult nd complex process. In this pper, we show tht reformultion my e helpful in uilding such propgtors. We consider oth hrd nd soft forms of two powerful glol constrints, Slide nd Regulr. These glol constrints re useful to represent wide rnge of prolems like rostering nd scheduling where we hve sequence of decision vriles nd some constrint tht holds long the sequence. We show tht the different forms of Slide nd Regulr cn ll e reformulted s ech other. We lso show tht reformultion is n effective method to incorporte such glol constrints within n existing constrint toolkit. Finlly, this study provides insight into the close reltionship etween these two importnt glol constrints. 1 Introduction Glol constrints re one of the most importnt fetures of constrint progrmming. Glol constrints cpture common ptterns occurring in models of complex, rel-life comintoril prolems. For instnce, common pttern in rostering prolems is tht sequences of night shifts must e followed y severl dys off, nd tht no one is llowed to work more thn certin numer of consecutive night shifts. Such ptterns cn e modelled using Regulr constrint [6]. More recently, we hve proposed the glol Slide to model wide rnge of ptterns ppering in sequencing nd other prolems [3]. In this pper, we explore the reltionship etween these two glol constrints in depth. We show tht the Slide constrint cn e efficiently reformulted s the Regulr constrint nd vice vers.

2 In mny rel-world prolems, it is not possile to find fesile solution tht stisfies ll the constrints nd preferences of the user. Consider the prolem of llocting reviewers for ppers sumitted to conference. Typiclly, pper must e reviewed y certin numer of reviewers nd ech reviewer must hve certin numer of ppers. Reviewers lso indicte preferences over the ppers tht they would e hppy to review. Finding n lloction tht stisfies the ssignment constrints s well s ll the reviewer preferences my not e possile. We my however give n dditionl pper to some reviewers nd my ssign pper to reviewer even if she is not enthusistic out it, s long s she did not indicte conflict of interest. Soft versions of glol constrints re useful to model nd solve such over-constrined prolems. A recent direction is to convert over-constrined prolems into constrint optimiztion prolems y treting constrint violtions s costs. To reson out such prolems, we cn design specific cost-sed propgtors. Severl such soft glol constrints hve een proposed to model nd solve over-constrined prolems effectively nd efficiently (e.g., [7, 9, 10, 12]). Whilst efficient propgtors hve een developed for oth the Slide nd Regulr constrint nd re ville in numer of solvers, there hs een less work out soft versions of these constrints. For exmple, no GAC propgtors hve yet een developed for soft versions of the Slide constrint. One of our contriutions in this pper is to propose the first such propgtors. We show tht reformultion is n ttrctive mechnism lso to implement soft versions of the Slide nd Regulr glol constrints. This rest of this pper is structured s follows. After giving the necessry forml ckground in Section 2, we explin in detil in Section 3 the Slide nd Regulr constrints. Then we show in Section 4 how Slide cn e efficiently reformulted s the Regulr constrint nd vice vers. In Section 5, we focus on the soft versions of these glol constrints nd in Section 6 demonstrte tht the different types of SoftSlide constrints cn e reformulted s hrd forms of the Slide or soft form of the Regulr constrints. We provide experimentl proof in Section 7 tht reformulting glol constrints could e useful. We report relted work in Section 8 nd conclude in Section 9. 2 Forml Bckground A constrint stisfction prolem consists of set of vriles, ech with finite domin of vlues, nd set of constrints specifying llowed comintions of vlues for some suset of vriles. We consider finite domin integer vriles, nd use cpitl letters for vriles (e.g. X) nd lower cse for vlues (e.g. d). We write D(X) for the domin of vrile X. A constrint C defined on vriles [X i,..., X j ] is indicted s C(X i,..., X j ). Constrint solvers typiclly explore prtil ssignments enforcing locl consistency property using either specilised or generl purpose lgorithms. A constrint C is generlised rc consistent (GAC ) iff when vrile is ssigned ny of the vlues in its domin, there exist comptile vlues in the domins of ll the

3 other vriles of C. For inry constrints, generlised rc consistency is often clled simply rc consistency (AC). A constrint C is ound consistent (BC ) iff when vrile is ssigned the mximum (or minimum) vlue in its domin, there exist comptile vlues etween the mximum nd minimum domin vlue for ll the other vriles of C. A deterministic finite utomton (DFA) is descried y 5-tuple A = Q, Q F, q 0, δ, Σ where Σ is n lphet, Q is set of sttes, q 0 Q is the initil stte, Q F Q is set of finl sttes, nd δ Q Σ Q is trnsition tle. A sequence s 1,..., s n is ccepted y the utomton A if there exists sequence of sttes t 0,..., t n such tht t 0 = q 0 is the initil stte, t n Q F is finl stte, nd t i 1, s i, t i δ is trnsition in the trnsition tle. A lnguge L Σ is (possily infinite) set of sequences tken from n lphet Σ. A regulr lnguge is the set of sequences ccepted y DFA. The Hmming distnce etween two strings s 1 nd s 2 of the sme length is the numer of positions in which they differ. The Hmming distnce is denoted y H(s 1, s 2 ). For exmple, the Hmming distnce etween the strings c nd dc is 1 s they differ only on the second position. The Hmming distnce etween string s nd lnguge L is min{h(s, t) t L}. If L does not contin ny string of the sme length s s, the distnce etween s nd L is undefined. The edit distnce etween two strings s 1 nd s 2 is the minimum numer of chrcter insertions, deletions, nd replcements to string s 1 in order to otin s 2. The edit distnce is denoted y E(s 1, s 2 ). For exmple, the edit distnce etween the strings c nd dc is 2 s we cn replce the chrcter of the string c y nd insert d efore c to otin dc. The edit distnce etween string s nd lnguge L is min{e(s, t) t L}. If L is empty, the distnce etween s nd L is undefined. 3 Slide nd Regulr constrints The glol Regulr constrint ws introduced y Pesnt to model prolems in scheduling nd rostering [6]. The constrint is specified in terms of finite utomton which ccepts the string of vlues spelled out y the sequence of vriles. More precisely, Regulr(A, [X 1,..., X n ]) holds iff X 1 to X n form string ccepted y the DFA A. Such glol constrint cn e used to ensure certin ptterns do (or do not) occur over time. For exmple, in shift rostering, we might hve tht we cnnot work more thn three night shifts in row nd once sequence of night shifts ends, we must hve t lest two dys off. This cn esily e specified using finite utomton. We hve finite utomton A with the sttes n 1, n 2, n 3, o 1 nd ny. The trnsition tle is: ny, dy, ny, ny, night, n 1, ny, off, ny, n i, night, n i+1, n i, off, o 1, nd o 1, off, ny. For instnce, if we re in stte ny, we go to stte n 1 with input night. Pesnt gives propgtor for the Regulr constrint sed on dynmic progrmming which chieves GAC in O(nd Q ) time where Q is the numer of sttes of the utomton [6]. More recently, we introduced the glol Slide constrint [3]. We egin with its simplest form. If C is constrint of rity k then Slide(C, [X 1,..., X n ]) holds

4 iff C(X i,..., X i+k 1 ) itself holds for 1 i n k + 1. Tht is, we slide the constrint C down the sequence of vriles, X 1 to X n. For exmple, consider the cr sequencing prolem (pro001 in CSPLi) where we need to decide the order in which to uild crs on n ssemly line. We might wnt to ensure tht no more thn one out of every two crs hs the sun roof option s it tkes extr time to fit sun roof. This cn esily e specified with Slide constrint. We slide inry constrint down sequence of decision vriles representing the order in which crs will e produced. This inry constrint ensures tht one of or oth of the vriles within its scope does not represent cr with the sun roof option. A vrition of the dul encoding cn e used to mintin GAC on such Slide constrint in O(nkd k ) time [3]. A more complex form of the Slide constrint permits us to slide down two or more sequences of vriles t the sme time. For instnce, if C is constrint of rity 2k then Slide(C, [X 1,..., X n ], [Y 1,..., Y n ]) holds iff C(X i,..., X i+k 1, Y i,..., Y i+k 1, ) itself holds for 1 i n k + 1. Tht is, we slide the constrint C down the two sequences of vriles. Consider, for exmple, the glol contiguity constrint [5]. This ensures tht within sequence of 0/1 vriles, X 1 to X n, the 1 s occur in continuous lock. We cn model this y Slide constrint down two sequences of 0/1 vriles, X 1 to X n nd Y 1 to Y n. The second sequence of vriles, Y 1 to Y n record if we hve met the lock of 1 s yet or not. The constrint eing slid, C(X i, X i+1, Y i, Y i+1 ) holds iff (Y i = 0, X i = 0, X i+1 = Y i+1 ) or (Y i = Y i+1 = 1 nd X i X i+1 ). Such more complex forms of Slide cn e reformulted s the simple form of Slide down single sequence. We merely need to interleve the different sequences nd then slide suitly modified constrint over these interleved sequences. (See [3] for detils.) 4 Reformulting Slide nd Regulr We first show tht Slide nd Regulr cn e reformulted s ech other. As well s providing insight into the reltionship etween the two glol constrints, these reformultions will e useful in providing propgtors for soft versions of these glol constrints. 4.1 Regulr s Slide In [8], we give simple reformultion of the Regulr constrint in terms of Slide constrint. In ddition to the sequence of vriles long which the Regulr constrint is defined, we introduce sequence of vriles for the stte of the utomton. We then slide the trnsition reltion down the two sequences of vriles. For instnce, consider gin the shift rostering prolem from the lst section. We cn reformulte Regulr(A, [X 1,..., X n ]) s Slide(C, [X 1,..., X n+1 ], [Q 1,..., Q n ]) where X n+1 is dummy vrile, Q i re vriles representing the stte of the utomton, nd C(X i, X i+1, Q i, Q i+1 ) holds iff we move from stte Q i to Q i+1 on seeing X i. Oserve tht X i+1 is not used in the definition of C. We let it in its scope just to e consistent with

5 the simplified presenttion of Slide on multiple sequences tht we presented in Section 3. Enforcing GAC on this reformultion chieves GAC on the originl Regulr constrint. Hence, reformultion does not hinder propgtion. This reformultion is lso optiml in the sense tht, we cn enforce GAC on either the Regulr constrint or its reformultion into Slide in O(nd Q ) time. This complexity is lower thn the complexity of Slide in generl ecuse of the chrcteristics of the constrint eing slid (see [3] for detils). As we show in the experimentl section, this reformultion is lso prcticl mens to propgte the Regulr constrint. By reformulting Regulr s Slide constrint, we get n efficient nd incrementl propgtor tht cn outperform Pesnt s propgtor for Regulr sed on dynmic progrmming. 4.2 Slide s Regulr The reverse is lso possile. Tht is, we cn reformulte ny instnce of the Slide constrint using Regulr constrint. Agin this is optiml in the sense tht we cn enforce GAC on either the Slide constrint or the reformultion into Regulr in O(nkd k ) time. We prove this clim y constructing DFA A recognizing the lnguge ccepted y Slide constrint. Let Σ = n i=1 D(X i) e the lphet nd k e the rity of the constrint C. The sttes of A re given y the set of sequences Q = k 1 i=0 Σi. The empty sequence ɛ Q is the initil stte. Any sequence of length k 1 is finl stte. Let T = {[s 1,..., s k ] C([s 1,..., s k ])} e the set of sequences ccepted y the constrint C. We construct the trnsition tle δ of A s follows. Let w e sequence of length strictly smller thn k 1 nd c Σ e chrcter from the lphet. Let wc e the conctention of the sequence w nd the chrcter c. We hve trnsition w, c, wc δ if there exists sequence in T strting with wc. Let, Σ e two chrcters nd w Σ k 2 e sequence of length k 2 such tht w is sequence in T. Then we hve the trnsition w,, w δ. Notice tht stte w cn only e visited fter prsing the su-sequence w. Exmple 1. Consider the lphet Σ = {, } nd the constrint C tht ccepts ny sequence of length three ut the sequences nd. We otin the DFA depicted in Figure 1. The DFA A constructed in this wy represents the Slide constrint. Theorem 1. If n is greter thn or equl to the rity of C, then the lnguge {X 1... X n Slide(C, [X 1,..., X n ])} formed y the sequences stisfying the Slide constrint is equl to the set of sequences of length n recognized y the DFA A. Proof. We first prove tht every sequence s of length n ccepted y A is lso ccepted y the Slide constrint. Let w e the first k 1 chrcters in s. By construction of A fter reding these k 1 chrcters, the current stte is w nd there exists sequence in T strting with w. Assume tht the k 1 chrcters

6 ɛ Fig. 1. DFA corresponding to Exmple 1. following position i in s re given y w where is chrcter nd w is sequence of length k 2. Also ssume tht there exists sequence in T strting with w nd tht fter reding w, A is in stte w. By construction of A when reding the chrcter t position i, the stte of A chnges from w to w. The trnsition gurntees tht the sequence w elongs to T nd tht the constrint C is stisfied t position i. By inductively repeting the rgument, we conclude tht the constrint C is stisfied t every position nd tht consequently, the Slide constrint is stisfied. We now prove tht if the sequence s stisfies the Slide constrint, then it is ccepted y A. Let w e the first k chrcters of s where nd re two chrcters nd w is sequence of k 2 chrcters. Since the Slide constrint is stisfied, the sequence w stisfies the constrint C nd elongs to the set T. Therefore, there is series of sttes q 0,..., q k 1 tht prses the sequence w where stte q i is the first i chrcters of w. Suppose tht the i th chrcter to e prsed is, tht the lst k 1 prsed chrcters re the chrcter followed y the sequence w, nd tht A is in stte w. Since the Slide constrint is stisfied, the sequence w stisfies C. Therefore, there exists trnsition w,, w δ tht prses the chrcter nd leds to the stte w. Notice tht w re the lst k 1 prsed chrcters. By inductively repeting the rgument, we conclude tht there exists prsing for ny sequence stisfying the slide constrint. Consequently, the sequence s is ccepted y A.

7 5 Softening Slide nd Regulr As we discussed in the introduction, rel world prolems re often over-constrined. One mechnism to del with such over-constrined prolems is to introduce cost function, nd find solution of miniml cost from fesile solution. We will formlize this process s follows. Let C(X 1,..., X n ) e hrd glol constrint like Slide or Regulr. Given distnce function d etween strings, the soft constrint C soft (X 1,..., X n, Z) holds iff Z = min{d( 1,..., n, 1,..., m ) i D(X i ) i 1..n & C( 1,..., m )}. Distnce might, for instnce, e Hmming (in which cse n = m) or edit distnce. As stted in Section 2, d is not defined if the set of strings stisfying C is empty. As n exmple, the constrint SoftSlide H (C, [X 1,..., X n ], D) holds iff D is the Hmming-distnce etween the sequence [X 1,..., X n ] nd the lnguge ccepted y the Slide constrint. Similrly, the constrint SoftSlide E (C, [X 1,..., X n ], D) holds iff D is the edit-distnce etween the sequence [X 1,..., X n ] nd the lnguge ccepted y the Slide constrint. Similrly, SoftRegulr H nd SoftRegulr E re soft forms of Regulr otined y pplying Hmming nd edit distnce sed violtions to Regulr respectively [10]. For exmple, SoftRegulr E (A, [X 1,..., X n ], D) is stisfied iff D is the edit-distnce etween the sequence [X 1,..., X n ] nd the lnguge ccepted y A. In [10], the propgtion lgorithm for Regulr sed on dynmic progrmming is modified in two different wys to mintin GAC on SoftRegulr H nd SoftRegulr E, respectively. 6 SoftSlide constrint We will show tht the different types of SoftSlide constrints cn e reformulted s hrd forms of the Slide or soft form of the Regulr constrints. Reformultion thus provides simple mechnism to propgte the soft forms of these glol constrints. 6.1 SoftSlide H s Slide Let us consider SoftSlide H (C, [X 1,..., X n ], D) where the rity of constrint C is k nd where n k. In order to reformulte this SoftSlide constrint s Slide constrint, we introduce two sequences of extr vriles. The first sequence contins n+k 1 vriles [S 1,..., S n+k 1 ] tht we uild in such wy tht S 1,..., S n cn e ny string ccepted y Slide(C, [S 1,..., S n ]). The domin of ech S i contins ll the vlues tht pper in t lest one tuple elonging to C. The vriles S n+1 to S n+k 1 must not e forced to stisfy the constrint eing slid. Hence, dummy vlue is dded to the domin of every S i, i > n. Furthermore, C is defined s relxtion of C tht contins tuple t iff t elongs to C or t contins t lest one dummy vlue. For instnce, if C is ternry constrint llowing the following set of tuples {,,,, c,,,, c },

8 then the domin of ech S i, i n, is {,, c}, the domin of ech S i, i > n, is {,, c, }, nd C = C { d 1, d 2, d 3 i 1..3, d i = }. The second sequence of vriles contins n + 1 vriles [D 1,..., D n+1 ] which provide the cumultive count of the numer of discrepncies with respect to the previous sequence. Then we introduce the following k + 3-ry constrint: C H (X i, S i,..., S i+k 1, D i, D i+1 ) C (S i,..., S i+k 1 ) D i+1 = D i + (S i X i ) This constrint ensures tht C is stisfied y the sequence [S i,..., S i+k 1 ] (tht is, [S i,..., S i+k 1 ] stisfies C if i + k 1 n), nd D i+1 = D i if S i = X i, otherwise D i+1 = D i + 1. Using the more complex form of Slide over multiple sequences, we cn thus reformulte the SoftSlide H constrint y sliding C H over the three sequences [S 1,..., S n+k 1 ], [X 1,..., X n ], nd [D 1,..., D n+1 ] nd y constrining D 1 to e 0 nd D n+1 to e equl to D. Tht is, we hve: SoftSlide H (C, [X 1,..., X n ], D) Slide(C H, [S 1,..., S n+k 1 ], [X 1,..., X n ], [0, D 2..., D n, D]) Enforcing GAC on Slide is in O(nkd k ), where n is the length of the sequence nd k the rity of the constrint eing slid. In the cse of the reformultion of SoftSlide H s Slide, the constrint to e slid hs rity k + 3. Thus, the time complexity of enforcing GAC on SoftSlide H using this reformultion is in O(nkd k+3 ) where d is the numer of vlues tht re used in tuples llowed y the constrint C. Note tht for this encoding to work correctly, the vriles [S 1,..., S n+k 1 ] should not e constrined y other constrints, so tht GAC on Slide(C, [S 1,..., S n+k 1 ]) gurntees solution. Since such vriles re introduced during the reformultion, they will e invisile to the users of the SoftSlide H constrint, hence such n ssumption is resonle. 6.2 SoftSlide E s SoftRegulr E By using the sme reformultion we proposed of Slide s Regulr, we cn reformulte SoftSlide E s SoftRegulr E. The set of strings ccepted y the hrd version of the SoftSlide E constrint must not e empty ecuse the propgtor of SoftRegulr E descried in [10] is defined for utomt ccepting non empty lnguge. This propgtor chieves GAC on the vriles X i for 1 i n nd BC on D in O(n δ + n Q log(n Q )) steps. The DFA A hs O( Σ i ) sttes lelled with sequence of length i for totl of Q = k 1 i=0 O( Σ i ) = O( Σ k ) sttes. The outgoing degree of every stte is ounded y Σ. We therefore hve δ = O( Σ k+1 ) trnsitions. Filtering the SoftSlide E constrint therefore requires O(n Σ k+1 + n Σ k log(n Σ k )) = O(n Σ k+1 + nk Σ k log(n Σ )) time.

9 7 Experimentl nlysis We now show tht reformultion is n effective mechnism to provide propgtors for Slide nd Regulr constrints. First, we compre resoning out Regulr constrint encoded s Slide, with resoning out it directly using Pesnt s GAC propgtor [6]. Then, we nlyse the reverse reformultion nd compre resoning Slide constrint reformulted s Regulr, with resoning out it directly using the GAC propgtor given in [3]. Pesnt presents two propgtors. We implemented the one tht keeps trck of ll supports for ech vlue in the domin of every vrile. Whilst the first set of experiments re done using ILOG Solver 6.1 on 900 MHz Pentium running Linux Dein, the second set is done using ILOG Solver 6.2 on 2.8GHz Intel Xeon computer running Linux FC Regulr s Slide As in [6], we generted rndom utomt with Q sttes nd n lphet of size Σ. We selected 30% of ll possile tuples (c, q i ) Σ Q nd rndomly chose stte q j Q to form the trnsition T (c, q i ) = q j. We otined the set of finl sttes F y rndomly selecting 50% of the sttes in Q. Following Pesnt, we used rndom vrile ordering nd rndom vlue selection. All experiments re verged over 30 runs. Tle 1 shows the results. We oserve tht the reformultion of Regulr constrints in terms of Slide is s efficient s nd most of the times slightly more efficient thn propgting directly the Regulr constrints. The propgtor for Slide uses sequence of uilt-in Tle constrints. We conjecture tht these re highly optimized nd contriute to the performnce offered y Slide. We lso rn experiments on model for the Mystery Shopper prolem due to Helmut Simonis tht ppers in CSPLi (pro004). This model contins lrge numer of Among constrints. We represented these Among constrints using Regulr constrints, nd gin either resoned with these Regulr constrints directly using Pesnt s propgtor or reformulted them using Slide constrints. Results re given in Tle 2. All instnces solved in the experiments use time limit of 5 minutes. Both methods chieve GAC on the Among constrint, so the serch trees re identicl nd it is only the efficiency of the propgtor which differ. Agin, reformultion of Regulr using Slide is slightly more efficient. 7.2 Slide s Regulr We consider vrint of the Nurse Scheduling Prolem [4] tht consists of generting schedule for ech nurse of shifts duties nd dys off within short-term plnning period. There re three types of shifts (dy, evening, nd night). We ensure tht (1) ech nurse should tke dy off or e ssigned to n ville shift; (2) ech shift hs minimum required numer of nurses; (3) ech nurse work lod should e etween specific lower nd upper ounds; (4) ech nurse

10 n Σ Q Regulr Regulr s Slide n Σ Q Regulr Regulr s Slide Tle 1. Time in seconds to find sequence stisfying rndomly generted utomton either using Pesnt s propgtor for the Regulr constrint or reformulting it s Slide constrint cn work t most 5 consecutive dys; (5) ech nurse must hve t lest 12 hours of rek etween two shifts; (6) the shift ssigned to nurse cnnot chnge more thn once every three dys. We develop two models to solve this prolem. In oth, we introduce one vrile for ech nurse nd ech dy, indicting to wht type of shift, if ny, this nurse is ffected on this dy. The constrints (1)-(3) re enforced using set of glol crdinlity constrints. The constrints (4), (5) nd (6) form sequences of respectively 6-ry, inry nd ternry constrints. Notice tht (4) is monotone, hence we simply post these constrints in oth models. The conjunction of constrints (5) nd (6) is slid using the tuple encoding of Slide in the first model, nd n encoding of Slide using Regulr in the second model. We test the models y using the instnces ville t in which nurses hve no mximum worklod, ut set of preferences is to e optimised. We ignore these preferences nd post constrint for ounding the mximum worklod to t most 5 dy shifts, 4 evening shifts nd 2 night shifts per nurses nd per week. Similrly, ech nurse must hve

11 Regulr Regulr s Slide Size #fils cpu time #solved #fils cpu time #solved / / / / / / / / / / / /56 Tle 2. Mystery Shopper prolem, Regulr v. Regulr s Slide. #fils nd cpu time re only verged on instnces solved y oth methods. Slide Slide s Regulr instnces solved 56/99 56/99 time cktrcks Tle 3. Nurse scheduling prolem (30 nurses, 28 dys), Slide v. Slide s Regulr. #fils nd cpu time re only verged on instnces solved y oth methods. t lest 2 rest dys per week. We solve smple of 99 instnces involving crew of 30 nurses to schedule over 28 dys. We use the sme sttic vrile ordering for oth models. The dys re scheduled in chronologicl order, nd within ech dy, we llocte shift to every nurse in lex order. Initil experiments show tht this simple heuristic is more efficient thn dynmic minimum domin heuristic. In Tle 3, we report the men fils nd cpu time required to solve the instnces. We oserve tht the first model is out 15% fster thn the second model. 8 Relted Work Reformulting new glol constrints in terms of those tht lredy ville within the constrint toolkit hs strted to gin ttention within the constrint progrmming community. For instnce, in [11], the AmongSeq constrint used in cr sequencing on production line is studied nd lterntive propgtion methods re discussed. One pproch reformultes AmongSeq s Regulr constrint. This reformultion is shown to e the most efficient in prctice compred to the other proposed propgtors. Given the lrge numer of glol constrints tht hve een identified, nother direction of study is generl-purpose glol constrints. Such constrints cn e used in conjunction with the primitive constrints to reformulte wide rnge of glol constrints without the need to extend the constrint toolkits. This is especilly useful if constrint toolkit does not provide propgtor for the glol constrint or if the constrint is difficult to propgte. Slide is such generl constrint ecuse it helps encode nd propgte mny sequencing

12 Regulr SoftSlide SoftRegulr Slide Fig. 2. The reltionship etween Slide, SoftSlide, Regulr, nd SoftRegulr constrints. constrints [3]. Other exmples of generl constrints re Rnge nd Roots [2]. They re shown to e very useful for reformulting diverse glol constrints ppering in counting nd occurrence prolems. One of the simplest wys to soften the Slide constrint is to relx the numer of times the slid constrint holds on the sequence. This gives the CrdPth constrint. CrdPth(C, [X 1,..., X n ], N) holds iff C holds N times on the sequence [X 1,..., X n ] [1]. Interestingly, the CrdPth constrint cn itself e reformulted s Slide constrint [3]. We cn therefore use the propgtor for Slide to propgte the CrdPth constrint. In fct, this reformultion is the first nd only method proposed so fr in the literture for enforcing GAC on CrdPth. 9 Conclusions To model rel-world constrint prolems nd to solve them efficiently, mny glol constrints hve een proposed in recent yers. In this pper, we hve focused on two importnt glol constrints, Slide nd Regulr which re useful for encoding nd propgting wide rnge of rostering nd sequencing prolems. Since prolems re often over-constrined, we hve lso studied soft forms of these glol constrints. We showed tht the different forms of Slide nd Regulr cn ll e reformulted s ech other. We lso showed tht reformultion is n effective method to incorporte such glol constrints within n existing constrint toolkit. This study hs provided insight into the close reltionship etween these two importnt glol constrints. The reltionships depicted in Figure 2 demonstrte the close links etween the hrd nd soft versions of the Slide nd Regulr constrints. An rrow from constrint C i to constrint C j indictes in the figure tht C i cn e reformulted s C j. A thick rrow is either due to findings in this pper or due to the fct tht soft form of constrint cn e used to propgte its hrd form y not llowing ny violtion. The dshed rrows cn e otined y trnsitivity

13 from the thick rrows. For instnce, given tht Regulr cn e reformulted s Slide which cn itself e reformulted s SoftSlide, we cn derive tht Regulr cn e reformulted s SoftSlide. References 1. N. Beldicenu nd M. Crlsson. Revisiting the crdinlity opertor nd introducing crdinlity-pth constrint fmily. In Proc. of ICLP 01, LNCS 2237,pp Springer, C. Bessière, E. Herrd, B. Hnich, Z. Kiziltn, nd T. Wlsh. The rnge nd roots constrints: Specifying counting nd occurrence prolems. In Proc. of IJCAI 05, pp Professionl Book Center, C. Bessière, E. Herrd, B. Hnich, Z. Kiziltn, nd T. Wlsh. The Slide Met- Constrint. Comic technicl report, 2006 (ville t hnich/comic/). 4. Burke, E. K., Cusmecker, P. D., Berghe, G. V., nd Lndeghem, H. V. The stte of the rt of nurse rostering. Journl of Scheduling, 7(6): , M. Mher. Anlysis of glol contiguity constrint. In Proc. of the CP 02 Workshop on Rule Bsed Constrint Resoning nd Progrmming, G. Pesnt. A regulr lnguge memership constrint for finite sequences of vriles. In Proc. of CP 04, LNCS 3258, pp Springer, T. Petit, J-C. Régin, nd C. Bessière. Specific filtering lgorithms for overconstrined prolems. In Proc. of CP 01, LNCS 2236, pp Springer, C.-G. Quimper nd T. Wlsh. Glol grmmr constrints. In Proc. of CP 06, LNCS 4204, pp Springer, W-J. vn Hoeve. A hyper-rc consistency lgorithm for the soft lldifferent constrint. In Proc. of CP 04, LNCS LNCS 3258, pp Springer, W-J. vn Hoeve, G. Pesnt, nd L-M. Rousseu. On glol wrming : Flow-sed soft glol constints. Journl of Heuristics, 12(4-5): , W-J. vn Hoeve, G. Pesnt, L-M. Rousseu, nd A. Shrwl. Revisiting the sequence constrint. In Proc. of CP 06, LNCS 42024, pp Springer, A. Znrini, M. Milno, nd G. Pesnt. Improved lgorithm for the soft glol crdinlity constrint. In Proc. of CP-AI-OR 06, LNCS 3990, pp Springer, 2006.

Minimal DFA. minimal DFA for L starting from any other

Minimal DFA. minimal DFA for L starting from any other Miniml DFA Among the mny DFAs ccepting the sme regulr lnguge L, there is exctly one (up to renming of sttes) which hs the smllest possile numer of sttes. Moreover, it is possile to otin tht miniml DFA

More information

Designing finite automata II

Designing finite automata II Designing finite utomt II Prolem: Design DFA A such tht L(A) consists of ll strings of nd which re of length 3n, for n = 0, 1, 2, (1) Determine wht to rememer out the input string Assign stte to ech of

More information

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9. Regulr Expressions, Pumping Lemm, Right Liner Grmmrs Ling 106 Mrch 25, 2002 1 Regulr Expressions A regulr expression descries or genertes lnguge: it is kind of shorthnd for listing the memers of lnguge.

More information

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages Deprtment of Computer Science, Austrlin Ntionl University COMP2600 Forml Methods for Softwre Engineering Semester 2, 206 Assignment Automt, Lnguges, nd Computility Smple Solutions Finite Stte Automt nd

More information

1 Nondeterministic Finite Automata

1 Nondeterministic Finite Automata 1 Nondeterministic Finite Automt Suppose in life, whenever you hd choice, you could try oth possiilities nd live your life. At the end, you would go ck nd choose the one tht worked out the est. Then you

More information

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz University of Southern Cliforni Computer Science Deprtment Compiler Design Fll Lexicl Anlysis Smple Exercises nd Solutions Prof. Pedro C. Diniz USC / Informtion Sciences Institute 4676 Admirlty Wy, Suite

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 utomt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Prolem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) nton Setzer (Bsed on ook drft y J. V. Tucker nd K. Stephenson)

More information

Lecture 08: Feb. 08, 2019

Lecture 08: Feb. 08, 2019 4CS4-6:Theory of Computtion(Closure on Reg. Lngs., regex to NDFA, DFA to regex) Prof. K.R. Chowdhry Lecture 08: Fe. 08, 2019 : Professor of CS Disclimer: These notes hve not een sujected to the usul scrutiny

More information

Chapter 2 Finite Automata

Chapter 2 Finite Automata Chpter 2 Finite Automt 28 2.1 Introduction Finite utomt: first model of the notion of effective procedure. (They lso hve mny other pplictions). The concept of finite utomton cn e derived y exmining wht

More information

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4 Intermedite Mth Circles Wednesdy, Novemer 14, 2018 Finite Automt II Nickols Rollick nrollick@uwterloo.c Regulr Lnguges Lst time, we were introduced to the ide of DFA (deterministic finite utomton), one

More information

Convert the NFA into DFA

Convert the NFA into DFA Convert the NF into F For ech NF we cn find F ccepting the sme lnguge. The numer of sttes of the F could e exponentil in the numer of sttes of the NF, ut in prctice this worst cse occurs rrely. lgorithm:

More information

Harvard University Computer Science 121 Midterm October 23, 2012

Harvard University Computer Science 121 Midterm October 23, 2012 Hrvrd University Computer Science 121 Midterm Octoer 23, 2012 This is closed-ook exmintion. You my use ny result from lecture, Sipser, prolem sets, or section, s long s you quote it clerly. The lphet is

More information

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014 CMPSCI 250: Introduction to Computtion Lecture #31: Wht DFA s Cn nd Cn t Do Dvid Mix Brrington 9 April 2014 Wht DFA s Cn nd Cn t Do Deterministic Finite Automt Forml Definition of DFA s Exmples of DFA

More information

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1 Chpter Five: Nondeterministic Finite Automt Forml Lnguge, chpter 5, slide 1 1 A DFA hs exctly one trnsition from every stte on every symol in the lphet. By relxing this requirement we get relted ut more

More information

Formal languages, automata, and theory of computation

Formal languages, automata, and theory of computation Mälrdlen University TEN1 DVA337 2015 School of Innovtion, Design nd Engineering Forml lnguges, utomt, nd theory of computtion Thursdy, Novemer 5, 14:10-18:30 Techer: Dniel Hedin, phone 021-107052 The exm

More information

First Midterm Examination

First Midterm Examination Çnky University Deprtment of Computer Engineering 203-204 Fll Semester First Midterm Exmintion ) Design DFA for ll strings over the lphet Σ = {,, c} in which there is no, no nd no cc. 2) Wht lnguge does

More information

CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 CMSC 330 1 Types of Finite Automt Deterministic Finite Automt (DFA) Exctly one sequence of steps for ech string All exmples so fr Nondeterministic

More information

3 Regular expressions

3 Regular expressions 3 Regulr expressions Given n lphet Σ lnguge is set of words L Σ. So fr we were le to descrie lnguges either y using set theory (i.e. enumertion or comprehension) or y n utomton. In this section we shll

More information

Lecture 09: Myhill-Nerode Theorem

Lecture 09: Myhill-Nerode Theorem CS 373: Theory of Computtion Mdhusudn Prthsrthy Lecture 09: Myhill-Nerode Theorem 16 Ferury 2010 In this lecture, we will see tht every lnguge hs unique miniml DFA We will see this fct from two perspectives

More information

Homework 3 Solutions

Homework 3 Solutions CS 341: Foundtions of Computer Science II Prof. Mrvin Nkym Homework 3 Solutions 1. Give NFAs with the specified numer of sttes recognizing ech of the following lnguges. In ll cses, the lphet is Σ = {,1}.

More information

Lecture 9: LTL and Büchi Automata

Lecture 9: LTL and Büchi Automata Lecture 9: LTL nd Büchi Automt 1 LTL Property Ptterns Quite often the requirements of system follow some simple ptterns. Sometimes we wnt to specify tht property should only hold in certin context, clled

More information

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata CS103B ndout 18 Winter 2007 Ferury 28, 2007 Finite Automt Initil text y Mggie Johnson. Introduction Severl childrens gmes fit the following description: Pieces re set up on plying ord; dice re thrown or

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2 CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh Lnguges nd Automt Finite Automt Informtics 2A: Lecture 3 John Longley School of Informtics University of Edinburgh jrl@inf.ed.c.uk 22 September 2017 1 / 30 Lnguges nd Automt 1 Lnguges nd Automt Wht is

More information

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS CS 310 (sec 20) - Winter 2003 - Finl Exm (solutions) SOLUTIONS 1. (Logic) Use truth tles to prove the following logicl equivlences: () p q (p p) (q q) () p q (p q) (p q) () p q p q p p q q (q q) (p p)

More information

p-adic Egyptian Fractions

p-adic Egyptian Fractions p-adic Egyptin Frctions Contents 1 Introduction 1 2 Trditionl Egyptin Frctions nd Greedy Algorithm 2 3 Set-up 3 4 p-greedy Algorithm 5 5 p-egyptin Trditionl 10 6 Conclusion 1 Introduction An Egyptin frction

More information

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University CS415 Compilers Lexicl Anlysis nd These slides re sed on slides copyrighted y Keith Cooper, Ken Kennedy & Lind Torczon t Rice University First Progrmming Project Instruction Scheduling Project hs een posted

More information

Coalgebra, Lecture 15: Equations for Deterministic Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata Colger, Lecture 15: Equtions for Deterministic Automt Julin Slmnc (nd Jurrin Rot) Decemer 19, 2016 In this lecture, we will study the concept of equtions for deterministic utomt. The notes re self contined

More information

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb. CMSC 330: Orgniztion of Progrmming Lnguges Finite Automt 2 Types of Finite Automt Deterministic Finite Automt () Exctly one sequence of steps for ech string All exmples so fr Nondeterministic Finite Automt

More information

1.4 Nonregular Languages

1.4 Nonregular Languages 74 1.4 Nonregulr Lnguges The number of forml lnguges over ny lphbet (= decision/recognition problems) is uncountble On the other hnd, the number of regulr expressions (= strings) is countble Hence, ll

More information

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science CSCI 340: Computtionl Models Kleene s Theorem Chpter 7 Deprtment of Computer Science Unifiction In 1954, Kleene presented (nd proved) theorem which (in our version) sttes tht if lnguge cn e defined y ny

More information

Formal Languages and Automata

Formal Languages and Automata Moile Computing nd Softwre Engineering p. 1/5 Forml Lnguges nd Automt Chpter 2 Finite Automt Chun-Ming Liu cmliu@csie.ntut.edu.tw Deprtment of Computer Science nd Informtion Engineering Ntionl Tipei University

More information

Parse trees, ambiguity, and Chomsky normal form

Parse trees, ambiguity, and Chomsky normal form Prse trees, miguity, nd Chomsky norml form In this lecture we will discuss few importnt notions connected with contextfree grmmrs, including prse trees, miguity, nd specil form for context-free grmmrs

More information

First Midterm Examination

First Midterm Examination 24-25 Fll Semester First Midterm Exmintion ) Give the stte digrm of DFA tht recognizes the lnguge A over lphet Σ = {, } where A = {w w contins or } 2) The following DFA recognizes the lnguge B over lphet

More information

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton 25. Finite Automt AUTOMATA AND LANGUAGES A system of computtion tht only hs finite numer of possile sttes cn e modeled using finite utomton A finite utomton is often illustrted s stte digrm d d d. d q

More information

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.) CS 373, Spring 29. Solutions to Mock midterm (sed on first midterm in CS 273, Fll 28.) Prolem : Short nswer (8 points) The nswers to these prolems should e short nd not complicted. () If n NF M ccepts

More information

DFA minimisation using the Myhill-Nerode theorem

DFA minimisation using the Myhill-Nerode theorem DFA minimistion using the Myhill-Nerode theorem Johnn Högerg Lrs Lrsson Astrct The Myhill-Nerode theorem is n importnt chrcteristion of regulr lnguges, nd it lso hs mny prcticl implictions. In this chpter,

More information

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh Finite Automt Informtics 2A: Lecture 3 Mry Cryn School of Informtics University of Edinburgh mcryn@inf.ed.c.uk 21 September 2018 1 / 30 Lnguges nd Automt Wht is lnguge? Finite utomt: recp Some forml definitions

More information

More on automata. Michael George. March 24 April 7, 2014

More on automata. Michael George. March 24 April 7, 2014 More on utomt Michel George Mrch 24 April 7, 2014 1 Automt constructions Now tht we hve forml model of mchine, it is useful to mke some generl constructions. 1.1 DFA Union / Product construction Suppose

More information

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science CSCI 340: Computtionl Models Trnsition Grphs Chpter 6 Deprtment of Computer Science Relxing Restrints on Inputs We cn uild n FA tht ccepts only the word! 5 sttes ecuse n FA cn only process one letter t

More information

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations.

Lecture 3. In this lecture, we will discuss algorithms for solving systems of linear equations. Lecture 3 3 Solving liner equtions In this lecture we will discuss lgorithms for solving systems of liner equtions Multiplictive identity Let us restrict ourselves to considering squre mtrices since one

More information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Finite Automt Theory nd Forml Lnguges TMV027/DIT321 LP4 2018 Lecture 10 An Bove April 23rd 2018 Recp: Regulr Lnguges We cn convert between FA nd RE; Hence both FA nd RE ccept/generte regulr lnguges; More

More information

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont. NFA DFA Exmple 3 CMSC 330: Orgniztion of Progrmming Lnguges NFA {B,D,E {A,E {C,D {E Finite Automt, con't. R = { {A,E, {B,D,E, {C,D, {E 2 Equivlence of DFAs nd NFAs Any string from {A to either {D or {CD

More information

Tutorial Automata and formal Languages

Tutorial Automata and formal Languages Tutoril Automt nd forml Lnguges Notes for to the tutoril in the summer term 2017 Sestin Küpper, Christine Mik 8. August 2017 1 Introduction: Nottions nd sic Definitions At the eginning of the tutoril we

More information

Finite Automata-cont d

Finite Automata-cont d Automt Theory nd Forml Lnguges Professor Leslie Lnder Lecture # 6 Finite Automt-cont d The Pumping Lemm WEB SITE: http://ingwe.inghmton.edu/ ~lnder/cs573.html Septemer 18, 2000 Exmple 1 Consider L = {ww

More information

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents Finite Automt (FA or DFA) CHAPTE 1 egulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, euivlence of NFAs nd DFAs, closure under regulr

More information

Nondeterminism and Nodeterministic Automata

Nondeterminism and Nodeterministic Automata Nondeterminism nd Nodeterministic Automt 61 Nondeterminism nd Nondeterministic Automt The computtionl mchine models tht we lerned in the clss re deterministic in the sense tht the next move is uniquely

More information

The size of subsequence automaton

The size of subsequence automaton Theoreticl Computer Science 4 (005) 79 84 www.elsevier.com/locte/tcs Note The size of susequence utomton Zdeněk Troníček,, Ayumi Shinohr,c Deprtment of Computer Science nd Engineering, FEE CTU in Prgue,

More information

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018 CS 301 Lecture 04 Regulr Expressions Stephen Checkowy Jnury 29, 2018 1 / 35 Review from lst time NFA N = (Q, Σ, δ, q 0, F ) where δ Q Σ P (Q) mps stte nd n lphet symol (or ) to set of sttes We run n NFA

More information

Homework Solution - Set 5 Due: Friday 10/03/08

Homework Solution - Set 5 Due: Friday 10/03/08 CE 96 Introduction to the Theory of Computtion ll 2008 Homework olution - et 5 Due: ridy 10/0/08 1. Textook, Pge 86, Exercise 1.21. () 1 2 Add new strt stte nd finl stte. Mke originl finl stte non-finl.

More information

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Converting Regular Expressions to Discrete Finite Automata: A Tutorial Converting Regulr Expressions to Discrete Finite Automt: A Tutoril Dvid Christinsen 2013-01-03 This is tutoril on how to convert regulr expressions to nondeterministic finite utomt (NFA) nd how to convert

More information

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7 CS103 Hndout 32 Fll 2016 Novemer 11, 2016 Prolem Set 7 Wht cn you do with regulr expressions? Wht re the limits of regulr lnguges? On this prolem set, you'll find out! As lwys, plese feel free to drop

More information

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers 80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES 2.6 Finite Stte Automt With Output: Trnsducers So fr, we hve only considered utomt tht recognize lnguges, i.e., utomt tht do not produce ny output on ny input

More information

1B40 Practical Skills

1B40 Practical Skills B40 Prcticl Skills Comining uncertinties from severl quntities error propgtion We usully encounter situtions where the result of n experiment is given in terms of two (or more) quntities. We then need

More information

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38 Theory of Computtion Regulr Lnguges (NTU EE) Regulr Lnguges Fll 2017 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of Finite Automt A finite utomton hs finite set of control

More information

Regular expressions, Finite Automata, transition graphs are all the same!!

Regular expressions, Finite Automata, transition graphs are all the same!! CSI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 7: Kleene s Theorem Chpter 7: Kleene s Theorem Regulr expressions, Finite Automt, trnsition grphs re ll the sme!! Dr. Neji Zgui CSI3104-W11 1

More information

Thoery of Automata CS402

Thoery of Automata CS402 Thoery of Automt C402 Theory of Automt Tle of contents: Lecture N0. 1... 4 ummry... 4 Wht does utomt men?... 4 Introduction to lnguges... 4 Alphets... 4 trings... 4 Defining Lnguges... 5 Lecture N0. 2...

More information

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true. York University CSE 2 Unit 3. DFA Clsses Converting etween DFA, NFA, Regulr Expressions, nd Extended Regulr Expressions Instructor: Jeff Edmonds Don t chet y looking t these nswers premturely.. For ech

More information

Closure Properties of Regular Languages

Closure Properties of Regular Languages Closure Properties of Regulr Lnguges Regulr lnguges re closed under mny set opertions. Let L 1 nd L 2 e regulr lnguges. (1) L 1 L 2 (the union) is regulr. (2) L 1 L 2 (the conctention) is regulr. (3) L

More information

Discrete Mathematics and Probability Theory Spring 2013 Anant Sahai Lecture 17

Discrete Mathematics and Probability Theory Spring 2013 Anant Sahai Lecture 17 EECS 70 Discrete Mthemtics nd Proility Theory Spring 2013 Annt Shi Lecture 17 I.I.D. Rndom Vriles Estimting the is of coin Question: We wnt to estimte the proportion p of Democrts in the US popultion,

More information

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes CSE 260-002: Exm 3-ANSWERS, Spring 20 ime: 50 minutes Nme: his exm hs 4 pges nd 0 prolems totling 00 points. his exm is closed ook nd closed notes.. Wrshll s lgorithm for trnsitive closure computtion is

More information

Chapter 5 Plan-Space Planning

Chapter 5 Plan-Space Planning Lecture slides for Automted Plnning: Theory nd Prctice Chpter 5 Pln-Spce Plnning Dn S. Nu CMSC 722, AI Plnning University of Mrylnd, Spring 2008 1 Stte-Spce Plnning Motivtion g 1 1 g 4 4 s 0 g 5 5 g 2

More information

Genetic Programming. Outline. Evolutionary Strategies. Evolutionary strategies Genetic programming Summary

Genetic Programming. Outline. Evolutionary Strategies. Evolutionary strategies Genetic programming Summary Outline Genetic Progrmming Evolutionry strtegies Genetic progrmming Summry Bsed on the mteril provided y Professor Michel Negnevitsky Evolutionry Strtegies An pproch simulting nturl evolution ws proposed

More information

Model Reduction of Finite State Machines by Contraction

Model Reduction of Finite State Machines by Contraction Model Reduction of Finite Stte Mchines y Contrction Alessndro Giu Dip. di Ingegneri Elettric ed Elettronic, Università di Cgliri, Pizz d Armi, 09123 Cgliri, Itly Phone: +39-070-675-5892 Fx: +39-070-675-5900

More information

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3 2 The Prllel Circuit Electric Circuits: Figure 2- elow show ttery nd multiple resistors rrnged in prllel. Ech resistor receives portion of the current from the ttery sed on its resistnce. The split is

More information

1.3 Regular Expressions

1.3 Regular Expressions 56 1.3 Regulr xpressions These hve n importnt role in describing ptterns in serching for strings in mny pplictions (e.g. wk, grep, Perl,...) All regulr expressions of lphbet re 1.Ønd re regulr expressions,

More information

Theory of Computation Regular Languages

Theory of Computation Regular Languages Theory of Computtion Regulr Lnguges Bow-Yw Wng Acdemi Sinic Spring 2012 Bow-Yw Wng (Acdemi Sinic) Regulr Lnguges Spring 2012 1 / 38 Schemtic of Finite Automt control 0 0 1 0 1 1 1 0 Figure: Schemtic of

More information

The Minimum Label Spanning Tree Problem: Illustrating the Utility of Genetic Algorithms

The Minimum Label Spanning Tree Problem: Illustrating the Utility of Genetic Algorithms The Minimum Lel Spnning Tree Prolem: Illustrting the Utility of Genetic Algorithms Yupei Xiong, Univ. of Mrylnd Bruce Golden, Univ. of Mrylnd Edwrd Wsil, Americn Univ. Presented t BAE Systems Distinguished

More information

Linear Inequalities. Work Sheet 1

Linear Inequalities. Work Sheet 1 Work Sheet 1 Liner Inequlities Rent--Hep, cr rentl compny,chrges $ 15 per week plus $ 0.0 per mile to rent one of their crs. Suppose you re limited y how much money you cn spend for the week : You cn spend

More information

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages 5//6 Grmmr Automt nd Lnguges Regulr Grmmr Context-free Grmmr Context-sensitive Grmmr Prof. Mohmed Hmd Softwre Engineering L. The University of Aizu Jpn Regulr Lnguges Context Free Lnguges Context Sensitive

More information

Bases for Vector Spaces

Bases for Vector Spaces Bses for Vector Spces 2-26-25 A set is independent if, roughly speking, there is no redundncy in the set: You cn t uild ny vector in the set s liner comintion of the others A set spns if you cn uild everything

More information

Let's start with an example:

Let's start with an example: Finite Automt Let's strt with n exmple: Here you see leled circles tht re sttes, nd leled rrows tht re trnsitions. One of the sttes is mrked "strt". One of the sttes hs doule circle; this is terminl stte

More information

Name Ima Sample ASU ID

Name Ima Sample ASU ID Nme Im Smple ASU ID 2468024680 CSE 355 Test 1, Fll 2016 30 Septemer 2016, 8:35-9:25.m., LSA 191 Regrding of Midterms If you elieve tht your grde hs not een dded up correctly, return the entire pper to

More information

CS 330 Formal Methods and Models

CS 330 Formal Methods and Models CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2017 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 2 1. Prove ((( p q) q) p) is tutology () (3pts) y truth tle. p q p q

More information

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University U.U.D.M. Project Report 07:4 Frey Frctions Rickrd Fernström Exmensrete i mtemtik, 5 hp Hledre: Andres Strömergsson Exmintor: Jörgen Östensson Juni 07 Deprtment of Mthemtics Uppsl University Frey Frctions

More information

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute Victor Admchik Dnny Sletor Gret Theoreticl Ides In Computer Science CS 5-25 Spring 2 Lecture 2 Mr 3, 2 Crnegie Mellon University Deterministic Finite Automt Finite Automt A mchine so simple tht you cn

More information

Distance Constraints in Constraint Satisfaction

Distance Constraints in Constraint Satisfaction Distnce Constrints in Constrint Stisfction Emmnuel Herrd 4C, Computer Science Dept. UCC, Irelnd e.herrd@4c.ucc.ie Brry O Sullivn 4C, Computer Science Dept. UCC, Irelnd.osullivn@4c.ucc.ie Toy Wlsh NICTA

More information

1 From NFA to regular expression

1 From NFA to regular expression Note 1: How to convert DFA/NFA to regulr expression Version: 1.0 S/EE 374, Fll 2017 Septemer 11, 2017 In this note, we show tht ny DFA cn e converted into regulr expression. Our construction would work

More information

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1.

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1. Mth Anlysis CP WS 4.X- Section 4.-4.4 Review Complete ech question without the use of grphing clcultor.. Compre the mening of the words: roots, zeros nd fctors.. Determine whether - is root of 0. Show

More information

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings... Tle of contents: Lecture N0.... 3 ummry... 3 Wht does utomt men?... 3 Introduction to lnguges... 3 Alphets... 3 trings... 3 Defining Lnguges... 4 Lecture N0. 2... 7 ummry... 7 Kleene tr Closure... 7 Recursive

More information

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA) Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr

More information

Myhill-Nerode Theorem

Myhill-Nerode Theorem Overview Myhill-Nerode Theorem Correspondence etween DA s nd MN reltions Cnonicl DA for L Computing cnonicl DFA Myhill-Nerode Theorem Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute

More information

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016 CS125 Lecture 12 Fll 2016 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

CS 275 Automata and Formal Language Theory

CS 275 Automata and Formal Language Theory CS 275 Automt nd Forml Lnguge Theory Course Notes Prt II: The Recognition Problem (II) Chpter II.5.: Properties of Context Free Grmmrs (14) Anton Setzer (Bsed on book drft by J. V. Tucker nd K. Stephenson)

More information

Non-deterministic Finite Automata

Non-deterministic Finite Automata Non-deterministic Finite Automt Eliminting non-determinism Rdoud University Nijmegen Non-deterministic Finite Automt H. Geuvers nd T. vn Lrhoven Institute for Computing nd Informtion Sciences Intelligent

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation 9/6/28 Stereotypicl computer CISC 49 Theory of Computtion Finite stte mchines & Regulr lnguges Professor Dniel Leeds dleeds@fordhm.edu JMH 332 Centrl processing unit (CPU) performs ll the instructions

More information

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 17

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 17 CS 70 Discrete Mthemtics nd Proility Theory Summer 2014 Jmes Cook Note 17 I.I.D. Rndom Vriles Estimting the is of coin Question: We wnt to estimte the proportion p of Democrts in the US popultion, y tking

More information

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS The University of Nottinghm SCHOOL OF COMPUTER SCIENCE LEVEL 2 MODULE, SPRING SEMESTER 2016 2017 LNGUGES ND COMPUTTION NSWERS Time llowed TWO hours Cndidtes my complete the front cover of their nswer ook

More information

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1 CS4 45- Determinisitic Finite Automt -: Genertors vs. Checkers Regulr expressions re one wy to specify forml lnguge String Genertor Genertes strings in the lnguge Deterministic Finite Automt (DFA) re nother

More information

CS375: Logic and Theory of Computing

CS375: Logic and Theory of Computing CS375: Logic nd Theory of Computing Fuhu (Frnk) Cheng Deprtment of Computer Science University of Kentucky 1 Tle of Contents: Week 1: Preliminries (set lger, reltions, functions) (red Chpters 1-4) Weeks

More information

Lecture 2: January 27

Lecture 2: January 27 CS 684: Algorithmic Gme Theory Spring 217 Lecturer: Év Trdos Lecture 2: Jnury 27 Scrie: Alert Julius Liu 2.1 Logistics Scrie notes must e sumitted within 24 hours of the corresponding lecture for full

More information

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014 CS125 Lecture 12 Fll 2014 12.1 Nondeterminism The ide of nondeterministic computtions is to llow our lgorithms to mke guesses, nd only require tht they ccept when the guesses re correct. For exmple, simple

More information

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions CS 330 Forml Methods nd Models Dn Richrds, George Mson University, Spring 2016 Quiz Solutions Quiz 1, Propositionl Logic Dte: Ferury 9 1. (4pts) ((p q) (q r)) (p r), prove tutology using truth tles. p

More information

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010 CS 311 Homework 3 due 16:30, Thursdy, 14 th Octoer 2010 Homework must e sumitted on pper, in clss. Question 1. [15 pts.; 5 pts. ech] Drw stte digrms for NFAs recognizing the following lnguges:. L = {w

More information

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy: Scnner Specifying ptterns source code tokens scnner prser IR A scnner must recognize the units of syntx Some prts re esy: errors mps chrcters into tokens the sic unit of syntx x = x + y; ecomes

More information

Finite-State Automata: Recap

Finite-State Automata: Recap Finite-Stte Automt: Recp Deepk D Souz Deprtment of Computer Science nd Automtion Indin Institute of Science, Bnglore. 09 August 2016 Outline 1 Introduction 2 Forml Definitions nd Nottion 3 Closure under

More information

FABER Formal Languages, Automata and Models of Computation

FABER Formal Languages, Automata and Models of Computation DVA337 FABER Forml Lnguges, Automt nd Models of Computtion Lecture 5 chool of Innovtion, Design nd Engineering Mälrdlen University 2015 1 Recp of lecture 4 y definition suset construction DFA NFA stte

More information

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-* Regulr Expressions (RE) Regulr Expressions (RE) Empty set F A RE denotes the empty set Opertion Nottion Lnguge UNIX Empty string A RE denotes the set {} Alterntion R +r L(r ) L(r ) r r Symol Alterntion

More information

Java II Finite Automata I

Java II Finite Automata I Jv II Finite Automt I Bernd Kiefer Bernd.Kiefer@dfki.de Deutsches Forschungszentrum für künstliche Intelligenz Finite Automt I p.1/13 Processing Regulr Expressions We lredy lerned out Jv s regulr expression

More information

Learning Moore Machines from Input-Output Traces

Learning Moore Machines from Input-Output Traces Lerning Moore Mchines from Input-Output Trces Georgios Gintmidis 1 nd Stvros Tripkis 1,2 1 Alto University, Finlnd 2 UC Berkeley, USA Motivtion: lerning models from blck boxes Inputs? Lerner Forml Model

More information