CVX return a matrix of NaN values


(Alberto) #1

Hi, when launch a cvx problem, it returns a 76x76 NaN matrix. In particular, this is the code I launched:

in the “main” script,

[L_recovered,Ck]= laplacian_learning(Y, U_recovered, S_recovered,param, 'TV');

where Y is a 76x400 matrix, U_recovered a 76x76 matrix and S_recovered a 76x400 matrix.
param and ‘TV’ are two parameters needed for the function laplacian_learning, that is the following:

support=[];
trace_constraint=param.trace_constraint;

for i=1:param.N
    if norm(S(i,:)) ~=0
        support= [support i];
    end
    
end

Uk(:, 1:param.K)= U(:,support); % support first K columns
Sk(1:param.K, :)= S(support,:); % WARNING
switch method
case 'TV'
        disp('METHOD: TOTAL VARIATION BASED LEARNING' )
        cvx_clear
        cvx_begin
            variable L_recovered(param.N,param.N) semidefinite % encode the simmetry 
            variable Ck(param.K,param.K) semidefinite
            Objective = sum(sum(repmat(-L_recovered,1,size(Y,2)).* abs(diffmat(Y)))) + param.mu* sum_square(vec(L_recovered))
          
           minimize Objective
           subject to
                L_recovered*Uk==Uk*Ck
                L_recovered*ones(param.N,1)==zeros(param.N,1)
                
                triu(L_recovered,1)<=0; % off diagonal <=0
                %diag(L_recovered)>=0; not necesary since semidefinite
                trace(L_recovered)==trace_constraint;
        cvx_end

The status is INFEASIBLE. In particular this are the message during the resolution cvx process:

Objective =
 
    cvx convex expression (scalar)
 
 
Calling SDPT3 4.0: 18575 variables, 5007 equality constraints
   For improved efficiency, SDPT3 is solving the dual problem.
------------------------------------------------------------

 num. of constraints = 5007
 dim. of sdp    var  = 140,   num. of sdp  blk  =  2
 dim. of socp   var  = 5778,   num. of socp blk  =  1
 dim. of linear var  = 2850
 dim. of free   var  = 4941 *** convert ublk to lblk
*******************************************************************
   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|7.5e+01|1.0e+02|1.0e+13|-1.465070e-02  0.000000e+00| 0:0:09| chol  1  1 
 1|0.423|0.272|4.3e+01|7.5e+01|2.9e+12| 1.677289e+09 -2.532748e+07| 0:0:16| chol  1  1 
 2|0.905|0.776|4.1e+00|1.7e+01|5.0e+11| 2.878037e+09  1.651881e+07| 0:0:24| chol  1  1 
 3|0.873|0.964|5.2e-01|7.3e-01|2.1e+10| 1.724017e+09 -3.392050e+06| 0:0:31| chol  1  1 
 4|0.905|0.747|4.9e-02|2.3e-01|5.7e+09| 6.088070e+08 -4.120711e+06| 0:0:39| chol  1  1 
 5|0.336|0.237|3.2e-02|1.8e-01|4.1e+09| 4.530588e+08 -4.165774e+06| 0:0:46| chol  1  1 
 6|0.379|0.513|2.0e-02|9.8e-02|2.1e+09| 3.734173e+08 -4.311236e+06| 0:0:54| chol  1  1 
 7|0.687|0.245|6.3e-03|8.0e-02|1.4e+09| 2.603302e+08 -4.314254e+06| 0:1:01| chol  1  1 
 8|0.491|0.412|3.2e-03|5.0e-02|8.1e+08| 2.062424e+08 -4.333582e+06| 0:1:09| chol  1  1 
 9|0.931|0.227|2.2e-04|4.0e-02|4.5e+08| 1.149104e+08 -4.332472e+06| 0:1:16| chol  1  1 
