On the slowness of sum(log(x))

In my optimization problem I have linear constraints and the concave objective function sum(log(1+x)), which is equivalent but not identical to sum(log(x)).

Since the value of the objective function is not so important in my case but the optimization variables are, I could just as easily have used sum(x) as the objective and treat it as a linear problem since the log-function is monotone. Why? I noticed that having sum(log(1+x)) as the objective rather than sum(x) slows down CVX a lot given that everything else is the same. Why is this so? Are different solvers used?

I provide example code to visualize my point. I have created a for loop where the two problems are solved multiple times to accentuate the time difference.

% Initialization
clear all
n = 3; m = 5; nr = 10;
A = rand(m,n);
b = 10ones(m,1);
l = zeros(n,1);
u = 10
ones(n,1);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sum(log(1+x))
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tic;
for r = 1:nr
cvx_begin quiet
variable x(n)
maximize( sum(log(1+x)) )
subject to
A*x <= b
l <= x <= u
cvx_end
end
toc

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% sum(x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tic;
for r = 1:nr
cvx_begin quiet
variable x(n)
maximize( sum(x) )
subject to
A*x <= b
l <= x <= u
cvx_end
end
toc

Your sum(x) formulation is a Linear Program, so is easy to solve. Your sum(log(1+x)) formulation requires use of CVX’s successive approximation method to deal with the exponential cone, and though it is a convex programming problem, it is a more difficult problem to solve than your corresponding Linear Program.

1 Like

I see. Makes sense. Thanks for the timely reply!