Teljes Matlab script kiegészítő függvényekkel.
File: LMI_tricks.m Author: Peter Polcz (ppolcz@gmail.com)
Created on 2017. November 21.
global SCOPE_DEPTH VERBOSE LATEX_EQNR
SCOPE_DEPTH = 0;
VERBOSE = 1;
LATEX_EQNR = 0;
C = sdpvar(2,3);
sdpopts = sdpsettings('verbose', 0);
mu = 10000;
optimize( [ mu*eye(2) C ; C' eye(3) ] >= 0 , sum(C(:)) , sdpopts);
val_C = value(C)
val_C = -40.8248 -40.8248 -40.8248 -40.8248 -40.8248 -40.8248
optimize( [ mu*eye(2) C ; C' eye(3) ] >= 0 , -sum(C(:)) , sdpopts);
val_C = value(C)
val_C = 40.8248 40.8248 40.8248 40.8248 40.8248 40.8248
optimize( [ mu*eye(2) C ; C' eye(3) ] >= 0 , C(1) , sdpopts);
val_C = value(C)
val_C =
-100.0000 0 0
0 0 0
optimize( [ mu*eye(2) C ; C' eye(3) ] >= 0 , C(1)+C(3) , sdpopts);
val_C = value(C)
val_C = -70.7107 -70.7107 0 -0.0000 0.0000 0
a = 5;
b = 3;
A = sdpvar(5);
R = sdpvar(5,3);
M = [
A R
R' zeros(b)
];
sdpopts = sdpsettings('solver','mosek');
optimize([ A <= -1e-10 , M >= 0 ] , [], sdpopts)
A = value(A);
M = value(M);
eig(A), eig(M)
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 30
Cones : 0
Scalar variables : 0
Matrix variables : 2
Integer variables : 0
Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator - tries : 0 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.00
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 30
Cones : 0
Scalar variables : 0
Matrix variables : 2
Integer variables : 0
Optimizer - threads : 4
Optimizer - solved problem : the primal
Optimizer - Constraints : 30
Optimizer - Cones : 0
Optimizer - Scalar variables : 0 conic : 0
Optimizer - Semi-definite variables: 2 scalarized : 51
Factor - setup time : 0.00 dense det. time : 0.00
Factor - ML order time : 0.00 GP order time : 0.00
Factor - nonzeros before factor : 465 after factor : 465
Factor - dense dim. : 0 flops : 1.44e+04
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 0.0e+00 1.0e+00 1.0e+00 0.00e+00 -5.000000000e-10 0.000000000e+00 1.0e+00 0.00
Optimizer terminated. Time: 0.01
MOSEK DUAL INFEASIBILITY REPORT.
Problem status: The problem is dual infeasible
Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -5.0000000000e-10 nrm: 1e+00 Viol. con: 0e+00 barvar: 0e+00
Optimizer summary
Optimizer - time: 0.01
Interior-point - iterations : 0 time: 0.01
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
ans =
struct with fields:
yalmiptime: 0.1463
solvertime: 0.0187
info: 'Infeasible problem (MOSEK)'
problem: 1
ans =
0
0
0
0
0
ans =
0
0
0
0
0
0
0
0
$$ P \succeq 0 \overset{?}{\Leftrightarrow} \pmqty{P & R \\ R^T & 0} \succeq 0 $$
Válasz: nem, mivel. Attól, hogy $P \succeq 0$ még létezhet $R$ ú.h. $\pmqty{P & R \\ R^T & 0}$ indefinit lesz.
a = 5;
b = 3;
P = randn(a);
P = P*P';
R = randn(a,b);
\begin{align} {\LARGE(1) \quad}
\text{Sajátértékek}: \left(\begin{array}{cccccccc}
-2.05 & -0.778 & -0.646 & 1.81 & 2.38 & 6.41 & 8.11 & 17.5 \\
\end{array}\right)
\end{align}
Fordítva igaz-e? Sejtés: igen.