cvxpylayers
cvxpylayers copied to clipboard
CvxpyLayer initialization for larger (n~5000) sparse QP
Hello,
First of all thanks for making this this great package available.
I have a sparse QP problem with with n~5000 variables. Is there anyway to speed up the CvxpyLayer initialization? right now, initialization takes over 10 minutes (until stopped, did not finish). Even for n=1500, initialization takes a little under 5 minutes, which seems long.
I saw the previous issue on the subject, and it was from several years ago, so I was wondering If there are other ways to handle this now.
Furthermore, in my problem the matrix A is very sparse, if that helps. The problem does not seem to be cvxpy, as when I use it to solve my QP, the solution is very fast:
`
#using cvxpy
objective = cp.Minimize((1 / 2) * cp.quad_form(x, A_tch.numpy()))
constraints = [eq_tch.numpy() @ x == b_tch.numpy()]
problem = cp.Problem(objective, constraints)
sol = problem.solve()`
`
# using cvxpylayers
x = cp.Variable(n)
A = cp.Parameter((n, n), sparsity=True)
eq = cp.Parameter((12, n))
b = cp.Parameter(12)
objective = cp.Minimize(0.5 * cp.pnorm(A @ x, p=2))
constraints = [eq @ x == b]
problem = cp.Problem(objective, constraints)
# this takes a long time
cvxpylayer = CvxpyLayer(problem, parameters=[A,eq,b], variables=[x])
A_sqrt_torch = torch.cholesky(A_tch)
solution, = cvxpylayer(A_sqrt_torch , eq_tch, b_tch)
`
Can anything be done?
Thanks!
@amir90 I am facing the same issue. Were you able to find any resolution to this?
No, sadly not. I converted my problem to a linear system insteaf of a qp.
בתאריך יום ג׳, 22 ביוני 2021, 14:44, מאת Aaditya Chandrasekhar < @.***>:
@amir90 https://github.com/amir90 I am facing the same issue. Were you able to find any resolution to this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cvxgrp/cvxpylayers/issues/109#issuecomment-865912430, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB55ZP77OWAB3DJB345Q26TTUBZRNANCNFSM45SHYY2Q .