Applications of Matching Theory in Constraint Programming
Total Page:16
File Type:pdf, Size:1020Kb
Applications of Matching Theory in Constraint Programming Von der Fakultät für Elektrotechnik und Informatik der Gottfried Wilhelm Leibniz Universität Hannover zur Erlangung des Grades Doktor der Naturwissenschaften Dr. rer. nat. genehmigte Dissertation von Dipl.-Inform. Radosław Cymer geboren am 18.06.1970 in Łódź 2013 Referent: Heribert Vollmer, Leibniz Universität Hannover Korreferent: Ulrich Hertrampf, Universität Stuttgart Tag der Promotion: 16.12.2013 Einfachheit ist das Resultat der Reife. Simplicity is a result of maturity. Friedrich Schiller I would like to thank my supervisor, Prof. Heribert Vollmer, for his assistance in the preparation of this thesis. Our interesting discussions and his patient guidance were a great support. This thesis would not have been written if he had not exposed me to the world of constraint programming. At our first meeting he recommended that I read the book "Constraint Processing"by Rina Dechter in order to get to know constraint programming. This reading fascinated me and gave me the impetus to further research this interesting subject matter. In the course of time I have come to realize that constraint programming has a connection with graph theory and I have deeply researched this area. When I had thoroughly studied the book "Matching Theory"by László Lovász and Michael D. Plummer I perceived that there exists a very good field of research in matching theory in order to connect the results which can help to solve the global constraints. I have read many papers that described an algorithm that could only solve one specific kind of global constraint. Having seen the similarity between the constraints I figured that it is highly possible to discover a universal method to solve some of them at once. This thesis, as the result of my many years of research, describes how this is possible. I would also like to thank Prof. Qinglin Roger Yu for several helpful comments about the decomposition of graphs. This work could not have been fully achieved without his support. I also thank Prof. David S. Johnson for his very exciting discussions, advice, his suggesti- ons given and my answered questions regarding the complexity of some non-trivial problems. Last and by no means least, I am very grateful to my dear wife Anna (to whom this thesis is dedicated) for just being there, staying sane and keeping our family together during the past few years while I was writing this thesis. Without her help, patience and support, the achievement of this goal would have been simply impossible. I apologize to all those omitted who helped me in one way or another. Even though I have unconsciously forgotten them, I am very grateful for the aid they have given. iv Zusammenfassung Thema: Anwendungen der Matchingtheorie in der Constraint-Programmierung. Eines der wichtigsten und meist studierten Gebiete der Constraint-Programmierung sind globale Constraints. Globale Constraints sind Klassen von Constraints, die mit einer be- liebigen Anzahl von Variablen definiert sind. Diese Dissertation beschäftigt sich mit der Matchingtheorie und deren Anwendung in der Constraint-Programmierung. Es wird hierbei eine universelle Methode entwickelt, um verschiedene globale Constraints zu behandeln. Die globalen Constraints sollten eine gemeinsame Eigenschaft haben, damit sich ihre Lösung mittels eines Matchingproblems darstellen lässt. Die Grundidee ist, den globalen Constraint als einen Hilfsgraphen zu modellieren, in dem jede Lösung einem zulässigen Matching entspricht. Kanten, die zu keinem Matching gehören, können aus dem Graphen entfernt werden, da die Werte, die sie repräsentieren, keine Lösung darstellen. Solche Kanten können mit der sogenannten alternierenden Breiten- und Tiefensuche ermittelt werden. Zuerst werden all jene globalen Constraints erörtert, die sich durch bipartite Graphen darstellen lassen. Die nicht erlaubten Kanten können mit Hilfe der Dulmage-Mendelsohn Zerlegung gefunden werden. In diesem Kapitel wird ein universeller Propagierungsalgorith- mus für die folgenden Constraints (und ihre weichen Versionen) beschrieben: alldifferent, correspondence, inverse, same, used_by, gcc, und symmetric_gcc. Das nächste Kapitel betrachtet Constraints, die sich mittels Matching in einem einfa- chen Graphen lösen lassen. Hier wird u.a. der Struktursatz von Gallai-Edmonds verwendet, um die nicht erlaubten Kanten zu ermitteln. Ein Constraint, das sich mit dieser Methode lösen lässt, ist z.B. das globale Constraint symmetric_alldifferent, seine Familie, d.h. symmetric_alldifferent_except_0, symmetric_alldifferent_loop, dessen weiche Ver- sion soft_symmetric_alldifferent_var, aber auch 2-cycle, proper_forest, tour und undirected_path Constraints. Die zwei letzten Constraints sind NP-hart. Als nächstes wird das gerichtete Matching vorgestellt. Dieses Matching lässt sich mittels eines bipartiten Graphen berechnen, wobei hier die bereits entwickelte Methode angewandt werden kann. Hiermit können folgende globale Constraints gelöst werden: circuit, cycle, derangement, sowie dessen weiche Version soft_derangement_var, aber auch binary_tree, tree, path und map. Meistens repräsentieren diese Constraints jedoch NP-vollständige Pro- bleme und die Domänen der Variablen können nur partiell reduziert werden. Zuletzt soll die Lösung von Optimierungsproblemen mittels gewichtetem Matching er- örtert werden. Bei einem Graphen können sowohl Kanten als auch Knoten mit Gewich- ten versehen werden. In der Dissertation werden Optimization-Constraints betrachtet, die entweder durch knotengewichtete Graphen (wie z.B. wpa, nvalue und swdv) oder durch kantengewichtete Graphen (wie z.B. cost_alldifferent, soft_inverse_var, cost_gcc, cost_symmetric_gcc, cost_symmetric_alldifferent, cost_tour und cost_path) mo- delliert werden können. Auch hier sind einige Probleme NP-vollständig und erlauben nur partielle Propagation. v Schlagworte: Matchingtheorie, Zerlegungstheorie, extreme Mengen, Dominatoren, Constraint- Programmierung, globale Constraints, Filteralgorithmen, Komplexität vi Abstract One of the most important and most studied areas in constraint programming is global constraints. Global constraints are classes of constraints defined by a relation between a non-fixed number of variables. This thesis deals with matching theory and its application in constraint programming. Based on the existing results of matching and decomposition theory, a universal method will be devised for solving various global constraints. All constraints should have the property that their solution is representable as a match- ing problem in a particular graph. The basic idea is to model the solution to the global constraint as a maximum, perfect or complete matching. The edges belonging to no match- ing (forbidden edges) can be removed from the auxiliary graph because the corresponding values do not belong to a solution. The partition of edges can be computed by means of the so-called alternating breadth-first search and alternating depth-first search. First, the bipartite matching will be discussed and some constraints representable by a matching in a bipartite graph will be considered. The mandatory and forbidden edges can be found by means of the Dulmage-Mendelsohn Canonical Decomposition. In this chapter we describe a generic propagation routine for the following constraints and their soft versions: alldifferent, correspondence, inverse, same, used_by, gcc, and symmetric_gcc. The next chapter examines constraints solvable by the matching for general graphs. The partition of edges can be determined by means of the Gallai-Edmonds Structure Theo- rem. A constraint modeled as a maximum matching problem is the well-known constraint symmetric_alldifferent and its variants, such as symmetric_alldifferent_except_0, symmetric_alldifferent_loop and soft_symmetric_alldifferent_var, and 2-cycle, as well the proper_forest constraint. By means of the Lovasz-Plummer Decomposition the constraints tour and undirected_path can be partially solved. The next chapter introduces a directed matching. This matching can be found by means of the bipartite graph so the method proposed for the bipartite matching can be easily ap- plied. The propagation rules described in this chapter can have an application to some graph partitioning constraints such as circuit, cycle, derangement, soft_derangement_var, tree, binary_tree, path and map. These constraints are mostly intractable and therefore the domains can be only partially reduced. In the last chapter of the thesis the weighted matching is disputed. This matching can have an application to solve optimization constraints representable as a weighted match- ing problem. There are two kinds of weighted matchings: a vertex-weighted matching and an edge-weighted matching. By the first matching the constraints such as wpa, nvalue or swdv can be solved. By the second matching the constraints cost_alldifferent, soft_inverse_var, cost_gcc, cost_symmetric_gcc, cost_symmetric_alldifferent, as well as cost_tour and cost_path can be modeled. Some of the constraints represent NP- complete problems so only incomplete filtering is possible. vii Keywords: matching theory, decomposition theory, extreme sets, dominators, con- straint programming, global constraints, filtering algorithms, computational complexity viii Contents 1 Introduction1 2 Preliminaries9 2.1 Some basic concepts................................9 2.2 Complexity of algorithms............................. 11 2.3 Graph Theory.................................... 12 2.4 Matching Theory.................................