2012-05-23 14:56:01 +01:00
|
|
|
|
|
|
|
function prepare_new_run
|
|
|
|
{
|
|
|
|
YAP=~/bin/$SHORTNAME-$SOLVER
|
|
|
|
|
|
|
|
LOG_FILE=$SOLVER.log
|
|
|
|
#LOG_FILE=results`date "+ %H:%M:%S %d-%m-%Y"`.
|
|
|
|
|
|
|
|
rm -f $LOG_FILE
|
|
|
|
rm -f ignore.$LOG_FILE
|
|
|
|
|
|
|
|
cp ~/bin/yap $YAP
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function run_solver
|
|
|
|
{
|
2013-01-09 15:25:14 +00:00
|
|
|
echo $LOG_FILE
|
|
|
|
CONSTRAINT=$1
|
2012-05-23 14:56:01 +01:00
|
|
|
solver_flag=true
|
|
|
|
if [ -n "$2" ]; then
|
|
|
|
if [ $SOLVER = hve ]; then
|
2013-01-09 15:25:14 +00:00
|
|
|
SOLVER_FLAG=set_horus_flag\(hve_elim_heuristic,$2\)
|
2012-05-23 14:56:01 +01:00
|
|
|
elif [ $SOLVER = bp ]; then
|
2013-01-09 15:25:14 +00:00
|
|
|
SOLVER_FLAG=set_horus_flag\(bp_msg_schedule,$2\)
|
2012-05-23 14:56:01 +01:00
|
|
|
elif [ $SOLVER = cbp ]; then
|
2013-01-09 15:25:14 +00:00
|
|
|
SOLVER_FLAG=set_horus_flag\(bp_msg_schedule,$2\)
|
2012-06-05 15:33:24 +01:00
|
|
|
elif [ $SOLVER = lbp ]; then
|
2013-01-09 15:25:14 +00:00
|
|
|
SOLVER_FLAG=set_horus_flag\(bp_msg_schedule,$2\)
|
2012-05-23 14:56:01 +01:00
|
|
|
else
|
|
|
|
echo "unknow flag $2"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
/usr/bin/time -o $LOG_FILE -a -f "%U\t%S\t%e\t%M" \
|
2013-01-09 15:25:14 +00:00
|
|
|
$YAP << EOF >> ignore.$LOG_FILE 2>> ignore.$LOG_FILE
|
2012-05-23 14:56:01 +01:00
|
|
|
nogc.
|
|
|
|
[$NETWORK].
|
2013-01-09 15:25:14 +00:00
|
|
|
[$CONSTRAINT].
|
|
|
|
set_solver($SOLVER).
|
|
|
|
set_horus_flag(verbosity, 1).
|
|
|
|
set_horus_flag(use_logarithms, true).
|
|
|
|
$SOLVER_FLAG.
|
2012-05-23 14:56:01 +01:00
|
|
|
$QUERY.
|
2013-01-09 15:25:14 +00:00
|
|
|
open("$LOG_FILE", 'append', S), format(S, "$CONSTRAINT ~15+ ", []), close(S).
|
2012-05-23 14:56:01 +01:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function clear_log_files
|
|
|
|
{
|
|
|
|
rm -f *~
|
|
|
|
rm -f ../*~
|
|
|
|
rm -f workshop_attrs/*.log workshop_attrs/*~
|
|
|
|
rm -f ../workshop_attrs/*.log ../workshop_attrs/*~
|
2013-01-09 15:25:14 +00:00
|
|
|
rm -f comp_workshops/*.log comp_workshops/*~
|
|
|
|
rm -f ../comp_workshops/*.log ../comp_workshops/*~
|
|
|
|
rm -f city/*.log city/*~
|
|
|
|
rm -f ../city/*.log ../city/*~
|
|
|
|
rm -f social_network2/*.log social_network2/*~
|
|
|
|
rm -f ../social_network2/*.log ../social_network2/*~
|
|
|
|
rm -f social_network2_evidence/*.log social_network2_evidence/*~
|
|
|
|
rm -f ../social_network2_evidence/*.log ../social_network2_evidence/*~
|
2012-05-23 14:56:01 +01:00
|
|
|
echo all done!
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function write_header
|
|
|
|
{
|
|
|
|
echo -n "****************************************" >> $LOG_FILE
|
|
|
|
echo "****************************************" >> $LOG_FILE
|
|
|
|
echo "results for solver $1 user(s) sys(s) real(s), mem(kB)" >> $LOG_FILE
|
|
|
|
echo -n "****************************************" >> $LOG_FILE
|
|
|
|
echo "****************************************" >> $LOG_FILE
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [ $1 ] && [ $1 == "clean" ]; then
|
|
|
|
clear_log_files
|
|
|
|
fi
|
|
|
|
|
|
|
|
|