Manuscript Offprint
arXiv:2610.07846Scen-Opt: A Scenario Optimization Toolbox for Data-Driven Convex Programming
Abstract
The scenario approach is a well-established statistical framework for data-driven decision-making. In particular, in data-driven optimization, the scenario approach unveils how the problem structure governs out-of-sample generalization, and offers a principled basis for assessing and certifying the reliability of the optimal solution as per constraint satisfaction. Despite its strong theoretical development and wide applicability, no software toolbox has been available to date that enables user-friendly, data-driven convex optimization within the scenario-approach framework. In this paper, we introduce Scen-Opt, an open-source software tool that integrates convex programming with data samples while providing statistical guarantees grounded in scenario theory. Scen-Opt is implemented in Python, supporting data-driven linear, quadratic, and semidefinite programming, and offers a Python-based web application with an intuitive and reactive graphical user interface (GUI) built using modern web technologies. Scen-Opt can be used directly through its online interface or installed locally, accommodating both manual input and data-file uploads (CSV, JSON, TXT, TSV, MAT, Excel, NPY, NPZ, Parquet). Built on a Python backend with a modern JavaScript frontend, Scen-Opt offers a highly user-friendly experience and efficient usability across desktops, laptops, tablets, and mobile devices. In this paper, Scen-Opt is applied to a set of representative benchmarks, demonstrating its practical effectiveness for data-driven convex optimization with guaranteed performance.
Institute for Convergent Software Integrated Systems, Vanderbilt University, USA E-mail: ben.wooding@vanderbilt.edu
Department of Electronics, Information and Bioengineering, Politecnico di Milano, Italy E-mail: simone.garatti@polimi.it
Department of Information Engineering, University of Brescia, Italy E-mail: marco.campi@unibs.it
School of Computing, Newcastle University, UK E-mail: abolfazl.lavaei@newcastle.ac.uk
Wooding et al.
1 Introduction
The increasing availability of data across scientific and engineering domains has fundamentally reshaped decision-making workflows: rather than depending solely on analytical models, which may be inaccurate, overly conservative, or impractical to obtain, there is growing interest in methods that leverage sampled observations directly to inform decision-making [27]. Data can reveal structure, expose model limitations, and support more adaptive strategies. Yet, most data-driven decision procedures offer limited assurances about how the resulting decisions will perform when confronted with new, unseen situations. In many cases, solutions are derived from data but their reliability is assessed only through ad-hoc or post-hoc testing, leaving open the fundamental question of whether such solutions generalize with some robustness beyond the observed sample.
The scenario approach [8,15,12] provides a principled answer to this challenge. Originating in convex optimization and now encompassing a broad class of data-driven decision-making schemes, scenario theory establishes rigorous probabilistic guarantees for decisions obtained from independent and identically distributed (i.i.d.) data. By characterizing the intersection between the decision and the observed data through the notion of complexity, scenario theory offers explicit bounds on the probability that a newly observed uncertainty instance will render the decision inappropriate. This risk quantification is entirely data-driven and does not rely on assumptions about the underlying probability distribution, making it suitable for a wide spectrum of applications [9,22].
When applied to convex optimization, scenario theory attains a particularly elegant form. Each data point is treated as a constraint, the complexity is the number of constraints strictly needed to reconstruct the solution (the so called support list), and the risk corresponds to the probability that a new constraint, unseen at design time, is violated by the computed solution. The structural properties of convex optimization ensure that solutions are globally optimal and unique (when the problem is strictly convex), so the connection between complexity, sample size, and generalization becomes especially transparent. These features have driven the widespread adoption of convex optimization techniques across control theory, robotics, machine learning, data science, signal processing, and many other fields.
Original contributions. Motivated by the central challenge of making reliable decisions when only sampled data are available but robust performance guarantees are still required, this paper introduces Scen-Opt a first-of-its-kind tool that leverages scenario theory to deliver user-friendly, data-driven convex optimization with rigorous probabilistic guarantees, even when only limited sampled data are available.
The main features of the proposed tool are the following:
(i) Scen-Opt leverages a Python backend with a modern JavaScript frontend, powered by a suite of state-of-the-art solvers (27 solvers supported at the time of writing) including CVX toolbox [24] and MOSEK , and supports three classes of scenario optimization programs (i) linear programs (LP), (ii) quadratic programs (QP) and (iii) semidefinite programs (SDP).
(ii) For each of the mentioned scenario programs, Scen-Opt supports four problem configurations: (i) the robust problem, (ii) the relaxed problem, (iii) the regularized problem, and (iv) the general formulation combining relaxation, and regularization.
(iii) Implemented as a responsive and reactive Python Flask web application, Scen-Opt provides an intuitive, user-friendly interface that enables efficient interaction with all scenario-optimization functionalities. Users can access and use the application directly through the web across desktops, laptops, tablets, and mobile devices without any download or installation .
(iv) In addition, Scen-Opt provides a Docker-based version that can be downloaded and executed locally, enabling users to achieve higher performance when leveraging their own computing resources.
(v) The tool supports both manual data entry and data-file uploads for sampled trajectories, providing a user-friendly interface for specifying all required inputs across the different scenario optimization programs. The full program can be uploaded in one-shot via .mat or .json, and results downloaded in the same formats. Scenario-dependent constraints can be provided either symbolically, as expressions in the uncertainty, or numerically, as pre-evaluated per-sample matrices.
Besides describing Scen-Opt, this paper demonstrates its effectiveness through a series of physical benchmarks, spanning all three supported classes of scenario optimization programs and showcasing their corresponding four sub-classes for each program type.
The web-based version of Scen-Opt is accessible at:
https://scen-opt.woodingben.com
The Scen-Opt source code, accompanied by comprehensive installation and usage instructions for the Docker-based version, can be accessed at :
https://github.com/Kiguli/Scen-Opt
Organization. The remainder of the paper is structured as follows. Section 2 reviews the theoretical foundations of the scenario approach in a convex optimization setting that underpin the methods and guarantees used throughout this paper. Section 3 presents the convex optimization programs supported by
https://www.mosek.com/documentation/
https://flask.palletsprojects.com/en/stable/
The server has 24GB RAM and 4 vCPUs, enabling a predicted 20+ simultaneous users with a 50MB maximum uploaded file size and 2 hour timeout for any single program. Heavier computations can be run by installing Scen-Opt to their local machine.
docker pull ghcr.io/kiguli/scen-opt:latest
docker run -p 5000:5000 ghcr.io/kiguli/scen-opt:latest
The version described in this paper (v1.0) is permanently archived at: https://doi.org/10.5281/zenodo.23177690
Wooding et al.
Scen-Opt, outlining the three program classes and their four scenario-based variants implemented for each. Implementation details of the toolbox, including the underlying algorithms, are provided in Section 4, while the web-based graphical interface is described in Section 5. Comprehensive benchmarking results across all supported problem classes are reported in Section 6, and the paper concludes, together with directions for future development, in Section 7.
Related studies on scenario approach. Over the past two decades, the scenario approach has played a central role in advancing data-driven methods for decision-making under uncertainty. The seminal work in [8] introduced scenario-based convex programming for robust control, showing that semi-infinite constraints can be handled through randomized sampling. This line of work was further strengthened in [10, 11], which established explicit probabilistic bounds on violation and extended the framework to settings with discarded or a-posteriori-violated constraints. These developments form the foundation for a broad class of randomized and scenario-based optimization techniques that have since been generalized and applied across numerous domains.
Numerous contributions to the field have been made by many authors. Methods for convex scenario programs with multiple chance constraints are investigated in [40]. The sample complexity of random convex programs with structured uncertainty is characterized in [43], leading to less conservative bounds when exploiting problem structure. A probabilistic connection between the optimal value of scenario convex programs and that of robust and chance-constrained formulations is established in [33], with extensions to certain mixed-integer nonconvex settings; the results are further applied to infinite-dimensional linear programs in [32]. The relationship between compression learning and the original results in scenario optimization is analyzed in [31], while [30] proposes an intermediate approach to chance-constrained optimization that sits between robust optimization and fully randomized scenario methods. Distributed scenario optimization in uncertain multi-agent framework is studied in [29]. Probabilistic guarantees for convex scenario programs where validation tests are exploited to derive tighter confidence bounds on the violation probability are developed in [41]. Finally, [39,38] study exact feasibility properties of convex scenario programs with discarded constraints, providing conditions under which the tightest feasibility guarantees remain valid despite constraint removal.
A major turning point in the theory of the scenario approach is given by the works [16,22,13,21] which introduce the wait-and-judge philosophy and permit assessing generalization after a solution is obtained, using the size of a suitably defined support subsample as a measure of complexity. This enables tight, instance-specific guarantees for a quite general class of decision problems, broadening the applicability of scenario methods far beyond traditional convex optimization settings.
A further shift to enhance the broadest applicability is the new compression-based theory in [14] establishes rigorous control over the probability that newly observed data, which alter a compressed representation, providing tight finite-sample bounds under minimal assumptions. By showing that the compressed-set cardinality consistently estimates this probability in a fully agnostic setting, this abstract framework offers strong support for general observation-driven decision-making and constitutes a foundational tool for modern learning tasks involving uncertainty quantification.
We begin by formalizing the class of convex optimization problems considered in this work.
Definition 1 (Convexity) Let denote a Euclidean space with components. A set is convex if the line segment between any two points in lies entirely within ; that is, for all and any ,
A function is convex if its domain is a convex set and, for all in its domain and any ,
Geometrically, this means that the line segment connecting and lies above the graph of .
Let be a vector of design variables, where . Let , with components, be a parameter that describes the environment to which a decision is applied. In this setting, one can formulate the following scenario program:
The constraints (1b) are expressed as , for each data point , and we allow both regularization of the solution and relaxation of the constraints. The values are per-constraint scalar slack optimization variables used to relax the problem. By selecting , a scenario constraint may be violated, thereby enlarging the feasibility domain for and creating the possibility of finding a solution with lower cost . To control the regret associated with constraint violations, however, the sum of the
Wooding et al.
relaxation parameters, , is also penalized in the objective function (1a). A fixed weight parameter determines the relative importance assigned to the cost and the constraint violations. Regularization is likewise imposed in the objective to encourage the solution to remain near some , with the fixed weight parameter controlling the strength of this regularization. There are special cases of (1) that typically arise as limiting cases, but which we explicitly consider in this work.
Only Constraint Relaxation
subject to: , .
Only Regularization ( and , )
subject to: , .
Robust problem
subject to: , .
The user can choose the formulation which is most appropriate for the problem at hand among these four alternatives. Once a formulation has been selected, let denote the x-component of the corresponding optimal solution (in what follows, there is no need to explicitly consider the optimal components, if any). When problem (1) is solved, it yields , for which the cost can be directly computed.
Assumption 1 We assume that a solution to (1) exists and is unique for every N and for every realization of the 's.
Existence is always guaranteed when there is constraint relaxation (for a compact ; otherwise a small can make the relaxed problem unbounded), while uniqueness is guaranteed whenever there is a strictly convex regularization term with , provided existence holds. The results below apply to regardless of the formulation adopted. The variables and are linked through the concept of appropriateness as in the following definition.
Definition 2 (Appropriateness) The variable x is said to be appropriate for if it satisfies the corresponding requirement induced by ; that is, the satisfaction condition associated with holds when evaluated at x.
In robust optimization, is appropriate for if it lies within the region of feasible decisions induced by . The set of all values of that are appropriate for is denoted by . We assume access to a list of observations of , where each is referred to as a scenario and is used to inform the decision variable . By abuse of notation, the same expression is used even when , in which case the list is interpreted as empty. Formally, is an i.i.d. sample from a probability space , where is the set of all possible uncertainty realizations, is the associated -algebra of measurable subsets of , and is the underlying probability measure governing the sampling process. Although the scenario approach does not require knowledge of the underlying probability space, a distribution-free paradigm, the resulting generalization guarantees still yield insight into the reliability of the decision.
However, the appropriateness of for a new, unseen scenario remains uncertain. This motivates the introduction of the notion of risk, which quantifies the probability that fails to satisfy the requirement induced by a future scenario.
Definition 3 (Risk) The risk quantifies the probability that a newly drawn scenario renders inappropriate. For any , .
The fundamental problem is to estimate , which cannot be computed directly since the probability measure is unknown. Scenario optimization provides a powerful generalization theory that enables one to bound or estimate without requiring any additional samples or any knowledge of the underlying probability distribution.
To analyze how the solution evolves as additional scenarios are incorporated, we consider (1) for some general N. This formulation allows us to track how the feasible set and its optimizer change as new scenarios are added, which is central to the generalization properties of scenario optimization. The following concept of complexity plays a central role in scenario-based theory, as it characterizes the minimal subset of scenarios that fully determine the solution.
Definition 4 (Support List and Complexity) Given a list of scenarios , a support list is the sublist of scenarios that include all those for which and some of those for which , such that:
(i) it allows reconstruction of the solution of the considered problem;
(ii) the sublist is irreducible: no element can be further removed from the sublist without the decision changing.
For a given list , multiple support lists may exist with different cardinalities . The minimal such cardinality among all support lists is called the complexity and is denoted by .
Note that both and depend on the list and are therefore random elements defined on the product probability space ,
Wooding et al.
where the product measure arises from the independence of scenario draws. Finally, we can state the theorems where is the solution of the considered problem for a known N.
Theorem 1 (Risk Certificate) Let be defined as
where, for a prescribed confidence level , the scalar is the unique solution of
Then, for any probability measure , the following distribution-free risk bound holds:
In Theorem 1, the parameter is referred to as the confidence level and is typically chosen to be very small, for example or . The result asserts that , the risk that the solution fails to be appropriate for a new out-of-sample scenario, is upper-bounded with confidence , by . Here, is a known deterministic function evaluated at the complexity of the scenario optimization problem.
Remark 1 The upper bound on the risk provided in Theorem 1 holds for any solution computed by Scen-Opt. In the sequel, we also present a result that yields a corresponding lower bound; however, this requires additional assumptions. While Scen-Opt attempts to detect violations of these assumptions, such checks cannot be performed for out-of-sample scenarios. Consequently, it is ultimately the user's responsibility to assess whether the lower bound remains applicable in cases where Scen-Opt has not flagged a violation.
We now recall a structural property of scenario programs that will play a central role in the forthcoming theorem.
Property 1 (Non-degeneracy) For any N and with probability one with respect to the generation of the scenarios, there exists a unique support list for .
It is often instructive to illustrate degeneracy concretely, in order to clarify the meaning of non-degeneracy. In any optimization problem, one may identify subsets of support constraints whose removal does not alter the optimal solution. Degeneracy arises when multiple distinct subsets of support constraints can be removed while still preserving the solution. A simple example occurs when a support constraint appears multiple times in the list: each repeated instance may be removed independently without affecting the optimizer. As a result, there exist multiple support lists, each omitting a different repetition, despite all having the same complexity.
Theorem 2 (Two-sided Risk Certificate) Given a confidence parameter , for any consider the polynomial equation in the variable
and for , consider instead the polynomial equation
For any , (2a) admits exactly two solutions in , denoted and with . For , (2b) admits exactly one solution in , denoted , which we define with . Let and , for all . Under the assumptions of consistency and non-degeneracy, it holds for any uncertainty space and any probability measure that:
With this theorem, one can bound the risk associated with scenario optimization for any chosen confidence level and any list of scenarios . In our tool, we implement this result using the same numerical procedure described in [14, Appendix B].
3 Scenario Optimization Schemes Covered by the Toolbox
In this section, we present the data-driven convex optimization schemes supported by our toolbox Scen-Opt. The problem formulations are intentionally aligned with the classical exposition in [5] to maintain familiarity, and the underlying implementation of Scen-Opt draws inspiration from the design principles established in the CVX toolbox [24].
We present below the implementation of scenario convex optimization for LP, QP, and SDP programs. As outlined in Section 2, Scen-Opt supports four subclasses for each of these optimization types, : robust, relaxation, regularization, and the combined relaxation-regularization formulation. For consistency, we introduce each class using the relaxation-regularization formulation, as it is the most general case, and then indicate how the other subclasses are obtained through appropriate adaptations.
Throughout, we denote the decision variable by . Each optimization program incorporates the constraints induced by every scenario in the list , together with any additional hard constraints required by the problem structure.
Wooding et al.
3.1 Linear Programming (LP)
We consider the most general case of relaxed-regularized LP as
where and .
LPs are so named because the objective function , where , and all constraint functions in (3b) and (3c) are required to be linear. For arbitrary integers and , the matrix and vector define the hard linear constraints, while the matrix-valued function and vector-valued function specify the linear constraints associated with each scenario .
In what follows, we discuss how the relaxed-regularized LP in (3) can be specialized to obtain each of the other LP subclasses.
Robust LP. The robust LP is obtained by setting , , and for all , and is the strictest LP form available in Scen-Opt. Under these restrictions, the cost function reduces to
and constraint (3b) collapses to the hard linear constraints .
Relaxed LP. The relaxed LP is obtained by setting , thereby reducing the objective function to:
while leaving the constraints (3b), (3c) unchanged.
Regularized LP. The regularized LP corresponds to set and for all . The cost function is given as
while scenario constraints (3b) become .
When regularization is present, different choices of norm are supported by Scen-Opt; the field accepts any order (e.g., or ), for the -norm, or for the Frobenius norm, which for the vector coincides with .
To illustrate the use of scenario optimization for linear programs, we present a simple yet instructive example.

