7,839 research outputs found
On Applying Or-Parallelism and Tabling to Logic Programs
The past years have seen widening efforts at increasing Prolog's
declarativeness and expressiveness. Tabling has proved to be a viable technique
to efficiently overcome SLD's susceptibility to infinite loops and redundant
subcomputations. Our research demonstrates that implicit or-parallelism is a
natural fit for logic programs with tabling. To substantiate this belief, we
have designed and implemented an or-parallel tabling engine -- OPTYap -- and we
used a shared-memory parallel machine to evaluate its performance. To the best
of our knowledge, OPTYap is the first implementation of a parallel tabling
engine for logic programming systems. OPTYap builds on Yap's efficient
sequential Prolog engine. Its execution model is based on the SLG-WAM for
tabling, and on the environment copying for or-parallelism.
Preliminary results indicate that the mechanisms proposed to parallelize
search in the context of SLD resolution can indeed be effectively and naturally
generalized to parallelize tabled computations, and that the resulting systems
can achieve good performance on shared-memory parallel machines. More
importantly, it emphasizes our belief that through applying or-parallelism and
tabling to logic programs the range of applications for Logic Programming can
be increased.Comment: 45 pages, 12 figures, to appear in the journal of Theory and Practice
of Logic Programming (TPLP
Efficient Instance Retrieval of Subgoals for Subsumptive Tabled Evaluation of Logic Programs
Tabled evaluation is an implementation technique that solves some problems of
traditional Prolog systems in dealing with recursion and redundant
computations. Most tabling engines determine if a tabled subgoal will produce
or consume answers by using variant checks. A more refined method, named call
subsumption, considers that a subgoal A will consume from a subgoal B if A is
subsumed by (an instance of) B, thus allowing greater answer reuse. We recently
developed an extension, called Retroactive Call Subsumption, that improves upon
call subsumption by supporting bidirectional sharing of answers between
subsumed/subsuming subgoals. In this paper, we present both an algorithm and an
extension to the table space data structures to efficiently implement instance
retrieval of subgoals for subsumptive tabled evaluation of logic programs.
Experiments results using the YapTab tabling system show that our
implementation performs quite well on some complex benchmarks and is robust
enough to handle a large number of subgoals without performance degradation.Comment: Theory and Practice of Logic Programming, 27th Int'l. Conference on
Logic Programming (ICLP 2011) Special Issue, volume 11, issue 4-
An Efficient and Flexible Engine for Computing Fixed Points
An efficient and flexible engine for computing fixed points is critical for
many practical applications. In this paper, we firstly present a goal-directed
fixed point computation strategy in the logic programming paradigm. The
strategy adopts a tabled resolution (or memorized resolution) to mimic the
efficient semi-naive bottom-up computation. Its main idea is to dynamically
identify and record those clauses that will lead to recursive variant calls,
and then repetitively apply those alternatives incrementally until the fixed
point is reached. Secondly, there are many situations in which a fixed point
contains a large number or even infinite number of solutions. In these cases, a
fixed point computation engine may not be efficient enough or feasible at all.
We present a mode-declaration scheme which provides the capabilities to reduce
a fixed point from a big solution set to a preferred small one, or from an
infeasible infinite set to a finite one. The mode declaration scheme can be
characterized as a meta-level operation over the original fixed point. We show
the correctness of the mode declaration scheme. Thirdly, the mode-declaration
scheme provides a new declarative method for dynamic programming, which is
typically used for solving optimization problems. There is no need to define
the value of an optimal solution recursively, instead, defining a general
solution suffices. The optimal value as well as its corresponding concrete
solution can be derived implicitly and automatically using a mode-directed
fixed point computation engine. Finally, this fixed point computation engine
has been successfully implemented in a commercial Prolog system. Experimental
results are shown to indicate that the mode declaration improves both time and
space performances in solving dynamic programming problems.Comment: 26 page
XSB: Extending Prolog with Tabled Logic Programming
The paradigm of Tabled Logic Programming (TLP) is now supported by a number
of Prolog systems, including XSB, YAP Prolog, B-Prolog, Mercury, ALS, and Ciao.
The reasons for this are partly theoretical: tabling ensures termination and
optimal known complexity for queries to a large class of programs. However the
overriding reasons are practical. TLP allows sophisticated programs to be
written concisely and efficiently, especially when mechanisms such as tabled
negation and call and answer subsumption are supported. As a result TLP has now
been used in a variety of applications from program analysis to querying over
the semantic web. This paper provides a survey of TLP and its applications as
implemented in XSB Prolog, along with discussion of how XSB supports tabling
with dynamically changing code, and in a multi-threaded environment
Swapping Evaluation: A Memory-Scalable Solution for Answer-On-Demand Tabling
One of the differences among the various approaches to suspension-based
tabled evaluation is the scheduling strategy. The two most popular strategies
are local and batched evaluation.
The former collects all the solutions to a tabled predicate before making any
one of them available outside the tabled computation. The latter returns
answers one by one before computing them all, which in principle is better if
only one answer (or a subset of the answers) is desired.
Batched evaluation is closer to SLD evaluation in that it computes solutions
lazily as they are demanded, but it may need arbitrarily more memory than local
evaluation, which is able to reclaim memory sooner. Some programs which in
practice can be executed under the local strategy quickly run out of memory
under batched evaluation. This has led to the general adoption of local
evaluation at the expense of the more depth-first batched strategy.
In this paper we study the reasons for the high memory consumption of batched
evaluation and propose a new scheduling strategy which we have termed swapping
evaluation. Swapping evaluation also returns answers one by one before
completing a tabled call, but its memory usage can be orders of magnitude less
than batched evaluation. An experimental implementation in the XSB system shows
that swapping evaluation is a feasible memory-scalable strategy that need not
compromise execution speed.Comment: 16 pages, 5 figures, published in TPLP 201
Linear Tabling Strategies and Optimizations
Recently, the iterative approach named linear tabling has received
considerable attention because of its simplicity, ease of implementation, and
good space efficiency. Linear tabling is a framework from which different
methods can be derived based on the strategies used in handling looping
subgoals. One decision concerns when answers are consumed and returned. This
paper describes two strategies, namely, {\it lazy} and {\it eager} strategies,
and compares them both qualitatively and quantitatively. The results indicate
that, while the lazy strategy has good locality and is well suited for finding
all solutions, the eager strategy is comparable in speed with the lazy strategy
and is well suited for programs with cuts. Linear tabling relies on depth-first
iterative deepening rather than suspension to compute fixpoints. Each cluster
of inter-dependent subgoals as represented by a top-most looping subgoal is
iteratively evaluated until no subgoal in it can produce any new answers. Naive
re-evaluation of all looping subgoals, albeit simple, may be computationally
unacceptable. In this paper, we also introduce semi-naive optimization, an
effective technique employed in bottom-up evaluation of logic programs to avoid
redundant joins of answers, into linear tabling. We give the conditions for the
technique to be safe (i.e. sound and complete) and propose an optimization
technique called {\it early answer promotion} to enhance its effectiveness.
Benchmarking in B-Prolog demonstrates that with this optimization linear
tabling compares favorably well in speed with the state-of-the-art
implementation of SLG.Comment: 29 pages, 1 figure, TPL
Combinatorial Search With Picat
Picat, a new member of the logic programming family, follows a different
doctrine than Prolog in offering the core logic programming concepts: arrays
and maps as built-in data types; implicit pattern matching with explicit
unification and explicit non-determinism; functions for deterministic
computations; and loops for convenient scripting and modeling purposes. Picat
provides facilities for solving combinatorial search problems, including a
common interface with CP, SAT, and MIP solvers, tabling for dynamic
programming, and a module for planning. Picat's planner module, which is
implemented by the use of tabling, has produced surprising and encouraging
results. Thanks to term-sharing and resource-bounded tabled search, Picat
overwhelmingly outperforms the cutting-edge ASP and PDDL planners on the
planning benchmarks used in recent ASP competitions
Detecting Unsolvable Queries for Definite Logic Programs
In solving a query, the SLD proof procedure for definite programs sometimes
searches an infinite space for a non existing solution. For example, querying a
planner for an unreachable goal state. Such programs motivate the development
of methods to prove the absence of a solution. Considering the definite program
and the query ``<- Q'' as clauses of a first order theory, one can apply model
generators which search for a finite interpretation in which the program
clauses as well as the clause ``false <- Q'' are true. This paper develops a
new approach which exploits the fact that all clauses are definite. It is based
on a goal directed abductive search in the space of finite pre-interpretations
for a pre-interpretation such that ``Q'' is false in the least model of the
program based on it. Several methods for efficiently searching the space of
pre-interpretations are presented. Experimental results confirm that our
approach find solutions with less search than with the use of a first order
model generator.Comment: 32 pages including appendix. A preliminary version appeared in
proceedings PLILP/ALP98 (Springer LNCS 1490) This version, without appendix
appeared in Journal Functional and Logic Programming 199
A Simple and Efficient Lock-Free Hash Trie Design for Concurrent Tabling
A critical component in the implementation of a concurrent tabling system is
the design of the table space. One of the most successful proposals for
representing tables is based on a two-level trie data structure, where one trie
level stores the tabled subgoal calls and the other stores the computed
answers. In this work, we present a simple and efficient lock-free design where
both levels of the tries can be shared among threads in a concurrent
environment. To implement lock-freedom we took advantage of the CAS atomic
instruction that nowadays can be widely found on many common architectures. CAS
reduces the granularity of the synchronization when threads access concurrent
areas, but still suffers from low-level problems such as false sharing or cache
memory side-effects. In order to be as effective as possible in the concurrent
search and insert operations over the table space data structures, we based our
design on a hash trie data structure in such a way that it minimizes potential
low-level synchronization problems by dispersing as much as possible the
concurrent areas. Experimental results in the Yap Prolog system show that our
new lock-free hash trie design can effectively reduce the execution time and
scale better than previous designs.Comment: To appear in Theory and Practice of Logic Programming (TPLP
Single Time-Stamped Tries for Retroactive Call Subsumption
Tabling is an evaluation strategy for Prolog programs that works by storing
answers in a table space and then by using them in similar subgoals. Some
tabling engines use call by subsumption, where it is determined that a subgoal
will consume answers from a more general subgoal in order to reduce the search
space and increase efficiency. We designed an extension, named Retroactive Call
Subsumption (RCS), that implements call by subsumption independently of the
call order, thus allowing a more general subgoal to force previous called
subgoals to become answer consumers. For this extension, we propose a new table
space design, the Single Time Stamped Trie (STST), that is organized to make
answer sharing across subsumed/subsuming subgoals simple and efficient. In this
paper, we present the new STST table space design and we discuss the main
modifications made to the original Time Stamped Tries approach to
non-retroactive call by subsumption. In experimental results, with programs
that stress some deficiencies of the new STST design, some overheads may be
observed, however the results achieved with more realistic programs greatly
offset these overheads.Comment: Online Proceedings of the 11th International Colloquium on
Implementation of Constraint LOgic Programming Systems (CICLOPS 2011),
Lexington, KY, U.S.A., July 10, 201
- …