# CVX status: solved, but the result doesn't satisfy the constraint

Hello,

I’m solving an optimization problem using CVX(MATALB). The status is solved, but the solution doesn’t satisfy the constraint. Can you give me some advice for it? My code is listed below, thank you so much!

``````cvx_solver sedumi
cvx_precision best
cvx_begin
variable W(param.Nt,param.Nt,param.K) complex hermitian
variable t(param.K,1) nonnegative

minimize (trace(sum(W,3)))

subject to
for k = 1:param.K
W(:,:,k) == semidefinite(param.Nt)
end

for k = 1:param.K
W_sum = sum(W,3)-W(:,:,k);
Q = real(kron(transpose(W(:,:,k)*param.denominator-W_sum),V));
R = real(Q*vec(param.H_hat(:,:,k)));
c = real(vec(param.H_hat(:,:,k))'*R)-param.Pnoise;
d2 = (param.sigma(k)^2*chi2inv(1-param.pout,2*param.Nt*param.N))/2;

[Q+t(k)*eye(param.Nt*param.N), R;
R',                                               c-t(k)*param.d2(k)] == semidefinite(param.Nt*param.N+1);
end
cvx_end
``````

SeDuMi also says the optimal ||x||=3.8e15. This indicates you have a numerically very bad model.

I don 't know why CVX reported `Solved` when SeDuMi said it ran into numerical problems.

Can the MOSEK solver solve my problem? I have changed my solver to MOSEK, and the result is following. It shows “Solved” again, but the result still doesn’t satisfy the constraints.

Remove `cvx_precision best` and try again.

Never use `cvx_precision` with Mosek. Especially not `best`.

Also, it is always a good idea to install the latest Mosek 10.1.

OK. Thank you! This is the output of MOSEK. The variable W should be a set of semidefinite matrixes. The result is inaccurate, but it reports solved. Can you give some advice to adjust to solve the problem?

The maximum violation reported by Mosek is of order 1e-13, so you must work much harder to convince us that the result is not accurate enough. For example by providing a fully reproducible code with input data and a computation of the expression which proves the result violates some constraint.

Do ou realize that in floating-point arithmetic you can rarely expect the results to ideally satisfy constraints? For example the solution of `x <=0` can be something like `x=-1e-9` and that is perfectly normal. The same with eigenvalues. See 7 Practical optimization — MOSEK Modeling Cookbook 3.3.0

Hi Michal can you please help me correct this cvx code it’s been 3 week since i’m working on writing cvx code of power optimization and trajectory optimization, now in trajectory optimization i get this error, how should i fix it?
please see the picture and tell me something, i really need help. Thank you so much.

if the infeasibility doesn’t occur on the first iteration, but occurs in some later iteration, please read The result obtained using the SeDuMi solver is inaccurate. The optimal solution is not as good as before the optimization. - #12 by Mark_L_Stone .

if infeasibility occurs on the .1st iteration, also read Debugging infeasible models - YALMIP , all of which applies to CVX, except for section 1.

I read all of them before and can’t fix it. could you fix it for me ?

If you read the l1st ink, you see what I think of SCA. So unfortunately, you’re on your own. It’s your research project, not mine.

I read your post, but it is the same as this ieee paper, you mean the answer of paper is false?

I don’t know. But “false” can have many meanings. Working reliably for all data sets and all starting values is not the same as working for some of them. I’m also not saying whether your code is “correct” or not This is the last I have to say on this. if someone else wants to weigh in, that is up to them.

Even after using Mosek latest version, same problem occurs for my problem also. Status is solved, but some of the constraints (2 users satisfy, remaining not) don’t satisfy the constraints. How can we believe that the problem is actually solved using the CVX tool, sir?
Should I work with input data provided to the solver or Should I change the solver or any other optimization tools? Please help me in this Sir