AlgebraicDecisionDiagrams
AlgebraicDecisionDiagrams.Monomial
AlgebraicDecisionDiagrams.MultilinearExpression
AlgebraicDecisionDiagrams.MultilinearExpression
AlgebraicDecisionDiagrams.MultilinearExpression
AlgebraicDecisionDiagrams.MultilinearExpression
AlgebraicDecisionDiagrams.Terminal
Base.IteratorSize
AlgebraicDecisionDiagrams.:¬
AlgebraicDecisionDiagrams.:∧
AlgebraicDecisionDiagrams.:∨
AlgebraicDecisionDiagrams.apply
AlgebraicDecisionDiagrams.apply
AlgebraicDecisionDiagrams.apply
AlgebraicDecisionDiagrams.indicator
AlgebraicDecisionDiagrams.marginalize
AlgebraicDecisionDiagrams.nliteral
AlgebraicDecisionDiagrams.pliteral
AlgebraicDecisionDiagrams.reduce
AlgebraicDecisionDiagrams.reduce
AlgebraicDecisionDiagrams.restrict
Base.:*
Base.:-
Base.eltype
Base.iterate
Base.iterate
Base.length
Base.length
Base.one
Base.one
Base.zero
Base.zero
AlgebraicDecisionDiagrams.Monomial
— TypeMonomial
Specifies a monomial as a coefficient of numeric type T and a sorted list of variable indices. We assume the index 0 represents the constant (variable-free) monomial.
AlgebraicDecisionDiagrams.MultilinearExpression
— TypeMultilinearExpression
Implements a multilinear expression data type as a dictionary of monoids to coefficients.
Examples
```julia
Creates a constant expression
@show c = MultilinearExpression(7.4)
Creates expressions with single term
@show e1 = MultilinearExpression(4.0,1) @show e2 = MultilinearExpression(3.0,1,3) ````
AlgebraicDecisionDiagrams.MultilinearExpression
— MethodCreates an expression with given coefficient and variables (indices).
AlgebraicDecisionDiagrams.MultilinearExpression
— MethodCreates an expression with a single constant c
AlgebraicDecisionDiagrams.MultilinearExpression
— MethodCreates an expression with a single term (given as a pair monomial => coefficient
AlgebraicDecisionDiagrams.Terminal
— TypeImplements a generic decision diagram whose leaves are of given type T
Base.IteratorSize
— MethodWe can't know the number of nodes in advance (to traversing the diagram).
AlgebraicDecisionDiagrams.:¬
— MethodReturns the complement of the function.
AlgebraicDecisionDiagrams.:∧
— MethodReturns the conjunction of the Boolean functions.
AlgebraicDecisionDiagrams.:∨
— MethodReturns the disjunction of the Boolean functions.
AlgebraicDecisionDiagrams.apply
— Methodapply(OP,α,β,opcache,vcache)
Recursively computes α OP β and cache results.
Parameters
OP
: operation to apply to leavesα
,β
: decision diagramsopcache
: cache of applied operationsvcache
: cache of terminal values
AlgebraicDecisionDiagrams.apply
— MethodReturns a Diagram canonical representation of α OP β, where OP is some binary operator.
AlgebraicDecisionDiagrams.apply
— Methodapply(f::Function, α::DecisionDiagram)
Returns the application of function f to α.
AlgebraicDecisionDiagrams.indicator
— FunctionCreates Diagram representing indicator function on given variable. If complement is true, then returns complement indicator.
AlgebraicDecisionDiagrams.marginalize
— MethodMarginalize a variable var from function α.
AlgebraicDecisionDiagrams.nliteral
— Method" nliteral(index::Int)
Creates a negated literal (an indicator over Boolean constants) for variable index.
AlgebraicDecisionDiagrams.pliteral
— Method" pliteral(index::Int)
Creates a positive literal (an indicator over Boolean constants) for variable index.
AlgebraicDecisionDiagrams.reduce
— Methodreduce(α::DecisionDiagram)
Returns the canonical form of the decision diagram α. A diagram is canonical iff:
- no two terminals are assigned to the same value
- no two nodes have are labeled by the same variable and have the same two reduced children low and high with identical ids
AlgebraicDecisionDiagrams.reduce
— Methodreduce(α::DecisionDiagram{T}, cache::Dict{Tuple{Int,Int,Int},DecisionDiagram{T}}, vcache::Dict{T,DecisionDiagram{T}})
Returns the canonical form of decision diagram α using node and value caches. A diagram is canonical iff: - no two terminals are assigned to the same value - no two nodes have are labeled by the same variable and have the same two reduced children low and high with identical ids
Arguments
α
: decision diagram to reduce.cache
: cache of inner nodes (identified by ids of variable, low and high children).vcache::Dict{T,DecisionDiagram{T}}
: cache of terminal nodes identified by the associated value.
AlgebraicDecisionDiagrams.restrict
— Functionrestrict(α::DecisionDiagram, var::Int, value::Bool=true)
Returns the canonical form of the function α constrained at variable var=value.
Example
x, y = variable(1), variable(2)
f = (one(x)-x)*(one(y)-1) + x*y
g = Terminal(4)*(one(x)-x) + Terminal(2)*x
h = f + g
r1 = restrict(h,1,false)
r2 = h | (2 => true) # shorthand for restrict(h,2,true)
r3 = h | (y => true) # same as above
Base.:*
— MethodReturns the product of the respective functions.
Base.:-
— MethodReturns the subtraction of the respective functions.
Base.eltype
— MethodA decision diagram is composed of other decision diagrams.
Base.iterate
— MethodIterate over the pairs monomials => coeeficient in the expression.
Base.iterate
— MethodDepth-first search traversal.
Base.length
— MethodReturns the number of monomials in the expression.
Base.length
— MethodReturns the number of nodes in the diagram.
Base.one
— MethodReturns the multiplicative identity expression.
Base.one
— MethodMultiplicative identity for terminals of type T
Base.zero
— MethodReturns the aditivity identity expression.
Base.zero
— MethodAdditive identity for terminals of type T