LP instead of QP?
lyeskhalil opened this issue · comments
Hi Brandon! Thanks for the great code!
In example-cls-layer, I tried to use an LP layer instead of a QP one, i.e. Q = Variable(torch.zeros(self.nCls, self.nCls))
.
Expectedly, I get RuntimeError: qpth Error: Cannot perform LU factorization on Q. Please make sure that your Q matrix is PSD and has a non-zero diagonal.
Any simple modifications I could make to get the LP working? Perhaps PDIPM is not the best for this special case of QP, but I'm only interested in playing around with this.
Thanks!
Hi Elias! To use the solver with LPs you can add a ridge term by setting Q = Variable(eps*torch.eye(nx))
for some eps
. The ridge term makes the Hessian invertible for the default PDIPM solver in qpth
and is also useful analytically since the solution of an unregularized LP is piecewise constant w.r.t. the parameters of the problem which makes the gradients w.r.t. the parameters not very useful
-Brandon.