main.tex 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. % ------------------------------------------------------------------------
  2. \documentclass{llncs}
  3. \input{prelude}
  4. \begin{document}
  5. \title{$\mbox{\EightStarBold}$ Discrepancies for generalized Halton points}
  6. % \titlerunning{} % abbreviated title (for running head)
  7. % also used for the TOC unless
  8. % \toctitle is used
  9. \author{Thomas Espitau$\mbox{}^{\mbox{\SnowflakeChevron}}$ \and Olivier Marty$\mbox{}^{\mbox{\SnowflakeChevron}}$}
  10. %
  11. % \authorrunning{} % abbreviated author list (for running head)
  12. %
  13. %%%% list of authors for the TOC (use if author list has to be modified)
  14. % \tocauthor{}
  15. %
  16. \institute{$\mbox{}^{\mbox{\SnowflakeChevron}}$ ENS Cachan}
  17. \maketitle
  18. \makeatletter
  19. \makeatother
  20. \begin{abstract}
  21. \end{abstract}
  22. \section{Introduction}
  23. \section{General architecture of the tool}
  24. The testing tool is aimed to be modular: it is made of independents blocks that
  25. are interfaced trough a scheduler. More precisely a master wrapper is written
  26. in Python that calls a first layer which performs the chosen heuristic. This
  27. layer is written in C++ for performances. The given discrepancy algorithm
  28. --- written in C --- is called when evaluations of a state is needed.
  29. The wrapper dispatch the computations on the multi-core architecture of
  30. modern computers\footnote{for us, between 2 and 4 physical cores and 4 or 8
  31. virtual cores}. This basic architecture is described in figure~\ref{main_flow}.
  32. Experiments were conducted on two machines:
  33. \begin{itemize}
  34. \item 2.4 GHz Intel Dual Core i5 hyper-threaded to 2.8GHz, 8 Go 1600 MHz DDR3.
  35. \item 2.8 GHz Intel Quad Core i7 hyper-threaded to 3.1GHz, 8 Go 1600 MHz DDR3.
  36. \end{itemize}
  37. \begin{figure}
  38. \includegraphics[scale=0.6]{main_flow.pdf}
  39. \caption{Tool overview}
  40. \label{main_flow}
  41. \end{figure}
  42. On these machines, some basic profiling has make clear that
  43. the main bottleneck of the computations is hiding in the \emph{computation
  44. of the discrepancy}. The chosen algorithm and implantation of this
  45. cost function is the DEM-algorithm~\cite{Dobkin} of
  46. \emph{Magnus Wahlstr\o m}~\cite{Magnus}.\medskip
  47. All the experiments has been conducted on dimension 2,3,4
  48. --- with a fixed Halton basis 7, 13, 29, 3 ---. Some minor tests have
  49. been made in order to discuss the dependency of the discrepancy and
  50. efficiency of the heuristics with regards to the values chosen for the
  51. prime base. The average results remains roughly identical when taking
  52. changing these primes and taking them in the range [2, 100]. For such
  53. a reason we decided to pursue the full computations with a fixed
  54. basis.
  55. \subsection{Algorithmic insights}
  56. To perform an experiment we made up a
  57. loop above the main algorithm which calls the chosen heuristic multiple
  58. times in order to smooth up the results and obtain more exploitable datas.
  59. Then an arithmetic mean of the result is performed on the values. In addition
  60. extremal values are also given in order to construct error bands graphs.
  61. A flowchart of the conduct of one experiment is described in the
  62. flowchart~\ref{insight_flow}. The number of iteration of the heuristic is
  63. I and the number of full restart is N. The function Heuristic() correspond to
  64. a single step of the chosen heuristic. We now present an in-depth view of
  65. the implemented heuristics.
  66. \begin{figure}
  67. \begin{mdframed}
  68. \includegraphics[scale=0.4]{insight.pdf}
  69. \caption{Flowchart of a single experiment}
  70. \label{insight_flow}
  71. \end{mdframed}
  72. \end{figure}
  73. Graph are presented not with the usual box plot to show the
  74. error bounds, but in a more graphical way with error bands. The graph
  75. of the mean result is included inside a band of the same color which
  76. represents the incertitude with regards to the values obtained.
  77. \section{Heuristics developed}
  78. \subsection{Fully random search (Test case)}
  79. The first heuristic implemented is the random search. We generate
  80. random permutations, compute the corresponging sets of Halton points
  81. and select the best set with regard to its discrepancy.
  82. The process is wrapped up in the
  83. flowchart~\ref{random_flow}. In order to generate at each step random
  84. permutations, we transform them directly from the previous ones.
  85. More precisely the permutation is a singleton object which have method
  86. random, built on the Knuth Fisher Yates shuffle. This algorithm allows
  87. us to generate an uniformly chosen permutation at each step. We recall
  88. this fact and detail the algorithm in the following section.
  89. \begin{figure}
  90. \begin{mdframed}
  91. \includegraphics[scale=0.4]{flow_rand.pdf}
  92. \caption{Flowchart of the random search}
  93. \label{random_flow}
  94. \end{mdframed}
  95. \end{figure}
  96. \subsubsection{The Knuth-Fisher-Yates shuffle}
  97. The Fisher–Yates shuffle is an algorithm for generating a random permutation
  98. of a finite sets. The Fisher–Yates shuffle is unbiased, so that every
  99. permutation is equally likely. We present here the Durstenfeld variant of
  100. the algorithm, presented by Knuth in \emph{The Art of Computer programming}
  101. vol. 2~\cite{Knuth}.
  102. The algorithm's time complexity is here $O(n)$, compared to $O(n^2)$ of
  103. the naive implementation.
  104. \begin{algorithm}[H]
  105. \SetAlgoLined
  106. \SetKwFunction{Rand}{Rand}
  107. \SetKwFunction{Swap}{Swap}
  108. \KwData{A table T[1..n]}
  109. \KwResult{Same table T, shuffled}
  110. \For{$i\leftarrow 1$ \KwTo $n-1$}{
  111. $j \leftarrow$ \Rand{$[1,n-i]$}\;
  112. \Swap{$T[i], T[i+j]$}\;
  113. }
  114. \caption{KFY algorithm}
  115. \end{algorithm}
  116. \begin{lemma}
  117. The resulting permutation of KFY is unbiased.
  118. \end{lemma}
  119. \begin{proof}
  120. Let consider the set $[1,\ldots n]$ as the vertices of a random graph
  121. constructed as the trace of the execution of the algorithm:
  122. an edge $(i,j)$ exists in the graph if and only if the swap of $T[i]$ and
  123. $T[j]$ had been executed. This graph encodes the permutation represented by
  124. $T$. To be able to encode any permutation the considered graph must be
  125. connected --- in order to allow any pairs of points to be swapped ---.
  126. Since by construction every points is reached by an edge, and that there
  127. exists exactly $n-1$ edges, we can conclude directly that any permutation can
  128. be reached by the algorithm. Since the probability of getting a fixed graph
  129. of $n-1$ edges with every edges of degree at least one is $n!^{-1}$, the
  130. algorithm is thus unbiased.
  131. \end{proof}
  132. \subsubsection{Results and stability}
  133. We first want to analyze the dependence of the results on the number of
  134. iterations of the heuristic, in order to discuss its stability.
  135. The results are compiled in the figures~\ref{rand_iter2},~\ref{rand_iter3},
  136. restricted to a number of points between 80 and 180.
  137. We emphasize on the fact the lots of datas appears on the graphs,
  138. and the error bands representation make them a bit messy. These graphs
  139. were made for extensive internal experiments and parameters researches.
  140. The final wrap up graphs are much more lighter and only presents the best
  141. results obtained.
  142. As expected from a fully random search, the error bands are very large for
  143. low number of iterations ($15\%$ of the value for 400 iterations) and tends
  144. to shrink with a bigger number of iterations (around $5\%$ for 1600 iterations).
  145. This shrinkage is a direct consequence of well known concentrations bounds
  146. (Chernoff and Asuma-Hoeffding).
  147. The average results are quite stable, they decrease progressively with
  148. the growing number of iterations, but seem to get to a limits after 1000
  149. iterations. This value acts as a threshold for the interesting number of iterations.
  150. As such interesting results can be conducted with \emph{only} 1000 iterations,
  151. without altering too much the quality of the set with regards to its
  152. discrepancy and this heuristic.
  153. \begin{figure}
  154. \includegraphics[scale=0.3]{Results/random_iter.png}
  155. \caption{Dependence on iterations, dimension 2}
  156. \label{rand_iter2}
  157. \end{figure}
  158. \begin{figure}
  159. \includegraphics[scale=0.3]{Results/random_iter_3.png}
  160. \caption{Dependence on iterations, dimension 3}
  161. \label{rand_iter3}
  162. \end{figure}
  163. %# TODO sa n'est pas evolutionnaire
  164. \subsection{Evolutionary heuristic: Simulated annealing and local search}
  165. The second heuristic implemented is a randomized local search with
  166. simulated annealing. This heuristic is inspired by the physical
  167. process of annealing in metallurgy.
  168. Simulated annealing interprets the physical slow cooling as a
  169. slow decrease in the probability of accepting worse solutions as it
  170. explores the solution space.
  171. More precisely a state is a $d$-tuple of permutations, one for each dimension,
  172. and the neighbourhood is the set of $d$-tuple of permutations which can be obtained
  173. by application of exactly one transposition of one of the permutation of
  174. the current state.
  175. The selection phase is dependant on the current temperature:
  176. after applying a random transposition on one of the current permutations, either
  177. the discrepancy of the corresponding Halton set is decreased and the
  178. evolution is kept, either it does not but is still kept with
  179. a probability $e^{\frac{\delta}{T}}$ where $\delta$ is the difference
  180. between the old and new discrepancy, and $T$ the current temperature.
  181. If the de discrepancy has decreased, the temperature $T$ is multiplied
  182. by a factor $\lambda$ (fixed to $0.992$ in all our simultations), hence
  183. is decreased.
  184. The whole algorithm is described in the flowchart~\ref{flow_rec}.
  185. \begin{figure}
  186. \begin{mdframed}
  187. \includegraphics[scale=0.4]{flow_recuit.pdf}
  188. \caption{Flowchart of the simulated annealing local search heuristic}
  189. \label{flow_rec}
  190. \end{mdframed}
  191. \end{figure}
  192. \subsubsection{Dependence on the temperature}
  193. First experiments were made to select the best initial temperature.
  194. Results are compiled in graphs~\ref{temp_2},~\ref{temp3},\ref{temp3_z}.
  195. Graphs~\ref{temp_2},~\ref{temp3} represent the results obtained respectively
  196. in dimension 2 and 3 between 10 and 500 points. The curve obtained is
  197. characteristic of the average evolution of the discrepancy optimization
  198. algorithms for Halton points sets: a very fast decrease for low number of
  199. points --- roughly up to 80 points --- and then a very slow one
  200. after~\cite{Doerr}.
  201. The most interesting part of these results are concentrated between 80 and 160
  202. points were the different curves splits. The graph~\ref{temp3_z} is a zoom
  203. of~\ref{temp3} in this window. We remark on that graph that the lower the
  204. temperature is, the best the results are.
  205. \begin{figure}
  206. \includegraphics[scale=0.3]{Results/resu_2_temp.png}
  207. \caption{Dependence on initial temperature: D=2}
  208. \label{temp_2}
  209. \end{figure}
  210. \begin{figure}
  211. \includegraphics[scale=0.3]{Results/resu_temp3.png}
  212. \caption{Dependence on initial temperature: D=3}
  213. \label{temp3}
  214. \end{figure}
  215. \begin{figure}
  216. \includegraphics[scale=0.3]{Results/resu_temp3_zoom.png}
  217. \caption{Dependence on initial temperature (zoom): D=3}
  218. \label{temp3_z}
  219. \end{figure}
  220. \subsubsection{Stability with regards to the number of iterations}
  221. As for the fully random search heuristic we investigated the stability
  222. of the algorithm with regards to the number of iterations. We present here
  223. the result in dimension 3 in the graph~\ref{iter_sa}. Once again we
  224. restricted the window between 80 and 180 points were curves are split.
  225. An interesting phenomena can be observed: the error rates are somehow
  226. invariant w.r.t.\ the number of iterations and once again the 1000 iterations
  227. threshold seems to appear --- point 145 is a light split between iteration
  228. 1600 and the others, but excepted for that point, getting more than 1000
  229. iterations tends be be a waste of time. The error rate is for 80 points the
  230. biggest and is about $15\%$ of the value, which is similar to the error
  231. rates for fully random search with 400 iterations.
  232. \begin{figure}
  233. \includegraphics[scale=0.3]{Results/sa_iter.png}
  234. \caption{Dependence on iterations number for simulated annealing : D=3}
  235. \label{iter_sa}
  236. \end{figure}
  237. \subsection{Genetic (5+5) search}
  238. \begin{figure}
  239. \begin{mdframed}
  240. \includegraphics[scale=0.4]{crossover_flow.pdf}
  241. \caption{Flowchart of the crossover algorithm.}
  242. \label{cross_flow}
  243. \end{mdframed}
  244. \end{figure}
  245. \subsubsection{Dependence on the parameter p}
  246. First experiments were made to select the value for the crossover parameter
  247. p. Results are compiled in graphs~\ref{res_gen2},~\ref{res_gen2z},\ref{res_gen3}
  248. and~\ref{res_gen4}.
  249. Graph~\ref{res_gen2}, represents the results obtained
  250. in dimension 2 between 10 and 500 points. The curve obtained is, with no
  251. surprise again,
  252. the characteristic curve of the average evolution of the discrepancy we already
  253. saw with the previous experiments.
  254. The most interesting part of these results are concentrated --- once again ---
  255. between 80 and 160 points were the different curves splits.
  256. The graph~\ref{res_gen2z} is a zoom of~\ref{res_gen2} in this window, and
  257. graphs~\ref{res_gen3} and~\ref{res_gen4} are focused directly into it too.
  258. \begin{figure}
  259. \includegraphics[scale=0.3]{Results/res_gen_2.png}
  260. \caption{Dependence on parameter p: D=2}
  261. \label{res_gen2}
  262. \end{figure}
  263. \begin{figure}
  264. \includegraphics[scale=0.3]{Results/res_gen_2_zoom.png}
  265. \caption{Dependence on parameter p (zoom): D=2}
  266. \label{res_gen2z}
  267. \end{figure}
  268. \begin{figure}
  269. \includegraphics[scale=0.3]{Results/res_gen_3_zoom.png}
  270. \caption{Dependence on parameter p: D=3}
  271. \label{res_gen3}
  272. \end{figure}
  273. \begin{figure}
  274. \includegraphics[scale=0.3]{Results/res_gen_4_zoom.png}
  275. \caption{Dependence on parameter p: D=4}
  276. \label{res_gen4}
  277. \end{figure}
  278. Once again we investigated the stability
  279. of the algorithm with regards to the number of iterations. Once again we
  280. restricted the window between 80 and 180 points were curves are split.
  281. An interesting phenomena can be observed: the error rates are somehow
  282. invariant w.r.t.\ the number of iteration and once again the 1000 iterations
  283. threshold seems to appear --- point 145 is a light split between iteration
  284. 1600 and the others, but excepted for that point, getting more than 1000
  285. iterations tends be be a waste of time. The error rate is for 80 points the
  286. biggest and is about $15\%$ of the value, which is similar to the error
  287. rates for fully random search with 400 iterations.
  288. \section{Results}
  289. Eventually we made extensive experiments to compare the three previously
  290. presented heuristics. The parameters chosen for the heuristics have been
  291. chosen using the experiments conducted in the previous sections
  292. Results are compiled in the last
  293. figures~\ref{wrap2},~\ref{wrap2z},~\ref{wrap3z},~\ref{wrap4z}. The
  294. recognizable curve of decrease
  295. of the discrepancy is still clearly recognizable in the graph~\ref{wrap2},
  296. made for points ranged between 10 and 600. We then present the result
  297. in the --- now classic --- window 80 points - 180 points ---.
  298. For all dimensions, the superiority of non-trivial algorithms --- simulated
  299. annealing and genetic search --- is clear over fully random search.
  300. Both curves for these heuristics are way below the error band of random
  301. search. As a result \emph{worse average results of non trivial heuristics are
  302. better than best average results when sampling points at random}.
  303. In dimension 2~\ref{wrap2z}, the best results are given by the genetic search,
  304. whereas in dimension 3 and 4~\ref{wrap3z},~\ref{wrap4z}, best results are
  305. given by simulated annealing. It is also noticeable that in that range
  306. of points the error rates are roughly the same for all heuristics:
  307. \emph{for 1000 iteration, the stability of the results is globally the
  308. same for each heuristic}.
  309. \begin{figure}
  310. \includegraphics[scale=0.3]{Results/wrap_2.png}
  311. \caption{Comparison of all heuristics: D=2}
  312. \label{wrap2}
  313. \end{figure}
  314. \begin{figure}
  315. \includegraphics[scale=0.3]{Results/wrap_2_zoom.png}
  316. \caption{Comparison of all heuristics (zoom): D=2}
  317. \label{wrap2z}
  318. \end{figure}
  319. \begin{figure}
  320. \includegraphics[scale=0.3]{Results/wrap_3.png}
  321. \caption{Comparison of all heuristics: D=3}
  322. \label{wrap3z}
  323. \end{figure}
  324. \begin{figure}
  325. \includegraphics[scale=0.3]{Results/wrap_4.png}
  326. \caption{Comparison of all heuristics: D=4}
  327. \label{wrap4z}
  328. \end{figure}
  329. \section{Conclusion}
  330. \bibliographystyle{alpha}
  331. \bibliography{bi}
  332. \end{document}