How to debug in CVX?

During the simulation, what should I do if I wanna watch the value of CVX variables? Right, I got a problem. The value of some CVX variables is NaN. Fortunately, this problem can be solved by CVX, so I wonder if the initial value is right.

Look at cvx_status. NaN variable values could happen due to the problem being infeasible or due to some error.

Thanks, I have another question.
Although the problem solved, the CVX will throw the NaN value when the variables are large, right?
And I use cvx_solver to change the solver, the wrong message “The global CVX solver selection cannot be changed while a model is being constructed.” appears, so I have to reopen the Matlab again and again. Could you have a better solution? Thanks again!

Variables being “large” does not necessarily result in NaN.

However, large variables might contribute either to a solver determination, whether correct or not, that the problem is infeasible, or might cause the solver to fail. In such cases, NaN would result. You should try to scale such that non-zero coefficients in your model are within a small number of orders of masgntiude of one.

As for the cvx solver error, please read http://cvxr.com/cvx/doc/solver.html#selecting-a-solver . If that doesn’t resolve your difficulty, show us the exact sequence of commands and error message.

If you show us a reproducible problem, with all solver and CVX output, and preferably with input data, perhaps forum readers can provide more specific guidance.

Right, I have organized the files to show you.
First, I will briefly introduce my work. There are M Sensors are separated into K clusters. A single drone hovers over the optimal location of every cluster to receive the sensors’ data inside this cluster. I wanna minimize the total communication time by jointly optimizing the drone’s trajectory q and beamform width \Phi.
Secondly, I will show you the formulation.

T=\sum_i^M \frac{\zeta}{log_2\left(1+\eta f(q,\Phi)\right)}

where \zeta and \eta are constant, their values are approximate 10^{-3} and 10^{-9}, and f(q,\Phi)=\frac{10^{\frac{G_0}{10\Phi^2}}}{(||q-z_i||+H)^2} which is too difficult to solve due to its non-convexity. So I reformed f(q,\Phi) based on the first-order Taylor expansion to it becomes affine, like this

tf=\frac{{{{10}^{\frac{{{G_0}}}{{10{\kern 1pt} {\Phi _0}^2}}}}}}{{{{\left( {||{q_0} - z_i|| + H} \right)}^2}}}{\mkern 1mu} - \frac{{{\mkern 1mu} \ln \left( {10} \right){G_0}{{10}^{\frac{{{G_0}}}{{10{\kern 1pt} {\Phi _0}^2}}}}{\mkern 1mu} }}{{5{\mkern 1mu} {\Phi _0}^3{{\left( {||{q_0} -z_i|| + H} \right)}^2}}}\left( {\Phi - {\Phi _0}} \right) - \frac{{\alpha {\mkern 1mu} {{10}^{\frac{{{G_0}}}{{10{\kern 1pt} {\Phi _0}^2}}}}\left( {{q_0} - z} \right)}}{{||{q_0} - z_i||{\mkern 1mu} {{\left( {||{q_0} - z_i|| + H} \right)}^3}}}\left( {q - {q_0}} \right)

Then the T namely the objective function has been convex.
And the whole problem is expressed as

\begin{array}{ll} \text{minimize}&{T}\\ \text{subject to}&{\gamma_{th}-\eta tf\leq0}\\ {}&{0\leq \Phi\leq \frac{\pi}{2}}\\ {}&{0\leq q\leq 500}\\ {}&{||q-z_i||\leq rad_k} \end{array}

where \gamma_{th} is the threshold of SNR, which is 3\times 10^{4} and rad_{k} is the radius of cluster-k that is approximate 200.
Then, I will show you my code

