Cvxpy: Making CVXPY flow faster

Created on 6 Aug 2020  路  3Comments  路  Source: cvxgrp/cvxpy

Hi!
First off, thanks for creating such an amazing library. I have been using it for a few days now. I am using it for solving a linear programming problem.

My problem consists of a target vector and a set of vectors (let's name it base set). The target vector is assumed to be a linear combination of some of the base set vectors plus noise. The goal is to determine the weights (scalar term in the linear combination) corresponding to each of the base set vectors that would minimize the MSE between the weighted linear combination of base and target vector.

The optimization objective is to minimize MSE between the predicted vector (obtained by using weights determined by cvxpy) and the target vector. The constraints are that each weight should be between 0 and 1, and should sum to 1.

This process becomes time-consuming as the size of base set increases (it can contain about 2000 base vectors). Each vector is of size (3000,1). And in our case, we need to repeat this exercise for ~4000 different base sets/ targets

I have tried ECOS and SCS solvers, but with no major improvements in speed. I'm looking for suggestions/ approaches which can help speed up the above task.

Thanks

Most helpful comment

You could solve the 4000 different LPs in parallel. cvxpylayers has some functionality for doing this: https://github.com/cvxgrp/cvxpylayers,
but it would probably be easier to do yourself using Python multiprocessing.

All 3 comments

You could solve the 4000 different LPs in parallel. cvxpylayers has some functionality for doing this: https://github.com/cvxgrp/cvxpylayers,
but it would probably be easier to do yourself using Python multiprocessing.

corresponding to each of the base set vectors that would minimize the MSE between the weighted linear combination of base and target vector.

Have you tried using the OSQP solver? This might also improve the speed of each individual task. As @SteveDiamond mentioned, it might also be good to solve these in parallel.

@PartheshSoni for parallel computing you can use Dask. See https://github.com/cvxgrp/cvxpy/issues/1021.

I'm marking this issue as closed because its scope isn't well defined (beyond the suggestions made already).

Was this page helpful?
0 / 5 - 0 ratings