tclbdd

Check-in [9b2f195e16]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improve FDDD documentation, and make the 'profile' method return something sensible
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9b2f195e16464e4cf0404c79c38bb0875cac4f49
User & Date: kbk 2014-08-02 20:45:13
Context
2014-08-02
21:23
Add leading comment so as not to confuse 'man' check-in: 668a835e53 user: kbk tags: trunk
20:45
Improve FDDD documentation, and make the 'profile' method return something sensible check-in: 9b2f195e16 user: kbk tags: trunk
2014-07-10
03:30
progress toward a man page for tclfddd check-in: 337aa1f548 user: kbk tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to doc/tclfddd.n.


1
2
3
4
5
6
7
..
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
...
367
368
369
370
371
372
373
374
375






























376

377


378



379
380
381
382
383
384

'\" tclfddd.n --
'\" 
'\"     Documentation for the 'tclfddd' package
'\" 
'\" Copyright (c) 2014 by Kevin B. Kenny
'\" 
'\" See the file "license.terms" for information on usage and redistribution of
................................................................................
\fIdb\fR \fBset\fR \fIresultRelation\fR \fIrelation1\fR
\fIdb\fR \fBunion\fR \fIresultRelation\fR \fIrelation1\fR

\fIdb\fR \fBcolumns\fR ?\fIrelation\fR?
\fIdb\fR \fBenumerate\fR \fIdictVar\fR \fIrelation\fR \fIscript\fR
\fIdb\fR \fBgc\fR
\fIdb\fR \fBprofile\fR \fIrelation\fR

.fi
.SH "ARGUMENTS"
.TP
\fIdbname\fR
Name to give a Finite Domain Decision Diagram (FDDD) database.
.TP
\fIdomain\fR
................................................................................
                  # a parent of person2
    [db project grandparent temp3];
                  # get rid of the 'person3' column
                  # and store the 'grandparent' relation
"
findGrandparents
.CE
.\" enumerate
.\" columns, gc, profile






























.SH "SEE ALSO"

.SH "KEYWORDS"


.SH "REFERENCES"



.SH "COPYRIGHT"
Copyright (c) 2014 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"
>







 







<







 







|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

>

>
>

>
>
>






1
2
3
4
5
6
7
8
..
88
89
90
91
92
93
94

95
96
97
98
99
100
101
...
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
'\"
'\" tclfddd.n --
'\" 
'\"     Documentation for the 'tclfddd' package
'\" 
'\" Copyright (c) 2014 by Kevin B. Kenny
'\" 
'\" See the file "license.terms" for information on usage and redistribution of
................................................................................
\fIdb\fR \fBset\fR \fIresultRelation\fR \fIrelation1\fR
\fIdb\fR \fBunion\fR \fIresultRelation\fR \fIrelation1\fR

\fIdb\fR \fBcolumns\fR ?\fIrelation\fR?
\fIdb\fR \fBenumerate\fR \fIdictVar\fR \fIrelation\fR \fIscript\fR
\fIdb\fR \fBgc\fR
\fIdb\fR \fBprofile\fR \fIrelation\fR

.fi
.SH "ARGUMENTS"
.TP
\fIdbname\fR
Name to give a Finite Domain Decision Diagram (FDDD) database.
.TP
\fIdomain\fR
................................................................................
                  # a parent of person2
    [db project grandparent temp3];
                  # get rid of the 'person3' column
                  # and store the 'grandparent' relation
"
findGrandparents
.CE
.SH "DIRECT METHODS"
The following methods exist to query the content of the database or perform
a service against it. They operate directly, rather than returning a block
of generated code.
.TP
\fIdb\fR \fBenumerate\fR \fIdictVar\fR \fIrelation\fR \fIscript\fR
This command is the basic way that a Tcl script queries a relation.
The \fIdb\fR is the name of a database.
The \fIdictVar\fR parameter gives the name of a Tcl variable that will
hold a dictionary whose keys are column names and whose values are column
values. The \fIrelation\fR parameter gives the name of a relation, and the
\fIscript\fR parameter holds a Tcl script. The given script is executed
once for each tuple in the relation, with the given \fIdictVar\fR set to hold
the tuple's values. \fBbreak\fR, \fBcontinue\fR, \fBreturn\fR, errors, and
unusual status returns within \fIscript\fR  all have the same meaning that 
they do with all loops in Tcl code.
.TP
\fIdb\fR \fBgc\fR This command requests that the database named
\fIdb\fR perform a garbage collection and free any unused memory. It is
intended primarily for debugging purposes, since the underlying implementation
gains a performance advantage from keeping the unused objects as a cache.
.TP
\fIdb\fR \fBprofile\fR \fIrelation\fR
This command is intended for performance analysis of the representation
of relations. It queries \fIdb\fR for the number of Binary Decision Diagram
nodes required to represent \fIrelation\fR. The result is a list whose elements
appear in groups of three. The first element in each group is the name of
a column; the second is the bit position (0 is least significant) within the
column, and the third is the number of nodes in the BDD that query the given
bit. A series of numbers that increase exponentially followed by an
exponential decrease suggests that the variables were declared in an
inappropriate interleaving.
.SH "SEE ALSO"
Bdd(3), tclbdd(n), datalog(n)
.SH "KEYWORDS"
finite domain decision diagram, FDDD, binary decision diagram, BDD,
Boolean function, deduction, deductive database, logic programming.
.SH "REFERENCES"
The implementation of the tclfddd package is greatly influenced by
the BDDBDDB library (http://bddbddb,sourceforge.net/) and the papers
describing it that are available from the same site.
.SH "COPYRIGHT"
Copyright (c) 2014 by Kevin B. Kenny.
'\" Local Variables:
'\" mode: nroff
'\" End:
'\"

Changes to library/tclfddd.tcl.

852
853
854
855
856
857
858
859
860



861
862
863
864
865

866










867
868
869
870
871
872
873
    #
    #	Determines the number of BDD beads in use for each variable.
    #
    # Parameters:
    #	relation - Relation to profile
    #
    # Results:
    #	Returns a list ordered by variable level giving the number of
    #	beads at each level



    #
    # This method executes directly, rather than returning a codeburst.

    method profile {relation} {
	my relationMustExist $relation

	sys profile $relation










    }

    # Method: project
    #
    #	Uses existential quantification to project a relation onto
    #	a smaller domain.
    #







|
|
>
>
>





>
|
>
>
>
>
>
>
>
>
>
>







852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
    #
    #	Determines the number of BDD beads in use for each variable.
    #
    # Parameters:
    #	relation - Relation to profile
    #
    # Results:
    #	Returns a list ordered by variable level of elements in groups
    #	of three:
    #    - the name of a column
    #    - the bit index within the column
    #    - the number of nodes of the relation's BDD that test the given bit.
    #
    # This method executes directly, rather than returning a codeburst.

    method profile {relation} {
	my relationMustExist $relation
	set result {}
	foreach {col bit} $m_variables count [sys profile $relation] {
	    if {$count eq {}} {
		set count 0
	    }
	    if {[lsearch [dict get $m_relcolumns $relation] $col] >= 0} {
		lappend result $col $bit $count
	    } elseif {$count > 0} {
		lappend result $col? $bit $count
	    }
	}
	return $result
    }

    # Method: project
    #
    #	Uses existential quantification to project a relation onto
    #	a smaller domain.
    #