%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Beamer Presentation
% LaTeX Template
% Version 1.0 (10/11/12)
%
% This template has been downloaded from:
% http://www.LaTeXTemplates.com
%
% License:
% CC BY-NC-SA 3.0 (http://creativecommons.org/licenses/by-nc-sa/3.0/)
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%----------------------------------------------------------------------------------------
%	PACKAGES AND THEMES
%----------------------------------------------------------------------------------------
% Interessante:
%https://www.codecogs.com/latex/eqneditor.php?lang=pt-br

\documentclass{beamer}

\usepackage[brazilian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{colortbl}
\usepackage{mathrsfs}
\usepackage{smartdiagram}
\usepackage{listings}
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\usepackage{multirow}
\usepackage{amssymb}
\usepackage{mdframed}
\usepackage{listings}
\usepackage{amsmath}
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\usepackage{cancel}

\mode<presentation> {

% The Beamer class comes with a number of default slide themes
% which change the colors and layouts of slides. Below this is a list
% of all the themes, uncomment each in turn to see what they look like.

%\usetheme{default}
%\usetheme{AnnArbor}
%\usetheme{Antibes}
%\usetheme{Bergen}
%\usetheme{Berkeley}
%\usetheme{Berlin}
%\usetheme{Boadilla}
%\usetheme{CambridgeUS}
%\usetheme{Copenhagen}
%\usetheme{Darmstadt}
%\usetheme{Dresden}
\usetheme{Frankfurt}
%\usetheme{Goettingen}
%\usetheme{Hannover}
%\usetheme{Ilmenau}
%\usetheme{JuanLesPins}
%\usetheme{Luebeck}
%\usetheme{Madrid}
%\usetheme{Malmoe}
%\usetheme{Marburg}
%\usetheme{Montpellier}
%\usetheme{PaloAlto}
%\usetheme{Pittsburgh}
%\usetheme{Rochester}
%\usetheme{Singapore}
%\usetheme{Szeged}
%\usetheme{Warsaw}

% As well as themes, the Beamer class has a number of color themes
% for any slide theme. Uncomment each of these in turn to see how it
% changes the colors of your current slide theme.

%\usecolortheme{albatross}
%\usecolortheme{beaver}
%\usecolortheme{beetle}
%\usecolortheme{crane}
%\usecolortheme{dolphin}
%\usecolortheme{dove}
%\usecolortheme{fly}
%\usecolortheme{lily}
%\usecolortheme{orchid}
%\usecolortheme{rose}
%\usecolortheme{seagull}
%\usecolortheme{seahorse}
%\usecolortheme{whale}
%\usecolortheme{wolverine}

%\setbeamertemplate{footline} % To remove the footer line in all slides uncomment this line
%\setbeamertemplate{footline}[page number] % To replace the footer line in all slides with a simple slide count uncomment this line

%\setbeamertemplate{navigation symbols}{} % To remove the navigation symbols from the bottom of all slides uncomment this line
}

\usepackage{graphicx} % Allows including images
\usepackage{booktabs} % Allows the use of \toprule, \midrule and \bottomrule in tables

\usepackage{animate}
\usepackage{hyperref}
\usepackage{media9}
\usepackage{listings}
\usepackage{amsmath}
\usepackage[framed,numbered,autolinebreaks,useliterate]{mcode}
\usepackage{chronology}
\usepackage{xpatch}
\xpretocmd{\chronology}{\tikzset{>=|}}{}{\failure}
\usepackage{mdframed}
\usepackage{tikz}
\usepackage{makecell}

\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shapes,arrows}
\usepackage{array}

%----------------------------------------------------------------------------------------
%	TITLE PAGE
%----------------------------------------------------------------------------------------

\logo
{
    \includegraphics[width=0.6cm,height=0.6cm,keepaspectratio]{UFJF.jpg}~%
}

\title[Aula 4]{Os Métodos Big M e Duas Fases}

\author{\scriptsize Professores André L.M. Marcato, Ivo C.da Silva Jr, João A.Passos Filho } % Your name
\institute[UFJF/PPEE]{Universidade Federal de Juiz de Fora \\
	Programa de Pós-Graduação em Engenharia Elétrica \\
	\medskip
	\textit{\href{mailto:andre.marcato@ufjf.edu.br}{andre.marcato@ufjf.edu.br}, \href{mailto:ivo.chaves@ufjf.edu.br}{ivo.junior@ufjf.edu.br}, \href{mailto:joao.passos@ufjf.edu.br}{joao.passos@ufjf.edu.br}}
}

%\date{\small \today} % Date, can be changed to a custom date
\date{\small Primeiro Semestre de 2018} % Date, can be changed to a custom date

\hypersetup{
    colorlinks=true,
    linkcolor=gray,
    filecolor=magenta,
    urlcolor=cyan,
}

\begin{document}

\begin{frame}
\titlepage % Print the title page as the first slide
\begin{figure}[!htb]
\centering
\includegraphics[width=2.6cm, height=1.7cm]{cover.jpg}
%\caption{Ogata - 5a Edicao - Fig. 1.1}
\label{Ogata_1_1}
\end{figure}
\end{frame}

\begin{frame}
\frametitle{Agenda da Apresentação} % Table of contents slide, comment this block out to remove it
\tableofcontents % Throughout your presentation, if you choose to use \section{} and \subsection{} commands, these will automatically be printed on this slide as an overview of your presentation
\end{frame}

%----------------------------------------------------------------------------------------
%	PRESENTATION SLIDES
%----------------------------------------------------------------------------------------

\include{Otimiz_AULA4_A}

\section{Matlab}
\subsection{Resolução do Exemplo}
\begin{frame}
	\frametitle{Matlab - Problema Original}
	\begin{columns}
		\begin{column}{5cm}
			\begin{block}{Resolver o seguinte PPL}
				\centering
				$
					\begin{matrix}
						\max 2x_1+3x_2 \\
						\text{Sujeito a} \\
						-2x_1+3x_2 \le 6 \\
						x_1 + 2x_2 \ge 8 \\
						x_1 + x_2 = 6 \\
						x_1, x_2 \ge 0 \\
					\end{matrix}
				$
			\end{block}
		\end{column}
		\only<1>
		{
		\begin{column}{5cm}
			\centering
			\includegraphics[width=4cm,height=4cm]{solver_matlab.png}
		\end{column}
		}
	\end{columns}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Matlab - Problema Original}
	\begin{columns}
		\begin{column}{5cm}
			\begin{block}{Resolver o seguinte PPL}
				\centering
				$
					\begin{matrix}
						\max 2x_1+3x_2 \\
						\text{Sujeito a} \\
						-2x_1+3x_2 \le 6 \\
						x_1 + 2x_2 \ge 8 \\
						x_1 + x_2 = 6 \\
						x_1, x_2 \ge 0 \\
					\end{matrix}
				$
			\end{block}
		\end{column}
		\begin{column}{5cm}
			\begin{block}{Programa em Matlab}
				\begin{lstlisting}[basicstyle=\tiny]
