\input{template}
\input{macros}
\begin{document}
\lecture{24}{ILP formulations for SAT and shortest path problem.}{Kshitij Bhardwaj}
Writing ILP(Integer Linear Program) for the following \newline
a) SAT \newline
b) Shortest Path 
\section{SAT :}
For a given conjunction of clauses find an assignment of truth values for the literals so that the expression evaluates to true. 
Clause - Disjunction of literals \newline
\hfill \newline
For Example - $((x_{1} \vee x_{2} \vee x_{3}) \wedge (x_4 \vee x_5 \vee x_6))$ \newline
Now we have to assign truth values to $x_{i}$'s such that expression evaluates to true. Clearly for this to hold each of the clause should evaluate to true.\newline
\hfill \newline
Hence the input and output for the SAT problem are as follows : \newline
\textbf{Input} : Set of clauses \newline
\textbf{Output} : Setting of true/false values to the variables such that each clause evaluates to true. \newline

\section{Shortest Path :}
Given a directed graph with positive edge weights (see Figure 1) find a shortest path between two given points. \newline
\hfill \newline
If $E$ is the edge set and $w_{e}$ is the weight of the edge $e \in E $ then the set $S \subseteq E$ is the shortest path from $s$ to $t$ if $\displaystyle\sum_{e \in S}{w_{e}}$ is smallest among all such sets whose elements form a path from $s$ to $t$. \newline
\begin{figure}[ht]
\center
\includegraphics[width=8cm]{lecture24kgraph}
\caption{Directed Graph}
\end{figure}


\hfill \newline
\textbf{Input} : A set of directed edges, the two vertices(say $s$ and $t$) between which the shortest path is to be found. \newline
\textbf{Output} : A set of edges such that these edges form a path from $s$ to $t$ and this is the least cost path from $s$ to $t$. \newline

\section{Formulating an ILP}
\textbf{Choice of variables} :  \newline
The variables are usually the unknows in the problem. And some assignment of values to these will lead us to the desired solution. \newline In the case of SAT the literals are the ones to which values have to be assigned. And an appropriate assignment to these is what we are looking for. Hence in the ILP  for SAT we have one variable for each literal.

\hfill \newline
\textbf{Constraints} :  \newline
The constraints in an ILP should be of the form $AX \leq b$. If we look at each constraint individually i.e. each row of the matrix at a time then it will be of the form $A_{i_{1}}x + A_{i_{2}}y + ...... +A_{i_{n}}w \leq b_{i}$ where $A_{i_{1}},A_{i_{2}},...,A_{i_{n}}$ and $b_{i}$ are constants and $x, y, ... , w$ are the variables. The constraints in case of SAT must force at least one variable in each clause to take value true.
\hfill \newline
\textbf{Cost} :  \newline
The cost should be of the form  max/min$\enskip C^{T}X $. In some cases this might not be of any use as in the case of SAT where the cost function is immaterial and we would not need it to solve the problem.


\end{document}
