Skip to content

Commit e9dca08

Browse files
Merge pull request #1002 from mikeingold/docs
Clarify Rosenbrock examples documentation
2 parents 7d3edcb + 1e25ec2 commit e9dca08

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

docs/src/examples/rosenbrock.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,34 @@ for common workflows of the package and give copy-pastable starting points.
1111
the installation and usage of OptimizationOptimJL.jl package, see the
1212
[Optim.jl page](@ref optim).
1313

14+
The objective of this exercise is to determine the $(x, y)$ value pair that minimizes the result of a Rosenbrock function $f$ with some parameter values $a$ and $b$. The Rosenbrock function is useful for testing because it is known *a priori* to have a global minimum at $(a, a^2)$.
15+
```math
16+
f(x,\,y;\,a,\,b) = \left(a - x\right)^2 + b \left(y - x^2\right)^2
17+
```
18+
19+
The Optimization.jl interface expects functions to be defined with a vector of optimization arguments $\bar{x}$ and a vector of parameters $\bar{p}$, i.e.:
20+
```math
21+
f(\bar{x},\,\bar{p}) = \left(p_1 - x_1\right)^2 + p_2 \left(x_2 - x_1^2\right)^2
22+
```
23+
24+
Parameters $a$ and $b$ are captured in a vector $\bar{p}$ and assigned some arbitrary values to produce a particular Rosenbrock function to be minimized.
25+
```math
26+
\bar{p} = \begin{bmatrix} a \\ b \end{bmatrix} = \begin{bmatrix} 1 \\ 100 \end{bmatrix}
27+
```
28+
29+
The original $x$ and $y$ domains are captured in a vector $\bar{x}$.
30+
```math
31+
\bar{x} = \begin{bmatrix} x \\ y \end{bmatrix}
32+
```
33+
34+
An initial estimate $\bar{x}_0$ of the minima location is required to initialize the optimizer.
35+
```math
36+
\bar{x}_0 = \begin{bmatrix} x_0 \\ y_0 \end{bmatrix} = \begin{bmatrix} 0 \\ 0 \end{bmatrix}
37+
```
38+
39+
40+
An optimization problem can now be defined and solved to estimate the values for $\bar{x}$ that minimize the output of this function.
41+
1442
```@example rosenbrock
1543
# Define the problem to solve
1644
using Optimization, ForwardDiff, Zygote

0 commit comments

Comments
 (0)