clear all; close all; clc;
c = -[2 3];
A = [ -2 3 ; -1 -2 ];
B = [ 6 ; -8 ];
Aeq = [ 1 1 ];
Beq = [ 6 ];
[x, fval, exitflag] = linprog(c,A,B,Aeq,Beq);
				\end{lstlisting}
			\end{block}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Matlab - Problema Original}
	\begin{columns}
		\begin{column}{5cm}
			\begin{block}{Resolver o seguinte PPL}
				\centering
				$
					\begin{matrix}
						\max 2x_1+3x_2 \\
						\text{Sujeito a} \\
						-2x_1+3x_2 \le 6 \\
						x_1 + 2x_2 \ge 8 \\
						x_1 + x_2 = 6 \\
						x_1, x_2 \ge 0 \\
					\end{matrix}
				$
			\end{block}
		\end{column}
		\begin{column}{5cm}
			\begin{block}{Programa em Matlab}
				\only<1>
				{
					\includegraphics[width=4cm,height=6cm]{BigM_Matlab_1.png}
				}
				\only<2>
				{
					\includegraphics[width=4cm,height=6cm]{BigM_Matlab_2.png}
				}
			\end{block}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\frametitle{Problema Modificado para BigM}
		\begin{alertblock}{\centering Inserção das Variáveis Artificiais e das Penalidades}
			\centering
			$
				\begin{matrix}
					\max Z = 2x_1+3x_2  &                                       &                   & \cellcolor{green!70}{\color{red}-Mx_5} & \cellcolor{green!70}{\color{red}- Mx_6}  & =0 \\
					\text{Sujeito a} \\
					-2x_1+3x_2          & \cellcolor{green!70}{\color{red}+x_3} &                   &                                        &                                          & =6 \\
					x_1 + 2x_2          &                                       & {\color{red}-x_4} & \cellcolor{green!70}{\color{red}+x_5}  &                                          & =8 \\
					x_1 + x_2           &                                       &                   &                                        & \cellcolor{green!70}{\color{red}+x_6}    & =6 \\
					x_1, x_2{\color{red},x_3,x_4,x_5,x_6} \ge 0 \\
				\end{matrix}
			$
		\end{alertblock}
		\centering
		\includegraphics[width=3cm,height=3cm]{solver_matlab.png}
\end{frame}

\begin{frame}[fragile]
	\frametitle{Problema Modificado para BigM}
		\begin{alertblock}{\centering Inserção das Variáveis Artificiais e das Penalidades}
			\centering
			$
				\begin{matrix}
					\max Z = 2x_1+3x_2  &                                       &                   & \cellcolor{green!70}{\color{red}-Mx_5} & \cellcolor{green!70}{\color{red}- Mx_6}  & =0 \\
					\text{Sujeito a} \\
					-2x_1+3x_2          & \cellcolor{green!70}{\color{red}+x_3} &                   &                                        &                                          & =6 \\
					x_1 + 2x_2          &                                       & {\color{red}-x_4} & \cellcolor{green!70}{\color{red}+x_5}  &                                          & =8 \\
					x_1 + x_2           &                                       &                   &                                        & \cellcolor{green!70}{\color{red}+x_6}    & =6 \\
					x_1, x_2{\color{red},x_3,x_4,x_5,x_6} \ge 0 \\
				\end{matrix}
			$
		\end{alertblock}
			\begin{block}{Programa em Matlab}
				\begin{lstlisting}[basicstyle=\tiny]
clear all; close all; clc;
M = 60;
c = -[2 3 0 0 -M -M];
A = []; B=[];
Aeq = [ -2 3  1 0 0 0; 1 2 0 -1 1 0; 1 1 0 0 0 1];
Beq = [ 6;8;6 ];
lb = [  0   0   0   0   0   0];
ub = [inf inf inf inf inf inf];
[x, fval, exitflag] = linprog(c,A,B,Aeq,Beq, lb, ub);
				\end{lstlisting}
			\end{block}
\end{frame}

\begin{frame}
	\frametitle{Problema Modificado para BigM}

		\centering
		\only<1>
		{
			\includegraphics[width=5cm,height=7cm]{BigM_Matlab_3.png}
		}
		\only<2>
		{
			\includegraphics[width=5cm,height=7cm]{BigM_Matlab_4.png}
		}
\end{frame}

\section{Métodos das Duas Fases}
\subsection{Resolução do Exemplo}

\begin{frame}
	\centering
	\includegraphics[width=10cm,height=3cm]{Pergunta_Final.png}
	\begin{columns}
		\begin{column}{0.33\textwidth}
			\begin{mdframed}[backgroundcolor=green!80]
				\centering
				Método das Penalidades (BIG-M)
			\end{mdframed}
		\end{column}
		\begin{column}{0.33\textwidth}
			\centering
			\includegraphics[width=4cm,height=4cm]{twoways.jpg}
		\end{column}
		\hspace{0.2cm}
		\begin{column}{0.33\textwidth}
			\only<1>
			{
				\begin{mdframed}[backgroundcolor=green!80]
					\centering
					Método das Duas Fases
				\end{mdframed}
			}
			\only<2>
			{
				\begin{mdframed}[backgroundcolor=red!80]
					\centering
					Método das Duas Fases
				\end{mdframed}
			}
		\end{column}
	\end{columns}
\end{frame}

\begin{frame}
	\frametitle{Exemplo - Método de Duas Fases}
	\only<1>
	{
		\begin{alertblock}{\centering Inserção das Variáveis Artificiais em uma Nova FOB de Minimização}
			$ \min W = x_5 + x_6 $ \\
			$ \max Z = 2 x_1 + 3 x_2  $ \\
			{\textbf{Sujeito à}}: \\
			$
				\begin{matrix}
					-2x_1+3x_2+   & {\color{red}x_3} &                  &  					& = 6 \\
					x_1+2x_2-x_4  &				     & \color{red}+x_5  &  					& = 8 \\
					x_1+x_2		  &			         &				   & \color{red}+x_6 	& = 6 \\
					x_1, x_2, x_3,x_4,x_5,x_6 \ge 0  \\
				\end{matrix}
			$
		\end{alertblock}
	}
	\only<2>
	{
		\begin{alertblock}{\centering Inserção das Variáveis Artificiais em uma Nova FOB de Minimização}
			$ \color{cyan} \min W -x_5 - x_6 = 0 $\\
			$ \color{cyan} \max Z -2x_1 -3x_2 = 0 $ \\
			{\textbf{Sujeito à}}: \\
			$
				\begin{matrix}
					-2x_1+3x_2+   & {\color{red}x_3} &                  &  					& = 6 \\
					x_1+2x_2-x_4  &				     & \color{red}+x_5  &  					& = 8 \\
					x_1+x_2		  &			         &				   & \color{red}+x_6 	& = 6 \\
					x_1, x_2, x_3,x_4,x_5,x_6 \ge 0  \\
				\end{matrix}
			$
		\end{alertblock}
	}
	\only<3>
	{
		\begin{alertblock}{\centering Inserção das Variáveis Artificiais em uma Nova FOB de Minimização}
			$ \color{cyan} \min W +2x_1 +3x_2-x_4-14=0 $ {\color{olive} \textbf{(Fase 1)}} \\
			$ \color{cyan} \max Z -2x_1 -3x_2 = 0 $ {\color{olive} \textbf{(Fase 2)}} \\
			{\textbf{Sujeito à}}: \\
			$
				\begin{matrix}
					-2x_1+3x_2+   & {\color{red}x_3} &                  &  					& = 6 \\
					x_1+2x_2-x_4  &				     & \color{red}+x_5  &  					& = 8 \\
					x_1+x_2		  &			         &				   & \color{red}+x_6 	& = 6 \\
					x_1, x_2, x_3,x_4,x_5,x_6 \ge 0  \\
				\end{matrix}
			$
		\end{alertblock}
	}
\end{frame}

