-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathclingo-lpx.tex
77 lines (73 loc) · 2.5 KB
/
clingo-lpx.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
73
74
75
76
77
% ----------------------------------------------------------------------
\begin{frame}{\clingolpx}
\begin{itemize}
\item \structure{Idea} \ extend \clingo\ with linear constraints over rationals
\item \structure{Features} \
\begin{itemize}
\item rational variables not subject to grounding
\item basic constraints \lstinline{&sum}
\item optimization \lstinline{&minimize}
\item customized propagator based on simplex method
\item arbitrary precision arithmetics
\end{itemize}
\item \structure{Applications} \ notably, hybrid metabolic network completion~\cite{frscscsiwa18a}
\end{itemize}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}[fragile]{Example}{0/1 Knapsack}
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,xshift=-1ex,yshift=-2.1cm] at (current page.north east){%
\includegraphics[width=.26\textwidth]{pictures/knapsack.pdf}};
\end{tikzpicture}
\begin{adjustbox}{max totalsize={\textwidth}{.6\textheight},keepaspectratio}
\begin{lstlisting}[escapeinside=||]
item(a;b;c;d).
weight(a,"3.3";b,"4.7";c,"6.1";d,"5.9").
value(a,"3.1";b,"3.2";c,"1.9";d,"4.8").
load("9.1").
|\pause|
{ pack(I) } :- item(I).
&sum { I } = 1 :- pack(I).
&sum { I } = 0 :- item(I), not pack(I).
&sum { W*I: weight(I,W) } <= L :- load(L).
&maximize { P*I: value(I,P) }.
\end{lstlisting}
\end{adjustbox}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}[fragile]{Example}{0/1 Knapsack}
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,xshift=-2em,yshift=-3cm] at (current page.north east){%
\includegraphics[width=.21\textwidth]{pictures/knapsack-sol.pdf}};
\end{tikzpicture}
\begin{adjustbox}{max totalsize={\textwidth}{.75\textheight},keepaspectratio}
\begin{lstlisting}
$ clingo-lpx encoding.lp instance.lp --objective=global --quiet=1 0
clingo-lpx version 1.3.0
Reading from knapsack.lp
Solving...
Answer: 4
item(a) item(b) item(c) item(d)
load("9.1")
pack(a) pack(b)
value(a,"3.1") value(b,"3.2")
value(c,"1.9") value(d,"4.8")
weight(a,"3.3") weight(b,"4.7")
weight(c,"6.1") weight(d,"5.9")
Assignment:
a=1 b=1 c=0 d=0
Optimization: 63/10 [bounded]
SATISFIABLE
Models : 4
Calls : 1
Time : 0.001s (Solving: 0.00s 1st Model: 0.00s Unsat: 0.00s)
CPU Time : 0.001s
\end{lstlisting}
\end{adjustbox}
\end{frame}
% ----------------------------------------------------------------------
%
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../../main"
%%% End: