/* Reasoning in Belief Networks in Picat v3. This is a port of the belief networks program from I. Bratko, "Prolog Programming for Artificial Intelligence", 4th edn., Pearson Education / Addison-Wesley 2012 Page 378ff (Figure 16.4 and 16.5) The module belief_network_v3 is here: http://hakank.org/picat/belief_network_v3.pi This Picat model was created by Hakan Kjellerstrand, hakank@gmail.com See also my Picat page: http://www.hakank.org/picat/ */ import belief_network_v3. main => go. go ?=> L = [ [a,[]], [a,[c]], [c,[a]], [c,[a,d]], [e,[]], [e,[d]], [a,[b,c]], [a,[not c]] ], foreach(T in L) println(T), prob(T[1],T[2],P), println(p=P), nl end, nl. go => true. % Example from Exercise 16.4 (page 380) parent(a,c). parent(b,c). parent(b,d). parent(c,e). p(a,0.1). p(b,0.2). p(c,[a,b],0.5). p(c,[not a, b],0.0). p(c,[a, not b],0.4). p(d,[b],0.9). p(d,[not b],0.1). p(e,[c],0.6). p(e,[not c],0.1).