I am trying to solve the optimization problem given below:

\max log_2det(\delta * H * H')
subject to trace(\delta) < 3

Here, H is a 3$\times$3 matrix and \delta (the optimization variable) is a diagonal matrix of the same size. Here is the code I have written:

H = [1 2 3; 4 5 6; 7 8 9];
cvx begin

variables double(v(1,3))
% Objective Function
maximize (log2 (det (diag((v)) * H * H')))
% Constraints
subject to
1 <= trace(diag(v)) < 3;

cvx end

However, I am getting an error that says, “Error using sparse sparse(A) does not accept char inputs A. Use sparse(double(A)) instead.” What am I doing wrong here? Thanks in advance for the help.

You have several syntax errors as well as optimization formulation problems.

Use cvx_begin and cvx_end. Use log_det (you can divide by log(2) if you want, but I won’t bother). Don’t use double.

The argument of log_det, namely diag((v)) * H * H' is not symmetric, so I think. is not a convex optimization problem. I will now guess that you intended H*diag(v)*H' to be that argument. Making all these changes, a problem which can be accepted by CVX can be entered (I also changed < 3 to <= 3, which is how it will be interpreted by CVX).

However, this problem is unbounded, as can be seen by making v(1) large and v(2) = -v(1), which will still meet the constraint 1 <= trace(diag(v)) <= 3.

If you add a constraint such as v >= 0, the problem will be bounded and have a finite solution. However, with sedumi, sdpt3, and scs, in CVX3.0beta build 1177, this problem incorrectly is reported as being unbounded (i.e., with constraint v >= 0 added) which appears to be a bug in CVX 3.0 beta build 1177, because CVX 's successive approximation method is not being used when scs is used.

Wow! Thanks a lot for your reply. I have two more questions.

When I solve this system, the result is not integer. I tried to add some if/else statement to round the variable but CVx does not allow it. Is there anyway to get the optimized variable in binary form?

Also, if its not possible to get the binary result, how should I rewrite the problem to get the integer form solution for the diagonal matrix? Thanks a lot.

I think you’re out of luck for solving a mixed integer version of this problem with CVX and current versions of solvers. If you have CVX Professional and MOSEK, there is an integer capability for MILP/MIQP/MISOCP, but not for MISDP. Note that although CVX will call MOSEK for mixed integer problems in which CVX"s successive approximation method is used, CVX’s successive approximation will not work correctly, and will return unreliable, quite possibly erroneous results.

Although I suggested using logdet, for your problem, you could maximize det_rootn instead. The argmax will be the same. This will not cause CVX"s successive approximation method to be invoked. The bad news is that I believe that would require making use of a mixed integer SDP capability, which MOSEK does not currently have (for problems which can not be expressed as mixed integer SOCP)…

I recommend using det_rootn instead of log_det fo rthe continuous variable version of the problem… Actually, you could solve the problem by brute force enumeration of all possible integer vectors v satisfying the constraints, and evaluating the objective function. Largest objective function wins.

I believe you want [Ro t;t' inv(Ro)]>=0; to be an LMI, in which case you either need to use cvx_begin sdp , or use [Ro t;t' inv(Ro)]==semidefinite(2), which both accomplish the same thing. Please read http://cvxr.com/cvx/doc/sdp.html .

Furthermore, if you want to obtain t = -1, then you need to get rid of the constraint t >= 0.

If you do these, you will get optimal t = -1 ((within tolerance of) as you thought it should be.

So either do

cvx_begin sdp
variable t
minimize trace(C*Pvar*Pvar*C'*sigma*t)
subject to
[Ro t;t' inv(Ro)]>=0;
cvx_end

or do

cvx_begin
variable t
minimize trace(C*Pvar*Pvar*C'*sigma*t)
subject to
[Ro t;t' inv(Ro)]==semidefinite(2);
cvx_end

It doesn’t give me the amount of t.
It gives me this:
alling SDPT3 4.0: 3 variables, 1 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 1
dim. of sdp var = 2, num. of sdp blk = 1

SDPT3: Infeasible path-following algorithms

version predcorr gam expon scale_data
HKM 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime