Dear Johan,
I'm trying to implement the following GEVP by using both the bisection algorithm and alternatively penlab, as you suggest in the decay rate example. The GEVP I want to solve is the following
given a full-rank matrix M, determine P>0, Q>0, t >1, such that
t is minimized, and
t*Q>=M'*P*M>=Q, t>1.
I tried with the bisection and alternatively I used penlab as well. The solvers state that a solution is found, but when I check the numerical values of P and Q, they are not positive definite (they are not positive semi-definite either).
Am I coding anything wrong?
Enclosed you can find the two minimal working examples. I would be glad if you could tell me what´s going on, as I rechecked the code several times, and it seems consistent to me. In any case for a quick look I'm copying the main functions here too. (the subfunction only hardcodes the input)
Thanks in advance,
Best Regards,
Marco
%%%%%% EXAMPLE 1 - use of bisection
function GEVP_testing
% solving GEVP problem s.t.
% P>0, Q>0, (t)*Q>=M'*P*M>=Q, t>1
% load the matrix
M = load_M;
% check the rank
if (rank(M)-size(M,1))<0
disp('matrix is not full-ranked');
return
end
% cond number
c0 = cond(M);
% define the dimensions of the matrices P and Q
dim = size(M);
p = dim(1);
q = dim(2);
% define in Yalmip the matrices P and Q, and the variable t; they must be PSD matrices
t = sdpvar(1,1);
P = sdpvar(p,p,'diagonal');
Q = sdpvar(q,q,'diagonal');
% define matrices to ensure P and Q are PD
eps_p = 1e-15*eye(p);
eps_q = 1e-15*eye(q);
% define the LMI problem
Objective = t;
% the LMI is defined here - eps_p and eps_q ensure the PD of P and Q. since
% t has to be larger than 1, but don't explicitly bound it, we include a
% +1, and t_true = t+1;
F = [P-eps_p>=0, Q-eps_q>=0, Q<=M'*P*M, (t+1)*Q>=M'*P*M];
% set the solver and use the bisection command
h_opt = bisection(F, Objective,sdpsettings('solver','sedumi'))
% check the positive definiteness
% check the positive definiteness
positivedefinite = prod((eig(value(P))>0)) && prod((eig(value(Q))>0));
if positivedefinite==0
disp('not positive definite')
end
% end of test
%%%%% EXAMPLE 2 - use of penlab
function GEVP_testing_alternative
% solving GEVP problem s.t.
% P>0, Q>0, (t)*Q>=M'*P*M>=Q, t>1
% load the matrix
M = load_M;
% check the rank
if (rank(M)-size(M,1))<0
disp('matrix is not full-ranked');
return
end
% cond number
c0 = cond(M);
% define the dimensions of the matrices P and Q
dim = size(M);
p = dim(1);
q = dim(2);
% define in Yalmip the matrices P and Q, and the variable t; they must be PSD matrices
t = sdpvar(1,1);
P = sdpvar(p,p,'diagonal');
Q = sdpvar(q,q,'diagonal');
% define matrices to ensure P and Q are PD
eps_p = 1e-15*eye(p);
eps_q = 1e-15*eye(q);
% version without eps_p and eps_q - not working
% F = [P>=0, Q>=0, Q<=M'*P*M, t*Q>=M'*P*M, c0 >= t >= 2];
F = [P>=eps_p, Q>=eps_q, Q<=M'*P*M, (t)*Q>=M'*P*M, c0 >= t >= 2];
Objective = t;
% version with bmibnb - not working
% sol = optimize(F,t,sdpsettings('solver','bmibnb'));
sol = optimize(F,t,sdpsettings('solver','penlab'));
% check the positive definiteness
positivedefinite = prod((eig(value(P))>0)) && prod((eig(value(Q))>0));
if positivedefinite==0
disp('not positive definite')
end
end