I am trying to solve the following optimization problem with binary variables using a Mosek solver 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(AxA’)
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)

First, the above problem gives a optimum solution for n1=2 and n2=1. For n1>3 the above 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 doesn’t return a binary solution x for every matrix A. Any suggestions to solve the above given problem using binary restrictions on variables?

I found a way to solve the above problem using YALMIP. I came to know that, CVX with Mosek solver (academic license) cannot handle binary semidefinite variables. Below given is the mosek error displayed in matlab.
Mosek error: MSK_RES_ERR_GLOBAL_INV_CONIC_PROBLEM (The global optimizer can only be applied to problems without semidefinite variables.)

Whereas YALMIP can handle binary semidefinite variables. I have solved using the following code.

n1=5;n2=3;
A=rand(n1,n1)
x = diag(binvar(n1,1));
F = [sum(sum(x))==n2];
h = lambda_max(AxA’);
optimize(F,h);
sol = value(x)

For Mosek error: MSK_RES_ERR_GLOBAL_INV_CONIC_PROBLEM (The global optimizer can only be applied to problems without semidefinite variables.)

The reason behind that is, you are trying to implement a mixed integer solution along with normal Semidefinite Program, which Mosek doesn’t allow. So try to remove the line:

“prob.ints.sub”

Removing this, I got my solution, though I had to solve the Mixed Integer part through the Second Order Cone Program and thereby used those values accordingly to solve my Semidefinite Program.

I have faced similar problem and I cannot understand why mosek doesn’t allow, according to CVX 7th and later versions of MOSEK should allow.
and I did not understand where should I remove the line “prob.ints.sub”

MOSEK, even the forthcoming version 9.0, does not natively handle mixed-integer SDPs, but does handle mixed-integer SOCPs (among other things). Read the link Mixed Integer SDPs which are not Mixed Integer SOCPs provided above.

There is no way of solving mixed-integer SDPs in CVX. Mosek can handle mixed-integer combined with all cone types, except semidefiinite. Depending on the code, CVX can actually send something to Mosek, but Mosek would produce an error message.

Mixed-integer SDP can done in YALMIP, using either

YALMIP’s BNB solver, with Mosek or other semidefinite solver as uppersolver.
or

There is sort of an exception. If CVX can convert the semidefinite constraints into SOCP constraints, as for instance with any 2 by 2 semidefinite constraints, then it would pass the problem to Mosek as an MISOCP, and MOsek could solve it.

yes
it worked for me when dimensions were (2,2) but change to (3,3) caused error.
unfortunately bnb with mosek or other semidefinite solvers as uppersolver didn’t work for me.
but I didn’t understand your meaning about combined cutsdp with MILP solver.
can you guide me?