Cannot perform the operation: {log-affine} ./ {concave}

function[Pr,Rr]=SolveP1(Qr)
global beta0 H N0 N1 N2 Fc V L d0 tolerance P_ave p1 p2 M SNR R S;
L=2000;
H=100;
N1=-169;
N2=-169;
P_ave=5;
beta0=10; %

l=0;

tolerance=0.00001;
tol=tolerance;
M=100;
m = 1 : 1: M;
Q(1,m) = ((2000 - 0)(m-1)/(M-1));
Q(2,m)=((2000 - 0)
(m-1)/(M-1));
Qr=Q;
for l=1:1000
itera=l

P_begin=4*ones(2,M);%
P1={P_begin}%

%初始化轨迹;
h_ub=beta0ones (1,M)./((Qr(1,:)-Lones(1,M)).^2+(Qr(2,:).^2)+Hones(1,M).^2); %this is a 1m matrix
h_au=beta0ones(1,M)./((Qr(1,:).^2)+(Qr(2,:).^2)+(Hones(1,M).^2));%this is a 1*m matrix

cvx_begin   gp
variable P(2,M);
expression S;
expression R_con;
minimize -sum(R_con);
subject to
sum(P(1,:))<=M*P_ave; %average power constrains
sum(P(2,:))<=M*P_ave;
P(1,:)>=0;
P(2,:)>=0;
SNR=((P(1,:).*P(2,:).*h_au .*h_ub)) ./( ((P(1,:).*h_au.*(N2*ones(1,M)) +P(2,:).*h_ub.*(N1*ones(1,M))+(N1*ones(1,M)).*(N2*ones(1,M)))));
SNR1=(P1{1}(1,:).*P1{1}(2,:).*h_ub.*h_au)./((P1{1}(1,:).*h_ub.*N2*ones(1,M))+P1{1}(2,:).*h_ub.*N1*ones(1,M)+N1*ones(1,M)*N2*ones(1,M));
S=((SNR.^2*log2(e)*ones(2,M))./(2*(SNR1+1))).*(ones(2,M)./SNR -(ones(2,M)./SNR1));
R = (1/2*ones(2,M) * log2(1+P1{1}));%initial 
  R_con=R(l)-S;
cvx_end
P_l_ite=P;
R_l_ite=sum(R_con);

R = [R; R_l_ite];
P1 = cat(1, P1, {P_l_ite});
if (l >= 2) &&(R(l) - R(l-1) < tol) %l is the times of iteration
break;
end
end

Pr = P;
Rr = sum(R_con);
end

it was the frist to use cvx to solve problem ,i am sure that my model is convex ,i can not solve this problem as show above ,could please tell me why cvx did not accpet my model,thank you very much

If my description is not clear,please point it,

error in SNR=((P(1,:).P(2,:).h_au .h_ub)) ./( ((P(1,:).h_au.(N2ones(1,M)) +P(2,:).h_ub.(N1ones(1,M))+(N1ones(1,M)).(N2ones(1,M)))));

Have you proved that this is a convex optimization problem?

It doesn’t seem like a convex or concave function.

The “SNR” is a Intermediate variable,it is not a constraint or objective function ,I am sure my constraint and objective function is convex ,but you inspired me,I am not sure the Intermediate variable ,weather is convex or not, I will retry in other ways to avoid it.thanks for your time.thank you!

emmm,我在重现一篇论文的结果,论文最后将非凸问题转化成凸优化,这个SNR不是约束也不是目标函数,这里有一个很纠结的问题,在这里P里面存了一个2*M的值,分别代表两个节点的功率,相乘来求整体的信噪比(不好意思,如果你不是通信领域的可能听不懂),在后面把这个SNR当作一个整体处理,变成一个凸约束,也就是对P来讲,这可能是非凸的,但是对SNR来讲,这是一个凸约束。。。emmm,我可能也讲得不是很清楚,我也是刚接触凸优化不久,大佬你多担待。
(I tried to reproduce result from a paper,the “SNR” is not a constrain or objecti function,it just a Intermediate variable,I will try in another way,thank you very much。)

我也不是大佬,不过我是学通信的。 :joy:
I recommend you to refer to the 3.2.4 Section of Convex Optimization (Boyd), namely Composition. Although the SNR is a part of the objective function, it always has an effect on the convexity of the objective function.
Now, we consider the composite function f(x)=h(g(x)), the outer function of the right hand side h(x)=\frac{1}{x} is convex and nonincreasing. If you want to make f(x) is convex, the argument of h(x), i.e. g(x) must be concave.

另外,不是哥们不用中文,只是写的答案想让大家都看到,对于英文不好的我,可难为死我了。 :joy:

鉴于我的回复没啥参考意义我就不用英语回复了,太难组织语言了 :rofl:,那本书我前段时间也在研究,不过也没细看,我再去看看,其实我现在还是有点懵,没有相关代码就是自己头铁自己搞仿真,大兄弟要不留个联系方式拯救一下咸鱼 :joy:,交流交流

ldj1226229275@163.com

感谢老哥,我会来请教老哥的,如有打扰还请包涵哈 :joy:

It seems that the “SNR” term is not convex. If you are using the GP mode, the “SNR” term should be modeled as a posynomial. However, in your modeling, The “SNR” term is not a posynomial since the denominator of SNR is not a monomial, which makes the SNR term nonconvex. You can refer to [1] for details.

[1] Boyd, Stephen, et al. “A tutorial on geometric programming.” Optimization and engineering 8.1 (2007): 67.

yes,the SNR is not convex or concave,it is just a stupid question,because it was the frist time I use CVX to solve convex question ,thanks for your recommendation,I will read it,thank you!