% 2 scenarios:
% 6 agents, 2 leaders - showing group classification
% capabilities
% Additional scenarios similar to the above with time varying heirarchies
%randn('state',23);
%srand('state',23);
warning off
anim=0;
iter=1;
%while (iter)
simulate_flocks_local_interactions_varying;
clusters.x=x;
d=[];
for jj=1:n_par,
for jj1=1:n_par,
if (jj ~= jj1)
d=[d; norm(x{jj}(1,:)-x{jj1}(1,:))];
end
end
end
tl=cause_dynamic_elimination1_varying(x, n_par, lead);
%plot(tl);
%pause;
if (and(min(d) > 20, mean(tl(1:20)) < 2.4)) %2.6)
iter=0;
end
%end
max_n_clusters=n_par;
for i=1:max_n_clusters,
clusters.active{i}=ones(length(x{1}),1);
end
for j=1:n_par,
xtraj{j}=[];
end
xmin=-200;
xmax=200;
ymin=-200;
ymax=200;
vxmin=-10;
vxmax=10;
vymin=-10;
vymax=10;
max_t0=6;
min_t1=15;
max_t1=30;
curve_R=20;
dir_prob=0.6;
smin=0.4; %0.4; %0.1; %0.4;
smax=0.5; %0.5; %0.2; %0.5;
min_clust_obsrv=1;
max_clust_obsrv=1;
nclut=0.5;
dt=0.05; %0.05;
n_particles=1000;
params.N_chains=4;
pop_mcmc=0;
params.temp=[1, 1, 1, 1];
params.vxmin=vxmin;
params.vxmax=vxmax;
params.vymin=vymin;
params.vymax=vymax;
params.Rmin=100; %curve_R/2;
params.Rmax=120; %curve_R;
params.dir_prob=dir_prob;
params.cov_size=[smin/2,smax];
params.max_n_clusters=max_n_clusters;
params.max_n_assumed=max_n_clusters; %+1;
params.dt=dt;
params.Bernulli_Markov_staying_prob0=0.02;
params.Bernulli_Markov_staying_prob1=1;
params.vel_noise=1;
params.burnin=1000;
params.clutter_prob=1e-9;
params.MH_Gibbs_iterations=3;
params.Gibbs_samples=1000; %500;
params.dup_distance=10;
params.Q=0.5^2*eye(2);
em_particles=1;
% for i=1:max_n_clusters,
% x0(i,:)=[unifrnd(xmin,xmax), unifrnd(ymin,ymax)];
% v0(i,:)=[unifrnd(vxmin,vxmax), unifrnd(vymin, vymax)];
% if (i == 1)
% t0=0;
% else
% t0=max_t0;
% end
% times(i,:)=[round(unifrnd(0, (i-1)*1+t0)), round(max_t0+unifrnd(min_t1, max_t1))];
% steering(i,:)=[curve_R, dir_prob];
% c_size(i,:)=[unifrnd(smin/2,smin), unifrnd(smax/2, smax)];
% end
%clusters=produce_cluster_tracks(x0, v0, c_size, steering, times, dt);
zk=produce_observations(clusters, min_clust_obsrv, max_clust_obsrv);
%load typical_run %observations %typical_run
max_times=length(x{1})*dt; %length(x{1})*dt; %max(times(:,2));
clear x
% Show scenario
%plot_scenario;
%pause
fov_xmax=-1e10;
fov_xmin=1e10;
fov_ymax=-1e10;
fov_ymin=1e10;
for i=1:max_n_clusters,
fov_xmax=max([fov_xmax; clusters.x{i}(:,1)]);
fov_xmin=min([fov_xmin; clusters.x{i}(:,1)]);
fov_ymax=max([fov_ymax; clusters.x{i}(:,2)]);
fov_ymin=min([fov_ymin; clusters.x{i}(:,2)]);
end
%close all
%plot_observations(zk, [fov_xmax,fov_xmin,fov_ymax,fov_ymin],nclut,max_n_clusters,2*max_times);
%pause
%close all
% initialize particles using the 1st observation
z0=[];
for i=1:max_n_clusters,
if (clusters.active{i}(2))
z0=[z0; zk{i}{2}];
end
end
n_clutter=round(nclut*length(z0));
if (n_clutter)
z_clutter=[unifrnd(fov_xmin, fov_xmax, n_clutter, 1), unifrnd(fov_ymin, fov_ymax, n_clutter, 1)];
z0=[z0; z_clutter];
end
%z0=obsrv{1};
obsrv{1}=z0;
par=init_particles(z0, n_particles, params);
k=2;
%!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Should add mixture weights !!!!!!!!!!!!!!!!!!!!
%figure(1);
p_length=6;
n0=(max_n_clusters-1)*p_length+1;
a_est=zeros(n0,1);
for j=1:max_n_clusters,
a_est1{j}=a_est;
Pc{j}=1e2*eye(n0);
end
pos1=n_par;
i1=[1:n_par]';
A_mat=zeros(max_n_clusters,max_n_clusters);
kk1=0;
for t=0:dt:max_times-4*dt,
% Propagate particles
t
k=k+1;
par=propagate_particles(par, n_particles, params);
% hist(ncl)
% pause
zt=[];
for i=1:max_n_clusters,
if (clusters.active{i}(k))
zt=[zt; zk{i}{k}];
end
end
n_clutter=round(nclut*length(zt));
if (n_clutter)
z_clutter=[unifrnd(fov_xmin, fov_xmax, n_clutter, 1), unifrnd(fov_ymin, fov_ymax, n_clutter, 1)];
zt=[zt; z_clutter];
end
obsrv{k-1}=zt;
% zt=obsrv{k-1};
if (pop_mcmc)
[par, w_par, weights, acc]=Population_MCMC_particles(par, n_particles, params, zt);
else
[par, w_par, weights, acc]=MCMC_particles(par, n_particles, params, zt);
end
disp(sprintf('MH Acceptance ratio %2.2f\n', acc/(n_particles+params.burnin)));
% disp(sprintf('MH within Gibbs Acceptance ratio %2.2f\n', acc1));
phd=0;
for j1=1:length(weights),
ncl=0;
for j=1:params.max_n_assumed,
ncl=ncl+w_par.active{j}(j1);
end
phd=phd+weights(j1)*ncl;
end
phd
[a1,a2]=max(weights);
disp(sprintf('True cluster means:\n'));
cl_true=[];
nc_true=0;
for j=1:max_n_clusters,
if (clusters.active{j}(k))
clusters.x{j}(k,:)
cl_true=[cl_true; clusters.x{j}(k,:)];
nc_true=nc_true+1;
end
end
disp(sprintf('Estimated cluster means:\n'));
ncl=0;
init_mat=[];
for j=1:params.max_n_assumed,
if (w_par.active{j}(a2))
% w_par.mean{j}(a2,:)
init_mat=[init_mat; w_par.mean{j}(a2,:)];
end
ncl=ncl+w_par.active{j}(a2);
end
phd_track(k-2)=phd;
if (not(ncl == phd))
phd=ncl;
end
j1=1;
for j=1:params.max_n_assumed,
if (w_par.active{j}(a2))
x_est.mean{k-2}(j1,:)=w_par.mean{j}(a2,:); %kmeans_clusters(par, n_particles, phd, params, init_mat);
x_est.cov{k-2}(j1,:)=w_par.cov{j}(a2,:);
x_est.vel{k-2}(j1,:)=w_par.vel{j}(a2,:);
x_est.curve{k-2}(j1)=w_par.curve_R{j}(a2);
j1=j1+1;
end
end
%x_est.mean{k-2}
% obsrv{k-2}=zt;
% if (t > 0)
% mse_est1=mse_est;
% else
% mse_est1=0;
% end
[mse_est, cov_est]=compute_estimates(x_est.mean{k-2}, par, params, n_particles);
if (sum(sum(isnan(mse_est))))
mse_est=x_est.mean{k-2};
end
% mse_est=cl_true;
% sqrt(cov_est)
if (t > 0)
% mse_est=cl_true(randperm(n_par),:);
mse_est=sort_ref(mse_est_k{k-3}, mse_est);
end
mse_est
mse_est_k{k-2}=mse_est;
std_dev{k-2}=sqrt(cov_est);
est_err=max(hausdorf_distance(cl_true, mse_est, 0), hausdorf_distance(cl_true, mse_est, 1));
% est_err=compute_norm_error(mse_est, clusters, params, max_n_clusters, k);
est_err
if (k > 4+p_length)
% clear xtraj
% for tt=1:p_length+1,
dimx=size(mse_est_k{k-2},1);
if (dimx == n_par)
for jj=1:dimx,
xtraj{jj}=[xtraj{jj}; mse_est_k{k-2}(jj,:)];
end
else
for jj=1:n_par,
xtraj{jj}=[];
end
end
% end
if (size(xtraj{1},1) == p_length)
for jj=1:n_par,
cv(jj)=trace(cov(xtraj{jj}));
end
cv
if (max(cv) < 40)
kk1=kk1+1;
A_mat=0;
% for jj=2:n_particles,
%
% for jj1=1:max_n_clusters,
% xx1(jj1,:)=par.cluster_mean{jj1}(jj,:);
% end
%
% ms1=sort_ref(mse_est_k{k-2}, xx1);
%
% for jj1=1:max_n_clusters,
% xtraj{jj1}(p_length+1,:)=ms1(jj1,:);
% end
没有合适的资源?快使用搜索试试~ 我知道了~
动态集群跟踪的高斯混合 MCMC 粒子算法附matlab代码.zip
共104个文件
mat:62个
m:27个
asv:10个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 75 浏览量
2023-01-05
20:16:24
上传
评论
收藏 12.01MB ZIP 举报
温馨提示
动态集群跟踪的高斯混合 MCMC 粒子算法附matlab代码.zip
资源推荐
资源详情
资源评论
收起资源包目录
动态集群跟踪的高斯混合 MCMC 粒子算法附matlab代码.zip (104个子文件)
run_test_varying.asv 11KB
run_test.asv 11KB
cause_dynamic_elimination.asv 5KB
simulate_flocks_local_interactions_varying.asv 4KB
cause_dynamic_elimination1.asv 4KB
simulate_flocks_local_interactions.asv 4KB
causality_detection_kf.asv 2KB
compute_stats.asv 1KB
sort_ref.asv 875B
test1.asv 257B
mean_tci.fig 11KB
2agents.fig 11KB
est_errors.fig 10KB
test.fig 1KB
fg1.fig 1KB
run_test_varying.m 11KB
run_test.m 11KB
Gibbs_refinement.m 7KB
cause_dynamic_elimination_varying.m 5KB
cause_dynamic_elimination.m 5KB
cause_dynamic.m 5KB
MCMC_particles.m 5KB
simulate_flocks_local_interactions_varying.m 4KB
cause_dynamic_elimination1_varying.m 4KB
cause_dynamic_elimination1.m 4KB
simulate_flocks_local_interactions.m 4KB
propagate_particles.m 2KB
compute_stats.m 2KB
causality_detection_kf_biased.m 1KB
produce_cluster_tracks.m 1KB
causality_detection_kf.m 1KB
compute_estimates.m 1KB
sort_ref.m 884B
hausdorf_distance.m 756B
produce_observations.m 658B
kmeans_clusters.m 634B
plot_observations.m 590B
test1.m 549B
init_particles.m 546B
remove_duplicates.m 432B
mcruns_varying.m 150B
mcruns.m 142B
trun.mat 484KB
mcrun2_7.mat 345KB
mcrun1_6.mat 345KB
mcrun2_3.mat 343KB
mcrun2_11.mat 338KB
mcrun2_17.mat 335KB
mcrun1_8.mat 325KB
mcrun1_11.mat 314KB
mcrun2_9.mat 312KB
mcrun2_2.mat 307KB
mcrun1_13.mat 284KB
mcrun1_5.mat 279KB
mcrun1_18.mat 276KB
mcrun2_10.mat 274KB
mcrun1_15.mat 273KB
mcrun2_16.mat 254KB
mcrun2_5.mat 252KB
mcrun2_6.mat 250KB
mcrun1_12.mat 241KB
mcrun2_12.mat 236KB
mcrun2_4.mat 230KB
mcrun2_15.mat 220KB
mcrun1_16.mat 218KB
mcrun2_14.mat 208KB
mcrun2_1.mat 203KB
mcrun31_2.mat 197KB
mcrun1_4.mat 196KB
mcrun2_8.mat 196KB
mcrun31_4.mat 193KB
mcrun1_9.mat 190KB
mcrun1_17.mat 186KB
mcrun31_3.mat 181KB
mcrun1_3.mat 180KB
mcrun3_7.mat 171KB
mcrun3_5.mat 167KB
mcrun1_14.mat 166KB
run2.mat 161KB
mcrun1_2.mat 159KB
mcrun1_10.mat 159KB
mcrun31_6.mat 151KB
mcrun3_4.mat 150KB
mcrun31_1.mat 147KB
mcrun3_6.mat 146KB
mcrun1_7.mat 146KB
mcrun2_13.mat 139KB
mcrun31_5.mat 136KB
mcrun3_1.mat 131KB
run1.mat 128KB
mcrun3_2.mat 124KB
mcrun6.mat 123KB
mcrun3_3.mat 112KB
mcrun11.mat 109KB
mcrun7.mat 109KB
mcrun5.mat 108KB
mcrun4.mat 106KB
mcrun8.mat 104KB
mcrun9.mat 104KB
mcrun3.mat 99KB
共 104 条
- 1
- 2
资源评论
天天Matlab科研工作室
- 粉丝: 3w+
- 资源: 7259
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功