# matlabR2020b cvx 2.2 mosek 9.1.9

The optimization variable is the matrix nu, which represents the power value. I’m sure my problem is a concave function, and there should be a maximum value, but the optimized result nu is only the first column non-zero, and the other elements are 0, which is certainly not the optimal solution.The following code is the optimization function I wrote.Thank you for your answer.
function [pBest,isfeasible,numOfLoop,Tafter,Tbefore] = functionPowerOptimization_maxSumRate(N,gamma,beta,Pmax,SINRconstraint,tau_p,Tbefore,tau_c)
L= size(beta,1);
K = size(beta,2);
dl_power=(Pmax/L)*ones(L,K);
Tafter=1e6;
%Set the accuracy of the bisection
delta = 0.01;
numOfLoop=0;
while (Tafter - Tbefore)/Tbefore > delta
if numOfLoop==0
P0=dl_power;
[feasible,nuSolution] = functionFeasibilityProblemP1(L,K,N,beta,Pmax,gamma,SINRconstraint,P0);
if feasible
isfeasible=true;
pBest = nuSolution;
else
isfeasible=false;
[pBest,~]=chooseAP_S4_one(beta,Pmax);
end
Tafter = functionComputeSumSE_DL(gamma,K,N,beta,tau_p,tau_c,pBest);
numOfLoop=numOfLoop+1;
else
P0=pBest.^numOfLoop;
[feasible,nuSolution] = functionFeasibilityProblemP1(L,K,N,beta,Pmax,gamma,SINRconstraint,P0);
if feasible
isfeasible=true;
pBest = nuSolution;
else
isfeasible=false;
[pBest,~]=chooseAP_S4_one(beta,Pmax);
end
Tbefore=Tafter;
Tafter = functionComputeSumSE_DL(gamma,K,N,beta,tau_p,tau_c,pBest);
numOfLoop=numOfLoop+1;
end
end
end

function [feasible,nuSolution] = functionFeasibilityProblemP1(L,K,N,beta,Pmax,gamma,SINRconstraint,P0)
beta=10000beta;
gamma=10000
gamma;
cvx_begin
cvx_quiet(true);
variable nu(L,K) %Power allocation
subject to
for k=1:K
daoshuUI(k)=Ksum(beta(:,k));
daoshuDS(k)=N
sqrt(P0(:,k))’*sqrt(gamma(:,k))*sum(sqrt(gamma(:,k))./(sqrt(P0(:,k))+eps));
daoshuRminus(k)=-daoshuUI(k)/((sum(P0’*beta(:,k))+10000)*log(2));
TaylorDS(k)=log(sum(nu’beta(:,k))+10000+N(sqrt(P0(:,k))’*sqrt(gamma(:,k)))^2+daoshuDS(k)*sum(sum(nu-P0)))/log(2);
TaylorRminus(k)=-log(sum(P0’*beta(:,k))+10000)/log(2)+daoshuRminus(k)sum(sum(nu-P0));
object(k)=TaylorDS(k)+TaylorRminus(k);
object(k)>=SINRconstraint;
end
for l = 1:L
sum(nu(l,:)) <= Pmax
K/L;
nu(l,:)>=0;
end
maximize sum(object)
cvx_end
if contains(cvx_status,‘Solved’) % feasible
feasible = true;
nuSolution = nu;
else
feasible = false;
nuSolution = [];
end
end

Remove cvx_quiet and please show the full log output.

I removed cvx_quiet and the solution results output from matlab command window are as follows:
CVX Warning:
Models involving “log” or other functions in the log, exp, and entropy
family are solved using an experimental successive approximation method.
This method is slower and less reliable than the method CVX employs for
other models. Please see the section of the user’s guide entitled
The successive approximation method
for more details about the approach, and for instructions on how to
suppress this warning message in the future.

## Calling Mosek 9.1.9: 150 variables, 40 equality constraints

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Platform: Windows/64-X86

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 40
Cones : 10
Scalar variables : 150
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.05
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 40
Cones : 10
Scalar variables : 150
Matrix variables : 0
Integer variables : 0

