This package provides computation of various bounds of the Scenario Theory pioneered by Marco Campi and Simone Garatti [1]. Scenario theory is commonly framed as optimization [1] or compression [2]; this package supports neither. Instead, the purpose is, given the number of samples, the desired confidence, and the number of decision variables/support constraints/compressed size, to compute the level of violation defined as the probability of a change of compression.
The computation of the violation is numerically unstable with both large binomial coefficients and large exponents of values in the range [0, 1], which are hard to represent with floats. I strongly recommend that you do not try to do it manually - this is exactly why I created this package.
A goal is to also support inverse problems: given a desired confidence and (a bound on) compression cardinality, compute the required number of samples.
To install the package, run the following command from a Julia REPL.
(v1.11) pkg> add ScenarioTheoryThe package is used as follows:
using ScenarioTheory
samples = 1500
decision_variables = 30
β = 1e-6 # the confidence is 1 - β
theory = ScenarioOptimization(samples, decision_variables)
ϵ_lower, ϵ_upper = violation(theory, β)
# Output: ϵ_lower = 0.0, ϵ_upper = 0.041878994612488896This theory is the original based around convex optimization with chance-constraints [1]. That is, define the violation probability
Then,
Warning
The theory requires that almost surely the problem is feasible and the solution is unique. This is not checked by this code (it does not have access to the distribution nor the optimization problem); it is your responsibility to check that.
To compute
using ScenarioTheory
samples = 1500
decision_variables = 30
β = 1e-6 # the confidence is 1 - β
theory = ScenarioOptimization(samples, decision_variables)
ϵ_lower, ϵ_upper = violation(theory, β)ϵ_lower is always zero for ScenarioOptimization.
This theory is similar to vanilla scenario optimization except that, rather than relying on the number of decision variables, it relies on the number of support constraints (from
Warning
The theory requires that almost surely the problem is feasible, the solution is unique, and the solution with only the support constraints coincides with the solution with all constraints (non-degeneracy). This is not checked by this code (it does not have access to the distribution nor the optimization problem); it is your responsibility to check that.
To compute
using ScenarioTheory
samples = 1500
support_constraints = 10
β = 1e-6 # the confidence is 1 - β
theory = WaitAndJudge(samples, support_constraints)
ϵ_lower, ϵ_upper = violation(theory, β)ϵ_lower is always zero for WaitAndJudge.
This theory is a modern reformulation and generalization in terms of compression. To this end, let
Warning
The theory requires that compression function satisfies a preference property (see [3]). This is not checked by this code (it does not have access to the compression function); it is your responsibility to check that.
To compute
using ScenarioTheory
samples = 1500
compression = 10
β = 1e-6 # the confidence is 1 - β
theory = CompressionOneTail(samples, compression)
ϵ_lower, ϵ_upper = violation(theory, β)ϵ_lower is always zero for CompressionOneTail.
This theory is an extension to no only upper but also lower bounds on the violation probability.
Then,
Warning
The theory requires that compression function satisfies a preference property, the distribution has no concentrated mass, and the compression function is almost surely non-associative (see [3]). This is not checked by this code (it does not have access to the distribution nor the compression function); it is your responsibility to check that.
To compute
using ScenarioTheory
samples = 1500
compression = 10
β = 1e-6 # the confidence is 1 - β
theory = CompressionTwoTail(samples, compression)
ϵ_lower, ϵ_upper = violation(theory, β)[1] Campi, M. C., & Garatti, S. (2008). The exact feasibility of randomized solutions of uncertain convex programs. SIAM Journal on Optimization, 19(3), 1211-1230.
[2] Campi, M. C., & Garatti, S. (2023). Compression, generalization and learning. Journal of Machine Learning Research, 24(339), 1-74.
[3] Campi, M. C., & Garatti, S. (2018). Wait-and-judge scenario optimization. Mathematical Programming, 167(1), 155-189.