diff --git a/Makefile b/Makefile index 2cd857d..5b95fcd 100644 --- a/Makefile +++ b/Makefile @@ -16,10 +16,18 @@ latex.out/.sync: mkdir -p latex.out touch latex.out/.sync -%.pdf: %.tex latex.out/.sync FORCE - $(info compiling $@) +%.pdf: %.tex latex.out/.sync assets FORCE + $(info compiling $*) @pipenv run ./vendor/latexrun --latex-cmd=$(LATEX) --latex-args="-shell-escape --8bit" --bibtex-cmd=$(BIBTEX) --makeglossaries-cmd=$(MAKEGLOS) $< +assets: assets/img/back_chess1.pdf assets/img/back_chess2.pdf assets/img/back_chess3.pdf assets/img/back_chess4.pdf assets/img/rew_interpreter_plot.pdf + +assets/img/%.pdf: assets/img/src/%.tex + xelatex -output-directory=assets/img $< + rm -f assets/img/$*.{aux,log} + + + update: pipenv lock rm -f latex.out/.sync @@ -30,3 +38,4 @@ clean: clobber: rm -rf latex.out/* + rm -f assets/img/{back_chess{1,2,3,4},rew_interpreter_plot}.* diff --git a/assets/img/back_chess1.pdf b/assets/img/back_chess1.pdf new file mode 100644 index 0000000..3865044 Binary files /dev/null and b/assets/img/back_chess1.pdf differ diff --git a/assets/img/back_chess2.pdf b/assets/img/back_chess2.pdf new file mode 100644 index 0000000..a13dd53 Binary files /dev/null and b/assets/img/back_chess2.pdf differ diff --git a/assets/img/back_chess3.pdf b/assets/img/back_chess3.pdf new file mode 100644 index 0000000..db172fd Binary files /dev/null and b/assets/img/back_chess3.pdf differ diff --git a/assets/img/back_chess4.pdf b/assets/img/back_chess4.pdf new file mode 100644 index 0000000..a888f92 Binary files /dev/null and b/assets/img/back_chess4.pdf differ diff --git a/assets/img/rew_interpreter_plot.pdf b/assets/img/rew_interpreter_plot.pdf new file mode 100644 index 0000000..f452a46 Binary files /dev/null and b/assets/img/rew_interpreter_plot.pdf differ diff --git a/assets/img/src/back_chess1.tex b/assets/img/src/back_chess1.tex new file mode 100644 index 0000000..8e6a744 --- /dev/null +++ b/assets/img/src/back_chess1.tex @@ -0,0 +1,16 @@ +\documentclass{standalone} + +% Drawing chessboards (background) +\usepackage{chessboard} +\setchessboard{showmover=false} + +\begin{document} + +\chessboard[ + setwhite={Qd3}, + pgfstyle=cross, + color=red, + markarea={d1-d2,d4-d8}, +] + +\end{document} diff --git a/assets/img/src/back_chess2.tex b/assets/img/src/back_chess2.tex new file mode 100644 index 0000000..18cc531 --- /dev/null +++ b/assets/img/src/back_chess2.tex @@ -0,0 +1,19 @@ +\documentclass{standalone} + +% Drawing chessboards (background) +\usepackage{chessboard} +\setchessboard{showmover=false} + +\begin{document} + +\chessboard[ + setwhite={Qd3}, + pgfstyle=cross, + color=red!35!white, + markareas={d1-d2,d4-d8}, + pgfstyle=cross, + color=red, + markareas={a3-c3,e3-h3}, +] + +\end{document} diff --git a/assets/img/src/back_chess3.tex b/assets/img/src/back_chess3.tex new file mode 100644 index 0000000..caebb95 --- /dev/null +++ b/assets/img/src/back_chess3.tex @@ -0,0 +1,19 @@ +\documentclass{standalone} + +% Drawing chessboards (background) +\usepackage{chessboard} +\setchessboard{showmover=false} + +\begin{document} + +\chessboard[ + setwhite={Qd3}, + pgfstyle=cross, + color=red!35!white, + markareas={d1-d2,d4-d8,a3-c3,e3-h3}, + pgfstyle=cross, + color=red, + markareas={b1-b1,c2-c2,e4-e4,f5-f5,g6-g6,h7-h7}, +] + +\end{document} diff --git a/assets/img/src/back_chess4.tex b/assets/img/src/back_chess4.tex new file mode 100644 index 0000000..1e43f10 --- /dev/null +++ b/assets/img/src/back_chess4.tex @@ -0,0 +1,19 @@ +\documentclass{standalone} + +% Drawing chessboards (background) +\usepackage{chessboard} +\setchessboard{showmover=false} + +\begin{document} + +\chessboard[ + setwhite={Qd3}, + pgfstyle=cross, + color=red!35!white, + markareas={d1-d2,d4-d8,a3-c3,e3-h3,b1-b1,c2-c2,e4-e4,f5-f5,g6-g6,h7-h7}, + pgfstyle=cross, + color=red, + markareas={a6-a6,b5-b5,c4-c4,e2-e2,f1-f1}, +] + +\end{document} diff --git a/assets/img/src/rew_interpreter_plot.tex b/assets/img/src/rew_interpreter_plot.tex new file mode 100644 index 0000000..abb4663 --- /dev/null +++ b/assets/img/src/rew_interpreter_plot.tex @@ -0,0 +1,44 @@ +\documentclass{standalone} +\usepackage{pgfplots} +\usepackage{pgfplotstable} +\pgfplotsset{compat=1.17} +\usetikzlibrary{patterns} + +\begin{document} + +\definecolor{cb1}{RGB}{230, 159, 0} +\definecolor{cb2}{RGB}{ 86, 180, 223} +\definecolor{cb3}{RGB}{ 0, 158, 115} +\definecolor{cb4}{RGB}{240, 228, 66} + +\pgfplotstableread[ + col sep=comma, +]{assets/table/rew_functional.csv}\rewFuncData{} +\begin{tikzpicture} +\begin{axis}[ + xbar, + reverse legend, + legend style={at={(0.82,0.8)}, + anchor=west,legend columns=1}, + xlabel={Run-time (ms)}, + symbolic y coords={{A(3,6)},{Fib(23)},{Tak(18,12,6)}}, + ytick=data, + % cycle list name=exotic, + nodes near coords, + nodes near coords align={horizontal}, + width = \columnwidth, + height = 8cm, + enlarge y limits={0.3}, + enlarge x limits={0.03}, + xmin = 0, + xmax = 130, +] +\addplot[fill=cb1, postaction={pattern=grid}] table [y={test}, x={MiniZinc}]{\rewFuncData}; +\addplot[fill=cb2, postaction={pattern=north east lines}] table [y={test}, x={Python}]{\rewFuncData}; +\addplot[fill=cb3, postaction={pattern=dots}] table [y={test}, x={Prototype}]{\rewFuncData}; +\addplot[fill=cb4] table [y={test}, x={OCaml}]{\rewFuncData}; +\legend{MiniZinc,Python,Prototype,OCaml} +\end{axis} +\end{tikzpicture} + +\end{document} diff --git a/assets/packages.tex b/assets/packages.tex index 9c4ede8..67db68a 100644 --- a/assets/packages.tex +++ b/assets/packages.tex @@ -60,11 +60,6 @@ % Tables \usepackage{booktabs} -% Plots -\usepackage{pgfplots} -\usepackage{pgfplotstable} -\pgfplotsset{compat=1.17} -\usetikzlibrary{patterns} % Glossary / Acronyms \usepackage[acronym,toc]{glossaries} @@ -79,11 +74,6 @@ \usepackage{graphicx} \usepackage{subcaption} -% Drawing chessboards (background) -\usepackage{chessboard} -\setchessboard{showmover=false} - - % % TODO: What am I doing with this? \newcommand*\justify{% \fontdimen2\font=0.4em% interword space diff --git a/chapters/2_background.tex b/chapters/2_background.tex index c8ae635..d482a63 100644 --- a/chapters/2_background.tex +++ b/chapters/2_background.tex @@ -538,53 +538,24 @@ They allow modellers to use high-level constraints that are used directly by the \centering \begin{subfigure}[b]{.48\columnwidth} \centering - \chessboard[ - setwhite={Qd3}, - pgfstyle=cross, - color=red, - markarea={d1-d2,d4-d8}, - ] + \includegraphics{assets/img/back_chess1} \caption{\label{sfig:back-nqueens-1} Assign a queen to d3} \end{subfigure}% \hspace{0.04\columnwidth}% \begin{subfigure}[b]{.48\columnwidth} \centering - \chessboard[ - setwhite={Qd3}, - pgfstyle=cross, - color=red!35!white, - markareas={d1-d2,d4-d8}, - pgfstyle=cross, - color=red, - markareas={a3-c3,e3-h3}, - ] + \includegraphics{assets/img/back_chess2} \caption{\label{sfig:back-nqueens-2} Propagate rows} \end{subfigure} \begin{subfigure}[b]{.48\columnwidth} \centering - \chessboard[ - setwhite={Qd3}, - pgfstyle=cross, - color=red!35!white, - markareas={d1-d2,d4-d8,a3-c3,e3-h3}, - pgfstyle=cross, - color=red, - markareas={b1-b1,c2-c2,e4-e4,f5-f5,g6-g6,h7-h7}, - ] + \includegraphics{assets/img/back_chess3} \caption{\label{sfig:back-nqueens-3} Propagate upwards diagonal} \end{subfigure}% \hspace{0.04\columnwidth}% \begin{subfigure}[b]{.48\columnwidth} \centering - \chessboard[ - setwhite={Qd3}, - pgfstyle=cross, - color=red!35!white, - markareas={d1-d2,d4-d8,a3-c3,e3-h3,b1-b1,c2-c2,e4-e4,f5-f5,g6-g6,h7-h7}, - pgfstyle=cross, - color=red, - markareas={a6-a6,b5-b5,c4-c4,e2-e2,f1-f1}, - ] + \includegraphics{assets/img/back_chess4} \caption{\label{sfig:back-nqueens-4} Propagate downward diagonal} \end{subfigure} \caption{\label{fig:back-nqueens} An example of domain propagation when a queen gets assigned in the N-Queens problem.} diff --git a/chapters/3_rewriting.tex b/chapters/3_rewriting.tex index 4ac44dc..01d9e18 100644 --- a/chapters/3_rewriting.tex +++ b/chapters/3_rewriting.tex @@ -739,7 +739,7 @@ These are very encouraging results, given that we are comparing a largely unopti \includegraphics[width=\columnwidth]{assets/img/rew_compare_memory} \caption{\label{sfig:rew-comparemem}Maximum resident set size (kbytes)} \end{subfigure} - \caption{\label{fig:rew-runtime}Performance on flattening MiniZinc Challenge + \caption{\label{fig:4-runtime}Performance on flattening MiniZinc Challenge instances. \minizinc\ 2.5.5 (x-axis) vs new architecture (y-axis), log-log plot. Dots below the line indicate the new system is better.} \end{figure} @@ -747,40 +747,7 @@ These are very encouraging results, given that we are comparing a largely unopti \begin{figure}[ht] \centering - \definecolor{cb1}{RGB}{230, 159, 0} - \definecolor{cb2}{RGB}{ 86, 180, 223} - \definecolor{cb3}{RGB}{ 0, 158, 115} - \definecolor{cb4}{RGB}{240, 228, 66} - - \pgfplotstableread[ - col sep=comma, - ]{assets/table/rew_functional.csv}\rewFuncData{} - \begin{tikzpicture} - \begin{axis}[ - xbar, - reverse legend, - legend style={at={(0.82,0.8)}, - anchor=west,legend columns=1}, - xlabel={Run-time (ms)}, - symbolic y coords={{A(3,6)},{Fib(23)},{Tak(18,12,6)}}, - ytick=data, - % cycle list name=exotic, - nodes near coords, - nodes near coords align={horizontal}, - width = \columnwidth, - height = 8cm, - enlarge y limits={0.3}, - enlarge x limits={0.03}, - xmin = 0, - xmax = 130, - ] - \addplot[fill=cb1, postaction={pattern=grid}] table [y={test}, x={MiniZinc}]{\rewFuncData}; - \addplot[fill=cb2, postaction={pattern=north east lines}] table [y={test}, x={Python}]{\rewFuncData}; - \addplot[fill=cb3, postaction={pattern=dots}] table [y={test}, x={Prototype}]{\rewFuncData}; - \addplot[fill=cb4] table [y={test}, x={OCaml}]{\rewFuncData}; - \legend{MiniZinc,Python,Prototype,OCaml} - \end{axis} - \end{tikzpicture} + \includegraphics[width=\columnwidth]{assets/img/rew_interpreter_plot} \caption{\label{fig:rew-interpreter-comp} Run-time comparison of interpreters on recursive functions: Takeuchi, Fibonacci, and Ackermann.}