Compare commits
4 commits
df98bff285
...
06b9500efc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06b9500efc | ||
|
|
bfbad23aed | ||
|
|
ac6c443beb | ||
|
|
064eeabad5 |
1 changed files with 42 additions and 3 deletions
|
|
@ -114,7 +114,42 @@ we store each item in the next bin if it fits, otherwise we open a new bin.
|
|||
will be of random sizes between $ 0 $ and $ 1 $. We will run X simulations % TODO
|
||||
with 10 packets.
|
||||
|
||||
\subsubsection{Variables used in models}
|
||||
\subsection{Variables used in models}
|
||||
|
||||
We use the following variables in our algorithms and models :
|
||||
|
||||
\begin{itemize}
|
||||
|
||||
\item $ U_n $ : the size of the $ n $-th item. $ (U_n)_{n \in \mathbb{N}} $
|
||||
denotes the mathematical sequence of random variables of uniform
|
||||
distribution on $ [0, 1] $ representing the items' sizes.
|
||||
|
||||
\item $ T_i $ : the number of items in the $ i $-th bin.
|
||||
|
||||
\item $ V_i $ : the size of the first item in the $ i $-th bin.
|
||||
|
||||
\item $ H_n $ : the number of bins required to store $ n $ items.
|
||||
|
||||
\end{itemize}
|
||||
|
||||
Mathematically, the NFBP algorithm imposes the following constraint on the first box :
|
||||
|
||||
\begin{align*}
|
||||
T_1 = k \iff & U_1 + U_2 + \ldots + U_{k-1} < 1 \\
|
||||
\text{ and } & U_1 + U_2 + \ldots + U_{k} \geq 1 \qquad \text{ with } k \geq 2
|
||||
\end{align*}
|
||||
|
||||
|
||||
\subsection{Implementation and results}
|
||||
|
||||
We implemented the NFBP algorithm in Python \footnotemark, for its ease of use
|
||||
and broad recommendation. We used the \texttt{random} library to generate
|
||||
random numbers between $ 0 $ and $ 1 $ and \texttt{matplotlib} to plot the
|
||||
results.
|
||||
|
||||
\footnotetext{The code is available in Annex \ref{annex:probabilistic}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -123,6 +158,8 @@ with 10 packets.
|
|||
|
||||
\section{Next Fit Dual Bin Packing algorithm}
|
||||
|
||||
The variables used are the same as for NFBP.
|
||||
|
||||
\subsection{La giga demo}
|
||||
|
||||
Let $ k \in \mathbb{N} $. Let $ (U_n)_{n \in \mathbb{N}} $ be a sequence of
|
||||
|
|
@ -225,8 +262,10 @@ $ f_{U_{k-1}}(y) = 1 $.
|
|||
|
||||
\section{Complexity and implementation optimization}
|
||||
|
||||
The NFBP algorithm has a linear complexity $ O(n) $, as we only need to iterate
|
||||
over the items once.
|
||||
Both the NFBP and NFDBP algorithms have a linear complexity $ O(n) $, as we
|
||||
only need to iterate over the items once. While the algorithms themselves are
|
||||
linear, calculating the statistics may not not be. In this section, we will
|
||||
discuss how to optimize the implementation of the statistical analysis.
|
||||
|
||||
\subsection{Performance optimization}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue