Hi, I am new to CVX. Recently, I was trying to solve an SDP problem with mainly linear matrix inequality constraints and found that the CVX is an ideal tool for expressing the problem. However, CVX can be worked with several internal and external SDP solvers. I didnβt know which one is the best for me so I tried them all: SDPT3, SeDuMi, and Mosek. SDPT3 simply didnβt work for most of the time. The main issue is that the SeDuMi and Mosek gave inconsistent results. And, I could not tell which one is close to the real optimized value.
Here is the code I implemented using both SeDuMi and Mosek:
cvx_solver SeDuMi
% cvx_solver MOSEK_3
cvx_begin sdp
variable x(n)
expression M_psd_exp(Nk,Nk)
variable M_psd(Nk,Nk,NQ) complex hermitian semidefinite
minimize( f * x );
subject to
lb <= x <= ub;
A * x <= b;
Aeq * x == beq;
for i = 1:NQ
for j = 1:Nk
M_psd_exp(:,j) = D(:,:,j,i)*x;
end
M_psd(:,:,i) == M_psd_exp;
end
cvx_end
Here the for-loop is used to generate NQ numbers of positive semidefinite constraints stored in the variable M_psd claimed to be complex hermitian semidefinite (yes, I am solving a complex SDP problem). In my implementations, I have n = 325, Nk=NQ=49, A is a matrix with dimension 2401x325, and Aeq is a 1x325 vector.
This is what the SeDuMi solver gave me after the optimization:
Calling SeDuMi 1.3.4: 175973 variables, 27373 equality constraints
For improved efficiency, SeDuMi is solving the dual problem.
SeDuMi 1.3.4 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
Split 55273 free variables
eqs m = 27373, order n = 115999, dim = 348896, blocks = 50
nnz(A) = 37069641 + 0, nnz(ADA) = 32617321, nnz(L) = 16322347
it : by gap delta rate t/tP t/tD* feas cg cg prec
0 : 2.64E+02 0.000
1 : 1.69E-01 2.19E+02 0.000 0.8295 0.9000 0.9000 4.44 1 1 3.4E+01
2 : 1.20E-01 1.86E+02 0.000 0.8523 0.9000 0.9000 2.66 1 1 2.6E+01
3 : 8.02E-02 1.22E+02 0.000 0.6531 0.9000 0.9000 2.71 1 1 1.1E+01
4 : 8.23E-02 5.31E+01 0.000 0.4356 0.9000 0.9000 2.88 1 1 2.4E+00
5 : 8.64E-02 2.06E+01 0.000 0.3874 0.9000 0.9000 2.92 1 1 5.8E-01
6 : 9.08E-02 6.30E-01 0.000 0.0307 0.9900 0.9900 1.41 1 1 1.1E-01
7 : 1.35E-01 5.25E-02 0.000 0.0833 0.9900 0.9900 1.46 1 1 6.8E-02
8 : 2.07E-01 1.03E-02 0.000 0.1966 0.9000 0.9000 1.06 1 1 4.3E-02
9 : 2.35E-01 5.50E-04 0.000 0.0533 0.9900 0.9900 1.01 1 1 4.6E-03
10 : 2.36E-01 3.02E-05 0.000 0.0550 0.9900 0.9900 1.00 3 2 2.7E-04
Run into numerical problems.
iter seconds digits cx by
10 38.1 2.5 2.3645714125e-01 2.3556829304e-01
|Ax-b| = 5.8e-07, [Ay-c]_+ = 1.5E-06, |x|= 2.4e+01, |y|= 4.3e+02
No sensible solution found.
Detailed timing (sec)
Pre IPM Post
5.748E+00 1.381E+02 1.200E-01
Max-norms: ||b||=1.066859e-03, ||c|| = 3.888980e+02,
Cholesky |add|=0, |skip| = 93, ||L.L|| = 979.611.
Status: Failed
Optimal value (cvx_optval): NaN
which actually failed. However, it did give me a final obj value: 2.2901e-04.
Then for MOSEK, I got the following results:
Calling Mosek_3 9.1.9: 175973 variables, 27373 equality constraints
For improved efficiency, Mosek_3 is solving the dual problem.
MOSEK Version 10.1.24 (Build date: 2024-1-31 14:16:39)
Copyright (c) MOSEK ApS, Denmark WWW: mosek.com
Platform: Windows/64-X86
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #288 (nearly) zero elements are specified in sparse col ββ (1) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #248 (nearly) zero elements are specified in sparse col ββ (2) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #248 (nearly) zero elements are specified in sparse col ββ (3) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #248 (nearly) zero elements are specified in sparse col ββ (4) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #248 (nearly) zero elements are specified in sparse col ββ (5) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #316 (nearly) zero elements are specified in sparse col ββ (6) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #297 (nearly) zero elements are specified in sparse col ββ (7) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #248 (nearly) zero elements are specified in sparse col ββ (8) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #248 (nearly) zero elements are specified in sparse col ββ (9) of matrix βAβ.
MOSEK warning 710 (MSK_RES_WRN_ZEROS_IN_SPARSE_COL): #248 (nearly) zero elements are specified in sparse col ββ (10) of matrix βAβ.
Warning number 710 is disabled.
Problem
Name :
Objective sense : minimize
Type : CONIC (conic optimization problem)
Constraints : 27373
Affine conic cons. : 0
Disjunctive cons. : 0
Cones : 0
Scalar variables : 58324
Matrix variables : 49 (scalarized: 237699)
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. - primal attempts : 1 successes : 1
Lin. dep. - dual attempts : 0 successes : 0
Lin. dep. - primal deps. : 0 dual deps. : 0
Presolve terminated. Time: 0.75
Optimizer - threads : 24
Optimizer - solved problem : the primal
Optimizer - Constraints : 27373
Optimizer - Cones : 1
Optimizer - Scalar variables : 28848 conic : 27814
Optimizer - Semi-definite variables: 49 scalarized : 237699
Factor - setup time : 0.95
Factor - dense det. time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 1.63e+07 after factor : 1.63e+07
Factor - dense dim. : 2 flops : 1.15e+10
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 1.0e+00 2.9e+02 3.7e+02 0.00e+00 3.728979592e+02 0.000000000e+00 1.0e+00 2.08
1 7.4e-01 2.1e+02 3.2e+02 -9.88e-01 3.719304136e+02 -7.828392432e-05 7.4e-01 2.34
2 1.2e-01 3.4e+01 1.3e+02 -9.87e-01 3.514496629e+02 1.700256345e-03 1.2e-01 2.58
3 1.8e-02 5.3e+00 3.6e+01 -8.54e-01 2.045420898e+02 2.866275053e-02 1.8e-02 2.83
4 3.7e-03 1.1e+00 5.9e+00 -1.07e-01 5.941925152e+01 6.496061270e-02 3.7e-03 3.03
5 5.2e-04 1.5e-01 2.3e-01 1.74e+00 4.495914487e+00 8.784223341e-02 5.2e-04 3.28
6 1.6e-06 4.6e-04 2.0e-05 1.12e+00 1.041667567e-01 8.860669003e-02 1.6e-06 3.55
7 1.1e-07 3.2e-05 3.8e-07 1.00e+00 1.838516726e-01 1.827591160e-01 1.1e-07 3.78
8 6.6e-09 1.3e-06 3.0e-09 1.00e+00 2.343853251e-01 2.343393361e-01 4.6e-09 4.03
9 6.5e-09 1.3e-06 2.9e-09 9.97e-01 2.344226642e-01 2.343781053e-01 4.5e-09 5.06
10 6.5e-09 1.3e-06 2.9e-09 9.97e-01 2.344226642e-01 2.343781053e-01 4.5e-09 5.59
11 6.5e-09 1.3e-06 2.9e-09 9.97e-01 2.344226642e-01 2.343781053e-01 4.5e-09 6.16
Optimizer terminated. Time: 6.77
Interior-point solution summary
Problem status : UNKNOWN
Solution status : UNKNOWN
Primal. obj: 2.3442266423e-01 nrm: 3e+01 Viol. con: 2e-07 var: 1e-07 barvar: 0e+00
Dual. obj: 2.3437810532e-01 nrm: 3e+02 Viol. con: 0e+00 var: 3e-05 barvar: 2e+53
Optimizer summary
Optimizer - time: 6.77
Interior-point - iterations : 12 time: 6.75
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.00141919
which gives an inaccurate/solved result. The obj value is much larger.
Although SeDuMi failed on this task, I actually cannot see why it failed and the results obtained from SeDuMi fit better to my expectations.
Can anyone please tell me how to read the output from both solvers and how I can improve the implementation?