2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
This commit is contained in:
Martin Thoma 2013-09-07 15:04:33 +02:00
parent 060ee0828a
commit 03756e0131
4 changed files with 96 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

View file

@ -0,0 +1,57 @@
\documentclass{article}
\usepackage[pdftex,active,tightpage]{preview}
\setlength\PreviewBorder{2mm}
\usepackage[utf8]{inputenc} % this is needed for umlauts
\usepackage[ngerman]{babel} % this is needed for umlauts
\usepackage[T1]{fontenc} % this is needed for correct output of umlauts in pdf
\usepackage{amssymb,amsmath,amsfonts} % nice math rendering
\usepackage{braket} % needed for \Set
\usepackage{algorithm,algpseudocode}
\algnewcommand\True{\textbf{true}\space}
\algnewcommand\False{\textbf{false}\space}
\algnewcommand{\LineComment}[1]{\State \(\triangleright\) #1}
\begin{document}
\begin{preview}
\begin{algorithm}[H]
\begin{algorithmic}
\Require Klauselmenge $K$, Symbolmenge $S$, (partielles) Modell $M$
\Procedure{DPLL}{$K$, $S$, $M$}
\If{Alle Klauseln sind wahr in $M$}
\State \Return \texttt{true}
\EndIf
\If{Eine Klausel ist falsch in $M$}
\State \Return \texttt{false}
\EndIf
\\
\State $P, Wert \gets \Call{FindeEinheitsklausel}{K, S, M}$
\If{$P$ existiert}
\State $M \gets \Call{SetzePInModell}{P, Wert, M}$
\State \Return $\Call{DPLL}{k, S \setminus \Set{P}, M}$
\EndIf
\\
\LineComment{Ein reines Literal ist eines, das in jeder Klausel}
\LineComment{immer wahr bzw. immer falsch ist}
\State $P, Wert \gets \Call{FindeReinesLiteral}{K, M}$
\If{$P$ existiert}
\State $m \gets \Call{SetzePInModell}{P, Wert, M}$
\State \Return $\Call{DPLL}{K, S \setminus \Set{P}, M}$
\EndIf
\\
\State $P \gets S.pop()$ \Comment{Symbolmenge schrumpft}
\State $M_1 \gets \Call{SetzePInModell}{P, \texttt{true}, M}$
\State $M_2 \gets \Call{SetzePInModell}{P, \texttt{false}, M}$
\State \Return $\Call{DPLL}{K, S, M_1} \lor \Call{DPLL}{K, S, M_2}$
\EndProcedure
\end{algorithmic}
\caption{DPLL-Verfahren}
\label{alg:dpll}
\end{algorithm}
\end{preview}
\end{document}

View file

@ -0,0 +1,36 @@
SOURCE = DPLL
DELAY = 80
DENSITY = 300
WIDTH = 500
make:
pdflatex $(SOURCE).tex -output-format=pdf
pdflatex $(SOURCE).tex -output-format=pdf
make clean
clean:
rm -rf $(TARGET) *.class *.html *.log *.aux *.data *.gnuplot
gif:
pdfcrop $(SOURCE).pdf
convert -verbose -delay $(DELAY) -loop 0 -density $(DENSITY) $(SOURCE)-crop.pdf $(SOURCE).gif
make clean
png:
make
make svg
inkscape $(SOURCE).svg -w $(WIDTH) --export-png=$(SOURCE).png
transparentGif:
convert $(SOURCE).pdf -transparent white result.gif
make clean
svg:
make
#inkscape $(SOURCE).pdf --export-plain-svg=$(SOURCE).svg
pdf2svg $(SOURCE).pdf $(SOURCE).svg
# Necessary, as pdf2svg does not always create valid svgs:
inkscape $(SOURCE).svg --export-plain-svg=$(SOURCE).svg
rsvg-convert -a -w $(WIDTH) -f svg $(SOURCE).svg -o $(SOURCE)2.svg
inkscape $(SOURCE)2.svg --export-plain-svg=$(SOURCE).svg
rm $(SOURCE)2.svg

View file

@ -0,0 +1,3 @@
Compiled example
----------------
![Example](DPLL.png)