-
Notifications
You must be signed in to change notification settings - Fork 2
/
localisation.m
78 lines (65 loc) · 2.52 KB
/
localisation.m
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
78
%% Load features and test routes
switch p.type
case {'ES'}
filename = fullfile(p.features_dir,p.type,p.network,p.scale,[p.type,'_',p.dataset,'.mat']);
case {'BSD'}
filename = fullfile(p.features_dir,p.type,p.dataset,[p.type,'_',p.dataset,'_',p.network,'.mat']);
case {'MES'}
filename = fullfile(p.features_dir,p.type,p.network,[p.type,'_',p.dataset,'.mat']);
end
load(filename, 'routes');
% load test routes and test turns
directory = 'test_routes/';
load([directory, p.dataset,'_turns_', num2str(p.T), '_' , num2str(p.threshold),'.mat']);
load([directory, p.dataset,'_routes_', num2str(p.T),'.mat']);
R_init = zeros(size(routes,2),1);
for i = 1:size(routes,2)
R_init(i) = i;
end
ranking = zeros(p.T, p.mrl);
best_estimated_routes = {p.T};
best_estimated_top5_routes = {p.T};
dist = {p.T};
tic;
parfor_progress('searching', p.T);
for i=1:p.T
t = test_route(i,1:p.mrl);
T = test_turn(i,1:p.mrl-1);
switch p.type
case {'ES'}
%% ES FEATURES
[location, rank, best_top5_routes, route_dist] = RouteSearching_ES(routes, p.N, p.mrl, p.threshold, R_init, t, T, p.turns, p.mnc, p.topk, p.overlap);
dist{i} = route_dist;
%% BSD FEATURES
case {'BSD'}
[location, rank, best_top5_routes, route_dist] = RouteSearching_BSD(routes, p.N, p.mrl, p.threshold, R_init, t, T, p.turns, p.mnc, p.topk, p.overlap);
dist{i} = route_dist;
case {'MES'}
%% MES FEATURES
[location, rank, best_top5_routes, route_dist] = RouteSearching_ES(routes, p.N, p.mrl, p.threshold, R_init, t, T, p.turns, p.mnc, p.topk, p.overlap);
dist{i} = route_dist;
%% JUST TURNS
otherwise
[location, rank, best_top5_routes] = RouteSearching_onlyT(routes, p.mrl, R_init, t, T, p.threshold, p.topk, p.overlap);
end
ranking(i,:) = rank;
best_estimated_top5_routes{i} = best_top5_routes;
parfor_progress('searching');
end
time = toc;
avg_time = time/p.T;
disp(avg_time)
%% Save localization test information
switch p.type
case {'ES'}
path = fullfile(p.results_dir, p.dataset, num2str(p.turns), p.scale);
case {'BSD'}
path = fullfile(p.results_dir, p.dataset, num2str(p.turns));
case {'MES'}
path = fullfile(p.results_dir, p.dataset, num2str(p.turns), p.network);
end
if ~exist(path, 'dir')
mkdir(path)
end
file_name = fullfile(path, [p.name,'.mat']);
save(file_name,'ranking','best_estimated_top5_routes');