This repository has been archived on 2021-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
NC/mp3/project_3_Maggioni_Claudio.tex

189 lines
7.3 KiB
TeX

\documentclass[unicode,11pt,a4paper,oneside,numbers=endperiod,openany]{scrartcl}
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{amsmath}
\input{assignment.sty}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{plotmarks}
\usetikzlibrary{arrows.meta}
\usepgfplotslibrary{patchplots}
\usepackage{grffile}
\usepackage{amsmath}
\usepackage{subcaption}
\usepgfplotslibrary{external}
\tikzexternalize
\hyphenation{PageRank}
\hyphenation{PageRanks}
\begin{document}
\setassignment
\setduedate{Wednesday, 4 November 2020, 11:55 PM}
\serieheader{Numerical Computing}{2020}{Student: Claudio Maggioni}{Discussed with: --}{Solution for Project 3}{}
\newline
\assignmentpolicy
Please note all scripts used can be found under the folder \texttt{Project\_3\_Maggioni\_Claudio/src}.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Install METIS 5.0.2, and the corresponding Matlab mex interface}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Implement various graph partitioning algorithms \punkte{60}}
I summarize the various benchmark results in table \ref{table:bisection}. Please note that this table
can be generated at will with the script \texttt{ex2\_bisection\_table.m}.
\section{Visualize the Fiedler eigenvector\punkte{10}}
In figure \ref{fig:run1} there are graph outputs respectively from \textit{Grid9}, \textit{Small}, and \textit{Eppstein}. Please note that these results can be reproduced using script \texttt{ex3\_plots.m}.
Colors to represent the partitions and the eigenvector components are the same as the ones used in the the assignment's Figure 3. It is quite easy to evince from these plots that spectral partitioning indeed partitions the graph verticies based on the sign of their respective Fiedler eigenvector component: the only intersection between the Graph plane and the surface the eigenvector entries lay corresponds to the edgecut produced by spectral partitioning. This is due to the fact that in the figure the graph is positioned at $z = 0$.
\begin{figure}[h]
\begin{subfigure}{0.5\textwidth}
\centering
% \input{ex3_grid9}
\includegraphics[trim=50 200 50 200,clip,width=\textwidth]{ex3_grid9.pdf}
\caption{Plot for \textit{Grid9}}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
% \input{ex3_small}
\includegraphics[trim=50 200 50 200,clip,width=\textwidth]{ex3_small.pdf}
\caption{Plot for \textit{Small}}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
% \input{ex3_eppstein)
\includegraphics[trim=50 200 50 200,clip,width=\textwidth]{ex3_eppstein.pdf}
\caption{Plot for \textit{Eppstein}}
\end{subfigure}
\caption{Graph outputs for the 3 adjacency matrices.}
\label{fig:run1}
\end{figure}
\section{Recursively bisecting meshes \punkte{20}}
I summarize my results in table \ref{table:Rec_bisection}. Additionally, the graph plots
for a recursive partition in 16 parts of \textit{Crack} are avaliable in figure \ref{fig:bicrack}.
Again the data shown here can reproduced using a MATLAB script (\texttt{Bench\_rec\_bisection.m}). Please note that the given recursion helper function \texttt{rec\_bisection} was not used. Instead, the function \texttt{runtest} was implemented to allow for partitioning graphs to be generated at will.
\begin{figure}[h]
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex4_Spectral}}
\caption{Spectral bisection}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex4_Coordinate}}
\caption{Coordinate bisection}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex4_METIS}}
\caption{METIS bisection}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex4_Inertial}}
\caption{Inertial bisection}
\end{subfigure}
\caption{Graph outputs for \textit{Crack} graph with $n=16$}
\label{fig:bicrack}
\end{figure}
\section{Compare recursive bisection to direct $k$-way partitioning\punkte{10}}
I summarize my results in table \ref{table:Compare_Metis}. Additionally, plots for the $n = 32$ cases can be found in figure \ref{fig:bikmetis}. Please note that both the table and the plots can be reproduced using script \texttt{Bench\_metis.m}.
I had the suspicion that k-way partitioning would perform better in all cases, since in this the partitioning algorithm has a chance to see the entire problem and to perform decision that could affect all partitions. Instead, for the \texttt{Crack} mesh, recursive partitioning surprisedly performed better than k-way for both $n = 16$ and $n = 32$, producing slighly smaller edge cuts.
\begin{figure}[h]
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex5_air_n}}
\caption{\textit{Airfoil} with recursive partitioning}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex5_air_k}}
\caption{\textit{Airfoil} with k-way partitioning}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex5_crack_n}}
\caption{\textit{Crack} with recursive partitioning}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\centering
\resizebox{0.8\linewidth}{!}{
\input{ex5_crack_k}}
\caption{\textit{Crack} with k-way partitioning}
\end{subfigure}
\caption{Graph outputs for \textit{METIS} recursive and k-way partitioning with $n=32$. Edge cuts are displayed in black}
\label{fig:bikmetis}
\end{figure}
\begin{table}[h]
\caption{Bisection results}
\centering
\begin{tabular}{|l|r|r|r|r|} \hline\hline
Mesh & Coordinate & Metis 5.0.2 & Spectral & Inertial \\ \hline
grid5rect(10,100)& 10 & 10 & 10 & 10 \\
grid5rect(100,10)& 10 & 10 & 10 & 10 \\
grid5recRotate(100,10,-45)& 18 & 10 & 10 & 10 \\
gridt(40) & 58 & 58 & 58 & 58 \\
grid9(30) & 88 & 92 & 104 & 88 \\
Smallmesh & 25 & 13 & 12 & 30 \\
Tapir & 55 & 34 & 18 & 49 \\
Eppstein & 42 & 48 & 45 & 45 \\ \hline \hline
\end{tabular}
\label{table:bisection}
\end{table}
\begin{table}[h]
\caption{Edge-cut results for recursive bi-partitioning (data for $n=8$ on the left and $n=16$ on the right).}
\centering
\begin{tabular}{|l|r|r|r|r|p{4cm}|} \hline\hline
Case & Spectral & Metis 5.0.2 & Coordinate & Inertial \\ \hline
airfoil1 & 327\hfill578 & 320\hfill563 & 516\hfill819 & 577\hfill897\\
3elt & 372\hfill671 & 395\hfill651 & 733\hfill1168 & 880\hfill1342\\
barth4 & 505\hfill758 & 405\hfill689 & 875\hfill1306 & 891\hfill1350\\
mesh3e1 & 72\hfill111 & 75\hfill117 & 75\hfill122 & 67\hfill102\\
crack & 804 \hfill 1303 & 784\hfill1290 & 1343\hfill1860 & 1061 \hfill 1618\\\hline\hline
\end{tabular}
\label{table:Rec_bisection}
\end{table}
\begin{table}[h]
\caption{Comparing the number of cut edges for recursive bisection and direct multiway partitioning in Metis 5.0.2. Results for recursive partitioning shown on the left, k-way on the right.}
\centering
\begin{tabular}{|l|r|r|r|r|} \hline\hline
Partitions & crack & airfoil1 \\ \hline
16 & 10055 \hfill 10077 & 580 \hfill 564 \\
32 & 10824 \hfill 10943 & 967 \hfill 947 \\ \hline \hline
\end{tabular}
\label{table:Compare_Metis}
\end{table}
\end{document}