How to write this objective function?

Sorry,I trouble you again.The value of vector D is
[0.473598356769857
0.738710312208351
0.0337572264048661
0.212903680967566
0.612722033876240],
I also used CVX 2.1,MATLAB R2017a, Windows 10, please show your program with using exponential.m, thanks a lot !

Solution depends on the random draw for Pmax. For this D, I did multiple draws, and the problem was solved in most cases with optimal solution (mostly having cvx_optval about 26.2) using all 4 combinations of Pade approximation (CVXQUAD’s exponential.m) or CVX’s successive approximation method; and sdpt3 vs. sedumi, with all cvx_optval values agreeing to 3 decimal places. For this D, it is possible to get a random draw for Pmax in which the problem will be declared infeasible. All done under CVX 2.1.

Here is one result (reproducible by assigning the displayed value of Pmax rather than randomly drawing it).:

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=[0.473598356769857
0.738710312208351
0.0337572264048661
0.212903680967566
0.612722033876240];
    % 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];
  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_solver sdpt3
        cvx_end
=====================================
Using Pade approximation for exponential
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.259683e+03  0.000000e+00| 0:0:00| chol  1  1 
 1|1.000|0.748|1.8e-05|2.1e+00|1.0e+04| 2.071312e+03 -3.696166e+01| 0:0:00| chol  1  1 
 2|0.754|0.831|3.7e-06|3.7e-01|2.9e+03| 1.321413e+03 -5.004315e+01| 0:0:00| chol  1  1 
 3|0.952|0.797|1.6e-06|7.5e-02|7.5e+02| 4.060430e+02 -2.487668e+01| 0:0:00| chol  1  1 
 4|1.000|0.681|7.8e-07|2.4e-02|2.5e+02| 1.066219e+02 -1.954550e+01| 0:0:00| chol  1  1 
 5|0.961|0.723|2.6e-07|6.7e-03|8.2e+01| 2.146503e+01 -1.788257e+01| 0:0:00| chol  1  1 
 6|0.541|0.415|2.8e-07|3.9e-03|6.0e+01| 1.016192e+01 -1.834024e+01| 0:0:00| chol  1  1 
 7|0.361|0.313|2.5e-07|2.7e-03|5.3e+01| 6.160631e+00 -1.861821e+01| 0:0:00| chol  1  1 
 8|0.148|0.239|2.4e-07|2.0e-03|4.8e+01| 4.706852e+00 -1.900411e+01| 0:0:00| chol  1  1 
 9|0.124|0.320|2.2e-07|1.4e-03|4.2e+01| 3.606916e+00 -1.950688e+01| 0:0:00| chol  1  1 
