\documentclass[%
  slidesonly,%  this only prints the slides.
  %notes,%      both notes and slides.
  %notesonly,%  only notes %uncomment
  %article,%    for a printout of whole talk in a nice format do
         ,%    not use with portrait.
  %semlayer,%    needed for overlays and color
  %semcolor,%    needed for overlays and color
  %portrait,   this is needed for printing non-landscape files
         ]{seminar} 
\usepackage{amssymb}
\usepackage{fancybox}
\newcommand{\rr}{{\mathbb R}}

\slidesmag{4}  %how much to blow up the slide.
\articlemag{1} %how much to blow up in article option

\slideframe{Oval} \slidestyle{bottom} \pagestyle{empty}
\renewcommand{\slidelabel}{\small \theslide\vspace{-10pt}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Warning:
%DO NOT use a font size bigger than large.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%PRINTING ISSUES
\renewcommand{\printlandscape}{\special{landscape}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Printing slides.
%\portraitonly
\landscapeonly
%printing is a pain.  To print landscape slides uncomment the above
%line and the slidesonly option.
%To print portrait slides uncomment \portraitonly and
%portrait option.  {slide} is landscape {slide*} is portrait. Notes go
%between the slides.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\notslides{\ref{questions}-7,1}   %Try me: The slides are omitted.
%\onlyslides{1}  %Try me: Only these slides are included.
%\onlynotestoo                     %Try me: For selecting notes as well.
%use these items for printing only certain slides.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%other issuses
\newcommand{\sref}[1]{Slide \ref{#1}}
%Overlays works with semlayer and semcolor but there
%are printing problems-- as same above.  semcolor calles PSTricks
%which is not comparability with latex2e.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Advice:  use landscape or portrait but not both.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\title{\Large\bf Linear Programming}

\author{Jan Verschelde \\  %2mm with \slidesmag{5}
 % Department of Math, Stat \& CS \vspace{-0.5mm}\\
 % University of Illinois at Chicago \vspace{-0.5mm}\\
 % Chicago, IL 60607-7045 \vspace{-0.5mm}\\
  {\em e-mail:} jan@math.uic.edu\vspace{-0.5mm}\\
             www.math.uic.edu/\~{}jan
 }
\date{MCS 494 Special Topics in Computer Science: \\
      Industrial Math \& Computation, Fall 2002. \\
 \ \\
Adapted from Chapter 5 of ``{\em Industrial Mathematics.} \\
 {\em Modeling in Industry, Science, and Government}'' \\
      by Charles R. MacCluer.}

\newcommand{\heading}[1]{\begin{center}\shadowbox{\large\bf
      #1}\end{center}}
\newcommand{\subheading}[1]{\begin{center}\shadowbox{
      #1}\end{center}}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

%\maketitle          % This won't show up when \onlynotestoo is in effect.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
  \ifslidesonly              % Title slide only for slidesonly selection.
  \maketitle
    %\addtocounter{slide}{-1}
  \slidepagestyle{empty} \fi
\end{slide}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{Outline of the Lecture}
\begin{enumerate}
   \item Linear Optimization Problems
   \item A Geometric View on Linear Programming
   \item Standard Form for a Linear Minimization
   \item Application: The Diet Problem
   \item The Simplex Algorithm - the idea
   \item Using {\tt linprog} in MATLAB
   \item Duality Theory
\end{enumerate}
\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{1. Optimization Problems}

\begin{tabbing}
   \hspace{1.5cm} \=max\=imize profit 
   \hspace{2.5cm} \= min\=imize cost \\
    \> subject to 
    \> \> subject to \\
    \>  \> $E({\bf x}) = {\bf a}$  
        ~~~~~ {\em equalities}     
    \>  \> $E({\bf x}) = {\bf a}$ \\
    \>  \> $I({\bf x}) \leq {\bf b}$ 
        ~~~~~ {\em inequalities} 
    \>  \> $I({\bf x}) \geq {\bf b}$ \\
\end{tabbing}

A Linear Programming problem is an optimization problem
\begin{itemize}
   \item with one linear objective function; and
   \item all the constraints (equalities and inequalities)
         are linear.
\end{itemize} 

\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{2. A Geometric View on Linear Programming}

The linear constraints define a polyhedron:

\begin{picture}(200,100)(-20,10)
   \put(0,10){\vector(1,0){200}} \put(205,0){$x_1$}
   \put(10,0){\vector(0,0){100}} \put(-5,100){$x_2$}
   \thicklines
   \put(0,5){\line(1,3){30}}
   \put(0,40){\line(3,2){80}}
   \put(0,65){\line(1,0){200}}
   \put(0,80){\line(4,-1){200}}
   \put(40,0){\line(2,1){160}}
   \put(60,0){\line(1,1){90}}
   \thinlines
   \put(10,20){\line(1,-1){10}}
   \put(10,30){\line(1,-1){20}}
   \put(12,38){\line(1,-1){28}}
   \put(14,46){\line(1,-1){36}}
   \put(18,52){\line(1,-1){42}}
   \put(24,56){\line(1,-1){42}}
   \put(31,60){\line(1,-1){43}}
   \put(37,65){\line(1,-1){44}}
   \put(47,65){\line(1,-1){39}}
   \put(57,65){\line(1,-1){34}}
   \put(70,63){\line(1,-1){26}}
   \put(85,58){\line(1,-1){16}}
   \put(96,56){\line(1,-1){10}}
\end{picture}

\bigskip

\begin{itemize}
   \item polyhedron is nonempty: problem is {\em feasible}
\vspace{-0.2cm}
   \item polyhedron is bounded: problem is {\em well-posed}
\end{itemize}

\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{3. Standard Form for a Linear Minimization}
{\small
\begin{displaymath}
   \hspace{-2cm}
   \begin{array}{lclcl}
     {\rm consider}
          & & {\rm min}~ {\bf c}^T {\bf x}
          & & {\bf c}, {\bf x} \in \rr^n \\
      & & {\rm subject~to}~ A {\bf x} \geq {\bf b} 
          & & A \in \rr^{m \times n},
             {\bf b} \in \rr^m 
   \end{array}
\end{displaymath}

slack variables ${\bf z} \in \rr^m$:
%\begin{displaymath}
   $A {\bf x} \geq {\bf b}
   \quad {\rm becomes} \quad
   A {\bf x} - {\bf z} = {\bf b},
   \ {\bf z} \geq {\bf 0}$
%\end{displaymath}

splitting ${\bf x} = {\bf x}^+ - {\bf x}^-$, 
          ${\bf x}^+ \geq {\bf 0}$, ${\bf x}^- \geq {\bf 0}$ : 
\begin{displaymath}
   \begin{array}{lcl}
      {\rm min} ~ \left[ {\bf c} ~~ {-\bf c} ~~ {\bf 0} \right]
         \left[ \begin{array}{l}
                   {\bf x}^+ \\ {\bf x}^- \\ {\bf z}
                \end{array} 
         \right] \\
      {\rm subject~to}~
              \left[ A ~~ -A ~~ -I \right]
         \left[ \begin{array}{l}
                   {\bf x}^+ \\ {\bf x}^- \\ {\bf z}
                \end{array} 
         \right] = {\bf b},
      & &
         \left[ \begin{array}{l}
                   {\bf x}^+ \\ {\bf x}^- \\ {\bf z}
                \end{array} 
         \right] \geq {\bf 0} \\
   \end{array}
\end{displaymath}
}
\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{4. Application: the Diet Problem}

Problem: plan healthy but economical meals.

{\small
~\hspace{1cm}~\begin{tabular}{c|cccc|c}
   nutritional & \multicolumn{4}{c|}{food quantities} & minimum  \\
    elements   & $x_1$ & $x_2$ & $\cdots$ & $x_n$ & requirements \\ \hline
       1 & $a_{11}$ & $a_{12}$ & $\cdots$ & $a_{1n}$ & $c_1$ \\
       2 & $a_{21}$ & $a_{22}$ & $\cdots$ & $a_{2n}$ & $c_2$ \\
      $\vdots$ & $\vdots$ & $\vdots$ & $\ddots$ & $\vdots$ & $\vdots$ \\
       m & $a_{m1}$ & $a_{m2}$ & $\cdots$ & $a_{mn}$ & $c_m$ \\ \hline
   price & $p_1$ & $p_2$ & $\cdots$ & $p_n$ & 
\end{tabular}
}

Solve a linear programming problem {\footnotesize (typically $m > n$)} :

{\small
~\hspace{1cm}~\begin{tabular}{l}
   min $p_1 x_1 + p_2 x_2 + \cdots + p_n x_n$ \\
   subject to $a_{i1} x_1 + a_{i2} x_2 + \cdots + a_{in} x_n \geq c_i$,
              {\scriptsize $i=1,2,\ldots,m$}
\end{tabular}
}
\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{5. The Simplex Algorithm}

\begin{description}
  \item{\em Idea}: move from one vertex to another vertex,

  improving the objective value in each move.
\end{description}

\begin{description}
  \item[Step 0:] Bring the problem in standard form:

                 ${\rm min}~ {\bf c}^T {\bf x}$
                 subject to $A{\bf x} = {\bf b}$, ${\bf x} \geq {\bf 0}$.
  \item[Step 1:] Find one feasible point.
  \item[Step 2:] Find one feasible {\em vertex} point.
  \item[Step 3:] Move to vertex with improved objective value,

                 repeat until at optimum.
\end{description}
\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{6. Using {\tt linprog} in MATLAB}
\begin{itemize}
   \item MATLAB has an optimization toolbox

         type {\tt help toolbox}$\backslash${\tt optim} to see an overview

   \item type {\tt help linprog} for information 
 
         about the use of the simplex algorithm in MATLAB :

   {\tt x = linprog(f,A,b)} solves

\begin{verbatim}
       min f'*x    subject to   A*x <= b
        x
\end{verbatim}

   \item for the diet problem: 
         {\tt A*x >= c} $\Leftrightarrow$ {\tt -A*x <= -c}

\end{itemize}
\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{slide}
\heading{7. Every LP problem has a dual problem}
{\small
\begin{displaymath}
   \begin{array}{l}
       {\rm max}~{\displaystyle \sum_{j=1}^n c_j x_j} \\
       {\rm subject~to} \\
       \quad \left\{
                \begin{array}{r}
                   {\displaystyle 
                        \sum_{j=1}^n a_{ij} x_j \leq b_i},~~~ \\
                    \vspace{-0.8cm} \\
                       {~}^{i = 1,2,\ldots,m} \\
                    \vspace{-0.8cm} \\
                   x_j \geq 0, {~}_{j=1,2,\ldots,n}
                \end{array}
             \right.
   \end{array}
\quad \quad
   \begin{array}{l}
       {\rm min}~{\displaystyle \sum_{i=1}^m b_i y_i} \\
       {\rm subject~to} \\
       \quad \left\{
                \begin{array}{r}
                   {\displaystyle 
                        \sum_{i=1}^m a_{ij} y_j \geq c_j},~~~ \\
                    \vspace{-0.8cm} \\
                       {~}^{j = 1,2,\ldots,n} \\
                    \vspace{-0.8cm} \\
                   y_i \geq 0, {~}_{i=1,2,\ldots,m}
                \end{array}
             \right.
   \end{array}
\end{displaymath}

\noindent {\bf economic interpretation :}

\begin{tabular}{ccl}
   $x_j$ & : & level of activity $j$ \\
  \\ \vspace{-1.2cm} \\
   $c_j$ & : & unit profit of activity $j$ \\
  \\ \vspace{-1.2cm} \\
   $b_i$ & : & amount available of resource $i$ \\
  \\ \vspace{-1.2cm} \\
   $a_{ij}$ & : & amount of resource $i$ consumed 
                  by each unit of activity $j$ \\
  \\ \vspace{-1.2cm} \\
   $y_i$ & : & contribution to profit per unit of resource $i$
\end{tabular}
}
\end{slide}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{slides}
\end{document}