\begin{frame}

	\only<1-4>
	{
		\frametitle{Método das Duas Fases - Tableau - \color{pink}Fase 1 - \color{green}Iter. 1}
	}
	\only<5-8>
	{
		\frametitle{Método das Duas Fases - Tableau - \color{pink}Fase 1 - \color{green}Iter. 2}
	}
	\only<9-12>
	{
		\frametitle{Método das Duas Fases - Tableau - \color{pink}Fase 1 - \color{green}Iter. 3}
	}
	\only<13-14>
	{
		\frametitle{Método das Duas Fases - Tableau - \color{pink}Fase 1 - \color{green}Iter. 4}
	}
	\only<15->
	{
		\frametitle{Método das Duas Fases - Tableau - \color{pink}Fase 2 - \color{green}Iter. 1}
	}

	\only<1>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_3$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -2$
				& \cellcolor{yellow!50} $\scriptstyle +3$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +6$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +8$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +6$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle -2$
				& \cellcolor{yellow!50} $\scriptstyle -3$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle +2$
				& \cellcolor{yellow!90} $\scriptstyle +3$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +14$  \\
			\end{tabular}
		\end{table}
	}
	\only<2>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_3$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -2$
				& \cellcolor{gray!50} $\scriptstyle +3$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +6$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +8$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +6$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle -2$
				& \cellcolor{gray!50} $\scriptstyle -3$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle +2$
				& \cellcolor{gray!50} $\scriptstyle +3$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +14$  \\
				& & &  \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & &  \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<3>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_3$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -2$
				& \cellcolor{gray!50} $\scriptstyle +3$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +6$
				& $ \scriptstyle \frac{6}{3} = 2$
				& \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg} \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +8$
				& $ \scriptstyle \frac{8}{2} = 4$
				& \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg}\\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +6$
				& $ \scriptstyle \frac{6}{1} = 6$
				& \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg}\\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle -2$
				& \cellcolor{gray!50} $\scriptstyle -3$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 0$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle +2$
				& \cellcolor{gray!50} $\scriptstyle +3$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +14$  \\
				& & &  \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & &  \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<4>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_3$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle -2$
				& \cellcolor{red!50} $\scriptstyle +3$
				& \cellcolor{gray!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +6$
				& $ \scriptstyle \frac{6}{3} = 2$
				& \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg} \scriptsize Sai \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +8$
				& $ \scriptstyle \frac{8}{2} = 4$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +6$
				& $ \scriptstyle \frac{6}{1} = 6$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle -2$
				& \cellcolor{gray!50} $\scriptstyle -3$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 0$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle +2$
				& \cellcolor{gray!50} $\scriptstyle +3$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +14$  \\
				& & &  \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & &  \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<5>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +2$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{7}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +4$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{5}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +4$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle -4$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 6$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle +4$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +8$  \\
			\end{tabular}
		\end{table}
	}
	\only<6>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +2$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +\frac{7}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +4$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +4$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle -4$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 6$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +4$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +8$  \\
				& & \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<7>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +2$
				& $ \scriptstyle -3 $ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +\frac{7}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +4$
				& $ \scriptstyle +\frac{12}{7} $ & \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg}\\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +4$
				& $ \scriptstyle +\frac{12}{5} $ & \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg}\\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle -4$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 6$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +4$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +8$  \\
				& & \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<8>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +2$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_5$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{red!50} $\scriptstyle +\frac{7}{3}$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle -\frac{2}{3}$
				& \cellcolor{gray!50} $\scriptstyle -1$
				& \cellcolor{gray!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +4$
				& $ \scriptstyle +\frac{12}{7} $
				& \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg}  \scriptsize Sai \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{3}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +4$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle -4$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 6$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +4$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +8$  \\
				& & \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<9>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{22}{7}$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{5}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{8}{7}$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{7}$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{90}{7}$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{yellow!90} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{8}{7}$  \\
			\end{tabular}
		\end{table}
	}
	\only<10>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{22}{7}$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{5}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{8}{7}$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{90}{7}$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{yellow!90} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{8}{7}$  \\
				& & & & & \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & & & & \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<11>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{22}{7}$
				& $ \scriptstyle -11 $ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$
				& $ \scriptstyle -4 $  \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{5}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{8}{7}$
				& $ \scriptstyle +\frac{8}{5} $ & \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg}  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{90}{7}$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{yellow!90} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{8}{7}$  \\
				& & & & & \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & & & & \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<12>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{white} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{red}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{2}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{22}{7}$
				& $ \scriptstyle -11 $ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{2}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{3}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$
				& $ \scriptstyle -4 $  \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_6$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle 0$
				& \cellcolor{gray!50} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{red!50} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{5}{7}$
				& \cellcolor{gray!50} $\scriptstyle +1$
				& \cellcolor{gray!50} $\scriptstyle +\frac{8}{7}$
				& $ \scriptstyle +\frac{8}{5} $
				& \includegraphics[width=0.3cm,height=0.3cm]{setaesquerda.jpg} \scriptsize Sai \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{7}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{90}{7}$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{1}{7}$
				& \cellcolor{gray!50} $\scriptstyle +\frac{5}{7}$
				& \cellcolor{yellow!90} $\scriptstyle -\frac{12}{7}$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle +\frac{8}{7}$  \\
				& & & & & \includegraphics[width=0.3cm,height=0.3cm]{setacima.jpg} \\
				& & & & & \scriptsize Entra \\
			\end{tabular}
		\end{table}
	}
	\only<13>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_5$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{2}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{18}{5}$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{3}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{5}$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_4$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle -1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{7}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{8}{5}$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{78}{5}$  \\
				\cellcolor{blue!100} \color{white} $\scriptstyle W$
				& \cellcolor{yellow!90} $\scriptstyle +1$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle 0$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle -1$
				& \cellcolor{yellow!90} $\scriptstyle 0$  \\
			\end{tabular}
		\end{table}
	}
	\only<14>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cline{1-8}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_4$
				&\cellcolor{olive!90} \color{white}   $\scriptstyle X_5$
				&\cellcolor{olive!90} \color{white}   $\scriptstyle X_6$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle +\frac{2}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{18}{5}$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle +\frac{3}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{5}$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_4$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{olive!90} $\scriptstyle -1$
				& \cellcolor{olive!90} $\scriptstyle +\frac{7}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{8}{5}$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle +\frac{12}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{78}{5}$  \\
				\cellcolor{olive!100} \color{white} $\scriptstyle W$
				& \cellcolor{olive!90} $\scriptstyle +1$
				& \cellcolor{olive!90} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle 0$
				& \cellcolor{olive!90} $\scriptstyle -1$
				& \cellcolor{olive!90} $\scriptstyle -1$
				& \cellcolor{olive!90} $\scriptstyle 0$  \\
			\end{tabular}
		\end{table}
	}
	\only<15-16>
	{
		\begin{table}
			\begin{tabular}{c c c c c c c c c c c c}
				\cellcolor{blue!100} \color{white} \scriptsize Base
				&\cellcolor{blue!100} \color{white} \scriptsize Z/W
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				&\cellcolor{blue!100} \color{white}   $\scriptstyle X_3$
				&\cellcolor{blue!100} \color{red} $\scriptstyle X_4$
				&\cellcolor{blue!100} \color{white} \scriptsize b
				&
				&
				& \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_2$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{18}{5}$ \\
			    \cellcolor{blue!100} \color{red} $\scriptstyle X_1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle -\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{12}{5}$ \\
				\cellcolor{blue!100} \color{red} $\scriptstyle X_4$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{8}{5}$ \\
				\cellcolor{blue!100} \color{white} $\scriptstyle Z$
				& \cellcolor{yellow!50} $\scriptstyle +1$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{1}{5}$
				& \cellcolor{yellow!50} $\scriptstyle 0$
				& \cellcolor{yellow!50} $\scriptstyle +\frac{78}{5}$  \\
			\end{tabular}
		\end{table}
	}

	% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
	\only<1>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=olive!80]
					Verificar se a solução é ótima! (Linha de Z). \underline{Problema de Minimização}, todos coeficientes devem ser negativos.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<2>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=orange!80]
					Escolhe variável com coeficiente mais positivo na FOB para entrar na base.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<3>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=olive!80]
					Para cada linha do Tableau calcular razão $\frac{b_i}{\text{coluna}}$ e verificar se há razão positiva e finita.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<4>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=orange!80]
					A linha com a menor razão positiva finita sairá da base.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}
				$
					\begin{matrix}
						\scriptstyle \text{LINHA}'_1 = \frac{1}{3} \times \text{LINHA}_1 \\
						\scriptstyle \text{LINHA}'_2 = \text{LINHA}_2 - \frac{2}{3} \times \text{LINHA}_1 \\
						\scriptstyle \text{LINHA}'_3 = \text{LINHA}_3 - \frac{1}{3} \times \text{LINHA}_1 \\
						\scriptstyle \text{LINHA}'_4 = \text{LINHA}_4 + \text{LINHA}_1 \\
						\scriptstyle \text{LINHA}'_5 = \text{LINHA}_5 - \text{LINHA}_1 \\
					\end{matrix}
				$
			\end{column}
		\end{columns}
	}
	\only<5>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=olive!80]
					Verificar se a solução é ótima! (Linha de Z). \underline{Problema de Minimização!}
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<6>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=orange!80]
					Escolhe variável com coeficiente mais positivo na FOB para entrar na base.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<7>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=olive!80]
					Para cada linha do Tableau calcular razão $\frac{b_i}{\text{coluna}}$ e verificar se há razão positiva e finita.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<8>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=orange!80]
					A linha com a menor razão positiva finita sairá da base.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}
				$
					\begin{matrix}
						\scriptstyle \text{LINHA}'_1 = \text{LINHA}_1 + \frac{2}{7} \times \text{LINHA}_2\\
						\scriptstyle \text{LINHA}'_2 = \frac{3}{7} \times \text{LINHA}_2 \\
						\scriptstyle \text{LINHA}'_3 = \text{LINHA}_3 - \frac{5}{7} \times \text{LINHA}_2 \\
						\scriptstyle \text{LINHA}'_4 = \text{LINHA}_4 + \frac{12}{7} \times \text{LINHA}_2 \\
						\scriptstyle \text{LINHA}'_5 = \text{LINHA}_5 - \frac{12}{7} \times \text{LINHA}_2 \\
					\end{matrix}
				$
			\end{column}
		\end{columns}
	}
	\only<9>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=olive!80]
					Verificar se a solução é ótima! (Linha de Z). \underline{Problema de Minimização}
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<10>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=orange!80]
					Escolhe variável com coeficiente mais positivo na FOB para entrar na base.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<11>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=olive!80]
					Para cada linha do Tableau calcular razão $\frac{b_i}{\text{coluna}}$ e verificar se há razão positiva e finita.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<12>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=orange!80]
					A linha com a menor razão positiva finita sairá da base.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}
				$
					\begin{matrix}
						\scriptstyle \text{LINHA}'_1 = \text{LINHA}_1 + \frac{2}{5} \times \text{LINHA}_3\\
						\scriptstyle \text{LINHA}'_2 = \text{LINHA}_2 + \frac{3}{5} \times \text{LINHA}_3\\
						\scriptstyle \text{LINHA}'_3 = \frac{7}{5} \times \text{LINHA}_3  \\
						\scriptstyle \text{LINHA}'_4 = \text{LINHA}_4 + \frac{12}{5} \times \text{LINHA}_3 \\
						\scriptstyle \text{LINHA}'_5 = \text{LINHA}_5 - \text{LINHA}_3 \\
					\end{matrix}
				$
			\end{column}
		\end{columns}
	}
	\only<13>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=red!80]
					\centering
					OPTIMAL SOLUTION FOUND DA FASE 1!!!!
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<14>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=red!80]
					\centering
					Elimanam-se as colunas das variáveis artificiais e a linha da FOB de Minimização!!!! \\
					Inicia-se a FASE 2.
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<15>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=olive!80]
					Verificar se a solução é ótima! (Linha de Z). \underline{Problema de Maximização}
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}

			\end{column}
		\end{columns}
	}
	\only<16>
	{
		\begin{columns}
			\begin{column}{5cm}
				\begin{mdframed}[backgroundcolor=red!80]
					\centering
					OPTIMAL SOLUTION FOUND !!!!
				\end{mdframed}
			\end{column}
			\begin{column}{5cm}
				\begin{table}
					\begin{tabular}{ c | c | c |}
						\hline
						\cellcolor{blue!100} \color{white}\scriptsize Tipo     &
						\cellcolor{blue!100} \color{white} \scriptsize Variável &
						\cellcolor{blue!100} \color{white} \scriptsize Valor \\
						\cellcolor{green!80}  &
						\cellcolor{green!80} $\scriptstyle X_1$   &
						\cellcolor{green!80} $\scriptstyle \frac{12}{5}$   \\
						\cellcolor{green!80} VB &
						\cellcolor{green!80} $\scriptstyle X_2$   &
						\cellcolor{green!80} $\scriptstyle \frac{18}{5}$   \\
						\cellcolor{green!80} &
						\cellcolor{green!80} $\scriptstyle X_4$   &
						\cellcolor{green!100} $\scriptstyle \frac{8}{5}$   \\
						\cellcolor{yellow!50} &
						\cellcolor{yellow!50} $ \scriptstyle X_3$   &
						\cellcolor{yellow!50} $\scriptstyle 0$   \\
						\cellcolor{yellow!50} VNB &
						\cellcolor{yellow!50} $\scriptstyle X_5$   &
						\cellcolor{yellow!50} $\scriptstyle 0$   \\
						\cellcolor{yellow!50} &
						\cellcolor{yellow!50} $\scriptstyle X_6$   &
						\cellcolor{yellow!50} $\scriptstyle 0$   \\
						\cellcolor{green!80} FOB 				 &
						\cellcolor{green!80} $\scriptstyle Z$     &
						\cellcolor{green!80} $\scriptstyle \frac{78}{5}$  \\
						\hline
					\end{tabular}
				\end{table}
			\end{column}
		\end{columns}
	}

