Nom

Overview — An overview of the Low Discrepancy toolbox.

Purpose

The goal of this toolbox is to provide a collection of low discrepancy sequences. These sequences try to produce numbers which favor the convergence of a Monte-Carlo simulation by reducing the discrepancy. These random numbers are designed to be used in a Monte-Carlo simulation. For example, low discrepancy sequences provide a higher convergence rate to the Monte-Carlo method when used in numerical integration. The toolbox takes into account the dimension of the problem, i.e. generate vectors with arbitrary size.

Low Discrepancy sequences are designed to be able to produce real values uniform in the [0,1[^s interval, where s is the dimension of the space.

See the provided demonstrations for sample examples of this library.

Overview of sequences

In this section, we git the list of sequences which are provided in this component.

  • The Halton sequence.

  • The Faure sequence.

  • The Reverse Halton sequence of Vandewoestyne and Cools.

  • The Sobol sequence.

  • The Niederreiter base 2 and arbitrary base sequence.

Features

The current component has the following features :

  • manage arbitrary number of dimensions

  • skips a given number of elements in the sequence

  • leaps (i.e. ignores) a given number of elements from call to call

  • fast sequences based on compiled source code,

  • suggest optimal settings to use the best of the sequences.

  • object oriented programming.

Sources of Sequences

Although the random number toolbox provides the same interface for all generators, what happens behind the scenes is not the same, depending on the sequence. Two main sources are used in this toolbox.

  • Scripts

    Scripts are provided with this toolbox to implement both low-discrepancy sequences (such as Halton for instance). These sequences may be slow if a large number of data is to be generated, but may provide greater flexibility for some users.

  • C source codes

    These sequences are based on compiled C source code and are as fast as possible.

Design

The internal design of the toolbox is based on the following hierarchy.

  • The lowdisc_* functions provide the highest level object oriented functions. They allow to access to any sequence with a constructor based on a string representing the sequence. For example, lds = lowdisc_new("halton") creates a new Halton sequence. In this framework, the lowdisc component allows to access to all sequences with a single API, where all the methods are valid for all sequences and all sequences share the same options.

  • The ldhalton_*, ldfaure_*, etc... functions are each implementing a specific low discrepancy sequence. Each sequence is independent of the others. Each sequence has its specific options, but all must implement the following methods : new, destroy, configure, cget, get, startup and next.

  • The ldbase_* functions provide an abstract sequence object. This class gathers the source code shared by all sequences.

Limitations

Much work was devoted to the update of the library so that the parameters of each sequence are clearly identified. In the original Fortran 77 implementations, common blocks were used to manage the state of the sequence throughout the calls. In the original C source code, static variables, some of them being local to some functions, were used. In the original Matlab implementations, global variables were used. In the current implementation, the parameters are more clearly identified.

In the macros-based sequences, each sequence has a state which is stored in a typed list, created transparently by the user. There is no global variable.

In the C-based sequences, each sequence has an associated collection of variables declared as static variables at the begining of each source code. These variables are used consistently : there are no local static variables anymore. This implementation has one limitation: it is not possible to manage two sequences of the same type concurently (i.e. at the same time). In a future implementation, an update of the source code will be necessary to use C++ classes.

History of the source code

The source code provided here is the result of the cumulated work of several authors at different times.

  • From 1986 to 1992, Bennett Fox and then Paul Bratley and Harald Niederreiter developped Fortran algorithms which provided the Sobol, Faure and Niederreiter sequences. These algorithms are described in several papers called Algorithm 647, Algorithm 659 and Algorithm 738.

  • From 2003 to 2009, John Burkardt translated these source codes into Matlab and C. He also developped a leaped Halton sequence based on the 1997 paper by Kocis and Whiten.

  • From 2008 to 2010, Michael Baudin did early experiments with interfacing the low discrepancy sequences from the Gnu Scientific Library. Problems with the portability of the library under Windows and limitations of the licence led me to the search for another source of sequences. I developped the Halton and Faure sequences as Scilab macros from the algorithms provided by Paul Glasserman in his book. Then I translated and re-structured the Matlab and, later, the C source codes from John Burkardt. I updated all the sequences, so that they all share the same parameters, such as the skip and the leap parameters. I also created the Reverse Halton sequence from the 2006 paper by Vandewoestyne and Cools. This work was inspired by the work done by O. Teytaud in the Gnu Scientific Library. Much time was spent on the validation of the sequences provided in this module. Each sequence is associated with a collection of unit tests which ensure the that the sequence is correctly computed. We used the original Fortran 77 implementations as a base to compare our results. Several bugs were discovered this way and fixed in the source code provided here.

TODO

  • Add scrambling algorithms : RR2 from Kocis and Whiten, Matousek. Can we program Reverse Halton as a scrambling ? Can let the user define its scrambling function ?

  • Add algorithms to compute the discrepancy

  • Add test cases on integrals as in Bratley and Fox

  • check interaction between skip and leap for all sequences

  • for C-based sequences, vectorize the calls to the fast sequences, so that we can get several elements at the same time

  • replace dim_num by dim everywhere in the macros

  • update the name of the next routines of the C library : i4_sobol > i4_sobol_next, etc... Review all the .h to be sure of this update.

  • see if the Gray code of the index can be computed directly, so that the skip and leap options of Sobol sequence is faster

  • replace basis by base where appropriate in Faure sequence

  • create a graycode function

  • update the C source codes and use C++ classes

DONE

  • many other things before...

  • tested the skip and leap for all sequences

  • replaced sprintf by msprintf

  • with the Fast Niederreiter sequence, if the gfarit and gfplsys files already exist, do not generate anymore.

  • checked the maximal dimension available for Fast Niederreiter : fixed bug in the source

  • removed _mlist_isfield where unused

  • Update the help page : Niederreiter base 2 is slow while Niederreiter arbitrary base is fast

  • added -nbsimmax to know the maximum number of simulations for all sequences

  • removed _divremainder : this is modulo

  • improved the performance of skip and leap

  • add the reference implementation in the comments of lowdisc_new

  • check that the maximum dimension is checked in lowdisc_configure for all sequences

  • made some support routine available publicly : lowdisc_bary, lowdisc_bitlo0, lowdisc_hi1.

  • fill lowdisc_new and specify for each sequence if the skip and leap options are direct (faster) or one-by-one (slower)

  • created lowdisc_soboltau to suggest a skip parameter for Sobol : http://people.sc.fsu.edu/~burkardt/m_src/sobol/tau_sobol.m

  • created lowdisc_sobolsuggest to suggest number of simulations for Sobol : a power of 2 larger than nbsim, N = 2**K WHERE K .GE. (TAUS+S-1) FOR INTEGRATION AND K .GT. TAUS FOR GLOBAL OPTIMIZATION. TAU/0,0,1,3,5,8,11,15,19,23,27,31,35/

  • created lowdisc_fauresuggest to suggest skip parameter for Faure : skip = base^4 - 2.

  • created lowdisc_fauresuggest to suggest number of simulations for Faure : a power of the base larger than nbsim

  • created lowdisc_niedersuggest to suggest skip parameter for Niederreiter : BASE ** POWER(BASE) where (POWER(I), I = 2,MAXBAS) / 12,8,8,6,6,6,4,4,4,4,4,4 /

  • created lowdisc_niedersuggest to suggest number of simulations for Niederreiter : a power of the base : BASE ** POWER(BASE), BASE ** ((POWER(BASE) + 1)), BASE ** ((POWER(BASE) + 2)), BASE ** ((POWER(BASE) + 3))

  • created lowdisc_niedersuggest to suggest initial base for Niederreiter : (OPTBAS(I), I = 2,MAXDIM) / 2,3,3,5,7,7,9,9,11,11,13/

  • created lowdisc_haltonsuggest to suggest number of simulations, skip and leap for Halton

Authors

2009-2010 - DIGITEO - Michael Baudin
2008-2009 - INRIA - Michael Baudin
2003-2009 - John Burkardt
1994 - Paul Bratley, Bennett Fox, Harald Niederreiter
1986-1986 - Bennett Fox

See Also

lowdisc_sequences, lowdisc_new, lowdisc_cget, lowdisc_configure, lowdisc_display, lowdisc_next, lowdisc_terms, lowdisc_destroy

Acknowledgements

Michael Baudin thanks John Burkardt for his help during the development of this library.

Thanks to Alan Cornet, Pierre Marechal for the technical help for this project.

Licence

This toolbox is distributed under the GNU LGPL license.

Bibliography

"Monte-Carlo methods in Financial Engineering", Paul Glasserman, Springer, 2003

"Algorithm 247: Radical-inverse quasi-random point sequence", J. H. Halton, 1964. Commun. ACM 7, 12 (Dec. 1964), 701-702

"Good permutations for deterministic scrambled Halton sequences in terms of L2-discrepancy", B. Vandewoestyne and R. Cools, Computational and Applied Mathematics 189, 2006

"Low-discrepancy and low-dispersion sequences", Harald Niederreiter, Journal of Number Theory, Volume 30, 1988, pages 51-70.

"Algorithm 647: Implementation and Relative Efficiency of Quasirandom Sequence Generators", B. L. Fox, 1986. ACM Trans. Math. Softw. 12, 4 (Dec. 1986), 362-376.

"Algorithm 659: Implementing Sobol's quasirandom sequence generator.", P. Bratley and B. L. Fox, 1988. ACM Trans. Math. Softw. 14, 1 (Mar. 1988), 88-100.

"Remark on Algorithm 659: Implementing Sobol's Quasirandom Sequence Generator", Stephen Joe, Frances Kuo, ACM Transactions on Mathematical Software, Volume 29, Number 1, March 2003, pages 49-57.

"Implementation and Tests of Low Discrepancy Sequences", Paul Bratley, Bennett Fox, Harald Niederreiter, ACM Transactions on Modeling and Computer Simulation, Volume 2, Number 3, July 1992, pages 195-213.

"Algorithm 738: Programs to generate Niederreiter's low-discrepancy sequences", P. Bratley, B. L. Fox, and H. Niederreiter, 1994. ACM Trans. Math. Softw. 20, 4 (Dec. 1994), 494-495.

"Algorithm 823: Implementing scrambled digital sequences", H. S. Hong and F. J. Hickernell, 2003. ACM Trans. Math. Softw. 29, 2 (Jun. 2003), 95-109.

"Discrepancy of sequences associated with a number system (in dimension one)", Faure Henri, Bull. Soc. Math. France 109, no. 2, 143--182, 1981

"Numerical Recipes in Fortran: The Art of Scientific Computing", William Press, Brian Flannery, Saul Teukolsky, William Vetterling, Second Edition, Cambridge University Press, 1992

"Comparison of Point Sets and Sequences for Quasi-Monte Carlo and for Random Number Generation.", L'Ecuyer, P. 2008. In Proceedings of the 5th international Conference on Sequences and their Applications (Lexington, KY, USA, September 14 - 18, 2008). S. W. Golomb, M. G. Parker, A. Pott, and A. Winterhof, Eds. Lecture Notes In Computer Science, vol. 5203. Springer-Verlag, Berlin, Heidelberg, 1-17.

"Computational investigations of low-discrepancy sequences", Kocis, L. and Whiten, W. J. 1997. ACM Trans. Math. Softw. 23, 2 (Jun. 1997), 266-294.

"Gnu Scientific Library - The Reverse Halton Sequence", Olivier Teytaud, 2007

"USSR Computational Mathematics and Mathematical Physics", Ilya Sobol, Volume 16, pages 236-242, 1977.

"The Production of Points Uniformly Distributed in a Multidimensional Cube" (in Russian), Ilya Sobol, YL Levitan, Preprint IPM Akad. Nauk SSSR, Number 40, Moscow 1976.