# 9.5. `pyopus.misc.ghalton` — Generalized Halton sequence generator¶

class `ghalton.``GeneralizedHalton`(dim[, seed] | config)

Creates a generalized Halton generator. It takes at least one argument, either the dimensionality, or a configuration. When the dimensionality is given, an optional argument can be used to seed for the random permutations created. The configuration is a series of permutations each of n_i numbers, where n_i is the n_i‘th prime number. In that last case, the dimensionality is infered from the number of sublists given.

Parameters: dim (integer) – Dimensionality of the points to create seed (integer) – Seed to create the permutations config (list of lists of integers) – List of permutations to scramble the halton digits
`get`(n)

Retreive the n next points from this sequence. Each point is a `list` containing each value for each coordinates and the points are returned in a `list` of n elements even if n is 1.

`reset`()

Reset the generator to its initial state, i.e. before it generated the first point.

`seed`([config])

Seed the generator with a new seed or configuration. Seeding a generator automatically call `reset()`.

Parameters: config (`None`, integer, or list of lists of integers) – The config to seed the sequencer
class `ghalton.``Halton`(dim)

Creates a Halton generator of dimensionality dim. This is similar to creating a `GeneralizedHalton` sequence with the identity permutations.

`get`(n)

Retreive the n next points from this sequence. Each point is a `list` containing each value for each coordinates and the points are returned in a `list` of n elements even if n is 1.

`reset`()

Reset the generator to its initial state, i.e. before it generated the first point.

`ghalton.``EA_PERMS`

Permutations described in [DeRainville2012] for the 100 first dimensions of the Generalized Halton sequence.

`ghalton.``PRIMES`

Prime numbers lower than 10000.

 [DeRainville2012] F.-M. De Rainville, C. Gagné, O. Teytaud, D. Laurendeau. Evolutionary optimization of low-discrepancy sequences. ACM Trans. Model. Comput. Simul., 22(2):1-25, 2012.

This module was written by Francois-Michel De Rainville (version 0.2.0) and released under GNU LGPL.