# How to express this objective function in CVX

#1

The objective function is:

maximize \prod_{t=1}^T(1+p_th_t)^{c_t}

Here 0\le p \le 3 are continuos variables and c_t\in \{0,1\} are binary integer variables.

How can I express this in CVX?

Can I use geo_mean function?

How to write it in CVX acceptable/equivalent form?
(Michael C. Grant) #2

The FAQ) applies here. First of all, products are rarely convex. You might be able to reformulate this using geo_mean instead.

(Michael C. Grant) #3

That said, I have a sneaking suspicion that a reformulation to true MIDCP form is possible if you replace that objective function with a geo_mean. I’ll think about it.

#4

@mcg Thank you very much. In fact, I obtained this objective reformulating my original objection function which is povided in the edited version of my post.

(Michael C. Grant) #5

Your original objective is closer to convex. The right way to reformulate sum_log is with geo_mean. But there’s still the matter of the c_t's. But note that if c_t\in\{0,1\},

$$(1+p_th_t)^{c_t} = 1+c_tp_th_t$$

This isn’t true for all c_t, of course, just for binary c_t. So let’s take advantage of this. For each t, create a new variable, and add the constraints

$$q_t \leq 1 + h_t \min{p_t,3 c_t}$$

So I think what you can do is this:

\begin{array}{ll}
\text{maximize} & \left( \textstyle \prod_t q_t \right)^{1/T} \
\text{subject to} & q_t \leq 1 + h_t \min{ p_t, 3 c_t } \
& 0 \leq p_t \leq 3, ~ t=1,2,\dots,T \
& c_t\in{0,1} ~ t=1,2,\dots T \
& \text{other constraints}
\end{array}

In CVX you would have cvx_begin variables p(T) q(T) variable c(T) binary maximize(geo_mean(q)) q <= 1 + h .* min( p, 3 * c ) ... cvx_end You'll have to convince yourself this is equivalent.

(Michael C. Grant) #6

Yes, that is not accepted. You will have to do a similar transformation the one I offer below.

#7

Using MCG’s approach the constraints become

q_t\le1+h_t{\rm{min}}(p_t,3c_t), \forall t

\prod\limits_{t=1}^Nq_t\le Z which is equivalent to

 geo_mean(q)<=(Z)^{1/N}


Am I doing something wrong?

#8

@mcg, please comment on my answer… Also, which solver I should be using for MIDCP, both Sedumi and SDTP3 do not support integer variables, I do not have access to MOSEK…

(Michael C. Grant) #9

Then you cannot solve this problem with CVX.

(Michael C. Grant) #10

Yes. READ THE FAQ.) The fact that you’re still trying to use prod instead of geo_mean tells me you’re just not understanding how CVX is used, and I am reluctant to help further until you do.

#11

@mcg Thanks, ofcourse, I need to express the product in terms of geo-metric mean. I just wanted you to confirm the transformation…

(Michael C. Grant) #12

Your edit looks good. But of course, without MOSEK or Gurobi you won’t be able to solve it…

#13

@mcg, Thanks for your comments. I tried with MOSEK, it just fails to solve my problem. When I use Sedumi instead with variable c(T) not binary, it can solve the problem but that I do not want…