-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval_robustness.sh
85 lines (69 loc) · 3.08 KB
/
eval_robustness.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
# Arguments:
# $1: model_name
# $2: trace directory
# $3: results directory
model_name=$1
trace_dir=$2
results_dir=$3
# Check if number of arguments is correct.
if [ "$#" -ne 3 ]
then
echo "Usage: $0 <model_name> <trace_dir> <results_dir>"
exit 1
fi
fixed_bw_traces=("wired6" "wired12" "wired24" "wired48" "wired96" "wired192")
pushd $HOME/ConstrainedOrca
# Run for 3 runs.
for run in 0 1 2
do
# Create a directory for the run.
mkdir -p ${results_dir}/run${run}
# Iterate over all traces in the trace directory.
for trace in $(ls $trace_dir)
do
# Check if the trace is a file.
if [ -f $trace_dir/$trace ]
then
# If the trace is a fixed bandwidth trace, then run only if it is in the fixed_bw_traces list.
if [[ $trace == *"wired"* ]]
then
if [[ ! " ${fixed_bw_traces[@]} " =~ " ${trace} " ]]
then
echo "Skipping $trace. Fixed bandwidth trace not in traces of concern."
continue
fi
continue
fi
echo "[INFO] Running robustness evaluation for $trace."
mkdir -p ${results_dir}/run${run}/${trace}-eval
# Evaluate baseline model.
./robustness.sh $model_name 0 0 0.05 uniform $trace
# Move the evaluation log files to the results directory.
mkdir -p ${results_dir}/run${run}/${trace}-eval/baseline
cp $HOME/ConstrainedOrca/rl-module/evaluation_log/seed0/*${trace}* ${results_dir}/run${run}/${trace}-eval/baseline/
# Evaluate model with noise.
# ./robustness.sh $model_name 1 0 0.05 uniform $trace
# mkdir -p ${results_dir}/run${run}/${trace}-eval/noise-Thr-0.05
# cp $HOME/ConstrainedOrca/rl-module/evaluation_log/seed0/*${trace}* ${results_dir}/run${run}/${trace}-eval/noise-Thr-0.05/
# sleep 5
./robustness.sh $model_name 1 5 0.05 uniform $trace
mkdir -p ${results_dir}/run${run}/${trace}-eval/noise-Delay-0.05
cp $HOME/ConstrainedOrca/rl-module/evaluation_log/seed0/*${trace}* ${results_dir}/run${run}/${trace}-eval/noise-Delay-0.05/
sleep 5
# ./robustness.sh $model_name 1 0 0.1 uniform $trace
# mkdir -p ${results_dir}/run${run}/${trace}-eval/noise-Thr-0.1
# cp $HOME/ConstrainedOrca/rl-module/evaluation_log/seed0/*${trace}* ${results_dir}/run${run}/${trace}-eval/noise-Thr-0.1/
# sleep 5
# ./robustness.sh $model_name 1 5 0.1 uniform $trace
# mkdir -p ${results_dir}/run${run}/${trace}-eval/noise-Delay-0.1
# cp $HOME/ConstrainedOrca/rl-module/evaluation_log/seed0/*${trace}* ${results_dir}/run${run}/${trace}-eval/noise-Delay-0.1/
# Move the result files from /mydata/log to the results directory.
mv /mydata/log/$trace ${results_dir}/run${run}/
echo "[INFO] Evaluation completed for $trace. Sleeping 5 seconds."
sleep 5
else
echo "Skipping $trace. Not a file."
fi
done
done
popd