# How can model this problem in cvx

hello.I want to minimize following model in cvx.
z=p1I1
log(z)=log(p1
I1)
log(z)=log(p1)+log(I1)
z=exp(log(p1)+log(I1)
the model in cvx will be:
cvx_begin
variables p1 I1
minimize(exp(log(p1)+log(I1)))
subject to
p1>=0;
I1>=0;
cvx_end
the error in cvx is:
Error using cvxprob/newobj (line 57)
Disciplined convex programming error:
Cannot minimize a(n) log-concave expression.

Error in minimize (line 21)
newobj( prob, ‘minimize’, x );

Error in Untitled13cvx (line 12)
minimize(exp(log(p1)+log(I1)))
thanks

How is this different from your previous similar questions? How did things end up for those problems…

hello.I read your previous recommendation about geometric programing ,but i can not change the model and I decided don’t use of cvx_ begin gp in cvx.for this purpose we must replace the p1*I1 with convex model in problem. please help me.
best regard.

If your problem is not convex, it’s not convex. You either need to change your model to a convex model which will be accepted by CVX, or use a different optimization tool/solver than CVX if you wish to keep your model as is.

Your only chance of having a non-convex problem accepted and solved by CVX, is to use CVX"s MIDCP capability, which allows use of binary and integer variables to model certain non-convex situations. If you figure out how to use the MIDCP capability to do this for any of the problems you have posted, then please post how you did it, because that may be of interest to many forum readers, including myself.

I have no idea what your “real-world” problem is, so I have no idea, which changes to the model, if any, would be appropriate. Nor would changing your model to a different model be within scope of this forum.

hello. i write the following terms in cvx, it shows error:
cvx_begin
variables p1 I1 y1 y2
exp(y1)=p1;
exp(y2)=I1;
minimize (a0*(log(exp(2y1+y2)))+a1(log(exp(y1+y2)))+a2*y2)
subject to
p1>=0;
I1>=0;

cvx_end
the error is:
Error using cvx/subsasgn (line 39)
Function ‘subsindex’ is not defined for values of class ‘cvx’.

Error in Untitled13cvx (line 13)
exp(y1)=p1;

thanks regard

CVX is objecting to

``````exp(y1)=p1;
exp(y2)=I1;
``````

You can not assign some function of a variable to anything. These are assignments because there is a single = . They are not equalities which have double ==

Tricks like you are trying to do will not work. Your model is not convex. The only hope I can see to get it accepted by CVX is to either change the model to a convex model (i.e., a different, NON-EQUIVALENT model) or use the MIDCP capability to model the non-convexities of your model using binary (or integer) variables. I don’t know how to do the latter and don’t know if it can be done, but maybe you can figure out how to do it. Otherwise, you need to use a different tool/solver than CVX.

Edit: MIDCP will not work. Use of binary or integer variables combined with CVX"s successive approximation method, which is needed for log or exp, does not work correctly.

morteza: this is going to sound mean, but: please stop trying to use CVX. It is simply not designed for the types of problems you are trying to solve. And as stated quite clearly in the FAQ, if you don’t use it properly, it can be a very frustrating piece of software to use. In particular, you have to understand convex optimization well to use it effectively.

You have asked a number of questions on this forum, and well over half of them have involved problems that CVX is not designed to solve, and never will solve. The documentation and FAQ make this clear; if they do not, please recommend changes to those documents so I can help you understand why CVX is not a good choice for your applications.