hello

I want to include

for k=1:K

for n=1:N

norm(d(n,k)) == binary ;

end

end

in my CVX code but I get an error

please guide me on How to include binary norm constraints in CVX?

Thanks

What does this constraint even mean? You want `norm(d(n,k))`

to be equal to zero or one?

Anyhow, this seems non-convex, and probably not MIDCP representable But perhaps something could be done if you made clear what kind of variable `d`

is and what your intended constraint is.

I want to represent this as MIDCP

this is entier code:

```
function [d, cvx_status, cvx_optval] = ...
iter_opt_prob_3_SOCP(W, G,Hr_prim,Hd,sigma_2,SINR_target,int_users_matrix)
K = size(Hd,2);
N = size(G,1) ;
% Define a, b and R
A = zeros(N*K,K);
B = zeros(K,K);
for k = 1:K % looping over all users
int_users = int_users_matrix(k,:); % interfering users
A(1+(k-1)*N:k*N,k)= diag(Hr_prim(:,k)')*G*W(:,k);
B(k,k)= Hd(:,k)'*W(:,k);
for m = int_users
A(1+(k-1)*N:k*N,m)= diag(Hr_prim(:,k)')*G*W(:,m);
B(k,m)= Hd(:,k)'*W(:,m);
end
end
% -------------------------------------------------------------------------
cvx_clear
cvx_begin sdp
cvx_quiet(true)
cvx_solver sedumi %sedumi %SDPT3 %Mosek % Choose the underlying solver
cvx_precision best % Change the cvx numerical precision
variable d(N,K) complex
% variable V(N+1,N+1) complex semidefinite;
% variable a_aux(1,K) nonnegative; % Auxiliary variables for max sum
%variable a_aux nonnegative; % Auxiliary variables for max min
% expressions SINR_CONSTR(K) desired(K) interference(K);
% Define the expressions desired, interference, and SINR_CONSTR
% in terms of the optimization variables
% sinr_fun_handle = @sinr_CONSTRAINT;
%[desired, interference, SINR_CONSTR] = sinr_fun_handle(V, b, R, SINR_target, sigma_2, all_users, int_users_matrix);
% for k = 1:K % looping over all users
% int_users = int_users_matrix(k,:);% interfering users
% desired(k) = trace(real(R{k,k}*V)) + square_abs(B{k,k});
% interference(k) = 0;
% for m = int_users
% interference(k) = ...
% interference(k) + ...
% trace(real(R{k,m}*V)) + ...
% square_abs(B{k,m});
% end
% SINR_CONSTR(k) = ...
% desired(k) - a_aux(k) - ...
% SINR_target * (interference(k) + sigma_2);
% end
%all_elements = 1:M+1;
% Write the optimization problem
% maximize( sum(a_aux) );
minimise 0
subject to
%SINR_CONSTR == nonnegative(N_users)
for k = 1:K
{[conj(B(k,:)'+ A(1+(k-1)*N:k*N,:)'*d(:,k)) ; sqrt(sigma_2)],...
sqrt(1+1/SINR_target)*real(B(k,k)+d(:,k)' * A(1+(k-1)*N:k*N,k))}...
== complex_lorentz(K+1); % SINR CONSTRAINT
% desired(k) >= a_aux(k) + ...
% SINR_target * (interference(k) + sigma_2);
%sqrt(SINR_CONSTR(k)) >= 0
end
% diag(V) == ones(N+1,1);
% Other 2 constraints are already in the definitions of opt variables
%obj_fn2 >= 0; % Dummy constraint to check/prevent the resulting -ve cvx_optval
for k = 1 : 1 : K
norm(d(:,k))<=N/2;
end
for k = 1:K
norm(d(:,k))<=ones(N,1);
end
cvx_end
% theta_mat = diag(v);
%Undoing Relaxation
% for k=1:K
% % d(:,k)=abs(d(:,k))>=mean(abs(d(:,k)));
% % d(:,k)=abs(d(:,k));
% d(:,k)=abs(d(:,k))>=0.5*ones(N,1);
% end
end
```

What specifically do you need help with? I see only two instance of `norm`

, and in both cases they are SOCP constraints which CVX should accept, although the second of those has extraneous `ones`

instead of `1`

on the RHS, and which could use `norms`

instead of `norm`

in for loop.

Is the issue that the program in your preceding post relaxes norm equality constraints? if so, the non-relaxed version would not appear to be MIDCP-representable. I still don’t know why you refer to `binary`

.

Yes, This is a relaxed version of this code,

Is this MIDCP-representable?

As Iwrote,the non-relaxed version would not appear to be MIDCP-representable.

Thanks a lot,

which approach do you suggest for unrelaxing?

Converting `==`

to `<=`

, which you appear to have already done. Whether that provides a useful solution to your original problem is for you to determine. If the relaxed solution is not useful, then perhaps you should use a non-convex solver, such as available under YALMIP (I think you will need to expand out `norm(x) == a`

to `x'*x == a^2`

, because YALMIP doesn’t allow non-convex use of the 2-norm.).