# How to solve this problem?

Hello,

Thanks in advance for your help and support. I know that this is common topic, posted by many before me. I have read their problems. However,I can not solve the error!

I want to solve the problem in the picture.Here, the yellow words are variables.When I use CVX,it shows “Disciplined convex programming error:
Cannot perform the operation: {positive constant} ./ {convex}”

Kind regardsstrong text

Here the initial of aa1 is zero.To begin with,it is not ‘eps’,I suppose that ‘taon_opt(1,2:N) + 0.01’ to replace,but it is still wrong.

for i = 2:N
aa3 = (c1.*taon_opt(1,i).*pow_pos(vn(1,i),3) + c2.*taon_opt(1,i)./norms(vn(1,i)) + (c2.pow_pos(norms(vn(1,i) - vn(1,i-1)),2))./((inv_pos(taon_opt(1,2:N)+eps).(g^2).*vn(1,2:N))));
aa1 = aa1+aa3;
end
aa1 = aa1 + (c1.*taon_opt(1,1).pow_pos(vn(1,1),3) + c2.taon_opt(1,1)./norms(vn(1,1)) + (c2pow_pos(norms(vn(1,1) - v0),2))./((inv_pos(taon_opt(1,1)+eps).(g^2).*vn(1,1))));
aa2 = sum(sum(bmn_opt(:,1:N).*Pn(1,N)));
aa1 + aa2 <= Emax; %26

That s not complete code. It does not contain variable declarations. Your first post stated that tau and b are variables, although it did not explicitly state that they are the only variables. Your code looks suspiciously like vn may also be a variable.

In any event, you can’t expect anyone to help you unless they clearly know what the optimization problem is, to include knowing what the optimization variables are, and what is input data.

If vn is an optimization variable (and if it is not, why are you applying CVX functions to it?), the problem doesn’t look convex to me.

Sorry，I din dot express it clearly!
cvx_begin
cvx_quiet(true)
variable un_opt(2,N) nonnegative;
variable bmn_opt(5,N) nonnegative;
variable fmn_opt(5,N);
variable taon_opt(1,N) nonnegative;

variable yita;
maximize yita

subject to
for m = 1:5
for n = 1:N
Imnr(m,n) - Jmnr(m,n)(pow_pos( norms(un_opt(:,n)-GU(:,m)),2) - pow_pos(norms(un0(:,n)- GU(:,m)),2)) >= fmn_opt(m,n); %33
end
end
bmn_opt1 = power((bmn_opt(:,1:N)),2) ;
fmn_opt1 = power((fmn_opt(:,1:n)),2);
sum(sum((bmn0(:,1:N)+fmn0(:,1:N)).
(bmn_opt(:,1:N)+fmn_opt(:,1:N))-(1/2).pow_pos(bmn0(:,1:N)+fmn0(:,1:N),2) -(1/2)(bmn_opt1 + fmn_opt1))) >= yita;%34

for i = 1:N
bmn_opt2 = power(bmn_opt(:,i),2);
fmn_opt2 = power(fmn_opt(:,i),2);

``````   sum((bmn0(:,i)+fmn0(:,i)).*(bmn_opt(:,i)+fmn_opt(:,i))-(1/2).*power(bmn0(:,i)+fmn0(:,i),2) -(1/2).*(bmn_opt2 + fmn_opt2)) >= Rmin .*taon_opt(1,i);%35
``````

end

vn = rand(1,N);
v0 = 15;
for i_ = 1:N
sum(bmn_opt(:,i_)) <= taon_opt(1,i_); %15

end
for i = 2:N
norms(un_opt(:,i)- un_opt(:,i-1)) <= samax;% 约束21
un_opt(:,i) - un_opt(:,i-1) == ((vn(1,i) + vn(1,i-1))./2).taon_opt(1,i); %23
norms(taon_opt(1,i)) <= abs((vn(1,i) - vn(1,i-1))./amax); %27
end
norms(un_opt(:,1) - ui(1,1)) <= samax;
un_opt(:,1) - ui(1,1)== taon_opt(1,1)
(vn(1,1) + v0)/2;
norms(taon_opt(1,1)) <= abs((vn(1,1) - v0(1,1))./amax);

for i = 1:5
for i_ = 1:N
bmn_opt(i,i_) >= 0;
end
end

aa1 = 0;
for i = 2:N
aa3 = (c1.*taon_opt(1,i).*pow_pos(vn(1,i),3) + c2.*taon_opt(1,i)./norms(vn(1,i)) + (c2.pow_pos(norms(vn(1,i) - vn(1,i-1)),2))./((inv_pos(taon_opt(1,2:N)+eps).(g^2).*vn(1,2:N))));
aa1 = aa1+aa3;
end
aa1 = aa1 + (c1.*taon_opt(1,1).pow_pos(vn(1,1),3) + c2.taon_opt(1,1)./norms(vn(1,1)) + (c2pow_pos(norms(vn(1,1) - v0),2))./((inv_pos(taon_opt(1,1)+eps).(g^2).*vn(1,1))));
aa2 = sum(sum(bmn_opt(:,1:N).*Pn(1,N)));
aa1 + aa2 <= Emax; %26

cvx_end
val1= cvx_optval;
un0 = un_opt;
bmn0 = bmn_opt;
fmn0 = fmn_opt;
taon = taon_opt;

I will assume this problem is non-convex unless you prove otherwise. Please read the link in my previous post.

Hu = 100;
Hg = 25;
bmn0 = ones(5,N);
fmn0 = ones(5,N);
taon = 0.01.*ones(1,N);
ui = [0 ,0];
uf = [5000 ,5000];
g = 9.8;
GU = [1000 3500 4800 4000 1800;1800 4500 3200 1000 300];

Pn = ones(1,N);

Amnr = zeros(5,N);
for m = 1:5
for n = 1:N
Amnr(m,n) = ((Hu - Hg)^2 + norms(un0(:,n)-GU(:,m))^2)^1.1;
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
gamma = 2;

Imnr = zeros(5,N);
for m = 1:5
for n = 1:N
Imnr(m,n) = B*log2(1 + (Pn(1,n).*gamma)/Amnr(m,n));
end
end

Jmnr = ones(5,N);
for m = 1:5
for n = 1:N
Jmnr(m,n) = (B.*Pn(1,n).gamma.(alpha/2)log2(exp(1)))/(((Hu - Hg)^2 + norms(un0(:,n)-GU(:,m))^2)(Amnr(m,n) + Pn(1,n).*gamma));
end
end