-
Notifications
You must be signed in to change notification settings - Fork 0
/
single_d4rl_run_file.sh
173 lines (167 loc) · 6.22 KB
/
single_d4rl_run_file.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
algo="iqln"
n_ensemble="10"
n_steps="5000"
weight_temp="3.0"
expectile="0.7"
expectile_min="0.7"
expectile_max="0.7"
update_ratio="0.3"
alpha="2"
dataset="halfcheetah"
dataset_nums="3000-0"
mix_type="random"
clone_actor=""
clear_network=""
max_save_num="10"
actor_replay_type="orl"
actor_replay_lambda="1"
critic_replay_type="orl"
critic_replay_lambda="1"
entropy_time="0"
test_=""
gpu=0
echo original parameters=[$@]
ARGS=`getopt -o a:s:d:m: --long algo:,n_ensemble:,n_steps:,weight_temp:,expectile:,expectile_min:,expectile_max:,update_ratio:,alpha:,dataset:,dataset_nums:,mix_type:,clone_actor,clear_network,max_save_num:,actor_replay_type:,actor_replay_lambda:,critic_replay_type:,critic_replay_lambda:,entropy_time:,gpu:,test_ -n "$0" -- "$@"`
if [ $? != 0 ]; then
echo "Terminating..."
exit 1
fi
echo ARGS=[$ARGS]
#将规范化后的命令行参数分配至位置参数($1,$2,...)
eval set -- "${ARGS}"
echo formatted parameters=[$@]
while true
do
case "$1" in
-a|--algo)
algo=$2
shift 2
;;
--n_ensemble)
n_ensemble=$2
shift 2
;;
-s|--n_steps)
n_steps=$2
shift 2
;;
--weight_temp)
weight_temp=$2
shift 2
;;
--expectile)
expectile=$2
shift 2
;;
--expectile_min)
expectile_min=$2
shift 2
;;
--expectile_max)
expectile_max=$2
shift 2
;;
--update_ratio)
update_ratio=$2
shift 2
;;
--alpha)
alpha=$2
shift 2
;;
--dataset)
dataset=$2
shift 2
;;
--dataset_nums)
dataset_nums=$2
shift 2
;;
--mix_type)
mix_type=$2
shift 2
;;
--max_save_num)
max_save_num=$2
shift 2
;;
--actor_replay_type)
actor_replay_type=$2
shift 2
;;
--actor_replay_lambda)
actor_replay_lambda=$2
shift 2
;;
--critic_replay_type)
critic_replay_type=$2
shift 2
;;
--critic_replay_lambda)
critic_replay_lambda=$2
shift 2
;;
--entropy_time)
entropy_time=$2
shift 2
;;
--gpu)
gpu=$2
shift 2
;;
--clone_actor)
clone_actor="--clone_actor"
shift;
;;
--clear_network)
clear_network="--clear_network"
shift;
;;
--test_)
test_="--test"
shift;
;;
--)
shift
break
;;
*)
echo "Internal error!"
exit 1
;;
esac
done
if [[ $clone_actor == "--clone_actor" ]]
then
clone_actor_str="cloneactor"
else
clone_actor_str=""
fi
if [[ $clear_network == "--clear_network" ]]
then
clear_network_str="_clearnetwork"
else
clear_network_str=""
fi
if [[ $algo == "sql" || $algo == "sqln" ]]
then
if [[ $test_ == "--test" ]]
then
task_id=${algo}_${n_ensemble}_${alpha}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_0_test
output_file=single_output_files/output_${algo}_${n_ensemble}_${alpha}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_test.txt
else
task_id=${algo}_${n_ensemble}_${alpha}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_0
output_file=single_output_files/output_${algo}_${n_ensemble}_${alpha}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_0_$(date +%Y%m%d%H%M%S).txt
fi
else
if [[ $test_ == "--test" ]]
then
task_id=${algo}_${n_ensemble}_${weight_temp}_${expectile}_${expectile_min}_${expectile_max}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_0_test
output_file=single_output_files/output_${algo}_${n_ensemble}_${weight_temp}_${expectile}_${expectile_min}_${expectile_max}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_test.txt
else
task_id=${algo}_${n_ensemble}_${expectile}_${expectile_min}_${expectile_max}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_0
output_file=single_output_files/output_${algo}_${n_ensemble}_${weight_temp}_${expectile}_${expectile_min}_${expectile_max}_${dataset}_${dataset_nums}_${n_steps}_${actor_replay_type}_${actor_replay_lambda}_${critic_replay_type}_${critic_replay_lambda}_${entropy_time}_${clone_actor_str}_${mix_type}_${max_save_num}${clear_network_str}_0_$(date +%Y%m%d%H%M%S).txt
fi
fi
echo "output_file is $output_file"
python continual_single.py --algo ${algo} --alpha ${alpha} --update_ratio ${update_ratio} --n_ensemble ${n_ensemble} --experience_type random_episode --dataset ${dataset} --dataset_nums ${dataset_nums} --max_save_num ${max_save_num} --critic_replay_type ${critic_replay_type} --critic_replay_lambda ${critic_replay_lambda} --actor_replay_type ${actor_replay_type} --actor_replay_lambda ${actor_replay_lambda} ${clone_actor} ${clear_network} --mix_type ${mix_type} --weight_temp ${weight_temp} --expectile ${expectile} --expectile_min ${expectile_min} --expectile_max ${expectile_max} --entropy_time ${entropy_time} --n_steps=${n_steps} --seed 0 --read_policy -1 --gpu ${gpu} | tee $output_file