# Exponential of variables in the objective function

Hello everyone,

I am using CVX tool on MATLAB for an optimization problem with two variables (one variable is a vector X and the other is a scalar t). However, My variables are within exponential function in the objective function.

As shown here in this example:

Here is my first code sample:

cvx_begin
variables t X(N)
obj=norm(A-exp(1j*X).exp(-2*j*t),2);
minimize(obj)
cvx_end

Then I reformulated the optimization problem as follows to adhere to the no-product rule of CVX:

cvx_begin
variables t X(N)
obj=norm(A-exp(1j*X-2*j*t),2);
minimize(obj)
cvx_end

However I sill face this error message:

Error using - (line 27)
Disciplined convex programming error:
Invalid operations:
{0.0645916+1j*-0.997912} - {log affine}

As long as the variables are within the exponential or any other function like cos and sin, the optimization doesnâ€™t run and generates an error.

Is there any way where I can include my variables within exp() in the objective?

Many thanks in advance!

You also need to adhere to the argument of norm must be affine rule.

@Mark_L_Stone Thanks for your response. Actually, I try to make the argument of norm follow the affine rule. However, even when I remove the norm function and let my objective as simple as
minimize (A-exp(1jX-2j*t)), I sill get the same error. The problem comes from exp() function. Whenever I remove it, the optimization works.

In addition to the preceding link, which perhaps you need to re-read more carefully, also read Log of sigmoid function

@Mark_L_Stone Thanks a lot for the info. It is actually very helpful. So, if talking about each part of my model, I see that a positive constaint is log-affine. In my model, I have a complex constant A. Do we consider this also log-affine!

Type in the expression at the command line, and CVX will tell you what it is.

Thanks for your help! I managed to make my model follow CVX rules. However, I still have one last problem, which is that no function (such norm, sum_squareâ€¦etc)
operates on a â€śconcaveâ€ť. Is there anyway where I can perform such operations on my â€śconcaveâ€ť objective. Or if I ask in another way â€śwhich functionsâ€ť can operate on a concave objective.

norm(A-exp(1jX-2jf*t),2);

A is a complex constant, f is a real constant, X and t are the variables.

Any help would be much appreciated!

log and inv_pos are some of the functions which accept concave arguments.

However, I suggest you carefully re-read Why isn't CVX accepting my model? READ THIS FIRST! .

1 Like