How can I solve this problem? Disciplined convex programming error: Cannot perform the operation: {real affine} ./ {real affine}

Recently, I’m coding and I meet the problem: Disciplined convex programming error: Cannot perform the operation: {real affine} ./ {real affine}
My code is shown as following, please help me to solve this problem :sob:

clear all;
close all;

Para = get_parameters();
K = Para.K;
U = Para.U;
N = Para.N;
D = Para.D;
C = Para.C;
P = Para.P;
cos = Para.cos;
alpha = Para.alpha;
h = Para.h;
t = Para.t;
B = Para.B;
L = Para.L;
N0 = Para.N0;

p_equal = [0.125 0.125;0.125 0.125;0.125 0.125;0.125 0.125];
[S,S_bar,rho] = two_sided_matching(Para,p_equal);

E_cmp = D*C.*P;
h_match = zeros(K,N);
flag = find(S~=0);
h_match(flag) = h(flag);
F = zeros(K,K,N);
for k = 1:K
for j = 1:K
for n = 1:N
if j == k
if h_match(j,n) < h_match(k,n)
F(k,j,n) = 1;
F(k,j,n) = 0;

variable p(K,N);
expression p_bar(K,N);
expression I(K,N);
expression R(K,N);
obj = 0;
p_bar = p.rho;
for k = 1:K
for n = 1:N
F_k = F(k,:,n);
I(k,n) = sum(F_k.p_bar(:,n)’.(h(:,n).^2)’);
R(k,n) = B
lg(1 + (p_bar(k,n)(h(k,n)^2)./(I(k,n)+N0)));
obj = obj + sum(cos.
minimize obj
subject to
sum(R,2)*t >= alpha.*L;
p >= 0;

1 Like

Let’s handle this at your other post How to solve this problem?Cannot perform the operation: {real affine} .* {convex}

1 Like

The two constrains are all convex, because the paper has solved the problem , and I just recurrence code, and I still dont know how to do?

1 Like

We don’t know what paper said or did what.

The paper where I found the model says it is convex.

This is not sufficient. Please do not use CVX until you have thoroughly proven that the model is a convex optimization problem.

It does happen, sometimes, that authors are incorrect. But more commonly, they are imprecise. That is: some models that are claimed to be convex are convex geometrically, but they are not in a standard convex optimization form. For a simple, but contrived example, consider the constraint ⌈x⌉≥1 is not a valid constraint in a convex optimization setting, even though it describes the same interval as the linear inequality x>0 . (I’ve not seen this particular example in practice, but I have seen others; e.g., beamforming papers.)

If you are having difficulty proving that a model you found in a paper is convex, please contact the authors to see if you can get clarification. In fact, if they say they’ve solved the problem with CVX themselves, ask them for the code! But please do not try to use CVX until you’ve done so. And please do not ask for help with this here at this forum.

1 Like

So could you please post the link of the paper you are recurrencing?

Well said Mark … You set the direction correctly and stresed the point to the teeth. Using a paper to confirm a convexity lacks understanding & create immaturity to address the problem. The onus is always on the individual to proof a convex solution exist first before even attempting on the cvx programming.