% Created 2014-05-10 Sat 21:33
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\author{Torsten Schaub\\\url{torsten@cs.uni-potsdam.de}\\\url{http://potassco.sourceforge.net/videos.html}}
\date{\today}
\title{The ASP solving process\\
via Graph coloring
}
\hypersetup{
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs 24.3.1 (Org mode 8.2.3c)}}
\begin{document}

\maketitle
\tableofcontents

\section{Process}
\label{sec-1}
okular --presentation asp-solving.pdf
\section{Problem}
\label{sec-2}
\begin{itemize}
\item \url{http://en.wikipedia.org/wiki/Graph_coloring}
\item Example: Graph coloring, Section 3.1 in \footnote{M. Gebser, R. Kaminski, B. Kaufmann, and T. Schaub.
Answer Set Solving in Practice.
Synthesis Lectures on Artificial Intelligence and Machine Learning, Morgan and Claypool
December 2012, 238 pages, \url{10.2200/S00457ED1V01Y201211AIM019}}

\item Given a graph consisting of nodes and edges,
assign each node one color
such that
no two nodes connected by an edge have the same color
\end{itemize}
\section{Modeling}
\label{sec-3}
\subsection{Problem instance}
\label{sec-3-1}

A \textbf{graph} consisting of nodes and edges, along with some colors,
is represented as
\begin{itemize}
\item facts formed by predicates node/1 and edge/2
\item facts formed by predicate  col/1
\end{itemize}

\subsubsection{Commands}
\label{sec-3-1-1}
view-file \href{graph.lp}{graph.lp}
\subsection{Problem class}
\label{sec-3-2}

Assign each node one color 
such that 
no two nodes connected by an edge have the same color

In other words:

\begin{itemize}
\item Each node has a unique color
\item Two connected nodes must not have the same color
\end{itemize}

\subsubsection{Commands}
\label{sec-3-2-1}
view-file \href{color.lp4}{color.lp4} \footnote{We use extension lp4 to indicate encodings for gringo 4 (along the ASP-Core-2 standard \footnotemark)}\footnotetext[3]{F. Calimeri, W. Faber, M. Gebser, G. Ianni, R. Kaminski, T. Krennwallner, N. Leone, F. Ricca, and T. Schaub: ASP-Core-2: Input language format. 2012.
Available at \url{https://www.mat.unical.it/aspcomp2013/files/ASP-CORE-2.0.pdf}.}

okular --presentation methodology.pdf
\section{Grounding}
\label{sec-4}
gringo4 --version

\begin{itemize}
\item \uline{human-readable output}
gringo4 color.lp4 graph.lp --text

\item \uline{machine-readable output} (see Table 7.1 in \footnotemark[1]{})
gringo4 color.lp4 graph.lp
\end{itemize}

\subsection{NB: You may as well want to try gringo 3 for more options:}
\label{sec-4-1}

view-file  \href{color.lp4}{color.lp4} \footnotemark[2]{}
view-file  \href{color.lp}{color.lp}

gringo3 color.lp  graph.lp --text

gringo3 color.lp4 graph.lp --text
gringo4 color.lp4 graph.lp --text
\section{Solving}
\label{sec-5}
clasp3 --version

gringo4 color.lp4 graph.lp | clasp3 
gringo4 color.lp4 graph.lp | clasp3 0

gringo4 color.lp4 graph.lp | clasp3 0 --stats
\section{Miscellaneous}
\label{sec-6}
\subsection{Alternative encoding}
\label{sec-6-1}

view-file \href{colorD.lp4}{colorD.lp4} \footnotemark[2]{}

gringo4 colorD.lp4 graph.lp --text
gringo4 colorD.lp4 graph.lp | clasp3 0
\subsection{clingo versus gringo+clasp}
\label{sec-6-2}
clingo4 --version

clingo4 color.lp4 graph.lp

clingo4 --help
\begin{itemize}
\item "--help=3"
clingo4 --help=3
\item "--mode"
clingo4 --mode=gringo color.lp4 graph.lp | clingo4 --mode=clasp
\end{itemize}
% Emacs 24.3.1 (Org mode 8.2.3c)
\end{document}
