Disciplined Convex Stochastic Programming: A New Framework for Stochastic Optimization

Alnur Ali, J. Zico Kolter, Steven Diamond, Stephen P. Boyd

Abstract

This paper introduces Disciplined Convex Stochastic Programming (DCSP), a modeling framework and Python library (cvxstoc) designed to simplify the specification and solution of convex optimization problems involving random variables. By extending the Disciplined Convex Programming (DCP) approach, DCSP automates the verification of convexity and the translation of complex stochastic constructs—such as expectations and chance constraints—into forms compatible with standard solvers.

Introduction

Optimization is a cornerstone of modern engineering, yet real-world problems are frequently characterized by uncertainty. Practitioners often need to optimize for average outcomes (expectations) or ensure constraints hold with high probability (chance constraints). Traditionally, stochastic optimization has faced a high barrier to entry, requiring modelers to manually transform mathematical formulations into specific, solver-friendly formats while rigorously verifying convexity.

DCSP bridges this gap, allowing researchers to write code that closely mirrors mathematical notation while the framework handles the underlying complexities of stochastic translation and convexity verification.

Methodology

DCSP is built upon the foundation of Disciplined Convex Programming (DCP), the logic powering the cvxpy library. DCP utilizes a library of "atoms" (basic convex functions) and formal composition rules to guarantee problem convexity. DCSP extends this with three critical building blocks:

  1. Expectations: Modelers can wrap convex expressions in an expectation() atom. The framework primarily employs Sample Average Approximation (SAA)—drawing samples from a distribution to approximate the mean—though it can compute exact expectations for discrete variables.
  2. Partial Optimization: This new atom enables optimization over a subset of variables, providing the mathematical framework for two-stage stochastic programs. This allows for immediate decision-making (stage one) followed by "recourse" actions (stage two) once uncertainty is resolved.
  3. Chance Constraints: To handle typically non-convex "probability of success" constraints, DCSP automatically substitutes them with conservative convex approximations based on the perspective of a convex function, closely related to Conditional Value-at-Risk (CVaR).

The framework is implemented in the open-source Python package cvxstoc.

Key Insights

  • Random Variables as Constants: A fundamental insight is that for convexity verification, random variables can be treated as constants. Since the expectation of a convex function remains convex, the framework only needs a robust method to approximate its value.
  • The Power of Partial Optimization: By treating the optimal value of a sub-problem as a convex atom, the authors provide an elegant way to handle multi-stage problems without requiring the user to flatten their model into a single massive matrix.
  • Expressivity in Code: The paper emphasizes the reduction in boilerplate code. For instance, a News Vendor problem that might require over 100 lines in other frameworks can be expressed in just a few intuitive lines using cvxstoc.

Key Results

Convergence of Sample Average Approximation

The authors demonstrate the effectiveness of the SAA approach using a stochastic least squares problem. The results show that the SAA optimal value $\hat{p}^*_N$ converges to the true analytical optimal value $p^*$ as the number of Monte Carlo samples increases.

Convergence of the SAA optimal value $\hat{p}^*_N$ to the true optimal value $p^*$ as the number of samples $N$ increases.

Risk Management and Chance Constraints

In portfolio optimization, the framework's approach to chance constraints is validated. While the convex CVaR-based approximation is more conservative than the non-convex Value-at-Risk (VaR) approach, it remains computationally tractable and provides a safer risk guarantee. The convergence of the CVaR estimate is observed as the sample size grows.

Comparison of VaR and CVaR optimal values, illustrating the convergence of the CVaR estimate $\hat{p}^*_N$ toward the true value.

Limitations and Future Work

Despite its advantages, the framework has limitations. SAA is a biased estimator of the true optimal value; for instance, it may underestimate the "true" cost in some scenarios. Furthermore, high-dimensional problems or heavy-tailed distributions may require significantly higher sample counts, increasing computational overhead. The convex approximations for chance constraints are inherently conservative and may reject solutions that technically meet probability requirements but fall outside the "safe" convex boundary.

Future development may integrate more sophisticated variance-reduction techniques, Markov Chain Monte Carlo (MCMC) methods, or specialized stochastic solvers to enhance performance and accuracy.

Summary updated

BibTeX
@inproceedings{ali2015disciplined,
  author = {Alnur Ali and J. Zico Kolter and Steven Diamond and Stephen P. Boyd},
  title = {{Disciplined Convex Stochastic Programming: A New Framework for Stochastic Optimization}},
  booktitle = {Conference on Uncertainty in Artificial Intelligence},
  year = {2015},
}
Figure