[thebeast] r746 committed - improved factorization

5 views
Skip to first unread message

codesite...@google.com

unread,
Mar 28, 2010, 10:30:03 PM3/28/10
to thebeas...@googlegroups.com
Revision: 746
Author: sebastian.riedel
Date: Sun Mar 28 19:29:00 2010
Log: improved factorization
http://code.google.com/p/thebeast/source/detail?r=746

Added:
/branches/thefuture-modules/thebeast-core/src/main/lyx/aaai.bst
Modified:

/branches/thefuture-modules/thebeast-apps/src/main/scala/org/riedelcastro/thebeast/apps/DependencyParsing.scala
/branches/thefuture-modules/thebeast-core/src/main/lyx/starai.lyx

/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/Term.scala

/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/booleans/BooleanTerm.scala

/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/combinatorics/SpanningTreeConstraint.scala

/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/doubles/Factorizer.scala

/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/solve/SumProductBeliefPropagation.scala

=======================================
--- /dev/null
+++ /branches/thefuture-modules/thebeast-core/src/main/lyx/aaai.bst Sun Mar
28 19:29:00 2010
@@ -0,0 +1,1192 @@
+%Filename: AAAI.bst
+% BibTeX `aaai' style file for BibTeX version 0.99c, LaTeX version 2.09
+% Version of 22 February 2008
+% Place it in a file called aaai.bst in the BibTeX search path. (Placing it
+% in the same directory as the LaTeX document should also work.)
+% Support for named citations is provided by named.sty
+% This version was made by modifying the master file made by
+% Oren Patashnik (PATA...@SCORE.STANFORD.EDU)
+% Copyright (C) 1985, all rights reserved.
+% Modifications Copyright (C) 1988, 1989, 1994, Peter F. Patel-Schneider
+% Copying of this file is authorized only if either
+% (1) you make absolutely no changes to your copy, including name, or
+% (2) if you do make changes, you name it something other than
+% btxbst.doc, plain.bst, unsrt.bst, alpha.bst, and abbrv.bst.
+% This restriction helps ensure that all standard styles are identical.
+% This style is NOT guaranteed to work. It is provided in the hope
+% that it will make the preparation of papers easier.
+%
+% There are undoubtably bugs in this style. If you make bug fixes,
+% improvements, etc. please us know (www.aaai.org)
+% The preparation of this modified file was supported by Schlumberger Palo
+% Alto Research and AT\&T Bell Laboratories.
+% Modifications Copyright (C) 1990. Sunil Issar s...@cs.cmu.edu
+% Modified the file so that the Bibliography style is closer to the
+% one specified in the Instructions to Authors for AAAI papers.
+% This style is NOT guaranteed to work. It is provided in the hope
+% that it will make the preparation of papers easier.
+% Standard disclaimers apply. Send comments etc., to s...@cs.cmu.edu
+% This file can be used in other conferences as long as credit to the
+% authors and supporting agencies is retained, this notice is not changed,
+% and further modification or reuse is not restricted.
+% Name format in citations:
+% single authorFirst
+% two authorsFirst and Second
+% three authorsFirst, Second, and Third
+% more authorsFirst et al.
+%
+% Bibliography format
+% author. date. other.
+% Author format
+% single authorFirst, Initials
+% two authorsFirst, Initials, and Second, Initials
+% more authorsFirst, Initials; ...; and Last, Initials
+%
+% Reference list ordering: alphabetical by author or whatever passes
+% for author in the absence of one.
+%
+% This BibTeX style has support for short (year only) citations. This
+% is done by having the citations actually look like
+% \citeauthoryear{author-info}{year}
+% The LaTeX style has to have support for this
+ENTRY
+{ address
+author
+booktitle
+chapter
+edition
+editor
+howpublished
+institution
+journal
+key
+month
+note
+number
+organization
+pages
+publisher
+school
+series
+title
+type
+volume
+year
+}
+{}
+{ label extra.label sort.label }
+INTEGERS { output.state before.all mid.sentence after.sentence after.block
}
+FUNCTION {init.state.consts}
+{ #0 'before.all :=
+#1 'mid.sentence :=
+#2 'after.sentence :=
+#3 'after.block :=
+}
+STRINGS { s t }
+FUNCTION {output.nonnull}
+{ 's :=
+output.state mid.sentence =
+{ ", " * write$ }
+{ output.state after.block =
+{ add.period$ write$
+newline$
+"\newblock " write$
+}
+{ output.state before.all =
+'write$
+{ add.period$ " " * write$ }
+if$
+}
+if$
+mid.sentence 'output.state :=
+}
+if$
+s
+}
+FUNCTION {sioutput.nonnull}
+{ 's :=
+output.state mid.sentence =
+{ " " * write$ }
+{ output.state after.block =
+{ add.period$ write$
+newline$
+"\newblock " write$
+}
+{ output.state before.all =
+'write$
+{ add.period$ " " * write$ }
+if$
+}
+if$
+mid.sentence 'output.state :=
+}
+if$
+s
+}
+FUNCTION {output}
+{ duplicate$ empty$
+'pop$
+'output.nonnull
+if$
+}
+FUNCTION {sioutput}
+{ duplicate$ empty$
+'pop$
+'sioutput.nonnull
+if$
+}
+FUNCTION {output.check}
+{ 't :=
+duplicate$ empty$
+{ pop$ "empty " t * " in " * cite$ * warning$ }
+'output.nonnull
+if$
+}
+FUNCTION {output.bibitem}
+{ newline$
+"\bibitem[" write$
+label write$
+"]{" write$
+cite$ write$
+"}" write$
+newline$
+""
+before.all 'output.state :=
+}
+FUNCTION {fin.entry}
+{ add.period$
+write$
+newline$
+}
+FUNCTION {new.block}
+{ output.state before.all =
+'skip$
+{ after.block 'output.state := }
+if$
+}
+FUNCTION {new.sentence}
+{ output.state after.block =
+'skip$
+{ output.state before.all =
+'skip$
+{ after.sentence 'output.state := }
+if$
+}
+if$
+}
+FUNCTION {not}
+{ { #0 }
+{ #1 }
+if$
+}
+FUNCTION {and}
+{ 'skip$
+{ pop$ #0 }
+if$
+}
+FUNCTION {or}
+{ { pop$ #1 }
+'skip$
+if$
+}
+FUNCTION {new.block.checka}
+{ empty$
+'skip$
+'new.block
+if$
+}
+FUNCTION {new.block.checkb}
+{ empty$
+swap$ empty$
+and
+'skip$
+'new.block
+if$
+}
+FUNCTION {new.sentence.checka}
+{ empty$
+'skip$
+'new.sentence
+if$
+}
+FUNCTION {new.sentence.checkb}
+{ empty$
+swap$ empty$
+and
+'skip$
+'new.sentence
+if$
+}
+FUNCTION {field.or.null}
+{ duplicate$ empty$
+{ pop$ "" }
+'skip$
+if$
+}
+FUNCTION {emphasize}
+{ duplicate$ empty$
+{ pop$ "" }
+{ "{\em " swap$ * "}" * }
+if$
+}
+INTEGERS { nameptr namesleft numnames }
+FUNCTION {format.publisher}
+{ publisher empty$
+{ "" }
+{ address empty$
+{ publisher }
+{ address ": " * publisher * }
+if$
+}
+if$
+}
+FUNCTION {format.organization}
+{ organization empty$
+{ "" }
+{ address empty$
+{ organization }
+{ address ": " * organization * }
+if$
+}
+if$
+}
+FUNCTION {format.names}
+{ 's :=
+#1 'nameptr :=
+s num.names$ 'numnames :=
+numnames 'namesleft :=
+{ namesleft #0 > }
+{ s nameptr "{vv~}{ll}{, jj}{, f.}" format.name$ 't :=
+nameptr #1 >
+{ namesleft #1 >
+{ "; " * t * }
+{ numnames #2 >
+{ ";" * }
+{ "," * }
+if$
+t "others" =
+{ " et~al." * }
+{ " and " * t * }
+if$
+}
+if$
+}
+'t
+if$
+nameptr #1 + 'nameptr :=
+namesleft #1 - 'namesleft :=
+}
+while$
+add.period$
+}
+FUNCTION {format.authors}
+{ author empty$
+{ "" }
+{ author format.names }
+if$
+}
+FUNCTION {format.editors}
+{ editor empty$
+{ "" }
+{ editor format.names
+editor num.names$ #1 >
+{ ", eds." * }
+{ ", ed." * }
+if$
+}
+if$
+}
+FUNCTION {format.title}
+{ title empty$
+{ "" }
+{ title "t" change.case$ }
+if$
+}
+FUNCTION {n.dashify}
+{ 't :=
+""
+{ t empty$ not }
+{ t #1 #1 substring$ "-" =
+{ t #1 #2 substring$ "--" = not
+{ "--" *
+t #2 global.max$ substring$ 't :=
+}
+{ { t #1 #1 substring$ "-" = }
+{ "-" *
+t #2 global.max$ substring$ 't :=
+}
+while$
+}
+if$
+}
+{ t #1 #1 substring$ *
+t #2 global.max$ substring$ 't :=
+}
+if$
+}
+while$
+}
+FUNCTION {format.year}
+{ year empty$
+{ "" }
+{ year extra.label * }
+if$
+}
+FUNCTION {format.date}
+{ year empty$
+{ month empty$
+{ "" }
+{ "there's a month but no year in " cite$ * warning$
+month
+}
+if$
+}
+{ month empty$
+'year
+{ month " " * year * }
+if$
+}
+if$
+}
+FUNCTION {format.btitle}
+{ title emphasize
+}
+FUNCTION {tie.or.space.connect}
+{ duplicate$ text.length$ #3 <
+{ "~" }
+{ " " }
+if$
+swap$ * *
+}
+FUNCTION {either.or.check}
+{ empty$
+'pop$
+{ "can't use both " swap$ * " fields in " * cite$ * warning$ }
+if$
+}
+FUNCTION {format.bvolume}
+{ volume empty$
+{ "" }
+{ "volume" volume tie.or.space.connect
+series empty$
+'skip$
+{ " of " * series emphasize * }
+if$
+"volume and number" number either.or.check
+}
+if$
+}
+FUNCTION {format.number.series}
+{ volume empty$
+{ number empty$
+{ series field.or.null }
+{ output.state mid.sentence =
+{ "number" }
+{ "Number" }
+if$
+number tie.or.space.connect
+series empty$
+{ "there's a number but no series in " cite$ * warning$ }
+{ " in " * series * }
+if$
+}
+if$
+}
+{ "" }
+if$
+}
+FUNCTION {format.edition}
+{ edition empty$
+{ "" }
+{ output.state mid.sentence =
+{ edition "l" change.case$ " edition" * }
+{ edition "t" change.case$ " edition" * }
+if$
+}
+if$
+}
+INTEGERS { multiresult }
+FUNCTION {multi.page.check}
+{ 't :=
+#0 'multiresult :=
+{ multiresult not
+t empty$ not
+and
+}
+{ t #1 #1 substring$
+duplicate$ "-" =
+swap$ duplicate$ "," =
+swap$ "+" =
+or or
+{ #1 'multiresult := }
+{ t #2 global.max$ substring$ 't := }
+if$
+}
+while$
+multiresult
+}
+FUNCTION {format.pages}
+{ pages empty$
+{ "" }
+{ pages multi.page.check
+{ "" pages n.dashify tie.or.space.connect }
+{ "" pages tie.or.space.connect }
+if$
+}
+if$
+}
+FUNCTION {format.vol.num.pages}
+{ volume field.or.null
+number empty$
+'skip$
+{ "(" number * ")" * *
+volume empty$
+{ "there's a number but no volume in " cite$ * warning$ }
+'skip$
+if$
+}
+if$
+pages empty$
+'skip$
+{ duplicate$ empty$
+{ pop$ format.pages }
+{ ":" * pages n.dashify * }
+if$
+}
+if$
+}
+FUNCTION {format.chapter.pages}
+{ chapter empty$
+'format.pages
+{ type empty$
+{ "chapter" }
+{ type "l" change.case$ }
+if$
+chapter tie.or.space.connect
+pages empty$
+'skip$
+{ ", " * format.pages * }
+if$
+}
+if$
+}
+FUNCTION {format.in.ed.booktitle}
+{ booktitle empty$
+{ "" }
+{ editor empty$
+{ "In " booktitle emphasize * }
+{ "In " format.editors * ", " * booktitle emphasize * }
+if$
+}
+if$
+}
+FUNCTION {empty.misc.check}
+{ author empty$ title empty$ howpublished empty$
+month empty$ year empty$ note empty$
+and and and and and
+key empty$ not and
+{ "all relevant fields are empty in " cite$ * warning$ }
+'skip$
+if$
+}
+FUNCTION {format.thesis.type}
+{ type empty$
+'skip$
+{ pop$
+type "t" change.case$
+}
+if$
+}
+FUNCTION {format.tr.number}
+{ type empty$
+{ "Technical Report" }
+'type
+if$
+number empty$
+{ "t" change.case$ }
+{ number tie.or.space.connect }
+if$
+}
+FUNCTION {format.article.crossref}
+{ key empty$
+{ journal empty$
+{ "need key or journal for " cite$ * " to crossref " * crossref *
+warning$
+""
+}
+{ "In {\em " journal * "\/}" * }
+if$
+}
+{ "In " key * }
+if$
+" \shortcite{" * crossref * "}" *
+}
+FUNCTION {format.crossref.editor}
+{ editor #1 "{vv~}{ll}" format.name$
+editor num.names$ duplicate$
+#2 >
+{ pop$ " et~al." * }
+{ #2 <
+'skip$
+{ editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
+{ " et~al." * }
+{ " and " * editor #2 "{vv~}{ll}" format.name$ * }
+if$
+}
+if$
+}
+if$
+}
+FUNCTION {format.book.crossref}
+{ volume empty$
+{ "empty volume in " cite$ * "'s crossref of " * crossref * warning$
+"In "
+}
+{ "Volume" volume tie.or.space.connect
+" of " *
+}
+if$
+editor empty$
+editor field.or.null author field.or.null =
+or
+{ key empty$
+{ series empty$
+{ "need editor, key, or series for " cite$ * " to crossref " *
+crossref * warning$
+"" *
+}
+{ "{\em " * series * "\/}" * }
+if$
+}
+{ key * }
+if$
+}
+{ format.crossref.editor * }
+if$
+" \shortcite{" * crossref * "}" *
+}
+FUNCTION {format.incoll.inproc.crossref}
+{ editor empty$
+editor field.or.null author field.or.null =
+or
+{ key empty$
+{ booktitle empty$
+{ "need editor, key, or booktitle for " cite$ * " to crossref " *
+crossref * warning$
+""
+}
+{ "In {\em " booktitle * "\/}" * }
+if$
+}
+{ "In " key * }
+if$
+}
+{ "In " format.crossref.editor * }
+if$
+" \shortcite{" * crossref * "}" *
+}
+FUNCTION {article}
+{ output.bibitem
+format.authors "author" output.check
+new.block format.year "year" output.check
+new.block
+format.title "title" output.check
+new.block
+crossref missing$
+{ journal emphasize "journal" output.check
+format.vol.num.pages sioutput
+}
+{ format.article.crossref output.nonnull
+format.pages sioutput
+}
+if$
+new.block
+note output
+fin.entry
+}
+FUNCTION {book}
+{ output.bibitem
+author empty$
+{ format.editors "author and editor" output.check }
+{ format.authors output.nonnull
+crossref missing$
+{ "author and editor" editor either.or.check }
+'skip$
+if$
+}
+if$
+new.block format.year "year" output.check
+new.block
+format.btitle "title" output.check
+crossref missing$
+{ format.bvolume output
+new.block
+format.number.series output
+new.sentence
+format.publisher "publisher" output.check
+}
+{ new.block
+format.book.crossref output.nonnull
+}
+if$
+format.edition output
+% format.date "year" output.check
+new.block
+note output
+fin.entry
+}
+FUNCTION {booklet}
+{ output.bibitem
+format.authors output
+new.block format.year "year" output.check
+new.block
+format.title "title" output.check
+howpublished address new.block.checkb
+howpublished output
+address output
+% format.date output
+new.block
+note output
+fin.entry
+}
+FUNCTION {inbook}
+{ output.bibitem
+author empty$
+{ format.editors "author and editor" output.check }
+{ format.authors output.nonnull
+crossref missing$
+{ "author and editor" editor either.or.check }
+'skip$
+if$
+}
+if$
+new.block format.year "year" output.check
+new.block
+format.btitle "title" output.check
+crossref missing$
+{ format.bvolume output
+new.block
+format.number.series output
+new.sentence
+format.publisher "publisher" output.check
+}
+{ format.book.crossref output.nonnull
+}
+if$
+format.edition output
+% format.date "year" output.check
+new.block
+format.chapter.pages "chapter and pages" output.check
+new.block
+note output
+fin.entry
+}
+FUNCTION {incollection}
+{ output.bibitem
+format.authors "author" output.check
+new.block format.year "year" output.check
+new.block
+format.title "title" output.check
+new.block
+crossref missing$
+{ format.in.ed.booktitle "booktitle" output.check
+format.bvolume output
+format.number.series output
+new.sentence
+format.publisher "publisher" output.check
+format.edition output
+% format.date "year" output.check
+new.block
+format.chapter.pages output
+}
+{ format.incoll.inproc.crossref output.nonnull
+new.block
+format.chapter.pages output
+}
+if$
+new.block
+note output
+fin.entry
+}
+FUNCTION {inproceedings}
+{ output.bibitem
+format.authors "author" output.check
+new.block format.year "year" output.check
+new.block
+format.title "title" output.check
+new.block
+crossref missing$
+{ format.in.ed.booktitle "booktitle" output.check
+format.bvolume output
+format.number.series output
+format.pages output
+new.block
+organization empty$
+{ format.publisher output }
+{ format.organization output }
+if$
+}
+{ format.incoll.inproc.crossref output.nonnull
+format.pages output
+}
+if$
+new.block
+note output
+fin.entry
+}
+FUNCTION {conference} { inproceedings }
+FUNCTION {manual}
+{ output.bibitem
+author empty$
+{ organization empty$
+'skip$
+{ organization output.nonnull
+address output
+}
+if$
+}
+{ format.authors output.nonnull }
+if$
+new.block format.year "year" output.check
+new.block
+format.btitle "title" output.check
+author empty$
+{ organization empty$
+{ address new.block.checka
+address output
+}
+'skip$
+if$
+}
+{ organization address new.block.checkb
+organization output
+address output
+}
+if$
+format.edition output
+% format.date output
+new.block
+note output
+fin.entry
+}
+FUNCTION {mastersthesis}
+{ output.bibitem
+format.authors "author" output.check
+new.block format.year "year" output.check
+new.block
+format.title "title" output.check
+new.block
+"Master's thesis" format.thesis.type output.nonnull
+school "school" output.check
+address output
+% format.date "year" output.check
+new.block
+note output
+fin.entry
+}
+FUNCTION {misc}
+{ output.bibitem
+format.authors output
+new.block format.year "year" output.check
+title howpublished new.block.checkb
+format.title output
+howpublished new.block.checka
+howpublished output
+% format.date output
+new.block
+note output
+fin.entry
+empty.misc.check
+}
+FUNCTION {phdthesis}
+{ output.bibitem
+format.authors "author" output.check
+new.block format.year "year" output.check
+new.block
+format.btitle "title" output.check
+new.block
+"Ph.D. Dissertation" format.thesis.type output.nonnull
+school "school" output.check
+address output
+% format.date "year" output.check
+new.block
+note output
+fin.entry
+}
+FUNCTION {proceedings}
+{ output.bibitem
+editor empty$
+{ organization output }
+{ format.editors output.nonnull }
+if$
+new.block format.year "year" output.check
+new.block
+format.btitle "title" output.check
+format.bvolume output
+format.number.series output
+editor empty$
+{ publisher empty$
+{ address output }
+{ format.publisher output }
+if$
+}
+{ organization empty$
+{ publisher new.sentence.checka
+format.publisher output
+}
+{ organization new.sentence.checkb
+format.organization output
+}
+if$
+}
+if$
+new.block
+note output
+fin.entry
+}
+FUNCTION {techreport}
+{ output.bibitem
+format.authors "author" output.check
+new.block format.year "year" output.check
+new.block
+format.title "title" output.check
+new.block
+format.tr.number output.nonnull
+institution "institution" output.check
+address output
+% format.date "year" output.check
+new.block
+note output
+fin.entry
+}
+FUNCTION {unpublished}
+{ output.bibitem
+format.authors "author" output.check
+new.block format.year "year" output.check
+new.block
+format.title "title" output.check
+new.block
+note "note" output.check
+% format.date output
+fin.entry
+}
+FUNCTION {default.type} { misc }
+MACRO {jan} {"January"}
+MACRO {feb} {"February"}
+MACRO {mar} {"March"}
+MACRO {apr} {"April"}
+MACRO {may} {"May"}
+MACRO {jun} {"June"}
+MACRO {jul} {"July"}
+MACRO {aug} {"August"}
+MACRO {sep} {"September"}
+MACRO {oct} {"October"}
+MACRO {nov} {"November"}
+MACRO {dec} {"December"}
+MACRO {acmcs} {"ACM Computing Surveys"}
+MACRO {acta} {"Acta Informatica"}
+MACRO {cacm} {"Communications of the ACM"}
+MACRO {ibmjrd} {"IBM Journal of Research and Development"}
+MACRO {ibmsj} {"IBM Systems Journal"}
+MACRO {ieeese} {"IEEE Transactions on Software Engineering"}
+MACRO {ieeetc} {"IEEE Transactions on Computers"}
+MACRO {ieeetcad}
+{"IEEE Transactions on Computer-Aided Design of Integrated Circuits"}
+MACRO {ipl} {"Information Processing Letters"}
+MACRO {jacm} {"Journal of the ACM"}
+MACRO {jcss} {"Journal of Computer and System Sciences"}
+MACRO {scp} {"Science of Computer Programming"}
+MACRO {sicomp} {"SIAM Journal on Computing"}
+MACRO {tocs} {"ACM Transactions on Computer Systems"}
+MACRO {tods} {"ACM Transactions on Database Systems"}
+MACRO {tog} {"ACM Transactions on Graphics"}
+MACRO {toms} {"ACM Transactions on Mathematical Software"}
+MACRO {toois} {"ACM Transactions on Office Information Systems"}
+MACRO {toplas} {"ACM Transactions on Programming Languages and Systems"}
+MACRO {tcs} {"Theoretical Computer Science"}
+READ
+FUNCTION {sortify}
+{ purify$
+"l" change.case$
+}
+INTEGERS { len }
+FUNCTION {chop.word}
+{ 's :=
+'len :=
+s #1 len substring$ =
+{ s len #1 + global.max$ substring$ }
+'s
+if$
+}
+FUNCTION {format.lab.names}
+{ 's :=
+s num.names$ 'numnames :=
+numnames #1 =
+{ s #1 "{vv }{ll}" format.name$ }
+{ numnames #2 =
+{ s #1 "{vv }{ll} and " format.name$ s #2 "{vv }{ll}" format.name$ *
+}
+{ numnames #3 =
+{ s #1 "{vv }{ll}, " format.name$
+s #2 "{vv }{ll}, and " format.name$ *
+s #3 "{vv }{ll}" format.name$ *
+}
+{ s #1 "{vv }{ll }\bgroup et al.\egroup " format.name$
+}
+if$
+}
+if$
+}
+if$
+}
+FUNCTION {author.key.label}
+{ author empty$
+{ key empty$
+{ cite$ #1 #3 substring$ }
+{ key }
+if$
+}
+{ author format.lab.names }
+if$
+}
+FUNCTION {author.editor.key.label}
+{ author empty$
+{ editor empty$
+{ key empty$
+{ cite$ #1 #3 substring$ }
+{ key }
+if$
+}
+{ editor format.lab.names }
+if$
+}
+{ author format.lab.names }
+if$
+}
+FUNCTION {author.key.organization.label}
+{ author empty$
+{ key empty$
+{ organization empty$
+{ cite$ #1 #3 substring$ }
+{ "The " #4 organization chop.word #3 text.prefix$ }
+if$
+}
+{ key }
+if$
+}
+{ author format.lab.names }
+if$
+}
+FUNCTION {editor.key.organization.label}
+{ editor empty$
+{ key empty$
+{ organization empty$
+{ cite$ #1 #3 substring$ }
+{ "The " #4 organization chop.word #3 text.prefix$ }
+if$
+}
+{ key }
+if$
+}
+{ editor format.lab.names }
+if$
+}
+FUNCTION {calc.label}
+{ type$ "book" =
+type$ "inbook" =
+or
+'author.editor.key.label
***The diff for this file has been truncated for email.***
=======================================
---
/branches/thefuture-modules/thebeast-apps/src/main/scala/org/riedelcastro/thebeast/apps/DependencyParsing.scala
Fri Mar 26 21:54:48 2010
+++
/branches/thefuture-modules/thebeast-apps/src/main/scala/org/riedelcastro/thebeast/apps/DependencyParsing.scala
Sun Mar 28 19:29:00 2010
@@ -175,6 +175,7 @@
//val linearModel = ((wordPair + posPair + bias) dot weightVar) +
treeConstraint
val linearModel = (posPair dot theta)
val probModel = normalize(exp(linearModel) * ptree(link, token, 0,
LessThan(Tokens)))
+ val mlModel = normalize(exp(linearModel) * ptree(link, token, 0,
LessThan(Tokens)).asLogic)

val weights = new Vector
for (pair <- posPairProbs) weights("Pos",pair._1._1,pair._1._2) =
pair._2
@@ -189,6 +190,9 @@

println(marginals)

+ val mlMarginals =
bp.infer(mlModel.ground(trainData(0).overlay(global).mask(Set(link))))
+
+ println(mlMarginals)

}

=======================================
--- /branches/thefuture-modules/thebeast-core/src/main/lyx/starai.lyx Wed
Mar 24 22:06:14 2010
+++ /branches/thefuture-modules/thebeast-core/src/main/lyx/starai.lyx Sun
Mar 28 19:29:00 2010
@@ -52,30 +52,30 @@
\end_layout

\begin_layout Abstract
-While many probabilistic programming language focus on restricting
expressivenes
-s to achieve complexity guarantees, we argue that we should rather design
+We argue that probabilistic programming, in order to scale up, needs to

\emph on
-open
+open up
\emph default
- languages that are designed to grow over time.
- In the languages we envision, new types of constructs, such as cardinality
- constraints, projectivity assumptions, acyclicity, are constantly added
- to a ever increasing set of declarative building blocks.
- This leads to
+.
+ That is, instead of focussing on minimal sets of generic building blocks
+ such as universal quantification and logical connectives, languages should
+
+\emph on
+grow
+\emph default
+ to include specific building blocks for as many uses cases as necessary.
+ On first sight this is not more than syntactic sugar to make models
\emph on
more concise
\emph default
- programs.
- More importantly, we argue and show that it can also lead to
+.
+ However, we argue and show that it can also lead to
\emph on
more efficient
\emph default
- inference if we use
-\emph on
-compositional
-\emph default
- inference methods that can exploit building-block specific sub-routines.
+ inference if we use inference methods that can exploit building-block
specific
+ sub-routines.
To this end we present
\begin_inset ERT
status open
@@ -89,7 +89,7 @@

\end_inset

-, a open-ended language to describe complex probabilistic models.
+, a open-ended framework for Undirected Graphical Models.
\end_layout

\begin_layout Section
@@ -97,6 +97,96 @@
\end_layout

\begin_layout Standard
+Probabilistic Programming languages such as Markov Logic
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "richardson06markov"
+
+\end_inset
+
+ and ? are very expressive.
+ Many statistical models of interest can be readily described using the
+ generic building blocks of these languages.
+ However, in many cases the generic inference routines of the language
interpret
+er will either be too slow, too inaccurate, or both.
+ For example, it is possible (albeit slightly convoluted) to use Markov
+ Logic for encoding probability distributions over the set of possible
syntactic
+ dependency trees of a sentence.
+ Yet, generic inference in these models is very inefficient, in particular
+ due to deterministic factors such as the spanning tree constraint that
+ induce high tree-width and strong interactions between variables.
+
+\end_layout
+
+\begin_layout Standard
+Here we argue that probabilistic programming, in order to scale up, needs
+ to
+\emph on
+open up
+\emph default
+.
+ That is, instead of focussing on minimal sets of generic building blocks
+ such as universal quantification and logical connectives, languages should
+
+\emph on
+grow
+\emph default
+ to eventually include specific building blocks for as many uses cases as
+ necessary.
+ For example, we should provide a spanning tree constraint as part of our
+ language that can be used whenever we want to extract dependency trees,
+ of model hierachical structures in general.
+
+\end_layout
+
+\begin_layout Standard
+On first sight, this is not more than syntactic sugar.
+ However, we argue and show that it can also lead to
+\emph on
+ more efficient
+\emph default
+ inference if we use inference methods that can exploit building-block
specific
+ sub-routines.
+ For example, Belief Propagation essentially requires each factor to
marginalize
+ itself.
+ For a spanning tree constraint this can be done very efficiently.
+\end_layout
+
+\begin_layout Standard
+Clearly, we do not want to design a language with all constructs we could
+ ever need in advance.
+ Instead, we need to provide the glue for an ever-increasing set of
language
+
+\emph on
+extensions
+\emph default
+.
+
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Plain Layout
+To this end we present
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+lang{}
+\end_layout
+
+\end_inset
+
+, a open-ended framework for Undirected Graphical Models.
+\end_layout
+
+\begin_layout Plain Layout
In recent years Probabilistic Programming languages have been adopted in
several fields, and used for applications such as Natural Language
Processing,
Planning, Sensor Networks, to name only a few.
@@ -130,7 +220,7 @@
treewidth, and hence high complexity.
\end_layout

-\begin_layout Standard
+\begin_layout Plain Layout
In this work we argue that Markov Logic, in order to scale up, needs to

\emph on
@@ -155,7 +245,8 @@

\end_layout

-\begin_layout Standard
+\end_inset
+
In the following we will present
\begin_inset ERT
status open
@@ -179,16 +270,85 @@

\end_inset

- an attempt to provide the glue for open-ended probabilistic programming.
- We have used it to (a) implement Markov Logic, and (b) extend it with
powerful
- building blocks such as a projective spanning tree constraint.
- We show empirically that this allows us to implement a dramatically more
- efficient dependency parser than in pure Markov Logic.
+ an attempt to provide this glue.
+ Like Markov Logic
+,
+\lang english
+
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+lang{}
\end_layout

+\end_inset
+
+ is declarative and focuses on undirected models.
+ However, it is not limited to the logical connectives and quantifications
+ present in ML; rather, it serves as a framework for extensions such as
+ cardinality constraints, or the tree constraint presented here.
+ Like FACTORIE,
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+lang{}
+\end_layout
+
+\end_inset
+
+ supports tailor-made inference, but while FACTORIE is primarily
imperative,
+
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+lang{}
+\end_layout
+
+\end_inset
+
+ is purely declarative (for all but language extension designers).
+ It is also similar to recent generative approaches, such as Church or
Figaro,
+ which supprt tailor-made proposal functions.
+ However, these languages are a) (primarily) generative, and b) limit
themselves
+ to MCMC.
+
+\end_layout
+
\begin_layout Standard
-Note as running example we use dependency parsing.
- Here we need to find the syntactic relations between the tokens of a
sentence.
+We have used
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+lang{}
+\end_layout
+
+\end_inset
+
+ it to (a) implement Markov Logic, and (b) extend it with powerful building
+ blocks such as a projective spanning tree constraint.
+ We show how this extension can be used to implement a syntactic dependency
+ parser
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+a dependency parser finds syntactic relations between the tokens of a
sentence.
For example, in
\begin_inset Quotes eld
\end_inset
@@ -216,6 +376,12 @@

\end_layout

+\end_inset
+
+ that would be out of scope for vanilla Markov Logic.
+
+\end_layout
+
\begin_layout Section
Domains, Variables, Worlds
\end_layout
@@ -234,10 +400,22 @@

\end_inset

- provides are abstract datatypes/interfaces for building blocks, as well
- as a set of initial constructs.
- We will describe them using classes and traits of Scala, a functional
object-or
-iented programming language.
+ provides are abstract datatypes for building blocks, as well as a set of
+ initial constructs.
+ Most Machine Learning infrastructure (inference and learning) can be
formulated
+ purely in terms of these interfaces.
+ We will describe them using classes and traits of Scala
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "odersky08programming"
+
+\end_inset
+
+, a hybrid functional object-oriented programming language.

\end_layout

@@ -246,21 +424,30 @@
\family typewriter
Domain[T]
\family default
- contains (Scala) objects of type
+ contains the (Scala) objects of type
\family typewriter
T
\family default
- we want to talk about; implementations of Domain usually need to provide
- an iterator over their objects, as well as a
+ we want to talk about; it needs to provide an iterator over its objects,
+ as well as a
\family typewriter
contains
\family default
method to indicate Domain membership.
- Note that a Domain can be infinite, and also be used when no enumeration
+\begin_inset Foot
+status collapsed
+
+\begin_layout Plain Layout
+Note that a Domain can be infinite, and also be used when no enumeration
of its objects is possible.

\end_layout

+\end_inset
+
+
+\end_layout
+
\begin_layout Standard
The three core types of domains are
\family typewriter
@@ -311,17 +498,26 @@

\end_inset

- a variable is represented by objects of the trait
+ a variable is represented by objects of the class
\family typewriter
Var[T]
\family default
.
Each variable has a name and a domain that specifies which values the
variable
can possibly take on.
- Variables can be simple (referring to simple objects) or complex (refering
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Plain Layout
+Variables can be simple (referring to simple objects) or complex (refering
to functions) :
\end_layout

+\end_inset
+
+
+\end_layout
+
\begin_layout LyX-Code
val root = Var(
\begin_inset Quotes eld
@@ -346,38 +542,32 @@
, Parses)
\end_layout

-\begin_layout Plain Layout
-One can understand each variable as a question about the world we seek to
- model.
- In this sense each assignment to our variables refers to a possible state
- of the world.
- In
-\begin_inset ERT
-status open
+\begin_layout Standard
+A variable binding is a (possible)
+\family typewriter
+World
+\family default
+.
+\begin_inset Foot
+status collapsed

\begin_layout Plain Layout
-
-
-\backslash
-lang{}
+Note that this is a generalization of possible worlds in Markov Logic if
+ one considers bindings of function variables that map into booleans.
+
\end_layout

\end_inset

- we hence refer to assignments using the
+ Its core method is
\family typewriter
-World
+resolveVar(v)
\family default
- trait.
- The core method a
+ and returns the object the variable
\family typewriter
-World
+v
\family default
- provides is
-\family typewriter
-resolveVar
-\family default
-: it returns the object the variable is assigned to.
+ is assigned to.
\begin_inset Foot
status collapsed

@@ -429,8 +619,8 @@
\end_layout

\begin_layout Standard
-Intuitively, a term is a symbolic expression that is, given a possible
world,
- evaluated to an object.
+A term is a symbolic expression that is, given a possible world, evaluated
+ to an object.
In
\begin_inset ERT
status open
@@ -446,29 +636,52 @@

a term is an instance of a
\family typewriter
-Term
+Term[T]
\family default
trait that has to implement an
\family typewriter
evaluate(world)
\family default
- method.
- It defines how the term maps worlds to values.
- A simple example of a term is the following:
+ method that maps the binding
+\family typewriter
+world
+\family default
+ to a value of type
+\family typewriter
+T
+\family default
+.
+ Crucially, terms in
+\begin_inset ERT
+status open
+
+\begin_layout Plain Layout
+
+
+\backslash
+lang{}
\end_layout

+\end_inset
+
+ also serve as formulae (then they evaluate into booleans) and
probabilistic
+ models (then they evaluate into real values).
+\end_layout
+
+\begin_layout Standard
+A simple example term is:
+\end_layout
+
\begin_layout LyX-Code
Exp(Indicator(FunApp(edge,Tuple(root,5)))
\end_layout

\begin_layout Standard
-It is actually a composed term with an
+
\family typewriter
Indicator
\family default
- term on its top-level.
- An indicator (or iverson bracket) evaluates to 1 if the boolean term
inside
- evaluates to
+ evaluates to 1 if the boolean term inside evaluates to
\family typewriter
TRUE
\family default
@@ -479,18 +692,22 @@
\family default
term applies the result of evaluating the first argument to the result
of evaluating the second.
- The edge term is the
+
+\family typewriter
+edge
+\family default
+ refers to the
\family typewriter
Var
\family default
- object we defined earlier.
- It evaluates to the function the variable is bound to in the given world.
+ object we defined earlier and evaluates to the function the variable is
+ bound to.
The other terms are defined accordingly.

\end_layout

\begin_layout Standard
-Scala allows us to use a lot syntactic sugar to make code more concise.
+We will use Scala's syntactic sugar to make code more concise.
In our case we can use this to alternatively write
\end_layout

@@ -499,26 +716,53 @@
\end_layout

\begin_layout Standard
-The terms so far provide no means of abstraction.
- To change this, we simply add
+where
\family typewriter
-Quantification
+${
+\begin_inset Formula $\cdot$
+\end_inset
+
+}
\family default
- terms which evaluate subterms for all objects of a given domain.
- A simple case is
+ is the indicator function.
+
\end_layout

+\begin_layout Standard
+To support abstraction, we provide quantified operations that are applied
+ to all objects of a given domain.
+ For example, to evaluate
+\end_layout
+
\begin_layout LyX-Code
-sum(Tokens){i=> ${tag(i,VB)->edge(root,i)}}
+Sum(Tokens,i=>${tag(i,VB)->edge(root,i)})
\end_layout

\begin_layout Standard
-This term is evaluated as follows: we replace i in the inner term with each
- possible value in Tokens, then we evaluate the inner term, get a real
value,
- and sum up these values.
+we replace i in the inner term with each possible value in
+\family typewriter
+Tokens
+\family default
+, then we evaluate the inner term, get a real value, and sum up these
values.
It should be clear that by placing this term into the exponential function
- we already have an (unnormalized) MLN.
-
+ we have an (unnormalized) MLN.
+ Also note that by replacing the add operation with
+\begin_inset Quotes eld
+\end_inset
+
+or
+\begin_inset Quotes erd
+\end_inset
+
+ and
+\begin_inset Quotes eld
+\end_inset
+
+and
+\begin_inset Quotes erd
+\end_inset
+
+ we get existential and universal quantification.
\end_layout

\begin_layout Standard
@@ -538,8 +782,6 @@

means composing terms into more complex terms, and use them to describe
probabilistic models.
- Just as traditional logics allow them to compose terms into boolean
formulae
- that describe the world.
Some users, however, will design and implement new terms.
In our running example, one could add a projective spanning tree
constraint

@@ -550,7 +792,7 @@
\end_layout

\begin_layout LyX-Code
-exp(${edge(root,5)})*PTree(edge,root)
+${edge(root,5)}*PTree(edge,root)
\end_layout

\begin_layout Standard
@@ -584,21 +826,31 @@
\end_layout

\begin_layout Section
-Compositional Inference
+Inference
\end_layout

\begin_layout Standard
-We could also write some logical formulae to express the projective
spanning
- tree constraint above.
- However, introducing an own term for this makes our model more concise.
- More importantly though, it can also make inference more tractable.
+\begin_inset Note Note
+status collapsed
+
+\begin_layout Plain Layout
+Introducing an own term for spanning tree makes our model more concise.
+ More importantly though, it also makes inference more tractable.
+ To illustrate this let us look at the case of Belief Propagation.

\end_layout

-\begin_layout Standard
-To illustrate this let us look at the case of Belief Propagation.
- Smith and Eisner have shown how efficient dynamic programming methods can
- be used to calculate the messages of a projective tree constraint factor.
+\end_inset
+
+
+\begin_inset CommandInset citation
+LatexCommand citet
+key "smith08dependency"
+
+\end_inset
+
+ have shown how efficient dynamic programming methods can be used to
calculate
+ the outgoing messages of a projective tree constraint factor.
In
\begin_inset ERT
status open
@@ -621,30 +873,50 @@

\end_layout

-\begin_layout Standard
+\begin_layout Plain Layout
Note that this type of compositional inference is not exclusive to Sum
Product
BP, and the spanning tree factor.
- Similar approaches can be used for algorithms such as Max Product BP, or
- even Integer Linear Programming, and other type of graphical structures.
- Moreover, note that we can follow a similar approach for inference methods
- that do not unroll the full graph.
- For example, terms can have a
+ Similar approaches can be used for algorithms such as Max Product BP
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "Duchi07usingcombinatorial"
+
+\end_inset
+
+ or methods that do not unroll the full graph.
+ For example, quantified terms can have a
\family typewriter
separate
\family default
- method for Cutting Plane Inference that returns all factors that are not
-
+ method for Cutting Plane Inference
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "riedel08improving"
+
+\end_inset
+
+ that returns all factors that are not
\emph on
maximally satisfied
\emph default
in a given world.
-\end_layout
+\begin_inset Note Note
+status open

\begin_layout Section
Related Work
\end_layout

-\begin_layout Standard
+\begin_layout Plain Layout
+Like Markov Logic
\begin_inset ERT
status open

@@ -657,17 +929,32 @@

\end_inset

- is closely related to Markov Logic: it is declarative, and focuses on
loglinear
- models.
+ is declarative and focuses on loglinear models.
However, it is not limited to the logical connectives and quantifications
present in ML; rather, it serves as a framework for extensions such as
cardinality constraints, or the tree constraint presented here.
-
+\begin_inset Foot
+status open
+
+\begin_layout Plain Layout
+Note that alchemy supports user-defined functions, but not
\end_layout

-\begin_layout Standard
-The possibility of incorporating tailor-made inference is also present in
- FACTORIE; But while FACTORIE focuses on imperative constructs,
+\end_inset
+
+ The possibility of incorporating tailor-made inference is also present
+ in FACTORIE
+\begin_inset space ~
+\end_inset
+
+
+\begin_inset CommandInset citation
+LatexCommand cite
+key "mccallum09factorie"
+
+\end_inset
+
+; But while FACTORIE focuses on imperative constructs,
\begin_inset ERT
status open

@@ -680,8 +967,8 @@

\end_inset

- is primarily declarative and requires imperative coding only for a few
- extension designers.
+ is primarily declarative and requires imperative coding only for extension
+ designers.
In this sense it is actually close languages like Figaro or Blog, which
allow inclusion of tailor-made proposal functions.
However, these languages are a) primarily generative, and b) limit
themselves
@@ -689,6 +976,11 @@

\end_layout

+\end_inset
+
+
+\end_layout
+
\begin_layout Section
Results and Conclusion
\end_layout
@@ -701,18 +993,24 @@
\end_layout

\begin_layout Standard
-\begin_inset Note Note
-status open
-
-\begin_layout Plain Layout
+
+\size small
\begin_inset CommandInset bibtex
LatexCommand bibtex
bibfiles "/Users/riedelcastro/projects/papers.fresh/bibtex/riedel"
-options "plain"
+options "aaai"

\end_inset


+\end_layout
+
+\begin_layout Standard
+\begin_inset Note Note
+status open
+
+\begin_layout Plain Layout
+
\end_layout

\end_inset
=======================================
---
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/Term.scala
Thu Mar 25 16:41:48 2010
+++
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/Term.scala
Sun Mar 28 19:29:00 2010
@@ -132,7 +132,13 @@

override def eval(env: Env) = Some(value)

- override def toString = value.toString
+ override def toString = value match {
+ case x:Integer => x.toString
+ case x:Product => x.toString
+ case x:String => x.toString
+ case x:AnyRef => x.getClass().getSimpleName
+ case x => x.toString
+ }

override def isGround = true

=======================================
---
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/booleans/BooleanTerm.scala
Sun Mar 21 14:06:34 2010
+++
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/booleans/BooleanTerm.scala
Sun Mar 28 19:29:00 2010
@@ -304,10 +304,12 @@
val env = new MutableEnv
Conjunction(variable.values.map(value => {env += variable -> value;
formula.ground(env)}).toSeq)
}
+
+ override def unrollUncertain = Conjunction(unroll.args.filter(arg
=> !arg.simplify.isGround))

def upperBound = unroll.upperBound

- override def ground(env: Env) = unroll.ground(env)
+ override def ground(env: Env) =
Forall(variable,formula.ground(env.mask(Set(variable))))

override def simplify = Forall(variable,formula.simplify)

=======================================
---
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/combinatorics/SpanningTreeConstraint.scala
Fri Mar 26 21:54:48 2010
+++
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/combinatorics/SpanningTreeConstraint.scala
Sun Mar 28 19:29:00 2010
@@ -49,7 +49,6 @@
(h, m, i) => vertices(h) && vertices(m) && vertices(i) && edges(h,
m) && order(m, i) && order(i, h) ~> dominates(h, i)
}
$ {uniqueHead && linkAndDominates && transitive && acyclic &&
projective1 && projective2}
- this
}


=======================================
---
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/doubles/Factorizer.scala
Sun Mar 21 14:06:34 2010
+++
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/env/doubles/Factorizer.scala
Sun Mar 28 19:29:00 2010
@@ -1,39 +1,55 @@
package org.riedelcastro.thebeast.env.doubles

import org.riedelcastro.thebeast.env.vectors.{VectorDotApp, VectorTerm,
VectorSum, QuantifiedVectorSum}
-import org.riedelcastro.thebeast.env.booleans.{BooleanTerm, Disjunction,
Conjunction}
+import org.riedelcastro.thebeast.env.booleans._
+import org.riedelcastro.thebeast.util.Logging

/**
* @author sriedel
*/

-object Factorizer {
+object Factorizer extends Logging {
def toMultiplication(term: DoubleTerm): Multiplication[DoubleTerm] = {
+ debug("Factorizing %s".format(term))
unroll(term).flatten match {
case Multiplication(args) =>
Multiplication(args.flatMap(toMultiplication(_).args))
case Exp(Sum(args)) => Multiplication(args.map(Exp(_)))
case Exp(v: VectorDotApp) =>
Multiplication(v.distribute.asInstanceOf[Sum[DoubleTerm]].args.map(Exp(_)))
- case Indicator(Conjunction(args)) =>
Multiplication(args.map(Indicator(_)))
+ case Indicator(b) =>
Multiplication(factorize(b).args.map(Indicator(_)))
case x => Multiplication(Seq(x))
}
}
+
+ def factorize(term:BooleanTerm) : Conjunction[BooleanTerm] = {
+ term.flatten match {
+ case Conjunction(args) =>
Conjunction(args.flatMap(factorize(_).args))
+ case x => Conjunction(Seq(x))
+ }
+ }

//todo: this should all be done by a generic unroll method and the
generic builder framework
- private def unroll(term: DoubleTerm): DoubleTerm = term match {
- case Multiplication(args) => Multiplication(args.map(unroll(_)))
- case Sum(args) => Sum(args.map(unroll(_)))
- case x: QuantifiedSum[_] => x.unroll
- case Normalize(x) => Normalize(unroll(x))
- case Exp(x) => Exp(unroll(x))
- case Indicator(arg) => Indicator(unrollBoolean(arg))
- case VectorDotApp(lhs, rhs) => VectorDotApp(unrollVectorTerm(lhs),
unrollVectorTerm(rhs))
- case x => x
+ private def unroll(term: DoubleTerm): DoubleTerm = {
+ debug("Unrolling %s".format(term))
+ term match {
+ case Multiplication(args) => Multiplication(args.map(unroll(_)))
+ case Sum(args) => Sum(args.map(unroll(_)))
+ case x: QuantifiedSum[_] => x.unroll
+ case Normalize(x) => Normalize(unroll(x))
+ case Exp(x) => Exp(unroll(x))
+ case Indicator(arg) => Indicator(unrollBoolean(arg))
+ case VectorDotApp(lhs, rhs) => VectorDotApp(unrollVectorTerm(lhs),
unrollVectorTerm(rhs))
+ case x => x
+ }
}

- private def unrollBoolean(term:BooleanTerm):BooleanTerm = term match {
- case Conjunction(args) => Conjunction(args.map(unrollBoolean(_)))
- case Disjunction(args) => Disjunction(args.map(unrollBoolean(_)))
- case x => x
+ private def unrollBoolean(term: BooleanTerm): BooleanTerm = {
+ debug("Unrolling %s".format(term))
+ term match {
+ case Conjunction(args) => Conjunction(args.map(unrollBoolean(_)))
+ case Disjunction(args) => Disjunction(args.map(unrollBoolean(_)))
+ case Forall(v, f) => Forall(v, unrollBoolean(f)).unrollUncertain
+ case x => x
+ }
}

private def unrollVectorTerm(term: VectorTerm): VectorTerm = term match {
=======================================
---
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/solve/SumProductBeliefPropagation.scala
Fri Mar 26 20:58:54 2010
+++
/branches/thefuture-modules/thebeast-core/src/main/scala/org/riedelcastro/thebeast/solve/SumProductBeliefPropagation.scala
Sun Mar 28 19:29:00 2010
@@ -96,7 +96,7 @@

private def infer(terms: Collection[DoubleTerm]): Beliefs[Any,
EnvVar[Any]] = {

- debug("SPBP for %d terms".format(terms.size))
+ debug("SPBP for %d terms: %s".format(terms.size,terms.mkString(",")))

val graph = new SPBPFactorGraph

Reply all
Reply to author
Forward
0 new messages