I am trying to solve the following optimization problem with binary variables using a Mosek solver and CVX toolbox in Matlab R2012b and Windows 10 OS
n1=6; n2=3
A=rand(n1,n1)
cvx_begin
variable x(n1,n1) diagonal binary
minimize lambda_max(A*x*A')
subject to
sum(sum(x))==n2
cvx_end
And I get the following error
Error:
Reference to non-existent field 'sol'.
Error in G:\Other Stuff\Softwares\cvx\shims\cvx_mosek.p>solve
(line 490)
Error in cvxprob/solve (line 428)
[ x, status, tprec, iters ] = shim.solve( At, b, c,
cones, quiet, prec, solv.settings, eargs{:} );
Error in cvx_end (line 87)
solve( prob );
First, the above problem gives a optimum solution for n1=2 and n2=1. For n1>=3 the above given error is displayed. Later I attempted to solve the problem by reformulating in the below given way to get a solution which is binary (0 or 1). I am able to run the cvx without any errors. But it doesnot return a binary solution x for every matrix A. Any suggestions to solve the above given problem using binary restrictions on variables?
n1=6; n2=3;
cvx_begin
variable x(n1,n1) diagonal nonnegative
minimize lambda_max(A*x*A')
subject to
sum(sum(x))==n2
norm(x,Inf)<=1
cvx_end