tex: final commit I suppose (I wish)
This commit is contained in:
parent
1f279bf2b9
commit
5246b1c56b
3 changed files with 64 additions and 7 deletions
|
@ -258,12 +258,10 @@ of $ T_i $. Our calculations have yielded that $ \overline{T_1} = 1.72 $ and $
|
||||||
{S_N}^2 = 0.88 $. Our Student coefficient is $ t_{0.95, 2} = 2 $.
|
{S_N}^2 = 0.88 $. Our Student coefficient is $ t_{0.95, 2} = 2 $.
|
||||||
|
|
||||||
We can now calculate the Confidence Interval for $ T_1 $ for $ R = 10^5 $ simulations :
|
We can now calculate the Confidence Interval for $ T_1 $ for $ R = 10^5 $ simulations :
|
||||||
|
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
IC_{95\%}(T_1) & = \left[ 1.72 \pm 1.96 \frac{\sqrt{0.88}}{\sqrt{10^5}} \cdot 2 \right] \\
|
IC_{95\%}(T_1) & = \left[ 1.72 \pm 1.96 \frac{\sqrt{0.88}}{\sqrt{10^5}} \cdot 2 \right] \\
|
||||||
& = \left[ 172 \pm 0.012 \right] \\
|
& = \left[ 172 \pm 0.012 \right] \\
|
||||||
\end{align*}
|
\end{align*}
|
||||||
|
|
||||||
We can see that the Confidence Interval is very small, thanks to the large number of iterations.
|
We can see that the Confidence Interval is very small, thanks to the large number of iterations.
|
||||||
This results in a steady curve in figure \ref{fig:graphic-NFBP-Ti-105-sim}.
|
This results in a steady curve in figure \ref{fig:graphic-NFBP-Ti-105-sim}.
|
||||||
|
|
||||||
|
@ -274,12 +272,24 @@ This results in a steady curve in figure \ref{fig:graphic-NFBP-Ti-105-sim}.
|
||||||
\label{fig:graphic-NFBP-Vi-105-sim}
|
\label{fig:graphic-NFBP-Vi-105-sim}
|
||||||
\end{figure}
|
\end{figure}
|
||||||
|
|
||||||
|
\begin{figure}[h]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=0.8\textwidth]{graphics/graphic-NFBP-Hn-105-sim}
|
||||||
|
\caption{Histogram of $ H_n $ for $ R = 10^5 $ simulations and $ N = 50 $ items (number of bins required to store $n$ items)}
|
||||||
|
\label{fig:graphic-NFBP-Hn-105-sim}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
\paragraph{Asymptotic behavior of $ H_n $} Finally, we analyzed how many bins
|
\paragraph{Asymptotic behavior of $ H_n $} Finally, we analyzed how many bins
|
||||||
were needed to store $ n $ items. We used the numbers from the $ R = 10^5 $ simulations.
|
were needed to store $ n $ items. We used the numbers from the $ R = 10^5 $ simulations.
|
||||||
|
|
||||||
|
|
||||||
|
We can see in figure \ref{fig:graphic-NFBP-Hn-105-sim} that $ H_n $ is
|
||||||
|
asymptotically linear. The expected value and the variance are also displayed.
|
||||||
|
The variance also increases linearly.
|
||||||
|
|
||||||
|
|
||||||
|
\paragraph{} The Next Fit Bin Packing algorithm is a very simple algorithm
|
||||||
|
with predictable results. It is very fast, but it is not optimal.
|
||||||
|
|
||||||
|
|
||||||
\section{Next Fit Dual Bin Packing algorithm (NFDBP)}
|
\section{Next Fit Dual Bin Packing algorithm (NFDBP)}
|
||||||
|
@ -328,7 +338,10 @@ new constraints on the first bin can be expressed as follows :
|
||||||
\text{ and } & U_1 + U_2 + \ldots + U_{k} \geq 1 \qquad \text{ with } k \geq 2 \\
|
\text{ and } & U_1 + U_2 + \ldots + U_{k} \geq 1 \qquad \text{ with } k \geq 2 \\
|
||||||
\end{align*}
|
\end{align*}
|
||||||
|
|
||||||
\subsection{La giga demo}
|
|
||||||
|
\subsection{Building a mathematical model}
|
||||||
|
|
||||||
|
In this section we will try to determine the probabilistic law followed by $ T_i $.
|
||||||
|
|
||||||
Let $ k \geq 2 $. Let $ (U_n)_{n \in \mathbb{N}^*} $ be a sequence of
|
Let $ k \geq 2 $. Let $ (U_n)_{n \in \mathbb{N}^*} $ be a sequence of
|
||||||
independent random variables with uniform distribution on $ [0, 1] $, representing
|
independent random variables with uniform distribution on $ [0, 1] $, representing
|
||||||
|
@ -343,12 +356,12 @@ bin. We have that
|
||||||
|
|
||||||
Let $ A_k = \{ U_1 + U_2 + \ldots + U_{k} < 1 \}$. Hence,
|
Let $ A_k = \{ U_1 + U_2 + \ldots + U_{k} < 1 \}$. Hence,
|
||||||
|
|
||||||
\begin{align}
|
\begin{align*}
|
||||||
\label{eq:prob}
|
\label{eq:prob}
|
||||||
P(T_i = k)
|
P(T_i = k)
|
||||||
& = P(A_{k-1} \cap A_k^c) \\
|
& = P(A_{k-1} \cap A_k^c) \\
|
||||||
& = P(A_{k-1}) - P(A_k) \qquad \text{ (as $ A_k \subset A_{k-1} $)} \\
|
& = P(A_{k-1}) - P(A_k) \qquad \text{ (as $ A_k \subset A_{k-1} $)} \\
|
||||||
\end{align}
|
\end{align*}
|
||||||
|
|
||||||
We will try to show that $ \forall k \geq 1 $, $ P(A_k) = \frac{1}{k!} $. To do
|
We will try to show that $ \forall k \geq 1 $, $ P(A_k) = \frac{1}{k!} $. To do
|
||||||
so, we will use induction to prove the following proposition \eqref{eq:induction},
|
so, we will use induction to prove the following proposition \eqref{eq:induction},
|
||||||
|
@ -414,6 +427,18 @@ Finally, plugging this into \eqref{eq:prob} gives us
|
||||||
P(T_i = k) = P(A_{k-1}) - P(A_{k}) = \frac{1}{(k-1)!} - \frac{1}{k!} \qquad \forall k \geq 2
|
P(T_i = k) = P(A_{k-1}) - P(A_{k}) = \frac{1}{(k-1)!} - \frac{1}{k!} \qquad \forall k \geq 2
|
||||||
\]
|
\]
|
||||||
|
|
||||||
|
\subsection{Empirical results}
|
||||||
|
|
||||||
|
We ran $ R = 10^3 $ simulations for $ N = 10 $ items. The empirical results are
|
||||||
|
similar to the mathematical model.
|
||||||
|
|
||||||
|
\begin{figure}[h]
|
||||||
|
\centering
|
||||||
|
\includegraphics[width=1.0\textwidth]{graphics/graphic-NFDBP-T1-103-sim}
|
||||||
|
\caption{Therotical and empiric histograms of $ T_1 $ for $ R = 10^3 $ simulations and $ N = 10 $ items (number of itens in the first bin)}
|
||||||
|
\label{fig:graphic-NFDBP-T1-103-sim}
|
||||||
|
\end{figure}
|
||||||
|
|
||||||
\subsection{Expected value of $ T_i $}
|
\subsection{Expected value of $ T_i $}
|
||||||
|
|
||||||
We now compute the expected value $ \mu $ and variance $ \sigma^2 $ of $ T_i $.
|
We now compute the expected value $ \mu $ and variance $ \sigma^2 $ of $ T_i $.
|
||||||
|
@ -441,6 +466,8 @@ We now compute the expected value $ \mu $ and variance $ \sigma^2 $ of $ T_i $.
|
||||||
\sigma^2 = E({T_i}^2) - E(T_i)^2 = 3e - 1 - e^2
|
\sigma^2 = E({T_i}^2) - E(T_i)^2 = 3e - 1 - e^2
|
||||||
\end{align*}
|
\end{align*}
|
||||||
|
|
||||||
|
$ H_n $ is asymptotically normal, following a $ \mathcal{N}(\frac{N}{\mu}, \frac{N \sigma^2}{\mu^3}) $
|
||||||
|
|
||||||
|
|
||||||
\section{Complexity and implementation optimization}
|
\section{Complexity and implementation optimization}
|
||||||
|
|
||||||
|
@ -519,13 +546,43 @@ then calculate the statistics (which iterates multiple times over the array).
|
||||||
between devices. Execution time and memory usage do not include the import of
|
between devices. Execution time and memory usage do not include the import of
|
||||||
libraries.}
|
libraries.}
|
||||||
|
|
||||||
\subsection{NFBP vs NFDBP}
|
|
||||||
|
|
||||||
\subsection{Optimal algorithm}
|
\subsection{Optimal algorithm}
|
||||||
|
|
||||||
|
As we have seen, NFDBP algorithm is much better than NFBP algorithm. All the
|
||||||
|
variables excluding V are showing this. More specifically, the most relevant
|
||||||
|
variable is Hn which is growing slightly slower in the NFDBP algorithm than in
|
||||||
|
the NFBP algorithm.
|
||||||
|
|
||||||
|
|
||||||
|
Another algorithm that we did not explore in this project is the SUBP (Skim Up
|
||||||
|
Bin Packing) algorithm. It works in the same way as the NFDBP algorithm.
|
||||||
|
However, when an item exceeds the box size, it is removed from the current bin
|
||||||
|
and placed into the next bin. This algorithm that we could not exploit is much
|
||||||
|
more efficient than both of the previous algorithms. His main issue is that it
|
||||||
|
takes a lot of storage and requires higher capacities.
|
||||||
|
|
||||||
|
We redirect you towards this video which demonstrates why another algorithm is
|
||||||
|
actually the most efficient that we can imagine. In this video we see that the
|
||||||
|
mostoptimized of alrogithm is another version of NFBP where we sort the items
|
||||||
|
in a decreasing order before sending them into the different bins.
|
||||||
|
|
||||||
|
\clearpage
|
||||||
|
|
||||||
\sectionnn{Conclusion}
|
\sectionnn{Conclusion}
|
||||||
|
|
||||||
|
In this project, we explored many bin packing algorithms in 1 dimension. We
|
||||||
|
discovered how some bin packing algorithms can be really simple to implement
|
||||||
|
but also a strong data consumer as the NFBP algorithm.
|
||||||
|
|
||||||
|
By modifying the conditions of bin packing we can upgrade our performances. For
|
||||||
|
example, the NFDBP doest not permit to close the boxes (which depend of the
|
||||||
|
context of this implementation). The performance analysis conclusions are the
|
||||||
|
consequences of a precise statistical and probabilistic study that we have leaded
|
||||||
|
on this project.
|
||||||
|
|
||||||
|
To go further, we could now think about the best applications of different
|
||||||
|
algorithms in real contexts, thanks to simulations.
|
||||||
|
|
||||||
|
|
||||||
\nocite{bin-packing-approximation:2022}
|
\nocite{bin-packing-approximation:2022}
|
||||||
\nocite{hofri:1987}
|
\nocite{hofri:1987}
|
||||||
|
|
BIN
latex/graphics/graphic-NFBP-Hn-105-sim.png
Normal file
BIN
latex/graphics/graphic-NFBP-Hn-105-sim.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 29 KiB |
BIN
latex/graphics/graphic-NFDBP-T1-103-sim.png
Normal file
BIN
latex/graphics/graphic-NFDBP-T1-103-sim.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Loading…
Reference in a new issue