diff --git a/convex_optimization.pdf b/convex_optimization.pdf index 9965c92f3ed613eb8719355837d192574cd9125a..dc31a63a43912036ccb8fb9c8f6574baf917faf3 100644 Binary files a/convex_optimization.pdf and b/convex_optimization.pdf differ diff --git a/convex_optimization.tex b/convex_optimization.tex index bf307523aec94e5c256f376c2ed96d8d7fea29f7..4aaf9a86d67d354d156feffd92c6702fd9023419 100644 --- a/convex_optimization.tex +++ b/convex_optimization.tex @@ -12,8 +12,12 @@ \usepackage{float} \usepackage{commath} \usepackage{tikz} +\usepackage{pgfplots} +\usepgfplotslibrary{patchplots} +\pgfplotsset{compat=newest} +\pgfplotsset{plot coordinates/math parser=false} \usepackage{tikz-3dplot} -\usetikzlibrary{calc} +\usetikzlibrary{calc,intersections} \usepackage{listings} \usepackage{enumitem} \usepackage{algorithm2e} @@ -77,13 +81,38 @@ We distinguish (for now) three classes od optimization problems: \end{description} Note that every LP is a convex optimization problem and every convex optimization problem is an NLP. In particular, every LP is also an NLP. -Intuitively $\alpha a + \beta b$ with $\alpha + \beta = 1$ and $\alpha, \beta \geq 0$ is a straight line segment between $a$ and $b$: $\alpha a + \beta b = (1-\beta)a + \beta b = a + \beta(b-a)$. -\begin{figure} - %TODO straight line +Intuitively, $\alpha a + \beta b$ with $\alpha + \beta = 1$ and $\alpha, \beta \geq 0$ is a straight line segment between $a$ and $b$: $\alpha a + \beta b = (1-\beta)a + \beta b = a + \beta(b-a)$. +\begin{figure}[H] + \centering + \begin{tikzpicture} + \path (0, 0) coordinate(a) -- (2, 1) coordinate(b); + \draw[-] (a) -- (b) node[pos=-.1] {$a$} node[pos=1.1] {$b$}; + \draw[->,shorten >= .2cm] (.2, 0) -- +($(b) - (a)$) node[pos=.5, below right] {\scriptsize$(b-a)$}; + \end{tikzpicture} \end{figure} -Hence, the condition for a function $f$ to be convex is that any straight line segment between two arbitrary points $(a, f(a)), (b, f(b)$ is above every point of the function between $a$ and $b$. -\begin{figure} - %TODO convex and non-convex function +Hence, the condition for a function $f$ to be convex is that any straight line segment between two arbitrary points $(a, f(a)), (b, f(b))$ is above every point of the function between $a$ and $b$. +\begin{figure}[H] + \centering + %\begin{tikzpicture} + % \begin{axis}[axis y line=left, xmin=0, xmax=5, xlabel=$x$, ylabel=$f(x)$, ymin=-3.5, ymax=2, xtick={\empty}, ytick={\empty}, axis on top, axis x line=bottom, every axis plot post/.append style={mark=none,domain=0:5,samples=50,smooth}] + % \addplot{x^2 - 5*x + 4}; + % \end{axis} + %\end{tikzpicture} + \begin{tikzpicture} + \begin{axis}[width=5in,axis equal image, + axis lines=middle, + xmin=0,xmax=8, + xlabel=$x$,ylabel=$f(x)$, + ymin=0,ymax=4, + xtick={\empty},ytick={\empty}, axis on top + ] + \addplot[thick,domain=0.25:7,blue,name path=A] {-x/3 + 2.75} coordinate[pos=0.4] (m) ; + \draw[thick,blue,name path=B] (0.15,4) .. controls (1,1) and (4,0) .. (6,2) coordinate[pos=0.075] (a1) coordinate[pos=0.95] (a2); + \path[name intersections={of=A and B, by={a,b}}]; + \draw[densely dashed] (0,0) -| node[pos=0.5, color=black, below] {$a$}(a); + \draw[densely dashed] (0,0) -| node[pos=0.5, color=black, below] {$b$}(b); + \end{axis} + \end{tikzpicture} \end{figure} \section{Theory}