-
Notifications
You must be signed in to change notification settings - Fork 4
/
runtest.m
63 lines (54 loc) · 1.6 KB
/
runtest.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
% Specify parameters and options
% n is the total number of sensors and anchors
% m is the number of anchors
params.n = 1000;
params.m = 10;
params.r = 2;
params.R = 0.25;
params.nf = 0.10;
params.seed = 2017; % use 'shuffle' or [] for no rng seeding
opts.verbose = 1;
opts.weighted_ls = 0;
opts.expvecweights = 0;
opts.refine = 1;
opts.MaxCliqueSize = 50;
opts.plotsoln = 1;
if opts.verbose
disp('-------------------------------------------------');
disp(params);
end
% Generate a random EDM with embdim r
tt = tic;
[Xorig, A, Dpartial] = genrandprob(params);
if opts.verbose
fprintf('%16s: %6.2f s\n\n', 'Generate problem', toc(tt));
end
% Solve EDM problem using Exposing Vector Algorithm
[X, Xrefined, xinds, info] = ExpVecEDM(Dpartial, A, params.r, opts);
% Compute RMSD
if isempty(A)
[info.rmsd.X, X] = procrustes_noncenter(Xorig(xinds,:), X);
info.rmsd.X = info.rmsd.X/params.R*100;
if opts.refine
[info.rmsd.Xrefined, Xrefined] = ...
procrustes_noncenter(Xorig(xinds,:), Xrefined);
info.rmsd.Xrefined = info.rmsd.Xrefined/params.R*100;
end
else
info.rmsd.X = rmsd(Xorig(xinds,:), X);
info.rmsd.X = info.rmsd.X/params.R*100;
if opts.refine
info.rmsd.Xrefined = rmsd(Xorig(xinds,:), Xrefined);
info.rmsd.Xrefined = info.rmsd.Xrefined/params.R*100;
end
end
% Output info
if opts.verbose
disp('info.eig:'); disp(info.eig);
disp('info.rmsd:'); disp(info.rmsd)
disp('info.resnorm:'); disp(info.resnorm)
end
% Plot solution
if opts.plotsoln
plotsoln(X, Xrefined, Xorig(xinds,:), A);
end