main.tex 16 KB

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