763 lines
26 KiB
Plaintext
763 lines
26 KiB
Plaintext
Variable: Burglar
|
|
Domain: b1, b2
|
|
Parents:
|
|
Childs: Alarm
|
|
cpt
|
|
----------------
|
|
b1 0.005
|
|
b2 0.995
|
|
|
|
Variable: FreightTruck
|
|
Domain: f1, f2
|
|
Parents:
|
|
Childs: Alarm
|
|
cpt
|
|
----------------
|
|
f1 0.03
|
|
f2 0.97
|
|
|
|
Variable: Alarm
|
|
Domain: a1, a2
|
|
Parents: Burglar, FreightTruck
|
|
Childs:
|
|
cpt b1,f1 b1,f2 b2,f1 b2,f2
|
|
----------------------------------------------------
|
|
a1 0.992 0.99 0.2 0.003
|
|
a2 0.008 0.01 0.8 0.997
|
|
|
|
Variable: Burglar
|
|
Domain: b1, b2
|
|
Parents:
|
|
Childs: Alarm
|
|
cpt
|
|
----------------
|
|
b1 0.005
|
|
b2 0.995
|
|
|
|
Variable: FreightTruck
|
|
Domain: f1, f2
|
|
Parents:
|
|
Childs: Alarm, _Jn
|
|
cpt
|
|
----------------
|
|
f1 0.03
|
|
f2 0.97
|
|
|
|
Variable: Alarm
|
|
Domain: a1, a2
|
|
Parents: Burglar, FreightTruck
|
|
Childs: _Jn
|
|
cpt b1,f1 b1,f2 b2,f1 b2,f2
|
|
----------------------------------------------------
|
|
a1 0.992 0.99 0.2 0.003
|
|
a2 0.008 0.01 0.8 0.997
|
|
|
|
Variable: _Jn
|
|
Domain: _jn0, _jn1, _jn2, _jn3
|
|
Parents: FreightTruck, Alarm
|
|
Childs:
|
|
cpt f1,a1 f1,a2 f2,a1 f2,a2
|
|
----------------------------------------------------
|
|
_jn0 1 0 0 0
|
|
_jn1 0 1 0 0
|
|
_jn2 0 0 1 0
|
|
_jn3 0 0 0 1
|
|
|
|
The graph is not single connected. Iterative belief propagation will be used.
|
|
|
|
Initializing solver
|
|
-> schedule = parallel
|
|
-> max iters = 100
|
|
-> stable threashold = 1e-20
|
|
-> query vars = FreightTruck Alarm
|
|
domain π(Burglar) λ(Burglar) belief
|
|
----------------------------------------------------------------
|
|
b1 1 1 0.5
|
|
b2 1 1 0.5
|
|
|
|
domain πAlarm(Burglar) λAlarm(Burglar)
|
|
----------------------------------------------------------------
|
|
b1 0.5 0.5
|
|
b2 0.5 0.5
|
|
|
|
domain π(FreightTruck) λ(FreightTruck) belief
|
|
----------------------------------------------------------------
|
|
f1 1 1 0.5
|
|
f2 1 1 0.5
|
|
|
|
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.5 0.5
|
|
f2 0.5 0.5
|
|
|
|
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.5 0.5
|
|
f2 0.5 0.5
|
|
|
|
domain π(Alarm) λ(Alarm) belief
|
|
----------------------------------------------------------------
|
|
a1 1 1 0.5
|
|
a2 1 1 0.5
|
|
|
|
domain π_Jn(Alarm) λ_Jn(Alarm)
|
|
----------------------------------------------------------------
|
|
a1 0.5 0.5
|
|
a2 0.5 0.5
|
|
|
|
domain π(_Jn) λ(_Jn) belief
|
|
----------------------------------------------------------------
|
|
_jn0 1 1 0.25
|
|
_jn1 1 1 0.25
|
|
_jn2 1 1 0.25
|
|
_jn3 1 1 0.25
|
|
|
|
|
|
|
|
********************************************************************************
|
|
Iteration 1
|
|
********************************************************************************
|
|
λ message Alarm --> Burglar
|
|
λAlarm(b1)
|
|
= [p(a1|b1,f1).πAlarm(f1) + p(a1|b1,f2).πAlarm(f2)].λ(a1)
|
|
+ [p(a2|b1,f1).πAlarm(f1) + p(a2|b1,f2).πAlarm(f2)].λ(a2)
|
|
= [(0.992x0.5) + (0.99x0.5)]x1
|
|
+ [(0.008x0.5) + (0.01x0.5)]x1 = 1
|
|
λAlarm(b2)
|
|
= [p(a1|b2,f1).πAlarm(f1) + p(a1|b2,f2).πAlarm(f2)].λ(a1)
|
|
+ [p(a2|b2,f1).πAlarm(f1) + p(a2|b2,f2).πAlarm(f2)].λ(a2)
|
|
= [(0.2x0.5) + (0.003x0.5)]x1
|
|
+ [(0.8x0.5) + (0.997x0.5)]x1 = 1
|
|
|
|
λ message Alarm --> FreightTruck
|
|
λAlarm(f1)
|
|
= [p(a1|b1,f1).πAlarm(b1) + p(a1|b2,f1).πAlarm(b2)].λ(a1)
|
|
+ [p(a2|b1,f1).πAlarm(b1) + p(a2|b2,f1).πAlarm(b2)].λ(a2)
|
|
= [(0.992x0.5) + (0.2x0.5)]x1
|
|
+ [(0.008x0.5) + (0.8x0.5)]x1 = 1
|
|
λAlarm(f2)
|
|
= [p(a1|b1,f2).πAlarm(b1) + p(a1|b2,f2).πAlarm(b2)].λ(a1)
|
|
+ [p(a2|b1,f2).πAlarm(b1) + p(a2|b2,f2).πAlarm(b2)].λ(a2)
|
|
= [(0.99x0.5) + (0.003x0.5)]x1
|
|
+ [(0.01x0.5) + (0.997x0.5)]x1 = 1
|
|
|
|
λ message _Jn --> FreightTruck
|
|
λ_Jn(f1)
|
|
= [p(_jn0|f1,a1).π_Jn(a1) + p(_jn0|f1,a2).π_Jn(a2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a1).π_Jn(a1) + p(_jn1|f1,a2).π_Jn(a2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a1).π_Jn(a1) + p(_jn2|f1,a2).π_Jn(a2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a1).π_Jn(a1) + p(_jn3|f1,a2).π_Jn(a2)].λ(_jn3)
|
|
= [(1x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (1x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1 = 1
|
|
λ_Jn(f2)
|
|
= [p(_jn0|f2,a1).π_Jn(a1) + p(_jn0|f2,a2).π_Jn(a2)].λ(_jn0)
|
|
+ [p(_jn1|f2,a1).π_Jn(a1) + p(_jn1|f2,a2).π_Jn(a2)].λ(_jn1)
|
|
+ [p(_jn2|f2,a1).π_Jn(a1) + p(_jn2|f2,a2).π_Jn(a2)].λ(_jn2)
|
|
+ [p(_jn3|f2,a1).π_Jn(a1) + p(_jn3|f2,a2).π_Jn(a2)].λ(_jn3)
|
|
= [(0x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1
|
|
+ [(1x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (1x0.5)]x1 = 1
|
|
|
|
λ message _Jn --> Alarm
|
|
λ_Jn(a1)
|
|
= [p(_jn0|f1,a1).π_Jn(f1) + p(_jn0|f2,a1).π_Jn(f2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a1).π_Jn(f1) + p(_jn1|f2,a1).π_Jn(f2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a1).π_Jn(f1) + p(_jn2|f2,a1).π_Jn(f2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a1).π_Jn(f1) + p(_jn3|f2,a1).π_Jn(f2)].λ(_jn3)
|
|
= [(1x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (1x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1 = 1
|
|
λ_Jn(a2)
|
|
= [p(_jn0|f1,a2).π_Jn(f1) + p(_jn0|f2,a2).π_Jn(f2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a2).π_Jn(f1) + p(_jn1|f2,a2).π_Jn(f2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a2).π_Jn(f1) + p(_jn2|f2,a2).π_Jn(f2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a2).π_Jn(f1) + p(_jn3|f2,a2).π_Jn(f2)].λ(_jn3)
|
|
= [(0x0.5) + (0x0.5)]x1
|
|
+ [(1x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (1x0.5)]x1 = 1
|
|
|
|
π message Burglar --> Alarm
|
|
πAlarm(b1) = π(b1) = 0.005 = 0.005
|
|
πAlarm(b2) = π(b2) = 0.995 = 0.995
|
|
|
|
π message FreightTruck --> Alarm
|
|
πAlarm(f1) = π(f1).λ_Jn(f1) = 0.03 x 0.5 = 0.015
|
|
πAlarm(f2) = π(f2).λ_Jn(f2) = 0.97 x 0.5 = 0.485
|
|
|
|
π message FreightTruck --> _Jn
|
|
π_Jn(f1) = π(f1).λAlarm(f1) = 0.03 x 0.5 = 0.015
|
|
π_Jn(f2) = π(f2).λAlarm(f2) = 0.97 x 0.5 = 0.485
|
|
|
|
π message Alarm --> _Jn
|
|
π_Jn(a1) = π(a1) = 1 = 1
|
|
π_Jn(a2) = π(a2) = 1 = 1
|
|
|
|
var Burglar:
|
|
π(b1)
|
|
= p(b1)
|
|
= (0.005) = 0.005
|
|
π(b2)
|
|
= p(b2)
|
|
= (0.995) = 0.995
|
|
λ(b1) = λAlarm(b1) = 0.5 = 0.5
|
|
λ(b2) = λAlarm(b2) = 0.5 = 0.5
|
|
belief change = 1
|
|
|
|
var FreightTruck:
|
|
π(f1)
|
|
= p(f1)
|
|
= (0.03) = 0.03
|
|
π(f2)
|
|
= p(f2)
|
|
= (0.97) = 0.97
|
|
λ(f1) = λAlarm(f1).λ_Jn(f1) = 0.5 x 0.5 = 0.25
|
|
λ(f2) = λAlarm(f2).λ_Jn(f2) = 0.5 x 0.5 = 0.25
|
|
belief change = 1
|
|
|
|
var Alarm:
|
|
π(a1)
|
|
= p(a1|b1,f1).πAlarm(b1).πAlarm(f1)
|
|
+ p(a1|b1,f2).πAlarm(b1).πAlarm(f2)
|
|
+ p(a1|b2,f1).πAlarm(b2).πAlarm(f1)
|
|
+ p(a1|b2,f2).πAlarm(b2).πAlarm(f2)
|
|
= (0.992x0.005x0.03)
|
|
+ (0.99x0.005x0.97)
|
|
+ (0.2x0.995x0.03)
|
|
+ (0.003x0.995x0.97) = 0.01381575
|
|
π(a2)
|
|
= p(a2|b1,f1).πAlarm(b1).πAlarm(f1)
|
|
+ p(a2|b1,f2).πAlarm(b1).πAlarm(f2)
|
|
+ p(a2|b2,f1).πAlarm(b2).πAlarm(f1)
|
|
+ p(a2|b2,f2).πAlarm(b2).πAlarm(f2)
|
|
= (0.008x0.005x0.03)
|
|
+ (0.01x0.005x0.97)
|
|
+ (0.8x0.995x0.03)
|
|
+ (0.997x0.995x0.97) = 0.98618425
|
|
λ(a1) = λ_Jn(a1) = 0.5 = 0.5
|
|
λ(a2) = λ_Jn(a2) = 0.5 = 0.5
|
|
belief change = 1
|
|
|
|
var _Jn:
|
|
π(_jn0)
|
|
= p(_jn0|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn0|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn0|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn0|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (1x0.03x0.5)
|
|
+ (0x0.03x0.5)
|
|
+ (0x0.97x0.5)
|
|
+ (0x0.97x0.5) = 0.015
|
|
π(_jn1)
|
|
= p(_jn1|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn1|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn1|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn1|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.5)
|
|
+ (1x0.03x0.5)
|
|
+ (0x0.97x0.5)
|
|
+ (0x0.97x0.5) = 0.015
|
|
π(_jn2)
|
|
= p(_jn2|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn2|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn2|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn2|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.5)
|
|
+ (0x0.03x0.5)
|
|
+ (1x0.97x0.5)
|
|
+ (0x0.97x0.5) = 0.485
|
|
π(_jn3)
|
|
= p(_jn3|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn3|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn3|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn3|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.5)
|
|
+ (0x0.03x0.5)
|
|
+ (0x0.97x0.5)
|
|
+ (1x0.97x0.5) = 0.485
|
|
λ(_jn0) = 1
|
|
λ(_jn1) = 1
|
|
λ(_jn2) = 1
|
|
λ(_jn3) = 1
|
|
belief change = 1
|
|
|
|
domain π(Burglar) λ(Burglar) belief
|
|
----------------------------------------------------------------
|
|
b1 0.005 0.5 0.005
|
|
b2 0.995 0.5 0.995
|
|
|
|
domain πAlarm(Burglar) λAlarm(Burglar)
|
|
----------------------------------------------------------------
|
|
b1 0.005 0.5
|
|
b2 0.995 0.5
|
|
|
|
domain π(FreightTruck) λ(FreightTruck) belief
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.25 0.03
|
|
f2 0.97 0.25 0.97
|
|
|
|
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.5
|
|
f2 0.97 0.5
|
|
|
|
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.5
|
|
f2 0.97 0.5
|
|
|
|
domain π(Alarm) λ(Alarm) belief
|
|
----------------------------------------------------------------
|
|
a1 0.01381575 0.5 0.01381575
|
|
a2 0.98618425 0.5 0.98618425
|
|
|
|
domain π_Jn(Alarm) λ_Jn(Alarm)
|
|
----------------------------------------------------------------
|
|
a1 0.5 0.5
|
|
a2 0.5 0.5
|
|
|
|
domain π(_Jn) λ(_Jn) belief
|
|
----------------------------------------------------------------
|
|
_jn0 0.015 1 0.015
|
|
_jn1 0.015 1 0.015
|
|
_jn2 0.485 1 0.485
|
|
_jn3 0.485 1 0.485
|
|
|
|
|
|
|
|
********************************************************************************
|
|
Iteration 2
|
|
********************************************************************************
|
|
λ message Alarm --> Burglar
|
|
λAlarm(b1)
|
|
= [p(a1|b1,f1).πAlarm(f1) + p(a1|b1,f2).πAlarm(f2)].λ(a1)
|
|
+ [p(a2|b1,f1).πAlarm(f1) + p(a2|b1,f2).πAlarm(f2)].λ(a2)
|
|
= [(0.992x0.03) + (0.99x0.97)]x0.5
|
|
+ [(0.008x0.03) + (0.01x0.97)]x0.5 = 0.5
|
|
λAlarm(b2)
|
|
= [p(a1|b2,f1).πAlarm(f1) + p(a1|b2,f2).πAlarm(f2)].λ(a1)
|
|
+ [p(a2|b2,f1).πAlarm(f1) + p(a2|b2,f2).πAlarm(f2)].λ(a2)
|
|
= [(0.2x0.03) + (0.003x0.97)]x0.5
|
|
+ [(0.8x0.03) + (0.997x0.97)]x0.5 = 0.5
|
|
|
|
λ message Alarm --> FreightTruck
|
|
λAlarm(f1)
|
|
= [p(a1|b1,f1).πAlarm(b1) + p(a1|b2,f1).πAlarm(b2)].λ(a1)
|
|
+ [p(a2|b1,f1).πAlarm(b1) + p(a2|b2,f1).πAlarm(b2)].λ(a2)
|
|
= [(0.992x0.005) + (0.2x0.995)]x0.5
|
|
+ [(0.008x0.005) + (0.8x0.995)]x0.5 = 0.5
|
|
λAlarm(f2)
|
|
= [p(a1|b1,f2).πAlarm(b1) + p(a1|b2,f2).πAlarm(b2)].λ(a1)
|
|
+ [p(a2|b1,f2).πAlarm(b1) + p(a2|b2,f2).πAlarm(b2)].λ(a2)
|
|
= [(0.99x0.005) + (0.003x0.995)]x0.5
|
|
+ [(0.01x0.005) + (0.997x0.995)]x0.5 = 0.5
|
|
|
|
λ message _Jn --> FreightTruck
|
|
λ_Jn(f1)
|
|
= [p(_jn0|f1,a1).π_Jn(a1) + p(_jn0|f1,a2).π_Jn(a2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a1).π_Jn(a1) + p(_jn1|f1,a2).π_Jn(a2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a1).π_Jn(a1) + p(_jn2|f1,a2).π_Jn(a2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a1).π_Jn(a1) + p(_jn3|f1,a2).π_Jn(a2)].λ(_jn3)
|
|
= [(1x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (1x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1 = 1
|
|
λ_Jn(f2)
|
|
= [p(_jn0|f2,a1).π_Jn(a1) + p(_jn0|f2,a2).π_Jn(a2)].λ(_jn0)
|
|
+ [p(_jn1|f2,a1).π_Jn(a1) + p(_jn1|f2,a2).π_Jn(a2)].λ(_jn1)
|
|
+ [p(_jn2|f2,a1).π_Jn(a1) + p(_jn2|f2,a2).π_Jn(a2)].λ(_jn2)
|
|
+ [p(_jn3|f2,a1).π_Jn(a1) + p(_jn3|f2,a2).π_Jn(a2)].λ(_jn3)
|
|
= [(0x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (0x0.5)]x1
|
|
+ [(1x0.5) + (0x0.5)]x1
|
|
+ [(0x0.5) + (1x0.5)]x1 = 1
|
|
|
|
λ message _Jn --> Alarm
|
|
λ_Jn(a1)
|
|
= [p(_jn0|f1,a1).π_Jn(f1) + p(_jn0|f2,a1).π_Jn(f2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a1).π_Jn(f1) + p(_jn1|f2,a1).π_Jn(f2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a1).π_Jn(f1) + p(_jn2|f2,a1).π_Jn(f2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a1).π_Jn(f1) + p(_jn3|f2,a1).π_Jn(f2)].λ(_jn3)
|
|
= [(1x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (1x0.97)]x1
|
|
+ [(0x0.03) + (0x0.97)]x1 = 1
|
|
λ_Jn(a2)
|
|
= [p(_jn0|f1,a2).π_Jn(f1) + p(_jn0|f2,a2).π_Jn(f2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a2).π_Jn(f1) + p(_jn1|f2,a2).π_Jn(f2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a2).π_Jn(f1) + p(_jn2|f2,a2).π_Jn(f2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a2).π_Jn(f1) + p(_jn3|f2,a2).π_Jn(f2)].λ(_jn3)
|
|
= [(0x0.03) + (0x0.97)]x1
|
|
+ [(1x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (1x0.97)]x1 = 1
|
|
|
|
π message Burglar --> Alarm
|
|
πAlarm(b1) = π(b1) = 0.005 = 0.005
|
|
πAlarm(b2) = π(b2) = 0.995 = 0.995
|
|
|
|
π message FreightTruck --> Alarm
|
|
πAlarm(f1) = π(f1).λ_Jn(f1) = 0.03 x 0.5 = 0.015
|
|
πAlarm(f2) = π(f2).λ_Jn(f2) = 0.97 x 0.5 = 0.485
|
|
|
|
π message FreightTruck --> _Jn
|
|
π_Jn(f1) = π(f1).λAlarm(f1) = 0.03 x 0.5 = 0.015
|
|
π_Jn(f2) = π(f2).λAlarm(f2) = 0.97 x 0.5 = 0.485
|
|
|
|
π message Alarm --> _Jn
|
|
π_Jn(a1) = π(a1) = 0.0138158 = 0.01381575
|
|
π_Jn(a2) = π(a2) = 0.986184 = 0.98618425
|
|
|
|
var Burglar:
|
|
π(b1)
|
|
= p(b1)
|
|
= (0.005) = 0.005
|
|
π(b2)
|
|
= p(b2)
|
|
= (0.995) = 0.995
|
|
λ(b1) = λAlarm(b1) = 0.5 = 0.5
|
|
λ(b2) = λAlarm(b2) = 0.5 = 0.5
|
|
belief change = 8.67361738e-19
|
|
|
|
var FreightTruck:
|
|
π(f1)
|
|
= p(f1)
|
|
= (0.03) = 0.03
|
|
π(f2)
|
|
= p(f2)
|
|
= (0.97) = 0.97
|
|
λ(f1) = λAlarm(f1).λ_Jn(f1) = 0.5 x 0.5 = 0.25
|
|
λ(f2) = λAlarm(f2).λ_Jn(f2) = 0.5 x 0.5 = 0.25
|
|
belief change = 0
|
|
|
|
var Alarm:
|
|
π(a1)
|
|
= p(a1|b1,f1).πAlarm(b1).πAlarm(f1)
|
|
+ p(a1|b1,f2).πAlarm(b1).πAlarm(f2)
|
|
+ p(a1|b2,f1).πAlarm(b2).πAlarm(f1)
|
|
+ p(a1|b2,f2).πAlarm(b2).πAlarm(f2)
|
|
= (0.992x0.005x0.03)
|
|
+ (0.99x0.005x0.97)
|
|
+ (0.2x0.995x0.03)
|
|
+ (0.003x0.995x0.97) = 0.01381575
|
|
π(a2)
|
|
= p(a2|b1,f1).πAlarm(b1).πAlarm(f1)
|
|
+ p(a2|b1,f2).πAlarm(b1).πAlarm(f2)
|
|
+ p(a2|b2,f1).πAlarm(b2).πAlarm(f1)
|
|
+ p(a2|b2,f2).πAlarm(b2).πAlarm(f2)
|
|
= (0.008x0.005x0.03)
|
|
+ (0.01x0.005x0.97)
|
|
+ (0.8x0.995x0.03)
|
|
+ (0.997x0.995x0.97) = 0.98618425
|
|
λ(a1) = λ_Jn(a1) = 0.5 = 0.5
|
|
λ(a2) = λ_Jn(a2) = 0.5 = 0.5
|
|
belief change = 0
|
|
|
|
var _Jn:
|
|
π(_jn0)
|
|
= p(_jn0|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn0|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn0|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn0|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (1x0.03x0.0138158)
|
|
+ (0x0.03x0.986184)
|
|
+ (0x0.97x0.0138158)
|
|
+ (0x0.97x0.986184) = 0.0004144725
|
|
π(_jn1)
|
|
= p(_jn1|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn1|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn1|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn1|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.0138158)
|
|
+ (1x0.03x0.986184)
|
|
+ (0x0.97x0.0138158)
|
|
+ (0x0.97x0.986184) = 0.0295855275
|
|
π(_jn2)
|
|
= p(_jn2|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn2|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn2|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn2|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.0138158)
|
|
+ (0x0.03x0.986184)
|
|
+ (1x0.97x0.0138158)
|
|
+ (0x0.97x0.986184) = 0.0134012775
|
|
π(_jn3)
|
|
= p(_jn3|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn3|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn3|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn3|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.0138158)
|
|
+ (0x0.03x0.986184)
|
|
+ (0x0.97x0.0138158)
|
|
+ (1x0.97x0.986184) = 0.9565987225
|
|
λ(_jn0) = 1
|
|
λ(_jn1) = 1
|
|
λ(_jn2) = 1
|
|
λ(_jn3) = 1
|
|
belief change = 0.9723685
|
|
|
|
domain π(Burglar) λ(Burglar) belief
|
|
----------------------------------------------------------------
|
|
b1 0.005 0.5 0.005
|
|
b2 0.995 0.5 0.995
|
|
|
|
domain πAlarm(Burglar) λAlarm(Burglar)
|
|
----------------------------------------------------------------
|
|
b1 0.005 0.5
|
|
b2 0.995 0.5
|
|
|
|
domain π(FreightTruck) λ(FreightTruck) belief
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.25 0.03
|
|
f2 0.97 0.25 0.97
|
|
|
|
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.5
|
|
f2 0.97 0.5
|
|
|
|
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.5
|
|
f2 0.97 0.5
|
|
|
|
domain π(Alarm) λ(Alarm) belief
|
|
----------------------------------------------------------------
|
|
a1 0.01381575 0.5 0.01381575
|
|
a2 0.98618425 0.5 0.98618425
|
|
|
|
domain π_Jn(Alarm) λ_Jn(Alarm)
|
|
----------------------------------------------------------------
|
|
a1 0.01381575 0.5
|
|
a2 0.98618425 0.5
|
|
|
|
domain π(_Jn) λ(_Jn) belief
|
|
----------------------------------------------------------------
|
|
_jn0 0.0004144725 1 0.0004144725
|
|
_jn1 0.0295855275 1 0.0295855275
|
|
_jn2 0.0134012775 1 0.0134012775
|
|
_jn3 0.9565987225 1 0.9565987225
|
|
|
|
|
|
|
|
********************************************************************************
|
|
Iteration 3
|
|
********************************************************************************
|
|
λ message Alarm --> Burglar
|
|
λAlarm(b1)
|
|
= [p(a1|b1,f1).πAlarm(f1) + p(a1|b1,f2).πAlarm(f2)].λ(a1)
|
|
+ [p(a2|b1,f1).πAlarm(f1) + p(a2|b1,f2).πAlarm(f2)].λ(a2)
|
|
= [(0.992x0.03) + (0.99x0.97)]x0.5
|
|
+ [(0.008x0.03) + (0.01x0.97)]x0.5 = 0.5
|
|
λAlarm(b2)
|
|
= [p(a1|b2,f1).πAlarm(f1) + p(a1|b2,f2).πAlarm(f2)].λ(a1)
|
|
+ [p(a2|b2,f1).πAlarm(f1) + p(a2|b2,f2).πAlarm(f2)].λ(a2)
|
|
= [(0.2x0.03) + (0.003x0.97)]x0.5
|
|
+ [(0.8x0.03) + (0.997x0.97)]x0.5 = 0.5
|
|
|
|
λ message Alarm --> FreightTruck
|
|
λAlarm(f1)
|
|
= [p(a1|b1,f1).πAlarm(b1) + p(a1|b2,f1).πAlarm(b2)].λ(a1)
|
|
+ [p(a2|b1,f1).πAlarm(b1) + p(a2|b2,f1).πAlarm(b2)].λ(a2)
|
|
= [(0.992x0.005) + (0.2x0.995)]x0.5
|
|
+ [(0.008x0.005) + (0.8x0.995)]x0.5 = 0.5
|
|
λAlarm(f2)
|
|
= [p(a1|b1,f2).πAlarm(b1) + p(a1|b2,f2).πAlarm(b2)].λ(a1)
|
|
+ [p(a2|b1,f2).πAlarm(b1) + p(a2|b2,f2).πAlarm(b2)].λ(a2)
|
|
= [(0.99x0.005) + (0.003x0.995)]x0.5
|
|
+ [(0.01x0.005) + (0.997x0.995)]x0.5 = 0.5
|
|
|
|
λ message _Jn --> FreightTruck
|
|
λ_Jn(f1)
|
|
= [p(_jn0|f1,a1).π_Jn(a1) + p(_jn0|f1,a2).π_Jn(a2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a1).π_Jn(a1) + p(_jn1|f1,a2).π_Jn(a2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a1).π_Jn(a1) + p(_jn2|f1,a2).π_Jn(a2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a1).π_Jn(a1) + p(_jn3|f1,a2).π_Jn(a2)].λ(_jn3)
|
|
= [(1x0.0138158) + (0x0.986184)]x1
|
|
+ [(0x0.0138158) + (1x0.986184)]x1
|
|
+ [(0x0.0138158) + (0x0.986184)]x1
|
|
+ [(0x0.0138158) + (0x0.986184)]x1 = 1
|
|
λ_Jn(f2)
|
|
= [p(_jn0|f2,a1).π_Jn(a1) + p(_jn0|f2,a2).π_Jn(a2)].λ(_jn0)
|
|
+ [p(_jn1|f2,a1).π_Jn(a1) + p(_jn1|f2,a2).π_Jn(a2)].λ(_jn1)
|
|
+ [p(_jn2|f2,a1).π_Jn(a1) + p(_jn2|f2,a2).π_Jn(a2)].λ(_jn2)
|
|
+ [p(_jn3|f2,a1).π_Jn(a1) + p(_jn3|f2,a2).π_Jn(a2)].λ(_jn3)
|
|
= [(0x0.0138158) + (0x0.986184)]x1
|
|
+ [(0x0.0138158) + (0x0.986184)]x1
|
|
+ [(1x0.0138158) + (0x0.986184)]x1
|
|
+ [(0x0.0138158) + (1x0.986184)]x1 = 1
|
|
|
|
λ message _Jn --> Alarm
|
|
λ_Jn(a1)
|
|
= [p(_jn0|f1,a1).π_Jn(f1) + p(_jn0|f2,a1).π_Jn(f2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a1).π_Jn(f1) + p(_jn1|f2,a1).π_Jn(f2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a1).π_Jn(f1) + p(_jn2|f2,a1).π_Jn(f2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a1).π_Jn(f1) + p(_jn3|f2,a1).π_Jn(f2)].λ(_jn3)
|
|
= [(1x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (1x0.97)]x1
|
|
+ [(0x0.03) + (0x0.97)]x1 = 1
|
|
λ_Jn(a2)
|
|
= [p(_jn0|f1,a2).π_Jn(f1) + p(_jn0|f2,a2).π_Jn(f2)].λ(_jn0)
|
|
+ [p(_jn1|f1,a2).π_Jn(f1) + p(_jn1|f2,a2).π_Jn(f2)].λ(_jn1)
|
|
+ [p(_jn2|f1,a2).π_Jn(f1) + p(_jn2|f2,a2).π_Jn(f2)].λ(_jn2)
|
|
+ [p(_jn3|f1,a2).π_Jn(f1) + p(_jn3|f2,a2).π_Jn(f2)].λ(_jn3)
|
|
= [(0x0.03) + (0x0.97)]x1
|
|
+ [(1x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (0x0.97)]x1
|
|
+ [(0x0.03) + (1x0.97)]x1 = 1
|
|
|
|
π message Burglar --> Alarm
|
|
πAlarm(b1) = π(b1) = 0.005 = 0.005
|
|
πAlarm(b2) = π(b2) = 0.995 = 0.995
|
|
|
|
π message FreightTruck --> Alarm
|
|
πAlarm(f1) = π(f1).λ_Jn(f1) = 0.03 x 0.5 = 0.015
|
|
πAlarm(f2) = π(f2).λ_Jn(f2) = 0.97 x 0.5 = 0.485
|
|
|
|
π message FreightTruck --> _Jn
|
|
π_Jn(f1) = π(f1).λAlarm(f1) = 0.03 x 0.5 = 0.015
|
|
π_Jn(f2) = π(f2).λAlarm(f2) = 0.97 x 0.5 = 0.485
|
|
|
|
π message Alarm --> _Jn
|
|
π_Jn(a1) = π(a1) = 0.0138158 = 0.01381575
|
|
π_Jn(a2) = π(a2) = 0.986184 = 0.98618425
|
|
|
|
var Burglar:
|
|
π(b1)
|
|
= p(b1)
|
|
= (0.005) = 0.005
|
|
π(b2)
|
|
= p(b2)
|
|
= (0.995) = 0.995
|
|
λ(b1) = λAlarm(b1) = 0.5 = 0.5
|
|
λ(b2) = λAlarm(b2) = 0.5 = 0.5
|
|
belief change = 0
|
|
|
|
var FreightTruck:
|
|
π(f1)
|
|
= p(f1)
|
|
= (0.03) = 0.03
|
|
π(f2)
|
|
= p(f2)
|
|
= (0.97) = 0.97
|
|
λ(f1) = λAlarm(f1).λ_Jn(f1) = 0.5 x 0.5 = 0.25
|
|
λ(f2) = λAlarm(f2).λ_Jn(f2) = 0.5 x 0.5 = 0.25
|
|
belief change = 0
|
|
|
|
var Alarm:
|
|
π(a1)
|
|
= p(a1|b1,f1).πAlarm(b1).πAlarm(f1)
|
|
+ p(a1|b1,f2).πAlarm(b1).πAlarm(f2)
|
|
+ p(a1|b2,f1).πAlarm(b2).πAlarm(f1)
|
|
+ p(a1|b2,f2).πAlarm(b2).πAlarm(f2)
|
|
= (0.992x0.005x0.03)
|
|
+ (0.99x0.005x0.97)
|
|
+ (0.2x0.995x0.03)
|
|
+ (0.003x0.995x0.97) = 0.01381575
|
|
π(a2)
|
|
= p(a2|b1,f1).πAlarm(b1).πAlarm(f1)
|
|
+ p(a2|b1,f2).πAlarm(b1).πAlarm(f2)
|
|
+ p(a2|b2,f1).πAlarm(b2).πAlarm(f1)
|
|
+ p(a2|b2,f2).πAlarm(b2).πAlarm(f2)
|
|
= (0.008x0.005x0.03)
|
|
+ (0.01x0.005x0.97)
|
|
+ (0.8x0.995x0.03)
|
|
+ (0.997x0.995x0.97) = 0.98618425
|
|
λ(a1) = λ_Jn(a1) = 0.5 = 0.5
|
|
λ(a2) = λ_Jn(a2) = 0.5 = 0.5
|
|
belief change = 0
|
|
|
|
var _Jn:
|
|
π(_jn0)
|
|
= p(_jn0|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn0|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn0|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn0|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (1x0.03x0.0138158)
|
|
+ (0x0.03x0.986184)
|
|
+ (0x0.97x0.0138158)
|
|
+ (0x0.97x0.986184) = 0.0004144725
|
|
π(_jn1)
|
|
= p(_jn1|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn1|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn1|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn1|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.0138158)
|
|
+ (1x0.03x0.986184)
|
|
+ (0x0.97x0.0138158)
|
|
+ (0x0.97x0.986184) = 0.0295855275
|
|
π(_jn2)
|
|
= p(_jn2|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn2|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn2|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn2|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.0138158)
|
|
+ (0x0.03x0.986184)
|
|
+ (1x0.97x0.0138158)
|
|
+ (0x0.97x0.986184) = 0.0134012775
|
|
π(_jn3)
|
|
= p(_jn3|f1,a1).π_Jn(f1).π_Jn(a1)
|
|
+ p(_jn3|f1,a2).π_Jn(f1).π_Jn(a2)
|
|
+ p(_jn3|f2,a1).π_Jn(f2).π_Jn(a1)
|
|
+ p(_jn3|f2,a2).π_Jn(f2).π_Jn(a2)
|
|
= (0x0.03x0.0138158)
|
|
+ (0x0.03x0.986184)
|
|
+ (0x0.97x0.0138158)
|
|
+ (1x0.97x0.986184) = 0.9565987225
|
|
λ(_jn0) = 1
|
|
λ(_jn1) = 1
|
|
λ(_jn2) = 1
|
|
λ(_jn3) = 1
|
|
belief change = 0
|
|
|
|
domain π(Burglar) λ(Burglar) belief
|
|
----------------------------------------------------------------
|
|
b1 0.005 0.5 0.005
|
|
b2 0.995 0.5 0.995
|
|
|
|
domain πAlarm(Burglar) λAlarm(Burglar)
|
|
----------------------------------------------------------------
|
|
b1 0.005 0.5
|
|
b2 0.995 0.5
|
|
|
|
domain π(FreightTruck) λ(FreightTruck) belief
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.25 0.03
|
|
f2 0.97 0.25 0.97
|
|
|
|
domain πAlarm(FreightTruck) λAlarm(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.5
|
|
f2 0.97 0.5
|
|
|
|
domain π_Jn(FreightTruck) λ_Jn(FreightTruck)
|
|
----------------------------------------------------------------
|
|
f1 0.03 0.5
|
|
f2 0.97 0.5
|
|
|
|
domain π(Alarm) λ(Alarm) belief
|
|
----------------------------------------------------------------
|
|
a1 0.01381575 0.5 0.01381575
|
|
a2 0.98618425 0.5 0.98618425
|
|
|
|
domain π_Jn(Alarm) λ_Jn(Alarm)
|
|
----------------------------------------------------------------
|
|
a1 0.01381575 0.5
|
|
a2 0.98618425 0.5
|
|
|
|
domain π(_Jn) λ(_Jn) belief
|
|
----------------------------------------------------------------
|
|
_jn0 0.0004144725 1 0.0004144725
|
|
_jn1 0.0295855275 1 0.0295855275
|
|
_jn2 0.0134012775 1 0.0134012775
|
|
_jn3 0.9565987225 1 0.9565987225
|
|
|
|
|
|
Iterative belief propagation converged in 3 iterations
|
|
|