mp3: other corrections
This commit is contained in:
parent
7690f4b23d
commit
09a568eaa5
5 changed files with 36 additions and 19 deletions
|
@ -106,19 +106,19 @@ for c = 1:nc
|
|||
% 3. Calculate number of cut edges
|
||||
% 4. Visualize the partitioning result
|
||||
|
||||
fprintf('%6d %6d %10d %6d %10d %6d %10d %6d %d\n',sp8,sp16,...
|
||||
m8,m16,c8,c16,i8,i16, nnz(diag(A)));
|
||||
fprintf('%6d %6d %10d %6d %10d %6d %10d %6d\n',sp8,sp16,...
|
||||
m8,m16,c8,c16,i8,i16);
|
||||
|
||||
end
|
||||
|
||||
% Bisection Spectral Metis 5.0.2 Coordinate Inertial
|
||||
% Partitions 8 16 8 16 8 16 8 16
|
||||
% -----------------------------------------------------------------------------------
|
||||
% airfoil1.mat ... 327 578 320 563 516 819 577 897
|
||||
% 3elt.mat ....... 372 671 395 651 733 1168 880 1342
|
||||
% barth4.mat ..... 505 758 405 689 875 1306 891 1350
|
||||
% mesh3e1.mat .... 72 111 75 117 75 122 67 102
|
||||
% crack.mat ...... 804 1303 784 1290 1343 1860 1061 1618
|
||||
%Bisection Spectral Metis 5.0.2 Coordinate Inertial
|
||||
%Partitions 8 16 8 16 8 16 8 16
|
||||
%------------------------------------------------------------------------------------
|
||||
%airfoil1.mat ... 327 578 320 563 516 819 577 897
|
||||
%3elt.mat ....... 372 671 395 651 733 1168 880 1342
|
||||
%barth4.mat ..... 505 758 405 689 875 1306 891 1350
|
||||
%mesh3e1.mat .... 75 124 75 117 75 122 67 102
|
||||
%crack.mat ...... 804 1303 784 1290 1343 1860 1061 1618
|
||||
|
||||
function n = runtest(A, xy, algorithm, depth, t, show_graphs)
|
||||
g = 0;
|
||||
|
@ -136,7 +136,9 @@ function n = runtest(A, xy, algorithm, depth, t, show_graphs)
|
|||
end
|
||||
|
||||
function n = recurse(A, xy, algorithm, color, depth, show_graphs)
|
||||
warning('off','MATLAB:eigs:IllConditionedA')
|
||||
[partA, partB] = algorithm(A, xy);
|
||||
warning('on', 'MATLAB:eigs:IllConditionedA')
|
||||
[n, ~] = cutsize(A, partA);
|
||||
A1 = A(partA, partA);
|
||||
xy1 = xy(partA, :);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
load Toy_meshes;
|
||||
addpaths_GP;
|
||||
load Toy_meshes;
|
||||
|
||||
[W1,c1] = grid5rec(10,100);
|
||||
[W2,c2] = grid5rec(100,10);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
load Toy_meshes;
|
||||
addpaths_GP;
|
||||
load Toy_meshes;
|
||||
|
||||
[A, xy] = grid9(50);
|
||||
bisection_spectral(A, xy, 2);
|
||||
|
|
Binary file not shown.
|
@ -37,6 +37,13 @@
|
|||
|
||||
Please note all scripts used can be found under the folder \texttt{Project\_3\_Maggioni\_Claudio/src}.
|
||||
|
||||
\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.
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
\section{Install METIS 5.0.2, and the corresponding Matlab mex interface}
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
@ -78,8 +85,14 @@ Colors to represent the partitions and the eigenvector components are the same a
|
|||
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}.
|
||||
|
||||
The figure shows the partitions and edge cuts with colors randomly assigned by MATLAB.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
\begin{figure}[h]
|
||||
\begin{subfigure}{0.5\textwidth}
|
||||
\centering
|
||||
|
@ -113,6 +126,8 @@ Again the data shown here can reproduced using a MATLAB script (\texttt{Bench\_r
|
|||
|
||||
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}.
|
||||
|
||||
The figure shows the resulting partitions with colors randomly assigned by MATLAB. All edge cuts are colored in black.
|
||||
|
||||
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]
|
||||
|
@ -156,10 +171,10 @@ I had the suspicion that k-way partitioning would perform better in all cases, s
|
|||
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 \\
|
||||
grid9(30) & 88 & 92 & 102 & 88 \\
|
||||
Smallmesh & 25 & 13 & 12 & 30 \\
|
||||
Tapir & 55 & 34 & 18 & 49 \\
|
||||
Eppstein & 42 & 48 & 45 & 45 \\ \hline \hline
|
||||
Eppstein & 42 & 48 & 42 & 45 \\ \hline \hline
|
||||
\end{tabular}
|
||||
\label{table:bisection}
|
||||
\end{table}
|
||||
|
@ -170,11 +185,11 @@ I had the suspicion that k-way partitioning would perform better in all cases, s
|
|||
\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
|
||||
airfoil1 & 327 \hfill 578 & 320 \hfill 563 & 516 \hfill 819 & 577 \hfill 897\\
|
||||
3elt & 372 \hfill 671 & 395 \hfill 651 & 733 \hfill 1168 & 880 \hfill 1342\\
|
||||
barth4 & 505 \hfill 758 & 405 \hfill 689 & 875 \hfill 1306 & 891 \hfill 1350\\
|
||||
mesh3e1 & 75 \hfill 124 & 75 \hfill 117 & 75 \hfill 122 & 67 \hfill 102\\
|
||||
crack & 804 \hfill 1303 & 784 \hfill 1290 & 1343 \hfill 1860 & 1061 \hfill 1618\\\hline\hline
|
||||
\end{tabular}
|
||||
\label{table:Rec_bisection}
|
||||
\end{table}
|
||||
|
|
Reference in a new issue