Find maximum of quadratically constrained quadratic problem using MATLAB
Show older comments
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 Comments
Matt J
on 11 Oct 2022
Above code is using fmincon but it is not giving correct results.
As indicated by what?
Shankul Saini
on 11 Oct 2022
Shankul Saini
on 11 Oct 2022
Shankul Saini
on 12 Oct 2022
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')
Shankul Saini
on 12 Oct 2022
Edited: Shankul Saini
on 12 Oct 2022
Accepted Answer
More Answers (1)
Bruno Luong
on 11 Oct 2022
1 vote
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 Comments
Shankul Saini
on 11 Oct 2022
Bruno Luong
on 11 Oct 2022
OK then you do not have quadratic constrained problem as the subject missleadingly suggests
Shankul Saini
on 11 Oct 2022
Torsten
on 11 Oct 2022
You've put the constraints in the objective function.
This way, you get an unconstraint optimization problem with general objective.
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
