Skip to content

Commit

Permalink
Merge pull request #165 from mrava87/doc-rosenbrock
Browse files Browse the repository at this point in the history
doc: Added Rosebrock function definition
  • Loading branch information
mrava87 authored Feb 26, 2024
2 parents 592dc71 + 6cebb94 commit b4a78b3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions tutorials/nonlinearconstrained.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@
========================================
In this tutorial we focus on a modification of the `Quadratic program
with box constraints` tutorial where the quadratic function is replaced by a
nonlinear function. For this example we will use the well-known Rosenbrock
function:
nonlinear function:
.. math::
\mathbf{x} = \argmin_\mathbf{x} f(\mathbf{x}) \quad \text{s.t.} \quad \mathbf{x}
\in \mathcal{I}_{\operatorname{Box}}
For this example we will use the well-known Rosenbrock
function:
.. math::
f(\mathbf{x}) = (a - x)^2 + b(y - x^2)^2
where :math:`\mathbf{x}=[x, y]`, :math:`a=1`, and :math:`b=10`.
We will learn how to handle nonlinear functionals in convex optimization, and
more specifically dive into the details of the
:class:`pyproximal.proximal.Nonlinear` operator. This is a template operator
Expand Down Expand Up @@ -199,9 +206,9 @@ def callback(x):

fig, ax = contour_rosenbrock(x, y)
steps = np.array(steps)
ax.plot(steps[:, 0], steps[:, 1], '.-k', lw=2, ms=20, alpha=0.4)
ax.contour(X, Y, indic, colors='k')
ax.scatter(1, 1, c='k', s=300)
ax.plot(steps[:, 0], steps[:, 1], '.-k', lw=2, ms=20, alpha=0.4, label='GD')
ax.plot(xhist_pg[:, 0], xhist_pg[:, 1], '.-b', ms=20, lw=2, label='PG')
ax.plot(xhist_admm[:, 0], xhist_admm[:, 1], '.-g', ms=20, lw=2, label='ADMM')
ax.plot(xhist_admm_lbfgs[:, 0], xhist_admm_lbfgs[:, 1], '.-m', ms=20, lw=2,
Expand Down

0 comments on commit b4a78b3

Please sign in to comment.