blob: 474f7be77cc3501c4c282e513679f2449fecd118 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#!/bin/bash
# SETUP
TIME_LIMIT=300 # In seconds, per query
NUM_PROBLEMS=1350 # First n problems from models path (e.g. MCC2022/)
STRATEGIES=(
"RDFS --seed-offset 5760351"
"BestFS"
"DFS"
"BFS"
)
# DO NOT CHANGE THIS BELOW THIS POINT
PIPELINE_PATH=$(dirname "$0")
main() {
if [ $# -eq 0 ]; then
help; exit 1
fi
case "$1" in
-h|--help)
help
exit
;;
*)
BINARY="$1"
MODELS_PATH="$2"
OUTPUT_PATH="$3"
;;
esac
if [[ ! -d "$MODELS_PATH" ]]; then
echo "error: invalid models path"
exit 1
fi
OUTPUT_PATH="$OUTPUT_PATH/$(date -u +"%d-%m-%YT%H.%M.%S")"
mkdir -p "$OUTPUT_PATH/pipeline"
cp $PIPELINE_PATH/{start,run-model} "$OUTPUT_PATH/pipeline"
details > "$OUTPUT_PATH/pipeline/details"
start_jobs
}
start_jobs() {
STRAT_LEN=${#STRATEGIES[@]}
serialize_array STRATEGIES STRAT_STR "|"
TOTAL_TIME_LIMIT=$(echo "($TIME_LIMIT * $STRAT_LEN * 16) / 60 + 1" | bc)
for MODEL in $(ls "$MODELS_PATH" | head -n "$NUM_PROBLEMS"); do
sbatch --time "$TOTAL_TIME_LIMIT" "$PIPELINE_PATH/run-model" "$BINARY" "$TIME_LIMIT" "$STRAT_STR" "$MODELS_PATH/$MODEL" "$OUTPUT_PATH/$MODEL.csv"
# timeout "${TOTAL_TIME_LIMIT}m" "$PIPELINE_PATH/run-model" "$BINARY" "$TIME_LIMIT" "$STRAT_STR" "$MODELS_PATH/$MODEL" "$OUTPUT_PATH/$MODEL.csv"
done
}
details() {
echo -e "BINARY:\t\t$BINARY"
echo -e "MODELS_PATH:\t$MODELS_PATH"
echo -e "OUTPUT_PATH:\t$OUTPUT_PATH"
echo -e "TIME_LIMIT:\t$TIME_LIMIT"
echo -e "NUM_PROBLEMS:\t$NUM_PROBLEMS"
echo
echo "STRATEGIES:"
printf ' %s\n' "${STRATEGIES[@]}"
echo
date
}
serialize_array() {
declare -n _array="${1}" _str="${2}" # _array, _str => local reference vars
local IFS="${3:-$'\x01'}"
# shellcheck disable=SC2034 # Reference vars assumed used by caller
_str="${_array[*]}" # * => join on IFS
}
help() {
cat << EOF
Usage: $0 BINARY MODELS-PATH OUTPUT-PATH
Run TAPAAL heuristic search experiment.
Number of models to run, time limit and search strategies can be
configured in the top of this script.
EOF
}
main "$@"
|