\input{template}
\input{macros}

\usepackage{color, graphicx}
\usepackage{amssymb, amsmath}
\usepackage{epsfig}

\begin{document}
\lecture{25} {ILP formulations for SAT and shortest path problem (contd.)}{ Ajit Burad}

%% -----------------------------------------------------------------------------
%%                          Beginning of Section 1.
%% -----------------------------------------------------------------------------
\section{SAT (\textit{continuing with previous lecture})}
\textbf{Input } : Conjunction of Clauses \\
$( x_{1} \vee x_{2} \vee ...) \wedge ( x_{3} \vee x_{4} \vee ...) \wedge (... \vee  ...)$ \\

\textbf{Variables }
The literals, $x_{i}$'s, in the clauses which are being assigned true or false are variables for the ILP. \\
But for the ILP we do not have True, False in our set so we will have one variable per boolean variable.\\
For instance a variable $y_{i}$ corresponding to each boolean variable $x_{i}$, So
\begin{center}
$x_{i}$ being false will be equivalent to $y_{i}$ being zero. \\
$x_{i}$ being true will be equivalent to $y_{i}$ being one. 
\end{center}
Here 0 $\leq$ $y_{i}$ $\leq$ 1 , $y_{i}$  is  Integer forces $y_{i}$ to take values either 1 or 0.\\
\\

We will represent $\overline{y_{i}}$  = $1-y_{i}$. So for each clause $( x_{i} \vee x_{j} \vee ...)$  the fact that one of the literals has to be true can be expressed as: 
\begin{center}
$y_{i}$ + $y_{j}$ + ...  $\geq$ 1
\end{center}
If we have $\overline{x_{i}}$, replace it with 1-$y_{i}$. \\
Here cost function is immaterial as for each set of $y_{i}$'s we can get corresponding $x_{i}$'s.

Here another approach (which does not work) could have been assigning :
\begin{center}
$y_{i}$ = +1 \enskip if \enskip $x_{i}$ = true \\ 
$y_{i}$ = -1 \enskip if \enskip $x_{i}$ = false \\
\end{center}
then -1 $\leq y_{i} \leq 1$
but $y_{i}$ = 0 is not assigned anywhere.\\
Hence it is not possible to solve it this way.\\

\section{Shortest Path}
\textbf{Input} :\\
	Directed Graph(G) (with each edge having positive integer weight) \\
	Vertices s,t $\in$ V(G) 
		\begin{itemize} 
		 \item Where s and t are start and end vertices respectively for the required path.
		\item V(G) is vertex set of G
		\end{itemize}

\textbf{Output} :
	Shortest Path between s and t \\ 
\\
To construct an ILP we  first need to define variables. An assignment to the variables should tell us what the output should be. \\
For this problem we choose one variable ($w_{i}$) per edge.\\
	$x_{i}$ = 1 $\Rightarrow$ corresponding edge is chosen in shortest path from s to t. \\
	$x_{i}$ = 0 $\Rightarrow$ edge is not part of shortest path from s to t. \\
\\
\textbf{Cost :}
	Let the cost of edge e be $c_{e}$ \\
	Cost of path = $\displaystyle\sum_{e}{(x_{e} *c_{e})}$ \\
Consider subsets of the vertex set which do not contain t but contain s. (See figure 1) \\
\begin{figure}
\center
\includegraphics[width=5cm,height=5cm]{lecture25afig1}
\caption{}
\end{figure}
$\forall$ U $\subseteq$ V such that s $\in$ U, t $\notin$ U, at least one edge leaving U must be selected. \\

The following set of constraints force a path from s to t for every  U $\in$ V(G), such that  s $\in$U and v $\notin$ U, \\

$\displaystyle\sum_{u \in U, v \notin U}{ X_{uv} \geq 1}$   ;  \\

Note that we had an exponential number of costraints. There is another way to write the constraints, so that there are only a polynomial number of them.\\

$\displaystyle\sum_{v}{x_{sv} = 1}$ , $\displaystyle\sum_{u}{x_{ut} = 1}$  (There are edges one starting from s and one terminating at t in our required path. We assume that there are no edges entering s and leaving t in G). \\
Also $\forall$ u $\neq$ s,t  
$\displaystyle\sum_{w}{x_{wu}} - \displaystyle\sum_{v}{x_{uv}} = 0$ ; $0 \leq Xuv \leq 1$ .\\
Now we need to write dual for this and we will do the same thing as we did for SAT and we will end up with Dijkstra's. \\
\end{document}

