refactor the city benchmarks and introduce set_solver/1
This commit is contained in:
parent
f2fbbf29d8
commit
03013960d3
@ -47,7 +47,7 @@ extern InfAlgorithms infAlgorithm;
|
||||
namespace Constants {
|
||||
|
||||
// level of debug information
|
||||
const unsigned DEBUG = 5;
|
||||
const unsigned DEBUG = 0;
|
||||
|
||||
const int NO_EVIDENCE = -1;
|
||||
|
||||
|
@ -1,50 +1,61 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp ~/bin/yap ~/bin/town_bp
|
||||
YAP=~/bin/town_bp
|
||||
cp ~/bin/yap ~/bin/city_bp
|
||||
YAP=~/bin/city_bp
|
||||
|
||||
#OUT_FILE_NAME=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
OUT_FILE_NAME=bp.log
|
||||
rm -f $OUT_FILE_NAME
|
||||
rm -f ignore.$OUT_FILE_NAME
|
||||
LOG_FILE=bp.log
|
||||
#LOG_FILE=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
|
||||
CITY_LOCATION="'../../examples/city'"
|
||||
|
||||
rm -f $LOG_FILE
|
||||
rm -f ignore.$LOG_FILE
|
||||
|
||||
|
||||
function run_solver
|
||||
{
|
||||
if [ $2 = bp ]
|
||||
then
|
||||
extra_flag1=clpbn_horus:set_horus_flag\(inf_alg,$4\)
|
||||
extra_flag2=clpbn_horus:set_horus_flag\(schedule,$5\)
|
||||
else
|
||||
extra_flag1=true
|
||||
extra_flag2=true
|
||||
fi
|
||||
/usr/bin/time -o $OUT_FILE_NAME -a -f "real:%E\tuser:%U\tsys:%S" $YAP << EOF >> $OUT_FILE_NAME 2>> ignore.$OUT_FILE_NAME
|
||||
[$1].
|
||||
clpbn:set_clpbn_flag(solver,$2),
|
||||
clpbn_horus:set_horus_flag(use_logarithms, true),
|
||||
$extra_flag1, $extra_flag2,
|
||||
run_query(_R),
|
||||
open("$OUT_FILE_NAME", 'append',S),
|
||||
format(S, '$3: ~15+ ',[]),
|
||||
close(S).
|
||||
solver=$1
|
||||
network=$2
|
||||
solver_flag=true
|
||||
if [ -n "$3" ]; then
|
||||
if [ $solver = hve ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(elim_heuristic,$3\)
|
||||
elif [ $solver = bp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
elif [ $solver = cbp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
else
|
||||
echo "unknow flag $3"
|
||||
fi
|
||||
fi
|
||||
/usr/bin/time -o $LOG_FILE -a -f "real:%E\tuser:%U\tsys:%S" \
|
||||
$YAP << EOF >> $LOG_FILE 2>> ignore.$LOG_FILE
|
||||
[$CITY_LOCATION].
|
||||
[$network].
|
||||
clpbn_horus:set_solver($solver).
|
||||
clpbn_horus:set_horus_flag(use_logarithms, true).
|
||||
$solver_flag.
|
||||
is_joe_guilty(X).
|
||||
open("$LOG_FILE", 'append', S), format(S, '$network: ~15+ ', []), close(S).
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function run_all_graphs
|
||||
{
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
echo "results for solver $2" >> $OUT_FILE_NAME
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
run_solver town_1000 $1 town_1000 $3 $4 $5
|
||||
#run_solver town_5000 $1 town_5000 $3 $4 $5
|
||||
#run_solver town_10000 $1 town_10000 $3 $4 $5
|
||||
#run_solver town_50000 $1 town_50000 $3 $4 $5
|
||||
#run_solver town_100000 $1 town_100000 $3 $4 $5
|
||||
#run_solver town_500000 $1 town_500000 $3 $4 $5
|
||||
#run_solver town_1000000 $1 town_1000000 $3 $4 $5
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
echo "results for solver $2" >> $LOG_FILE
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
run_solver $1 city_5 $3
|
||||
#run_solver $1 city_1000 $3
|
||||
#run_solver $1 city_5000 $3
|
||||
#run_solver $1 city_10000 $3
|
||||
#run_solver $1 city_50000 $3
|
||||
#run_solver $1 city_100000 $3
|
||||
#run_solver $1 city_500000 $3
|
||||
#run_solver $1 city_1000000 $3
|
||||
}
|
||||
|
||||
run_all_graphs bp "bp(seq_fixed) z " bp seq_fixed
|
||||
run_all_graphs bp "bp(shedule=seq_fixed) " seq_fixed
|
||||
|
||||
|
@ -1,56 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp ~/bin/yap ~/bin/town_cbp
|
||||
YAP=~/bin/town_cbp
|
||||
cp ~/bin/yap ~/bin/city_cbp
|
||||
YAP=~/bin/city_cbp
|
||||
|
||||
#OUT_FILE_NAME=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
OUT_FILE_NAME=cbp.log
|
||||
rm -f $OUT_FILE_NAME
|
||||
rm -f ignore.$OUT_FILE_NAME
|
||||
LOG_FILE=cbp.log
|
||||
#LOG_FILE=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
|
||||
CITY_LOCATION="'../../examples/city'"
|
||||
|
||||
rm -f $LOG_FILE
|
||||
rm -f ignore.$LOG_FILE
|
||||
|
||||
|
||||
function run_solver
|
||||
{
|
||||
if [ $2 = bp ]
|
||||
then
|
||||
extra_flag1=clpbn_horus:set_horus_flag\(inf_alg,$4\)
|
||||
extra_flag2=clpbn_horus:set_horus_flag\(schedule,$5\)
|
||||
else
|
||||
extra_flag1=true
|
||||
extra_flag2=true
|
||||
fi
|
||||
/usr/bin/time -o $OUT_FILE_NAME -a -f "real:%E\tuser:%U\tsys:%S" $YAP << EOF >> $OUT_FILE_NAME 2>> ignore.$OUT_FILE_NAME
|
||||
[$1].
|
||||
clpbn:set_clpbn_flag(solver,$2),
|
||||
clpbn_horus:set_horus_flag(use_logarithms, true),
|
||||
$extra_flag1, $extra_flag2,
|
||||
run_query(_R),
|
||||
open("$OUT_FILE_NAME", 'append',S),
|
||||
format(S, '$3: ~15+ ',[]),
|
||||
close(S).
|
||||
solver=$1
|
||||
network=$2
|
||||
solver_flag=true
|
||||
if [ -n "$3" ]; then
|
||||
if [ $solver = hve ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(elim_heuristic,$3\)
|
||||
elif [ $solver = bp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
elif [ $solver = cbp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
else
|
||||
echo "unknow flag $3"
|
||||
fi
|
||||
fi
|
||||
/usr/bin/time -o $LOG_FILE -a -f "real:%E\tuser:%U\tsys:%S" \
|
||||
$YAP << EOF >> $LOG_FILE 2>> ignore.$LOG_FILE
|
||||
[$CITY_LOCATION].
|
||||
[$network].
|
||||
clpbn_horus:set_solver($solver).
|
||||
clpbn_horus:set_horus_flag(use_logarithms, true).
|
||||
$solver_flag.
|
||||
is_joe_guilty(X).
|
||||
open("$LOG_FILE", 'append', S), format(S, '$network: ~15+ ', []), close(S).
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function run_all_graphs
|
||||
{
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
echo "results for solver $2" >> $OUT_FILE_NAME
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
run_solver town_3 $1 town_3 $3 $4 $5
|
||||
return
|
||||
run_solver town_1000 $1 town_1000 $3 $4 $5
|
||||
run_solver town_5000 $1 town_5000 $3 $4 $5
|
||||
run_solver town_10000 $1 town_10000 $3 $4 $5
|
||||
run_solver town_50000 $1 town_50000 $3 $4 $5
|
||||
run_solver town_100000 $1 town_100000 $3 $4 $5
|
||||
run_solver town_500000 $1 town_500000 $3 $4 $5
|
||||
run_solver town_1000000 $1 town_1000000 $3 $4 $5
|
||||
run_solver town_2500000 $1 town_2500000 $3 $4 $5
|
||||
run_solver town_5000000 $1 town_5000000 $3 $4 $5
|
||||
run_solver town_7500000 $1 town_7500000 $3 $4 $5
|
||||
run_solver town_10000000 $1 town_10000000 $3 $4 $5
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
echo "results for solver $2" >> $LOG_FILE
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
run_solver $1 city_5 $3
|
||||
#run_solver $1 city_1000 $3
|
||||
#run_solver $1 city_5000 $3
|
||||
#run_solver $1 city_10000 $3
|
||||
#run_solver $1 city_50000 $3
|
||||
#run_solver $1 city_100000 $3
|
||||
#run_solver $1 city_500000 $3
|
||||
#run_solver $1 city_1000000 $3
|
||||
}
|
||||
|
||||
run_all_graphs bp "cbp(seq_fixed) " cbp seq_fixed
|
||||
run_all_graphs cbp "cbp(shedule=seq_fixed) " seq_fixed
|
||||
|
||||
|
62
packages/CLPBN/clpbn/bp/benchmarks/city/fove_tests.sh
Executable file
62
packages/CLPBN/clpbn/bp/benchmarks/city/fove_tests.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp ~/bin/yap ~/bin/city_fove
|
||||
YAP=~/bin/city_fove
|
||||
|
||||
LOG_FILE=fove.log
|
||||
#LOG_FILE=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
|
||||
CITY_LOCATION="'../../examples/city'"
|
||||
|
||||
rm -f $LOG_FILE
|
||||
rm -f ignore.$LOG_FILE
|
||||
|
||||
|
||||
function run_solver
|
||||
{
|
||||
solver=$1
|
||||
network=$2
|
||||
solver_flag=true
|
||||
if [ -n "$3" ]; then
|
||||
if [ $solver = hve ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(elim_heuristic,$3\)
|
||||
elif [ $solver = bp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
elif [ $solver = cbp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
else
|
||||
echo "unknow flag $3"
|
||||
fi
|
||||
fi
|
||||
/usr/bin/time -o $LOG_FILE -a -f "real:%E\tuser:%U\tsys:%S" \
|
||||
$YAP << EOF >> $LOG_FILE 2>> ignore.$LOG_FILE
|
||||
[$CITY_LOCATION].
|
||||
[$network].
|
||||
clpbn_horus:set_solver($solver).
|
||||
clpbn_horus:set_horus_flag(use_logarithms, true).
|
||||
$solver_flag.
|
||||
is_joe_guilty(X).
|
||||
open("$LOG_FILE", 'append', S), format(S, '$network: ~15+ ', []), close(S).
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function run_all_graphs
|
||||
{
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
echo "results for solver $2" >> $LOG_FILE
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
run_solver $1 city_5 $3
|
||||
#run_solver $1 city_1000 $3
|
||||
#run_solver $1 city_5000 $3
|
||||
#run_solver $1 city_10000 $3
|
||||
#run_solver $1 city_50000 $3
|
||||
#run_solver $1 city_100000 $3
|
||||
#run_solver $1 city_500000 $3
|
||||
#run_solver $1 city_1000000 $3
|
||||
}
|
||||
|
||||
run_all_graphs fove "fove "
|
||||
|
@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp ~/bin/yap ~/bin/town_gibbs
|
||||
YAP=~/bin/town_gibbs
|
||||
|
||||
#OUT_FILE_NAME=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
OUT_FILE_NAME=gibbs.log
|
||||
rm -f $OUT_FILE_NAME
|
||||
rm -f ignore.$OUT_FILE_NAME
|
||||
|
||||
|
||||
function run_solver
|
||||
{
|
||||
if [ $2 = bp ]
|
||||
then
|
||||
extra_flag1=clpbn_bp:set_horus_flag\(inf_alg,$4\)
|
||||
extra_flag2=clpbn_bp:set_horus_flag\(schedule,$5\)
|
||||
else
|
||||
extra_flag1=true
|
||||
extra_flag2=true
|
||||
fi
|
||||
/usr/bin/time -o $OUT_FILE_NAME -a -f "real:%E\tuser:%U\tsys:%S" $YAP << EOF >> $OUT_FILE_NAME 2>> ignore.$OUT_FILE_NAME
|
||||
[$1].
|
||||
clpbn:set_clpbn_flag(solver,$2),
|
||||
clpbn_bp:set_horus_flag(use_logarithms, true),
|
||||
$extra_flag1, $extra_flag2,
|
||||
run_query(_R),
|
||||
open("$OUT_FILE_NAME", 'append',S),
|
||||
format(S, '$3: ~15+ ',[]),
|
||||
close(S).
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function run_all_graphs
|
||||
{
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
echo "results for solver $2" >> $OUT_FILE_NAME
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
run_solver town_1000 $1 town_1000 $3 $4 $5
|
||||
run_solver town_5000 $1 town_5000 $3 $4 $5
|
||||
run_solver town_10000 $1 town_10000 $3 $4 $5
|
||||
run_solver town_50000 $1 town_50000 $3 $4 $5
|
||||
run_solver town_100000 $1 town_100000 $3 $4 $5
|
||||
run_solver town_500000 $1 town_500000 $3 $4 $5
|
||||
run_solver town_1000000 $1 town_1000000 $3 $4 $5
|
||||
}
|
||||
|
||||
run_all_graphs gibbs "gibbs "
|
||||
|
62
packages/CLPBN/clpbn/bp/benchmarks/city/hve_tests.sh
Executable file
62
packages/CLPBN/clpbn/bp/benchmarks/city/hve_tests.sh
Executable file
@ -0,0 +1,62 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp ~/bin/yap ~/bin/city_hve
|
||||
YAP=~/bin/city_hve
|
||||
|
||||
LOG_FILE=hve.log
|
||||
#LOG_FILE=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
|
||||
CITY_LOCATION="'../../examples/city'"
|
||||
|
||||
rm -f $LOG_FILE
|
||||
rm -f ignore.$LOG_FILE
|
||||
|
||||
|
||||
function run_solver
|
||||
{
|
||||
solver=$1
|
||||
network=$2
|
||||
solver_flag=true
|
||||
if [ -n "$3" ]; then
|
||||
if [ $solver = hve ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(elim_heuristic,$3\)
|
||||
elif [ $solver = bp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
elif [ $solver = cbp ]; then
|
||||
extra_flag=clpbn_horus:set_horus_flag\(schedule,$3\)
|
||||
else
|
||||
echo "unknow flag $3"
|
||||
fi
|
||||
fi
|
||||
/usr/bin/time -o $LOG_FILE -a -f "real:%E\tuser:%U\tsys:%S" \
|
||||
$YAP << EOF >> $LOG_FILE 2>> ignore.$LOG_FILE
|
||||
[$CITY_LOCATION].
|
||||
[$network].
|
||||
clpbn_horus:set_solver($solver).
|
||||
clpbn_horus:set_horus_flag(use_logarithms, true).
|
||||
$solver_flag.
|
||||
is_joe_guilty(X).
|
||||
open("$LOG_FILE", 'append', S), format(S, '$network: ~15+ ', []), close(S).
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function run_all_graphs
|
||||
{
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
echo "results for solver $2" >> $LOG_FILE
|
||||
echo -n "**********************************" >> $LOG_FILE
|
||||
echo "**********************************" >> $LOG_FILE
|
||||
run_solver $1 city_5 $3
|
||||
#run_solver $1 city_1000 $3
|
||||
#run_solver $1 city_5000 $3
|
||||
#run_solver $1 city_10000 $3
|
||||
#run_solver $1 city_50000 $3
|
||||
#run_solver $1 city_100000 $3
|
||||
#run_solver $1 city_500000 $3
|
||||
#run_solver $1 city_1000000 $3
|
||||
}
|
||||
|
||||
run_all_graphs hve "hve(elim_heuristic=min_neighbors) " min_neighbors
|
||||
|
@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp ~/bin/yap ~/bin/town_jt
|
||||
YAP=~/bin/town_jt
|
||||
|
||||
#OUT_FILE_NAME=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
OUT_FILE_NAME=jt.log
|
||||
rm -f $OUT_FILE_NAME
|
||||
rm -f ignore.$OUT_FILE_NAME
|
||||
|
||||
|
||||
function run_solver
|
||||
{
|
||||
if [ $2 = bp ]
|
||||
then
|
||||
extra_flag1=clpbn_bp:set_horus_flag\(inf_alg,$4\)
|
||||
extra_flag2=clpbn_bp:set_horus_flag\(schedule,$5\)
|
||||
else
|
||||
extra_flag1=true
|
||||
extra_flag2=true
|
||||
fi
|
||||
/usr/bin/time -o $OUT_FILE_NAME -a -f "real:%E\tuser:%U\tsys:%S" $YAP << EOF >> $OUT_FILE_NAME 2>> ignore.$OUT_FILE_NAME
|
||||
[$1].
|
||||
clpbn:set_clpbn_flag(solver,$2),
|
||||
clpbn_bp:set_horus_flag(use_logarithms, true),
|
||||
$extra_flag1, $extra_flag2,
|
||||
run_query(_R),
|
||||
open("$OUT_FILE_NAME", 'append',S),
|
||||
format(S, '$3: ~15+ ',[]),
|
||||
close(S).
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function run_all_graphs
|
||||
{
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
echo "results for solver $2" >> $OUT_FILE_NAME
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
run_solver town_1000 $1 town_1000 $3 $4 $5
|
||||
run_solver town_5000 $1 town_5000 $3 $4 $5
|
||||
run_solver town_10000 $1 town_10000 $3 $4 $5
|
||||
run_solver town_50000 $1 town_50000 $3 $4 $5
|
||||
run_solver town_100000 $1 town_100000 $3 $4 $5
|
||||
run_solver town_500000 $1 town_500000 $3 $4 $5
|
||||
run_solver town_1000000 $1 town_1000000 $3 $4 $5
|
||||
}
|
||||
|
||||
run_all_graphs jt "jt "
|
||||
|
@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
cp ~/bin/yap ~/bin/town_ve
|
||||
YAP=~/bin/town_ve
|
||||
|
||||
#OUT_FILE_NAME=results`date "+ %H:%M:%S %d-%m-%Y"`.log
|
||||
OUT_FILE_NAME=ve.log
|
||||
rm -f $OUT_FILE_NAME
|
||||
rm -f ignore.$OUT_FILE_NAME
|
||||
|
||||
|
||||
function run_solver
|
||||
{
|
||||
if [ $2 = bp ]
|
||||
then
|
||||
extra_flag1=clpbn_bp:set_horus_flag\(inf_alg,$4\)
|
||||
extra_flag2=clpbn_bp:set_horus_flag\(schedule,$5\)
|
||||
else
|
||||
extra_flag1=true
|
||||
extra_flag2=true
|
||||
fi
|
||||
/usr/bin/time -o $OUT_FILE_NAME -a -f "real:%E\tuser:%U\tsys:%S" $YAP << EOF >> $OUT_FILE_NAME 2>> ignore.$OUT_FILE_NAME
|
||||
[$1].
|
||||
clpbn:set_clpbn_flag(solver,$2),
|
||||
clpbn_bp:set_horus_flag(use_logarithms, true),
|
||||
$extra_flag1, $extra_flag2,
|
||||
run_query(_R),
|
||||
open("$OUT_FILE_NAME", 'append',S),
|
||||
format(S, '$3: ~15+ ',[]),
|
||||
close(S).
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
function run_all_graphs
|
||||
{
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
echo "results for solver $2" >> $OUT_FILE_NAME
|
||||
echo "*******************************************************************" >> "$OUT_FILE_NAME"
|
||||
run_solver town_1000 $1 town_1000 $3 $4 $5
|
||||
#run_solver town_5000 $1 town_5000 $3 $4 $5
|
||||
#run_solver town_10000 $1 town_10000 $3 $4 $5
|
||||
#run_solver town_50000 $1 town_50000 $3 $4 $5
|
||||
#run_solver town_100000 $1 town_100000 $3 $4 $5
|
||||
#run_solver town_500000 $1 town_500000 $3 $4 $5
|
||||
#run_solver town_1000000 $1 town_1000000 $3 $4 $5
|
||||
}
|
||||
|
||||
run_all_graphs ve "ve "
|
||||
|
@ -1,9 +1,9 @@
|
||||
:- use_module(library(pfl)).
|
||||
|
||||
:- set_pfl_flag(solver,fove).
|
||||
%:- 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,bp), clpbn_horus:set_horus_flag(inf_alg,cbp).
|
||||
:- clpbn_horus:set_solver(fove).
|
||||
%:- clpbn_horus:set_solver(hve).
|
||||
%:- clpbn_horus:set_solver(bp).
|
||||
%:- clpbn_horus:set_solver(cbp).
|
||||
|
||||
|
||||
people(joe,nyc).
|
||||
@ -14,9 +14,7 @@ people(p3, nyc).
|
||||
ev(descn(p2, t)).
|
||||
ev(descn(p3, t)).
|
||||
|
||||
|
||||
:- [city_7].
|
||||
|
||||
% :- [city_7].
|
||||
|
||||
bayes city_conservativeness(C)::[y,n] ; cons_table(C) ; [people(_,C)].
|
||||
|
||||
@ -84,15 +82,21 @@ wit_table([0.2, 0.45, 0.24, 0.34,
|
||||
|
||||
|
||||
runall(G, Wrapper) :-
|
||||
findall(G, Wrapper, L),
|
||||
execute_all(L).
|
||||
findall(G, Wrapper, L),
|
||||
execute_all(L).
|
||||
|
||||
|
||||
execute_all([]).
|
||||
execute_all(G.L) :-
|
||||
call(G),
|
||||
execute_all(L).
|
||||
call(G),
|
||||
execute_all(L).
|
||||
|
||||
|
||||
?- witness(nyc, t), runall(X, ev(X)), guilty(joe, Guilty).
|
||||
is_joe_guilty(Guilty) :-
|
||||
witness(nyc, t),
|
||||
runall(X, ev(X)),
|
||||
guilty(joe, Guilty).
|
||||
|
||||
|
||||
% ?- is_joe_guilty(Guilty)
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
:- use_module(library(pfl)).
|
||||
|
||||
:- set_pfl_flag(solver,fove).
|
||||
%:- 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,bp), clpbn_horus:set_horus_flag(inf_alg,cbp).
|
||||
:- clpbn_horus:set_solver(fove).
|
||||
%:- clpbn_horus:set_solver(hve).
|
||||
%:- clpbn_horus:set_solver(bp).
|
||||
%:- clpbn_horus:set_solver(cbp).
|
||||
|
||||
c(p1,w1).
|
||||
c(p1,w2).
|
||||
@ -25,5 +25,5 @@ markov attends(P)::[t,f] , hot(W)::[t,f] ; [0.1, 0.2, 0.3, 0.4] ; [c(P,W)].
|
||||
|
||||
markov attends(P)::[t,f], series::[t,f] ; [0.5, 0.6, 0.7, 0.8] ; [c(P,_)].
|
||||
|
||||
?- series(X).
|
||||
% ?- series(X).
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
:- use_module(library(pfl)).
|
||||
|
||||
:- set_pfl_flag(solver,fove).
|
||||
%:- 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,bp), clpbn_horus:set_horus_flag(inf_alg,cbp).
|
||||
:- clpbn_horus:set_solver(fove).
|
||||
%:- clpbn_horus:set_solver(hve).
|
||||
%:- clpbn_horus:set_solver(bp).
|
||||
%:- clpbn_horus:set_solver(cbp).
|
||||
|
||||
:- yap_flag(write_strings, off).
|
||||
|
||||
@ -19,5 +19,5 @@ markov smokes(P)::[t,f] , cancer(P)::[t,f] ; [0.1, 0.2, 0.3, 0.4] ; [person(P)].
|
||||
|
||||
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)].
|
||||
|
||||
?- smokes(person_1, t), smokes(person_2, f), friend(person_1, person_2, X).
|
||||
% ?- smokes(person_1, t), smokes(person_2, f), friend(person_1, person_2, X).
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
:- use_module(library(pfl)).
|
||||
|
||||
:- set_pfl_flag(solver,fove).
|
||||
%:- 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,bp), clpbn_horus:set_horus_flag(inf_alg,cbp).
|
||||
:- clpbn_horus:set_solver(fove).
|
||||
%:- clpbn_horus:set_solver(hve).
|
||||
%:- clpbn_horus:set_solver(bp).
|
||||
%:- clpbn_horus:set_solver(cbp).
|
||||
|
||||
c(p1).
|
||||
c(p2).
|
||||
|
@ -6,7 +6,8 @@
|
||||
********************************************************/
|
||||
|
||||
:- module(clpbn_horus,
|
||||
[create_lifted_network/3,
|
||||
[set_solver/1,
|
||||
create_lifted_network/3,
|
||||
create_ground_network/4,
|
||||
set_parfactors_params/2,
|
||||
set_factors_params/2,
|
||||
@ -19,6 +20,10 @@
|
||||
]).
|
||||
|
||||
|
||||
:- use_module(library(pfl),
|
||||
[set_pfl_flag/2]).
|
||||
|
||||
|
||||
patch_things_up :-
|
||||
assert_static(clpbn_horus:set_horus_flag(_,_)).
|
||||
|
||||
@ -28,7 +33,17 @@ warning :-
|
||||
:- catch(load_foreign_files([horus], [], init_predicates), _, patch_things_up) -> true ; warning.
|
||||
|
||||
|
||||
:- set_horus_flag(inf_alg, ve).
|
||||
set_solver(ve) :- set_pfl_flag(solver,ve).
|
||||
set_solver(jt) :- set_pfl_flag(solver,jt).
|
||||
set_solver(gibbs) :- set_pfl_flag(solver,gibbs).
|
||||
set_solver(fove) :- set_pfl_flag(solver,fove).
|
||||
set_solver(hve) :- set_pfl_flag(solver,bp), set_horus_flag(inf_alg, ve).
|
||||
set_solver(bp) :- set_pfl_flag(solver,bp), set_horus_flag(inf_alg, bp).
|
||||
set_solver(cbp) :- set_pfl_flag(solver,bp), set_horus_flag(inf_alg, cbp).
|
||||
set_solver(S) :- throw(error('unknow solver ', S)).
|
||||
|
||||
|
||||
%:- set_horus_flag(inf_alg, ve).
|
||||
%:- set_horus_flag(inf_alg, bp).
|
||||
%: -set_horus_flag(inf_alg, cbp).
|
||||
|
||||
@ -44,7 +59,6 @@ warning :-
|
||||
:- set_horus_flag(order_factor_variables, false).
|
||||
%:- set_horus_flag(order_factor_variables, true).
|
||||
|
||||
|
||||
:- set_horus_flag(use_logarithms, false).
|
||||
% :- set_horus_flag(use_logarithms, true).
|
||||
|
||||
|
Reference in New Issue
Block a user