Fig. 1: Robust LP: Smallest enclosing interval example.
Example 1 (Smallest Enclosing Interval.) Consider the problem of determining the smallest interval that contains a collection of sampled points from a one-dimensional space. This task can be naturally formulated as a robust LP, where the decision variable consists of the center and half-width of the interval (cf. Fig. 1), such that .
In this formulation, the robust LP of the form in (3) is specified by the matrices
and the constraint is imposed for each sampled point (scenario) . Since this is a robust LP, we set , , and for all . The corresponding JSON program file is given in Listing 8 in Appendix B.
Scen-Opt supports LP scenario optimization through the following function in Listing 1, with its parameters described in detail in Appendix C.1. This function solves the LP defined in (3) and returns the optimal solution together with the information required to analyze the associated risk, including the complexity and the number of scenarios N. For diagnostic and analysis purposes, the full set of constraints is returned, along with an indicator specifying whether any degeneracy was detected during the solution process (the full solution can also be downloaded).
def solve_lp(deltas, A_d, b_d, G, h, c, tau=0.0, x_ref=np.array([0.0]), rho=0.0, norm_type=2, solver=None, include_slack=None): return x_out, zeta_out, cost_out, N, complexity, constraints, degeneracy
Listing 1: Function to solve LP.
3.2 Quadratic Programming (QP)
We consider the most general case of relaxed-regularized QP as
Each Listing shows python code, the python syntax preassigns values to the optional function variables equivalent to omitting those parameters), but all variables can be assigned by a user in practice. See Appendix C for further details.
Wooding et al.
subject to:
where and .
QPs are so named as their objective includes the quadratic term , where is a symmetric positive-semidefinite matrix, besides the linear term , where . A QP therefore minimizes a convex quadratic function over a polyhedral feasible set. For arbitrary numbers of hard constraints and scenario-dependent constraints , the matrix and vector encode the hard linear constraints, while the matrix-valued function and vector-valued function encode the linear constraints associated with each scenario .
In the following, we describe how the robust–relaxed–regularized QP in (5) can be specialized to recover each of the QP subclasses.
Robust QP. The robust QP in Scen-Opt is obtained by setting , , and all slack variables . Under these restrictions, the cost function becomes
and (5b) reduces to the hard constraints .
Relaxed QP. The relaxed QP is obtained by setting , so resulting in the objective function
while leaving the constraints (5b), (5c) unchanged.
Regularized QP. The regularized QP is obtained by setting and for all . The objective function becomes
while constraints (5b) reduce to the hard constraints .
As in the LP case, different norms are supported by Scen-Optwhen regularization is present.
We motivate the use of scenario optimization for quadratic programs with a common machine-learning classification problem, as illustrated in the following example.
Example 2 (Support Vector Machine) Consider the problem of binary classification, where one seeks a hyperplane that maximizes the separation margin between two labeled classes of data points. We sample points from a 2-dimensional space, where each point is assigned either a blue or a red label (cf.

Fig. 2: Robust QP: Support vector machine example.
Fig. 2), and the aim is to seek the optimal separating hyperplane that maximizes the margin between the two classes. This can be formulated as a robust QP, where the decision variable encodes the hyperplane , with gradient and intercept . The scenario optimization solution can therefore be written as .
A scenario consists of the triple , where is the coordinate of the sample and is its class label. Then the robust QP in (5) is described by the following matrices:
where the constraint is enforced for each scenario .
Relaxed QP. If the data are not linearly separable, the relaxed QP allows one to find a hyperplane that best accommodates the samples by introducing slack variables to handle misclassified points. The JSON program file of the robust QP is given in Listing 9 in Appendix B.
Scen-Opt supports QP scenario optimization through the following function in Listing 2, with its parameters described in detail in Appendix C.2. The function solves the QP in (5) and returns the solution together with all information required for subsequent risk analysis, including the complexity and the number of scenarios N. For completeness, the full set of constraints is also returned, along with a flag indicating whether any degeneracy was detected.
def solve_qp(deltas, A_d, b_d, G, h, c, Q, tau=0.0, x_ref=np.array([0.0]), rho=0.0, norm_type=2, solver=None, include_slack=None): return x_out, zeta_out, cost_out, N, complexity, constraints, degeneracy
Listing 2: Function to solve QP.
Wooding et al.
3.3 Semidefinite Programming (SDP)
Conic optimization is a structured subclass of convex optimization, and semidefinite programming constitutes a fundamental instance of conic optimization, since the set of semidefinite matrices forms a convex cone. Scen-Opt supports SDPs in the inequality form SDP, which naturally generalizes the inequality-based formulations used for LPs and QPs.
Several convex optimization problems can be reformulated or relaxed as an SDP, including LPs, QPs, quadratically-constrained QPs (QCQPs), second-order cone programs (SOCPs), linear matrix inequalities (LMIs), and least-squares problems. This makes Scen-Opt applicable to a wide range of problem classes.
We first consider the inequality form SDP, in which no equality constraints are present, and both hard and soft constraints are expressed as LMIs. Let denote the vector of decision variables. The robust-relaxed-regularized SDP in inequality form can then be written as
subject to:
where , , and denotes the identity matrix.
In (7), is a positive semidefinite symmetric matrix in and . , ..., are symmetric matrices in , these objects define the hard LMI constraint in (7c). Likewise, the symmetric matrix-valued functions , for , generate the LMI constraints associated with each scenario .
Robust SDP. The robust SDP is supported by Scen-Opt and obtained by setting , , and all , which yields the objective
while (7b) reduces to the hard LMI constraints , applied for each scenario .
Relaxed SDP. The relaxed SDP corresponds to setting and results in the objective
while constraints (7b), (7c) remain the same.
Regularized SDP. The regularized SDP is supported by Scen-Opt, with its cost function taking the form
and constraints (7b) becoming the hard LMI constraints .
Similarly to the LP and QP cases, different norms for SDP are supported by the tool when regularization is present.
To demonstrate the use of scenario optimization for SDP inequality form, we present the following illustrative example.
Example 3 (SDP Inequality Form)
Consider a linear parameter-varying (LPV) system with
where is a stable damped oscillator and captures parameter-varying uncertainty in the restoring and damping terms (see Figure 3 for the state trajectories achieved for various fixed values of and initializations). The goal is to find a common quadratic Lyapunov function with certifying stability across all parameter values, i.e. .
This maps to the SDP inequality form (7) with decision variable , the upper-triangular entries of the symmetric matrix . Let , , be the basis matrices for the symmetric space, so that . The scenario-dependent constraint matrices in (7b) are
encoding the Lyapunov inequality . The hard constraint in (7c) enforces via
The objective uses and , while we set and . This amounts to maximizing with light quadratic regularization and constraint relaxation. The corresponding JSON program file is given in Listing 10 in Appendix B.
Scen-Opt provides SDP scenario optimization via a dedicated function in Listing 3, with parameters described in Appendix C.3. This function solves the SDP specified in (7) and returns the optimal solution together with the quantities needed for risk assessment, including the complexity and the number of scenarios N. It also outputs the complete set of constraints and a diagnostic flag indicating whether degeneracy was detected.
Wooding et al.

