Abstract
The union-find algorithm can be seen as solving simple equations between variables or constants. With a few lines of code change, we generalise its implementation in CHR from equality to arbitrary binary relations. By choosing the appropriate relations, we can derive fast incremental algorithms for solving certain propositional logic (SAT) problems and polynomial equations in two variables. In general, we prove that when the relations are bijective functions, our generalisation yields a correct algorithm. We also show that bijectivity is a necessary condition for correctness if the relations include the identity function.
The rules of our generic algorithm have additional properties that make them suitable for incorporation into constraint solvers: from classical union-find, they inherit a compact solved form and quasi-linear time and space complexity. By nature of CHR, they are anytime and online algorithms. They solve and simplify the constraints in the problem, and can test them for entailment, even when the constraints arrive incrementally.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Aspvall, B., Plass, M.F., Tarjan, R.E.: A linear time algorithm for testing the truth of certain quantified Boolean formulas. Information Processing Letters 8, 121–123 (1979)
Aspvall, B., Shiloach, Y.: A fast algorithm for solving systems of linear equations with two variables per equation. Linear Algebra and its Applications 34, 117–124 (1980)
Beeri, C., Bernstein, P.A.: Computational problems related to the design of normal form relational schemas. ACM Trans. Database Syst. 4(1), 30–59 (1979)
Dowling, W.F., Gallier, J.H.: Linear-time algorithms for testing the satisfiability of propositional horn formulae. J. Log. Program. 1(3), 267–284 (1984)
Duck, G.J., Stuckey, P.J., García de la Banda, M., Holzbaur, C.: The Refined Operational Semantics of Constraint Handling Rules. In: Demoen, B., Lifschitz, V. (eds.) ICLP 2004. LNCS, vol. 3132, pp. 90–104. Springer, Heidelberg (2004)
Frühwirth, T., Abdennadher, S.: Essentials of Constraint Programming. Springer, Heidelberg (2003)
Frühwirth, T.: Theory and Practice of Constraint Handling Rules, Special Issue on Constraint Logic Programming. Journal of Logic Programming 37(1–3), 95–138 (1998)
Frühwirth, T.: Deriving linear-time algorithms from union-find in chr. In: Schrijvers, T., Frühwirth, T. (eds.) Third Workshop on Constraint Handling Rules, Venice, Italy (July 2006)
Frühwirth, T.: Constraint Handling Rules. Cambridge University Press, Cambridge (to appear, 2008)
Galil, Z., Italiano, G.F.: Data Structures and Algorithms for Disjoint Set Union Problems. ACM Comp. Surveys 23(3), 319ff (1991)
Joseph, B., Kruskal, J.B.: On the shortest spanning subtree of a graph and the traveling salesman problem. Proceedings of the American Mathematical Society 7, 48–50 (1956)
Minoux, M.: LTUR: a simplified linear-time unit resolution algorithm for Horn formulae and computer implementation. Information Processing Letters 29(1), 1–12 (1988)
Schrijvers, T., Frühwirth, T.: Analysing the CHR Implementation of Union-Find. In: 19th Workshop on (Constraint) Logic Programming (W(C)LP 2005), Ulmer Informatik-Berichte 2005-01, University of Ulm, Germany (February 2005)
Schrijvers, T., Frühwirth, T.: Optimal union-find in constraint handling rules, programming pearl. Theory and Practice of Logic Programming (TPLP) 6(1) (2006)
Sneyers, J., Schrijvers, T., Demoen, B.: The Computational Power and Complexity of Constraint Handling Rules. In: Second Workshop on Constraint Handling Rules, at ICLP 2005, Sitges, Spain (October 2005)
Tarjan, R.E., van Leeuwen, J.: Worst-case Analysis of Set Union Algorithms. J. ACM 31(2), 245–281 (1984)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Frühwirth, T. (2008). Quasi-Linear-Time Algorithms by Generalisation of Union-Find in CHR. In: Fages, F., Rossi, F., Soliman, S. (eds) Recent Advances in Constraints. CSCLP 2007. Lecture Notes in Computer Science(), vol 5129. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-89812-2_7
Download citation
DOI: https://doi.org/10.1007/978-3-540-89812-2_7
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-89811-5
Online ISBN: 978-3-540-89812-2
eBook Packages: Computer ScienceComputer Science (R0)