1n×n
minimizesubject to⟨On,X⟩x11=x22=⋯=xnn=1X⪰On
Si l'on a des contraintes supplémentaires, telles que des contraintes de rareté
xij=0 for all (i,j)∈Z⊂[n]×[n]
X≥On
minimizesubject to⟨On,X⟩x11=x22=⋯=xnn=1xij=0 for all (i,j)∈Z⊂[n]×[n]X≥OnX⪰On
3×3
x13=0x12,x23≥0
cvx_begin sdp
variable X(3,3) symmetric
minimize( trace(zeros(3,3)*X) )
subject to
% put ones on the main diagonal
X(1,1)==1
X(2,2)==1
X(3,3)==1
% put a zero in the northeast and southwest corners
X(1,3)==0
% impose nonnegativity
X(1,2)>=0
X(2,3)>=0
% impose positive semidefiniteness
X >= 0
cvx_end
Exécution du script,
Calling sedumi: 8 variables, 6 equality constraints
------------------------------------------------------------
SeDuMi 1.21 by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
eqs m = 6, order n = 6, dim = 12, blocks = 2
nnz(A) = 8 + 0, nnz(ADA) = 36, nnz(L) = 21
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 3.00E+000 0.000
1 : -1.18E-001 6.45E-001 0.000 0.2150 0.9000 0.9000 1.86 1 1 1.2E+000
2 : -6.89E-004 2.25E-002 0.000 0.0349 0.9900 0.9900 1.52 1 1 3.5E-001
3 : -6.48E-009 9.72E-007 0.097 0.0000 1.0000 1.0000 1.01 1 1 3.8E-006
4 : -3.05E-010 2.15E-009 0.000 0.0022 0.9990 0.9990 1.00 1 1 1.5E-007
5 : -2.93E-016 5.06E-015 0.000 0.0000 1.0000 1.0000 1.00 1 1 3.2E-013
iter seconds digits c*x b*y
5 0.3 5.8 0.0000000000e+000 -2.9302886987e-016
|Ax-b| = 1.7e-015, [Ay-c]_+ = 6.1E-016, |x|= 2.0e+000, |y|= 1.5e-015
Detailed timing (sec)
Pre IPM Post
1.563E-001 2.500E-001 1.094E-001
Max-norms: ||b||=1, ||c|| = 0,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 1.
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): +0
Voyons quelle solution CVX a trouvé,
>> X
X =
1.0000 0.4143 0
0.4143 1.0000 0.4143
0 0.4143 1.0000
Cette matrice est-elle semi-définie positive? Définie positive?
>> rank(X)
ans =
3
>> eigs(X)
ans =
1.5860
1.0000
0.4140
Il est définitivement défini, comme prévu. Nous pouvons trouver des matrices de corrélation semi-définies positives en choisissant une fonction objective non nulle (linéaire).