# How to solve optimization problem with a big sum with given values

Hello everyone,
I would like to solve the following optimization problem:

• given vector g with 50 concrete real values
• optimization variable x (again of length 50)

GOAL: minimize( sum(x) )

subject to: Y =< sum( log(1 + g*x) )

• Y is a given number. (e.g. Y = 5)

With sum( log(1 + g*x) ) I mean:
log(1+g(1)*p(1)) + log(1+g(2)*p(2)) + … + log(1+g(50)*p(50))

I tried to implement this optimization problem, but it doesn’t work so far. I am not sure, how to express the constraint.

I would be very happy, if someone could help me.
Thank You!

Here is the CVX code for what you said you mean. I have assumed g is a column vector already available in your MATLAB workspace.

``````cvx_begin
variable x(50)
minimize(sum(x))
Y <= sum(log(1 + g.*x))
cvx_end
``````

What did you try which didn’t work? Was it accepted by CVX? Note that CVX will use its successive approximation method, so there is a chance it could run into difficulties in the solution process. But I wouldn’t expect any difficulties on this problem.

Hello,

@Mark_L_Stone: Thank you very much, this helped me a lot.

My “problem” code was quite similar. I just haven’t considered the correct dimensions of the given vector x.
I had to transpose it, then it worked.