You are here

Developments in Code Generation with CVXPY

11 October 2024
11:00 am
San Francesco Complex - classroom 1

We introduce CVXPYgen, a tool for generating custom C code, suitable for embedded applications, that solves a parametrized class of convex optimization problems. CVXPYgen is based on CVXPY, a Python-embedded domain-specific language that supports a natural syntax (that follows the mathematical description) for specifying convex optimization problems. Along with the C implementation of a custom solver, CVXPYgen creates a Python wrapper for prototyping and desktop (non-embedded) applications. We give two examples, position control of a quadcopter and back-testing a portfolio optimization model. CVXPYgen outperforms a state-of-the-art code generation tool in terms of problem size it can handle, binary code size, and solve times. Further, we present our newest extension for evaluating the derivative of the solution with respect to the parameters, \ie, differentiating through the optimization problem, with custom C code and a Python wrapper. While differentiating through convex optimization problems is not new, CVXPYgen is the first tool that generates custom C code for the task, and increases the computation speed by more than an order of magnitude compared to CVXPYlayers, a general-purpose tool for differentiating through convex optimization problems. CVXPYgen and the generated implementations are open-source.

 

Join at: imt.lu/aula1

relatore: 
Maximilian Schaller, Stanford University
Units: 
DYSCO