I want to solve a non-linear optimization problem using cvxpy
. I get a DCP Error
when introducing 1/x
in the constraints, where x
is a variable.
For instance such a code leads to a DCP Error
import cvxpy
x = cvxpy.Variable(1)
obj = cvxpy.Maximize(x)
cst = [1/x >= 1]
prob = cvxpy.Problem(obj, cst)
opt_val = prob.solve()
Expected result is x=1
. Also 1/x
is obviously convex so I don't understand what the problem is...