Optimizer - solved problem : the primal
Optimizer - Constraints : 20
Optimizer - Cones : 10
Optimizer - Scalar variables : 50 conic : 30
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 210 after factor : 210
Factor - dense dim. : 0 flops : 7.21e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 2.0e+03 1.3e+00 2.1e+01 0.00e+00 1.194318353e+01 -8.051020016e+00 1.0e+00 0.06
1 2.4e+02 1.6e-01 7.3e+00 -1.00e+00 -5.885993118e+00 -1.871622577e+01 1.2e-01 0.19
2 6.5e+01 4.3e-02 3.8e+00 -9.97e-01 -1.520708185e+01 -6.219727819e+00 3.3e-02 0.20
3 1.4e+01 9.2e-03 1.7e+00 -9.85e-01 -1.705977403e+01 9.581516958e+01 7.1e-03 0.20
4 1.8e+00 1.2e-03 5.2e-01 -9.23e-01 4.844153985e+01 8.059513069e+02 9.0e-04 0.20
5 3.4e-01 2.3e-04 1.2e-01 -4.33e-01 2.239735483e+02 1.283855445e+03 1.8e-04 0.22
6 1.3e-01 8.7e-05 5.2e-02 -1.09e-01 2.592598116e+02 1.585887437e+03 6.8e-05 0.22
7 4.1e-02 2.7e-05 1.4e-02 -3.62e-02 3.051388255e+02 1.269048153e+03 2.1e-05 0.23
8 2.6e-02 1.7e-05 8.3e-03 1.89e-01 3.153495322e+02 1.165887189e+03 1.4e-05 0.23
9 6.8e-03 4.5e-06 1.2e-03 3.93e-01 3.385913741e+02 5.996989399e+02 3.5e-06 0.23
10 5.8e-04 3.8e-07 2.0e-05 9.57e-01 3.484967944e+02 3.591534458e+02 3.0e-07 0.23
11 5.6e-05 3.7e-08 6.2e-07 1.01e+00 3.492155966e+02 3.502532444e+02 2.9e-08 0.25
12 1.3e-05 8.4e-09 8.5e-08 9.56e-01 3.480797825e+02 3.484680159e+02 6.5e-09 0.25
13 3.2e-06 2.1e-09 1.6e-08 7.19e-01 3.438023172e+02 3.440107791e+02 1.6e-09 0.25
14 1.2e-06 8.2e-10 5.7e-09 2.60e-01 3.388346613e+02 3.390165013e+02 6.4e-10 0.25
15 2.6e-07 1.7e-10 1.1e-09 1.67e-01 3.305643282e+02 3.307297384e+02 1.3e-10 0.27
16 5.4e-08 3.6e-11 1.5e-10 5.01e-01 3.272143286e+02 3.272822473e+02 2.8e-11 0.27
17 2.3e-09 1.5e-12 1.1e-12 8.47e-01 3.261947060e+02 3.261967796e+02 1.2e-12 0.27
18 1.1e-10 7.0e-14 1.1e-14 9.98e-01 3.261393757e+02 3.261394727e+02 5.4e-14 0.27
19 1.2e-11 7.8e-15 4.2e-16 1.00e+00 3.261375759e+02 3.261375867e+02 6.1e-15 0.28
20 9.9e-13 6.7e-16 1.0e-17 1.00e+00 3.261373915e+02 3.261373925e+02 5.2e-16 0.28
Optimizer terminated. Time: 0.36

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: 3.2613739154e+02 nrm: 4e+07 Viol. con: 1e-03 var: 0e+00 cones: 0e+00
Dual. obj: 3.2613739247e+02 nrm: 2e+01 Viol. con: 0e+00 var: 6e-12 cones: 0e+00
Optimizer summary
Optimizer - time: 0.36
Interior-point - iterations : 20 time: 0.28
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Solved
Optimal value (cvx_optval): +36.8911

The above information shows that the problem has been solved, but the optimized power allocation value is only the first column non-zero, and the other elements are zero. This allocation is obviously not optimal because the sum rate obtained by the average power allocation scheme is larger than that calculated by using the optimized power allocation value.My question is concave. Why do I get such a result？

Have toy explicitly formed this supposed better solution, and shown the objective value is better, and that it satisfies all constraints?

