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]).
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)
minimize(sum(X.*Y.^2))
% Add constraints consistent with CVX's gp mode rules
cvx_end
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® ?
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.