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

32 lines
682 B
Plaintext
Raw Normal View History

2012-04-03 16:23:26 +01:00
:- use_module(library(pfl)).
2012-04-30 11:16:11 +01:00
%:- set_solver(fove).
%:- set_solver(hve).
%:- set_solver(bp).
%:- set_solver(cbp).
2012-04-03 16:23:26 +01:00
:- yap_flag(write_strings, off).
2012-04-30 11:16:11 +01:00
:- multifile people/1.
2012-04-30 11:16:11 +01:00
people @ 5.
2012-04-30 11:16:11 +01:00
friendship(X,Y) :-
people(X),
people(Y).
% X \== Y.
2012-04-03 16:23:26 +01:00
2012-04-30 11:16:11 +01:00
markov smokes(X)::[t,f] ; [1.0, 1.4] ; [people(X)].
2012-04-03 16:23:26 +01:00
2012-04-30 11:16:11 +01:00
markov asthma(X)::[t,f] ; [1.0, 2.3] ; [people(X)].
2012-04-03 16:23:26 +01:00
2012-04-30 11:16:11 +01:00
markov friends(X,Y)::[t,f] ; [1.0, 4.6] ; [friendship(X,Y)].
markov asthma(X)::[t,f], smokes(X)::[t,f] ; [1.5, 1.0, 1.5, 1.5] ; [people(X)].
markov asthma(X)::[t,f], friends(X,Y)::[t,f], smokes(Y)::[t,f] ;
[1.1, 1.0, 1.1, 1.1, 1.1, 1.1, 1.1, 1.1] ; [friendship(X,Y)].
% ?- smokes(p1,t), smokes(p2,t), friends(p1,p2,X)
2012-04-05 18:38:56 +01:00