212 research outputs found
The Ciao clp(FD) library. A modular CLP extension for Prolog
We present a new free library for Constraint Logic Programming over Finite Domains, included with the Ciao Prolog system. The library is entirely written in Prolog, leveraging on Ciao's module system and code transformation capabilities in order to achieve a highly modular design without compromising performance. We describe the interface,
implementation, and design rationale of each modular component. The library meets several design goals: a high level of modularity, allowing the individual components to be replaced by different versions; highefficiency, being competitive with other TT> implementations; a glass-box
approach, so the user can specify new constraints at different levels; and a Prolog implementation, in order to ease the integration with Ciao's code analysis components. The core is built upon two small libraries which implement integer ranges and closures. On top of that, a finite domain
variable datatype is defined, taking care of constraint reexecution depending on range changes. These three libraries form what we call the TT> kernel of the library. This TT> kernel is used in turn to implement several higher-level finite domain constraints, specified using indexicals. Together with a labeling module this layer forms what we name the TT> solver. A final level integrates the CLP (J7©) paradigm with our TT> solver. This is achieved using attributed variables and a compiler from
the CLP (J7©) language to the set of constraints provided by the solver. It should be noted that the user of the library is encouraged to work in any of those levels as seen convenient: from writing a new range module to enriching the set of TT> constraints by writing new indexicals
Towards a Generic Trace for Rule Based Constraint Reasoning
CHR is a very versatile programming language that allows programmers to
declaratively specify constraint solvers. An important part of the development
of such solvers is in their testing and debugging phases. Current CHR
implementations support those phases by offering tracing facilities with
limited information. In this report, we propose a new trace for CHR which
contains enough information to analyze any aspects of \CHRv\ execution at some
useful abstract level, common to several implementations. %a large family of
rule based solvers. This approach is based on the idea of generic trace. Such a
trace is formally defined as an extension of the semantics of
CHR. We show that it can be derived form the SWI Prolog CHR trace
Detecting and Explaining Conflicts in Attributed Feature Models
Product configuration systems are often based on a variability model. The
development of a variability model is a time consuming and error-prone process.
Considering the ongoing development of products, the variability model has to
be adapted frequently. These changes often lead to mistakes, such that some
products cannot be derived from the model anymore, that undesired products are
derivable or that there are contradictions in the variability model. In this
paper, we propose an approach to discover and to explain contradictions in
attributed feature models efficiently in order to assist the developer with the
correction of mistakes. We use extended feature models with attributes and
arithmetic constraints, translate them into a constraint satisfaction problem
and explore those for contradictions. When a contradiction is found, the
constraints are searched for a set of contradicting relations by the
QuickXplain algorithm.Comment: In Proceedings FMSPLE 2015, arXiv:1504.0301
TOR: modular search with hookable disjunction
Horn Clause Programs have a natural exhaustive depth-first procedural
semantics. However, for many programs this semantics is
ineffective. In order to compute useful solutions, one needs the
ability to modify the search method that explores the alternative
execution branches.
Tor, a well-defined hook into Prolog disjunction, provides this ability.
It is light-weight thanks to its library approach and efficient
because it is based on program transformation.
Tor is general enough to mimic search-modifying
predicates like ECLiPSe's search/6. Moreover, Tor supports
modular composition of search methods and other hooks.
The Tor library is already
provided and used as an add-on to SWI-Prolog.publisher: Elsevier
articletitle: Tor: Modular search with hookable disjunction
journaltitle: Science of Computer Programming
articlelink: http://dx.doi.org/10.1016/j.scico.2013.05.008
content_type: article
copyright: Copyright © 2013 Elsevier B.V. All rights reserved.status: publishe
Logic Programming with Max-Clique and its Application to Graph Coloring (Tool Description)
This paper presents pl-cliquer, a Prolog interface to the
cliquer tool for the maximum clique problem.
Using pl-cliquer facilitates a programming style that allows logic programs to integrate with other tools such as: Boolean
satisfiability solvers, finite domain constraint solvers, and graph isomorphism tools.
We illustrate this programming style to solve the Graph Coloring problem, applying a symmetry break that derives from finding a maximum clique in the input graph.
We present an experimentation of the resulting Graph Coloring solver on two benchmarks, one from the graph coloring community and the other from the examination timetabling community.
The implementation of pl-cliquer consists of two components: A lightweight C interface, connecting cliquer\u27s C library and
Prolog, and a Prolog module which loads the library.
The complete tool is available as a SWI-Prolog module
- …