我正在尝试解决cvxpy中的LMI约束问题。对于某些参数,该程序可以运行,但是我得到了变量值(NoneType
)gamma2.value
。将None作为变量值的原因是什么,这是因为问题不可行吗?我觉得在文档上找不到任何有用的信息。另外,我在Matlab中也遇到了同样的问题,并且得到了这组参数的结果。
破坏程序的参数是q
和r
。
可以重现此问题的最小代码:
import numpy as np
from cvxpy import *
q = 0.1
r = 0.1
Ad = np.array([[0.8217916 , 0. , 0. ],
[0. , 0.8217916 , 0. ],
[0. , 0. , 0.38560449]])
Bd = np.array([[ 0. , 0.03995538, -0.03995538],
[-0.0461365 , 0.02306825, 0.02306825],
[ 0.81953625, 0.81953625, 0.81953625]])
Cd = np.eye(3)
Dd = np.zeros((3, 3))
Z = np.zeros((3,3))
I = np.eye(3);
A = np.block([[Ad, Z], [I, I]])
B1 = np.vstack((I, Z))
B2 = np.vstack((Bd, Z))
C1 = np.block([[I, Z], [Z, Z]])
D11 = np.block([[Z], [Z]])
D12 = np.block([[Z], [I]])
C2 = np.block([I, Z])
D21 = Z
D22 = Z
tol = 1e-15
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 >> tol
LMI2 = bmat([
[-r*P, -q*P + A*P + B2*L],
[-q*P + P*A.T + L.T*B2.T, -r*P]
])
cons2 = LMI2 << tol
cons3 = gamma2 >= tol
cons4 = P == P.T
cons5 = P >> tol
optprob = Problem(Minimize(gamma2), constraints=[cons1, cons2, cons3, cons4, cons5])
optprob.solve()
Hinf_norm = np.sqrt(gamma2.value)
Pop = P.value
Lop = L.value
K = Lop.dot(np.linalg.inv(Pop))