-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.py
77 lines (71 loc) · 2.31 KB
/
args.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
76
77
import sys
def parseArgs(cl):
args = {'r':-1,'e':'greedy0.1','a':'constant0.5','i':15,'d':'constant0.7','p':'movAvg','m':'young'}
for n in range(len(cl)):
if cl[n] == '-h':
print ""
sys.exit()
### ITERATIONS ###################
if cl[n] == '-i':
args['i'] = int(cl[n+1])
### GAMMA / DISCOUNT #############
if cl[n] == '-dConstant':
args['d'] = 'constant' + cl[n+1]
if cl[n] == '-dLinear':
args['d'] = 'linear'
if cl[n] == '-dQuick':
args['d'] = 'quick'
### EPSILON ######################
if cl[n] == '-eGreedy':
args['e'] = 'greedy'+cl[n+1]
if cl[n] == '-eLinear':
args['e'] = 'linear'
if cl[n] == '-eExponential':
args['e'] = 'exponential'
if cl[n] == '-eSoftmax':
args['e'] = 'softmax'
if cl[n] == '-eGlie':
args['e'] = 'glie'
### ALPHA #########################
if cl[n] == '-aConstant':
args['a'] = 'constant'+cl[n+1]
if cl[n] == '-aLinear':
args['a'] = 'linear'
if cl[n] == '-aExponential':
args['a'] = 'exponential'
### PLOT OPTION ###################
if cl[n] == '-movAvg':
args['p'] = 'movAvg'
if cl[n] == '-polynomial':
args['p'] = 'polynomial'
### ANIMAL COMPARISON #############
if cl[n] == '-mdpYoung':
args['m'] = 'young'
if cl[n] == '-mdpOld':
args['m'] = 'old'
return args
def eps(parameters):
if parameters['e'] == 'linear':
return '-Linear'
if parameters['e'] == 'exponential':
return '-Exponential'
if parameters['e'] == 'softmax':
return 'Softmax'
if parameters['e'] == 'glie':
return 'GLIE'
else:
return parameters['e'][6:]
def alp(parameters):
if 'constant' in parameters['a']:
return parameters['a'][8:]
if parameters['a'] == 'linear':
return '-Linear'
if parameters['a'] == 'exponential':
return '-Exponential'
def dis(parameters):
if parameters['d'] == 'linear':
return '-Linear'
if parameters['d'] == 'quick':
return 'x/(x+1)'
if 'constant' in parameters['d']:
return parameters['d'][8:]