Algorithm 2: Elim-CPE |
|
input : A belief network ℬ = {P1, …, Pn}; a CNF formula on k propositions φ = {α1, …αm} defined over k propositions; an ordering of the variables, d = {X1, …, Xn}. |
|
output : The belief P(φ). |
1 |
Place buckets with unit clauses last in the ordering (to be processed first). |
// Initialize
|
|
Partition ℬ and φ into bucket1, …, bucketn, where bucketi contains all the CPTs and clauses whose highest variable is Xi. |
|
Put each observed variable into its appropriate bucket. Let S1, …, Sj be the scopes of the CPTs, and Q1, …Qr be the scopes of the clauses. (We denote probabilistic functions by λs and clauses by αs). |
2 |
for p ← n down to 1 do
|
// Backward
|
|
Let λ1, …, λj be the functions and α1, …, αr be the clauses in bucketp
|
|
Process-bucketp(Σ,(λ1, …, λj),(α1, …, αr)) |
3 |
return P(φ) as the result of processing bucket1. |