# Modified Rastrigin Function

**URL:** <https://uqworld.org/t/modified-rastrigin-function/126>\
**Category:** Benchmarks\
**Tags:** 2-dimension, test-function, reliability\
**Created:** [April 8, 2019, 7:11am UTC](https://uqworld.org/t/modified-rastrigin-function/126 "2019-04-08T07:11:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![damarginal](https://uqworld.org/user_avatar/uqworld.org/damarginal/32/73_2.png) [@damarginal](https://uqworld.org/u/damarginal)\
**Post date:** [April 8, 2019, 7:11am UTC](https://uqworld.org/t/modified-rastrigin-function/126/1 "2019-04-08T07:11:06Z")

</div>

The 2-dimensional modified Rastrigin function is a test function for reliability analysis algorithms (Echard et al., 2011). It is a modification of the Rastrigin function (Mühlenbein et al. 1991) to include positive and negative values (i.e., safe and failed points, respectively). It features a highly non-linear limit state function with non-convex and non-connex failure domains (Echard et al., 2011).

## Description

The analytic expression of the modified Rastrigin function is given as:

g(\mathbf{x}) = 10 - \sum\_{m=1}^2 (x\_m^2 - 5 \cos{(2 \pi x\_m)})

where \mathbf{x} = \{x\_1, x\_2\} is the vector of input variables.

The failure event and the failure probability are defined as g(\mathbf{x}) \leq 0 and P\_f = \mathbb{P}[g(\mathbf{x}) \leq 0], respectively. Figure 1 and 2 show the surface and contour plots of the modified Rastrigin function, respectively. In Figure 2, the limit state function at which g(\mathbf{x}) = 0 is highlighted.

![modifiedRastriginSurface](https://uqworld.org/uploads/default/original/1X/dff6ab39fb4f101e208f4ae4f46ed43e5e8528ff.png)  
**Figure 1** : Surface plot of the modified Rastrigin function.

![modifiedRastriginContour](https://uqworld.org/uploads/default/original/1X/156460aa253051327a7f40aabc477cf8473ff82c.png)  
**Figure 2** : Contour plot of the modified Rastrigin function. The limit state function at which g(\mathbf{x}=0) is highlighted.

## Inputs

The inputs x\_1 and x\_2 are modeled as two independent standard Gaussian random variables.

| No | Variable | Distribution | Parameters |
| --- | --- | --- | --- |
| 1 | x\_1 | Gaussian | \mu\_{x\_1} = 0,  
\sigma\_{x\_1} = 1.0 |
| 2 | x\_2 | Gaussian | \mu\_{x\_2} = 0,  
\sigma\_{x\_2} = 1.0 |

## Reference values

Some reference values for the failure probability P\_f are given in the table below.

| Method | N | \hat{P}\_f | \text{COV}[\hat{P}\_f] | Source |
| --- | --- | --- | --- | --- |
| MCS | 6 \times 10^4 | 7.34 \times 10^{-2} | 1.5\% | Echard et al. (2011) |
| MCS | 10^6 | 7.31 \times 10^{-2} | 0.36\% | UQLab v1.2.1 |
| Subset simulation | 5'000 | 7.65 \times 10^{-2} | - | Echard et al. (2011) |

## Resources

The vectorized implementation of the modified Rastrigin in MATLAB as well as the script file with the model and probabilistic inputs definitions for the function in UQLAB can be downloaded below:

[uq\_modifiedRastrigin.zip](https://uqworld.org/uploads/default/original/1X/4a07d23f185e00a22c906814f89fa5976c1363b1.zip) (2.4 KB)

The contents of the file are:

| Filename | Description |
| --- | --- |
| `uq_modifiedRastrigin.m` | vectorized implementation of the modified Rastrigin function in MATLAB |
| `uq_Example_modifiedRastrigin.m` | definitions for the model and probabilistic inputs in UQLab |
| `LICENSE` | license for the function (BSD 3-Clause) |

## References

- H. Mühlenbein, M. Schomisch, and J. Born, “The parallel genetic algorithm as function optimizer,” Parallel Computing, vol. 17, pp. 619–632, 1991. [DOI:10.1016/S0167-8191(05)80052-3](https://doi.org/10.1016/S0167-8191(05)80052-3)
- B. Echard, N. Gayton, and M. Lemaire, “AK-MCS: An active learning reliability method combining Kriging and Monte Carlo Simulation,” Structural Safety, vol. 33, pp. 145–154, 2011. [DOI:10.1016/j.strusafe.2011.01.002](https://doi.org/10.1016/j.strusafe.2011.01.002)
