Constraints for Membership in Formal Languages Under Systematic Search and Stochastic Local Search
Total Page:16
File Type:pdf, Size:1020Kb
Digital Comprehensive Summaries of Uppsala Dissertations from the Faculty of Science and Technology 1027 Constraints for Membership in Formal Languages under Systematic Search and Stochastic Local Search JUN HE ACTA UNIVERSITATIS UPSALIENSIS ISSN 1651-6214 ISBN 978-91-554-8617-4 UPPSALA urn:nbn:se:uu:diva-196347 2013 Dissertation presented at Uppsala University to be publicly examined in Room 2446, Polacksbacken, Lägerhyddsvägen 2D, Uppsala, Friday, April 26, 2013 at 13:00 for the degree of Doctor of Philosophy. The examination will be conducted in English. Abstract He, J. 2013. Constraints for Membership in Formal Languages under Systematic Search and Stochastic Local Search. Acta Universitatis Upsaliensis. Digital Comprehensive Summaries of Uppsala Dissertations from the Faculty of Science and Technology 1027. 74 pp. Uppsala. ISBN 978-91-554-8617-4. This thesis focuses on constraints for membership in formal languages under both the systematic search and stochastic local search approaches to constraint programming (CP). Such constraints are very useful in CP for the following three reasons: They provide a powerful tool for user- level extensibility of CP languages. They are very useful for modelling complex work shift regulation constraints, which exist in many shift scheduling problems. In the analysis, testing, and verification of string-manipulating programs, string constraints often arise. We show in this thesis that CP solvers with constraints for membership in formal languages are much more suitable than existing solvers used in tools that have to solve string constraints. In the stochastic local search approach to CP, we make the following two contributions: We introduce a stochastic method of maintaining violations for the regular constraint and extend our method to the automaton constraint with counters. To improve the usage of constraints for which there exists no known constant-time algorithm for neighbour evaluation, we introduce a framework of using solution neighbourhoods, and give an efficient algorithm of constructing a solution neighbourhood for the regular constraint. In the systematic search approach to CP, we make the following two contributions: We show that there may be unwanted consequences when using a propagator that may underestimate a cost of a soft constraint, as the propagator may guide the search to incorrect (non-optimum) solutions to an over-constrained problem. We introduce and compare several propagators that compute correctly the cost of the edit-distance based soft- regular constraint. We show that the context-free grammar constraint is useful and introduce an improved propagator for it. Keywords: constraint programming, regular constraint, automaton constraint, context-free grammar constraint, solution neighbourhood, counter automaton Jun He, Uppsala University, Department of Information Technology, Computing Science, Box 337, SE-751 05 Uppsala, Sweden. © Jun He 2013 ISSN 1651-6214 ISBN 978-91-554-8617-4 urn:nbn:se:uu:diva-196347 (http://urn.kb.se/resolve?urn=urn:nbn:se:uu:diva-196347) To my family Acknowledgements First and foremost I would like to thank my supervisors Professor Pierre Flener and Associate Professor Justin Pearson for their invaluable support and super- vision during my PhD research. Thank you for providing me with the opportu- nity to work with you and for always giving me numerous encouragement and patient guidance, without which I could not have achieved the research goals. I also appreciate your tremendous effort to teach me how to write scientific papers and your comments on drafts of this thesis. I would like to thank Professor Weiming Zhang for involving me with the PhD programme of the National University of Defense Technology (NUDT) of China and for supporting me to apply for a PhD scholarship from the China Scholarship Council (CSC). Thanks also to Professor Xianqing Yi for his su- pervision during my master programme at NUDT. I am grateful to Dr Magnus Ågren, Dr Serdar Kadioglu,ˇ and Dr Toni Mancini for their help and useful discussions in some aspects of my research. Thanks to Dr George Katsirelos for some useful discussions on the CFG con- straint. Thanks to Assistant Professor Willem-Jan van Hoeve and Associate Professor Louis-Martin Rousseau for some useful discussions on the edit- distance based SOFTREGULAR constraint. Thanks to Associate Professor Xi- ang Fu, Dr Adam Kiezun,˙ and Dr Prateek Saxena for some useful discussions on SUSHI,HAMPI, and KALUZA respectively. I enjoyed working in the ASTRA group on constraint programming. I would like to thank Karl Sundequist for helping me to write the Swedish sum- mary of this thesis. Thanks to Farshid Hassani Bijarbooneh for some useful discussions on COMET and GECODE, and for kindly sharing with me an apart- ment and some delicious Persian food in 2010. Thanks to Loïc Blet for proof- reading one of my COMET programs. Thanks also to Dr Jean-Noël Monette, Joseph Scott, María Andreína Francisco Rodríguez, and Farshid Hassani Bi- jarbooneh for presenting some interesting papers and sharing some delicious cookies in the ASTRA journal club. Special thanks to CSC and NUDT for providing me with financial support during my PhD research. Thanks to Associate Professor Lars-Henrik Eriksson and the Computing Science Division (CSD) for kindly providing me with fi- nancial support after the expiration of my Chinese scholarship and for offering me an English course, and thanks to Maria Njoo for teaching me. Thanks to Ulrika Andersson and Anne-Marie Jalstrand at the IT department for their help and support. Thanks also to Mr Rui Fan and Mr Wei Wang at the Education Section of the Chinese Embassy in Sweden for their help and support. I would like to thank the Association for Constraint Programming (ACP) for giving me financial support to attend the ACP summer schools 2010 and 2011 and the CP 2009 conference. Thanks also to the ACM Special Interest Group on Applied Computing (SIGAPP) for giving me a student travel award to attend the ACM SAC 2012 conference. I would also like to thank Professor Wang Yi for his encouragement and help. Special thanks to Minpeng Zhu. Thank you for always being a good listener and joining me with lunch. Thanks to Nan Guan for always being a big brother with numerous encouragementand suggestion. I am grateful to the Chinese student community at house one of the IT department: Minpeng Zhu, Nan Guan, Cheng Xu, Ran Ji, Xiaoyue Pan, Ping Lu, and Yunyun Zhu. Thank you for inviting me to many interesting games and parties with delicious Chi- nese food. Thanks also to my NUDT colleagues: Jinping Yuan, Longming Dong, Lidong Cheng, Xin Lu, Chaofang Zhang, Haining Wang, and Fei Cai for their help and encouragement. Last, but not least, I would like to thank my parents, my wife, and my son for all their love and support. Without your encouragement and understanding, it would be impossible for me to finish this thesis. List of papers This thesis is based on the following papers, which are referred to in the text by their Roman numerals. I Jun He, Pierre Flener, and Justin Pearson. An automaton Constraint for Local Search. Fundamenta Informaticae, 107(2–3):223–248, 2011. An early version is published in Electronic Proceedings in Theoretical Computer Science, 5:13–25, 2009, and is then also published in Proceedings of RCRA’09, the 16th RCRA International Workshop on Experimental Evaluation of Algorithms for Solving Problems with Combinatorial Explosion. II Jun He, Pierre Flener, and Justin Pearson. Solution Neighbourhoods for Constraint-Directed Local Search. In: S. Bistarelli, E. Monfroy, and B. O’Sullivan (editors), Proceedings of SAC/CSP’12, the track on Constraint Solving and Programming of the 27th ACM Symposium on Applied Computing, pages 74–79. ACM Press, 2012. III Jun He, Pierre Flener, and Justin Pearson. Underestimating the Cost of a Soft Constraint is Dangerous: Revisiting the Edit-Distance Based Soft Regular Constraint. Accepted under minor revisions in Journal of Heuristics. IV Jun He, Pierre Flener, and Justin Pearson. Solving String Constraints: The Case for Constraint Programming. Submitted to a conference. Reprints were made with permission from the publishers. Papers I, II and IV are verbatim copies of the original papers but are reformatted to the one- column format of this thesis. Comments on my Participation Paper I: I am the principal author of this paper. I proposed the ideas, designed the algorithms, performed the experiments, and participated in writing the paper. My supervisors contributed to the discussions. Paper II: I am the principal author of this paper. I proposed the ideas, designed the algorithms, performed the experiments, and was the lead writer of the paper. My supervisors contributed to the discussions. Paper III: I am the principal author of this paper. I proposed the ideas, de- signed the algorithms, performed the experiments, and was the lead writer of the paper. My supervisors contributed to the discussions. Paper IV: I am the principal author of this paper. I proposed the ideas, de- signed the algorithms, performed the experiments, and was the lead writer of the paper. My supervisors contributed to the discussions and wrote the intro- duction and conclusion of the paper. Summary in Swedish Constraint Programming (CP, e.g., se [2]) är en hög nivå deklarativa paradigm som använder en uppsättning villkor för att modellera och lösa kombinatoriska problem. Om en CP språk saknar ett villkor som gör det möjligt att formulera en viss modell av ett kombinatoriskt problem, så har modelleraren traditionellt tre val enligt följande: 1. att byta till ett annat CP språk som har alla nödvändiga villkor; 2. att formulera en annan modell som inte kräver de saknade villkoren; 3. att implementera de saknade villkoren i det låg-nivå språk valt av CP språket. Det första alternativet är ofta omöjligt i praktiken, eftersom det inte nöd- vändigtvis finns någon CP språk som innehåller alla nödvändiga villkor; det andra alternativet kan vara svårt eller göra så att problemet löses ineffektivt.