CVX solving problem


(hua meng) #1

I run my matlab code using CVX (version 2.1, mosek).I am confused by the my matlab results.
First, if I delete the first constraint, i.e., sum(E_um)+sum(E_u)<=EU;, and set L=5*10^3 , the CVX works, and the window shows Status:
Inaccurate/Solved
Optimal value (cvx_optval): +7.96431e-05
if I scale the parameter L , for example , L=20*10^3, the cvx doesnot works, the window shows Status:
Status: Inaccurate/Unbounded
Optimal value (cvx_optval): -Inf
From code E_um(n,1)=(2^(L_um(n,1)./(B*delta1))-1)*delta1*h_G2U(n+2,1).^2/SNR;, the increasing L will increase the objective results. Why scale parameter L can not solved by CVX ?

Second, if the first constraint, i.e., sum(E_um)+sum(E_u)<=EU;, is not deleted. We still set L=5*10^3 , however, the CVX does not work, and the window shows Status:
Status: Failed
Optimal value (cvx_optval): NaN
In fact, from the obtained results, E_um and E_u, by deleting first constraint, i.e., sum(E_um)+sum(E_u)<=EU;, I calculate sum(E_um)+sum(E_u)=4.8695e-04 is small EU.
Why adding this constraint cannot get the results. The codes are given as following

    B=20e6; % in Hz
    SNR_dB=20;
    SNR=10^(SNR_dB./10); %in  W
    EU=1000*10^3; 
    k=0.9; 
    C=1550.7;
    gamma=10^(-28);
    L=5*10^3;
    delta1=2.5*10^(-3); 
    delta2=100*10^(-3);
    T=5; % in s
    N=T./delta2;
    v=[-3 -3 -3].';
    UserPosition=[0 0 0].';
    q0=[5 5 5].';
    q=q0+v*[1:N]*delta2;
    %% 
    h_G2U=sqrt(sum((q-UserPosition).*(q-UserPosition))).';
    cvx_begin
        variable  L_mu(N-2,1) 
        variable  L_um(N-2,1) 
        variable  L_u(N-2,1) 
        expression  E_mu(N-2,1)
        expression  E_u(N-2,1)
        expression  E_um(N-2,1)
       
        for n=1:N-2
            E_um(n,1)=(2^(L_um(n,1)./(B*delta1))-1)*delta1*h_G2U(n+2,1).^2/SNR;
        end
        for n=1:N-2
            E_u(n,1)=C^3*gamma*pow_pos(L_u(n,1),3)./delta1^2;
        end

        for n=1:N-2
            E_mu(n,1)=(2^(L_mu(n,1)./(B*delta1))-1)*delta1*h_G2U(n,1).^2/SNR;
        end

        minimize sum(E_mu)
        subject to 
             sum(E_um)+sum(E_u)<=EU;
             for n=1:N-2
                 sum(L_u(1:n,1))<=sum(L_mu(1:n,1));
             end
             for n=1:N-2
                 sum(L_um(1:n,1))<=k*sum(L_u(1:n,1));
             end
             sum(L_mu)==L;
             sum(L_u)==L;
             sum(L_um)==k*L;
             L_mu>=0;
             L_um>=0;
             L_u>=0;
    cvx_end

Thanks in advance for anyone help me.


(Mark L. Stone) #2

Maybe you should try CVX 3.0beta with ECOS solver. That avoids use of the successive approximation method to deal with 2^(L_um(n,1) and 2^(L_mu(n,1). I was able to run the original problem in this configuration, and get (I don;t know how reliable these results are)

60  -1.363e+03  -1.363e+03  +2e-10  5e-03  4e-08  7e-03  2e-13  0.0007  9e-01   1  1  1 |  0  0
61  -1.363e+03Slacks/multipliers leaving the cone, recovering best iterate (44) and stopping.

NUMERICAL PROBLEMS (reached feastol=1.5e-03, reltol=1.3e-13, abstol=1.7e-10).------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -0.0784041

although I’m not sure I ran the problem correctly. It looks like you made use of a new capability added in MATLAB 2016A https://blogs.mathworks.com/loren/2016/10/24/matlab-arithmetic-expands-in-r2016b/ which essentially automatically inserts repmat in certain places where dimensions were incompatible per the old MATLAB rules. I am using MATLAB 2014A, so I had to manually insert some repmats to get things compatible per that version of MATLAB.

I think your code is not very well scaled, and that may be contributing to numerical difficulties. I don;t have specific recommendations on reformulation, but large magnitude positive and negative exponents, as you have now are probably not a good thing.

Also see the post by Michal_Adamaszek in Does cvx solve nonlinear convex problems? . But I don’t know what the plans are for support of this forthcoming MOSEK native exponential cone capability in CVX