Hello ,There’s a question that’s been puzzling me.That is Why is the target function monotonically subtracting when maximize a objective function.And the following is my code which is the part of solution with cvx.
cvx_begin
cvx_quiet true
solver='mosek';
%variables
variable x(1,N)
variable y(1,N)
variable u(1,N)
variable t(1,N)
variable sig(K,N)
%objective func
expression temp1(N)
f=0;
for n=1:N
P_fea(n)=P_fea(n)*gama;
temp1(n)=P_fea(n)*(u_fea(n)-u(n))/((u_fea(n)^2+P_fea(n)*u_fea(n))*log(2))+log(1-P_fea(n)*pow_p(t(n)+P_fea(n),-1))/log(2);
f=f+temp1(n);
end
maximize f;
%constrain
subject to
% x(N+1)==400;
% y(N+1)==-200;
% x(1)=-400;
% y(1)=-200;
expression c(K,N);
expression lambda(K,N);
for k=1:K
for n=1:N
c(k,n)=-x_fea(n)^2+2x_fea(n)x(n)-2x_E(k)x(n)+x_E(k)^2-y_fea(n)^2+2y_fea(n)y(n)-2y_E(k)y(n)+y_E(k)^2+H^2-t(n);
temp=[sig(k,n)+1,0,x_E(k)-x(n);0,sig(k,n)+1,y_E(k)-y(n);x_E(k)-x(n),y_E(k)-y(n),-sig(k,n)Q(k)^2+c(k,n)];
temp == semidefinite(3);
sig(k,n)>=0;
end
end
for n=1:N-1
square_abs(x(n+1)-x(n))+square_abs(y(n+1)-y(n))<=(dvmax)^2;
end
% norm([400-x(N),-200-y(N)],2)<=vmaxd;
% norm([-400-x(1),-200-y(1)],2)<=vmaxd;
square_abs(400-x(N))+square_abs(-200-y(N))<=(d*vmax)^2;
square_abs(-400-x(1))+square_abs(-200-y(1))<=(d*vmax)^2;
for n=1:N
square_abs(x(n))+square_abs(y(n))+H^2-u(n)<=0;
end
for n=1:N
t(n)>=H^2;
end
cvx_end
cvx_status
If anyone is kind enough to help me with my problems, I would appreciate it.