First of all, 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, Javanmard and Montanari. In case, if the paper is not accessible, I am uploading a snapshot of the algorithm in my- Google Drive link.
A short description of the problem which I am facing, is described below.
I am dealing with a complete graph where each node represents a sensor. As it is a complete graph, each node knows the all the distance between it and any other node. Here, we have considered noiseless scenario, i.e., \bigtriangleup = 0.
The code written by me-
%% Calling CVX Package
% E: Distance matrix
% N: Number of sensor nodes
% d: dimension where sensors are embedded
function [Q,X_est] = Montanari_Algo(E,N,d)
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(E(i,j));
end
end
end
cvx_end
[U,S,~] = svd(Q);
X_est = (U(:,1:d)*sqrt(S(1:d,1:d)))'; %Estimated sensor position
end
The input of the program will be E,N,d. Output will be X_{est}.
A sample input and expected output, I am providing-
X = -0.5+rand(2,10);
E = squareform(pdist(X'));
N = 10;
d = 2;
Expected output will be same as X, as we are dealing with complete graph in a noiseless scenario.
Looking forward for any generous help.