-
Notifications
You must be signed in to change notification settings - Fork 1
/
optimization.tex
72 lines (71 loc) · 2.37 KB
/
optimization.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
% ----------------------------------------------------------------------
\begin{frame}[fragile]{Optimization}
\bigskip
\begin{itemize}
\item Imagine some Blocksworld planning problem \dots
\smallskip
\item \structure{Code snippet}
\begin{lstlisting}[language=clingo,basicstyle=\ttfamily\small]
ngoal(T) :- not on(B,L,T), goal_on(B,L), time(T).
:- ngoal(n).
\end{lstlisting}
where \texttt{n} is a fixed horizon
\medskip
\item<2-> \structure{Optimization}
\begin{lstlisting}
_minimize(1,T) :- ngoal(T).
\end{lstlisting}
\end{itemize}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}[fragile,shrink]{Optimization}
\lstinputlisting[language=python]{opt.py}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}[fragile,shrink=37]{Optimization, zoom on \texttt{main}}
\bigskip
\lstinputlisting[language=python,linerange=29-46]{opt.py}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}[fragile,shrink=25]{Optimization, zoom on \texttt{\_on\_model}}
\bigskip
\lstinputlisting[language=python,linerange=22-27]{opt.py}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}[fragile,shrink]{Let's run it!}
\scriptsize\medskip
\begin{lstlisting}
UNIX> python opt.py tohB.lp tohI.lp -c n=17
opt-example version 1.0
Reading from tohB.lp ...
Solving...
Answer: 1
move(4,b,1) move(3,c,2) move(4,a,3) move(4,c,4) move(2,b,5) \
move(4,a,6) move(3,b,7) move(4,c,8) move(4,b,9) move(1,c,10) \
move(4,c,11) move(3,a,12) move(4,a,13) move(2,c,14) move(4,b,15)
move(3,c,16) move(4,c,17)
Found new bound: 17
Solving...
Answer: 1
move(4,b,1) move(3,c,2) move(4,c,3) move(2,b,4) move(4,a,5) \
move(3,b,6) move(4,c,7) move(4,b,8) move(1,c,9) move(4,c,10) \
move(3,a,11) move(4,a,12) move(2,c,13) move(4,b,14) move(3,c,15)
move(4,c,16)
Found new bound: 16
Solving...
Answer: 1
move(4,b,1) move(3,c,2) move(4,c,3) move(2,b,4) move(4,a,5) \
move(3,b,6) move(4,b,7) move(1,c,8) move(4,c,9) move(3,a,10) \
move(4,a,11) move(2,c,12) move(4,b,13) move(3,c,14) move(4,c,15)
Found new bound: 15
Solving...
Optimum found
UNSATISFIABLE
\end{lstlisting}
\end{frame}
% ----------------------------------------------------------------------
%
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../../main"
%%% End: