Cannot perform the operation: {real affine} .* {concave}, but the considered problem is a convex optimization problem

Dear expert,
I met an error when I did simulations. My simple code is listed as below:

h=2;
n=1;
cvx_begin
variables P t;
maximize t*log(1+P*h/n);
subject to
P>=1;
P<=8;
t>=0;
t<=1;
cvx_end

I have confirmed that the objective function in this code is concave w.r.t. P and t by deriving the objective function’s Hessian Matrix. Therefore, the related optimization problem is convex. Could you please tell me is there a suitable expression relating to the objective function such that the error can be avoided?

Thank you very much in advance.

1 Like

The objective function is neither concave nor convex. Your Hessian calculations must be erroneous.

If the objective were t*log(1+P*h/t), that would be concave.and could be entered as -rel_entr(t,t+P*h).

1 Like

Thank you very much, sir. I will consider my problem and your answer again.

1 Like