164 lines
7.1 KiB
TeX
164 lines
7.1 KiB
TeX
\twocolumn[
|
|
\title{\bf \acronym (High end, Advanced, Data driven, Enterprise grade Sock sorting algorithm) - An algorithm for faster sock sorting}
|
|
\author{
|
|
CelloClemens$^{1,2}$,
|
|
Henri\emoji{duck}$^{1}$,
|
|
}
|
|
\date{\today}
|
|
% List of institutions
|
|
\maketitle
|
|
$^{1}$Department for theoretical laundry science, Karlsruhe institute of suffering and sorrow (KISS), Karlsruhe, Germany \\
|
|
$^{2}$Institute of laundry sorting, Department for socks, Karlsruhe institute of suffering and sorrow (KISS), Karlsruhe, Germany
|
|
\begin{psummary}
|
|
Sorting socks can often be a time consuming task. This paper introduces the fastest method known in the scientific community to tackle
|
|
this challanging task. To be able to implement this new algorithm
|
|
a new datastructure will be introduced and discussed. Abundant application of this novel algorithm may be able to
|
|
reduce the time required for sorting socks considerably.
|
|
\end{psummary}
|
|
\vspace{2mm}
|
|
]
|
|
\fancypagestyle{firstpage}{%
|
|
\lhead{Please help I am stuck in the basement sorting socks}
|
|
\rhead{Journal of Immaterial Science}
|
|
}
|
|
\thispagestyle{firstpage}
|
|
|
|
% The introduction
|
|
\section{Introduction}
|
|
While sorting algorithms are one of the most discussed algorithms in the
|
|
computer science community, application of this field to laundry is still quite new.
|
|
In fact no research is known to the authors connecting the fields of computer science
|
|
and laundry sorting. A few definitions are required in order to establish a baseline
|
|
for the algorithm discussed in the following paper.
|
|
|
|
\subsection{Definitions}
|
|
In this section a few definitions, common in the field of theoretical laundry science shall be
|
|
introduced. These are required to understand the algorithm and its advantages.
|
|
|
|
\subsubsection{Sock}
|
|
Let $\Lambda_a$ be the Set of laundry. The set of socks, $\Sigma\subset\Lambda_a$
|
|
is defined as $\Sigma:=\{s\in\Lambda_a|\chi(s)=1\}$\footnote{Yes, some socks have holes. So what?!}, where $\chi(s)$ is the Euler
|
|
characteristic of $s$. For every sock $s$ there is an equal counterpart $s^{-1}$ giving rise
|
|
to the identity $s\cong s^{-1}$. The task commonly known as "sock sorting" is in fact the
|
|
search for this isomorphism $\eta$ and matching every sock $s$ to its inverse
|
|
$s^{-1}$.
|
|
\begin{figure}[h]
|
|
\centering
|
|
\includegraphics[width=\columnwidth]{\projectpath figs/Sock.jpeg}
|
|
\vspace{0.1in}
|
|
\caption{A pair of blue socks and a single orange sock.}
|
|
\label{fig:Sock}
|
|
\vspace{0.1in}
|
|
\end{figure}
|
|
\subsubsection{Laundry basket}
|
|
Let $\Lambda\subseteq\Lambda_a$ be a set of laundry items. Then a laundry basket is a
|
|
triplet $(\Lambda, +, -)$ representing a datastructure that implements
|
|
the following functions:
|
|
\begin{itemize}
|
|
\item \texttt{get: }$\mathscr{L}\in\Lambda_a$, returns a uniformly random
|
|
laundry item from the basket or $\mathscr{L}_0$, the Zero element of laundry, iff
|
|
There are no items left.
|
|
\item \texttt{put($\mathscr{L}\in\Lambda_a$)}, deposits the given laundry item
|
|
into the basket.
|
|
\end{itemize}
|
|
Note that both operations run in $\mathcal{O}(1)$. Because of the nature of
|
|
a laundry basket finding a unique item requires transferring the content of
|
|
the whole basket to a new basket thus requiring $\mathcal{O}(n)$ operations,
|
|
$n$ being the number of items currently inside the basket.
|
|
\subsection{Ongoing and latest research}
|
|
To fully appreciate the gravity of \acronym it has to first be discussed
|
|
how most resent research tackles the problem of sock sorting.
|
|
The following code describes the most recently developed sock sorting
|
|
algorithm from the paper by \citeauthor{My colleague et al.} Which is the current
|
|
industry standard. Notice the code has a runtime complexity of $\mathcal{O}(n^2)$.
|
|
|
|
\begin{algorithm}
|
|
\caption{Conventional sock sorting}
|
|
\begin{algorithmic}[1]
|
|
\State\Comment initialize a new laundry basket with a given set of laundry
|
|
\State $A\gets\Lambda$\Comment WLOG assume $\forall\mathscr{L}\in\Lambda|\mathscr{L}$ is a sock
|
|
\State $\text{matches}\gets []$
|
|
\Repeat
|
|
\State $\mathscr{L}\gets$ A.get
|
|
|
|
\Repeat\Comment find the inverse Sock by checking all other socks
|
|
\State $\mathscr{L}^\prime\gets$ A.get
|
|
\Until{$\mathscr{L}^\prime =\mathscr{L}^{-1}$}
|
|
\State matches.append(($\mathscr{L}, \mathscr{L}^\prime$))
|
|
\Until{$\mathscr{L}\ne\mathscr{L}_0$}
|
|
\end{algorithmic}
|
|
\end{algorithm}
|
|
|
|
\section{Concepts}
|
|
The basis for every fast algorithm are simple yet equally fast
|
|
datastructures. To enable the low runtime achieved by \acronym,
|
|
the introduction of a new datastructure, the "laundry rack" is integral.
|
|
|
|
\subsection{Laundry rack}
|
|
Let $\Lambda\subseteq\Lambda_a$ be a set of laundry. A laundry rack (See figure \ref{fig:Rack}) is a
|
|
triplet $(\Lambda, +, -)$ representing a datastructure that implements the
|
|
following methods:
|
|
\begin{itemize}
|
|
\item \texttt{get($\mathscr{L}\in\Lambda$)}: $\mathscr{L}\in\Lambda$, gets
|
|
a specific laundry item from the laundry rack.
|
|
\item \texttt{put($\mathscr{L}\in\Lambda$)}, deposits a laundry item onto
|
|
the laundry rack.
|
|
\item \texttt{match($\mathscr{L}\in\Lambda$)}: $(\mathscr{P}\in\Lambda\times\Lambda)|\mathscr{L}_0$,
|
|
returns a tuple $(\mathscr{L}, \mathscr{L}^{-1})$ representing
|
|
a pair of socks iff $\mathscr{L}^{-1}$ is already on the laundry rack,
|
|
$\mathscr{L}_0$ otherwise.
|
|
\end{itemize}
|
|
All these operations (especially \texttt{match}) run in $\mathcal{O}(1)$,
|
|
making iteration over all $n$ laundry items to find a pair $(\mathscr{L}, \mathscr{L}^{-1})$
|
|
obsolete.
|
|
\begin{figure}[h]
|
|
\centering
|
|
\includegraphics[width=\columnwidth]{\projectpath figs/rack.jpeg}
|
|
\vspace{0.1in}
|
|
\caption{A blue drying rack, found in many housholds.}
|
|
\label{fig:Rack}
|
|
\vspace{0.1in}
|
|
\end{figure}
|
|
|
|
\section{Algorithm}
|
|
Making use of the novel advanced features of a "drying rack" we are able to
|
|
implement the following algorithm in $\mathscr{O}(n)$:\\
|
|
\begin{algorithm}
|
|
\caption{\acronym}
|
|
\begin{algorithmic}[1]
|
|
\State\Comment initialize a new laundry basket with a given set of laundry
|
|
\State $A\gets\Lambda$\Comment WLOG assume $\forall\mathscr{L}\in\Lambda|\mathscr{L}$ is a sock
|
|
\State $\text{matches}\gets []$
|
|
\State $\daleth\gets []$ \Comment{Create a new empty drying rack}
|
|
\Repeat
|
|
\State $\mathscr{L}\gets $ A.get
|
|
\State result $\gets$ $\daleth$.match($\mathscr{L}$)
|
|
\If{result $\ne\mathscr{L}_0$}
|
|
\State matches.append(result)
|
|
\Else
|
|
\State $\daleth$.put($\mathscr{L}$)
|
|
\EndIf
|
|
|
|
\Until{$\mathscr{L}\ne\mathscr{L}_0$}
|
|
\end{algorithmic}
|
|
\end{algorithm}
|
|
As evident from the algorithm above, only one loop performing
|
|
operations which are all in $\mathscr{O}(1)$ is required thus
|
|
putting the algorithm in a $\mathscr{O}(n)$ runtime complexity
|
|
class. Assuming that $\forall\mathscr{L}\in\Lambda\exists\mathscr{L}^{-1}|\mathscr{L}\cong\mathscr{L}^{-1}$
|
|
the algorithm always yields a correct solution for the problem
|
|
(proof is left as an exercise to the reader).
|
|
\section{Discussion and Results}
|
|
To evaluate the algorithms performance it has been executed
|
|
on different platforms consisting of diverse hardware:
|
|
|
|
|
|
\section{Conclusion}
|
|
|
|
\section{Acknowledgements}
|
|
|
|
\begingroup
|
|
\setlength\bibitemsep{0pt}
|
|
\setlength\bibnamesep{0pt}
|
|
\printbibliography[heading=subbibliography]
|
|
\endgroup
|