Custom rust solvers speed up convex optimization problem solving

Generation of Custom Solvers in Rust for Convex Optimization

Computational Engineering, Finance, and ScienceMachine LearningMathematical Software

Summary

Convex optimization involves finding the best solution within a set of constraints, which can be slow with general solvers. The authors created cvxgenrust, a tool that generates specialized Rust code to solve these problems faster. It works by translating problem families from CVXPY into efficient Rust programs that use the Clarabel solver directly. Their tests show that this approach reduces the time to find solutions compared to solving directly in CVXPY and performs similarly to existing specialized tools.

What this means in practice

  • For optimization engineers: Generate fast, customized Rust solvers for repeated convex optimization problems to reduce computation time in real-time systems.
  • For financial modelers: Implement efficient custom solvers for portfolio optimization and risk analysis problems using Rust integrated with CVXPY models.

Authors

Hao Zhu, Joschka Boedecker

Abstract

We introduce cvxgenrust, an open-source tool for generating custom Rust code that solves families of parameterized convex optimization problems modeled in CVXPY. cvxgenrust canonicalizes a problem family, extracts affine maps to Clarabel cone-program data, and generates a specialized Rust crate that updates parameters and calls Clarabel natively at runtime. The generated solver can also be exposed to Python and registered as a custom CVXPY solver. Our code generator supports a wide range of convex optimization problems up to semidefinite programs and exponential-cone problems. Numerical experiments show reduced runtime relative to direct CVXPY solves and performance comparable to CVXPYgen on shared problem classes.