Fig. 3: Robust SDP: LPV System Example.
def solve_sdp(deltas, F_d, E, c, Q, tau=0.0, x_ref=np.array([0.0]), rho=0.0, norm_type=2, solver=None, include_slack=None): return x_out, zeta_out, cost_out, N, complexity, constraints, degeneracy
Listing 3: Function to solve SDP (Inequality Form)
4 Scen-Opt: Implementation Details
In this section, we outline the algorithms used to evaluate the risk and complexity of a scenario-based convex optimization problem, in accordance with the theory presented in Section 2. As established by Theorem 1 and Theorem 2, the risk associated with a scenario convex optimization solution depends on three quantities: the number of scenarios N, the complexity , and the user-selected confidence level . Among these, the computation of is the most nontrivial task, as it requires identifying a support list, which comprises all constraints violated at the optimum together with an irreducible subset of the active constraints that, jointly, allow reconstruction of the solution (cf. Definition 4). We begin by describing the computation of the risk, followed by the procedures used to determine the complexity and other auxiliary quantities. While is the true complexity, in the implementation we use k for the calculated minimal cardinality, where in non-degenerate cases but for degeneracy (cf. Remark 3).
4.1 Risk
def quantify_risk(k, N, beta): return epsL, epsU
Listing 4: Function to compute risk bounds.
Algorithm 1 Quantifying risk bounds and
Require: Complexity and number of scenarios with , confidence
Ensure: Lower bound and upper bound
1: ▷ Compute lower bound
2:
3: threshold
4: while
5:
6:
7:
8: if then
9:
10: else
11:
12: end if
13: end while
14: ▷ when the loop is skipped and
15: if then ▷ Compute upper bound
16:
17: else
18:
19:
20: while
21:
22:
23:
24: if then
25:
26: else
27:
28: end if
29: end while
30:
31: end if
32: return
The ultimate aim of Scen-Opt is to compute the risk bounds associated with a convex optimization problem solved under the scenario approach. Algorithm 1 summarizes this procedure, assuming that the number of scenarios N, the complexity k, and the user-defined confidence level have already been obtained. The pseudocode follows the implementation strategy of [14, Appendix B], originally presented in MATLAB. The algorithm evaluates the bounds stated in Theorem 2, which hold under the non-degeneracy assumption and rely on the incomplete beta function betainc. The corresponding Python implementation used by Scen-Opt is provided in Listing 4.
Remark 2 When the assumption of non-degeneracy, as defined in Definition 1, is violated, the validity of the two-sided bound in Theorem 2 can no longer be guaranteed. In this case, only the upper bound on the risk remains theoretically sound, whereas the lower bound may fail to hold (see Theorem 1).
Wooding et al.
Algorithm 2 Validating candidate support list
Require: Candidate constraints A, solved optimization problem prob, objective obj, non-scenario constraints R
1: function TEST_SUPPORT(prob, obj, A, R) 2: Solve problem prob' ← Problem(obj, A ∪ R) 3: return True iff the optimal values match: prob.value ≈ prob'.value 4: end function
Consequently, the risk certificate becomes one-sided, reflecting an additional risk reduction introduced by degeneracy. We recall that, although the toolbox issues a warning when the specified optimization problem instance is detected to be degenerate, the use of the lower bound remains at the discretion of the user, who is responsible for verifying the validity of the non-degeneracy property.
4.2 Support List Validation
In Definition 4, the support list is characterized by two conditions: (i) the solution obtained when only the candidate constraints are enforced coincides with the solution obtained using the full set of constraints, and (ii) the candidate list is irreducible, meaning that removing any of its elements alters the solution. Given any candidate support list, that is any subset of the constraints, we can verify property (i) using Algorithm 2. This algorithm summarizes the procedure implemented in Listing 5, and its operation is independent of the particular solver employed.
def test_support(objective, support, non_risk, ref, solver=None): return bool
Listing 5: Function to validate candidate support lists.
Algorithm 2 takes a solved problem prob and its objective obj. The set A is a subset of the scenario constraints, i.e. a candidate support list. TEST_SUPPORT re-solves the problem for candidate constraints A together with the non-scenario constraints , and returns True if and only if the optimal value is reproduced. Deciding support list membership using the optimal value keeps the test well posed when the optimizer is non-unique: removing a genuinely-supporting scenario strictly changes the optimum, whereas a redundant one would leave it unchanged. A True result establishes the first requirement of Definition 4; irreducibility is checked separately.
R are the hard constraints; enforced always and not counted in the complexity.
4.3 Complexity Computation
def get_support(constraints, non_risk_constraints, prob, objective, solver=None, threshold=1e-8, sol_tol=1e-6): return complexity, support, degeneracy
Listing 6: Function to determine complexity.
The computation of complexity is the most intricate component of Scen-Opt's implementation. Although the full procedure is realized as a single function in Listing 6, for clarity we describe its constituent steps separately.
Algorithm 3 computes the support list. Lines 3–7 screen the scenario constraints by dual value, adding each constraint with a nonzero dual to the candidate list A. Such a constraint is either active (binding) at the optimum or violated: under relaxation, stationarity of the Lagrangian in the slack forces the dual of a violated constraint to sum to , so the check captures both. Line 8 tests, through TEST_SUPPORT, whether A alone reproduces the optimum. If it does, the screened constraints A are the support scenarios, and line 9 greedily prunes them via PRUNE (Algorithm 4). Non-degeneracy is equivalent to the support scenarios forming a support list (Property 1), so this prune doubles as a degeneracy test: the flag is raised exactly when PRUNE removes a constraint that is active or violated at the optimum, since the support scenarios are then reducible and more than one support list exists. The removal of a spuriously screened constraint — one that is strictly slack at the optimum, yet carries a small nonzero dual — is instead ignored (see Remark 4). If only spurious screens are removed, the remaining A is an irreducible support list and the instance is certified non-degenerate. In the degenerate case the pruned list is irreducible but not guaranteed to be of minimum cardinality. If TEST_SUPPORT is False, the dual screening was inaccurate (i.e. from numerical errors in the solver). To be conservative the degeneracy flag is raised and PRUNE restarts from the full scenario list C, which always recovers a valid support list. The complexity is the cardinality of the returned support list, .
The greedy reduction PRUNE (Algorithm 4) turns a candidate list into an irreducible support list. It is used in both branches of Algorithm 3: on the small screened set in the normal case, and on the full scenario list when the screening fails to reproduce the optimum. It checks each constraint in turn and removes it (via TEST_SUPPORT) whenever doing so leaves the optimum unchanged. The returned list is irreducible but not guaranteed to be of minimum cardinality. The pass is in the number of constraints: convexity guarantees that a constraint which is not of support cannot become of support as others are removed, so no constraint need be rechecked.
Remark 3 In cases of degeneracy, it is possible the complexity value calculated is suboptimal, i.e., for multiple support lists, the smallest support list is not necessarily identified. This sub-optimality is acceptable in practice, as a larger complexity leads to a more conservative (higher) upper bound on the risk.
Wooding et al.
Algorithm 3 Computing the support list and complexity
Require: Scenario constraints C, non-scenario constraints R, problem prob, objective obj Ensure: Complexity k, support list A, flag for degeneracy d 1: 2: 3: for all constraint c in C do 4: if 5: append c to A 6: end if 7: end for 8: if TEST_SUPPORT(prob, obj, A, R) then ▷ screened set reproduces the optimum 9: 10: 11: if any is active or violated at the optimum then 12: 13: end if 14: else 15: 16: 17: end if 18: 19: return
Algorithm 4 PRUNE: greedy support-list reduction
Require: Candidate constraints A, problem prob, objective obj, non-scenario constraints R Ensure: Irreducible support list A 1: i = 0 2: repeat 3: ▷ Temporary list without constraint in position i 4: if TEST_SUPPORT(prob, obj, , R) then 5: ▷ Remove constraint in position i 6: else 7: ▷ increment i 8: end if 9: until i == |A| 10: return A
Consequently, the true complexity would yield a strictly tighter, and therefore less risky certificate than the one obtained from a suboptimal result.
Remark 4 Some solvers (e.g. interior point) may return small nonzero duals on constraints that are neither active nor violated, so the dual screen of lines 3–7 may retain such spuriously screened constraints. Left unaddressed, their removal by PRUNE would raise the degeneracy flag even in non-degenerate instances, which is overly conservative. Scen-Opt resolves this by recording every screened constraint's activity margin at the optimum (before any re-solve overwrites the solution). A removed constraint whose margin clearly exceeds the tolerance is recognized as a spurious screen and discounted by the degeneracy test. When the margin is ambiguous, the constraint is conservatively treated as active, so the test still leans towards flagging degeneracy.
4.4 Solvers
Scen-Opt builds upon CVXPY [18], a well-established convex optimization framework that interfaces with a wide range of solvers . By leveraging CVXPY for scenario optimization, Scen-Opt can access 27 solvers (at the time of writing), including both open-source options (e.g., CLARABEL [23], CVXOPT [2], SCS [35]) and commercial solvers (e.g., MOSEK [3], GUROBI [26]). The function get_solvers, shown in Listing 7, automatically detects and returns all compatible solvers available on the host machine . This list is then used to populate the dynamic solver-selection menu in the web interface, as discussed in Section 5.
def get_solvers(): return solver_dict
Listing 7: Function to get installed solvers.
The returned solver_dict is a mapping from each installed solver's name to the list of program types it supports ('LP', 'QP', and 'SDP'), which is used to filter the dropdown in the web interface based on the active program tab. Commercial solvers requiring a license are handled by a dedicated subprocess entry point (mosek_solve.py) that sets the license environment variable before importing CVXPY, allowing concurrent users to each upload their own license without conflicts; the license is held only in RAM and never persists on disk.
4.5 Parallelism
With modern computational resources, one might expect significant gains from distributing computations across multiple processors or GPUs. However, for convex optimization it is well established that parallelization, particularly GPU-based acceleration, offers limited practical benefit [4,34]. The current version of Scen-Opt therefore runs sequentially. In Algorithm 3, the screening loop in lines 3–7 only reads dual values and is inexpensive, while PRUNE (Algorithm 4) admits no meaningful parallelism: although it contains a loop, each iteration depends on the outcome of the previous one, since the decision to remove a constraint affects all subsequent checks. The clearest opportunity for future versions is to solve the programs for different values of and in parallel, since they are independent. Such an implementation must give every parallel solve its own copy of the optimization problem: if parallel solves share optimization variables, the values written by one solve can overwrite those of another, the support list may then be identified incorrectly, and the complexity k can be under-counted, which would make the risk certificate too optimistic.
8 https://www.cvxpy.org/tutorial/solvers/index.html
The server contains the following solvers CLARABEL, CVXOPT, DAQP, ECOS, ECOS_BB, GLPK, GLPK_MI, HIGHS, MOSEK, OSQP, PIQP, PROXQP, SCIPY, SCS. Further solvers can be used by installing Scen-Opt locally.
Wooding et al.

