Writing an objective function respecting DCP

Hello everyone !

It is my first time using CVX tool to solve an optimization problem and I am struggling to write my objective that has the following form :

   sum( sum( X(r,t) * W(r,t) * e(r) * f(r)²) )

The first summation is over t and the second one is over r. The variables of the problem are X(r,t) (that belongs to [0,1]) and f® (that belongs to [0,f]).

Many thanks for your insights !

Why is your objective function convex?

You haven’t shown us the constraints. So the following may or may not work, and will only work with some values of W and e (those which make the objective function log-convex).

In simplified form:

cvx_begin gp
variables X(2) f(2)
% Add constraints consistent with CVX's gp mode rules

Given the variable products, I think the only hope of applying CVX to this problem is use of gp mode, and only if you can manage to follow all its rules. http://cvxr.com/cvx/doc/gp.html

Hello !
Thank you for your answers. Here is the complete version of the problem with constraints:

sum(sum( x(r,t) * w(r) * e(r) * f(r)² ))
such that : 0<= x(r,t) <=1 ;  0<= f(r) <=f
                  sum( x( r, t1:t2) ) =0 for every r 
                  sum( x( r, t2+1:t3) ) <=1 for every r
                  sum( x( r, t3+1:T) ) = 0 for every r
                  sum( x( r,t) * f(r))  = 0 for every t 
                  R * (1-epsilon) *( sum (x(r,t2+1:t3))^-1 <=1
                  x(r,t) * w(r)* e(r)* f(r)^-1 *To^-1 <= 1

Variables of the program: x(r,t) and f®.

Now , in the beginning my problem was a mixed integer non linear program (I know thre are solvers dedicated for this kind of problems) . After I relaxed it by imposing that x(r,t) belongs to [0,1].

To resolve it I tried to write it using the geometric programming form you propose. Except that for it to work, all my variables should be strictly positive as I understood since it will be considering the log of the objective function. Is it normal if i get as optimal solution zeroes for both x(r,t) and f® ?

Thank you correcting me if I’m on the wrong path.

Note that CVX doesn’t distinguish between strict and non-strict inequalities, e.g. between x > 0 and x >=0. The solution with all variables equal to zero is feasible and produces the lowest (given that this is minimization) possible objective value; therefore it is optimal. It appears that your optimization problem formulation is not very good. It is your problem, so you will have to figure out how to improve the formulation.

In the future, it will be helpful if you provide the complete CVX program, as well as solver and CVX output. Minimal-size reproducible programs complete with all input data are always preferable.

MIxed-Integer Geometric Programs can be formulated and solved under CVX if CVXQUAD and its exponential.m replacement for CVX’s is installed (see CVXQUAD: How to use CVXQUAD's Pade Approximant instead of CVX's unreliable Successive Approximation for GP mode, log, exp, entr, rel_entr, kl_div, log_det, det_rootn, exponential cone. CVXQUAD's Quantum (Matrix) Entropy & Matrix Log related functions ), in which case no modifications to your program are required given that you are already using gp mode. Either Mosek or Gurobi can be selected as the solver, however, Mosek is recommended due to the existence of bugs when Gurobi is run under CVX.