A Boltzmann sampler is an algorithm intended for random sampling of combinatorial structures. If the object size is viewed as its energy, and the argument of the corresponding generating function is interpreted in terms of the temperature of the physical system, then a Boltzmann sampler returns an object from a classical Boltzmann distribution.
The concept of Boltzmann sampler was proposed by Philippe Duchon, Philippe Flajolet, Guy Louchard and Gilles Schaeffer in 2004.[1]
The concept of Boltzmann sampling is closely related to the symbolic method in combinatorics.
Let be a combinatorial class with an ordinary generating function which has a nonzero radius of convergence , i.e. is complex analytic. Formally speaking, if each object
is equipped with a non-negative integer size, then the generating function is defined as
where denotes the number of objects of size . The size function is typically used to denote the number of vertices in a tree or in a graph, the number of letters in a word, etc.
A Boltzmann sampler for the class with a parameter such that , denoted as
returns an object with probability
If the target class is a disjoint union of two other classes, , and the generating functions and of and are known, then the Boltzmann sampler for can be obtained as
where stands for "if the random variable is 1, then execute , else execute ". More generally, if the disjoint union is taken over a finite set, the resulting Boltzmann sampler can be represented using a random choice with probabilities proportional to the values of the generating functions.
If is composed of all the finite sequences of elements of with size of a sequence additively inherited from sizes of components, then the generating function of is expressed as
, where is the generating function of . Alternatively, the class admits a recursive representation This gives two possibilities for .
where stands for "draw a random variable ; if the value is returned, then execute independently times and return the sequence obtained". Here, stands for the geometric distribution .
As the first construction of the sequence operator suggests, Boltzmann samplers can be used recursively. If the target class is a part of the system
where each of the expressions involves only disjoint union, cartesian product and sequence operator, then the corresponding Boltzmann sampler is well defined. Given the argument value , the numerical values of the generating functions can be obtained by Newton iteration.[2]
where denotes the number of labelled objects of size . The operation of cartesian product and sequence need to be adjusted to take labelling into account, and the principle of construction remains the same.
In the labelled case, the Boltzmann sampler for a labelled class is required to output an object with probability
In the labelled universe, a class can be composed of all the finite sets of elements of a class with order-consistent relabellings. In this case, the exponential generating function of the class is written as
where is the exponential generating function of the class . The Boltzmann sampler for can be described as
In the cycle construction, a class is composed of all the finite sequences of elements of a class , where two sequences are considered equivalent if they can be obtained by a cyclic shift. The exponential generating function of the class is written as
where is the exponential generating function of the class . The Boltzmann sampler for can be described as
Consider various partitions of the set into several non-empty classes, being disordered between themselves.
Using symbolic method, the class of set partitions can be expressed as
The corresponding generating function is equal to . Therefore, Boltzmann sampler can be described as
where the positive Poisson distribution is a Poisson distribution with a parameter conditioned to take only positive values.
The original Boltzmann samplers described by Philippe Duchon, Philippe Flajolet, Guy Louchard and Gilles Schaeffer[1] only support basic unlabelled operations of disjoint union, cartesian product and sequence, and two additional operations for labelled classes, namely the set and the cycle construction. Since then, the scope of combinatorial classes for which a Boltzmann sampler can be constructed, has expanded.
The admissible operations for unlabelled classes include such additional operations as Multiset, Cycle and Powerset. Boltzmann samplers for these operations have been described by Philippe Flajolet, Éric Fusy and Carine Pivoteau.[3]
Let be a labelled combinatorial class. The derivative operation is defined as follows: take a labelled object and replace an atom with the largest label with a distinguished atom without a label, therefore reducing a size of the resulting object by 1. If is the exponential generating function of the class , then the exponential generating function of the derivative class is given byA differential specification is a recursive specification of type
where the expression involves only standard operations of union, product, sequence, cycle and set, and does not involve differentiation.
Boltzmann samplers for differential specifications have been constructed by Olivier Bodini, Olivier Roussel and Michèle Soria.[4]
A multi-parametric Boltzmann distribution for multiparametric combinatorial classes is defined similarly to the classical case. Assume that each object is equipped with the composition size which is a vector of non-negative integer numbers. Each of the size functions can reflect one of the parameters of a data structure, such as the number of leaves of certain colour in a tree, the height of the tree, etc. The corresponding multivariate generating function is then associated with a multi-parametric class, and is defined asA Boltzmann sampler for the multiparametric class with a vector parameter inside the domain of analyticity of , denoted as
returns an object with probability
Multiparametric Boltzmann samplers have been constructed by Olivier Bodini and Yann Ponty.[5] A polynomial-time algorithm for finding the numerical values of the parameters given the target parameter expectations, can be obtained by formulating an auxiliary convex optimisation problem[6]
^ abDuchon, Philippe; Flajolet, Philippe; Louchard, Guy; Schaeffer, Gilles (July 2004). "Boltzmann Samplers for the Random Generation of Combinatorial Structures". Combinatorics, Probability and Computing. 13 (4–5): 577–625. doi:10.1017/S0963548304006315. ISSN0963-5483. S2CID1634696.
^Bodini, Olivier Ponty, Yann. Multi-dimensional Boltzmann Sampling of Languages. OCLC695180521.{{cite book}}: CS1 maint: multiple names: authors list (link)
^Bendkowski, Maciej; Bodini, Olivier; Dovgal, Sergey (January 2018), "Polynomial tuning of multiparametric combinatorial samplers", 2018 Proceedings of the Fifteenth Workshop on Analytic Algorithmics and Combinatorics (ANALCO), Society for Industrial and Applied Mathematics, pp. 92–106, arXiv:1708.01212, doi:10.1137/1.9781611975062.9, ISBN978-1-61197-506-2