-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_shell4.py
executable file
·42 lines (31 loc) · 981 Bytes
/
main_shell4.py
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
#!/usr/bin/env python
"""
run the main4.py file for multiple times (runs)
Author: Qiong
"""
# import os
import pickle
# import main4 as main4
import sys
N_RUN = 3
i_run = 0
while i_run < N_RUN:
# execute the code for N_RUN times
print("********Run {} starts********".format(i_run))
if i_run == 0:
sys.argv = ['main.py', '--seed=1']
elif i_run == 1:
sys.argv = ['main.py', '--seed=21']
elif i_run == 2:
sys.argv = ['main.py', '--seed=42']
exec(open("main4.py").read())
# execfile('main4.py') # removed in python 3.x
# os.system("python main4.py")
# f = os.popen("python main4.py")
# print(prio_reward)
with open("saved/prio_memo_e004_May_train_time_run{}.data".format(i_run), "wb") as fp:
pickle.dump(prio_memory, fp)
# save reward to json file
with open("saved/prio_reward_e004_May_train_time_run{}.data".format(i_run), "wb") as fp:
pickle.dump(prio_reward, fp)
i_run += 1