Skip to main content
Log in

CVXGEN: a code generator for embedded convex optimization

  • Published:
Optimization and Engineering Aims and scope Submit manuscript

Abstract

CVXGEN is a software tool that takes a high level description of a convex optimization problem family, and automatically generates custom C code that compiles into a reliable, high speed solver for the problem family. The current implementation targets problem families that can be transformed, using disciplined convex programming techniques, to convex quadratic programs of modest size. CVXGEN generates simple, flat, library-free code suitable for embedding in real-time applications. The generated code is almost branch free, and so has highly predictable run-time behavior. The combination of regularization (both static and dynamic) and iterative refinement in the search direction computation yields reliable performance, even with poor quality data. In this paper we describe how CVXGEN is implemented, and give some results on the speed and reliability of the automatically generated solvers.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Institutional subscriptions

Fig. 1
Fig. 2
Fig. 3
Fig. 4

Similar content being viewed by others

References

  • Bacher R (1996) Automatic generation of optimization code based on symbolic non-linear domain formulation. In: Proceedings international symposium on symbolic and algebraic computation, pp 283–291

    Google Scholar 

  • Bacher R (1997) Combining symbolic and numeric tools for power system network optimization. Maple Tech Newsl 4(2):41–51

    Google Scholar 

  • Bertsekas DP (1975) Necessary and sufficient conditions for a penalty method to be exact. Math Program 9(1):87–99

    Article  MathSciNet  MATH  Google Scholar 

  • Boyd S, Barratt C (1991) Linear controller design: limits of performance. Prentice-Hall, New York

    MATH  Google Scholar 

  • Boyd S, Vandenberghe L (2004) Convex optimization. Cambridge University Press, Cambridge

    MATH  Google Scholar 

  • Boyd S, El Ghaoui L, Feron E, Balakrishnan V (1994) Linear matrix inequalities in system and control theory. SIAM, Philadelphia

    Book  MATH  Google Scholar 

  • Boyd S, Kim S-J, Patil D, Horowitz MA (2005) Digital circuit optimization via geometric programming. Oper Res 53(6):899–932

    Article  MathSciNet  MATH  Google Scholar 

  • Calvin R, Ray C, Rhyne V (1969) The design of optimal convolutional filters via linear programming. IEEE Trans Geosci Electron 7(3):142–145

    Article  Google Scholar 

  • Cristianini N, Shawe-Taylor J (2000) An introduction to support vector machines and other kernel-based learning methods. Cambridge University Press, Cambridge

    Google Scholar 

  • Cornuejols G, Tütüncü R (2007) Optimization methods in finance. Cambridge University Press, Cambridge

    MATH  Google Scholar 

  • Davis TA (2003) UMFPACK User Guide.Available from http://www.cise.ufl.edu/research/sparse/umfpack

  • Davis TA (2006) CHOLMOD User Guide. Available from http://www.cise.ufl.edu/research/sparse/cholmod/

  • Dahleh MA, Diaz-Bobillo IJ (1995) Control of uncertain systems: a linear programming approach. Prentice-Hall, New York

    MATH  Google Scholar 

  • Duff IS, Erisman AM, Reid JK (1989) Direct methods for sparse matrices. Oxford University Press, London

    MATH  Google Scholar 

  • Eldar YC, Megretski A, Verghese GC (2003) Designing optimal quantum detectors via semidefinite programming. IEEE Trans Inf Theory 49(4):1007–1012

    Article  MathSciNet  MATH  Google Scholar 

  • Grant M, Boyd S (2008a) CVX: Matlab software for disciplined convex programming (web page and software). http://www.stanford.edu/~boyd/cvx/, July 2008

  • Grant M, Boyd S (2008b) Graph implementations for nonsmooth convex programs. In: Blondel V, Boyd S, Kimura H (eds) Recent advances in learning and control (a tribute to M. Vidyasagar). Springer, Berlin, pp 95–110

    Chapter  Google Scholar 

  • Grant M, Boyd S, Ye Y (2006) Disciplined convex programming. In: Liberti L, Maculan N (eds) Global optimization: from theory to implementation: nonconvex optimization and its applications. Springer, New York, pp 155–210

    Google Scholar 

  • Graham R, Grötschel M, Lovász L (1996) Handbook of combinatorics, vol 2. MIT Press, Cambridge, Chap 28

    Google Scholar 

  • Grant M (2004) Disciplined convex programming. PhD thesis, Department of Electrical Engineering, Stanford University, December 2004

  • Gill PE, Saunders MA, Shinnerl JR (1996) On the stability of Cholesky factorization for symmetric quasidefinite systems. SIAM J Matrix Anal Appl 17(1):35–46

    Article  MathSciNet  MATH  Google Scholar 

  • del Mar Hershenson M, Boyd S, Lee TH (2001) Optimal design of a CMOS op-amp via geometric programming. IEEE Trans Comput-Aided Des Integr Circuits Syst 20(1):1–21

    Article  Google Scholar 

  • del Mar Hershenson M, Mohan SS, Boyd S, Lee TH (1999) Optimization of inductor circuits via geometric programming. In: Design automation conference. IEEE Computer Society, Los Alamitos, pp 994–998

    Google Scholar 

  • Johnson SC (1975) Yacc: Yet another compiler-compiler. Computing Science Technical Report, 32

  • Kant E (1993) Synthesis of mathematical-modeling software. IEEE Softw 10(3):30–41

    Article  Google Scholar 

  • Kelly FP, Maulloo AK, Tan DKH (1998) Rate control for communication networks: shadow prices, proportional fairness and stability. Journal of the Operational Research society, 237–252,

  • Löfberg J (2004) YALMIP: a toolbox for modeling and optimization in MATLAB. In: Proceedings of the CACSD conference, Taipei, Taiwan. http://control.ee.ethz.ch/~joloef/yalmip.php

    Google Scholar 

  • Markowitz H (1952) Portfolio selection. J Finance 7(1):77–91

    Article  Google Scholar 

  • Mattingley J, Boyd S (2008) CVXMOD: convex optimization software in Python (web page and software). http://cvxmod.net/, August 2008

  • Mattingley JE, Boyd S (2009a) Automatic code generation for real-time convex optimization. In: Palomar DP, Eldar YC (eds) Convex optimization in signal processing and communications. Cambridge University Press, Cambridge

    Google Scholar 

  • Mattingley JE, Boyd S (2009b) Real-time convex optimization in signal processing. IEEE Signal Process Mag 23(3):50–61

    Google Scholar 

  • Mattingley JE, Wang Y, Boyd S (2010) Code generation for receding horizon control. In: Proceedings IEEE multi-conference on systems and control, September 2010, pp 985–992

    Google Scholar 

  • Mehrotra S (1992) On the implementation of a primal-dual interior point method. SIAM J Optim 2:575

    Article  MathSciNet  MATH  Google Scholar 

  • Nesterov Y, Nemirovskii A (1994) Interior point polynomial algorithms in convex programming, vol 13. SIAM, Philadelphia

    Book  MATH  Google Scholar 

  • Nocedal J, Wright SJ (1999) Numerical optimization. Springer, Berlin

    Book  MATH  Google Scholar 

  • Saunders MA (1995) Solution of sparse rectangular systems using LSQR and CRAIG. BIT Numer Math 35:588–604

    Article  MathSciNet  MATH  Google Scholar 

  • Saunders MA (1996) Cholesky-based methods for sparse least squares: the benefits of regularization. In: Adams L, Nazareth JL (eds) Linear and nonlinear conjugate gradient-related methods. Proceedings of AMS-IMS-SIAM joint summer research conference. SIAM, Philadelphia, pp 92–100

    Google Scholar 

  • Shi C, Brodersen RW (2004) Automated fixed-point data-type optimization tool for signal processing and communication systems. In: ACM IEEE design automation conference, pp 478–483

    Google Scholar 

  • IEEE Journal of Selected Topics in Signal Processing, December 2007, Special Issue on Convex Optimization Methods for Signal Processing

  • Sturm J (1999) Using SeDuMi 1.02, a MATLAB toolbox for optimization over symmetric cones. Optim Methods Softw 11:625–653. Software available at http://sedumi.ie.lehigh.edu/

    Article  MathSciNet  Google Scholar 

  • Sturm JF (2002) Implementation of interior point methods for mixed semidefinite and second order cone optimization problems. Optim Methods Softw 17(6):1105–1154

    Article  MathSciNet  MATH  Google Scholar 

  • Toh KC, Todd MJ, Tütüncü RH (1999) SDPT3—a Matlab software package for semidefinite programming, version 1.3. Optim Methods Softw 11(1):545–581

    Article  MathSciNet  Google Scholar 

  • Tuma M (2002) A note on the LDL T decomposition of matrices from saddle-point problems. SIAM J Matrix Anal Appl 23(4):903–915

    Article  MathSciNet  MATH  Google Scholar 

  • Vanderbei RJ (1995) Symmetric quasi-definite matrices. SIAM J Optim 5(1):100–113

    Article  MathSciNet  MATH  Google Scholar 

  • Vandenberghe L (2010) The cvxopt linear and quadratic cone program solvers. http://abel.ee.ucla.edu/cvxopt/documentation/coneprog.pdf, March 2010

  • Vapnik VN (2000) The nature of statistical learning theory, 2nd edn. Springer, Berlin

    MATH  Google Scholar 

  • Vanderbei RJ, Carpenter TJ (1993) Symmetric indefinite systems for interior point methods. Math Program 58(1):1–32

    Article  MathSciNet  MATH  Google Scholar 

  • Wang Y, Boyd S (2008) Fast model predictive control using online optimization. In: Proceedings IFAC world congress, July 2008, pp 6974–6997

    Google Scholar 

  • Wei DX, Jin C, Low SH, Hegde S (2006) FAST TCP: motivation, architecture, algorithms, performance. IEEE/ACM Trans Netw 14(6):1246–1259

    Article  Google Scholar 

  • Wright SJ (1997) Primal-dual interior-point methods. SIAM, Philadelphia

    Book  MATH  Google Scholar 

  • Ye Y (1997) Interior point algorithms: theory and analysis. Wiley, New York

    Book  MATH  Google Scholar 

Download references

Acknowledgements

We are grateful to Lieven Vandenberghe for some very helpful discussions, including suggesting the initialization method and algorithm of Sect. 5.2. We also thank early users of CVXGEN, including Yang Wang and Craig Beal, for important bug reports and suggestions. We are indebted to Lars Blackmore and Behcet Acikmese for helpful feedback on an early version of this paper.

The research reported here was supported in part by JPL contract 1400723, and NASA grant NNX07AEIIA. Jacob Mattingley was supported in part by a Lucent Technologies Stanford Graduate Fellowship.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jacob Mattingley.

Rights and permissions

Reprints and permissions

About this article

Cite this article

Mattingley, J., Boyd, S. CVXGEN: a code generator for embedded convex optimization. Optim Eng 13, 1–27 (2012). https://doi.org/10.1007/s11081-011-9176-9

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s11081-011-9176-9

Keywords

Navigation