Fig. 4: Web interface of Scen-Opt illustrating the relaxed and regularized LP.
5 Web Interface
Scen-Opt is accompanied by an interactive web interface designed to make the toolbox highly accessible and user-friendly. Figure 4 illustrates the interface for a relaxed and regularized LP, with annotated labels <1>--<10>. In the interface, <1> denotes the tab system that allows navigation between the different convex optimization programs supported by Scen-Opt. Each tab displays the corresponding optimization scheme, where <2> provides a dropdown menu for selecting whether regularization and/or relaxation are included or whether the basic robust formulation is used. The mathematical description of the chosen program is shown in <3>, with variable names aligned to the input fields and buttons in <4>. A row of dimension fields (d, m, n, and, for SDP, the LMI size) sets the problem sizes; changing any of them automatically reshapes the matrices already entered, zero-padding or truncating as needed.
Pressing any blue button opens a modal dialog for entering or uploading matrices or vectors. When relaxation or regularization is not applicable, the corresponding buttons and fields automatically disappear, ensuring a clean and adaptive interface. A help icon (?) beside each field opens a short tooltip explaining the corresponding input. Each matrix modal provides both a cell-by-cell grid editor and a JSON-paste box, with live validation. The scenario-dependent data , , and can be entered either symbolically or numerically — both input modes, and their corresponding scenario file format, are detailed in the Symbolic and numeric input modes paragraph below. The confidence parameter can be specified in ; when several values of or are swept (see below), this field instead reports the overall confidence obtained from a union bound over the solved instances, with the user-entered per-instance value, while the scenario data file is uploaded via , whose row-wise format depends on the active input mode (see below). As Scen-Opt supports up to 27 solvers, the dynamically populated solver dropdown enables selection among the solvers available on the host machine, automatically filtered to those compatible with the active program type (LP, QP, or SDP). Once all parameters are set, the optimization problem can be executed by clicking Solve at . Label denotes the input-mode toggle, which switches between the Symbolic and Numeric ways of entering the scenario-dependent constraints (detailed below). Label shows the button used to do a full upload of a program in .json or .mat formats, with Scen-Opt automatically detecting the suitable program choice. The program can be supplied either as a file or by pasting its .json text, and the dialog provides a format reference listing the required fields for each program type; in .mat files the symbolic matrices are passed as cell arrays of strings.
Symbolic and numeric input modes. Selected via the toggle <9>, Scen-Opt offers two complementary ways of providing the scenario-dependent constraints, in both cases uploaded through <7>. Throughout, the uncertainty is a q-dimensional vector whose components are addressed as delta[0], ..., delta[q-1]. In symbolic mode, each entry of and (LP/QP), or of (SDP), is entered in the matrix editors of <4> as a closed-form expression in delta[0], ..., delta[q-1], e.g., . The file uploaded via <7> then contains the scenarios themselves, as an table whose i-th row lists the components of scenario ; each row is substituted into the symbolic expressions to generate the i-th scenario constraint. This mode is convenient whenever the dependence on is available in closed form. In numeric mode, the scenario constraints are instead supplied already evaluated: the scenarios are given directly as the instances , (or ), so nothing is specified in the matrix editors (they are replaced by simple dimension fields), and the i-th row of the file uploaded via <7> lists the row-wise flattened numerical blocks for LP/QP or for SDP. Numeric mode is useful when the constraint data are produced externally (e.g., pre-computed from raw measurements or another processing pipeline) and do not admit a convenient symbolic form. Both modes solve the same underlying scenario program and return identical results. In numeric mode, Scen-Opt verifies
Supported formats include .csv, .json, .mat, .txt, .tsv, .xlsx, .xls, .npy, .npz, and .parquet
Wooding et al.
| Results Table | p Graph | r Graph | Program JSON | |
|---|---|---|---|---|
| Optimization Results | ||||
| Download .JSON | Download .MAT | |||
| Parameter | Value1 | Value2 | Value3 | Value4 |
| Optimal Cost ? | 0.5528 | 0.7000 | 0.6000 | 0.7000 |
| Optimal x | 0.5528 | 0.7000 | 0.6000 | 0.7000 |
| Optimal ζ | 8.526e-117.471e-116.782e-117.597e-116.704e-110.0472 | 1.408e-81.676e-81.857e-81.882e-81.928e-82.616e-8 | 8.612e-97.741e-97.328e-97.894e-96.118e-92.025e-8 | 1.088e-121.115e-121.095e-121.014e-128.615e-132.537e-13 |
| Relaxation Parameters ρ | 0.2000 | 0.3000 | 0.2000 | 0.3000 |
| Regularization Parameters τ | 0.2000 | 0.2000 | 0.3000 | 0.3000 |
| Confidence 1 – | 0.6000 | 0.6000 | 0.6000 | 0.6000 |
| Risk Bounds ε | [0.0873, 0.8401] | [0.0187, 0.7585] | [0.0873, 0.8401] | [0.0187, 0.7585] |
| Degeneracy Detected? | No | No | No | No |
| Complexity (support list size) | 4 | 3 | 4 | 3 |
| Number of data samples | 9 | 9 | 9 | 9 |
| Total Constraints | 9 | 9 | 9 | 9 |
| Optimization Time (s) | 0.0489 | 0.0665 | 0.0566 | 0.0419 |
| Risk Computation Time (s) | 0.0295 | 0.0311 | 0.0246 | 0.0257 |
| Error | None | None | None | None |
Fig. 5: Scen-Opt web interface displaying the results table for the relaxed and regularized LP set up in Fig. 4 (, scenarios, ), with one column for each pair , .
that each uploaded row has the length implied by the declared dimensions, reporting a descriptive error otherwise.
Remark 5 The Mosek [3] solver requires a license, which is not provided for the user when using the server. Instead, when trying to use Mosek, a user can upload their valid license to be checked and used. The license is only temporarily stored. For convenience, an uploaded license is cached in the browser's session storage so that subsequent solves skip the upload prompt; a cache indicator with a Clear button appears beneath the solver menu, while users with a locally installed Mosek can instead skip the upload and use their system license. Similarly, no scenario or program files uploaded persist on the disk. If privacy concerns remain, the tool can be downloaded/installed locally.
As shown in Fig. 5, pressing Solve triggers the optimization, after which the results are dynamically displayed. The interface provides up to four analysis tabs (the and graphs appear only when relaxation or regularization is

(a) Comparing for different selections of

(b) Comparing for different selections of
Fig. 6: Example graphical output from Scen-Opt for cases involving relaxation or regularization, for the run of Figs. 4 and 5.
selected); the first tab presents a results table containing key information such as the optimal cost, the solution values, the associated upper and (when applicable) lower risk bounds, and an indicator flag identifying whether degeneracy was detected. The table also reports the computed complexity, the total number of constraints, the timings for acquiring the results (reported separately as the optimization solve time and the risk-bound computation time), and any numerical issues encountered during the solution process. When degeneracy is flagged, the lower risk bound is withheld and only the certified upper bound is shown, in line with Theorem 2.
Scen-Opt allows users to specify multiple scalar values for and , separated by commas. When multiple values are provided, each resulting optimization problem is solved independently with the entered confidence parameter , and the table reports the overall confidence , which holds simultaneously for all cases. When multiple cases are present, the table automatically expands to include additional columns for each trial, and a horizontal scroll bar enables convenient navigation across all displayed results. Similarly, when d or N is large, the optimal x and optimal windows become scrollable. All the results can be subsequently downloaded in .json or .mat formats using the respective green download buttons.
To provide deeper insight, Scen-Opt also offers graphical summaries of the solutions when multiple values of and are tested. Figure 6 illustrates this functionality for the run of Figs. 4 and 5, with two choices of and two choices of . Since visualizing all combinations simultaneously would lead to cluttered plots, the interface instead presents Pareto front slices: one parameter (either or ) is fixed via an interactive dropdown, while the other is varied and plotted against the resulting risk and cost . The risk plot displays both the upper (blue) and lower (green) bounds, whereas the cost curve is shown in black. These visualizations allow users to
Wooding et al.
conveniently explore and interpret the trade-off between risk and objective value across different regularization and relaxation settings in the spirit of [21, 22].
The final tab in the results displays the form data, which allows users to verify that the optimization problem has been specified correctly. The .json representation shown in this tab can also be saved, via a dedicated Download Program button, and later re-uploaded through the Upload Program dialog, providing a convenient workflow for experimenting with multiple related optimization problems or repeating similar analyses.
6 Benchmarking
Table 1 summarizes the twelve case studies used to evaluate Scen-Opt. The benchmarks span all three supported program types (LP, QP, SDP) and cover decision-variable dimensions from to , with scenario uncertainty dimensions up to . Solve times are wall-clock measurements on a desktop with an Intel Core Ultra 9 285K (24 cores) and 64 GB RAM running Windows 11 using MOSEK [3] as the underlying conic solver. For two benchmarks (Growth Bound and Radiation Therapy) Scen-Opt detects degeneracy — the constraints active at the optimum do not form a support list — so their lower risk bounds are not certified (see Theorem 2) and are marked N/A in the table. Full problem descriptions are provided in Appendix A.
7 Conclusions and Future Work
This work presented Scen-Opt, the first open-source software tool designed to bring the scenario approach into practical, user-friendly data-driven convex optimization. Building on the rigorous theoretical foundations of scenario theory, which links sampled constraints, their support list, and the generalization properties of the resulting decision, Scen-Opt enabled researchers and practitioners to solve linear, quadratic, and semidefinite programs using only sampled uncertainty realizations while obtaining certified probabilistic guarantees on performance. The tool was implemented in Python and complemented with a modern JavaScript-based web interface, providing an intuitive and highly accessible user experience across devices. It supported both web-based usage and local installation, allowing flexible data entry through manual input or file uploads. Through a set of representative benchmarks, we demonstrated the practical effectiveness of Scen-Opt for reliable, data-driven decision making. Looking ahead, the framework established in this work opens the door to extending Scen-Opt to accommodate emerging advances in nonconvex scenario optimization.
Table 1: Summary of all twelve benchmark case studies solved with Scen-Opt, grouped by program type. decision variables, uncertainty dimension, scenario constraints (rows of for LP/QP, LMI dimension for SDP), hard constraints (rows of for LP/QP, LMI dimension for SDP), number of sampled scenarios, complexity (number of support constraints). All benchmarks use the confidence parameter . Solve times are wall-clock seconds on a desktop with an Intel Core Ultra 9 285K (24 cores) and 64 GB RAM running Windows 11. Power Dispatch, Inventory and Portfolio CVaR use an augmented formulation in which the slack penalty is embedded in the objective coefficient ; the value of rho passed to the solver is therefore 0, while the displayed value reflects the user-facing penalty weight. N/A = degeneracy detected, so the lower risk bound is not certified. Scenario data come from Yahoo Finance (Portfolio CVaR) and the UCI repository (Iris SVM [20], Covariance Estimation [1], Min. Encl. Ellipsoid [42]); Radiation Therapy uses synthetic data inspired by TROTS [6], and the scenarios of all other benchmarks are generated as described in Appendix A.
| Benchmark | d | q | ms | mh | ρ | τ | N | k | ε | ε | Time (s) |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Linear Programs (LP) | |||||||||||
| Half Width | 2 | 1 | 2 | 0 | 0 | 0 | 100 | 2 | 0 | 0.2085 | 1.2 |
| Growth Bound | 12 | 6 | 3 | 6 | 0 | 0 | 3127 | 6 | N/A | 0.0103 | 1276.8 |
| Inventory | 11 | 15 | 6 | 17 | 0 | 500 | 7 | 0 | 0.0666 | 4.0 | |
| Portfolio CVaR | 13 | 12 | 4 | 27 | 0 | 1255 | 3 | 0 | 0.0203 | 22.0 | |
| Power Dispatch | 120 | 48 | 48 | 330 | 0 | 150 | 34 | 0.0791 | 0.4496 | 2.9 | |
| Quadratic Programs (QP) | |||||||||||
| Iris SVM | 3 | 3 | 1 | 0 | 0 | 0 | 150 | 2 | 0 | 0.1441 | 1.2 |
| Robot Navigation | 118 | 1 | 3 | 320 | 0 | 0 | 500 | 1 | 0 | 0.0403 | 1.6 |
| Radiation Therapy | 50 | 3 | 80 | 100 | 0 | 0.1 | 200 | 5 | N/A | 0.1414 | 112.3 |
| Semidefinite Programs (SDP) | |||||||||||
| LPV Stability | 3 | 1 | 2 | 2 | 1 | 0 | 100 | 1 | 0 | 0.1858 | 1.7 |
| Quadratic Stability | 6 | 2 | 3 | 3 | 0 | 0 | 500 | 1 | 0 | 0.0403 | 2.2 |
| Covariance Estimation | 15 | 5 | 5 | 5 | 0 | 0 | 178 | 7 | 0 | 0.1780 | 2.1 |
| Min. Encl. Ellipsoid | 15 | 5 | 1 | 5 | 0 | 0 | 569 | 5 | 0 | 0.0518 | 235.6 |
References
-
Aeberhard, S., Forina, M.: Wine. UCI Machine Learning Repository (1992). DOI: https://doi.org/10.24432/C5PC7J
-
Andersen, M., Dahl, J., Vandenberghe, L.: CVXOPT: Convex optimization. Astrophysics Source Code Library (2020)
-
ApS, M.: Mosek optimizer api for python. Version 9(17), 6–4 (2022)
-
Balkanski, E., Singer, Y.: Parallelization does not accelerate convex optimization: Adaptivity lower bounds for non-smooth convex minimization. arXiv:1808.03880 (2018)
-
Boyd, S.P., Vandenberghe, L.: Convex optimization. Cambridge university press (2004)
-
Breedveld, S., Heijmen, B.: Trots-the radiotherapy optimisation test set (2019)
-
Buzby, J.C., Farah-Wells, H., Hyman, J.: The estimated amount, value, and calories of postharvest food losses at the retail and consumer levels in the united states. USDA-ERS Economic Information Bulletin (121) (2014)
-
Calafiore, G.C., Campi, M.C.: The scenario approach to robust control design. IEEE Transactions on automatic control 51(5), 742–753 (2006)
-
Campi, M.C., Carè, A., Garatti, S.: The scenario approach: A tool at the service of data-driven decision making. Annual Reviews in Control 52, 1–17 (2021)
-
Campi, M.C., Garatti, S.: The exact feasibility of randomized solutions of uncertain convex programs. SIAM Journal on Optimization 19(3), 1211–1230 (2008)
-
Campi, M.C., Garatti, S.: A sampling-and-discarding approach to chance-constrained optimization: feasibility and optimality. Journal of optimization theory and applications 148(2), 257–280 (2011)
Wooding et al.
-
Campi, M.C., Garatti, S.: Introduction to the scenario approach. SIAM (2018)
-
Campi, M.C., Garatti, S.: Wait-and-judge scenario optimization. Mathematical Programming 167(1), 155–189 (2018)
-
Campi, M.C., Garatti, S.: Compression, generalization and learning. Journal of Machine Learning Research 24(339), 1–74 (2023)
-
Campi, M.C., Garatti, S., Prandini, M.: The scenario approach for systems and control design. Annual Reviews in Control 33(2), 149–157 (2009)
-
Campi, M.C., Garatti, S., Ramponi, F.A.: A general scenario theory for nonconvex optimization and decision making. IEEE Transactions on Automatic Control 63(12), 4067–4078 (2018)
-
Deasy, J.O., Blanco, A.I., Clark, V.H.: Cerr: a computational environment for radiotherapy research. Medical physics 30(5), 979–985 (2003)
-
Diamond, S., Boyd, S.: Cvxpy: A python-embedded modeling language for convex optimization. Journal of Machine Learning Research 17(83), 1–5 (2016)
-
Draxl, C., Clifton, A., Hodge, B.M., McCaa, J.: The wind integration national dataset (wind) toolkit. Applied Energy 151, 355–366 (2015)
-
Fisher, R.A.: Iris. UCI Machine Learning Repository (1936). DOI: https://doi.org/10.24432/C56C76
-
Garatti, S., Campi, M.C.: Risk and complexity in scenario optimization. Mathematical Programming 191(1), 243–279 (2022)
-
Garatti, S., Campi, M.C.: Non-convex scenario optimization. Mathematical Programming 209(1), 557–608 (2025)
-
Goulart, P.J., Chen, Y.: Clarabel: An interior-point solver for conic programs with quadratic objectives. arXiv:2405.12762 (2024)
-
Grant, M., Boyd, S., Ye, Y.: CVX users' guide (2009)
-
Grantham, A., Pudney, P., Ward, L., Belusko, M., Boland, J.: Generating synthetic five-minute solar irradiance values from hourly observations. Solar Energy 147, 209–221 (2017)
-
Gurobi Optimization, LLC: Gurobi Optimizer Reference Manual (2024). URL https://www.gurobi.com
-
Hou, Z.S., Wang, Z.: From model-based control to data-driven control: Survey, classification and perspective. Information Sciences 235, 3–35 (2013)
-
Kazemi, M., Majumdar, R., Salamati, M., Soudjani, S., Wooding, B.: Data-driven abstraction-based control synthesis. Nonlinear Analysis: Hybrid Systems 52 (2024)
-
Margellos, K., Falsone, A., Garatti, S., Prandini, M.: Distributed constrained optimization and consensus in uncertain networks via proximal minimization. IEEE Transactions on Automatic Control 63(5), 1372–1387 (2017)
-
Margellos, K., Goulart, P., Lygeros, J.: On the road between robust optimization and the scenario approach for chance constrained optimization problems. IEEE Transactions on Automatic Control 59(8), 2258–2263 (2014)
-
Margellos, K., Prandini, M., Lygeros, J.: On the connection between compression learning and scenario based single-stage and cascading optimization problems. IEEE Transactions on Automatic Control 60(10), 2716–2721 (2015)
-
Mohajerin Esfahani, P., Sutter, T., Kuhn, D., Lygeros, J.: From infinite to finite programs: explicit error bounds with applications to approximate dynamic programming. SIAM journal on optimization 28(3), 1968–1998 (2018)
-
Mohajerin Esfahani, P., Sutter, T., Lygeros, J.: Performance bounds for the scenario approach and an extension to a class of non-convex programs. IEEE Transactions on Automatic Control 60(1), 46–58 (2014)
-
Nemirovski, A.: On parallel complexity of nonsmooth convex optimization. Journal of Complexity 10(4), 451–463 (1994)
-
O'Donoghue, B., Chu, E., Parikh, N., Boyd, S.: Conic optimization via operator splitting and homogeneous self-dual embedding. Journal of Optimization Theory and Applications 169(3), 1042–1068 (2016). URL http://stanford.edu/~boyd/papers/scs.html
-
Perez, A., Ferreira, G., Minor, T.: Fruit and tree nuts outlook (2017)
-
Rockafellar, R.T., Uryasev, S., et al.: Optimization of conditional value-at-risk. Journal of risk 2, 21–42 (2000)
-
Romao, L., Margellos, K., Papachristodoulou, A.: Probabilistic feasibility guarantees for convex scenario programs with an arbitrary number of discarded constraints. Automatica 149, 110601 (2023)
-
Romao, L., Papachristodoulou, A., Margellos, K.: On the exact feasibility of convex scenario programs with discarded constraints. IEEE Transactions on Automatic Control 68(4), 1986–2001 (2022)
-
Schildbach, G., Fagiano, L., Morari, M.: Randomized solutions to convex programs with multiple chance constraints. SIAM Journal on Optimization 23(4), 2479–2501 (2013)
-
Shang, C., You, F.: A posteriori probabilistic bounds of convex scenario programs with validation tests. IEEE Transactions on Automatic Control 66(9), 4015–4028 (2020)
-
Wolberg, W., Mangasarian, O., Street, N., Street, W.: Breast Cancer Wisconsin (Diagnostic). UCI Machine Learning Repository (1993). DOI: https://doi.org/10.24432/C5DW2B
-
Zhang, X., Grammatico, S., Schildbach, G., Goulart, P., Lygeros, J.: On the sample size of random convex programs with structured dependence on the uncertainty. Automatica 60, 182–188 (2015)
A Case Studies
All case study benchmarks can be found in the repository at https://github.com/Kiguli/Scen-Opt/tree/v1.0/benchmarks, and in the archived release at https://doi.org/10.5281/zenodo.23177690. The results presented here were run on a desktop with an Intel Core Ultra 9 285K (24 cores) and 64 GB RAM running Windows 11.
A.1 Linear Programming Cases
A.1.1 Inventory Management
A purchasing manager must decide how many cases of fresh produce to order daily from the Oakland Terminal Market. Fresh produce is highly perishable, e.g. strawberries might have perished by the time they reach stores. Demand fluctuates based on weather, local events and seasonal patterns. The purchasing manager has a fixed budget and limited warehouse space. Too little orders means empty shelves and lost sales. Too many and produce spoils on the shelf, a wasted purchase.
Determine the optimal daily order quantities to minimize wastage for 5 perishable produce, as labeled in Table 2. The daily budget is $12,000 and warehouse has 800 cubic feet of refrigerator space. Products have a maximum order limit of 150 – 200 cases, item dependent.
The decision variable is , representing daily order quantities for five perishable produce items (strawberries, tomatoes, lettuce, avocados, bell peppers), with per-case ordering cost USD, slack penalty , and no regularization (). Each scenario encodes uncertain yields , demands
| Product | Cost ($) | Mean Demand (cases) | Yield (%) | Space (cu. ft) |
|---|---|---|---|---|
| Strawberries | 18.50 | 85 | 75 (25 loss) | 1.2 |
| Tomatoes | 14.25 | 120 | 88 (12 loss) | 1.5 |
| Lettuce | 12.00 | 95 | 82 (18 loss) | 2.0 |
| Avocados | 32.00 | 60 | 90 (10 loss) | 0.8 |
| Bell Peppers | 22.50 | 75 | 85 (15 loss) | 1.3 |
Table 2: Produce purchasing details. The data is synthetic but calibrated to real data [7, 36], along with USDA Terminal Market Prices for highest grade products.
Wooding et al.


