Gurobi convex optimization

I am using Gurobi and JuMP to solve a fairly simple convex optimization problem but I am a newbie and don’t know the right syntax.
I want to solve (N is a fixed and known integer (eg 100))
\min \sum_{i=1}^{N} (-log x[i]) subject to some linear constraints on the N-dimensional vector x.

I have already got some code to work that minimizes the sum of some quadratic terms subject to some linear constraints. My problem is doing an objective function involving logs.
Any help would be appreciated. Thank you.

Hi @tardis438, welcome to the forum.

Gurobi does not easily support problems with log.

You could use Ipopt instead:

using JuMP, Ipopt
N = 100
model = Model(Ipopt.Optimizer)
@variable(model, 0.01 <= x[1:N] <= 1)
@objective(model, Min, sum(-log(x[i]) for i in 1:N))

Thank you! It works — and works perfectly now!

1 Like