# Discrepancy between cvx_optval and objective value?

I’m trying to test out the source code for the lambda_max_largest function as follows:

``````k = 3;p = 4;
cvx_clear
cvx_begin SDP
variable X(p, p)
variable t % nonnegative
variable Z(p,p) symmetric
Z == semidefinite (p);

minimize k*t+trace(Z);
t*eye(p)+Z-X >= 0;
cvx_end
``````

When this is solved, it gives : Status as Unbounded, cvx_optval as -Inf

But then, when I compute `k*t+trace(Z)` (based on their computed values), it’s -1.

What explains this? Thanks.

I don;t really know what you’re doing. Perhaps you want nonnegative before % in variables declaration of t, and you want X to be declared symmetric. Then you’ll get a finite optimal solution … of something.

Nevertheless,w hen the problem is declared unbounded by CVX, variable values after cvx_end are are not “optimal” values or -infinity objective value producing variable values… Based on results from the solver, CVX has determined the problem is unbounded, but does not provide corresponding variable values which achieve -infinity objective.

Instead of directly using the lambda_max_largest (which essentially solves the SDP that I’ve here), I’m trying to do the thing from scratch. I put the % before the nonnegative as I was testing both for t>=0 and any real t. When I constrain t>=0, it can find a solution but this shouldn’t be the case (as t can be any real).

When a problem is unbounded, the values returned in the variables represent an unbounded direction. They aren’t intended to be interpreted as a potential solution.