I am trying to solve the following problem using CVXPY
import cvxpy as cp
x = cp.Variable(nonneg=True)
from cvxpy.atoms.elementwise.power import power
objective = cp.Minimize(3*x + x*cp.exp(cp.inv_pos(x)))
constraints = [x>=1,x<=10]
problem = cp.Problem(objective, constraints)
problem.solve()
print(x.value)
print(problem.value)
It gives me the following error:
DCPError: Problem does not follow DCP rules. Specifically:
The objective is not DCP. Its following subexpressions are not:
var91 @ exp(power(var91, -1.0))
I think this objective is convex, but there in an error
cvxpy
As @Michal Adamaszek mentioned, you can add another variable
tsaisfying the constraintcp.rel_entr(x, t) <= -1i.e.t>=x*exp(1/x)(relaxation), then minimize3*x+tMATLAB, with CVX
MATLAB, with YALMIP
gurobipy
Mathematica