wolffd@0
|
1 function [engine, clqtoroot] = push(engine, clq, pushdom)
|
wolffd@0
|
2 %PUSH_POT push the variables in putshdom which is subset of clq to the clique toword the root and get new engine
|
wolffd@0
|
3 %pushdom is pushed variables set
|
wolffd@0
|
4 %clq is the index of the clique that pushdom belongs to
|
wolffd@0
|
5
|
wolffd@0
|
6 clqdom = engine.cliques{clq};
|
wolffd@0
|
7 assert( mysubset(pushdom, clqdom));
|
wolffd@0
|
8 clqtoroot = parents(engine.jtree, clq);
|
wolffd@0
|
9 %sepdom = engine.separator{clq, clqtoroot};
|
wolffd@0
|
10 sepdom = engine.separator{clqtoroot, clq};
|
wolffd@0
|
11
|
wolffd@0
|
12 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
13 % Calculate the strong marginal of the union of pushdom and and the separatordomain and %
|
wolffd@0
|
14 % the corresponding complement %
|
wolffd@0
|
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
16 %[margpot, comppot] = complement_pot(engine.clpot{clq}, pushdom);
|
wolffd@0
|
17 newsepdom = myunion(pushdom,sepdom);
|
wolffd@0
|
18 [margpot,comppot] = complement_pot(engine.clpot{clq}, newsepdom);
|
wolffd@0
|
19 engine.clpot{clqtoroot} = direct_combine_pots(engine.clpot{clqtoroot}, margpot);
|
wolffd@0
|
20 engine.clpot{clq} = comppot;
|
wolffd@0
|
21
|
wolffd@0
|
22 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
23 % Calculation of the new separator and separatorpotential of the junction tree %
|
wolffd@0
|
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
25 engine.seppot{clqtoroot, clq} = direct_combine_pots(engine.seppot{clqtoroot, clq}, margpot);
|
wolffd@0
|
26 engine.separator{clqtoroot, clq} = myunion(engine.separator{clqtoroot, clq}, pushdom);
|
wolffd@0
|
27
|
wolffd@0
|
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
29 % Add pushdomain to the clique towards the root %
|
wolffd@0
|
30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
wolffd@0
|
31 engine.cliques{clqtoroot} = myunion(engine.cliques{clqtoroot}, pushdom);
|
wolffd@0
|
32
|
wolffd@0
|
33 num_cliques = length(engine.cliques);
|
wolffd@0
|
34 B = sparse(num_cliques, 1);
|
wolffd@0
|
35 for i=1:num_cliques
|
wolffd@0
|
36 B(i, engine.cliques{i}) = 1;
|
wolffd@0
|
37 end
|
wolffd@0
|
38 engine.cliques_bitv = B;
|