In [15]:
using JLD
push!(LOAD_PATH,joinpath("..","src"))
using Multilane
In [16]:
d = load("results.jld")
In [14]:
import Base: mean, std
function mean(ncs::NoCrashStats)
t = Real[stat.t_in_goal for stat in ncs.stats]
b = Real[stat.nb_induced_brakes for stat in ncs.stats]
r = Real[stat.reward for stat in ncs.stats]
return mean(t), mean(b), mean(r)
end
function std(ncs::NoCrashStats)
t = Real[stat.t_in_goal for stat in ncs.stats]
b = Real[stat.nb_induced_brakes for stat in ncs.stats]
r = Real[stat.reward for stat in ncs.stats]
return std(t), std(b), std(r)
end
function ste(ncs::NoCrashStats)
t,b,r = std(ncs)
return t/sqrt(length(ncs)), b/sqrt(length(ncs)), r/sqrt(length(ncs))
end
Out[14]:
In [5]:
dpw = [string("dpw",k) for k in 1:10]
single_dpw = [string("single_dpw",k) for k in 1:10]
Out[5]:
In [6]:
using PyPlot
In [7]:
random = mean(d["random"])
In [8]:
heur = mean(d["simple_heuristic"])
dpw = [mean(d[s]) for s in dpw]
single_dpw = [mean(d[s]) for s in single_dpw]
In [9]:
dpw_x = [x[1] for x in dpw]
dpy_y = [x[2] for x in dpw]
single_dpw_x = [x[1] for x in single_dpw]
single_dpw_y = [x[2] for x in single_dpw]
pomcp_dpw_x = [0,7,16.5,7.6,9.1,8.1,1.2,0.1,0.3,0.6]
pomcp_dpw_y = [0.3,6.933, 8.8,11, 8.133, 7.62, 5.21, 6.2033, 4.204, 6.501]
pomcp_dpw_x_2 = [0, 11.3, 9.6, 7.1, 1.1, 0.8, 7.3, 3.1, 0.8, 0.1]
pomcp_dpw_y_2 = [0.3, 12.6667, 9, 11.9, 9.7333, 2.54, 9.80999,5.0066, 10.5, 5.801]
Out[9]:
In [11]:
plot(dpw_x,dpy_y)
plot(single_dpw_x,single_dpw_y)
plot(random[1],random[2],"x")
plot(heur[1],heur[2],"x")
plot(pomcp_dpw_x,pomcp_dpw_y)
#plot(pomcp_dpw_x_2,pomcp_dpw_y_2)
#legend(["DPW","Single DPW", "random", "heur"],"upper left")
legend(["DPW","Single DPW", "random", "heur","pomcp","pomcp2"],loc="upper left")
xlabel("time in desired lane")
ylabel("nb dangerous brakes")
In [11]:
length(pomcp_dpw_y)
Out[11]:
In [ ]: