-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_experiment.sh
executable file
·95 lines (75 loc) · 1.96 KB
/
run_experiment.sh
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
93
94
#!/usr/bin/env bash
# ###########################################################
#
# PARSE INPUT
usage="
Usage: $(basename "$0") [-h] -s series -e experiment -i iterations -l learner
where:
-s series folder in experiments
-e experiment (name of xml file w/o .xml)
-l learner (slstar, sllambda or sldt)
-i iterations
"
series=""
experiment=""
iterations=""
learner=""
while getopts 'hs:e:i:l:' option; do
case "$option" in
h) echo "$usage"
exit
;;
s) series=$OPTARG
;;
e) experiment=$OPTARG
;;
i) iterations=$OPTARG
;;
l) learner=$OPTARG
;;
:) printf "missing argument for -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
echo "$usage" >&2
exit 1
;;
esac
done
if [ -z "$series" -o -z "$experiment" -o -z "$iterations" -o -z "$learner" ]; then
echo "$usage" >&2
exit 1
fi
# BUILD CONFIG
config=experiments/$series/config
model=experiments/$series/$experiment.xml
results=results/$series/$experiment-$learner
# PREPARE FILES AND DIRS
rm -Rf "$results"
mkdir -p "$results"
# EXECUTE
for c in $(seq 1 "$iterations")
do
rm -Rf model.xml
rm -Rf learn.log
rm -Rf hs_err_pid*
echo "Running: $c"
for r in $(seq 1 3)
do
java -Xmx7G -ea -jar ./ralib/target/ralib-0.1-SNAPSHOT-jar-with-dependencies.jar iosimulator -f "$config" learner="$learner" target="$model" > learn.log 2>&1
if [ "0" == `ls hs_err_pid* 2> /dev/null | wc -l` ]; then
break;
fi
rm -Rf hs_err_pid*
echo " attempt $r failed"
done
if [ "0" == `less learn.log | grep "= STOP =" | wc -l` ]; then
seed=$(less learn.log | grep "RANDOM SEED")
echo "Problem with iteration $c, $seed, $learner."
fi
less learn.log | grep "Last EQ Test found a counterexample"
mv learn.log "$results"/learn-"$learner"-"$c".log
mv model.xml "$results"/model-"$learner"-"$c".xml
rm -Rf hs_err_pid*
done