# How to solve this convex optimization problem in matlab

hi, I have a multiobjective function. I know that it is a convex optimization problem but i am not able to grasp it completely because the constraint 2. is somewhat irritating.I want to solve this problem in matlab. how do i proceed . please help

minimize Ps and Pr where cost C = Wa *((Ps + Pr)/20) + Wb *(10/R);
subject to 1. Ps + Pr <= 20;
2. (1/R) <= (1/10); where R is a funtion of Ps and Pr defined below.
3. Ps >= 0; Pr >= 0;

where Wa and Wb are weights such that Wa + Wb = 1. these weights are assigned apriori.

and R = (PsPr)/((PsPr) + Ps + Pr + 1)

Please provide the CVX model you’ve used so far, and where it’s running into difficulties.

thank u very much for reply. sir , i am a novice to cvx, i am learning it. I could do anything to solve this problem , you just hint me, from where i should start. I have the book convex optimization, but its too big . so i just want the proper name of this problem. so that i can proceed further.

You may wish to pose your question to another forum such as StackExchange: Mathematics or OR Exchange.

The purpose of this forum is to help people become more effective users of CVX and related tools. It is not a general forum about optimization, or even convex optimization, but specifically about the aforementioned software. For that reason, it is a rather firm prerequisite that when asking about a particular model, an attempt should already have been made to implement it in CVX (or TFOCS, for instance).

Unfortunately CVX is simply not a tool that can be used effectively without a good grasp of basic convex analysis and optimization. While we genuinely believe that CVX greatly simplifies the use of convex optimization in practice, it can be very frustrating to use without this knowledge.

Having said that, I do have a couple of observations about the problem that I will share.

First, it is obvious that your model is not feasible. For instance, R=(P_sP_r)/(P_sP_r+P_s+P_r+1) clearly satisfies 0\leq R<1, because the numerator is strictly less than the denominator, and both are nonnegative. Therefore, it is not possible for 1/R\leq 1/10, or equivalently, R\geq 10.

Second, suppose the model were corrected to remedy that problem. The question remains how to implement the 1/R quantity in CVX:
$$1/R=(P_sP_r+P_s+P_r+1)/(P_sP_r) =1+P_s^{-1}+P_r^{-1}+P_s^{-1}P_r^{-1}$$
The individual terms P_s^{-1} and P_r^{-1} are handled using the inv_pos function. Because inv_pos implicitly constrains its argument to be positive, there is no need to add constraints like Ps >= 0 to your CVX model; they would be redundant.

What about P_s^{-1}P_r^{-1}? There are actually two ways to implement this currently. The first takes advantage of the fact that
$$P_s^{-1}P_r^{-1}=\left(\det\begin{bmatrix} P_s & 0 \ 0 & P_r \end{bmatrix}\right)^{-1}.$$
Given this, we can write it as det_inv([Ps,0;0,Pr]). Alternatively, we can write it as a nonlinear composition
$$P_s^{-1}P_r^{-1}=(\sqrt{P_sP_r})^{-2}$$
which becomes pow_p(geo_mean([Ps,Pr]),-2) in CVX. This obeys the nonlinear composition rules in the DCP ruleset: pow_p(.,-2) is convex and nonincreasing, and geo_mean is concave, therefore they can be combined.

Combining these, we can write

Rinv = 1 + inv_pos(Ps) + inv_pos(Pr) + pow_p(geo_mean([Ps,Pr]),-2)


in CVX. This is a convex expression that can be used anywhere convex expressions are allowed according to the DCP ruleset.

1 Like