10|0.137|0.440|1.9e-07|7.8e-04|3.5e+01| 1.948908e+00 -2.007745e+01| 0:0:00| chol  1  1 
11|0.108|0.198|1.7e-07|6.2e-04|3.3e+01| 1.596540e-01 -2.055558e+01| 0:0:00| chol  1  1 
12|0.063|0.162|1.6e-07|5.2e-04|3.2e+01|-8.537682e-01 -2.110211e+01| 0:0:00| chol  1  1 
13|0.070|0.179|1.5e-07|4.3e-04|3.0e+01|-1.929694e+00 -2.168377e+01| 0:0:00| chol  1  1 
14|0.071|0.183|1.4e-07|3.5e-04|2.9e+01|-3.013212e+00 -2.227795e+01| 0:0:00| chol  1  1 
15|0.067|0.161|1.3e-07|2.9e-04|2.8e+01|-4.002982e+00 -2.284811e+01| 0:0:00| chol  1  1 
16|0.060|0.141|1.2e-07|2.5e-04|2.8e+01|-4.842470e+00 -2.338704e+01| 0:0:00| chol  1  1 
17|0.056|0.124|1.1e-07|2.2e-04|2.7e+01|-5.564484e+00 -2.388098e+01| 0:0:00| chol  1  1 
18|0.051|0.113|1.1e-07|2.0e-04|2.7e+01|-6.173871e+00 -2.433457e+01| 0:0:00| chol  1  1 
19|0.048|0.103|1.0e-07|1.8e-04|2.6e+01|-6.700057e+00 -2.474313e+01| 0:0:00| chol  1  1 
20|0.044|0.095|9.8e-08|1.6e-04|2.6e+01|-7.149742e+00 -2.511374e+01| 0:0:01| chol  1  1 
21|0.042|0.089|9.4e-08|1.5e-04|2.5e+01|-7.544142e+00 -2.544747e+01| 0:0:01| chol  1  1 
22|0.039|0.085|9.0e-08|1.3e-04|2.5e+01|-7.892904e+00 -2.575235e+01| 0:0:01| chol  1  1 
23|0.038|0.085|8.6e-08|1.2e-04|2.5e+01|-8.214348e+00 -2.603322e+01| 0:0:01| chol  1  1 
24|0.037|0.089|8.3e-08|1.1e-04|2.4e+01|-8.524785e+00 -2.629897e+01| 0:0:01| chol  1  1 
25|0.040|0.106|8.0e-08|9.9e-05|2.4e+01|-8.858035e+00 -2.656059e+01| 0:0:01| chol  1  1 
26|0.051|0.166|7.6e-08|8.3e-05|2.3e+01|-9.322388e+00 -2.682401e+01| 0:0:01| chol  1  1 
27|0.871|0.852|9.7e-09|1.2e-05|5.7e+00|-2.189284e+01 -2.647725e+01| 0:0:01| chol  1  1 
28|0.596|0.239|1.2e-08|9.4e-06|4.2e+00|-2.355569e+01 -2.652032e+01| 0:0:01| chol  1  1 
29|1.000|0.760|4.9e-08|2.3e-06|1.9e+00|-2.492609e+01 -2.644109e+01| 0:0:01| chol  1  1 
30|0.801|0.994|1.3e-08|1.7e-08|3.9e-01|-2.597144e+01 -2.636359e+01| 0:0:01| chol  1  1 
31|0.055|0.098|1.3e-08|1.8e-08|3.6e-01|-2.593924e+01 -2.630030e+01| 0:0:01| chol  1  1 
32|0.130|1.000|1.1e-08|2.5e-09|3.2e-01|-2.594784e+01 -2.627074e+01| 0:0:01| chol  1  1 
33|1.000|1.000|1.0e-09|2.2e-09|1.8e-01|-2.608473e+01 -2.625968e+01| 0:0:01| chol  1  1 
34|1.000|1.000|5.5e-10|2.1e-10|2.6e-02|-2.617887e+01 -2.620515e+01| 0:0:01| chol  2  1 
35|0.975|1.000|1.3e-09|1.1e-10|1.9e-03|-2.619419e+01 -2.619609e+01| 0:0:01| chol  1  1 
36|0.956|0.980|1.3e-09|1.1e-10|8.1e-05|-2.619525e+01 -2.619532e+01| 0:0:01| chol  1  1 
37|0.973|1.000|7.0e-10|2.3e-11|1.7e-05|-2.619529e+01 -2.619531e+01| 0:0:01| chol  1  1 
38|0.992|0.994|8.5e-10|9.8e-13|6.2e-07|-2.619530e+01 -2.619530e+01| 0:0:01|
  stop: max(relative gap, infeasibilities) < 1.49e-08
-------------------------------------------------------------------
 number of iterations   = 38
 primal objective value = -2.61952995e+01
 dual   objective value = -2.61953000e+01
 gap := trace(XZ)       = 6.18e-07
 relative gap           = 1.16e-08
 actual relative gap    = 1.05e-08
 rel. primal infeas (scaled problem)   = 8.54e-10
 rel. dual     "        "       "      = 9.81e-13
 rel. primal infeas (unscaled problem) = 0.00e+00
 rel. dual     "        "       "      = 0.00e+00
 norm(X), norm(y), norm(Z) = 7.8e+03, 3.0e+01, 2.9e+01
 norm(A), norm(b), norm(C) = 2.1e+01, 3.2e+00, 2.5e+01
 Total CPU time (secs)  = 0.99  
 CPU time per iteration = 0.03  
 termination code       =  0
 DIMACS: 1.4e-09  0.0e+00  3.3e-12  0.0e+00  1.0e-08  1.2e-08