Fig. 7: Left. Comparison of optimal order against mean demand. Center. Quantified risk bounds for and confidence 99%. Right. Graphic of scenario samples for different produce.
| Product | Order (cases) | Mean Demand | Service Level (%) |
|---|---|---|---|
| Strawberries | 150 | 83.9 | 85.8 |
| Tomatoes | 155.2 | 118.9 | 72.4 |
| Lettuce | 40.4 | 94.3 | 0.2 |
| Avocados | 118.9 | 59.8 | 99.8 |
| Bell Peppers | 121.0 | 74.1 | 90.0 |
Table 3: Optimal Purchasing Order
, and warehouse packing efficiencies , drawn from correlated distributions calibrated to USDA wholesale market data. The scenario-dependent constraint matrices in (3b) are
where is the warehouse space per case of product and . The first five rows enforce that usable supply meets demand; the last row enforces refrigerated warehouse capacity. The hard constraints in (3c) are
encoding non-negativity, supplier limits cases, and a daily budget . is the identity matrix.
Scen-Opt solves the LP in 4.0 seconds considering scenarios. The optimal cost is 12,000 of budget used. The penalty implies a cost per case of lost sales for an item, therefore the expected daily loss from stockouts is only 12/case), and has high spoilage (18%). Under a 32/case but 90% yield) and accept lettuce shortfalls. With confidence , the LP problem had complexity , no degeneracy, and risk bounds [0.0000, 0.0666]. This gives a maximum 6.7% chance of the optimal cost being nullified if another sample was acquired.
| Generator | Capacity | Min Output | Cost | Ramp Rate |
|---|---|---|---|---|
| Gas 1 | 400 MW | 100 MW | 40 $/MW | 200 MW/h |
| Gas 2 | 300 MW | 75 MW | 50$/MW | 150 MW/h |
| Coal | 500 MW | 200 MW | 30 $/MW | 100 MW/h |
Table 4: Thermal generator parameters. Costs and capacities are synthetic but calibrated against standard values.

