2020-10-25 14:12:00 +00:00
% Please note that a large LaTeX memory limit is needed to compile this file.
% Edit /usr/local/texlive/<year-version>/texmf.cnf and add/edit the following lines:
%
% main_memory = 12000000
% extra_mem_bot = 30000000
% extra_mem_top = 2000000000
2020-10-21 13:21:51 +00:00
\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}
2020-10-23 07:20:58 +00:00
\usepgfplotslibrary { external}
\tikzexternalize
2020-10-21 13:21:51 +00:00
\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
2020-10-25 14:05:25 +00:00
Please note all scripts used can be found under the folder \texttt { Project\_ 3\_ Maggioni\_ Claudio/src} .
2020-11-02 16:43:56 +00:00
\section * { Note on collaboration}
Please note that in the spirit of collaboration I shared with some of my classmates the helper
function \texttt { drawgraph(...)} used in exercise 3 and included in the file \texttt { bisection\_ spectral.m} , and the functions \texttt { runtest(...)} and \texttt { recurse(...)} in file \texttt { bench\_ rec\_ bisection.m} for exercise 4. I am therefore claiming here I am the sole author of these functions.
Please also note this sharing was done with Edoardo Vecchi's supervision.
2020-10-21 13:21:51 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\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} }
2020-10-25 14:05:25 +00:00
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 $ .
2020-10-21 13:21:51 +00:00
2020-11-03 13:40:49 +00:00
\begin { figure}
2020-10-21 13:21:51 +00:00
\begin { subfigure} { 0.5\textwidth }
\centering
2020-10-25 14:05:25 +00:00
% \input{ex3_grid9}
2020-10-21 13:21:51 +00:00
\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
2020-10-25 14:05:25 +00:00
% \input{ex3_small}
2020-10-21 13:21:51 +00:00
\includegraphics [trim=50 200 50 200,clip,width=\textwidth] { ex3_ small.pdf}
\caption { Plot for \textit { Small} }
\end { subfigure}
\begin { subfigure} { 0.5\textwidth }
2020-10-25 14:05:25 +00:00
% \input{ex3_eppstein)
2020-10-21 13:21:51 +00:00
\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} }
2020-10-25 14:05:25 +00:00
I summarize my results in table \ref { table:Rec_ bisection} . Additionally, the graph plots
2020-11-03 13:40:49 +00:00
for a recursive partition in 8 and 16 parts of \textit { Crack} are avaliable in figure \ref { fig:bicrack} .
2020-10-23 07:20:58 +00:00
2020-11-02 16:43:56 +00:00
The figure shows the partitions and edge cuts with colors randomly assigned by MATLAB.
2020-10-25 14:05:25 +00:00
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.
2020-11-02 16:43:56 +00:00
Please note that while computing spectral partitioning for \textit { barth4} MATLAB emits a warning
in the computation of the adjacency matrix eigenvalues stating that the matrix is ill conditioned.
This warning was suppressed so as not to interfere with the table printout.
2020-11-03 13:40:49 +00:00
\begin { figure}
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ Spectral_ 8} }
\caption { Spectral bisection for $ n = 8 $ }
\end { subfigure}
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ Coordinate_ 8} }
\caption { Coordinate bisection for $ n = 8 $ }
\end { subfigure}
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ METIS_ 8} }
\caption { METIS bisection for $ n = 8 $ }
\end { subfigure}
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ Inertial_ 8} }
\caption { Inertial bisection for $ n = 8 $ }
\end { subfigure}
2020-10-23 07:20:58 +00:00
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ Spectral} }
2020-11-03 13:40:49 +00:00
\caption { Spectral bisection for $ n = 16 $ }
2020-10-23 07:20:58 +00:00
\end { subfigure}
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ Coordinate} }
2020-11-03 13:40:49 +00:00
\caption { Coordinate bisection for $ n = 16 $ }
2020-10-23 07:20:58 +00:00
\end { subfigure}
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ METIS} }
2020-11-03 13:40:49 +00:00
\caption { METIS bisection for $ n = 16 $ }
2020-10-23 07:20:58 +00:00
\end { subfigure}
\begin { subfigure} { 0.5\textwidth }
\centering
\resizebox { 0.8\linewidth } { !} {
\input { ex4_ Inertial} }
2020-11-03 13:40:49 +00:00
\caption { Inertial bisection for $ n = 16 $ }
2020-10-23 07:20:58 +00:00
\end { subfigure}
2020-11-03 13:40:49 +00:00
\caption { Graph outputs for \textit { Crack} graph with $ n = 8 $ and $ n = 16 $ }
2020-10-23 07:20:58 +00:00
\label { fig:bicrack}
\end { figure}
2020-10-25 14:05:25 +00:00
\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} .
2020-11-02 16:43:56 +00:00
The figure shows the resulting partitions with colors randomly assigned by MATLAB. All edge cuts are colored in black.
2020-10-25 14:05:25 +00:00
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.
2020-11-03 13:40:49 +00:00
\begin { figure}
2020-10-25 14:05:25 +00:00
\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}
2020-10-23 07:20:58 +00:00
2020-10-21 13:21:51 +00:00
2020-11-03 13:40:49 +00:00
\begin { table}
2020-10-21 13:21:51 +00:00
\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 \\
2020-11-02 16:43:56 +00:00
grid9(30) & 88 & 92 & 102 & 88 \\
2020-10-21 13:21:51 +00:00
Smallmesh & 25 & 13 & 12 & 30 \\
Tapir & 55 & 34 & 18 & 49 \\
2020-11-02 16:43:56 +00:00
Eppstein & 42 & 48 & 42 & 45 \\ \hline \hline
2020-10-21 13:21:51 +00:00
\end { tabular}
\label { table:bisection}
\end { table}
2020-11-03 13:40:49 +00:00
\begin { table}
\caption { Edge-cut results for recursive bi-partitioning (data for $ n = 8 $ on the top and $ n = 16 $ on the bottom).}
2020-10-21 13:21:51 +00:00
\centering
2020-10-23 07:20:58 +00:00
\begin { tabular} { |l|r|r|r|r|p{ 4cm} |} \hline \hline
2020-11-03 13:40:49 +00:00
Case $ n = 8 $ & Spectral & Metis 5.0.2 & Coordinate & Inertial \\ \hline
airfoil1 & 327 & 320 & 516 & 578 \\
3elt & 372 & 395 & 733 & 880 \\
barth4 & 505 & 405 & 875 & 888 \\
mesh3e1 & 75 & 75 & 75 & 76 \\
crack & 804 & 784 & 1343 & 1061 \\ \hline \hline
\end { tabular} \\
\vspace { 10pt}
\begin { tabular} { |l|r|r|r|r|p{ 4cm} |} \hline \hline
Case $ n = 16 $ & Spectral & Metis 5.0.2 & Coordinate & Inertial \\ \hline
airfoil1 & 578 & 563 & 819 & 903\\
3elt & 671 & 651 & 1168 & 1342\\
barth4 & 758 & 689 & 1306 & 1348\\
mesh3e1 & 124 & 117 & 122 & 116\\
crack & 1303 & 1290 & 1860 & 1618\\ \hline \hline
2020-10-21 13:21:51 +00:00
\end { tabular}
\label { table:Rec_ bisection}
\end { table}
2020-11-03 13:40:49 +00:00
\begin { table}
\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 top, k-way on the bottom table.}
2020-10-21 13:21:51 +00:00
\centering
\begin { tabular} { |l|r|r|r|r|} \hline \hline
2020-11-03 13:40:49 +00:00
Recursive part. & crack & airfoil1 \\ \hline
16 & 10055 & 580 \\
32 & 10824 & 967 \\ \hline \hline
\end { tabular} \\
\vspace { 10pt}
\begin { tabular} { |l|r|r|r|r|} \hline \hline
K-way part. & crack & airfoil1 \\ \hline
16 & 10077 & 564 \\
32 & 10943 & 947 \\ \hline \hline
2020-10-21 13:21:51 +00:00
\end { tabular}
\label { table:Compare_ Metis}
\end { table}
\end { document}