-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_theta_test.py
75 lines (61 loc) · 2.74 KB
/
run_theta_test.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
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
import subprocess
import numpy as np
# subprocess.run(['git', 'pull'])
# subprocess.run(['git', 'add', '-A'])
# subprocess.run(['git', 'commit', '-m', 'Automated push: Test for sigma'])
# subprocess.run(['git', 'push'])
print('Running theta test')
sigma = str(0.05)
iterations = str(150)
number_of_equal_runs = 5
python_interpreter = #!INSERT PATH TO PYTHON INTERPRETER HERE
path = '/home/thops19/Documents/9semester/Project-in-Artificial-Intelligence-gym-challenge-/'
data_path = 'data'
subdir = 'TRPO_theta_test_sigma_' + sigma
base_log_name = 'TRPO_theta_'
theta_test =[0.1, 0.2, 0.5, 1.0, 2.0, 3.0, 5.0]
# # Run the test for different sigma values
for j in range(0,number_of_equal_runs):
# round to 2 decimals
for i in theta_test:
theta = round(i, 3)
str_theta = str(theta) #add so 3 decimals are used
while 1:
if len(str_theta) <= 3:
break
str_theta += '0'
log_name = base_log_name + str_theta + '_number_' + str(j)
# Create the command
# print('sigma = ' + str_sigma + ' number ' + str(j))
print(log_name)
command = [python_interpreter, path+'main.py', '--use_trpo', 'True', '--path', data_path,'--subdir', subdir, '--log_name', log_name, '--it', iterations, '--n_steps', '1024', '--sigma', str(sigma), '--theta', str(theta)]
subprocess.run(command)
#push to git
# subprocess.run(['git', 'pull'])
# subprocess.run(['git', 'add', '-A'])
# subprocess.run(['git', 'commit', '-m', 'Automated push: Test for sigma = ' + str(sigma) + ' number ' + str(j)])
# subprocess.run(['git', 'push'])
#####RUN PPO
subdir = 'PPO_theta_test_sigma_' + sigma
base_log_name = 'PPO_theta_'
# # Run the test for different sigma values
for j in range(0,number_of_equal_runs):
# round to 2 decimals
for i in theta_test:
theta = round(i, 3)
str_theta = str(theta) #add so 3 decimals are used
while 1:
if len(str_theta) <= 3:
break
str_theta += '0'
log_name = base_log_name + str_theta + '_number_' + str(j)
# Create the command
# print('sigma = ' + str_sigma + ' number ' + str(j))
print(log_name)
command = [python_interpreter, path+'main.py', '--use_ppo', 'True', '--path', data_path,'--subdir', subdir, '--log_name', log_name, '--it', iterations, '--n_steps', '1024', '--sigma', str(sigma), '--theta', str(theta)]
subprocess.run(command)
#push to git
# subprocess.run(['git', 'pull'])
# subprocess.run(['git', 'add', '-A'])
# subprocess.run(['git', 'commit', '-m', 'Automated push: Test for sigma = ' + str(sigma) + ' number ' + str(j)])
# subprocess.run(['git', 'push'])