Fig. 8: Left. Stacked generation dispatch over 24 hours: coal provides baseload, gas ramps for the evening peak. Center. Quantified risk bounds for and confidence . Right. Wind and solar scenario variability (median with 25 – 75th and 10 – 90th percentile bands).
A.1.2 Power Dispatch
A grid operator must schedule three thermal generators over a 24-hour horizon to meet electricity demand while integrating uncertain wind and solar generation. Demand follows a typical residential-commercial daily profile peaking at 1000 MW. The system includes a 200 MW wind farm and 150 MW solar farm whose output cannot be known in advance.
Determine the optimal hourly generation schedule for each thermal unit at each hour . The decision variable is (3 generators 24 hours), with per-MWh generation cost , slack penalty , and no regularization (). Each scenario encodes uncertain hourly wind generation and solar generation , drawn from a Weibull distribution (shape 2.0, hour-varying scale) for wind [19] and a Beta(2, 5) cloudiness factor applied to a clear-sky envelope for solar [25]. The scenario-dependent constraint matrices in (3b) enforce power balance at each hour:
where selects all generators at hour and is the demand at hour . Each pair of rows bounds the power imbalance from above and below. The hard constraints in (3c) are
encoding generator capacity limits and ramp-rate constraints (282 rows total).
Scen-Opt solves the LP considering renewable generation scenarios in 2.9 seconds. The total cost is 537,670 in fuel costs and \rho = 10030/MWh, provides baseload at 284 – 500 MW. Gas 1 (50/MWh) remains at its 75 MW minimum throughout, dispatching it further is never cost-effective. The LP problem has confidence, complexity, no degeneracy, and risk bounds [0.0791, 0.4496]. This
Wooding et al.
| Ticker | Asset | Class | Role |
|---|---|---|---|
| SPY | S&P 500 ETF | US Equity | Core Growth |
| AGG | US Aggregate Bond | Fixed Income | Stability |
| VNQ | Real Estate REIT | Real Assets | Inflation Hedge |
| GLD | Gold | Commodities | Crisis Hedge |
| EFA | Intl Developed | Intl Equity | Diversification |
| TLT | 20+ Year Treasury | Long Bonds | Duration |
| VWO | Emerging Markets | Intl Equity | Growth |
| LQD | Inv. Grade Corp | Credit | Yield |
Table 5: ETF asset universe. Historical returns are downloaded from Yahoo Finance via yfinance (5 years daily data).
gives a likelihood of having the correct result for unseen data, therefore, more data is likely required to increase the confidence in this power dispatch solution.
A.1.3 Portfolio Management - Conditional Value at Risk (CVaR)
A pension fund must allocate capital across 8 ETF asset classes to minimize tail risk under market uncertainty. The fund uses Conditional Value-at-Risk (CVaR) at the level (the average loss in the worst of scenarios) as its primary risk measure, following the linear formulation of [37].
The decision variable is , where are portfolio weights and is the VaR threshold. The objective minimizes , with slack penalty so that approximates CVaR at the level. There is no regularization ().
Each scenario encodes 8 asset returns (bootstrapped from historical data), a market stress indicator , credit spread shock , interest rate shock , and volatility scaling . The scenario-dependent constraint matrix in (3b) has 4 rows:
with and . The first row is the main CVaR loss constraint with stress amplification; rows 2 and 3 capture credit spread and interest rate duration exposure on bond assets (AGG, TLT, LQD); row 4 models equity correlation breakdown during crises (SPY, EFA, VWO). The hard constraints in (3c) encode position limits (5 – 30% per asset), full investment (), equity allocation range (30 – 60%), fixed income minimum (25%), and VaR threshold bounds (23 rows total).
Scen-Opt solves the LP considering market scenarios (one per historical trading day) with confidence in 22.0 seconds. The optimizer tilts heavily toward alternatives: GLD (23.9%) and VNQ (21.1%) absorb the allocation not consumed by regulatory minimums. Equities sit at the 30% floor and fixed income at 25%, both at their binding lower limits. This minimizes tail risk, the CVaR(95%) is only 1.20% daily loss. The LP problem has complexity , no degeneracy, and risk bounds [0.0000, 0.0203].
A.1.4 Smallest Enclosing Interval
We sample 100 points from the 1-dimensional space [0, 1] and seek the smallest interval that encloses all samples, following the setup in [12]. This is formulated as a robust LP, where

Fig. 9: Left. Optimal portfolio weights with position limit constraints. Center. Quantified risk bounds for and . Right. Portfolio return distribution with VaR(95%) and CVaR(95%) marked.

Fig. 10: Left. Optimal half-width given sampled points. Center. Quantified risk bounds for N = 100 and confidence 99.9999%. Right. Density of sampled points across the region.
the solution consists of the interval center and half-width , i.e., . The corresponding matrices defining the robust LP in (3) are given in (4), where the constraint is enforced for each sampled point (scenario) . Using the dataset with , , and complexity , the resulting risk bounds are computed as and . Scen-Opt solved the LP in 1.2 seconds. The corresponding optimal solution is computed as .
A.1.5 Data-Driven Growth Bound for Finite Abstraction
In the formal methods community, mathematical guarantees on system behavior are often obtained through hybridization, whereby a continuous-space system is approximated via a finite abstraction and the abstraction is analyzed to infer guarantees for the original continuous-space dynamics. The work [28] employs scenario optimization to construct a data-driven growth bound, formulated as a linear program and derived directly from sampled system trajectories, which in turn is used in building the finite abstraction of an unknown deterministic system. As a case study, we illustrate the computation of such a growth bound using Scen-Opt, referring the reader to the original work for the full abstraction framework and controller synthesis procedure.
Finite abstractions group a set of continuous states into grid cells, each represented by a single point (typically the cell center). We consider a 3-dimensional hypercube of side length , centered at , together with vehicle dynamics of the form
where .
Wooding et al.
A total of 3127 trajectories are sampled from the hypercube under the fixed input , where denotes the trajectory originating from the center. The growth bound
with being a bias term, is then computed using the following LP:
subject to: ,
where and when .
We consider a single scenario formed by the 6-dimensional concatenation , . The matrices and vectors defining the corresponding robust LP constraints are
Solving the optimization yields the following rounded solution:
Using the pre-selected bias and confidence parameter , the resulting growth bound is computed as . The complexity is ; here ScenOpt detects degeneracy: essentially all 3127 scenario constraints are (numerically) active at the optimum, while only six are needed to reproduce it, so the active constraints do not form a support list and multiple support lists exist. The lower risk bound is therefore not certified (cf. Theorem 2) and only the upper bound is reported: . Scen-Opt computes this in 1276.8 seconds.
A.2 Quadratic Programming Cases
A.2.1 Radiation Therapy - Prostate Brachytherapy
A medical physicist must design a brachytherapy treatment plan that delivers a prescribed dose of 145 Gy to the prostate while minimizing dose to surrounding organs at risk (OARs). Catheter placement uncertainty of mm occurs due to tissue deformation, needle deflection, and inter-fraction anatomy changes.
The treatment uses dose-influence data [17] from the Treatment and Outcome Tracking System (TROTS) Prostate_BT_01 patient [6]. The original dataset has 55 catheters/dwell positions and 7 anatomical structures totaling approximately 35,000 voxels. We subsample

