Commit b44dd2e7 authored by Niklas's avatar Niklas

added M example

parent 5884197f
No preview for this file type
......@@ -7,6 +7,8 @@
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{mathtools}
\usepackage[osf]{mathpazo}
\usepackage{eulervm}
\usepackage{array}
\usepackage{enumitem}
\usepackage{booktabs}
......@@ -20,8 +22,8 @@
\usepackage{listings}
\usepackage{enumitem}
\usepackage{wrapfig}
%\usepackage{bbold}
\usepackage{bbm}
\newcommand*\red[1]{{\color{red}#1}}
\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
\node[shape=circle,draw,inner sep=2pt] (char) {#1};}}
\usepackage[justification=centering]{caption}
......@@ -486,7 +488,7 @@ The basic Simplex algorithm works in two stages:
\end{enumerate}
We first only consider the second stage, which is sufficient if setting $x_1 = \ldots = x_n$ (every non-slack variable) to $0$ is a feasible solution. We add stage 1 later in this document.
\begin{algorithm}
\begin{algorithm}[H]
\caption{Basic Simplex algorithm -- stage 2}
\label{alg:simplex}
\tcc{We are given a feasible basic solution}
......@@ -532,7 +534,7 @@ In the following we demonstrate the Simplex method on a small example that captu
\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
& 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.
......@@ -649,7 +651,7 @@ that makes the origin infeasible.
\draw[-,red] (-.5, 2.5) -- (2, -.5);
\draw[-] (2.5, -.5) -- (3, 2.5);
\draw[-] (1, 3) -- (3.5, 1);
\node[red] at (0, 0) {$\bullet$};
\node[red,draw,fill,circle,inner sep=2pt] at (0, 0) {};
\end{tikzpicture}
\end{figure}
......@@ -662,8 +664,123 @@ $$
$$
where $s_i$ denotes the slack variable of that constraint and $y_i$ the artificial variable. The initial basis now consists of all artificial variables and all slack variables to which no artificial variable exists. After that we can start the usual Simplex algorithm. As soon as the artificial variables become non-basic, we can disregard them. If we do not succeed then $P = \emptyset$ or $M$ was not big enough. Alternatively, one can minimize the sum of artificial variables as objective function. If then the optimal objective value is positive, then $P = \emptyset$.
\begin{example*}
\begin{algorithm}[H]
\caption{Basic Simplex algorithm -- stage 1}
TODO
\end{algorithm}
\begin{example*}
Consider the following LP in canonical form:
\begin{align*}
\text{maximize } & x_2\\
\text{subject to } & -x_1 - x_2 \leq -1\\
& 2x_1 + 3x_2 \leq 6\\
& x_1, x_2 \geq 0.
\end{align*}
Since the right hand side of the first constrtaint is negative, we introduce an artificial variable additionally to the slack variables to the corresponding LP in standard form:
\begin{align*}
\text{maximize } & x_2 - Mx_5\\
\text{subject to } & -x_1 - x_2 + x_3 - x_5 = -1\\
& 2x_1 + 3x_2 + x_4 = 6\\
& x_1, x_2, x_3, x_4, x_5 \geq 0.
\end{align*}
We now start with an auxiliary tableau where we use $B = (5, 4)$ as basis.
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc|c|}
\toprule
\ & $0$ & $0$ & $0$ & $0$ & $-M$ & $0$\\
\ & $0$ & $1$ & $0$ & $0$ & $0$ & $0$\\
\midrule
$x_5$ & $-1$ & $-1$ & $1$ & $0$ & $-1$ & $-1$\\
$x_4$ & $2$ & $3$ & $0$ & $1$ & $0$ & $6$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $x_5$ & \
\end{tabular}
\end{table}
First, we get rid of the negative right hand side and enforce large reduced cost w.r.t. the $M$-value for non-basic variables such that they become basic variables and we obtain a feasible basic solution for the original problem.
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc|c|}
\toprule
\ & $M$ & $M$ & $-M$ & $0$ & $0$ & $M$\\
\ & $0$ & $1$ & $0$ & $0$ & $0$ & $0$\\
\midrule
$x_5$ & \circled{$1$} & $1$ & $-1$ & $0$ & $1$ & $1$\\
$x_4$ & $2$ & $3$ & $0$ & $1$ & $0$ & $6$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $x_5$ & \
\end{tabular}
\end{table}
We can use the $x_2$-column as pivot column ($x_1$ would also be fine), then we use the usual Gaussian steps to obtain a unit column (including the reduced cost rows) The ratio test suggests that we use the first row as pivot row and we obtain
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc|c|}
\toprule
\ & \red{$0$} & \red{$0$} & \red{$0$} & \red{$0$} & \red{$-M$} & \red{$0$}\\
\ & $-1$ & $0$ & $1$ & $0$ & \red{$-1$} & $-1$\\
\midrule
$x_2$ & $1$ & $1$ & $-1$ & $0$ & \red{$1$} & $1$\\
$x_4$ & $-1$ & $0$ & $3$ & $1$ & \red{$-3$} & $3$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & \red{$x_5$} & \
\end{tabular}
\end{table}
Now we do not have any positive reduced cost w.r.t. $M$ and noch artificial variables in the basis. By deleting the top row (reduced cost w.r.t. $M$) and the $x_5$-column (artificial variable), we can now continue with the usual Simplex algorithm.
\end{example*}
Next, we look at another example for the case when there is no feasible solution.
\begin{example*}
Consider the following LP in standard form with slack variables $x_3$ and $x_4$, and artificial variable $x_5$:
\begin{align*}
\text{maximize } & -3x_1 + 4x_2 - Mx_5\\
\text{subject to } & x_1 + x_2 + x_3 = 4\\
& -2x_1 -3x_2 + x_4 - x_5 = -18\\
& x_1, x_2, x_3, x_4, x_5 \geq 0.
\end{align*}
We obtain an auxiliary tableau with basis $B = (3, 5)$:
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc|c|}
\toprule
\ & $0$ & $0$ & $0$ & $0$ & $-M$ & $0$\\
\ & $-3$ & $4$ & $0$ & $0$ & $0$ & $0$\\
\midrule
$x_3$ & $1$ & $1$ & $1$ & $0$ & $0$ & $4$\\
$x_5$ & $-2$ & $-3$ & $0$ & $1$ & $-1$ & $-18$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $x_5$ & \
\end{tabular}
\end{table}
Using the same initial step as in the previous example yields to
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc|c|}
\toprule
\ & $2M$ & $3M$ & $0$ & $-M$ & $0$ & $0$\\
\ & $-3$ & $4$ & $0$ & $0$ & $0$ & $0$\\
\midrule
$x_3$ & $1$ & \circled{$1$} & $1$ & $0$ & $0$ & $4$\\
$x_5$ & $2$ & $3$ & $0$ & $-1$ & $1$ & $18$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $x_5$ & \
\end{tabular}
\end{table}
After pivoting we obtain
\begin{table}[H]
\centering
\begin{tabular}{c|ccccc|c|}
\toprule
\ & $-M$ & $0$ & $-3M$ & $-M$ & $0$ & $6M$\\
\ & $-7$ & $0$ & $-4$ & $0$ & $0$ & $-16$\\
\midrule
$x_2$ & $1$ & $1$ & $1$ & $0$ & $0$ & $4$\\
$x_5$ & $-1$ & $0$ & $-3$ & $-1$ & $1$ & $6$\\
\bottomrule
\ & $x_1$ & $x_2$ & $x_3$ & $x_4$ & $x_5$ & \
\end{tabular}
\end{table}
Now observe that there are no positive reduced cost w.r.t. $M$ but the artificial variable $x_5$ is still in the optimal basis. Hence, the original problem is infeasible. If there would be a feasible solution then there exists basic solution with basic variables drawn from $\{x_1, x_2, x_3, x_4\}$ with objective value $0$ w.r.t. $M$, i.e. basic solutions with artificial variables are never optimal.
\end{example*}
We now want to analyze soundness and runtime of the Simplex algorithm. In the worst case the algorithm still needs an exponential number (in $m$) of iterations. Note that there are also algorithm that guarantee a runtime in polynomial time for solving LPs but it turns out that the Simplex algorithm is better in practice where it usually visits $\mathcal{O}(m)$ vertices.
......
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