Commit 99d588b3 authored by Niklas's avatar Niklas

added tableau example with figures

parent af358a6a
No preview for this file type
......@@ -8,6 +8,9 @@
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage{array}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[linesnumbered, ruled, vlined]{algorithm2e}
\usepackage{graphicx}
\usepackage{float}
\usepackage{tikz}
......@@ -18,6 +21,7 @@
\usepackage{wrapfig}
%\usepackage{bbold}
\usepackage{bbm}
\usepackage{bm}
\usepackage[justification=centering]{caption}
\usetikzlibrary{arrows, automata, graphs, shapes, petri, decorations.pathmorphing}
\parindent = 0pt
......@@ -31,6 +35,7 @@
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\newtheorem*{remark*}{Remark}
\newtheorem*{example*}{Example}
\theoremstyle{plain}
\newtheorem{lemma}[definition]{Lemma}
......@@ -241,7 +246,7 @@ $$
Every face itself is again a polyhedron. A point $x \in P$ is called \emph{feasible solution}, $x^\ast \in P$ such that $c^T x^\ast \geq c^T x$ for all $x \in P$ is called \emph{optimal solution} (provided that the objective function should be maximized), $c^T x^\ast$ is called \emph{optimum}.
\begin{theorem}
\begin{theorem}[Fundamental Theorem of Linear Programming]
For every LP exactly one of the following hold:
\begin{enumerate}
\item The LP is infeasible, i.e. $P = \emptyset$.
......@@ -343,7 +348,7 @@ The transformation from canonical form to standard form preserves dimension and
\begin{figure}[H]
\tdplotsetmaincoords{70}{45}
\centering
\begin{tikzpicture}[scale=3, >=latex', ]
\begin{tikzpicture}[scale=3, >=latex']
\begin{scope}[tdplot_main_coords]
\path[fill=gray!20] (0, 0, 0) -- (1, 0, 0) -- (0, 1.2, 0);
\draw[->] (0, 0, 0) -- (1.2, 0, 0) node[pos=1.1] {$x_1$};
......@@ -459,15 +464,145 @@ Otherwise we can find a non-basic variable that can ''improve`` the objective va
\end{itemize}
The first basis: If $b \geq 0$, all slack variables are a feasible basis, i.e. $B = (n+1, \ldots, n+m)$, and hence, $A_B = A_B^{-1} = \mathbbm{1}_m$ and $\bar{A}_N = A_N$, $\bar{b} = b$. The first basic solution is then $x_{n+i} = b_i$ for $i \in \{1, \ldots, m\}$ and $x_1 = \ldots = x_n = 0$ (i.e. the origin). Since $c_B^T = 0$ (all slack), we have $\bar{c}_N^T = C_N^T$ and $\bar{z} = 0$. For calculation by hand, we can store all coefficients in a \emph{dictionary} (or \emph{tableau}):
\begin{table}[h]
\begin{table}[H]
\def\arraystretch{1.3}
\centering
\begin{tabular}{c|ccc|}
\cline{2-4}
\begin{tabular}{c|cc|c|}
\toprule
\ & $\bar{c}_N^T$ & $0$ & $\bar{z}$\\
\cline{2-4}
\midrule
$x_B$ & $\bar{A}_N$ & $\mathbbm{1}_m$ & $\bar{b}$\\
\cline{2-4}
\bottomrule
\ & $x_N$ & $x_B$ & \
\end{tabular}
\end{table}
\begin{algorithm}
\caption{Basic Simplex algorithm}
\label{alg:simplex}
Compute initial basic feasible solution.\\
\While{Current basic solution not optimal} {
Move to best adjacent basic solution.
}
\end{algorithm}
In the following we demonstrate the Simplex method on a small example that captures the whole pivoting routines
\begin{example*}
We consider the LP in canonical form
\begin{align*}
\text{maximize } & 2 x_1 + x_2\\
\text{subject to } & 2x_1 - 3x_2 \leq 6\\
& x_1 + x_2 \leq 4\\
& x_1, x_2 \geq 0.
\end{align*}
The corresponding polytope is sketched in the next figure.
\begin{figure}[H]
\centering
\begin{tikzpicture}
\draw[->] (0, 0) -- (5, 0) node[below] {$x_2 \geq 0$};
\draw[->] (0, 0) -- (0, 5) node[left] {$x_1 \geq 0$};
\draw[-] (2.25, -.5) -- (4, 2/3) node[pos=1.1,right]{$2x_1-3x_2 \leq 6$};
\draw[-] (-.5, 4.5) -- (4, 0) node[pos=.5, above right]{$x_1+x_2 \leq 4$};
\end{tikzpicture}
\end{figure}
The corresponding LP in standard form is
\begin{align*}
\text{maximize } & 2x_1 + x_2\\
\text{subject to } & 2x_1 - 3x_2 + x_3 = 6\\
& x_1 + x_2 + x_4 = 4\\
& x_1, x_2, x_3, x_4 \geq 0
\end{align*}
Since $b = (6, 4) \geq (0, 0)$, we can choose the slack variables as basis, i.e. $B = (3, 4)$. Thus, the first basic solution is $(x_1, x_2, x_3, x_4) = (0, 0, 6, 4)$. From the standard form, we construct the initial simplex tableau.
\begin{minipage}{.49\textwidth}
\begin{table}[H]
\centering
\begin{tabular}{c|cccc|c|}
\toprule
\ & $2$ & $1$ & $0$ & $0$ & $0$\\
\midrule
$x_3$ & $\bm{2}$ & $-3$ & $1$ & $0$ & $6$\\
$x_4$ & $1$ & $1$ & $0$ & $1$ & $4$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & \
\end{tabular}
\end{table}
\end{minipage}
\begin{minipage}{.49\textwidth}
\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=.6]
\draw[->] (0, 0) -- (5, 0);
\draw[->] (0, 0) -- (0, 5);
\draw[-] (2.25, -.5) -- (4, 2/3);
\draw[-] (-.5, 4.5) -- (4, 0);
\node[draw,circle,red,inner sep=2pt] at (0, 0) {};
\end{tikzpicture}
\end{figure}
\end{minipage}
As we can see the greatest improvement of $\bar{z}$ can be obtained by increasing $x_1$ to a positive value ($\bar{c}_1 = 2 > 1 = \bar{c}_2$). Since $x_B = \bar{b} - \bar{A}_1 x_1$, we have to decreas basic variables that have a positive value in $\bar{A}_1 = (2, 1)^T$ (i.e. all of them): Increasing $x_1$ by $1$ forces $x_3$ to decrease by $2$ and $x_4$ by $1$. We can only decrease $x_3, x_4$ until one of them falls to $0$, i.e. $x_1$ can only be increased to $\min \{\frac{6}{2}, \frac{4}{1}\} = 3$. Hence, in this case $x_3$ drops to $0$. Since $x_1$ becomes a basic variable, its column should become $(1, 0)^T$, so we do similar transformation as in the Gaussian eliminination with the $\bm{2}$ as pivot. Similarly, the reduced cost should become $0$.
\begin{minipage}{.49\textwidth}
\begin{table}[H]
\centering
\begin{tabular}{c|cccc|c|}
\toprule
\ & $0$ & $4$ & $-1$ & $0$ & $-6$\\
\midrule
$x_1$ & $1$ & $-\frac{3}{2}$ & $\frac{1}{2}$ & $0$ & $3$\\
$x_4$ & $0$ & $\bm{\frac{5}{2}}$ & $-\frac{1}{2}$ & $1$ & $1$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & \
\end{tabular}
\end{table}
\end{minipage}
\begin{minipage}{.49\textwidth}
\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=.6]
\draw[->] (0, 0) -- (5, 0);
\draw[->] (0, 0) -- (0, 5);
\draw[-] (2.25, -.5) -- (4, 2/3);
\draw[-] (-.5, 4.5) -- (4, 0);
\node[draw,circle,red,inner sep=2pt] at (3, 0) {};
\end{tikzpicture}
\end{figure}
\end{minipage}
Note that by doing these Gaussian transformations we obtain $-6$ for $\bar{z}$, i.e. the wrong sign but we can live with this technical defect.
The current solution now is $(3, 0, 0, 1)$ which can be improved by increasing $x_2$ since $\bar{c}_2 = 4 > 0$. Note that the second constraint is not binding yet, as its slack ist positive. However, the first constraint is binding (we designed it that way by decreasing its slack to $0$). Now we use $\bm{\frac{5}{2}}$ as pivot as it is the only positive entry in the $x_2$-column.
\begin{minipage}{.49\textwidth}
\begin{table}[H]
\centering
\begin{tabular}{c|cccc|c|}
\toprule
\ & $0$ & $0$ & $-\frac{1}{5}$ & $-\frac{8}{5}$ & $-7.4$\\
\midrule
$x_1$ & $1$ & $0$ & $\frac{1}{5}$ & $\frac{3}{5}$ & $\frac{18}{5}$\\
$x_2$ & $0$ & $1$ & $-\frac{1}{5}$ & $\frac{2}{5}$ & $\frac{2}{5}$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & \
\end{tabular}
\end{table}
\end{minipage}
\begin{minipage}{.49\textwidth}
\begin{figure}[H]
\centering
\begin{tikzpicture}[scale=.6]
\draw[->] (0, 0) -- (5, 0);
\draw[->] (0, 0) -- (0, 5);
\draw[-] (2.25, -.5) -- (4, 2/3);
\draw[-] (-.5, 4.5) -- (4, 0);
\node[draw,circle,red,inner sep=2pt] at (3.6, .4) {};
\end{tikzpicture}
\end{figure}
\end{minipage}
Note since $a_{12} = -\frac{3}{2} < 0$ in the previous tableau, by increasing $x_2$, we actually were able to increase $x_1$ further to $\frac{18}{5} = 3.6$ (observe the first constraint).
The reduced cost of any variable are now non-positive; hence, there is no suitable variable to increase and the current solution $(\frac{18}{5}, \frac{2}{5}, 0, 0)$ is optimal.
\end{example*}
\end{document}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment