# Why is the target function monotonically subtracting when maximize a objective function

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))<=(d
vmax)^2;
end
% norm([400-x(N),-200-y(N)],2)<=vmax
d;
% norm([-400-x(1),-200-y(1)],2)<=vmax
d;

``````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.

I have no idea what you are asking. I doubt anyone else does either. You need to explain your question much better.

I suggest you not use the `quiet` options until you are sure everything in your problem and its solution is working correctly and is understood.

I am so sorry but i mean that when i maximize the objective function f the graph of f shows a monotonically decreasing trend.Actually when i look for a maximun ,the graph of objective function should be monotonically increasing.

f monotonically decreasing as a function of what? Are you talking about the optimal objective value as a function of some input data? What is that inpjut data?

[quote=“Mark_L_Stone, post:2, topic:7745, full:true”]
I have no idea what you are asking. I doubt anyone else does either. You need to explain your question much better.

I suggest you not use the `quiet` options until you are sure everything in your problem and its solution is working correctly and is understood.
[/quote
strong text

• List item
I’m sorry i wonder if I didn’t express myself clearly enough.when i maximize the objective function f, the graph of f shows a monotonically decreasing trend.Actually when i look for a maximun ,the graph of objective function should be monotonically increasing.I don’t know which detail causes the monotonicity change of the objective function

I’m sorry i wonder if I didn’t express myself clearly enough.when i maximize the objective function f, the graph of f shows a monotonically decreasing trend.Actually when i look for a maximun ,the graph of objective function should be monotonically increasing.I don’t know which detail causes the monotonicity change of the objective function

input data is P_fea ,x_fea,y_fea and u_fea.

What is the “graph of f” you are referring to?

I mean the objective function “f”

Sure, but f is the objective, and after you optimize it has some fixed value. But then you are talking about the “changes of f” and “graph of f” so you treat f as a function. It is hard to understand what you mean by the monotonicity of f. Are you referring to solving one problem, or a sequence of problems, or something yet different?

Oh sorry ,if I maximize the f ,the f will be greater than the previous value of f .however the result of my simulation shows the opposite.