4 import matplotlib.pyplot
as plt
10 rootfilename =
"actionValuesForState" 11 print "Processing state", state,
"...\n" 12 filename = rootfilename + str(state) +
"action" + str(action)
13 with open(filename)
as f:
15 value = [float(line)
for line
in f]
16 labl = str(state) +
"-" + str(action)
17 plt.plot(value, drawstyle=
'steps-post', label=labl)
19 pair = [line.split(
" ")
for line
in f]
20 time = [float(elem[0])
for elem
in pair]
21 value = [float(elem[1])
for elem
in pair]
22 labl = str(state) +
"-" + str(action)
23 plt.plot(time, value, drawstyle=
'steps-post', label=labl)
29 with open(
"rlfile.txt")
as f:
30 splitlines = [line.rstrip().split(
" ")
for line
in f]
31 for line
in splitlines:
32 actions = [float(a) > -70000
for a
in line]
36 for state
in range(144):
37 for action
in range(3):
38 if array[state][action]:
40 plt.legend(loc=
'upper left', bbox_to_anchor=(1, 1), ncol=2, borderaxespad=0)
45 if __name__ ==
'__main__':
def actionValuePlot(state, action)