Through the above optimization process, the power allocation values of the first column are non-zero and the other elements are zero. Using these power allocation values to calculate sumrate, it is found that the sumrate is smaller than that obtained during equal power allocation. My objective function is to maximize the sumrate. Now it seems that the solution is not good. Why is it still shows “Status: Solved”?

Please show us an explicit solution which you explicitly show satisfies all constraints and has a larger (by more than solver tolerance) objective value than that produced by CVX/Mosek.

Maybe you need to declare expression arrays (expression holders) http://cvxr.com/cvx/doc/basics.html#assignment-and-expression-holders for `TaylorDS. TaylorRminus, object.` Perhaps that is causing those expressions to not be set correctly, thereby not implementing the model you intended?

I’m not sure whether it is possible, in the absence of expression declarations, for no CVX error messages to be generated, yet the expressions not be set correctly. I recommend you make the declarations and see whether it makes a difference.

Thank you for your suggestion. I have added expression holder variables according to the rules in the link. The power optimization result is still that only the elements in the first column are non-zero, and the other elements are zero. The following are my code:
function [pBest,isfeasible,numOfLoop,Tafter,Tbefore] = functionPowerOptimization_maxSumRate(N,gamma,beta,Pmax,tau_p,Tbefore,tau_c)
L= size(beta,1);
K = size(beta,2);
dl_power=(Pmax/L)*ones(L,K);
Tafter=1e6;
%Set the accuracy of the bisection
delta = 0.00001;
numOfLoop=0;
while (Tafter - Tbefore)/Tbefore > delta
if numOfLoop==0
P0=dl_power;
[feasible,nuSolution] = functionFeasibilityProblemP1(L,K,N,beta,Pmax,gamma,P0);
if feasible
isfeasible=true;
pBest = nuSolution;
else
isfeasible=false;
[pBest,~]=chooseAP_S4_one(beta,Pmax);
end
Tafter = functionComputeSumSE_DL(gamma,K,N,beta,tau_p,tau_c,pBest);
numOfLoop=numOfLoop+1;
else
P0=dl_power;
[feasible,nuSolution] = functionFeasibilityProblemP1(L,K,N,beta,Pmax,gamma,P0);
if feasible
isfeasible=true;
pBest = nuSolution;
else
isfeasible=false;
[pBest,~]=chooseAP_S4_one(beta,Pmax);
end
Tbefore=Tafter;
Tafter = functionComputeSumSE_DL(gamma,K,N,beta,tau_p,tau_c,pBest);
numOfLoop=numOfLoop+1;
end
end
end

function [feasible,nuSolution] = functionFeasibilityProblemP1(L,K,N,beta,Pmax,gamma,P0)
% Pmax = 200;
for k=1:K
daoshuUI(k)=Ksum(beta(:,k));
daoshuDS(k)=N
sqrt(P0(:,k))’*sqrt(gamma(:,k))*sum(sqrt(gamma(:,k))./(sqrt(P0(:,k))+eps));
daoshuRminus(k)=-daoshuUI(k)/((sum(P0’*beta(:,k))+1)*log(2));
end
cvx_begin sdp
variable nu(L,K) %Power allocation
expressions TaylorDS(K,1) TaylorRminus(K,1) object(K,1)
for k=1:K TaylorDS(k)=log(sum(nu’beta(:,k))+1+N(sqrt(P0(:,k))’*sqrt(gamma(:,k)))^2+daoshuDS(k)*sum(sum(nu-P0)))/log(2);
TaylorRminus(k)=-log(sum(P0’*beta(:,k))+1)/log(2)+daoshuRminus(k)sum(sum(nu-P0));
object(k)=TaylorDS(k)+TaylorRminus(k);
end
maximize sum(object)
subject to
for l = 1:L
sum(nu(l,:)) <= Pmax
K/L;
nu(l,:)>=0;
end
cvx_end
if contains(cvx_status,‘Solved’) % feasible
feasible = true;
nuSolution = nu;
else
feasible = false;
nuSolution = [];
end
end
The following is the optimization output.
CVX Warning:
Models involving “log” or other functions in the log, exp, and entropy
family are solved using an experimental successive approximation method.
This method is slower and less reliable than the method CVX employs for
other models. Please see the section of the user’s guide entitled
The successive approximation method
for more details about the approach, and for instructions on how to
suppress this warning message in the future.