Fig. 11: Left. Dose-volume histogram showing tumor coverage above the 137.75 Gy minimum with OAR doses within limits (rectum < 100 Gy, bladder < 120 Gy); the x-axis is capped at 3× prescription as brachytherapy produces extreme hot spots near dwell positions. Center. Risk bounds with k = 5 support constraints. Right. Dwell-position intensity profile showing most channels near maximum with selective suppression near OARs.
to dwell positions (selected by total dose contribution) and 100 representative voxels (selected by dose variance): 20 prostate (PTV), 30 rectum, 30 bladder, and 20 normal tissue. The nominal dose-influence matrix relates dwell-position intensities to voxel doses, with entry representing the dose deposited in voxel by unit intensity of dwell position .
The TROTS dataset contains only scenarios, which is too small for proper analysis. Therefore, we design synthetic data inspired by this dataset. Each scenario encodes a catheter placement shift in three spatial directions (anterior–posterior, lateral, superior–inferior). A 5-level grid ( scenarios) combined with 75 random samples from a truncated Gaussian ( mm) yields scenarios. The perturbed dose-influence matrix follows an affine model:
where the gradient matrices are computed via finite differences on the nominal dose-influence data.
This is a Quadratic Program in the scenario approach framework. The scenario-dependent constraint matrices enforce dose bounds under each catheter shift:
where encodes 20 minimum tumor dose constraints ( Gy, i.e. 95% of the 145 Gy prescription), 30 maximum rectum dose constraints ( Gy), and 30 maximum bladder dose constraints ( Gy). The 100 hard constraints enforce non-negativity and upper bounds on each dwell-position intensity ( Gy·s).
The objective minimizes negative tumor dose (maximizing target coverage) with regularization ( ) to encourage physically smooth dwell-time profiles:
where penalizes dose inhomogeneity across tumor voxels and encodes the negative mean tumor dose contribution of each dwell position. The problem is solved robustly ( ): all dose constraints must hold for every scenario without slack relaxation.
Figure 11 presents the solution. The optimal plan achieves a tumor Gy (exceeding the 137.75 Gy minimum), with maximum rectum dose of 84.6 Gy (below the 100 Gy limit) and maximum bladder dose of 101.6 Gy (below the 120 Gy limit).
The left panel shows the dose-volume histogram (DVH). The tumor curve drops steeply beyond the prescription dose, confirming adequate target coverage, while the long tail reflects the hot spots inherent to brachytherapy (high doses near dwell positions are physically
Wooding et al.
unavoidable and clinically acceptable). Both OAR curves fall well within their respective dose constraints.
The center panel shows the risk bounds. The complexity is ; here Scen-Opt detects degeneracy: 20 scenario constraints are active at the optimum while only five form the support list, so the lower risk bound is not certified (cf. Theorem 2) and only the upper bound is reported, at 99.9999% confidence ( ). This guarantees that the dose constraints will be satisfied for a new random catheter placement with probability at least 85.9%. The low complexity relative to decision variables indicates that only a small number of catheter-shift scenarios are critical to the solution geometry.
The right panel displays the dwell-position intensity profile. Most channels carry high intensity ( Gy·s, the upper bound), with a few positions at low or zero intensity. This reflects the geometry of the prostate target relative to the catheter array: dwell positions near the center of the PTV deliver maximum intensity, while those far from the target or near OARs are suppressed.
A.2.2 Robot Motion Planning
We consider a point robot navigating from a start position (0.5, 2.5) to a goal (9.5, 2.5) in a m workspace containing a wide rectangular wall obstacle spanning , . The robot has double-integrator dynamics discretized over timesteps with s (total horizon 8 s). The state vector at each timestep is and the control input is , yielding decision variables (80 states and 38 controls).
The direct path at is blocked by the wall, so the robot must arc above the wall face at with a safety clearance of . The wall face position is uncertain: each scenario with perturbs the effective face location, generating 3 scenario constraints per sample (one per constrained timestep in the wall's -range), for a total of scenario constraints. In addition, 320 hard constraints encode the dynamics ( equality-as-inequality pairs for state transitions), initial conditions (8 constraints fixing the start state), control limits ( upper and 38 lower bounds on acceleration at ), workspace bounds ( upper and 40 lower bounds on -position), and goal proximity (4 constraints enforcing ). The total problem has 1,820 inequality constraints.
The objective minimizes a weighted combination of control effort and position tracking error relative to a straight-line reference at :
With scenarios, the solver returns a smooth arc trajectory with path length 9.79 m and minimum wall clearance 0.19 m from the safety boundary. The complexity is (one support constraint). Calculating the risk bounds with yields [0.0000, 0.040], guaranteeing that with at least 99.9999% confidence, the probability of constraint violation under a new scenario draw is at most 4%. No degeneracy is detected, and there is no regularization or relaxation ( and ). The QP was solved in 1.6 seconds.
A.2.3 Minimal Iris Classification
The small iris classification dataset [20] is one of the earliest and most widely used benchmarks for evaluating classification algorithms. It includes 150 iris plants belonging to three species, Iris Setosa, Iris Versicolour, and Iris Virginica, each described by four measured features: sepal length, sepal width, petal length, and petal width.
Using a simple linear classifier, Iris Setosa can be reliably distinguished from the other two species. Moreover, only the petal-related measurements are needed for this separation. We therefore consider a minimal binary classification problem based on two features, petal length and petal width, to determine whether a given iris sample belongs to the Iris Setosa class.

Fig. 12: Left. Optimal trajectory arcing above the wall obstacle. Center. Risk bounds as a function of complexity . Right. Wall clearance at timesteps within the wall's x-range.

Fig. 13: Left. Optimal separating hyperplane with margin boundaries and support vectors. Center. Risk bounds with complexity . Right. Petal feature distributions by class.
We sample points from the 2-dimensional feature space, labeled in blue and orange, and aim to determine a separating hyperplane that maximizes the margin between the two classes (cf. Fig 13). A natural approach for this task is the linear hard-margin support vector machine (SVM), formulated for data points with binary labels as the following optimization problem:
subject to: .
This can be formulated as a robust QP, where the separating hyperplane is given by . The optimizer returns and the corresponding intercept , so that, abusing notation, the scenario solution is . Each scenario consists of the feature-label pair , where are the feature coordinates and is the binary class label. The associated matrices defining the robust QP in (5) are given in (6). The risk is computed using the dataset with , confidence level , and complexity , yielding risk bounds and , solved in 1.2 seconds. The resulting optimal solution corresponds to the linear classifier
Wooding et al.

Fig. 14: Left. Entry-wise error ; diagonal inflation reflects the domination requirement. Center. Risk bounds with support constraints. Right. Eigenvalue spectrum comparison: the estimated covariance uniformly dominates the full-sample covariance in every principal direction.
A.3 Semidefinite Programming Cases
A.3.1 Robust Covariance Estimation
We seek the minimum-trace positive semidefinite covariance matrix that dominates all subsample covariances drawn from the UCI Wine dataset [1]. The scenario approach provides probabilistic guarantees that will also dominate the covariance of a new random subsample drawn from the same population.
The Wine dataset contains 178 samples with 13 chemical measurements per wine. We select the first 5 features (alcohol, malic acid, ash, alkalinity of ash, magnesium) and standardize each to zero mean and unit variance, yielding the full-sample covariance .
The decision variable is , the 15 free entries of the symmetric matrix , where are the standard basis matrices for the symmetric space. Each scenario is one of the 178 wine data points ( scenarios, one per wine).
This is a Semidefinite Program (SDP) in the scenario approach inequality form. The scenario-dependent constraint matrices encode covariance domination as a LMI:
where and , so that , i.e. for each scenario. The hard constraint enforces via and . The objective minimizes trace( ) using and . There is no slack penalty ( ) and no regularization ( ).
Figure 14 presents the solution. The left panel shows the entry-wise error as a heatmap. The diagonal entries are uniformly positive (ranging from +0.54 to +0.93), reflecting the conservatism inherent in the domination requirement: the estimated covariance must exceed every subsample covariance, which inflates the diagonal. Off-diagonal errors are smaller and mixed in sign.
The right panel shows the risk bounds. The complexity is with no degeneracy, yielding risk bounds at 99.9999% confidence ( ). This guarantees that will dominate the covariance of a new random 50-wine subsample with probability at least 82.2%. Scen-Opt solved the SDP in 2.1 seconds.

Fig. 15: Left. 2D projection showing 569/569 points contained (100%) inside the region. Center. Risk bounds with k = 5 support constraints. Right. Containment profile: sorted values for all 569 data points; the boundary at 1.0 separates interior from exterior points.
A.3.2 Minimum Enclosing Ellipsoid - Breast Cancer Wisconsin
Given a collection of data points, we seek the tightest ellipsoid (in the trace sense) that contains all sampled observations. This is a fundamental problem in robust statistics and anomaly detection: the scenario approach provides probabilistic guarantees that unseen data points from the same distribution will also be contained.
The Breast Cancer Wisconsin dataset [42] contains 569 samples with 30 features. We select the first 5 features (mean radius, mean texture, mean perimeter, mean area, mean smoothness) and standardize each to zero mean and unit variance, with data center .
The decision variable is , the entries of the symmetric shape matrix , defining the ellipsoid
Each scenario is a data point drawn from the dataset ( scenarios).
This is a Semidefinite Program (SDP) in the scenario approach inequality form. The scenario-dependent constraint matrices encode point containment as a (scalar) LMI:
where and , so that . The hard constraint enforces via and . The objective maximizes (i.e. minimizes ) using and , finding the tightest ellipsoid. There is no slack penalty and no regularization .
Figure 15 presents the solution. The left panel shows the 2D projection of the ellipsoid onto the first two standardized features (mean radius vs. mean texture). Since all 569 data points are used as scenarios, the ellipsoid contains all of them (100% containment).
The center panel shows the risk bounds. The complexity is with no degeneracy, yielding risk bounds at 99.9999% confidence ( ), guaranteeing that a new random data point will fall inside the ellipsoid with probability at least 94.8%.
The right panel displays the containment profile: for each of the 569 data points (sorted by containment value), the quantity is plotted. Points below the dashed line at 1.0 are contained. The optimal has trace 44.59 and eigenvalues , revealing that the standardized data effectively lies in a 1-dimensional subspace. The first 5 breast cancer features are highly correlated (mean radius, mean perimeter, and mean area are near-linearly dependent), so concentrates its “tightness” along the single direction of genuine data spread. The SDP was solved in 235.6 seconds.
Wooding et al.
(a) Stabilising trajectories

(b) Risk bounds

Fig. 16: Left. Stabilizing trajectories with for different scenarios . Right. Risk bounds for the LPV stability with complexity .
A.3.3 LPV Stability
Consider a linear parameter-varying (LPV) system with
where is a stable damped oscillator and captures parameter-varying uncertainty in the restoring and damping terms. The goal is to find a common quadratic Lyapunov function with certifying stability across all parameter values, i.e. .
This maps to the SDP inequality form (7) with decision variable , the upper-triangular entries of the symmetric matrix . Let , , be the basis matrices for the symmetric space, so that . The scenario-dependent constraint matrices in (7b) are
encoding the Lyapunov inequality . The hard constraint in (7c) enforces via
The objective uses and , which maximizes trace( ) with light quadratic regularization ( ).
Scen-Opt solves the SDP with N = 100 scenarios. The optimal Lyapunov matrix is
with complexity , no degeneracy, and risk bounds at 99.9999% confidence. Only a single scenario constraint supports the solution, corresponding to the smallest sampled value , where the maximum eigenvalue of approaches zero. The SDP is solved in 1.7 seconds.
A.3.4 Quadratic Stability - Coupled Oscillator
Consider a 3-state coupled oscillator with two uncertain parameters:

Fig. 17: Left. Stabilizing trajectories for example scenarios . Center. Risk bounds for the quadratic stability with complexity . Right. Stability margins for each sampled scenario, with red less stable and blue more stable.
where
Here models a well-damped coupled oscillator, perturbs the stiffness of the first mode, and perturbs the inter-mode coupling and damping. This maps to the SDP inequality form (7) with decision variable
the six independent entries of the symmetric Lyapunov matrix , where are the standard basis matrices for the symmetric space. The scenario constraint matrices in (7b) are
The hard constraint in (7c) enforces via
The objective uses and , which minimizes with no regularization .
Scen-Opt solves the SDP with scenarios sampled uniformly over . The optimal solution is
with complexity , no degeneracy, and risk bounds at 99.9999% confidence. The Lyapunov matrix is not a scalar multiple of the identity: is noticeably larger than and , reflecting the need for additional Lyapunov weight on the second state to certify stability across the parameter space. One scenario constraint supports the solution , corresponding to a near-worst-case parameter realization close to the corner where the stability margin is tightest.
B JSON Program Files for the Illustrative Examples
Instead of entering each matrix through the dialog boxes of the web interface (Section 5), a complete problem can be loaded in one step from a JSON program file through button <10> in Fig. 4, either by uploading the file or by pasting its content. Listings 8–10 give the
Wooding et al.
program files of Examples 1, 2 and 3, taken from the benchmarks folder of the repository. Each listing can be copied and pasted directly into Scen-Opt; after uploading the scenarios through <7>, pressing Solve reproduces the results reported in Appendix A.
The keys follow the notation of Section 3. The key type selects the program class (LP, QP or SDP), and mode selects symbolic or numeric input. The keys c, Q, G and h hold the matrices of the same name, A_d and b_d hold and , and F_d and E hold and under the keys "0", "1", ... The keys rho, tau, x_ref and p hold , , and the norm order p, and confidence holds . The dimensions d, m and n are given by n_x, rows_A and rows_G for LP and QP, and by n_x, lmi_size and lmi_e_size for SDP. Matrices are written row by row, and every entry is a string, so that the entries of , and can be expressions in the scenario components delta[0], delta[1], ... The scenarios themselves are not part of the program file.
{ "type": "LP", "A_d": [["-1", "-1"], ["1", "-1"]], "b_d": [["delta[0]"], [-"delta[0]"]], "G": [], "h": [], "c": [["0"], ["1"]], "rho": "0", "tau": "0", "x_ref": [], "p": "", "confidence": "1e-06", "mode": "symbolic", "n_x": 2, "rows_A": 2, "rows_G": 0 }
Listing 8: JSON program file for Example 1 (smallest enclosing interval, robust LP; case study in Appendix A.1.4), taken from benchmarks/LP_half_width_2d/data/program_symbolic.json. Here delta[0] is the sampled point . The fields G and h (no hard constraints) and x_ref and p (no regularization) are not used in this example: they can be omitted, as in the repository file, or left empty, as shown. The listing can be copied and pasted directly into Scen-Opt.
{ "type": "QP", "A_d": [["-delta[0]*delta[2]", "-delta[1]*delta[2]", "-delta[2]]], "b_d": [["1"]], "G": [], "h": [], "c": [["0"], ["0"], ["0"]], "Q": [["1", "0", "0"], ["0", "1", "0"], ["0", "0", "0"]], "rho": "0", "tau": "0", "x_ref": [], "p": "", "confidence": "1e-06", "mode": "symbolic", "n_x": 3, "rows_A": 1, "rows_G": 0 }
Listing 9: JSON program file for Example 2 (support vector machine, robust QP; Iris case study in Appendix A.2.3), taken from benchmarks/QP_Iris_minimal_3d/data/program_symbolic.json. Here delta[0], delta[1] and delta[2] are , and in (6). The fields G and h (no hard constraints) and x_ref and p (no regularization) are not used in this example: they can be omitted, as in the repository file, or left empty, as shown. The listing can be copied and pasted directly into Scen-Opt.
Wooding et al.
{ "type": "SDP", "c": [[-1], ["0"], [-1]], "Q": [[0.1], "0", "0"], ["0", "0.1", "0"], ["0", "0", "0.1]], "F_d": { "0": [[0", "0"], ["0", "0]], "1": [[0", "1"], ["1", "0]], "2": [[-4+0.6delta[0], "-1+0.1delta[0]], [-1+0.1delta[0], "2]], "3": [[0", "0.3delta[0]-2]], ["0.3delta[0]-2", "-2+0.2delta[0]]] }, "E": { "0": [[0", "0"], ["0", "0]], "1": [[-1", "0"], ["0", "0]], "2": [[0", "-1"], [-1", "0]], "3": [[0", "0"], ["0", "-1]] }, "rho": "1.0", "tau": "0", "x_ref": [], "p": "", "confidence": "1e-06", "mode": "symbolic", "n_x": 3, "lmi_size": 2, "lmi_e_size": 2 }
Listing 10: JSON program file for Example 3 (LPV stability, relaxed SDP; case study in Appendix A.3.3), taken from benchmarks/SDP_LPV_stability_3d/data/program_symbolic.json. The entries "0" to "3" of F_d and E are and , and delta[0] is the scalar parameter . The fields x_ref and p (no regularization, ) are not used in this example: they can be omitted, as in the repository file, or left empty, as shown. The listing can be copied and pasted directly into Scen-Opt.
C Detailed Function Implementation
The callable parameters A_d, b_d (LP/QP) and F_d (SDP) are typically generated by the parsing module (parsing.py), which provides generate_matrix_function() and generate_tensor_function() for converting user-supplied string expressions (e.g. "[[delta[0]+1, 0], [0, delta[1]]]") into evaluable Python functions, and their static counterparts generate_matrix() and generate_tensor() for constant matrices. All three solvers call the helper function get_support() (Section C.5) post-solve to identify support constraints and compute complexity.
C.1 solve_lp
def solve_lp(deltas, A_d, b_d, G, h, c, tau=0.0, x_ref=np.array([0.0]), rho=0.0, norm_type=2, solver=None, include_slack=None): return x_out, zeta_out, cost_out, N, complexity, constraints, degeneracy
Parameters:
– deltas: numpy.ndarray of shape . Each row is substituted into A_d and b_d to form per-scenario constraints.
– A_d: Callable[[numpy.ndarray], numpy.ndarray]. Given a delta row returns an constraint matrix .
– b_d: Callable[[numpy.ndarray], numpy.ndarray]. Given a delta row returns an right-hand side vector .
– G: numpy.ndarray of shape (may be an empty array to omit hard constraints).
– h: numpy.ndarray of shape corresponding to G.
– c: numpy.ndarray of length n (or shape ), objective linear coefficients.
– tau: float. Weight for the regularization term , which is omitted when .
– x_ref: numpy.ndarray broadcastable to same shape as x (default np.array([0.0])).
– rho: float. Weight of the penalty on the nonnegative slack variables of length (one per scenario), which are added when include_slack is true (or, if it is None, when ).
– norm_type: int, float or str. Order p of the vector norm in the regularization term: any (default 2), "inf", or "fro" (the same as p = 2).
– solver: Optional[str]. CVXPY solver or None (chooses default solver).
– include_slack: Optional[bool]. Whether to add the slack variables of the relaxation formulation. None (default) adds them only when .
Return values:
– x_out: numpy.ndarray of shape . Optimizer solution for x.
– zeta_out: numpy.ndarray of shape . Slack variable values (zeros if no slack variables are used).
– cost_out: float. Optimal objective value.
– N: int. Number of rows N in deltas used to build robust constraints.
– complexity: int. Number of scenario constraints in the support list identified post-solve.
– constraints: list of CVXPY constraint objects: the N scenario constraints (the hard constraints are not included).
– degeneracy: bool. Flag indicating whether degeneracy was detected when computing the support list.
https://www.cvxpy.org/tutorial/solvers/index.html
Wooding et al.
Exceptions and Error Checking:
– Raises ValueError if deltas has no rows.
– Raises ValueError if CVXPY problem status is not "optimal" or "optimal_inaccurate".
C.2 solve_qp
def solve_qp(deltas, A_d, b_d, G, h, c, Q, tau=0.0, x_ref=np.array([0.0]), rho=0.0, norm_type=2, solver=None, include_slack=None): return x_out, zeta_out, cost_out, N, complexity, constraints, degeneracy
Parameters:
– deltas: numpy.ndarray of shape . Each row is substituted into A_d and b_d to form per-scenario constraints.
– A_d: Callable[[numpy.ndarray], numpy.ndarray]. Given a delta row returns an constraint matrix .
– b_d: Callable[[numpy.ndarray], numpy.ndarray]. Given a delta row returns an right-hand side vector .
– G: numpy.ndarray of shape (may be an empty array to omit hard constraints).
– h: numpy.ndarray of shape corresponding to G.
– c: numpy.ndarray of length n (or shape ), objective linear coefficients.
– Q: numpy.ndarray of shape . Symmetric positive semidefinite quadratic cost matrix.
– tau: float. Weight for the regularization term , which is omitted when .
– x_ref: numpy.ndarray broadcastable to same shape as x (default np.array([0.0])).
– rho: float. Weight of the penalty on the nonnegative slack variables of length (one per scenario), which are added when include_slack is true (or, if it is None, when ).
– norm_type: int, float or str. Order p of the vector norm in the regularization term: any (default 2), "inf", or "fro" (the same as p = 2).
– solver: Optional[str]. CVXPY solver or None (chooses default solver).
– include_slack: Optional[bool]. Whether to add the slack variables of the relaxation formulation. None (default) adds them only when .
Return values:
– x_out: numpy.ndarray of shape . Optimizer solution for x.
– zeta_out: numpy.ndarray of shape . Slack variable values (zeros if no slack variables are used).
– cost_out: float. Optimal objective value.
– N: int. Number of rows N in deltas used to build robust constraints.
– complexity: int. Number of scenario constraints in the support list identified post-solve.
– constraints: list of CVXPY constraint objects: the N scenario constraints (the hard constraints are not included).
– degeneracy: bool. Flag indicating whether degeneracy was detected when computing the support list.
Exceptions and Error Checking:
– Raises ValueError if deltas has no rows.
– Raises ValueError if CVXPY problem status is not "optimal" or "optimal_inaccurate".
– Raises AssertionError if Q is not positive semidefinite or not symmetric.
C.3 solve_sdp
def solve_sdp(deltas, F_d, E, c, Q, tau=0.0, x_ref=\texttt{np.array([0.0])}, rho=0.0, norm_type=2, solver=None, include_slack=None): return x_out, zeta_out, cost_out, N, complexity, constraints, degeneracy
Parameters:
– deltas: numpy.ndarray of shape . Each row is substituted into F_d form per-scenario constraints.
– F_d: Callable[[numpy.ndarray], dict]. Given a delta row returns a dictionary of matrices with keys like '0', '1', ..., 'd' denoting the constant term.
– E: dict of numpy.ndarray. Optional hard constraint matrices keyed as in F_d.
– Q: numpy.ndarray of shape . Symmetric positive semidefinite quadratic cost matrix.
– c: numpy.ndarray of length n (or shape ), objective linear coefficients.
– tau: float. Weight for the regularization term , which is omitted when .
– x_ref: numpy.ndarray broadcastable to same shape as x (default np.array([0.0])).
– rho: float. Weight of the penalty on the nonnegative slack variables of length (one per scenario), which are added when include_slack is true (or, if it is None, when ).
– norm_type: int, float or str. Order p of the vector norm in the regularization term: any (default 2), "inf", or "fro" (the same as p = 2).
– solver: Optional[str]. CVXPY solver or None (chooses default solver).
– include_slack: Optional[bool]. Whether to add the slack variables of the relaxation formulation. None (default) adds them only when .
Return values:
– x_out: numpy.ndarray of shape . Optimizer solution for x. Note: unlike the LP and QP solvers which return a column vector of shape , the SDP solver returns a 1-D array.
– zeta_out: numpy.ndarray of shape . Slack variable values (zeros if no slack variables are used).
– cost_out: float. Optimal objective value.
– N: int. Number of rows N in deltas used to build robust constraints.
– complexity: int. Number of scenario constraints in the support list identified post-solve.
– constraints: list of CVXPY constraint objects: the N scenario constraints (the hard constraints are not included).
– degeneracy: bool. Flag indicating whether degeneracy was detected when computing the support list.
Exceptions and Error Checking:
– Raises ValueError if deltas has no rows.
– Raises ValueError if CVXPY problem status is not "optimal" or "optimal_inaccurate".
– Raises AssertionError if Q is not positive semidefinite or not symmetric.
– Raises AssertionError if any F_d(\delta) matrices are not symmetric.
– Raises AssertionError if any E matrices are not symmetric.
C.4 quantify_risk
def quantify_risk(k, N, beta): return epsL, epsU
Wooding et al.
Parameters:
– k: int. Complexity, i.e. length of support list.
– N: int. Number of scenarios.
– beta: float. User-defined confidence parameter .
Return values:
– epsL: float. Lower bound of the risk .
– epsU: float. Upper bound of the risk .
Implementation details:
– Uses the regularized incomplete beta function betainc from jax.scipy.special.
– Both bounds are computed via binary search with convergence tolerance .
– Special case: if the upper bound is set to 1.0 immediately (all scenarios are support constraints, so no generalization guarantee is possible).
C.5 get_support
def get_support(constraints, non_risk_constraints, prob, objective, solver=None, threshold=1e-8, sol_tol=1e-6): return complexity, support, degeneracy
Parameters:
– constraints: list. List of CVXPY scenario constraint objects (one per scenario).
– non_risk_constraints: list (may be empty). Hard constraint(s), always enforced when re-solving and never counted in the complexity.
– prob: CVXPY Problem. The solved problem instance whose solution and duals are used.
– objective: CVXPY objective expression used to re-solve reduced problems.
– solver: Optional[str]. Choice of CVXPY solver passed to Problem.solve when validating candidate supports.
– threshold: float (default 1e-8). Dual-value threshold for the initial screening of candidate support-list members (violated or active constraints).
– sol_tol: float (default 1e-6). Relative tolerance for judging whether a re-solve reproduces the reference optimal value; set above the solver's value-reproducibility and below the smallest meaningful support contribution.
Return values:
– complexity: int. Number of items in the support list.
– support: list. Final support list of CVXPY constraint objects, i.e., violated or active scenario constraints whose removal changes the optimal value.
– degeneracy: bool. True if degeneracy was detected during validation/reduction procedures, i.e., when the reduction removes a screened constraint that is active or violated at the optimum, or when the dual screening fails to reproduce the optimum (conservative fallback).
Implementation details:
Internally uses the helper function test_support(objective, support, non_risk, ref, solver) to validate candidate support lists: it re-solves the problem with the candidate constraints plus the always-enforced hard constraints and returns True if the optimal value matches the reference (cf. Section 4).
Exceptions and Error Checking:
– Raises ValueError if validation fails to produce a consistent support list (suggests trying another solver).