def solve_random_qp(n, solver):
M, b = random.random((n, n)), random.random(n)
P, q = dot(M.T, M), dot(b, M).reshape((n,))
G = toeplitz([1., 0., 0.] + [0.] * (n - 3), [1., 2., 3.] + [0.] * (n - 3))
h = ones(n)
return solve_qp(P, q, G, h, solver=solver)
评论列表
文章目录