16#ifndef STRUCTURED_DNNF_H
17#define STRUCTURED_DNNF_H
25#include <unordered_map>
74 const std::map<gate_t, int> &input_rank,
75 std::size_t max_nodes = 0);
104 std::size_t
size()
const;
109 using DNF = std::vector<Term>;
127 std::unordered_map<CacheKey, gate_t, CacheKeyHash>
cache_;
132 const std::map<gate_t, int> &rank,
133 std::map<gate_t, DNF> &memo)
const;
Boolean provenance circuit with support for knowledge compilation.
BooleanGate
Gate types for a Boolean provenance circuit.
gate_t
Strongly-typed gate identifier.
Boolean circuit for provenance formula evaluation.
gate_t rootGate() const
Root gate of the constructed d-DNNF (current after simplify).
double probability() const
Probability that the function is true (independent inputs).
gate_t mkNeg(Var v)
shared negative literal NOT(IN)
std::vector< DNF > andDecompose(const DNF &d) const
static DNF canonical(DNF d)
sort, dedup, drop supersets
StructuredDNNFBuilder(const BooleanCircuit &bc, gate_t root, const std::map< gate_t, int > &input_rank, std::size_t max_nodes=0)
DNF extract(const BooleanCircuit &bc, gate_t g, const std::map< gate_t, int > &rank, std::map< gate_t, DNF > &memo) const
std::size_t size() const
d-DNNF gates reachable from the root.
std::vector< std::string > uuid_
rank -> source input UUID (for labels)
std::vector< gate_t > in_gate_
rank -> shared dDNNF IN gate
static constexpr int GUARD_FACTOR
std::unordered_map< CacheKey, gate_t, CacheKeyHash > cache_
std::vector< gate_t > not_gate_
rank -> shared dDNNF NOT(IN) gate (lazy)
gate_t mkAnd(const std::vector< gate_t > &children)
static DNF condition(const DNF &d, Var v, bool value)
std::vector< double > prob_
prob_[rank] = P(variable)
std::vector< DNF > orDecompose(const DNF &d) const
gate_t false_gate_
empty AND / empty OR terminals
gate_t mkLit(Var v)
shared positive literal IN
const dDNNF & dnnf() const
The constructed d-DNNF (root set, simplified).
gate_t build(const DNF &d, gate_t false_sink)
std::vector< Term > DNF
A sum of products: canonicalised.
std::vector< Var > Term
A product: sorted, duplicate-free vars.
gate_t newGate(BooleanGate type)
setGate + size guard
int Var
Variable rank in [0,ninputs).
A d-DNNF circuit supporting exact probabilistic and game-theoretic evaluation.
Decomposable Deterministic Negation Normal Form circuit.
std::size_t operator()(const CacheKey &k) const
bool operator==(const CacheKey &o) const