diff --git a/packages/CLPBN/benchmarks/smokers_evidence/bp_tests.sh b/packages/CLPBN/benchmarks/smokers_evidence/bp_tests.sh new file mode 100755 index 000000000..89480a5ce --- /dev/null +++ b/packages/CLPBN/benchmarks/smokers_evidence/bp_tests.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source sm.sh +source ../benchs.sh + +SOLVER="bp" + +function run_all_graphs +{ + write_header $1 + run_solver ev0p$POP $2 + run_solver ev5p$POP $2 + run_solver ev10p$POP $2 + run_solver ev15p$POP $2 + run_solver ev20p$POP $2 + run_solver ev25p$POP $2 + run_solver ev30p$POP $2 + run_solver ev35p$POP $2 + run_solver ev40p$POP $2 + run_solver ev45p$POP $2 + run_solver ev50p$POP $2 + run_solver ev55p$POP $2 + run_solver ev60p$POP $2 + run_solver ev65p$POP $2 + run_solver ev70p$POP $2 + run_solver ev75p$POP $2 + run_solver ev80p$POP $2 + run_solver ev85p$POP $2 + run_solver ev90p$POP $2 +} + +prepare_new_run +run_all_graphs "bp(shedule=seq_fixed) " seq_fixed + diff --git a/packages/CLPBN/benchmarks/smokers_evidence/cbp_tests.sh b/packages/CLPBN/benchmarks/smokers_evidence/cbp_tests.sh new file mode 100755 index 000000000..f8975e415 --- /dev/null +++ b/packages/CLPBN/benchmarks/smokers_evidence/cbp_tests.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source sm.sh +source ../benchs.sh + +SOLVER="cbp" + +function run_all_graphs +{ + write_header $1 + run_solver ev0p$POP $2 + run_solver ev5p$POP $2 + run_solver ev10p$POP $2 + run_solver ev15p$POP $2 + run_solver ev20p$POP $2 + run_solver ev25p$POP $2 + run_solver ev30p$POP $2 + run_solver ev35p$POP $2 + run_solver ev40p$POP $2 + run_solver ev45p$POP $2 + run_solver ev50p$POP $2 + run_solver ev55p$POP $2 + run_solver ev60p$POP $2 + run_solver ev65p$POP $2 + run_solver ev70p$POP $2 + run_solver ev75p$POP $2 + run_solver ev80p$POP $2 + run_solver ev85p$POP $2 + run_solver ev90p$POP $2 +} + +prepare_new_run +run_all_graphs "cbp(shedule=seq_fixed) " seq_fixed + diff --git a/packages/CLPBN/benchmarks/smokers_evidence/fove_tests.sh b/packages/CLPBN/benchmarks/smokers_evidence/fove_tests.sh new file mode 100755 index 000000000..09e346839 --- /dev/null +++ b/packages/CLPBN/benchmarks/smokers_evidence/fove_tests.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +source sm.sh +source ../benchs.sh + +SOLVER="fove" + +function run_all_graphs +{ + write_header $1 + run_solver ev0p$POP $2 + run_solver ev5p$POP $2 + run_solver ev10p$POP $2 + run_solver ev15p$POP $2 + run_solver ev20p$POP $2 + run_solver ev25p$POP $2 + run_solver ev30p$POP $2 + run_solver ev35p$POP $2 + run_solver ev40p$POP $2 + run_solver ev45p$POP $2 + run_solver ev50p$POP $2 + run_solver ev55p$POP $2 + run_solver ev60p$POP $2 + run_solver ev65p$POP $2 + run_solver ev70p$POP $2 + run_solver ev75p$POP $2 + run_solver ev80p$POP $2 + run_solver ev85p$POP $2 + run_solver ev90p$POP $2 +} + +prepare_new_run +run_all_graphs "fove " + + diff --git a/packages/CLPBN/benchmarks/smokers_evidence/gen_people.sh b/packages/CLPBN/benchmarks/smokers_evidence/gen_people.sh new file mode 100755 index 000000000..1a72cee03 --- /dev/null +++ b/packages/CLPBN/benchmarks/smokers_evidence/gen_people.sh @@ -0,0 +1,49 @@ +#!/home/tgomes/bin/yap -L -- + +:- use_module(library(lists)). +:- use_module(library(random)). + + +:- initialization(main). + +main :- + unix(argv(Args)), + nth(1, Args, EV), % percentage of evidence + nth(2, Args, NP), % number of individuals + atomic_concat(['ev', EV, 'p', NP, '.yap'], FileName), + open(FileName, 'write', S), + atom_number(EV, EV2), + atom_number(NP, NP2), + EV3 is EV2 / 100.0, + generate_people(S, NP2, 4), + write(S, '\n'), + write(S, 'query(X) :- '), + generate_evidence(S, NP2, EV3, 4), + write(S, 'friends(p1,p2,X).\n'), + close(S). + + +generate_people(S, N, Counting) :- + Counting > N, !. +generate_people(S, N, Counting) :- + format(S, 'people(p~w).~n', [Counting]), + Counting1 is Counting + 1, + generate_people(S, N, Counting1). + + +generate_evidence(S, N, Ev, Counting) :- + Counting > N, !. +generate_evidence(S, N, Ev, Counting) :- + random(X), + ( + X < Ev + -> + random(Y), + (Y > 0.5 -> Val = t ; Val = f), + format(S, 'smokes(p~w,~w),', [Counting,Val]) + ; + true + ), + Counting1 is Counting + 1, + generate_evidence(S, N, Ev, Counting1). + diff --git a/packages/CLPBN/benchmarks/smokers_evidence/hve_tests.sh b/packages/CLPBN/benchmarks/smokers_evidence/hve_tests.sh new file mode 100755 index 000000000..37cf1f9ab --- /dev/null +++ b/packages/CLPBN/benchmarks/smokers_evidence/hve_tests.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +source sm.sh +source ../benchs.sh + +SOLVER="hve" + +function run_all_graphs +{ + write_header $1 + run_solver ev0p$POP $2 + run_solver ev5p$POP $2 + run_solver ev10p$POP $2 + run_solver ev15p$POP $2 + run_solver ev20p$POP $2 + run_solver ev25p$POP $2 + run_solver ev30p$POP $2 + run_solver ev35p$POP $2 + run_solver ev40p$POP $2 + run_solver ev45p$POP $2 + run_solver ev50p$POP $2 + run_solver ev55p$POP $2 + run_solver ev60p$POP $2 + run_solver ev65p$POP $2 + run_solver ev70p$POP $2 + run_solver ev75p$POP $2 + run_solver ev80p$POP $2 + run_solver ev85p$POP $2 + run_solver ev90p$POP $2 +} + +prepare_new_run +run_all_graphs "hve(elim_heuristic=min_neighbors) " min_neighbors +#run_all_graphs "hve(elim_heuristic=min_weight) " min_weight +#run_all_graphs "hve(elim_heuristic=min_fill) " min_fill +#run_all_graphs "hve(elim_heuristic=weighted_min_fill) " weighted_min_fill + diff --git a/packages/CLPBN/benchmarks/smokers_evidence/lbp_tests.sh b/packages/CLPBN/benchmarks/smokers_evidence/lbp_tests.sh new file mode 100755 index 000000000..8ea7bbf61 --- /dev/null +++ b/packages/CLPBN/benchmarks/smokers_evidence/lbp_tests.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +source sm.sh +source ../benchs.sh + +SOLVER="lbp" + +function run_all_graphs +{ + write_header $1 + run_solver ev0p$POP $2 + run_solver ev5p$POP $2 + run_solver ev10p$POP $2 + run_solver ev15p$POP $2 + run_solver ev20p$POP $2 + run_solver ev25p$POP $2 + run_solver ev30p$POP $2 + run_solver ev35p$POP $2 + run_solver ev40p$POP $2 + run_solver ev45p$POP $2 + run_solver ev50p$POP $2 + run_solver ev55p$POP $2 + run_solver ev60p$POP $2 + run_solver ev65p$POP $2 + run_solver ev70p$POP $2 + run_solver ev75p$POP $2 + run_solver ev80p$POP $2 + run_solver ev85p$POP $2 + run_solver ev90p$POP $2 +} + +prepare_new_run +run_all_graphs "lbp(shedule=seq_fixed) " seq_fixed + diff --git a/packages/CLPBN/benchmarks/smokers_evidence/sm.sh b/packages/CLPBN/benchmarks/smokers_evidence/sm.sh new file mode 100755 index 000000000..59f6d9d39 --- /dev/null +++ b/packages/CLPBN/benchmarks/smokers_evidence/sm.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +NETWORK="'../../examples/social_domain2'" +SHORTNAME="sm" +QUERY="query(X)" + +POP=500 +