# How to write this objective function?

`minimize sum(X./(Y-X))`, where X is a constant matrix, `Y-X>0`, thank you !

Presuming X has all entries nonnegative, the following will work

``````cvx_begin
variable Y(size(X))
minimize(sum(sum(X.*inv_pos(Y-X))))
cvx_end
``````

Of course, this will drive elements of Y to be large and the objective to within tolerance of 0, unless there are other constraints.

Thanks a lot, howerer, the compilation still fails according to your form.

Then you need to show us your X. Your expression is not convex for an arbitrary X.

`X = rand(5,1); Y = -1/2*log(inverseSINR), inverseSINR = (sigma + Gtilde*P)./(Gdiag.*P)`; the variable is vector P(5), thank you !

My program will run with your X.

Now you have provided a different problem. I don’t know what your new problem is. You have not provided all input values. You have not specified what the objective function is. You need to provide a complete and unambiguous specification of your problem. Have you proven it is convex?

The form is convex, since X is a constant matrix, the Y is also convex using the GP (please refer to http://cvxr.com/cvx/examples/), so the problem is convex. Thanks a lot.

Well, I still don’t know what your model is. If your model is convex as you say, because it matches a CVX example, then write your program in that form and it should work. Beware that you can not necessarily mix and match stuff from GP mode and non-GP mode and still have a valid convex problem.

Note the restriction on the argument of inv_pos:
help inv_pos

inv_pos Reciprocal of a positive quantity.
inv_pos(X) returns 1./X if X is positive, and +Inf otherwise.
X must be real.

`````` For matrices and N-D arrays, the function is applied to each element.

Disciplined convex programming information:
inv_pos is convex and nonincreasing; therefore, when used in CVX
specifications, its argument must be concave (or affine).``````

My model is as follows:
% minimize minimize(sum(sum(D.inv_pos(-1/2log(inverseSINR)-D))))
% s.t. Pmin <= P <= Pmax
% inverseSINR <= (1/SINR_min);
% D <= -1/2log(inverseSINR);

The argument of inv_pos is -1/2*log(), which is not concave as required. So your program violates CVX’s rules, and so you have not proven convexity.

If I use the objective function: maximize(sum(-1/2*log(inverseSINR)-D)), the problem can be solved using the CVX, it means that the problem is convex, the argument of the objective function with your form, which may be incorrect form.

Please show a complete program, with results, in which that objective is accepted by CVX.

You have not shown your problem is convex ( I still don;t know what it is, by the way). Math, convexity propagation, and CVX are not like legal arguments in which you can have different half proofs which don’t fit together and claim you have proven something.

You can substitute
`minimize(sum(inv_pos(-1/2*log(inverseSINR)-D)))`
for the objective function, and that will also be accepted.

When you show a complete working CVX program implementing the model you want, that will be a convexity proof. But the whole thing must either be in gp mode, or not gp mode; you can’t mix together rules which are allowed in one but not the other of gp and non-gp modes.

I use the objective function minimize(sum(inv_pos(-1/2*log(inverseSINR)-D))) can not be solved the problem, the errors are the similar to the above, it means that the argument is the function inv_pos, thank you!

I really don’t know what you want to solve.

If you substitute `minimize(sum(inv_pos(-1/2*log(inverseSINR)-D)))` for the objective in your most recently posted program (gp mode), the problem is accepted by CVX. Whether the problem is feasible (has a feasible solution) is another matter.

Please show you program with the minimize(sum(inv_pos(-1/2*log(inverseSINR)-D))) for the objective in your most recently posted program (gp mode) and the results. Thanks a lot!

Note: i used exponential.m from CVXQUAD, thereby avoiding CVX’s successive approximation method

``````    n = 5;                                 % number of transmitters and receivers
sigma = 0.0001*ones(n,1); % noise power at the receiver i
Pmin = 0.1*ones(n,1);        % minimum power at the transmitter i
Pmax = random('poisson',5,1,n)';
SINR_min = 5;                   % threshold SINR for each receiver
D = rand(n,1);
% path gain matrix
G = [3.0  0.2  0.02  0.01  0.2
0.01  2.0  0.2  0.01  0.1
0.2  0.1  2.0  0.02  0.02
0.1  0.1  0.02  3.0  0.05
0.3  0.1  0.2  0.4  2.0];
% variables are power levels
cvx_begin gp
variable P(n)
Gdiag = diag(G);            % the main diagonal of G matrix
Gtilde = G - diag(Gdiag); % G matrix without the main diagonal
% inverse SINR
inverseSINR = (sigma + Gtilde*P)./(Gdiag.*P);
information_capacity = -1/2*log(inverseSINR);
%minimize( sum(P) )
minimize(sum(inv_pos(-1/2*log(inverseSINR)-D)))
subject to
D <= information_capacity;
% constraints are power limits and minimum SINR level
Pmin <= P <= Pmax;
inverseSINR <= (1/SINR_min);
cvx_end
=====================================
cone with parameters m=3, k=3
=====================================

Calling SDPT3 4.0: 520 variables, 195 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------

num. of constraints = 195
dim. of sdp    var  = 310,   num. of sdp  blk  = 155
dim. of linear var  = 55
*******************************************************************
SDPT3: Infeasible path-following algorithms
*******************************************************************
version  predcorr  gam  expon  scale_data
HKM      1      0.000   1        0
it pstep dstep pinfeas dinfeas  gap      prim-obj      dual-obj    cputime
-------------------------------------------------------------------
0|0.000|0.000|4.7e+01|8.3e+00|4.5e+04| 2.253479e+03  0.000000e+00| 0:0:00| chol  1  1
1|1.000|0.746|1.8e-05|2.2e+00|1.0e+04| 2.086007e+03 -3.700553e+01| 0:0:00| chol  1  1
2|0.756|0.827|3.7e-06|3.8e-01|3.0e+03| 1.332268e+03 -5.059376e+01| 0:0:00| chol  1  1
3|0.966|0.792|1.6e-06|8.0e-02|7.6e+02| 3.930279e+02 -2.541220e+01| 0:0:00| chol  1  1
4|1.000|0.667|8.4e-07|2.7e-02|2.7e+02| 1.053236e+02 -2.133615e+01| 0:0:00| chol  1  1
5|0.757|0.583|3.7e-07|1.1e-02|1.5e+02| 4.674950e+01 -2.204594e+01| 0:0:00| chol  1  1
6|0.392|0.291|3.3e-07|7.9e-03|1.4e+02| 3.100218e+01 -2.320165e+01| 0:0:00| chol  1  1
7|0.195|0.334|3.2e-07|5.2e-03|1.2e+02| 2.314847e+01 -2.462522e+01| 0:0:00| chol  1  1
8|0.171|0.506|3.0e-07|2.6e-03|8.4e+01| 1.196586e+01 -2.598932e+01| 0:0:00| chol  1  1
9|0.170|0.112|5.5e-07|2.3e-03|8.9e+01|-1.810893e+01 -3.009078e+01| 0:0:00| chol  1  1
10|0.135|0.142|4.8e-07|2.0e-03|9.4e+01|-6.295865e+01 -3.624096e+01| 0:0:00| chol  1  1
11|0.112|0.256|4.2e-07|1.5e-03|7.8e+01|-1.497396e+02 -4.808738e+01| 0:0:00| chol  1  1
12|0.110|0.102|3.8e-07|1.3e-03|1.1e+02|-5.592772e+02 -8.382108e+01| 0:0:00| chol  1  1
13|0.050|0.059|3.6e-07|1.2e-03|2.0e+02|-2.285531e+03 -1.462806e+02| 0:0:00| chol  1  1
14|0.038|0.047|3.5e-07|1.2e-03|6.4e+02|-1.161816e+04 -4.510889e+02| 0:0:00| chol  1  1
15|0.015|0.020|3.4e-07|1.2e-03|2.7e+03|-7.192490e+04 -1.365145e+03| 0:0:00| chol  1  1
16|0.007|0.016|4.1e-07|1.1e-03|1.2e+04|-4.957616e+05 -5.737224e+03| 0:0:00| chol  1  2
17|0.005|0.001|9.4e-07|1.1e-03|1.3e+05|-9.467005e+06 -7.047134e+03| 0:0:00| chol  2  2
18|0.001|0.002|1.2e-06|1.1e-03|9.3e+05|-8.577005e+07 -2.038110e+04| 0:0:01| chol  2  2
19|0.000|0.001|4.0e-06|1.1e-03|3.0e+06|-3.362214e+08 -4.156361e+04| 0:0:01| chol  2  2
20|0.000|0.001|2.5e-05|1.1e-03|1.3e+07|-1.635529e+09 -7.181288e+04| 0:0:01| chol  2  2
21|0.000|0.001|2.0e-04|1.1e-03|9.9e+07|-1.549102e+10 -1.394889e+05| 0:0:01| chol  2  2
22|0.002|0.002|3.9e-03|1.1e-03|3.3e+09|-6.328995e+11 -2.802927e+05| 0:0:01| chol  2  2
stop: primal infeas has deteriorated too much, 1.1e-01
23|0.001|0.000|3.9e-03|1.1e-03|3.3e+09|-6.328995e+11 -2.802927e+05| 0:0:01|
prim_inf,dual_inf,relgap = 3.90e-03, 1.13e-03, 5.14e-03
sqlp stop: dual problem is suspected of being infeasible
-------------------------------------------------------------------
number of iterations   = 23
residual of dual infeasibility
certificate X          = 3.53e-12
reldist to infeas.    <= 1.51e-15
Total CPU time (secs)  = 0.66
CPU time per iteration = 0.03
termination code       =  2
DIMACS: 6.3e-03  0.0e+00  3.9e-03  0.0e+00  -1.0e+00  5.1e-03
-------------------------------------------------------------------

------------------------------------------------------------
Status: Infeasible
Optimal value (cvx_optval): +Inf``````

I don’t understand your note, in other words, I can’t use the exponetial.m, can you help me? I can‘t implement your posted program. Thank you！

I was referring to https://github.com/hfawzi/cvxquad .

However, the result is the same using CVX"s successive approximation method (using CVX, as provided).

Also note, as can be seen in the program listing, that I used D = rand(n,1); which you included as a comment, rather than loading a mat file which I don’t have.

Here is the configuration I used:
CVX Version 2.1, Build 1123 (cff5298)
MATLAB version: 8.3 (R2014a)
OS: Windows 7 amd64 version 6.1

“My” program can produce an optimal (finite) solution, depending on the value of D.

I suggest that you try to run it a new MATLAB session, in case your old session got corrupted. And use CVX 2.1, not CVX 3.0beta.