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);
Solving problem using fmincon. Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.
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
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
ans = 0.9829
M = h*diag(exp(1i*p))*g;
norm(M,'fro')^2
ans = 67.4239
trace(M*M')
ans = 67.4239
Shankul Saini
Shankul Saini 2022년 10월 12일
편집: Shankul Saini 2022년 10월 12일
yeah correctly pointed out @Bruno Luong, let me look into this why this isn't the same and where i was doing mistake. But thank you very much for helping.
sum((h1*phi1*g1-h2*phi2*g1-h1*phi2*g2-h2*phi1*g2).^2,"all") + sum((h1*phi1*g2-h2*phi2*g2+h1*phi2*g1+h2*phi1*g1).^2,'all')
Unrecognized function or variable 'h1'.
this was the line supposed to be there @Bruno Luong, thanks again for pointing out.

댓글을 달려면 로그인하십시오.

채택된 답변

Torsten
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)
Local minimum found that satisfies the constraints. Optimization completed because the objective function is non-decreasing in feasible directions, to within the value of the optimality tolerance, and constraints are satisfied to within the value of the constraint tolerance.
sol = 4×1
2.2056 2.7240 4.1670 3.1435
fval = -1.3543
phi1 = -(phase(h)+phase(g.'));
obj(phi1)
ans = -1.3543
  댓글 수: 15
Bruno Luong
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).
Shankul Saini
Shankul Saini 2022년 10월 14일
Yeah @bruno luong, you are correct and thank you very much for the patient explanation.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Bruno Luong
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.
where one of the method use reformulation as quadratic-eigenvalue could overcome such numerical issue.
  댓글 수: 4
Shankul Saini
Shankul Saini 2022년 10월 11일
@Bruno Luong yeah definietly i may be wrong, i do not posses much background in optimization theory but I saw from this research paper that my problem is also a non convex QCQP .
Torsten
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 CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by