# Two-sided chance constraints¶

JuMPChance supports two-sided chance constraints of the form

where \(l\), \(x\), and \(u\) are decision variables or affine functions of decision variables, \(z\) is a vector of independent jointly normal random variables with provided means and variances, and \(0 < \epsilon < \frac{1}{2}\). This constraint holds iff there exists \(t\) such that \(t \geq \sqrt{\sum_i (\sigma_ix_i)^2}\) and \((l-\mu^Tx,u-\mu^Tx,t) \in \bar S_\epsilon\) where

Note that \(\bar S_\epsilon\) is the conic hull of \(S_\epsilon\) where

A report outlining these results is available on arXiv.

## Using two-sided constraints¶

The syntax for two-sided constraints is as follows:

```
@constraint(m, l <= x*z <= u, with_probability = 0.95, approx="1.25")
@constraint(m, l <= x*z <= u, with_probability = 0.95, approx="2.0")
```

Any affine expression of the decision variables can appear as lower or upper bounds. Random variables may only appear in the expression in the middle. You can use `sum{}`

as in standard JuMP constraints, e.g.:

```
@constraint(m, l <= sum{ x[i]*z[i], i=1:n } + sum{ c[j], j=1:m } <= u)
```

Given a chance constraint with probability \(1-\epsilon\), the current implementation provides two different formulations, indicated by the `approx`

parameter. The `approx`

parameter may be set to `"1.25"`

or `"2.0"`

. The formulation guarantees that that the constraint will be satisfied with probability \(1-approx*\epsilon\). This is *not* a conservative approximation. After a model is solved, you can check the probability level at which a constraint holds as follows:

```
constraint_ref = @constraint(m, l <= x*z <= u, with_probability = 1-0.05, approx="1.25")
solve(m, method=:Reformulate)
satisfied_with = JuMPChance.satisfied_with_probability(constraint_ref)
println("The chance constraint is satisfied with probability $satisfied_with.")
```