-
Notifications
You must be signed in to change notification settings - Fork 199
/
Copy pathabsorptionID.m
23 lines (21 loc) · 1023 Bytes
/
absorptionID.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function [jtprob jtutil utilroot]=absorptionID(jtprob,jtutil,infostruct,partialorder)
%ABSORPTIONID Perform full round of absorption on an Influence Diagram
% [jtprob jtutil utilroot]=absorptionID(jtprob,jtutil,infostruct,partialorder)
% Absorption on an Junction Tree of an Influence Diagram
% see also jtreeID.m
schedule=1:length(jtprob)-1;
Atree=infostruct.cliquetree; % clique tree
for s=schedule
% absorb pot(a)-->pot(b)
pota = s;
potb = find(Atree(s,:));
% probability update:
sepvars=intersect(jtprob(pota).variables,jtprob(potb).variables);
maxsumvars=setdiff(jtprob(pota).variables,sepvars);
sepprob = maxsumpot(jtprob(pota),maxsumvars,partialorder);
jtprob(potb)=multpots([jtprob(potb) sepprob]);
% utility update:
seputil = maxsumpot(multpots([jtprob(pota) jtutil(pota)]),maxsumvars,partialorder);
jtutil(potb)=sumpots([jtutil(potb) divpots(seputil,sepprob)]);
end
[probroot, utilroot]=sumpotID(jtprob(end),jtutil(end),[],[],partialorder,0); utilroot=utilroot.table;