zeta=identM(:,k).*wSM.*datSA*NkA(k)/(B*prNA(k)); % constant size:M*1
eta=db2pow(PS-N0-pow2db(B/NkA(k)))*beta0; % constant size:1*1
q0=coorU(k,:); % the initial value of q
Phi0=1; % the initial value of Phi
for l=1:1:L % the iteration number of successive approximate convex, L=20
    cvx_begin
    cvx_solver mosek
    cvx_solver_settings('MSK_DPAR_DATA_TOL_AIJ_HUGE',1.0e50);
    variable q(1,2)
    variable Phi(1)
    expression g(M,1)
    for i=1:1:M
        vecTemp=q0-coorS(i,:);
        constantTerm=db2pow(G0/Phi0^2)./(vecnorm(vecTemp,2,2)+H)^2;
        coefficientPhi=-1*(log(10)*G0*db2pow(G0/Phi0^2)/(5*Phi0^3*vecnorm(vecTemp,2,2)+H)^2));
        if isequal(sum(vecTemp),0)
            coefficientqQ=-1*2*db2pow(G0/Phi0^2)/((vecnorm(vecTemp,2,2)+H)^3);
            vecTemp=[1 1];
        else
            coefficientqQ=-1*2*db2pow(G0/Phi0^2)/(vecnorm(vecTemp,2,2)*vecnorm(vecTemp,2,2)+H)^3);
        end    
        g(i)=constantTerm+coefficientPhi*(Phi-Phi0)+coefficientqQ*(vecTemp*(q-q0)');
    end
    minimize(sum(zeta.*inv_pos(log(1+eta.*g)/log(2)),1));
    subject to
    snrTh-eta.*g<=0;
    0<=Phi<=PhiMax;
    0<=q<=500;
    for i=1:1:M
        vecTemp=q0-coorS(i,:);
        identM(i,k)*norm(vecTemp)-radA(k)<=0;
    end
    cvx_end

Then, the bad consequence comes, I will show you the log

Calling Mosek 9.1.9: 202 variables, 59 equality constraints
   For improved efficiency, Mosek is solving the dual problem.
------------------------------------------------------------
NOTE: custom settings have been set for this solver.
------------------------------------------------------------

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 59              
  Cones                  : 56              
  Scalar variables       : 202             
  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 started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries                  : 2                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.02            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.05    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 59              
  Cones                  : 56              
  Scalar variables       : 202             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 31
Optimizer  - Cones                  : 56
Optimizer  - Scalar variables       : 202               conic                  : 168             
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 : 118               after factor           : 118             
Factor     - dense dim.             : 0                 flops                  : 2.66e+03        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   1.1e+01  8.2e+06  6.1e+06  0.00e+00   6.090708409e+06   -3.979685247e+01  1.0e+00  0.08  
1   4.3e+00  3.2e+06  3.8e+06  -1.00e+00  6.090642032e+06   -1.010662256e+02  3.9e-01  0.28  
2   2.0e+00  1.5e+06  2.6e+06  -1.00e+00  6.090501741e+06   -2.202013425e+02  1.8e-01  0.30  
3   6.7e-01  5.0e+05  1.5e+06  -1.00e+00  6.089986162e+06   -6.459841070e+02  6.2e-02  0.30  
4   9.7e-02  7.3e+04  5.7e+05  -1.00e+00  6.085192399e+06   -4.479702544e+03  8.9e-03  0.30  
5   7.8e-03  5.9e+03  1.6e+05  -1.00e+00  6.020991299e+06   -5.534996610e+04  7.1e-04  0.31  
6   1.1e-03  8.0e+02  6.0e+04  -9.96e-01  5.604321308e+06   -3.814272785e+05  9.8e-05  0.31  
7   1.5e-04  1.2e+02  2.1e+04  -9.68e-01  3.564014706e+06   -1.850792616e+06  1.4e-05  0.33  
8   5.5e-05  4.1e+01  1.0e+04  -7.64e-01  2.687067766e+06   -1.576947051e+06  5.0e-06  0.33  
9   2.4e-05  1.8e+01  3.0e+03  -5.38e-02  2.011563199e+06   -1.408601936e+05  2.2e-06  0.33  
10  1.7e-06  1.3e+00  8.8e+01  4.51e-01   1.837966686e+05   -1.809699554e+04  1.6e-07  0.34  
11  1.8e-09  1.4e-03  2.9e-03  9.64e-01   9.405395431e+01   -1.199545732e+02  1.7e-10  0.34  
12  1.6e-10  1.2e-04  7.5e-05  1.00e+00   1.538205820e+00   -1.721869845e+01  1.5e-11  0.34  
13  3.5e-11  2.7e-05  7.8e-06  9.98e-01   -4.375114490e+00  -8.538595480e+00  3.2e-12  0.36  
14  6.9e-12  5.2e-06  6.8e-07  9.94e-01   -4.867588878e+00  -5.682839253e+00  6.3e-13  0.36  
15  3.0e-12  2.2e-06  2.0e-07  9.44e-01   -4.837457404e+00  -5.202345518e+00  2.7e-13  0.38  
16  1.2e-12  9.0e-07  6.4e-08  7.65e-01   -4.721510027e+00  -4.899928973e+00  1.1e-13  0.38  
17  2.8e-13  4.2e-07  9.6e-09  7.04e-01   -4.600598743e+00  -4.651950846e+00  2.6e-14  0.38  
18  8.9e-14  6.6e-07  1.7e-09  9.02e-01   -4.564540724e+00  -4.581257028e+00  8.2e-15  0.39  
19  2.4e-14  7.5e-07  2.4e-10  9.64e-01   -4.553895296e+00  -4.558493122e+00  2.2e-15  0.39  
20  3.4e-15  6.4e-07  1.2e-11  9.94e-01   -4.551220247e+00  -4.551857997e+00  3.1e-16  0.41  
21  3.7e-16  6.9e-07  4.4e-13  9.99e-01   -4.550799882e+00  -4.550869246e+00  3.3e-17  0.41  
22  2.9e-17  5.8e-07  2.9e-15  1.00e+00   -4.550750861e+00  -4.550753292e+00  1.2e-18  0.41  
23  2.8e-16  6.4e-07  1.8e-18  1.00e+00   -4.550749115e+00  -4.550749133e+00  8.7e-21  0.42  
Optimizer terminated. Time: 0.50    


Interior-point solution summary
  Problem status  : PRIMAL_AND_DUAL_FEASIBLE
  Solution status : OPTIMAL
  Primal.  obj: -4.5507491148e+00   nrm: 2e+01    Viol.  con: 5e-09    var: 3e-09    cones: 7e-21  
  Dual.    obj: -4.5507491329e+00   nrm: 2e+06    Viol.  con: 0e+00    var: 3e-08    cones: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.50    
    Interior-point          - iterations : 23        time: 0.42    
      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): +4.55075
