Search code examples
pythonmatlabconvex-optimizationcvxpy

Block LMI in CVXPY


I want to translate a LMI-constrained optimization problem from Matlab to Python. While reading the CVXPY documentation, I found that I can define an LMI-constrained problem by creating a matrix variable and adding the corresponding constraint. However, instead of constraining the problem by a simple LMI, I need to use the following block LMI:

LMI

Where P, L are matrix variables and gamma is a scalar. The other symbols are state space matrices of a dynamic system.

Is it possible to use this kind of LMI as a constraint in CVXPY? If not, is there any other tool that would allow me to solve this problem in Python?


Solution

  • I followed the example posted by Rodrigo de Azevedo and I managed to write the given LMI in cvxpy.

    For reference, the code I wrote, It may be helpful for someone:

    n = A.shape[0]
    
    L = Variable((B2.shape[1], n))
    P = Variable((n, n), PSD=True)
    gamma2 = Variable()
    
    LMI1 = bmat([
            [P, A*P + B2*L, B1, np.zeros((B1.shape[0], D11.shape[0]))],
            [P*A.T + L.T * B2.T, P, np.zeros((P.shape[0], B1.shape[1])), P*C1.T + L.T*D12.T],
            [B1.T, np.zeros((B1.shape[1], P.shape[1])), np.eye(B1.shape[1]), D11.T],
            [np.zeros((C1.shape[0], B1.shape[0])), C1*P + D12*L, D11, gamma2*np.eye(D11.shape[0])]
              ])
    
    cons1 = LMI1 >> 0
    
    cons2 = P == P.T
    cons3 = gamma2 >= 0
    

    And then, to solve the problem:

    optprob = Problem(Minimize(gamma2), constraints=[cons1, cons2, cons3])
    optprob.solve()
    
    norm = np.sqrt(gamma2.value)
    Pop = P.value
    Lop = L.value