-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_experiment.sh
executable file
·73 lines (48 loc) · 1.46 KB
/
start_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
#!/usr/bin/env bash
# Example: ./start_experiment.sh fsm 0 1 &> fsm-0-1_log.txt &!
set -e
if [[ "$1" == "fsm" || "$1" == "bnn" || "$1" == "bnn_twist" ]]; then
BIN_NAME="$1"
else
echo "First argument (valid experiments): fsm|bnn|bnn_twist" >&2; exit 1;
fi
if [[ -n "$2" && $2 =~ ^[0-9]+$ ]]; then
NUM_OBSTACLES="$2"
else
echo "Second argument (number of obstacles) must be an integer" >&2; exit 1;
fi
if [[ -n "$3" && $3 =~ ^[0-9]+$ ]]; then
NUM_TRIALS="$3"
else
echo "Third argument (number of trials) must be an integer" >&2; exit 1;
fi
if [ ! -d "experiments" ]; then
echo "Expected to find 'experiments' directory" >&2; exit 1;
fi
function run_and_time () {
echo $@
{ $@ &> run_log.txt ; } &> run_time.txt
}
# Build the binaries
cd src
./build_linux.sh all
cd ..
# Create the directory and copy files
EXP_DIR="./experiments/""$BIN_NAME""-""$NUM_OBSTACLES""-""$NUM_TRIALS"
mkdir -p "$EXP_DIR""/bin"
cp "src/bin/ugv_""$BIN_NAME" "$EXP_DIR""/bin"
cp "src/ugv_""$BIN_NAME""/evolve_ugv_""$BIN_NAME"".py" "$EXP_DIR""/bin"
cd "$EXP_DIR"
NUM_REPS=20
for (( i = 1; i <= $NUM_REPS; i++ )); do
repname="seed"$(printf %02d $i)
# Don't recreate or overwrite current directories
if [ ! -d "$repname" ]; then
mkdir $repname
cd $repname
run_and_time "../bin/evolve_ugv_""$BIN_NAME"".py --seed $i --obst $NUM_OBSTACLES --evals $NUM_TRIALS"
cd ..
else
echo "$repname"" already exists"
fi
done