\end{frame}

% Método das duas fases
% https://www.youtube.com/watch?v=PtT2ddGg5SQ

\begin{frame}
	\frametitle{Método das Duas Fases - Youtube}
	\centering
	\begin{table}
		\begin{tabular}{c}
			\includegraphics[width=3.5cm,height=3.5cm]{youtube.png} \\
			\href{https://www.youtube.com/watch?v=PtT2ddGg5SQ}{Clicar para assistir video no YouTube !!!}
		\end{tabular}
	\end{table}
\end{frame}

\begin{frame}
\Huge{\centerline{Fim}}
\end{frame}

%----------------------------------------------------------------------------------------

\end{document}


\section{Distance-Based Outliers: Algorithms and Applications}
\label{ch:knorr00}

\textit{Distance-Based Outliers: Algorithms and Applications} by Edwin M. Knorr \\
Cited by 722. \textit{The VLDB Journal—The International Journal on Very Large Data Bases}.
\newline

\textbf{Main point} is that the outlier detection algorithm \begin{inparaenum}[\itshape a\upshape)]
\item can be done efficiently for large dataset and for $k$-dimensional datasets with large values of $k$,
\item is a meaningful and important knowledge discovery task
\end{inparaenum}


\chapter{Introduction}

Hi, there! This is a textbook explaining the basic notions in pure
mathematics.  The book currently goes over basic propositional logic,
set theory, and function theory. I eventually want to expand it to go
over arithmetic in a rigorous and fun way.  If you want to jump in, go
to \cref{propositions}.

First of all, what is ``pure mathematics''. A simple definition is
``math that is not applied''. However, that is misleading, because it
might lead you to think that pure mathematics isn't applicable to the
real world. In most cases, pure math is applicable to the real
world.\footnote{That said, in many of those cases, the applications
  have yet to be discovered.} However, when you study pure math, you
usually study it because the math is interesting, not because it's
useful.

\section{Motivations and Ideology}

In American high schools, mathematics is approached as a tool for
computation, and it's almost always studied in the context of
real-world applications. This is even true of most low-level
university courses.

Here's the problem: the real world is actually rather boring. Focusing
on real-world applications usually leads people to think that math is
difficult and boring. Math can be difficult, but if you look at it the
right way, it's definitely not boring.  It's only in the second half
of an undergraduate math track that most students are immersed in pure
mathematics.

Part of this process is usually students going back and re-learning
all of the stuff they learned in high school and early college,
because they didn't learn it with enough mathematical rigor. This
means that high school and the first half of college are usually a
complete waste of math students' time.

\subsection{Target audience}

The target audience is (roughly) people who know basic and
intermediate algebra (i.e. solving static equations) and would like to
gain a deeper understanding of mathematics. This book \xti{might} be
suitable as supplementary material for people learning basic algebra.
However, it's assumed that you know how to solve reasonably simple
static equations.

In particular, I've noticed that there are a large number of
programmers who want to understand advanced topics in computer
science, but don't have a suitable mathematical background to attack
said topics effectively. Most of the early audience of this book is
people in that situation, so it's particularly suited to them.

\subsection{Contributing}