-------------------------------------------------------------------
 
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +26.1953
 
>> disp(P)
    3.0000
    2.8605
    2.5829
    1.5466
    5.8034
>>disp(Pmax)
     3
     8
     4
     7
     8

Here is the solution for your Pmax and D. Note that to use Pade approximation, you have to install CVXQUAD, then replace the exponential.m in the CVX sets directory with the CVXQUAD version. But you should be able to solve this without CVXQUAD.

=====================================
Using Pade approximation for exponential
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.2e+00|4.6e+04| 2.327458e+03  0.000000e+00| 0:0:00| chol  1  1 
 1|1.000|0.740|1.8e-05|2.2e+00|1.1e+04| 2.157126e+03 -3.708764e+01| 0:0:00| chol  1  1 
 2|0.760|0.832|3.6e-06|3.7e-01|3.0e+03| 1.368868e+03 -5.123969e+01| 0:0:00| chol  1  1 
 3|0.975|0.807|1.6e-06|7.3e-02|7.1e+02| 3.784920e+02 -2.425660e+01| 0:0:00| chol  1  1 
 4|1.000|0.705|8.8e-07|2.1e-02|2.4e+02| 1.059229e+02 -1.913644e+01| 0:0:00| chol  1  1 
 5|0.934|0.690|3.3e-07|6.7e-03|8.8e+01| 2.570051e+01 -1.800547e+01| 0:0:00| chol  1  1 
 6|0.541|0.407|3.2e-07|4.0e-03|6.6e+01| 1.304069e+01 -1.846663e+01| 0:0:00| chol  1  1 
 7|0.356|0.330|2.9e-07|2.7e-03|5.7e+01| 8.683296e+00 -1.877049e+01| 0:0:00| chol  1  1 
 8|0.155|0.251|2.7e-07|2.0e-03|5.1e+01| 6.990550e+00 -1.917362e+01| 0:0:00| chol  1  1 
 9|0.128|0.347|2.5e-07|1.3e-03|4.4e+01| 5.695365e+00 -1.970061e+01| 0:0:00| chol  1  1 