## Calling Mosek 9.1.9: 140 variables, 30 equality constraints

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Platform: Windows/64-X86

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 30
Cones : 10
Scalar variables : 140
Matrix variables : 0
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.03
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 30
Cones : 10
Scalar variables : 140
Matrix variables : 0
Integer variables : 0

Optimizer - solved problem : the primal
Optimizer - Constraints : 10
Optimizer - Cones : 10
Optimizer - Scalar variables : 40 conic : 30
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 55 after factor : 55
Factor - dense dim. : 0 flops : 1.53e+03
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.8e+03 1.3e+00 2.1e+01 0.00e+00 1.194318353e+01 -8.051020016e+00 1.0e+00 0.08
1 1.8e+02 1.3e-01 6.5e+00 -9.90e-01 1.482572519e+02 1.375600292e+02 1.0e-01 0.22
2 5.0e+01 3.7e-02 2.9e+00 -8.64e-01 4.053756770e+02 4.130095697e+02 2.9e-02 0.22
3 1.5e+01 1.1e-02 5.0e-01 1.12e-01 2.875951316e+02 2.887811397e+02 8.8e-03 0.23
4 1.1e+00 8.1e-04 1.4e-02 5.09e-01 3.563578425e+02 3.569383519e+02 6.3e-04 0.23
5 1.4e-01 1.1e-04 7.0e-04 9.21e-01 3.574532772e+02 3.575444665e+02 8.2e-05 0.25
6 1.0e-02 7.5e-06 1.3e-05 9.88e-01 3.575265299e+02 3.575330245e+02 5.8e-06 0.25
7 3.3e-04 2.4e-07 7.7e-08 9.99e-01 3.575415321e+02 3.575417413e+02 1.9e-07 0.25
8 3.4e-05 2.5e-08 2.6e-09 1.00e+00 3.575428754e+02 3.575428969e+02 1.9e-08 0.27
9 1.5e-06 1.1e-09 2.3e-11 1.00e+00 3.575430572e+02 3.575430582e+02 8.4e-10 0.27
10 8.4e-08 6.2e-11 3.1e-13 1.00e+00 3.575430664e+02 3.575430665e+02 4.8e-11 0.27
11 4.8e-09 3.4e-12 4.1e-15 1.00e+00 3.575430670e+02 3.575430670e+02 2.6e-12 0.28
12 3.7e-10 2.6e-13 8.5e-17 1.00e+00 3.575430670e+02 3.575430670e+02 2.0e-13 0.28
13 3.7e-10 2.6e-13 8.5e-17 1.00e+00 3.575430670e+02 3.575430670e+02 2.0e-13 0.30
14 3.7e-10 2.6e-13 8.5e-17 1.00e+00 3.575430670e+02 3.575430670e+02 2.0e-13 0.30
Optimizer terminated. Time: 0.34

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: 3.5754306701e+02 nrm: 3e+03 Viol. con: 3e-08 var: 0e+00 cones: 9e-11
Dual. obj: 3.5754306701e+02 nrm: 3e+00 Viol. con: 0e+00 var: 3e-12 cones: 0e+00
Optimizer summary
Optimizer - time: 0.34
Interior-point - iterations : 15 time: 0.30
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Solved
Optimal value (cvx_optval): +33.2967

The optimization variable nu is a 10 * 10 matrix, and the sum of elements in each row of nu is required to be less than 200. After optimization, the value of nu is:
nu =

** (1,1) 200.0000**
** (2,1) 200.0000**
** (3,1) 200.0000**
** (4,1) 200.0000**
** (5,1) 200.0000**
** (6,1) 200.0000**
** (7,1) 200.0000**
** (8,1) 200.0000**
** (9,1) 200.0000**
** (10,1) 200.0000**
But this nu does not maximize the sumrate.

1 Like

If you provide fully reproducible code, not requiring any external toolboxes, with complete input data, as well as the solution you think is more optimal then I will try to investigate it carefully. If you cannot post all these things here then do it on https://groups.google.com/g/mosek