This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/CLPBN/clpbn/bp/examples/smokers.yap

25 lines
547 B
Plaintext
Raw Normal View History

2012-04-03 16:23:26 +01:00
:- use_module(library(pfl)).
:- clpbn_horus:set_solver(fove).
%:- clpbn_horus:set_solver(hve).
%:- clpbn_horus:set_solver(bp).
%:- clpbn_horus:set_solver(cbp).
2012-04-03 16:23:26 +01:00
:- yap_flag(write_strings, off).
2012-04-05 18:38:56 +01:00
friends(P1, P2) :-
2012-04-11 23:48:59 +01:00
people(P1),
people(P2),
2012-04-18 02:57:24 +01:00
P1 @< P2.
2012-04-11 23:48:59 +01:00
people @ 3.
2012-04-03 16:23:26 +01:00
2012-04-11 23:48:59 +01:00
markov smokes(P)::[t,f], cancer(P)::[t,f] ; [0.1, 0.2, 0.3, 0.4] ; [people(P)].
2012-04-03 16:23:26 +01:00
2012-04-11 23:48:59 +01:00
markov friend(P1,P2)::[t,f], smokes(P1)::[t,f], smokes(P2)::[t,f] ;
[0.5, 0.6, 0.7, 0.8, 0.5, 0.6, 0.7, 0.8] ; [friends(P1, P2)].
2012-04-03 16:23:26 +01:00
2012-04-11 23:48:59 +01:00
% ?- smokes(p1, t), smokes(p2, f), friend(p1, p2, X).
2012-04-05 18:38:56 +01:00