Skip to content

Commit 6cebb94

Browse files
committed
doc: Added Rosebrock function definition
1 parent 592dc71 commit 6cebb94

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tutorials/nonlinearconstrained.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,20 @@
33
========================================
44
In this tutorial we focus on a modification of the `Quadratic program
55
with box constraints` tutorial where the quadratic function is replaced by a
6-
nonlinear function. For this example we will use the well-known Rosenbrock
7-
function:
6+
nonlinear function:
87
98
.. math::
109
\mathbf{x} = \argmin_\mathbf{x} f(\mathbf{x}) \quad \text{s.t.} \quad \mathbf{x}
1110
\in \mathcal{I}_{\operatorname{Box}}
1211
12+
For this example we will use the well-known Rosenbrock
13+
function:
14+
15+
.. math::
16+
f(\mathbf{x}) = (a - x)^2 + b(y - x^2)^2
17+
18+
where :math:`\mathbf{x}=[x, y]`, :math:`a=1`, and :math:`b=10`.
19+
1320
We will learn how to handle nonlinear functionals in convex optimization, and
1421
more specifically dive into the details of the
1522
:class:`pyproximal.proximal.Nonlinear` operator. This is a template operator
@@ -199,9 +206,9 @@ def callback(x):
199206

200207
fig, ax = contour_rosenbrock(x, y)
201208
steps = np.array(steps)
202-
ax.plot(steps[:, 0], steps[:, 1], '.-k', lw=2, ms=20, alpha=0.4)
203209
ax.contour(X, Y, indic, colors='k')
204210
ax.scatter(1, 1, c='k', s=300)
211+
ax.plot(steps[:, 0], steps[:, 1], '.-k', lw=2, ms=20, alpha=0.4, label='GD')
205212
ax.plot(xhist_pg[:, 0], xhist_pg[:, 1], '.-b', ms=20, lw=2, label='PG')
206213
ax.plot(xhist_admm[:, 0], xhist_admm[:, 1], '.-g', ms=20, lw=2, label='ADMM')
207214
ax.plot(xhist_admm_lbfgs[:, 0], xhist_admm_lbfgs[:, 1], '.-m', ms=20, lw=2,

0 commit comments

Comments
 (0)