------------------------------------------------------------
错误使用  .*  (第 173 行)
Disciplined convex programming error:
    Cannot perform the operation: {negative constant} .* {real affine}

出错  *  (第 36 行)
    z = feval( oper, x, y );

出错 optimization (第 54 行)
            g(i)=constantTerm+coefficientPhi*(Phi-Phi0)+coefficientqQ*(vecTemp*(q-q0)');

出错 main (第 45 行)
[optCoorU,optPhi] = optimization(M,K,coorS,coorU,identM,wSM,datSA,NkA,radA,B,H,PS,G0,beta0,N0,lamPPP,snrTh,PhiMax);

That’s all, I am grateful to you to help me. Thanks again!

You have not provided a reproducible problem. You are not even showing complete code.

It appears that you neglected to show us the end of the for loop, i.e., after cvx_end. Presumably, that portion of the code updates one or more variables in the RHS of coefficientPhi or coefficientqQ with data from the result of the just completed CVX optimization.

I don’t understand why negative constant*affine expression produces an error message. Are you using CVX 3.0beta? if so, use CVX 2.2 instead, because CVX3.0beta has many bugs.

Your problem has terrible scaling. You are trying to hide that by changing a Mosek solver parameter.

I have modified the code, as shown below

function [optCoorU,optPhi] = optimization1(M,K,coorS,coorU,identM,wSM,datSA,NkA,radA,B,H,PS,G0,beta0,N0,lamPPP,snrTh,PhiMax)
%optimization 对核心问题进行优化
%   采用CVX工具箱或matlab Optimization Toolbox对无人机的轨迹进行优化,单次分簇的优化
arguments
    M (1,1) double
    K (1,1) double
    coorS (:,2) double % M*2
    coorU (:,2) double % M*2
    identM (:,:) double % M*K
    wSM (:,1) double % M*1
    datSA (:,1) double % M*1
    NkA (:,1) double % K*1
    radA (:,1) double %K*1
    B (1,1) double
    H (1,1) double
    PS (1,1) double
    G0 (1,1) double
    beta0 (1,1) double
    N0 (1,1) double
    lamPPP (1,1) double
    snrTh (1,1) double
    PhiMax (1,1) double
end
L=10; % SCA的迭代次数
radA(radA==0)=1; % 避免出现半径为零,从而造成概率为零的情况
prNA=exp(-lamPPP*pi*(radA/1000).^2).*(lamPPP*pi*(radA/1000).^2).^NkA./factorial(NkA); % 计算概率
optCoorU=zeros(K,2); % 初始化最优的无人机轨迹
optPhi=zeros(K,1); % 初始化最优的波束宽度
valA=zeros(L,1); % 记录每次迭代的最优值
PhiA=zeros(L,1); % 记录每次迭代的最优值
qA=zeros(L,2); % 记录每次迭代的最优值
for k=1:1:K
    disp(['第' num2str(k) '个簇计算开始...'])
    zeta=identM(:,k).*wSM.*datSA*NkA(k)/(B*prNA(k)); % 常量替换 M*1
    eta=db2pow(PS-N0-pow2db(B/NkA(k)))*beta0; % 常量替换 1*1
    q0=coorU(k,:); % SCA迭代中q的初始值
    Phi0=1; % SCA迭代中Phi的初始值
    for l=1:1:L
        disp(['第' num2str(k) '个簇第' num2str(l) '次迭代开始...'])
        cvx_begin
        cvx_solver mosek
        %         cvx_solver sdpt3
        cvx_solver_settings('MSK_DPAR_DATA_TOL_AIJ_HUGE',1.0e50);
        cvx_solver_settings('MSK_IPAR_INFEAS_REPORT_AUTO','MSK_ON');
        variable q(1,2)
        variable Phi(1)
        expression g(M,1)
        for i=1:1:M
            vecTemp=q0-coorS(i,:);
            constantTerm=(G0/Phi0^2)./(vecnorm(vecTemp,2,2)+H)^2;
            coefficientPhi=-1*(log(10)*G0*(G0/Phi0^2)/(5*Phi0^3*(vecnorm(vecTemp,2,2)+H)^2));
            if isequal(sum(vecTemp),0)
                coefficientqQ=-1*2*(G0/Phi0^2)/((vecnorm(vecTemp,2,2)+H)^3);
                vecTemp=[1 1];
            else
                coefficientqQ=-1*2*(G0/Phi0^2)/(vecnorm(vecTemp,2,2)*(vecnorm(vecTemp,2,2)+H)^3);
            end
            g(i)=constantTerm+coefficientPhi*(Phi-Phi0)+coefficientqQ*(vecTemp*(q-q0)');
        end
        minimize(sum(zeta.*inv_pos(log(1+eta.*g)/log(2)),1));
        subject to
        snrTh-eta.*g<=0;
        0.01<=Phi<=PhiMax;
        0.001<=q;
        q<=500;
        for i=1:1:M
            vecTemp=q0-coorS(i,:);
            identM(i,k)*norm(vecTemp)-radA(k)<=0;
        end
        cvx_end
        q0=q;
        Phi0=Phi;
        qA(l,:)=q;
        PhiA(l)=Phi;
        valA(l)=cvx_optval;
        disp(['第' num2str(k) '个簇第' num2str(l) '次迭代结束!'])
    end
    [minVal,ind]=min(valA);
    optCoorU(k,:)=qA(ind);
    optPhi(k)=PhiA(ind);
    disp(['第' num2str(k) '个簇计算结束!'])
end

I tried to solve this problem iteratively. At the first iteration, I got

Calling Mosek 9.1.9: 202 variables, 59 equality constraints
   For improved efficiency, Mosek is solving the dual problem.
------------------------------------------------------------
NOTE: custom settings have been set for this solver.
------------------------------------------------------------

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 59              
  Cones                  : 56              
  Scalar variables       : 202             
  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 started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries                  : 2                 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            : 59              
  Cones                  : 56              
  Scalar variables       : 202             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 31
Optimizer  - Cones                  : 56
Optimizer  - Scalar variables       : 202               conic                  : 168             
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 : 116               after factor           : 116             
Factor     - dense dim.             : 0                 flops                  : 2.58e+03        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   2.2e+00  8.2e+06  5.2e+06  0.00e+00   5.158870483e+06   -1.420718900e-01  1.0e+00  0.06  
1   1.1e+00  3.9e+06  3.6e+06  -1.00e+00  5.158867293e+06   -2.969381225e-01  4.8e-01  0.17  
2   5.0e-01  1.9e+06  2.5e+06  -1.00e+00  5.158851557e+06   -6.229361896e-01  2.3e-01  0.19  
3   1.4e-01  5.2e+05  1.3e+06  -1.00e+00  5.158769909e+06   -2.229436195e+00  6.4e-02  0.19  
4   2.7e-02  1.0e+05  5.7e+05  -1.00e+00  5.158160790e+06   -1.157146982e+01  1.2e-02  0.19  
5   2.6e-03  9.5e+03  1.8e+05  -1.00e+00  5.150607206e+06   -1.217187780e+02  1.2e-03  0.20  
6   2.8e-04  1.0e+03  5.8e+04  -9.97e-01  5.082651370e+06   -1.104521001e+03  1.3e-04  0.20  
7   3.9e-05  1.4e+02  2.0e+04  -9.73e-01  4.640402520e+06   -7.375728064e+03  1.8e-05  0.20  
8   1.0e-05  3.9e+01  8.5e+03  -8.02e-01  3.473954931e+06   -2.085211270e+04  4.7e-06  0.22  
9   2.7e-06  1.0e+01  1.3e+03  -7.76e-02  1.190829238e+06   -2.504903800e+04  1.2e-06  0.22  
10  4.1e-08  1.5e-01  3.1e+00  6.95e-01   1.863970599e+03   -1.885236844e+04  1.9e-08  0.22  
11  2.0e-10  7.6e-04  8.3e-04  1.03e+00   -1.640303351e+02  -2.673705907e+02  9.2e-11  0.22  
12  4.7e-13  1.8e-06  9.3e-08  1.00e+00   -4.018172968e-01  -6.408056152e-01  2.1e-13  0.23  
13  4.3e-14  1.6e-07  2.6e-09  1.00e+00   -4.702853917e-02  -6.883364308e-02  2.0e-14  0.23  
14  8.9e-15  8.9e-08  2.4e-10  1.01e+00   -2.069335400e-02  -2.515054739e-02  3.9e-15  0.25  
15  2.1e-15  1.0e-07  2.8e-11  1.06e+00   -1.631880566e-02  -1.733498780e-02  8.8e-16  0.25  
16  1.4e-15  1.2e-07  5.3e-12  1.15e+00   -1.586949134e-02  -1.619056437e-02  2.8e-16  0.25  
17  1.4e-15  1.2e-07  2.6e-12  1.48e+00   -1.567006744e-02  -1.585737775e-02  2.1e-16  0.25  
18  1.6e-15  1.1e-07  1.2e-12  1.70e+00   -1.547653898e-02  -1.557461060e-02  1.7e-16  0.27  
19  1.6e-15  1.1e-07  1.2e-12  1.65e+00   -1.547653898e-02  -1.557461060e-02  1.7e-16  0.27  
20  1.6e-15  1.1e-07  1.2e-12  1.71e+00   -1.547653898e-02  -1.557461060e-02  1.7e-16  0.27  
Optimizer terminated. Time: 0.31    


Interior-point solution summary
  Problem status  : UNKNOWN
  Solution status : UNKNOWN
  Primal.  obj: -1.5476538985e-02   nrm: 9e-02    Viol.  con: 1e-04    var: 9e-06    cones: 1e-16  
  Dual.    obj: -1.5574610604e-02   nrm: 4e+06    Viol.  con: 0e+00    var: 7e-03    cones: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.31    
    Interior-point          - iterations : 21        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: Inaccurate/Solved
Optimal value (cvx_optval): +0.0155746

And at the second iteration, the problem becomes Unbounded.

Calling Mosek 9.1.9: 202 variables, 59 equality constraints
   For improved efficiency, Mosek is solving the dual problem.
------------------------------------------------------------
NOTE: custom settings have been set for this solver.
------------------------------------------------------------

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Copyright (c) MOSEK ApS, Denmark. WWW: mosek.com
Platform: Windows/64-X86

MOSEK warning 62: The A matrix contains a large value of -7.2e+11 in constraint '' (28) at variable '' (0).
MOSEK warning 62: The A matrix contains a large value of -4.5e+11 in constraint '' (28) at variable '' (1).
MOSEK warning 62: The A matrix contains a large value of -8.3e+11 in constraint '' (28) at variable '' (2).
MOSEK warning 62: The A matrix contains a large value of -5.7e+11 in constraint '' (28) at variable '' (3).
MOSEK warning 62: The A matrix contains a large value of -1.1e+12 in constraint '' (28) at variable '' (4).
MOSEK warning 62: The A matrix contains a large value of -4.1e+11 in constraint '' (28) at variable '' (5).
MOSEK warning 62: The A matrix contains a large value of -3.3e+11 in constraint '' (28) at variable '' (6).
MOSEK warning 62: The A matrix contains a large value of -3.8e+11 in constraint '' (28) at variable '' (7).
MOSEK warning 62: The A matrix contains a large value of -8.6e+11 in constraint '' (28) at variable '' (8).
MOSEK warning 62: The A matrix contains a large value of -1.1e+12 in constraint '' (28) at variable '' (9).
Warning number 62 is disabled.
MOSEK warning 57: A large value of  2.0e+10 has been specified in c for variable '' (0).
MOSEK warning 57: A large value of  1.2e+10 has been specified in c for variable '' (1).
MOSEK warning 57: A large value of  2.2e+10 has been specified in c for variable '' (2).
MOSEK warning 57: A large value of  1.6e+10 has been specified in c for variable '' (3).
MOSEK warning 57: A large value of  2.9e+10 has been specified in c for variable '' (4).
MOSEK warning 57: A large value of  1.1e+10 has been specified in c for variable '' (5).
MOSEK warning 57: A large value of  8.9e+09 has been specified in c for variable '' (6).
MOSEK warning 57: A large value of  1.0e+10 has been specified in c for variable '' (7).
MOSEK warning 57: A large value of  2.3e+10 has been specified in c for variable '' (8).
MOSEK warning 57: A large value of  3.0e+10 has been specified in c for variable '' (9).
Warning number 57 is disabled.
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 59              
  Cones                  : 56              
  Scalar variables       : 202             
  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 started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries                  : 2                 time                   : 0.00            
Lin. dep.  - tries                  : 1                 time                   : 0.03            
Lin. dep.  - number                 : 0               
Presolve terminated. Time: 0.06    
Problem
  Name                   :                 
  Objective sense        : min             
  Type                   : CONIC (conic optimization problem)
  Constraints            : 59              
  Cones                  : 56              
  Scalar variables       : 202             
  Matrix variables       : 0               
  Integer variables      : 0               

Optimizer  - threads                : 4               
Optimizer  - solved problem         : the primal      
Optimizer  - Constraints            : 31
Optimizer  - Cones                  : 56
Optimizer  - Scalar variables       : 202               conic                  : 168             
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 : 118               after factor           : 118             
Factor     - dense dim.             : 0                 flops                  : 2.66e+03        
ITE PFEAS    DFEAS    GFEAS    PRSTATUS   POBJ              DOBJ              MU       TIME  
0   2.6e+00  6.9e+12  3.1e+11  0.00e+00   3.101105134e+11   -1.420718900e-01  1.0e+00  0.08  
1   1.4e+00  3.7e+12  2.3e+11  -1.00e+00  3.126792981e+11   -2.639395850e-01  5.4e-01  0.19  
2   5.5e-01  1.5e+12  1.5e+11  -1.00e+00  3.332474306e+11   -6.686548162e-01  2.1e-01  0.19  
3   4.0e-01  1.1e+12  1.3e+11  -1.00e+00  3.333066804e+11   -9.176813022e-01  1.5e-01  0.19  
4   8.0e-02  2.1e+11  5.9e+10  -1.00e+00  3.330060438e+11   -4.600006368e+00  3.1e-02  0.20  
5   1.9e-02  5.0e+10  2.8e+10  -1.00e+00  3.328431951e+11   -1.950627395e+01  7.3e-03  0.20  
6   2.1e-03  5.4e+09  9.4e+09  -1.00e+00  3.327074413e+11   -1.797582485e+02  7.9e-04  0.20  
7   2.4e-04  6.5e+08  3.2e+09  -1.00e+00  3.327122050e+11   -1.508872272e+03  9.4e-05  0.20  
8   3.5e-05  9.1e+07  1.2e+09  -1.00e+00  3.327124743e+11   -1.068497314e+04  1.3e-05  0.22  
9   4.4e-06  1.2e+07  4.3e+08  -1.00e+00  3.327102963e+11   -8.400837435e+04  1.7e-06  0.22  
10  7.4e-07  1.1e+06  1.3e+08  -1.00e+00  3.326877184e+11   -8.871040647e+05  1.6e-07  0.22  
11  7.6e-08  1.1e+05  4.3e+07  -1.00e+00  3.324760810e+11   -8.567138313e+06  1.7e-08  0.22  
12  9.1e-09  1.4e+04  1.5e+07  -9.99e-01  3.307589809e+11   -7.155490320e+07  2.0e-09  0.23  
13  9.1e-09  1.4e+04  1.5e+07  -9.92e-01  3.307589809e+11   -7.155490320e+07  2.0e-09  0.23  
14  9.1e-09  1.4e+04  1.5e+07  -9.92e-01  3.307589809e+11   -7.155490320e+07  2.0e-09  0.23  
Optimizer terminated. Time: 0.30    


Interior-point solution summary
  Problem status  : UNKNOWN
  Solution status : UNKNOWN
  Primal.  obj: 3.3075898093e+11    nrm: 1e+14    Viol.  con: 1e+13    var: 4e+12    cones: 0e+00  
  Dual.    obj: -7.1554903199e+07   nrm: 4e+08    Viol.  con: 0e+00    var: 1e+11    cones: 0e+00  
Optimizer summary
  Optimizer                 -                        time: 0.30    
    Interior-point          - iterations : 15        time: 0.23    
      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: Unbounded
Optimal value (cvx_optval): -Inf

After reading the Mosek user’s guide, I guess that the scaling problem is a key problem. But I have no idea how to scale the coefficient. Especially, the G0/Phi^2 is hard to control.
Thanks for your reply.

May I suggest that your iterative scheme (algorithm) is unstable. High quality non-convex optimization solvers are considerably more sophisticated than the crude algorithm you are using. You are probably better off using a high quality off the shelf non-convex optimizer (local or global). If so, you might find YALMIP as a convenient way of calling such a solver.

Thanks for your reply!

If you start with a “good” enough value of Phi0, perhaps you will get lucky and the algorithm will converge, maybe even to a local minimum of the original problem.

I believe the unfortunate reality of unsafeguarded (no line search or trust region) Successive Convex Approximation (SCA) is that if you apply it to a new problem and your name doesn’t happen to be Stephen Boyd, you may not enjoy the same success as the examples he shows.

。。。。你是搞无人机通信方向的? :joy:

so do I :rofl:小老弟 :rofl:,你也是吗

差不多,正在捣鼓这玩意 :joy:。。。

Trajectory Optimization?

yes, like successive convex approach …

:joy:so do I…

wow, academic enemies (friends) everywhere :sweat_smile: :rofl: :stuck_out_tongue_winking_eye: