An Experimental Comparison of Constraint Logic Programming and Answer Set Programming
Agostino Dovier Andrea Formisano Enrico Pontelli Universita` di Udine, Universita` di Perugia New Mexico State University Dip. di Matematica e Informatica Dip. di Matematica e Informatica Dept. of Computer Science [email protected] [email protected] [email protected]
Abstract are encoded as atomic formulae and relationships as pro- gram rules. It is well-known (Marek & Truszczynski 1991; Answer Set Programming (ASP) and Constraint Logic Baral 2003) that, given a propositional normal logic pro- Programming over finite domains (CLP(FD)) are two gram P , deciding whether P admits an answer set (Gel- declarative programming paradigms that have been ex- fond & Lifschitz 1988) is a NP-complete problem. As a tensively used to encode applications involving search, optimization, and reasoning (e.g., commonsense rea- consequence, any NP-complete problem can be encoded soning and planning). This paper presents experimen- as a propositional normal logic program under answer set tal comparisons between the declarative encodings of semantics. Answer-set solvers are programs designed to various computationally hard problems in both frame- compute the answer sets of normal logic programs. Some works. The objective is to investigate how the solvers solvers provide also syntactic extensions to facilitate pro- in the two domains respond to different problems, high- gram development—e.g., limited forms of aggregation (Si- lighting strengths and weaknesses of their implementa- mons 2000)—and classes of optimization statements, used tions, and suggesting criteria for choosing one approach to select answer sets that maximize or minimize an objec- over the other. Ultimately, the work in this paper is ex- tive function dependent on the content of the answer set. pected to lay the foundations for transfer of technology between the two domains, e.g., suggesting ways to use 1 An alternative framework, frequently adopted to handle CLP(FD) in the execution of ASP. NP-complete, combinatorial, and optimization problems, is CLP(FD) (Jaffar & Maher 1994; Marriott & Stuckey 1998). In this context, a finite domain of objects (typically integers) Introduction is associated to each variable in the problem specification, The objective of this work is to experimentally compare and the problem-derived relationships between such vari- the use of two distinct logic-based paradigms, tradition- ables are encoded as constraints (e.g., s = t, s