JuliaPOMDP / ParticleFilters.jl
Showing 1 of 1 files from the diff.

@@ -67,7 +67,7 @@
Loading
67 67
	return plots
68 68
end
69 69
70 -
function runexp(num_particles)
70 +
function runexp(;num_particles,num_iter,meascov)
71 71
	rng = Random.GLOBAL_RNG
72 72
73 73
	dt = 0.1 # time step
@@ -86,8 +86,8 @@
Loading
86 86
	C = [1.0 0.0 0.0 0.0; 
87 87
	     0.0 1.0 0.0 0.0]
88 88
89 -
	W = Matrix(0.001*Diagonal{Float64}(I, 4)) # Process noise covariance
90 -
	V = Matrix(5.0*Diagonal{Float64}(I, 2)) # Measurement noise covariance
89 +
	W = Matrix(0.001*Diagonal{Float64}(I, 4)) # Process noise covariance	
90 +
	V = Matrix(meascov*Diagonal{Float64}(I, 2)) # Measurement noise covariance
91 91
92 92
	f(x, u, rng) = A*x + rand(rng, MvNormal(W))
93 93
@@ -112,7 +112,6 @@
Loading
112 112
113 113
	plots = []
114 114
115 -
	num_iter = 100
116 115
	rmse = zeros(num_iter,3) # Col 1 has vanilla, 2 has cem, 3 has kf
117 116
	rmse_elites = zeros(num_iter,2)
118 117
@@ -222,20 +221,21 @@
Loading
222 221
# Third dimension of the `data` data structure denotes experiment number
223 222
# Each exp returns a table with timeslices in rows and rmse_sir and rmse_cem
224 223
# in columns. Each new table is stacked on top of table from previous experiment
225 -
function run_many_exps(;num_exp,num_particles)	
226 -
	display("Running $(num_exp) experiments with $(num_particles) particles")	
227 -
	data = zeros(100,3,num_exp) # 100 rows (iterations), 3 columns (van,cem,kf)
224 +
function run_many_exps(;num_exp,num_particles,meascov,num_iter)	
225 +
	display("Running $(num_exp) experiments with $(num_particles) particles with $(num_iter) iterations and $(meascov) measurement covariance coeff")	
226 +
	data = zeros(num_iter,3,num_exp) #3 columns (vanilla,cem,kf)
228 227
	for i in 1:num_exp
229 228
		if i%20 == 0.
230 229
			@show i
231 230
		end		
232 -
		plt,data[:,:,i] = runexp(num_particles)
231 +
		plt,data[:,:,i] = runexp(num_particles=num_particles,
232 +
					num_iter=num_iter,meascov=meascov)
233 233
	end
234 234
235 235
	rmse_avg = mean(data,dims=3)[:,:,1] #Extract 100x3 array from 100x3x1 array
236 236
237 -
	plot(rmse_avg,labels=["sir","cem","kf"])
238 -
	savefig("../img/rmse_avg_numexps_$(num_exp)_numparticles_$(num_particles)_meascov_5.png")
237 +
	plot(rmse_avg,labels=["sir","cem","kf"],xlabel="iteration",ylabel="rmse")
238 +
	savefig("../img/$(num_exp)exps_$(num_particles)particles_$(meascov)meascov_$(num_iter)iterations.png")
239 239
	return nothing
240 240
end
241 241
@@ -245,15 +245,17 @@
Loading
245 245
if run1exp
246 246
	# Single experiment and make associated video	
247 247
	display("Running a single experiment and making associated video")
248 -
	num_particles = 1000	
249 -
	plots, rmse = runexp(num_particles)
248 +
	num_particles = 1000
249 +
	num_iter = 50
250 +
	meascov = 5	
251 +
	plots, rmse = runexp(num_particles=num_particles,num_iter=num_iter,meascov=meascov)
250 252
	@show length(plots) # Should be equal to the number of iterations of the particle filter
251 253
	makegif = true
252 254
	if makegif write_particles_gif(plots,"../img/$(num_particles)_particles_all3.mp4") end
253 255
end
254 256
if runmanyexp
255 257
	# Mulitple experiments to make average rmse plot
256 -
	run_many_exps(num_exp = 100, num_particles = 1000)
258 +
	run_many_exps(num_exp = 100, num_particles = 50,num_iter=100,meascov=1)
257 259
end
258 260
if runkf
259 261
	mu_0 = [1.,1.,1.,1.]
Files Coverage
src 21.09%
Project Totals (16 files) 21.09%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading