diff --git a/packages/CLPBN/examples/burglary-alarm.yap b/packages/CLPBN/examples/burglary-alarm.yap index 52f9800ec..44a1d8816 100644 --- a/packages/CLPBN/examples/burglary-alarm.yap +++ b/packages/CLPBN/examples/burglary-alarm.yap @@ -1,41 +1,23 @@ - :- use_module(library(pfl)). -%:- set_pfl_flag(solver,ve). -:- set_pfl_flag(solver,bp), clpbn_horus:set_horus_flag(inf_alg,ve). -%:- set_pfl_flag(solver,bp), clpbn_horus:set_horus_flag(inf_alg,bp). -%:- set_pfl_flag(solver,fove). +%:- set_solver(fove). +%:- set_solver(hve). +%:- set_solver(bp). +%:- set_solver(cbp). -% :- yap_flag(write_strings, off). +:- yap_flag(write_strings, off). - -bayes burglary::[b1,b3] ; [0.001, 0.999] ; []. +bayes burglary::[b1,b2] ; [0.001, 0.999] ; []. bayes earthquake::[e1,e2] ; [0.002, 0.998]; []. -bayes alarm::[a1,a2] , burglary, earthquake ; [0.95, 0.94, 0.29, 0.001, 0.05, 0.06, 0.71, 0.999] ; []. +bayes alarm::[a1,a2], burglary, earthquake ; + [0.95, 0.94, 0.29, 0.001, 0.05, 0.06, 0.71, 0.999] ; + []. -bayes john_calls::[j1,j2] , alarm ; [0.9, 0.05, 0.1, 0.95] ; []. +bayes john_calls::[j1,j2], alarm ; [0.9, 0.05, 0.1, 0.95] ; []. -bayes mary_calls::[m1,m2] , alarm ; [0.7, 0.01, 0.3, 0.99] ; []. - - -b_cpt([0.001, 0.999]). - -e_cpt([0.002, 0.998]). - -a_cpt([0.95, 0.94, 0.29, 0.001, - 0.05, 0.06, 0.71, 0.999]). - -jc_cpt([0.9, 0.05, - 0.1, 0.95]). - -mc_cpt([0.7, 0.01, - 0.3, 0.99]). - -% ?- alarm(A). -?- john_calls(J), mary_calls(m1). -%?- john_calls(J), mary_calls(m1), alarm(a1). -%?- john_calls(J), alarm(a1). +bayes mary_calls::[m1,m2], alarm ; [0.7, 0.01, 0.3, 0.99] ; []. +% ?- john_calls(J), mary_calls(m1). diff --git a/packages/CLPBN/examples/cbp_example.uai b/packages/CLPBN/examples/cbp_example.uai deleted file mode 100644 index 7c8f130fa..000000000 --- a/packages/CLPBN/examples/cbp_example.uai +++ /dev/null @@ -1,15 +0,0 @@ -# example in counting belief propagation paper - -MARKOV -3 -2 2 2 -2 -2 0 1 -2 2 1 - -4 - 1.2 1.4 2.0 0.4 - -4 - 1.2 1.4 2.0 0.4 - diff --git a/packages/CLPBN/examples/smokers27.fg b/packages/CLPBN/examples/smokers27.fg deleted file mode 100644 index 990fadb98..000000000 --- a/packages/CLPBN/examples/smokers27.fg +++ /dev/null @@ -1,239 +0,0 @@ -27 - -1 -12 -2 -2 -0 9.974182 -1 1.000000 - -1 -13 -2 -2 -0 9.974182 -1 1.000000 - -1 -14 -2 -2 -0 9.974182 -1 1.000000 - -1 -9 -2 -2 -0 4.055200 -1 1.000000 - -1 -10 -2 -2 -0 4.055200 -1 1.000000 - -1 -11 -2 -2 -0 4.055200 -1 1.000000 - -1 -0 -2 -2 -0 7.389056 -1 1.000000 - -1 -3 -2 -2 -0 7.389056 -1 1.000000 - -1 -6 -2 -2 -0 7.389056 -1 1.000000 - -1 -1 -2 -2 -0 7.389056 -1 1.000000 - -1 -4 -2 -2 -0 7.389056 -1 1.000000 - -1 -7 -2 -2 -0 7.389056 -1 1.000000 - -1 -2 -2 -2 -0 7.389056 -1 1.000000 - -1 -5 -2 -2 -0 7.389056 -1 1.000000 - -1 -8 -2 -2 -0 7.389056 -1 1.000000 - -2 -9 12 -2 2 -4 -0 4.481689 -1 1.000000 -2 4.481689 -3 4.481689 - -2 -10 13 -2 2 -4 -0 4.481689 -1 1.000000 -2 4.481689 -3 4.481689 - -2 -11 14 -2 2 -4 -0 4.481689 -1 1.000000 -2 4.481689 -3 4.481689 - -2 -0 9 -2 2 -4 -0 3.004166 -1 3.004166 -2 3.004166 -3 3.004166 - -3 -3 10 9 -2 2 2 -8 -0 3.004166 -1 3.004166 -2 3.004166 -3 1.000000 -4 3.004166 -5 1.000000 -6 3.004166 -7 3.004166 - -3 -6 11 9 -2 2 2 -8 -0 3.004166 -1 3.004166 -2 3.004166 -3 1.000000 -4 3.004166 -5 1.000000 -6 3.004166 -7 3.004166 - -3 -1 9 10 -2 2 2 -8 -0 3.004166 -1 3.004166 -2 3.004166 -3 1.000000 -4 3.004166 -5 1.000000 -6 3.004166 -7 3.004166 - -2 -4 10 -2 2 -4 -0 3.004166 -1 3.004166 -2 3.004166 -3 3.004166 - -3 -7 11 10 -2 2 2 -8 -0 3.004166 -1 3.004166 -2 3.004166 -3 1.000000 -4 3.004166 -5 1.000000 -6 3.004166 -7 3.004166 - -3 -2 9 11 -2 2 2 -8 -0 3.004166 -1 3.004166 -2 3.004166 -3 1.000000 -4 3.004166 -5 1.000000 -6 3.004166 -7 3.004166 - -3 -5 10 11 -2 2 2 -8 -0 3.004166 -1 3.004166 -2 3.004166 -3 1.000000 -4 3.004166 -5 1.000000 -6 3.004166 -7 3.004166 - -2 -8 11 -2 2 -4 -0 3.004166 -1 3.004166 -2 3.004166 -3 3.004166 - diff --git a/packages/CLPBN/examples/smokers1.yap b/packages/CLPBN/examples/social_domain1.yap similarity index 100% rename from packages/CLPBN/examples/smokers1.yap rename to packages/CLPBN/examples/social_domain1.yap diff --git a/packages/CLPBN/examples/smokers2.yap b/packages/CLPBN/examples/social_domain2.yap similarity index 100% rename from packages/CLPBN/examples/smokers2.yap rename to packages/CLPBN/examples/social_domain2.yap diff --git a/packages/CLPBN/examples/test_city.yap b/packages/CLPBN/examples/test_city.yap deleted file mode 100644 index bbac6558a..000000000 --- a/packages/CLPBN/examples/test_city.yap +++ /dev/null @@ -1,110 +0,0 @@ -:- use_module(library(pfl)). - -:- set_solver(fove). -%:- set_solver(hve). -%:- set_solver(bp). -%:- set_solver(cbp). - -:- multifile people/2. -:- multifile ev/1. - -:- clpbn_horus:set_horus_flag(verbosity,5). - -people(joe,nyc). -people(p2, nyc). -people(p3, nyc). -people(p4, nyc). -people(p5, nyc). -people(p6, nyc). -people(p7, nyc). -people(p8, nyc). - -%ev(descn(p2, t)). -%ev(descn(p3, t)). -%ev(descn(p4, t)). -%ev(descn(p5, t)). - -bayes city_conservativeness(C)::[y,n] ; cons_table(C) ; [people(_,C)]. - -bayes gender(P)::[m,f] ; gender_table(P) ; [people(P,_)]. - -bayes hair_color(P)::[t,f], city_conservativeness(C) ; hair_color_table(P) ; [people(P,C)]. - -bayes car_color(P)::[t,f], hair_color(P) ; car_color_table(P); [people(P,_)]. - -bayes height(P)::[t,f], gender(P) ; height_table(P) ; [people(P,_)]. - -bayes shoe_size(P):[t,f], height(P) ; shoe_size_table(P); [people(P,_)]. - -bayes guilty(P)::[y,n] ; guilty_table(P) ; [people(P,_)]. - -bayes descn(P)::[t,f], car_color(P), hair_color(P), height(P), guilty(P) ; descn_table(P) ; [people(P,_)]. - -bayes witness(C)::[t,f], descn(Joe), descn(P2) ; wit_table ; [people(_,C), Joe=joe, P2=p2]. - -% FIXME -%cons_table(amsterdam, [0.2, 0.8]) :- !. -cons_table(_, [0.8, 0.2]). - - -gender_table(_, [0.55, 0.45]). - - -hair_color_table(_, - /* conservative_city */ - /* y n */ - [ 0.05, 0.1, - 0.95, 0.9 ]). - - -car_color_table(_, - /* t f */ - [ 0.9, 0.2, - 0.1, 0.8 ]). - - -height_table(_, - /* m f */ - [ 0.6, 0.4, - 0.4, 0.6 ]). - - -shoe_size_table(_, - /* t f */ - [ 0.9, 0.1, - 0.1, 0.9 ]). - - -guilty_table(_, [0.23, 0.77]). - - -descn_table(_, - /* color, hair, height, guilt */ - /* ttttt tttf ttft ttff tfttt tftf tfft tfff ttttt fttf ftft ftff ffttt fftf ffft ffff */ - [ 0.99, 0.5, 0.23, 0.88, 0.41, 0.3, 0.76, 0.87, 0.44, 0.43, 0.29, 0.72, 0.23, 0.91, 0.95, 0.92, - 0.01, 0.5, 0.77, 0.12, 0.59, 0.7, 0.24, 0.13, 0.56, 0.57, 0.71, 0.28, 0.77, 0.09, 0.05, 0.08]). - - -wit_table([0.2, 0.45, 0.24, 0.34, - 0.8, 0.55, 0.76, 0.66]). - - -runall(G, Wrapper) :- - findall(G, Wrapper, L), - execute_all(L). - - -execute_all([]). -execute_all(G.L) :- - call(G), - execute_all(L). - - -is_joe_guilty(Guilty) :- - witness(nyc, t), - runall(X, ev(X)), - guilty(joe, Guilty). - - -?- is_joe_guilty(Guilty). - diff --git a/packages/CLPBN/examples/test_smokers1.yap b/packages/CLPBN/examples/test_smokers1.yap deleted file mode 100644 index 15a4bce92..000000000 --- a/packages/CLPBN/examples/test_smokers1.yap +++ /dev/null @@ -1,33 +0,0 @@ -:- use_module(library(pfl)). - -:- set_solver(fove). -%:- set_solver(hve). -%:- set_solver(bp). -%:- set_solver(cbp). - -:- yap_flag(write_strings, off). - -:- multifile people/1. - -:- clpbn_horus:set_horus_flag(verbosity,5). - -people @ 5. - -people(X,Y) :- - people(X), - people(Y), - X \== Y. - -markov smokes(X)::[t,f]; [1.0, 4.0552]; [people(X)]. - -markov cancer(X)::[t,f]; [1.0, 9.9742]; [people(X)]. - -markov friends(X,Y)::[t,f] ; [1.0, 99.48432] ; [people(X,Y)]. - -markov smokes(X)::[t,f], cancer(X)::[t,f] ; [4.48169, 4.48169, 1.0, 4.48169] ; [people(X)]. - -markov friends(X,Y)::[t,f], smokes(X)::[t,f], smokes(Y)::[t,f] ; - [3.004166, 3.004166, 3.004166, 3.004166, 3.004166, 1.0, 1.0, 3.004166] ; [people(X,Y)]. - -?- friends(p1,p2,X). - diff --git a/packages/CLPBN/examples/test_smokers2.yap b/packages/CLPBN/examples/test_smokers2.yap deleted file mode 100644 index 887d1d957..000000000 --- a/packages/CLPBN/examples/test_smokers2.yap +++ /dev/null @@ -1,33 +0,0 @@ -:- use_module(library(pfl)). - -:- set_solver(fove). -%:- set_solver(hve). -%:- set_solver(bp). -%:- set_solver(cbp). - -:- yap_flag(write_strings, off). - -:- clpbn_horus:set_horus_flag(verbosity,5). -:- clpbn_horus:set_horus_flag(use_logarithms,true). - -:- multifile people/1. - -people @ 12. - -people(X,Y) :- - people(X), - people(Y). - -markov smokes(X)::[t,f]; [1.0, 4.0]; [people(X)]. - -markov asthma(X)::[t,f]; [2.5, 9.0] ; [people(X)]. - -markov friends(X,Y)::[t,f]; [1.0, 14.0] ; [people(X,Y)]. - -markov asthma(X)::[t,f], smokes(X)::[t,f]; [4.5, 4.3, 2.0, 1.45] ; [people(X)]. - -markov asthma(X)::[t,f], friends(X,Y)::[t,f], smokes(Y)::[t,f]; - [2.1, 3.3, 7.4, 3.9, 1.6, 5.0, 4.0, 3.0] ; [people(X,Y)]. - -?- friends(p1,p2,X). -