How to code the following optimization problem

Hi everyone,
I have the following optimization problem to solve:
minimize c^Tx, subject to ||c^Tx||_1 <= C

Can someone tell me how to write this in say NLopt, or any other library?

The very problem statement is rather confusing. At least for me. I assume that x and c are vectors (1d arrays of numbers). Then c^Tx is a scalar, but what does ||c^Tx||_1 mean? Why wouldn’t the constraint be written just as |c^Tx|<=C?

If my understanding of the problem statement is correct, that is,

minimize c'x
subject to |c'x|<=C

the solution is pretty straightforward, isn’t it? Minimization of a linear function(al) with a lower (and upper) bound on its value. For a nonzero c, the minimum value of the functional is -C. A minimizer x can be found by solving

c'x = -C.

3 Likes

sorry, I wrote it wrong! The correct problem is
minimize 1’Ax,
subject to ||Ax||_1 <=C

here A is a matrix, 1 is a vector of all ones

using Convex, Clp

m,n = 2,3
A = rand(m,n)
γ = 3.0

x = Variable(n)
problem = minimize(sum(A*x), norm(A*x,1)<=γ)

solve!(problem, Clp.Optimizer)

problem.optval
x.value
4 Likes

thank you so much

2 Likes