I would like to mention that I am new in CVX community. So, my doubt might be stupid. As I could not figure out the problem of my code, I have decided to post it here. I am trying to implement an algorithm as stated in the paper, titled as-
Localization from Incomplete Noisy Distance Measurements. (Link of the paper)
In case the paper is not accessible I am also uploading a snapshot of the algorithm in my : google drive link
I am dealing with a complete graph in a noiseless scenario. So according to the theory, I should get the perfect reconstruction. But it is not giving me the correct result, and the error value is quite high.
The code written by me is as follows-
% E: n-by-n matrix where (i,j)th element represents the distance between ith and jth node
% N: Number of nodes
% d: dimension of the space where nodes are embedded
%% Calling CVX Package
Q = zeros(N,N);
Mij = zeros(N,N);
cvx_precision best;
cvx_begin
variable Q(N,N) semidefinite % Defining variables
minimize(trace(Q)) % Objective function
subject to
% Constraints
for i = 1:N-1
for j = i:N
if E(i,j) ~= 0
Mij = Mij-Mij;
Mij(i,j) = -1;
Mij(j,i) = -1;
Mij(i,i) = 1;
Mij(j,j) = 1;
trace(Mij*Q) == square_pos(E(i,j));
end
end
end
cvx_end
[U,S,~] = svd(Q);
X_est = U(:,1:d)*sqrt(S(1:d,1:d));
X_est = X_est';
The algorithm SDP-based Algorithm for Localization