# Branin Function

**URL:** <https://uqworld.org/t/branin-function/53>\
**Category:** Benchmarks\
**Tags:** 2-dimension, test-function, optimization, metamodeling\
**Created:** [January 24, 2019, 3:00pm UTC](https://uqworld.org/t/branin-function/53 "2019-01-24T15:00:13Z")\
**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:** [January 24, 2019, 3:00pm UTC](https://uqworld.org/t/branin-function/53/1 "2019-01-24T15:00:13Z")

</div>

The Branin function is commonly used as a test function for metamodeling in computer experiments, especially in the context of optimization (Forrester et al., 2008; Picheny et al., 2012).

## Description

The analytic expression of the Branin function is given as:

f(\mathbf{x}) = a (x\_2 - b x\_1^2 + c x\_1 - r)^2 + s (1-t) \cos{x\_1} + s; \;\; x\_1 \in [-5, 10], \;\; x\_2 \in [0, 15],

where \mathbf{x} = \{x\_1, x\_2\} are input variables; and a, b, c, r, s, t are constants.

Figure 1 and 2 show the surface and contour plots of the Branin function using the default values of the constants, respectively.

![braninSurface](https://uqworld.org/uploads/default/original/1X/12c9ee4fc6c721e40fb004a74fa5e9a27815c6c2.png)  
**Figure 1** : Surface plot of the Branin function.

![braninContour](https://uqworld.org/uploads/default/original/1X/bf5286c0f8b3a40901ec72f1fe9237b9d8bf4cce.png)  
**Figure 2** : Contour plot of the Branin function.

## Inputs

For computer experiments, the input variables x\_1, x\_2 are modeled as two independent uniform random variables.

| No | Variable | Distribution | Parameters |
| --- | --- | --- | --- |
| 1 | x\_1 | Uniform | x\_{1,\min} = -5,  
x\_{1,\max} = 10 |
| 2 | x\_2 | Uniform | x\_{2,\min} = 0,  
 x\_{2,\max} = 15 |

## Constants

The default values for the constants are shown below.

| No | Constant | Value |
| --- | --- | --- |
| 1 | a | 1 |
| 2 | b | \frac{5.1}{(2 \pi)^2} |
| 3 | c | \frac{5}{\pi} |
| 4 | r | 6 |
| 5 | s | 10 |
| 6 | t | \frac{1}{8\pi} |

## Reference values

Using the constants above, three (identical) global minima of the function, f(\mathbf{x}^\*\_i) = 0.397887, are located at:

- \mathbf{x}^\*\_{1} = (-\pi, 12.275)
- \mathbf{x}^\*\_{2} = (\pi, 2.275)
- \mathbf{x}^\*\_{3} = (9.42478, 2.475)

## Resources

The vectorized implementation of the Branin function 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\_branin.zip](https://uqworld.org/uploads/default/original/1X/1b70153a678655ef177cfdf8e866552459109e40.zip) (2.4 KB)

The contents of the file are:

| Filename | Description |
| --- | --- |
| `uq_branin.m` | vectorized implementation of the Branin function |
| `uq_Example_branin.m` | definitions for the model and probabilistic inputs in UQLab |
| `LICENSE` | license for the function (BSD 3-Clause) |

## References

- A. Forrester, A. Sóbester, and A. Keane, _Engineering Design via Surrogate Modelling: A Practical Guide_, West Sussex: John Wiley & Sons Ltd., 2008, pp. 196-197. [DOI:10.1002/9780470770801](https://doi.org/10.1002/9780470770801)
- V. Picheny, T. Wagner, and D. Ginsbourger, “A benchmark of Kriging-based infill criteria for noisy optimization,” _HAL_, hal-00658212, 2012. [URL](https://hal.archives-ouvertes.fr/hal-00658212/document)