You are welcome---and encouraged---to contribute to this book. The
\LaTeX\ source for the book is on GitHub
\barelink{https://github.com/pharpend/sets-logics}, if you want to
make changes. You can also email the author at
\monospace{<peter.harpending@utah.edu>} if you find an error, or are
confused about something.

This book is free (as in ``unrestricted'') and open-source. It's also
``free'' in the sense that you don't have to pay for it, although
that's far less important.  The official license is the Creative
Commons Attribution 4.0 International License. The full license text
can be found at
\barelink{https://creativecommons.org/licenses/by/4.0/}.

You are encouraged to send your modifications back so others can use
them. You are also encouraged to publish modified versions under the
same license.

\section{Conventions}

Definitions, theorems, axioms, etc are numbered so they can be found
quickly. If I refer to ``definition X.Y.Z'', that means, the Zth
definition, in chapter X, section Y. Definitions, theorems, axioms,
etc. all use the same counter.\footnote{I took this idea from Joseph
  L. Taylor's \xti{Foundations of Analysis}.} For instance,

\begin{definition}
  Here's a definition!
\end{definition}

\begin{example}
  Here's an example.
\end{example}

\begin{axiom}
  Here's an axiom.
\end{axiom}

Exercises don't use the same counter as everything else. They are also
separated by section. For instance,

\begin{exercise}
  Here's an exercise.
\end{exercise}


 \documentclass [12pt]{article}

\usepackage {amsmath}
\usepackage {amsthm}
\usepackage {amssymb}
\usepackage {graphicx}
\usepackage {float}
\usepackage {multirow}
\usepackage {xcolor}
\usepackage {algorithmic}
\usepackage [ruled,vlined,commentsnumbered,titlenotnumbered]{algorithm2e} \usepackage {array}
\usepackage {booktabs}
\usepackage {url}
\usepackage {parskip}
\usepackage [margin=1in]{geometry}
\usepackage [T1]{fontenc}
\usepackage {cmbright}
\usepackage [many]{tcolorbox}
\usepackage [colorlinks = true,
            linkcolor = blue,
            urlcolor  = blue,
            citecolor = blue,
            anchorcolor = blue]{hyperref}
\usepackage {enumitem}
\usepackage {xparse}
\usepackage {verbatim}
\usepackage{listings}
\usepackage{xcolor}
\lstset { %
    language=C++,
    backgroundcolor=\color{black!5}, % set backgroundcolor
    basicstyle=\footnotesize,% basic font setting
}
\newtheorem{theorem}{Theorem}
\newtheorem{remark}{Remark}
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]
\newtheorem{claim}{Claim}

\DeclareTColorBox {Solution}{}{breakable, title={Solution}} \DeclareTColorBox {Solution*}{}{breakable, title={Solution (provided)}} \DeclareTColorBox {Instruction}{}{boxrule=0pt, boxsep=0pt, left=0.5em, right=0.5em, top=0.5em, bottom=0.5em, arc=0pt, toprule=1pt, bottomrule=1pt} \DeclareDocumentCommand {\Expecting }{+m}{\textbf {[We are expecting:} #1\textbf {]}} \DeclareDocumentCommand {\Points }{m}{\textbf {(#1 pt.)}}

\begin {document}

\vspace {1em}
\begin {Instruction}
Adapted From Virginia Williams' lecture notes.
\end {Instruction}

{\LARGE \textbf {COMP 285 (NC A\&T, Spr `22)}\hfill \textbf {Lecture 26} }

\begin{centering}
\section*{Dynamic Programmig IV - LCS, Unbounded Knapsack}
\end{centering}

\section{Longest Common Subsequence}
We now consider the longest common \textit{subsequence} problem which has applications in spellchecking, biology (whether different DNA sequences correspond to the same protein), and more.

We say that a sequence $Z$ is a \textit{subsequence} of a sequence $X$ if $Z$ can be obtained from $X$ by deleting symbols. For example, \texttt{abracadabra} has \texttt{baab} as a \textit{subsequence}, because we can obtain \texttt{baab} by deleting a, r, cad, and ra. We say that a sequence $Z$ is a longest common \textit{subsequence} (LCS) of $X$ and $Y$ if $Z$ is a \textit{subsequence} of both $X$ and $Y$ , and any sequence longer than $Z$ is not a \textit{subsequence} of at least one of $X$ or $Y$ . For instance, the LCS of \texttt{abracadabra} and \texttt{bxqrabry} is \texttt{brabr}.

Using the definition of LCS, we define the LCS problem as follows: Given sequences $X$ and $Y$ , find the length of their LCS, $Z$ (and if we are proceeding to Step 4 of the outline above, output $Z$). In what follows, suppose that the sequence $X$ is $X = x_1x_2x_3 \cdots x_m$, so that $X$ has length $m$, and suppose that $Y = y_1y_2 \cdots y_n$ as length $n$. We'll use the notation $X[1 : k]$ as usual to denote the prefix $X[1 : k] = x_1x_2 \cdots x_k$ .

\subsection{Steps 1 and 2: Identify optimal substructure, and write a recursive
formulation}

Our sub-problems will be to solve LCS on prefixes of $X$ and $Y$. To see how we can do this, we consider the following two cases.

\begin{enumerate}
  \item \textbf{Case 1:} $x_m = y_n$. If $x_m = y_n = \ell$, then any LCS $Z$ has $\ell$ as its last symbol. Indeed, suppose that $Z'$ is any common subsequence that does not end in $\ell$: then we can always extend it by appending $\ell$ to $Z'$ to obtain another (longer) legal common subsequence. Thus, if $|Z| = k$ and $x_m = y_n = \ell$, we can write

  $$
  Z[1 : k - 1] = \text{LCS}(X[1 : m - 1], Y [1 : n - 1])
  $$ and
  $$
  Z = Z[1 : k - 1] \circ \ell
  $$,
  where $\circ$ denotes the concatenation operation on strings.
  \item \textbf{Case 2:} $x_m \neq y_n$. As above, let $Z$ be the LCS of $X$ and $Y$ . In this case, the last letter of $Z$ (call it $z_k$ ) is either not equal to $x_m$ or it is not equal to $y_n$. (Notice that this or is not an exclusive or; maybe $z_k$ isn't equal to either $x_m$ or $y_n$). In this case, at least one of $x_m$ or $y_n$ cannot appear in the LCS of $X$ and $Y$ ; this means that either
  $$
    \text{LCS}(X, Y ) = \text{LCS}(X[1 : m - 1], Y )
  $$
  or
  $$
  \text{LCS}(X, Y ) = \text{LCS}(X, Y [1 : n - 1])
  $$,
  whichever is longer. That is, we can shave one letter off the end of either $X$ or $Y$ . In particular, the length of $\text{LCS}(X, Y )$ is given by
  $$
  \text{lenLCS}(X, Y ) = \max \{\text{lenLCS}(X[1 : m - 1], Y ), \text{lenLCS}(X, Y [1 : n - 1])\}
  $$.
\end{enumerate}

This immediately gives us our recursive formulation. Let's keep a table $C$, so that
$$
C[i,j] = \text{length of LCS}(X[1:i], Y[1:j])
$$
Then we have the relationship:
\begin{align*}
C[i,j] = \begin{cases}
  0 & i = 0 \text{ or } j = 0 \\
  C[i-1, j-1] +1 & X[i] = Y[j], i,j > 0  \\
  \max\{C[i-1, j], C[i, j-1] \} & X[i] \neq Y[j], i,j > 0
\end{cases}
\end{align*}
Suppose we keep a table $C$, where $C[i, j]$ maintains the length of $\text{LCS}(X[1 : i], Y [1 : j])$, the longest common subsequence of $X[1 : i]$ and $Y [1 : j]$. Then, we can fill in the values of $C$ using the following recurrence:
\begin{align*}
C[i,j] = \begin{cases}
  C[i-1, j-1] +1 & X[i] = Y[j]  \\
  \max\{C[i-1, j], C[i, j-1] \} & \text{otherwise}
\end{cases}
\end{align*}

Technically, we should do a proof here to show that this recurrence is correct. See CLRS for the details, but it is true that if we define $C[i, j]$ recursively as above, then indeed, $C[i, j]$ is equal to the length of $\text{LCS}(X[1 : i], Y [1 : j])$. (Good exercise: prove this for yourself using induction).

\subsection{Step 3: Define an algorithm using our recursive relationship.}
The recursive relationship above naturally gives rise to a DP algorithm for filling out the table
C:

Note that there are only $n \times m$ entries in our table $C$. This is where the overlapping subproblems come in: we only need to compute each entry once, even though we may access it many times when filling out subsequent entries.

We can also see that $C[i, j]$ only depends on three possible prior values: $C[i -1, j], C[i, j -1]$,
and $C[i - 1, j - 1]$. This means that each time we compute a new value $C[i, j]$ from previous
entries, it takes time $O(1)$.

\begin{algorithm}
\caption{lenLCS(X,Y)}
\label{alg:len_lcs}
\begin{algorithmic}
\STATE Initialize an $n + 1 \times m + 1$ zero-indexed array $C$
\STATE Set $C[0,j] = C[i, 0] = 0$ for all $i,j \in \{1, \cdots, m\} \times \{1, \cdots, n \}$
\FOR{$i = 1, \cdots, m$}
  \FOR{$j = 1, \cdots, n$}
    \IF{$X[i] == Y[j]$}
      \STATE $C[i, j] = 1 + C[i-1, j-1]$
    \ELSE
      \STATE $C[i,j]= \max\{C[i-1, j], C[i, j-1] \}$
    \ENDIF
  \ENDFOR
\ENDFOR
\RETURN C
\end{algorithmic}
\end{algorithm}

Thus, we can start to see how to obtain an algorithm for filling in the table and obtaining the LCS. First, we know that any string of length $0$ will have an LCS of length $0$. Thus, we can start by filling out $C[0, j] = 0$ for all $j$ and similarly, $C[i, 0] = 0$ for all $i$. Then, we can fill out the rest of the table, filling the rows from bottom up ($i$ from $1$ to $m$) and filling each row from left to right ($j$ from $1$ to $n$). The pseudocode is given in Algorithm \ref{alg:len_lcs}.

As mentioned above, in order to fill each entry, we only need to perform a constant number of lookups and additions. Thus, we need to do a constant amount of work for each of the $m \times n$ entries, giving a running time of $O(mn)$.

\subsection{Step 4: Recovering the actual LCS}
Algorithm \ref{alg:len_lcs} only computes the length of the LCS of $X$ and $Y$ . What if we want to recover the actual longest common subsequence? In Algorithm \ref{alg:lcs}, we show how we can construct the actual LCS, given the dynamic programming table $C$ that we've filled out in Algorithm 1.

In this algorithm, we start from the end of $X$ and $Y$ and work backward, using our table $C$ as a guide. We start with $i = m$ and $j = m$. If at some point $(i, j)$, we see that $X[i] = Y[j]$, then decrement both $i$ and $j$. On the other hand, if $X[i] \neq Y[j]$, then we know that we need to drop a symbol from either $X$ or $Y$ . The table $C$ will tell us which: if $C[i, j] = C[i, j - 1]$, then we can drop a symbol from $Y$ and decrement $j$. If $C[i, j] = C[i - 1, j]$, then we can drop a symbol from $X$ and decrement $i$. Of course, it might be the case that both of these hold; in this case it doesn't matter which we decrement, and our pseudocode will be default decrement $j$.

How long does this take? Notice that in each step, the sum $i + j$ is decremented by at least one (maybe two) and stops as soon as one of $i, j$ is equal to zero; this is at least before $i + j = 0$. Thus, the number of times we decrement $i + j$ is at most $m + n$, which was their total value to start.

Because at each step of Algorithm \ref{alg:lcs}, the work is $O(1)$, the total running time is thus $O(n+m)$, which is subsumed by the runtime of $O(mn)$ necessary to fill in the table.

\begin{algorithm}
\caption{LCS(X,Y)}
\label{alg:lcs}
\begin{algorithmic}
\STATE \texttt{// C is filled out already}
\STATE $L \gets \empty$
\STATE $i \gets m$
\STATE $j \gets n$
\WHILE{$i > 0$ and $j > 0$}
  \IF{$X[i] = Y[j]$}
    \STATE Append $X[i]$ to the beginning of $L$
    \STATE $i \gets i -1$
    \STATE $j \gets j -1$
  \ELSIF{$C[i,j] = C[i, j-1]$}
    \STATE $j \gets j - 1$
  \ELSE
    \STATE $i \gets i - 1$
  \ENDIF
\ENDWHILE
\end{algorithmic}
\end{algorithm}

The conclusion is that we can find $\text{LCS}(X, Y )$ of a sequence $X$ of length $m$ and a sequence $Y$ of length $n$ in time $O(mn)$.

Interestingly, this simple dynamic programming algorithm is basically the best known algorithm or solving the LCS problem. It is conjectured that this algorithm may be essentially optimal. It turns out that giving an algorithm that (polynomially) improves the dependence on $m$ andn over the $O(mn)$ strategy outlined above would imply a major breakthrough in algorithmsfor the boolean satisfiability problem – a problem widely believed to be computationally hard to solve.

\section{The Knapsack Problem}

This is a classic problem, defined as the following:

We have $n$ items, each with a value and a positive weight. The $i$-th item has weight $w_i$ and value $v_i$. We have a knapsack that holds a maximum weight of $W$. Which items do we put in our knapsack to maximize the value of the items in our knapsack? For example, let’s say that $W = 10$; that is, the knapsack holds a weight of at most 10. Also suppose that we have four items, with weight and value:

\begin{table}[h!]
\centering
\begin{tabular}{c|c|c}
Item & Weight & Value \\
\hline
A & 6 &  25 \\
B & 3 & 13 \\
C & 4 & 15 \\
D & 2 & 8
\end{tabular}
\end{table}

We will talk about two variations of this problem, one where you have infinite copies of each item (commonly known as Unbounded Knapsack), and one where you have only one of each item (commonly known as 0-1 Knapsack).

What are some useful subproblems? Perhaps it’s having knapsacks of smaller capacities, or maybe it’s having fewer items to choose from. In fact, both of these ideas for subproblems are useful. As we will see, the first idea is useful for the Unbounded Knapsack problem, and a combination of the two ideas is useful for the 0-1 Knapsack problem.

\subsection{The Unbounded Knapsack Problem}

In the example above, we can pick two of item $B$ and two of item $D$. Then, the total weight is $10$, and the total value $42$.

We define $K(x)$ to be the optimal solution for a knapsack of capacity $x$. Suppose $K(x)$ happens to contain the $i$-th item. Then, the remaining items in the knapsack must have a total weight of at most $x -  w_i$ . The remaining items in the knapsack must be an optimum solution. (If not, then we could have replaced those items with a more highly valued set of items.) This gives us a nice subproblem structure, yielding the recurrence
$$
K(x) = \max_{i:w_i\leq x}(K(x - w_i ) + v_i )
$$.

Developing a dynamic programming algorithm around this recurrence is straightforward. We first initialize $K(0) = 0$, and then we compute $K(x)$ values from $x = 1, \cdots , W$. The overall runtime is $O(nW)$.

\begin{algorithm}
\caption{UnboundedKnapsack(W, n, w, v)}
\label{alg:unboundedknapsack}
\begin{algorithmic}
\STATE $K[0]\gets 0$
\FOR{$x = 1, \cdots, W$}
  \STATE $K[x] \gets 0$
  \FOR{$i = 1, \cdots, n$}
    \IF{$w_i <= x$}
      \STATE $K[x] \gets \max\{K[x-w_i] + v_i \}$
    \ENDIF
  \ENDFOR
\ENDFOR
\RETURN $K[W]$
\end{algorithmic}
\end{algorithm}

\begin{remark}This solution is not actually polynomial in the input size because it takes $\log W)$ bits to represent $W$. We call these algorithms ``pseudo-polynomial.'' If we had a polynomial time algorithm for Knapsack, then a lot of other famous problems would have polynomial time algorithms. This problem is NP-hard.
\end{remark}

\end{document}


\documentclass[a4paper,11pt]{article}%,twocolumn
\input{settings/packages}
\input{settings/page}
\input{settings/jupyter}
\usepackage[ framed, numbered]{matlab-prettifier}%framed,%
\usepackage{listings}
\usepackage{pdfpages}

\begin{document}

\input{content/title_page}

\section*{Q1: Plot of the signal $y(t) = A.cos(2.\pi.f.t)$}

\begin{figure}[!h]
	\centering
	\includegraphics[scale=0.45]{figures/q1}
	\caption{Plot of the signal $y(t) = A.cos(2.\pi.f.t)$, Where $A = 1$ and $f = 400 ~Hz$}
\end{figure}

\section*{Q2: Nyquist sampling frequency ($f_{nq}$)}

A function containing no frequency higher than $f$ Hz, is completely determined by sampling at $2f$ Hz. This frequency is called Nyquist rate or Nyquist sampling frequency.

\[\therefore Nyquist ~sampling ~frequency~of~above~signal = 2.f = 2\times400 = 800 ~Hz\]

\section*{Q3: Sampled signal at Nyquist sampling frequency ($f_{nq}$)}

\begin{figure}[!h]
	\centering
	\includegraphics[scale=0.45]{figures/q3}
	\caption{Sampled signal at Nyquist sampling frequency ($f_{nq} = 800 ~Hz$)}
\end{figure}

\section*{Q4: Sampled signal at ($2f_{nq}$), ($f_{nq}$) and ($f_{nq}/2$) }

For the given signal there is only one frequency component and therefore, there is no point in sampling it in the rate, higher than the Nyquist rate. Because of there are no other higher frequency components than 400 Hz,  signals sampled at both  $2f_{nq} = 1600 ~Hz$ and  $f_{nq} = 800~ Hz$ illustrated in top and middle subplots respectively, will be eventually reconstructed in to the same signal as there is \textbf{\textit{no contribution from the samples with zero amplitudes}} at the reconstruction stage.\\

Therefore, it will be good enough if we sample at the \textit{Nyquist frequency}($f_{nq} = 800~Hz$) as illustrated in the middle subplot and it is possible to reconstruct the original signal without loosing the important information.\\

Consider the signal sampled at the \textit{half of the Nyquist frequency}($f_{nq}/2 = 400~Hz$), that is the sampling rate is equal to the highest frequency of the signal and bottom subplot represents the effect of this. Because there is no change in the amplitudes of the samples it will be seen as a straight line or more accurately a sinusoidal with a lower frequency when we reconstruct the signal. Which indicates signal carries no useful information if we sample it in this frequency as we have lost all the higher frequency components and they are now seen as lower frequency components. This phenomenon is known as the ``\textbf{\textit{Aliasing or Spectral folding}}''.\\

\begin{figure}[!h]
	\centering
	\includegraphics[scale=0.45]{figures/q4}
\end{figure}

\pagebreak
\section*{Q5: Minimum number of bits ($n_b$) required per a sample and number of minimum quantization levels (L) to have a $SN_qR$ ratio greater than 25dB}

$SN_qR$ in dB is defined as follows, where $S_0$ and $N_q$ represents the received signal power and the strength of noise power due to quantization.
\[
SN_qR = 10\log_{10}\left(\frac{S_0}{N_q}\right)
\]

Size of quantization interval can be written as follows \textit{for uniform quantization} where $L$ is the number of quantization levels and $m_p$ is the maximum amplitude of the signal. In our case which equals to 1.\\

\[Size ~of ~quantization ~interval~ (\Delta V) = \frac{2.m_p}{L}\]

Then $N_q$ and $S_0$ can be written as,
\[
\begin{split}
	S_0 &=\frac{m_p^2}{2}
\end{split}
\hspace{1cm}
\begin{split}
	N_q &= \frac{\Delta V^2}{12}\\
	&= \frac{(2.m_p/L)^2}{12}\\
	& = \frac{m_p^2}{3L^2}
\end{split}
\hspace{1cm}
\therefore
\begin{split}
		SN_qR = 10\log_{10}\left(\frac{3L^2}{2}\right)
\end{split}
\]

According to the requirements following calculations can be done.

\[
\begin{split}
	SN_qR &= 10\log_{10}\left(\frac{3L^2}{2}\right)\\
	25 &< 10\log_{10}\left(\frac{3L^2}{2}\right)\\
	10^{2.5} &< \frac{3L^2}{2}\\
	\frac{10^{2.5}\times2}{3} &< L^2\\
	14.519 &< L
\end{split}
\hspace{2cm}
\therefore L_{min} = 16 ~(\because L~ must ~be~ a ~power ~of~ 2)
\]

Therefore number of minimum quantization levels (L) = 16 and  minimum number of bits ($n_b$) required per a sample is $\log_{2}(L) = \log_{2}(16) = 4$.

\pagebreak
\section*{Q6: Quantization of Sampled output values}

Following {\tt MATLAB} function implements a method to quantize a given sampled signal. Its functionality can be briefly described as follows.
\begin{enumerate}[]
	\item First the three special case of samples are considered.
	\begin{itemize}
		\item If the sample's amplitude equals to the maximum amplitude of the signal, then quantized value is set to be $m_p- \Delta V/2$.
		\item If the sample's amplitude equals to the minimum amplitude of the signal, then quantized value is set to be $m_p+ \Delta V/2$.
		\item If the sample's amplitude equals to zero, then there is nothing to quantize and the quantized value is set to be 0.
	\end{itemize}
 	\item Then the other general values of the samples are considered. These values are again divided into two classes.
 	\begin{itemize}
 		\item If a sample is exactly equal to a value of a Quantization level, one of the following situations is possible and the quantization level is determined as follows with the aim of minimizing the effect of noise at the transmission.
 		\begin{itemize}
 			\item Negative samples are quantized towards negative infinity
 			\item Positive samples are quantized towards positive infinity
 		\end{itemize}
 		\item If a sample lies between two Quantization levels it is  quantized towards positive infinity.
 	\end{itemize}
\end{enumerate}

\lstinputlisting[basicstyle = \mlttfamily\scriptsize , style =
Matlab-editor]{code/quantizeSample.m}

\pagebreak
\section*{Q7: Quantization of the Signal sampled at 8 times Nyquist rate ($8f_{nq}$) with 16 Quantization Levels}

Observe the following figures while paying attention to the grids which makes it easy to identify the change in amplitudes after the quantization. Corresponding  Sampled Values and Quantized Values are also given below and it is seen that both {\tt 1.0000  and  0.9239} are quantized on to the {\tt 0.9375} quantization level and other values are quantized onto the corresponding discrete levels.

\begin{verbatim}
Sampled Values:
1.0000    0.9239    0.7071    0.3827    0.0000   -0.3827   -0.7071   -0.9239   -1.0000
Quantized Values:
	0.9375    0.9375    0.6875    0.4375         0   -0.4375   -0.6875   -0.9375   -0.9375
\end{verbatim}

\begin{figure}[!h]
	\centering
	\includegraphics[scale=0.45]{figures/q71}
	\caption{Sampled Signal at 8 times Nyquist rate ($8f_{nq}$)}
\end{figure}

\begin{figure}[!h]
	\centering
	\includegraphics[scale=0.45]{figures/q72}
		\caption{Quantization of the Signal sampled at 8 times Nyquist rate with 16 Quantization Levels}
		\label{l16}
\end{figure}

\pagebreak
\section*{Q8: Quantization of the Signal sampled at 8 times Nyquist rate ($8f_{nq}$) with 32 and 8 Quantization Levels}

\begin{verbatim}
Sampled Values:
	1.0000    0.9239    0.7071    0.3827    0.0000   -0.3827   -0.7071   -0.9239   -1.0000
Quantized Values:
0.9688    0.9063    0.7188    0.4063         0   -0.4063   -0.7188   -0.9063   -0.9688

\end{verbatim}

\begin{figure}[!h]
	\centering
	\includegraphics[scale=0.42]{figures/q32l}
	\caption{Quantization of the Signal sampled at 8 times Nyquist rate with 32 Quantization Levels}
	\label{l32}
\end{figure}

\begin{verbatim}
Sampled Values:
	1.0000    0.9239    0.7071    0.3827    0.0000   -0.3827   -0.7071   -0.9239   -1.0000
Quantized Values:
	0.8750    0.8750    0.6250    0.3750         0   -0.3750   -0.6250   -0.8750   -0.8750
\end{verbatim}
\begin{figure}[!h]
	\centering
	\includegraphics[scale=0.42]{figures/q8l}
		\caption{Quantization of the Signal sampled at 8 times Nyquist rate with 8 Quantization Levels}
		\label{l8}
\end{figure}

\pagebreak

\begin{verbatim}
	Sampled Values:
	1.0000    0.9239    0.7071    0.3827    0.0000   -0.3827   -0.7071   -0.9239   -1.0000

	Quantized Values with 32 Levels:
	0.9688    0.9063    0.7188    0.4063         0   -0.4063   -0.7188   -0.9063   -0.9688

	Quantized Values with 16 Levels:
	0.9375    0.9375    0.6875    0.4375         0   -0.4375   -0.6875   -0.9375   -0.9375

	Quantized Values with 8 Levels:
	0.8750    0.8750    0.6250    0.3750         0   -0.3750   -0.6250   -0.8750   -0.8750
\end{verbatim}
\vspace{1cm}
When observing the above plots and the given values  following conclusions can be made.\\

\begin{itemize}
	\item As depicted in Fig. \ref{l32} when the quantization levels are increases every sampled value is mapped into a unique quantization level but when we decrease the number of quantization levels as in Fig. \ref{l16} and Fig. \ref{l8} several sample values may be mapped into the same quantization level. This introduces an ambiguity at the signal reconstruction stage as we have lost the information about actual value of the amplitudes.

	\item In  addition to that when the number of quantization levels are decreased the actual value of the sampled signal and the value of the quantized signal differs a lot which again introduces an ambiguity at the signal reconstruction stage. This can be clearly seen when comparing the original signal's envelope drawn in dashed line with the quantized signal.
\end{itemize}

Therefore in order to minimize the quantization noise we need to increase the number of quantization levels.

%\vfill
%\hrule
%\begin{center}
%	Executable code for this assignment can be found  \href{https://github.com/bimalka98/Computer-Vision-and-Image-Processing/blob/main/EN2550Assignments/A2/180631J_a02.ipynb}{here}.
%\end{center}

\includepdf[pages=-]{code.pdf}

\end{document}

Digital Signal Sampling May 3, 2021/LaTeX Report/180631J_A01_EN2073.tex


% Title:
% 	UiB presentation template
% ----------------------
% Description:
% 	A UiB presentation template. Based loosely on
%	http://kapd.h.uib.no/profilmanual/02Maler/02bb1_PPTPresentasjon.html
%
% Creator: Tommy O.

% ----------------------
% Setup
% ----------------------
\documentclass[12pt, aspectratio=149, t]{beamer}
% Options for aspectratio: 1610, 149, 54, 43 and 32, 169
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usecolortheme{beaver} % Decent options: beaver, rose, crane
\usepackage{listings}

\title{Presentation title}
\subtitle{Presentation subtitle}
\institute{University of Bergen}
\date{\today}
\author{Tommy O.}

% -------------------------------------------------------------------------
% Package imports
% -------------------------------------------------------------------------
\usepackage{etoolbox}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{listings}
\usepackage[sharp]{easylist}
\usepackage{multicol}
\usepackage{tikz-cd}

% Remove navigation symbols and add frame number
\beamertemplatenavigationsymbolsempty
\setbeamerfont{page number in head/foot}{size=\scriptsize}
\setbeamertemplate{footline}[frame number]

% Set up colors to be used
\definecolor{purered}{RGB}{204,0,0}
\definecolor{titlered}{RGB}{229,78,71}
\definecolor{bggray}{RGB}{242,242,242}
\definecolor{bggraydark}{RGB}{217,217,217}

% Change the default colors

\setbeamercolor*{title}{bg=bggray,fg=titlered}
\AtBeginEnvironment{theorem}{%
	\setbeamercolor{block title}{fg=titlered, bg=bggraydark}
	\setbeamercolor{block body}{fg=black,bg=bggray}
}
\AtBeginEnvironment{proof}{%
	\setbeamercolor{block title}{bg=bggraydark}
	\setbeamercolor{block body}{fg=black,bg=bggray}
}
\AtBeginEnvironment{example}{%
	\setbeamercolor{block title example}{bg=bggraydark}
	\setbeamercolor{block body example}{fg=black,bg=bggray}
}
\AtBeginEnvironment{definition}{%
	\setbeamercolor{block title}{bg=bggraydark}
	\setbeamercolor{block body}{fg=black,bg=bggray}
}

\setbeamercolor{block title example}{bg=bggraydark}
\setbeamercolor{block body example}{fg=black,bg=bggray}
\setbeamercolor{block title}{bg=bggraydark}
\setbeamercolor{block body}{fg=black,bg=bggray}

\setbeamercolor{frametitle}{fg=titlered,bg=bggray}
\setbeamercolor{section in head/foot}{bg=black}
\setbeamercolor{author in head/foot}{bg=black}
\setbeamercolor{date in head/foot}{fg=titlered}

% Custom mathematics commands
\DeclareMathOperator{\C}{\mathbb{C}}
\DeclareMathOperator{\R}{\mathbb{R}}
\DeclareMathOperator{\Q}{\mathbb{Q}}
\DeclareMathOperator{\Z}{\mathbb{Z}}
\DeclareMathOperator{\N}{\mathbb{N}}

% Spacing for lsits
\newcommand{\listSpace}{0.2em}

% Theorems, equations, definitions setup
\theoremstyle{plain}

% -------------------------------------------------------------------------
% Document start
% -------------------------------------------------------------------------
\begin{document}
\maketitle
\addtobeamertemplate{frametitle}{}{%
\begin{tikzpicture}[remember picture,overlay]
  	\node[anchor=south west,yshift=0pt, xshift=4pt] at (current page.south west) {\includegraphics[height=0.75cm]{figs/UiB_MN_left.pdf}};
\end{tikzpicture}}

\begin{frame}{Table of contents}
	\tableofcontents
\end{frame}

% -------------------------------------------------------------------------
\section{First section}
\begin{frame}[fragile]{A slide with bullet points}
	\begin{easylist}[itemize]
		\ListProperties(Space=\listSpace, Space*=\listSpace)
		# Represent Abelian groups on the computer
		# Compute on Abelian groups
		# Solve equations, factor group homomorphisms
	\end{easylist}
\end{frame}

\begin{frame}[fragile]{A slide with a theorem and a proof.}
\begin{theorem}[Integral]
	\begin{equation*}
		\int_{a}^{b} f(x) \, dx = F(b) - F(a)
	\end{equation*}
\end{theorem}
\begin{proof}
Here's the proof.
\end{proof}
\end{frame}

\begin{frame}[fragile]{A slide with two columns}
\begin{columns}
\begin{column}{0.5\textwidth}
	\begin{easylist}[itemize]
		\ListProperties(Space=\listSpace, Space*=\listSpace)
		# Represent Abelian groups
		# Compute on Abelian
		# Solve equations
	\end{easylist}
\end{column}
\begin{column}{0.5\textwidth}
    \begin{center}
     \includegraphics[width=0.5\textwidth]{figs/UiB_logo.pdf}
     \end{center}
\end{column}
\end{columns}
\end{frame}

% -------------------------------------------------------------------------
\section{Second section}
\begin{frame}[fragile]{A slide with blocks}
	\begin{block}{title of the bloc}
	bloc text
	\end{block}

	\begin{exampleblock}{title of the bloc}
	bloc text
	\end{exampleblock}
\end{frame}

\begin{frame}[fragile]{A slide using pause}
	\begin{easylist}[itemize]
		\ListProperties(Space=\listSpace, Space*=\listSpace)
		# Represent Abelian groups on the computer \pause
		# Compute on Abelian groups \pause
		# Solve equations, factor group homomorphisms
	\end{easylist}
\end{frame}

\end{document}