main.tex 17 KB

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