qpth icon indicating copy to clipboard operation
qpth copied to clipboard

Accuracy issues with batches

Open PaulR-S opened this issue 4 years ago • 3 comments

Hi, I am using the qpth solver to solve many qp's (i.e. core price computations) as batches in parallel. Now, comparing the prices (resulting variables) with the ones I receive from gurobi shows that the ones from qpth differ quite a bit (see below). It seems like this is more likely to happen with a batch size > 1.

image

I tried to use float and double as well as cpu and gpu. The result of qpth is always the same (or at least very similar).
I also compared the result from cvxpylayer to gurobi and they are very close.

This is what I get when setting verbose to True

image

Do you know why the accuracy is so bad and how it can be improved? I'm using pytorch 1.3.0., qpth 0.0.15, gurobi 8.1.1. Thanks.

PaulR-S avatar Nov 21 '19 14:11 PaulR-S

Hmm, for your problem here, how is the speed in comparison to cvxpylayers? I've been thinking about deprecating this repo and pointing everybody to cvxpylayers

bamos avatar Nov 21 '19 21:11 bamos

Cvxpylayers allows batches, however, not on the GPU but CPU only, correct? For the setting I ran, cvxpylayers was significantly slower, in fact it was slower than parallelizing the batch over multiple CPU's and solving each with Gurobi.

PaulR-S avatar Nov 22 '19 08:11 PaulR-S

Cvxpylayers allows batches, however, not on the GPU but CPU only, correct? For the setting I ran, cvxpylayers was significantly slower, in fact it was slower than parallelizing the batch over multiple CPU's and solving each with Gurobi.

Hmm, I think we if we add in support for other solvers to cvxpylayers we can outperform qpth by using OSQP, for example. I've added an issue to cvxpylayers you can use to track our development on here -- and if you have some bandwidth you are welcome to help out with the development there to get this in faster: https://github.com/cvxgrp/cvxpylayers/issues/28

\cc @bstellato @sbarratt @akshayka

bamos avatar Nov 22 '19 15:11 bamos