10|0.794|0.401|4.6e-05|2.4e-02|2.1e+08| 6.378960e+07 -4.339542e+06| 0:1:23| chol  1  1 
11|0.296|0.354|3.2e-05|1.6e-02|1.4e+08| 4.678876e+07 -4.355095e+06| 0:1:31| chol  1  1 
12|0.460|0.212|1.7e-05|1.2e-02|1.0e+08| 2.302582e+07 -4.364167e+06| 0:1:39| chol  1  1 
13|0.491|0.244|8.8e-06|9.5e-03|7.4e+07| 6.629921e+06 -4.371487e+06| 0:1:47| chol  1  1 
14|0.396|0.263|5.3e-06|7.0e-03|5.7e+07|-1.715012e+06 -4.366695e+06| 0:1:54| chol  1  1 
15|0.388|0.237|3.3e-06|5.3e-03|4.8e+07|-7.962960e+06 -4.374278e+06| 0:2:02| chol  1  1 
16|0.176|0.192|2.7e-06|5.7e-03|5.6e+07|-1.070975e+07 -4.432430e+06| 0:2:10| chol  2  2 
17|0.037|0.024|2.6e-06|7.5e-03|7.3e+07|-1.077593e+07 -4.617117e+06| 0:2:18| chol  1  2 
18|0.231|0.061|2.0e-06|9.3e-03|1.0e+08|-1.225433e+07 -4.750541e+06| 0:2:26| chol  1  2 
19|0.293|0.175|1.4e-06|1.0e-02|1.2e+08|-1.377679e+07 -4.997335e+06| 0:2:34| chol  1  2 
20|0.222|0.205|1.1e-06|8.1e-03|1.0e+08|-1.464791e+07 -5.238880e+06| 0:2:41| chol  2  2 
21|0.325|0.099|7.4e-07|9.8e-03|1.4e+08|-1.664286e+07 -5.343499e+06| 0:2:50| chol  1  2 
22|0.524|0.262|3.5e-07|7.2e-03|1.2e+08|-1.968790e+07 -5.603888e+06| 0:2:57| chol  2  2 
23|0.259|0.285|2.6e-07|5.2e-03|9.2e+07|-2.243762e+07 -5.792852e+06| 0:3:06| chol  1  2 
24|0.162|0.218|2.2e-07|4.0e-03|7.5e+07|-2.538393e+07 -5.906786e+06| 0:3:13| chol  2  2 
25|0.489|0.153|1.1e-07|4.7e-03|1.3e+08|-3.781598e+07 -6.118205e+06| 0:3:21| chol  2  2 
26|0.709|0.243|3.2e-08|3.5e-03|1.5e+08|-5.784711e+07 -6.202394e+06| 0:3:30| chol  2  2 
27|0.437|0.258|1.8e-08|2.6e-03|1.3e+08|-8.610275e+07 -6.387962e+06| 0:3:38| chol  2  2 
28|0.390|0.434|1.1e-08|1.5e-03|7.0e+07|-1.503779e+08 -6.531525e+06| 0:3:47| chol  2  2 
29|0.057|0.094|1.0e-08|2.0e-03|2.3e+08|-2.451643e+08 -6.582697e+06| 0:3:55| chol  2  2 
30|0.398|0.153|6.3e-09|2.4e-03|8.2e+08|-5.769785e+08 -6.619501e+06| 0:4:03| chol  2  2 
31|1.000|0.152|2.3e-11|2.9e-03|3.4e+09|-1.735729e+09 -6.613883e+06| 0:4:12| chol  2  2 
32|1.000|0.350|7.2e-11|1.9e-03|3.9e+09|-4.096651e+09 -6.596760e+06| 0:4:21| chol  2  2 
33|1.000|0.171|4.1e-10|2.3e-03|2.5e+10|-1.870457e+10 -6.635377e+06| 0:4:32| chol  2  2 
34|1.000|0.301|5.3e-10|1.6e-03|3.8e+10|-5.812919e+10 -6.684811e+06| 0:4:41| chol  2  2 
35|1.000|0.116|1.8e-08|2.1e-03|4.6e+11|-3.910698e+11 -6.733064e+06| 0:4:49| chol  2  2 
36|1.000|0.294|1.6e-08|1.5e-03|7.5e+11|-1.361247e+12 -7.703783e+06| 0:4:58|
  sqlp stop: dual problem is suspected of being infeasible
-------------------------------------------------------------------
 number of iterations   = 36
 residual of dual infeasibility        
 certificate X          = 4.78e-06
 reldist to infeas.    <= 6.06e-10
 Total CPU time (secs)  = 297.60  
 CPU time per iteration = 8.27  
 termination code       =  2
 DIMACS: 3.3e-07  0.0e+00  2.1e-03  0.0e+00  -1.0e+00  5.5e-01
-------------------------------------------------------------------
 
------------------------------------------------------------
Status: Infeasible
Optimal value (cvx_optval): +Inf

Which could the problem be?


(Erling D.Andersen) #2

Most likely your problem has no feasible solution. That is most likely the problem. This is something which is unlikely than anyone at this forum can fix for you.

You can try another optimizer. SeDuMi and Mosek are better at detecting infeasibility reliably. If they say infeasible too you can be sure it is correct conclusion.


(Mark L. Stone) #3

You wrote:

Which could the problem be?

Read https://yalmip.github.io/debugginginfeasible/ .