How to achieve this function?


(hataimengzhu) #1
Optimization variables can't be used in 'if' statements, but I need to make judgments 
about optimized variables. How to achieve this function?   
Thanks.
N = 10;
Kr = 3;
h = rand(Kr,N)+1i*rand(Kr,N);
H = zeros(N,N,Kr);
for k = 1:Kr 
    H(:,:,k) = h(k,:)'*h(k,:);
end
cvx_begin
cvx_quiet(true); 
variable W(N,N,Kr) complex;                                                                   
minimize real(trace(sum(W,3))) 
subject to

for k = 1:Kr
  if real(trace(H(1:8,1:8,k)*W(1:8,1:8,k)))>1e-4 %Disciplined convex programming error:
                                            % Constraints may not appear in if/then   statements.                                                                         
        real(trace(H(9:10,9:10,k)*W(9:10,9:10,k)))<=1e-4;
  end  
end
cvx_end

(Mark L. Stone) #2

Presuming you have suitable bounds available, I think you should be able to do this using binary variable, i.e., MIDCP.


(hataimengzhu) #3

Thank you for your reply. Ok, let me give it a try.


(Mark L. Stone) #4

Look at https://www.artelys.com/uploads/pdfs/Xpress/mipformref-1.pdf


(hataimengzhu) #5

Thank you very much.