32f6adff530f86921776b6bc7f9d727f7bcfc6ec
[ker1415-1.git] / report / ass2.tex
1 \subsection{Implementation of the hitting-set algorithm}
2 \subsubsection{Task 12: Generate conflict}
3 \begin{listing}[H]
4 \caption{Generating conflict sets}
5 \prologcode{./src/task12.pl}
6 \end{listing}
7
8
9 \subsubsection{Task 13: Define your data structure}
10 \begin{listing}[H]
11 \caption{Hitting set datastructure}
12 \prologcode{./src/hs.pl}
13 \end{listing}
14 Our datastructure uses the predicate node to signify nodes and leaf for leaves. A node contains a list of edge labels and another list (with the same length as the amound of edge labels) that contains nodes or leaves. The edge label corresponds with its order in the list it is in.
15 Examples:
16 node([a,b],[leaf,leaf])
17 node([a,b], [node([c,d], [leaf,leaf]), node([e,f], [leaf,leaf])])
18 node([a,b], [node([c,d], [node([g,h,i], [leaf,leaf,leaf]),leaf]), node([a,f], [leaf,leaf])])
19 %insert hittingsettrees.png
20 \subsubsection{Task 14: Implementation}
21 \begin{listing}[H]
22 \caption{Code for generating a hitting set tree}
23 \prologcode{./src/task14.pl}
24 \end{listing}