GithubHelp home page GithubHelp logo

lqp_py's Introduction

lqp_py

lqp_py (learning quadratic programs) is a Python package for efficiently solving medium to large scale batch box-constrained quadratic programs. The QP solver is implemented as a custom PyTorch module. The forward solver invokes a basic implementation of the ADMM algorithm. Backward differentiation is performed by implicit differentiation of a fixed-point mapping customized to the ADMM algorithm.

For more information please see our publication:

Computational Optimization and Applications

arXiv (preprint)

parametric quadratic program

Core Dependencies:

To use the ADMM solver you will need to install numpy and Pytorch. If you want to invoke the SCS solver then you will need to install scs and SciPy.

Please see requirements.txt for full build details.

Runtime Experiments:

The demo directory contains simple demos for forward solving and backward differentiating through the ADMM solver. The following runtime experiments are available in the experiments directory.

All experiments are conducted on an Apple Mac Pro computer (2.6 GHz 6-Core Intel Core i7,32 GB 2667 MHz DDR4) running macOS ‘Monterey’.

Experiment 1:

Runtime: dz = 10 Runtime: dz = 50
runtime dz 10 runtime dz 50
Runtime: dz = 100 Runtime: dz = 250
runtime dz 100 runtime dz 250
Runtime: dz = 500 Runtime: dz = 1000
runtime dz 500 runtime dz 1000

Computational performance of ADMM FP, ADMM KKT, ADMM Unroll, Optnet and SCS for various problem sizes (dz). Batch size = 128 and stopping tolerance = 10^-5.

Experiment 2:

Runtime: dz = 500 Convergence: dz = 500
runtime dz 500 convergence dz 500

Training loss and computational performance for learning p. Problem setup: dz = 500, batch size = 32, epochs = 100, and stopping tolerance = 10^-5.

Notes: Limitations and Future Improvements

  1. Most importantly, the lqp ADMM solver is capabale of only solving Quadratic Programs (QP) with linear equality constraints and box constraints. If your QP contains more general constraints then we recommend qpth or cvxpylayers.

  2. Computational performance may differ from exactly what is reported in the paper. In our experience, computational speed seems to be dependent on the hardware, language (Python or R) and package versions used for computations. Importantly, for large problems (number of decision variables > 500 and batch size > 64) the RAM consumption will cause a considerable slowdown. Making the forward and backward routines more memory efficient is a high priority.

  3. When using ADMM solver, it is important that the QP variables are properly scaled and that the ADMM parameter (rho) is set appropriately. The ADMM solver now supports automatic scaling and parameter selection.

  • scale=True: automatic scaling of problem data.
  • rho=None: automatic rho selection.
  • adaptive_rho=True: dynamically tune rho based on primal/dual residuals.

Automatic scaling and parameter selection is a relatively new feature. If convergence is slow then we recommend that the user experiment with the scale of the QP input variables and manually scale the data for their particular use-case.

  1. Convergence of ADMM (and first-older solvers in general) can slow down if the matrix Q is rank deficient. We are currently exploring acceleration methods to improve convergence for rank deficient Q cases.

lqp_py's People

Contributors

butl3ra avatar cube1324 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.