# Is it possible to obtain a local extreme when using sdpt3?

I am trying to solve my sdp problem with cvx. To check my answer obtaining from cvx, I use lots of known results. For the table, n = 8 and all d less or equal to n are correct. Also, for n <= 20 and d <= 2, d = n are correct. But for n >= 9, d around n/2, I get an incorrect answer. For the case n > 13, I get status fail. Here is my code.
cvx_clear
cvx_begin sdp
cvx_solver sdpt3
variable x(n+1, n+1, n+1) nonnegative symmetric;
tar = 0;
a = [];
b = [];
%%definition condition
b = [b x(1, 1, 1) == 1];
%{
for i = 0: n
for j = i: n
for t = 0: n
if triple_comb(n, i-t, j-t, t) == 0
b = [b x(i+1, j+1, t+1) == 0];
end
end
end
end
%}

``````for i = 0: n
tar = tar + comb(n,i)*x(i+1, 1, 1);
end
for k = 0: floor(n/2)
[matrix_1, matrix_2] = genetate(x, n, k);
a = [a matrix_1 == semidefinite(n-2*k+1)];
a = [a matrix_2 == semidefinite(n-2*k+1)];
end
for i = 0: n
disp(i);
for j = i: n
for t = 0: n
``````

%% distance
if d >= 2
index = 1:d-1;
if ismember(i, index) || ismember(i + j -2*t, index)
b = [b (x(i+1, j+1, t+1) == 0)];
end
end
%%condition2

``````            %if j ~- 0 && t ~= 0
%b = [b (x(i+1, j+1, t+1) - x(i+1, 1, 1) <= 0)];
%end;
%b = [b (1 + x(i+1, j+1, t+1) - x(i+1, 1, 1) - x(j+1, 1, 1) >= 0)];
``````

%%permutation

``````             for m = 0: n
for l = m: n
for k = 0: n
if per(i, j, t, m, l, k)
b = [b (x(i+1, j+1, k+1) == x(m+1, l+1, k+1))];
end
end
end
end
end
end
end

maximize(tar)
subject to
a
b
``````

cvx_end

## When I get fail, this is an output. Calling SDPT3 4.0: 8543 variables, 1307 equality constraints For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 1307
dim. of sdp var = 620, num. of sdp blk = 40
dim. of free var = 2693 *** convert ublk to lblk

SDPT3: Infeasible path-following algorithms

## number of iterations = 49 primal objective value = 2.00011486e+01 dual objective value = 1.99878275e+01 gap := trace(XZ) = 9.03e-01 relative gap = 2.20e-02 actual relative gap = 3.25e-04 rel. primal infeas (scaled problem) = 3.30e-10 rel. dual " " " = 4.42e-07 rel. primal infeas (unscaled problem) = 0.00e+00 rel. dual " " " = 0.00e+00 norm(X), norm(y), norm(Z) = 5.1e+06, 1.3e+10, 1.3e+10 norm(A), norm(b), norm© = 3.1e+10, 1.9e+05, 2.4e+00 Total CPU time (secs) = 6.65 CPU time per iteration = 0.14 termination code = -5 DIMACS: 6.7e-10 0.0e+00 5.3e-07 0.0e+00 3.2e-04 2.2e-02

Status: Failed
Optimal value (cvx_optval): NaN

So, Is there anyone could help? I am wondering that cvx gave me a local maximum for some case because for those incorrect answer, they are all smaller than the correct one. For the failed case, I do not know how to solve this problem.

This shows

that A is most likely badly scaled. So you should work on the formulation.

You might also try another optimizer like Mosek and hope it works.

Can you explain what this code segment does?

``````for k = 0: floor(n/2)
[matrix_1, matrix_2] = genetate(x, n, k);
a = [a matrix_1 == semidefinite(n-2*k+1)];
a = [a matrix_2 == semidefinite(n-2*k+1)];
end
``````

I understand
`a matrix_1 == semidefinite(n-2*k+1)` .

I don’t understand
` a = [a matrix_1 == semidefinite(n-2*k+1)];`

This code is to add the condition matrix_1 == semidefinite(n-2*k+1) to the list a. As I define, a and b are two lists containing constraints. In here, a contains all semidefinite constraints and b contains others.