Skip to content

Commit

Permalink
use Element struct in apply cache
Browse files Browse the repository at this point in the history
  • Loading branch information
guyvdbroeck committed Jul 16, 2020
1 parent b2e4958 commit 27d4395
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/sdd/trimmed_apply.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function conjoin_cartesian(n1::Sdd⋁Node, n2::Sdd⋁Node)::Sdd
end
(n1,n2) = pointer_sort(n1,n2)

get!(tmgr(n1).conjoin_cache, (n1,n2)) do
get!(tmgr(n1).conjoin_cache, Element(n1,n2)) do
elems_prod = Vector{Element}()
elems1 = copy(children(n1))
elems2 = copy(children(n2))
Expand Down Expand Up @@ -99,7 +99,7 @@ end
Conjoin two SDDs when one descends from the other
"""
function conjoin_descendent(d::Sdd, n::Sdd)::Sdd
get!(tmgr(n).conjoin_cache, (d,n)) do
get!(tmgr(n).conjoin_cache, Element(d,n)) do
if varsubset_left(d, n)
elements = Element[Element(conjoin(prime(e),d), sub(e)) for e in children(n)]
elements = remove_false_primes(elements)
Expand All @@ -121,7 +121,7 @@ function conjoin_indep(s::Sdd, t::Sdd)::Sdd⋁Node
mgr = parentlca(s,t)
# @assert tmgr(s) != mgr && tmgr(t) != mgr
(s,t) = pointer_sort(s,t)
get!(mgr.conjoin_cache, (s,t)) do
get!(mgr.conjoin_cache, Element(s,t)) do
if varsubset_left(tmgr(s), mgr)
# @assert varsubset_right(tmgr(t), mgr)
elements = Element[Element(s,t),Element(!s,trimfalse)]
Expand Down
2 changes: 1 addition & 1 deletion src/sdd/trimmed_sdds.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const XYPartition = Set{Element}
const Unique⋁Cache = Dict{XYPartition,Sdd⋁Node}

"Apply cache for the result of conjunctions and disjunctions"
const ApplyCache = Dict{Tuple{Sdd,Sdd},Sdd}
const ApplyCache = Dict{Element,Sdd}

"SDD manager inner vtree node for trimmed SDD nodes"
mutable struct TrimSddMgrInnerNode <: TrimSddMgr
Expand Down

0 comments on commit 27d4395

Please sign in to comment.