Find maximum of quadratically constrained quadratic problem using MATLAB
조회 수: 8 (최근 30일)
이전 댓글 표시
Hey,
I am trying to solve for maximized SNR at receiver of a two hop network. First hop channel coefficients are denoted by N*N matrix g and second hop channel coefficients are denoted by N*N matrix h. We have an N size array of phase tuning varibales using which we have to maximize frobenious norm of h*diag(exp(1j.*phi))*g.
with constraints that each diagnoal element should be unit modulas.
I have written the code as below. MATLAB wasn't allowing to combine complex data with optimization variable so I separted the real and imaginary part.
N=4;
h=sqrt(0.5)*(randn(N,N)+1j*randn(N,N));
h1=real(h);h2=imag(h);
g=sqrt(0.5)*(randn(N,N)+1j*randn(N,N));
g1=real(g);g2=imag(g);
k=optimproblem;
p=optimvar('p',N);
phi1=diag(cos(p));
phi2=diag(sin(p));
k.ObjectiveSense='maximize';
k.Objective=sum(h1*phi1*g1-h2*phi2*g1-h1*phi2*g2-h2*phi1*g2,'all')^2 +sum(h1*phi1*g2-h2*phi2*g2-h1*phi2*g1+h2*phi1*g1,'all')^2;
k.Constraints.intercept1 = (0<=p);
k.Constraints.intercept2 = (p<=2*pi);
sol0.p=zeros(1,N);
sol=solve(k,sol0);
cNew=sol.p;
It seems to be a non convex QCQP, can someone please help in solving this. Above code is using fmincon but it is not giving correct results.
댓글 수: 7
Bruno Luong
2022년 10월 12일
편집: Bruno Luong
2022년 10월 12일
Your original code with the objective function expressed with real/imag of phi doesn't seem to return the frobenious norm
N=4;
h=sqrt(0.5)*(randn(N,N)+1j*randn(N,N));
h1=real(h);h2=imag(h);
g=sqrt(0.5)*(randn(N,N)+1j*randn(N,N));
g1=real(g);g2=imag(g);
p=2*pi*rand(N,1);
phi1=diag(cos(p));
phi2=diag(sin(p));
sum(h1*phi1*g1-h2*phi2*g1-h1*phi2*g2-h2*phi1*g2,'all')^2 +sum(h1*phi1*g2-h2*phi2*g2-h1*phi2*g1+h2*phi1*g1,'all')^2
M = h*diag(exp(1i*p))*g;
norm(M,'fro')^2
trace(M*M')
채택된 답변
Torsten
2022년 10월 11일
편집: Torsten
2022년 10월 11일
Is this the simplified version of the problem you are trying to solve ?
It seems fmincon gives the correct solution.
N = 4;
h = sqrt(0.5)*(randn(1,N)+1i*randn(1,N));
g = sqrt(0.5)*(randn(N,1)+1i*randn(N,1));
phi0 = zeros(N,1);
lb = zeros(N,1);
ub = 2*pi*ones(N,1);
obj = @(phi)-(h*diag(exp(1i*phi))*g)*(h*diag(exp(1i*phi))*g)';
[sol,fval] = fmincon(obj,phi0,[],[],[],[],lb,ub)
phi1 = -(phase(h)+phase(g.'));
obj(phi1)
댓글 수: 15
Bruno Luong
2022년 10월 14일
편집: Bruno Luong
2022년 10월 14일
The issue is NOT fmincon but it seems the formulation of the simplified problem, which is constant (=abs(h*g)) regardless the value of phi on the admissible set, so it does not give what you think is good.
The formulation and expectation, and intuition of what is right is on your side, not MATLAB so noone can help you. You told us that the fro norm is the SNR of your system. Obviously either that is wrong or either phi has no a right control of your SNR. Only you can make sense of it (or not).
추가 답변 (1개)
Bruno Luong
2022년 10월 11일
The problem of least-square minimization under quadratic constraints is known to might have many local minima. So if you use fmincon or such without care on first guess initialization it could converge to local minima.
You could use my FEX https://fr.mathworks.com/matlabcentral/fileexchange/27596-least-square-with-2-norm-constraint?s_tid=srchtitle
where one of the method use reformulation as quadratic-eigenvalue could overcome such numerical issue.
댓글 수: 4
Torsten
2022년 10월 11일
You've put the constraints in the objective function.
This way, you get an unconstraint optimization problem with general objective.
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

