Download Datalog Educational System V3.10 User`s Manual

Transcript
Universidad Complutense de Madrid
5.20.4.1
Datalog Educational System
Complete Computations (/optimize_cc)
Each call during the computation of a stratum (stratum saturation) is
remembered in addition to its outcome (in the answer table). Even when the calls are
removed in each fixpoint iteration (recall Section 5.20.2), most general ones do persist
as a collateral data structure to be used for saving computations should any of them is
called again during either computing a higher stratum or a subsequent query solving.
'cc' stands for completed computation, so that if a call is marked as a completed
computation, it is not even tried if called again. This means the following two points: 1)
During the computation of the memo function, calls already computed are not tried to
be solved again, and only the entries in the memo table are returned. 2) Moreover,
computing the memo function is completely avoided if a subsuming already-computed
call can be found. In the first case, that saves solving goals in computing the memo
function. In the second case, that completely saves fixpoint computation.
The following system session shows how this optimization works. First, we
enable statistics collection, enable verbose output to automatically display statistics
results, disable all the optimizations, assert the fact p(1) and submit the query p(X):
DES> /statistics on
DES> /verbose on
DES> /optimize_cc off
Info: Complete computations optimization is off.
DES> /optimize_ep off
Info: Extensional predicate optimization is off.
DES> /optimize_nrp off
Info: Non-recursive predicates optimization is off.
DES> /optimize_st off
Info: Stratum optimization is already disabled.
DES> /assert p(1)
Info: Computing predicate dependency graph...
Info: Computing strata...
Info: Rule asserted.
DES> p(X)
Info: Parsing query...
Info: Query successfully parsed.
Info: Solving query p(X)...
Info: Displaying query answer...
Info: Sorting answer...
{
p(1)
}
Info: 1 tuple computed.
Info: Fixpoint iterations: 2
Info: EDB retrievals
: 2
Info: IDB retrievals
: 0
Info: ET retrievals
: 4
Info: ET look-ups
: 6
Info: CT look-ups
: 2
Info: CF look-ups
: 0
As the statistics show, 2 fixpoint iterations have been needed to deduce the
output. In the first one, the rule p(1) is read for the first time. Then, in the second
iteration, it is read again and as the answer table has not changed, then this means that
Fernando Sáenz-Pérez
227/274