Failed status, NaN optimal value

Hi. this is a part of my code:

cvx_begin

    cvx_solver mosek
    
    variable Lambda nonnegative        % Dual variable of wasserstein ball
    variable obj_S(Sampnum,1)           % Auxillary Variable
    variable W(2*num,2*num)           % W_0
   
    minimize Lambda*WD_ep+sum(obj_S)
    subject to

%objective function- related constraints

     for obj_gen_idx=1:length(Gloc)
         obj_gen1=Gloc(obj_gen_idx);
         obj_gen(obj_gen_idx)=100*trace(Y_k(:,:,obj_gen1)*W);
     end
        
    
    for obj_idx1=1:Sampnum
        obj_S(obj_idx1)>=c_k_2'*((obj_gen'+obj_unc*max_unc+PDG).^2)...
                         +c_k_1'*(obj_gen'+obj_unc*max_unc+PDG)...
                         +c_k_0'*ones(length(Gloc),1) ...
                         -Lambda*norm(max_unc-unc(obj_idx1),1);
                     
        obj_S(obj_idx1)>=c_k_2'*((obj_gen'+obj_unc*min_unc+PDG).^2)...
                         +c_k_1'*(obj_gen'+obj_unc*min_unc+PDG)...
                         +c_k_0'*ones(length(Gloc),1) ...
                         -Lambda*norm(min_unc-unc(obj_idx1),1); 

          %%% constraint 1           
        obj_S(obj_idx1)>=c_k_2'*((obj_gen'+obj_unc*unc(:,obj_idx1)+PDG).^2)...
                         +c_k_1'*(obj_gen'+obj_unc*unc(:,obj_idx1)+PDG)...
                         +c_k_0'*ones(length(Gloc),1);              
                     
    end

cvx_end

before adding constraint 1, the objective is unbounded. However, after adding constraint 1, the optimal value will be changed to NAN and status will be failed.
WD_ep is a constant number. PDG is a constant vector. unc is a constant matrix.
I would be grateful if you help me out.

Please show the solver and CVX output of the failed run.

Here:
Calling Mosek 9.1.9: 2401 variables, 811 equality constraints
For improved efficiency, Mosek is solving the dual problem.

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

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 811
Cones : 750
Scalar variables : 2401
Matrix variables : 0
Integer variables : 0

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

Optimizer - threads : 2
Optimizer - solved problem : the dual
Optimizer - Constraints : 848
Optimizer - Cones : 751
Optimizer - Scalar variables : 2359 conic : 2258
Optimizer - Semi-definite variables: 0 scalarized : 0
Factor - setup time : 0.03 dense det. time : 0.00
Factor - ML order time : 0.01 GP order time : 0.00
Factor - nonzeros before factor : 3946 after factor : 4848
Factor - dense dim. : 16 flops : 4.59e+04
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 9.5e+05 8.6e+01 7.6e+02 0.00e+00 -1.798004895e+05 -1.805585652e+05 1.0e+00 0.08
1 5.1e+04 4.6e+00 1.7e+02 -9.95e-01 -1.709500186e+05 -1.716578252e+05 5.4e-02 0.22
2 1.2e+04 1.1e+00 7.4e+01 -9.03e-01 -1.431601823e+05 -1.437230056e+05 1.3e-02 0.22
3 4.0e+03 3.6e-01 3.0e+01 -5.87e-01 -8.048869092e+04 -8.082740547e+04 4.2e-03 0.23
4 1.5e+03 1.3e-01 1.2e+01 -3.06e-01 -2.806208287e+04 -2.825034427e+04 1.5e-03 0.23
5 3.8e+02 3.4e-02 4.1e+00 -2.83e-01 6.439956138e+04 6.438608056e+04 4.0e-04 0.23
6 9.6e+01 8.7e-03 1.3e+00 -3.05e-01 1.757120680e+05 1.758795830e+05 1.0e-04 0.25
7 1.3e+01 1.2e-03 2.2e-01 -2.59e-01 3.928824848e+05 3.933147933e+05 1.3e-05 0.27
8 4.4e+00 3.9e-04 1.0e-01 -3.63e-01 5.860150651e+05 5.868618358e+05 4.6e-06 0.27
9 6.9e-01 6.2e-05 2.2e-02 -3.09e-01 1.081839150e+06 1.083342768e+06 7.3e-07 0.28
10 2.4e-01 2.2e-05 8.8e-03 -2.46e-01 1.523843329e+06 1.525951967e+06 2.5e-07 0.28
11 8.2e-02 7.4e-06 3.2e-03 -1.57e-01 2.046377254e+06 2.048712449e+06 8.6e-08 0.30
12 2.1e-02 1.8e-06 8.7e-04 -1.47e-01 2.923133777e+06 2.925969377e+06 2.2e-08 0.30
13 6.2e-03 5.5e-07 2.7e-04 -7.24e-02 3.810904693e+06 3.813939321e+06 6.5e-09 0.31
14 2.2e-03 2.0e-07 9.3e-05 1.14e-02 4.603243458e+06 4.606123521e+06 2.3e-09 0.31
15 7.5e-04 6.7e-08 2.8e-05 1.53e-01 5.280124911e+06 5.282305505e+06 7.8e-10 0.33
16 2.8e-04 2.5e-08 7.4e-06 7.31e-01 5.747485031e+06 5.748568339e+06 3.2e-10 0.34
17 8.0e-05 7.2e-09 1.2e-06 6.73e-01 5.994697420e+06 5.995070974e+06 9.1e-11 0.36
18 1.4e-05 2.0e-09 8.6e-08 9.59e-01 6.109596299e+06 6.109659243e+06 1.6e-11 0.38
19 1.4e-05 2.0e-09 8.6e-08 9.94e-01 6.109596299e+06 6.109659243e+06 1.6e-11 0.39
Optimizer terminated. Time: 0.44

Interior-point solution summary
Problem status : UNKNOWN
Solution status : UNKNOWN
Primal. obj: 6.1095962989e+06 nrm: 3e+04 Viol. con: 3e+01 var: 0e+00 cones: 4e-05
Dual. obj: 6.1096592431e+06 nrm: 7e+06 Viol. con: 0e+00 var: 9e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 0.44
Interior-point - iterations : 20 time: 0.41
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: Failed
Optimal value (cvx_optval): NaN

Thanks.

It looks like maybe Mosek solved the problem (primal and dual objectives are almost equal and PRSTATUS is not too far from 1), but didn’t quite reach intended accuracy. Anyhow, the optimal objective value of 6e6 is very high, and indicates bad scaling of the problem. Perhaps if you improve the scaling, Mosek can complete with optimality attained.