Are you solving the SDP relaxation by addding quadratic constraints of the type x*(x-1)=0? In the end, I will tell you how to solve the problem, an SDP relaxation is most likely a poor choice.
Define the model (depends on how you store data of course)
x = sdpvar(n,1);
objective = x'*A0*x + b0^T*x;
Constraints = a'*x + b <= 0;
for i = 1:nc+nnc
Constraints = [Constraints, x'*A{i}*x + bi{i}^T*x + c(i) <= 0];
end
This model is used for any solver.
YALMIP has a built-in moment relaxation framework (i.e., semidefinite relaxations). The standard first-order relaxation, which probably is what you refer to, is solved by default
http://users.isy.liu.se/johanl/yalmip/pmwiki.php?n=Commands.solvemomentsolvemoment([Constraints, x.*(x-1) == 0],objective)
Stronger relaxations can be derived and computed too
solvemoment([Constraints, x.(x-1) == 0],objective,[],2)
Alternatively, use standard solver call, but specify moment as solver
solvesdp([Constraints, x.*(x-1) == 0],objective,sdpsettings('moment.order',2))
In this format, you can switch to the semidefinite relaxation framework sparsepop if you want (solves sparse polynomial relaxations)
solvesdp([Constraints, x.*(x-1) == 0],objective,sdpsettings('solver','sparsepop'))
The first-order relaxation can be encoded semi-manually, by telling YALMIP to relax all monomials to linear variables. With that, a semidefinite relaxation is equivalent to
solvesdp([Constraints, x.*(x-1) == 0,[1;x]*[1 x'] >= 0],objective,sdpsettings('relax',1))
However, I would not use semidefinite relaxations for this problem. The problem can be solved using a MILP solver or a convex MISOCP solver. A MILP solver can be used by recognizing that a bilinear term x(i)*x(j) can be handled by introducing a new variable w(i,j) which models x(i) AND x(j), which can be done using three linear constraints. This works in low dimensions, or if the quadratics are sparse so you don't have to introduce that many new variables.
Alternatively, exploit the fact that a nonconvex quadratic function in binary variables always can be rewritten as a convex function, by exploiting the fact that x(i)^2 = x(i). Hence, x'*Q*x = x'*(Q+r*I)*x-r*sum(x) for any scalar r. Pick r large enough so that matrix is positive semidefinite. Convex MISOCPs are solved reasonably effciently by solvers gurobi, cplex and mosek.
Here, I ensure all quadratic functions have matrices with smallest eigenvalue larger than 1.
x = binvar(n,1);
m = min(eig(A0));
r = 1-m;
objective = x'*(A0+r*eye(n))*x-r*sum(x)+b0^T*x;
Constraints = a'*x + b <= 0;
for i = 1:nc+nnc
m = min(eig(A{i}));
r = 1-m;
Constraints = [Constraints, x'*(A{i}+m*eye(n))*x-m*sum(x)+bi{i}^T*x + c(i)<= 0];
end
solvesdp(Constraints,objective)
Hopefully easily solved if you have any the mentioned solvers installed (if you don't, it will use the internal bnb solver, which is vaaaastly inferior)