 # Disciplined convex programming error：Exponential multiplication

clc
clear all
close all
cvx_begin gp
variables x
object =(1-x)*exp(-x);
maximize object
subject to
0<x<1;
cvx_end
%%%%%%%%%%
Disciplined convex programming error:
Cannot perform the operation: {concave} ./ {log-convex}
%%%%%%%%%%%
Why can’t cvx recognize this form of multiplication?
How can it be solved?

Do you see that listed as being allowed in the gp rules http://cvxr.com/cvx/doc/gp.html? I don’t.

Your objective function is concave within your constraint region of 0 < x < 1; so maximization over that domain is inherently a non-convex optimization problem. Actually it is a concave programming problem with compact constraints; therefore, its global maximum occurs at an extreme of the constraints, i.e…, at 0 or 1, and it happens to be at 1.

Your objective function is concave for x > 3, but because it is not concave over the entirety of its natural domain, the prospects for formulating within DCP rules, even if the problem is constrained to x > 3, are not good.

How can I solve such problems?
I think CVX does not recognize the expression of the objective function object =(1-x)*exp(-x);

Thank you

This is a non-convex problem, which requires a non-convex solver (unless you can solve it by inspection or analytically, as I did with your very simple example). CVX can’t be used for this problem.