10|0.138|0.373|2.1e-07|8.1e-04|3.8e+01| 3.808163e+00 -2.023707e+01| 0:0:00| chol  1  1 
11|0.100|0.225|1.9e-07|6.3e-04|3.6e+01| 2.137372e+00 -2.074730e+01| 0:0:00| chol  1  1 
12|0.072|0.190|1.8e-07|5.1e-04|3.4e+01| 9.487250e-01 -2.130636e+01| 0:0:00| chol  1  1 
13|0.072|0.183|1.7e-07|4.2e-04|3.3e+01|-2.295574e-01 -2.187792e+01| 0:0:00| chol  1  1 
14|0.067|0.171|1.5e-07|3.5e-04|3.1e+01|-1.311302e+00 -2.245079e+01| 0:0:00| chol  1  1 
15|0.063|0.150|1.4e-07|2.9e-04|3.1e+01|-2.283286e+00 -2.299530e+01| 0:0:00| chol  1  1 
16|0.057|0.134|1.4e-07|2.5e-04|3.0e+01|-3.109281e+00 -2.351220e+01| 0:0:00| chol  1  1 
17|0.054|0.120|1.3e-07|2.2e-04|2.9e+01|-3.831100e+00 -2.398741e+01| 0:0:00| chol  1  1 
18|0.049|0.110|1.2e-07|2.0e-04|2.9e+01|-4.446034e+00 -2.442680e+01| 0:0:00| chol  1  1 
19|0.046|0.101|1.2e-07|1.8e-04|2.8e+01|-4.983856e+00 -2.482487e+01| 0:0:01| chol  1  1 
20|0.043|0.094|1.1e-07|1.6e-04|2.8e+01|-5.448624e+00 -2.518888e+01| 0:0:01| chol  1  1 
21|0.041|0.089|1.1e-07|1.5e-04|2.8e+01|-5.862181e+00 -2.551963e+01| 0:0:01| chol  1  1 
22|0.039|0.086|1.0e-07|1.4e-04|2.7e+01|-6.234201e+00 -2.582485e+01| 0:0:01| chol  1  1 
23|0.038|0.087|9.9e-08|1.2e-04|2.7e+01|-6.584601e+00 -2.610936e+01| 0:0:01| chol  1  1 
24|0.038|0.095|9.5e-08|1.1e-04|2.6e+01|-6.934056e+00 -2.638227e+01| 0:0:01| chol  1  1 
25|0.042|0.120|9.1e-08|9.9e-05|2.6e+01|-7.331846e+00 -2.665726e+01| 0:0:01| chol  1  1 
26|0.062|0.172|8.6e-08|8.2e-05|2.4e+01|-7.998318e+00 -2.685476e+01| 0:0:01| chol  1  1 
27|0.909|0.898|7.8e-09|8.4e-06|3.6e+00|-2.350462e+01 -2.643345e+01| 0:0:01| chol  1  1 
28|0.988|0.287|1.4e-08|6.0e-06|2.1e+00|-2.511998e+01 -2.645514e+01| 0:0:01| chol  1  1 
29|1.000|0.876|1.2e-07|7.4e-07|8.1e-01|-2.565157e+01 -2.639252e+01| 0:0:01| chol  1  1 
30|0.964|1.000|2.9e-09|3.5e-09|4.1e-01|-2.594903e+01 -2.636158e+01| 0:0:01| chol  1  1 
31|0.389|0.371|2.6e-09|2.8e-09|3.7e-01|-2.585854e+01 -2.623239e+01| 0:0:01| chol  1  2 
32|0.907|1.000|3.1e-10|5.2e-10|8.0e-02|-2.611913e+01 -2.619899e+01| 0:0:01| chol  2  2 
33|1.000|1.000|3.8e-10|6.2e-11|2.4e-02|-2.616038e+01 -2.618388e+01| 0:0:01| chol  2  2 
34|0.971|0.956|2.9e-10|7.9e-11|9.3e-04|-2.617237e+01 -2.617330e+01| 0:0:01| chol  2  2 
35|0.985|0.978|4.4e-10|2.8e-11|2.0e-05|-2.617276e+01 -2.617278e+01| 0:0:01| chol  2  1 
36|0.989|0.993|2.9e-10|1.1e-12|6.7e-07|-2.617277e+01 -2.617277e+01| 0:0:01|
  stop: max(relative gap, infeasibilities) < 1.49e-08
-------------------------------------------------------------------
 number of iterations   = 36
 primal objective value = -2.61727685e+01
 dual   objective value = -2.61727691e+01
 gap := trace(XZ)       = 6.69e-07
 relative gap           = 1.25e-08
 actual relative gap    = 1.12e-08
 rel. primal infeas (scaled problem)   = 2.92e-10
 rel. dual     "        "       "      = 1.09e-12
 rel. primal infeas (unscaled problem) = 0.00e+00
 rel. dual     "        "       "      = 0.00e+00
 norm(X), norm(y), norm(Z) = 7.8e+03, 3.2e+01, 2.9e+01
 norm(A), norm(b), norm(C) = 2.1e+01, 3.2e+00, 2.6e+01
 Total CPU time (secs)  = 0.90  
 CPU time per iteration = 0.02  
 termination code       =  0
 DIMACS: 4.7e-10  0.0e+00  3.8e-12  0.0e+00  1.1e-08  1.3e-08
-------------------------------------------------------------------
 
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +26.1728
 
>> disp(Pmax)
    10
    19
    15
    14
    13
>> disp(P)
    6.7203
    6.4086
    5.7858
    3.4645
   13.0000

Try copy and pasting my code into a fresh MATLAB session, in case something got corrupted in your MATLAB session. To avoid confusion, it might be best for you to not use CVXQUAD. After you ,make any configuration change, start the fresh session of MATLAB.

I have set up it according to your suggestion,but the program have not implemented, the errors are similar to above. Could you capture the screen with your implemented steps ? Thanks a lot !

1 Like

At this point, I don’t know what the resolution is. I already provided my code and output above.

Are you able to run anything in gp mode? For instance,

cvx_begin gp
    variables w h d
    maximize( w * h * d )
    subject to
        2*(h*w+h*d) <= 3;
        w*d <= 4;
        1 <= h/w <= 2;
        1 <= d/w <= 2;
cvx_end

If I don’t use your provided objective function, the program run without problem. The arguments is the objection function.

Please show the output from executing the command cvx_version .

Please execute cvx_version from the MATLAB command line, and provide the output.

You earlier wrote you were using CVX 2.1 Use that, not CVX 3.0beta.

I am very sorry, I make a mistake.

Open a new MATLAB session. Remove all CVX 3.0beta directories from the MATLAB path. Remove all cvxquad directories from your MATLAB path. Do a fresh unzip of CVX 2.1 Build 1123. Do cvx_setup. Test it with the short gp program above. if that works, then copy and paste my code and run it.

When I run the instance:
cvx_begin gp
variables w h d
maximize( w * h * d )
subject to
2*(hw+hd) <= 3;
w*d <= 4;
1 <= h/w <= 2;
1 <= d/w <= 2;
cvx_end

The errors as follows:
Warning: A non-empty cvx problem already exists in this scope.
It is being overwritten.

In cvxprob (line 28)
In cvx_begin (line 41)
In Untitled1111 (line 3)
=====================================
Using Pade approximation for exponential
cone with parameters m=3, k=3
=====================================
undefined ‘op_rel_entr_epi_cone’。

error exponential (line 46)
op_rel_entr_epi_cone([1 1 sx],0,m,k);

error cvx/log_sum_exp (line 97)
{ cvx_accept_convex( x ) - cvx_expand_dim( z, dim, nx ), 1, w } == exponential( sx ); %#ok

error cvx/log (line 111)
vx = log_sum_exp( vx );

error cvxprob/newcnstr (line 197)
x = log( x );

error <= (line 21)
b = newcnstr( evalin( ‘caller’, ‘cvx_problem’, ‘’ ), x, y, ‘<=’ );

error Untitled1111 (line 7)
2*(hw+hd) <= 3;

You obviously didn’t follow my instructions above. Whatever configuration you have now is a mess. That’s why I provided the instructions, hopefully resulting in a clean installation of CVX 2.1 Build 1123, without CVXQUAD, and which works correctly.

cvx_version


CVX: Software for Disciplined Convex Programming (c)2014 CVX Research
Version 2.1, Build 1123 (cff5298) Sun Dec 17 18:58:10 2017

Installation info:
Path: E:\Program Files\MATLAB\cvx
MATLAB version: 9.2 (R2017a)
OS: Windows 8 amd64 version 6.2
Java version: 1.7.0_60
Verfying CVX directory contents:
No missing files.
Preferences:
Path: C:\Users\dbjia\AppData\Roaming\MathWorks\MATLAB\cvx_prefs.mat

Now try running something.

The program have be run successfully in my Pc, thanks for your kind and patience !
Successive approximation method to be employed.
For improved efficiency, SDPT3 is solving the dual problem.
SDPT3 will be called several times to refine the solution.
Original size: 120 variables, 45 equality constraints
25 exponentials add 200 variables, 125 equality constraints

Cones | Errors |
Mov/Act | Centering Exp cone Poly cone | Status
--------±--------------------------------±--------
25/ 25 | 8.000e+00 6.653e+00 0.000e+00 | Unbounded
25/ 25 | 3.620e+00 5.274e-01 0.000e+00 | Unbounded
25/ 25 | 4.276e-01 1.149e-02 0.000e+00 | Solved
25/ 25 | 5.180e-02 1.704e-04 0.000e+00 | Solved
25/ 25 | 7.006e-03 2.896e-06 0.000e+00 | Solved
0/ 20 | 2.812e-04 4.623e-09 0.000e+00 | Solved

Status: Solved
Optimal value (cvx_optval): +26.1733

Hello, may I ask what GP mode means? It means to build a.m file in Matlab directly, and then input the following code into it, and then run it?