Data Structures for Weighted Ensemble
Ensembles
WeightedEnsemble.Ensemble
— TypeEnsemble{TP, TF<:AbstractFloat, TI<:Integer, TD}
A particle ensemble structure designed for WE with bins.
Fields
ξ̂
- particle positions after selection, before mutationξ
- particle positions after mutationω̂
- partice weights after selection, before mutationω
- partice weights after mutationb̂
- particle bin after selection, before mutationb
- particle bin after mutationo
- number of offspring of the particled̂
- auxiliary data for each particle after selection, before mutationd
- auxiliary data for each particle, after mutation
The ensemble data structure holds the information about $\{(\omega_t^{(i)}, \xi_t^{(i)}\}$, along with the post selection step $\{(\hat{\omega}_t^{(i)}, \hat{\xi}_t^{(i)}\}$. Fo convenience, it also carries information about the bin the particle currently resides in. The structures d
and d̂
are optional for carrying any auxiliary information.
Several convenience constructors have been included.
WeightedEnsemble.Ensemble
— MethodEnsemble(X, n_particles)
Construct an ensemble of n_particles
with all particles in the state X
with uniform weights.
Arguments
X
- state to be assigned to all particlesn_particles
- size of ensemble
WeightedEnsemble.Ensemble
— MethodEnsemble(X)
Construct an ensemble with particles in the states specified in vector X
with uniform weights.
Arguments
X
- array of states at which to initialize the particles
WeightedEnsemble.Ensemble
— MethodEnsemble(X, ω)
Construct an ensemble with particles in the states specified in vector X
with weights specified in vector ω
Arguments
X
- array of states at which to initialize the particlesω
- array of weights at which to initialize the particles
As an example, if our problem is posed in $\mathbb{R}$, an initial ensemble could be constructed:
x0 = [-1.0];
n_particles = 100;
E0 = Ensemble(x0, n_particles);
This initializes the bin id field, b
, to zeros. It will be neccessary to either manually assign this field, or to call the user defined rebin!
function:
rebin!(E0, B0, 0);
Bins
WeightedEnsemble.Bins
— TypeBins{TS, TW, TBI, TT}
A bin structure designed for WE
Fields
Ω
- structure containing information for uniquely identifying each binn
- number of particles in each bintarget
- target number of particles in each binν
- weight of each bind
- auxiliary bin data
In addition to defining the Bins
data strucutre, it will also be essential to provide:
bin_id(x)
- This maps points in the state space to an integer indexing fo the bins.rebin!(E, B, t)
- This determines the bin of each particle, records this in the ensembleE.b
field, sums the weights of all particles within the bins, and updates this in the binsB.ν
field. This may be time dependent.
Several tools have been provided to simplify the construction of the bins.
WeightedEnsemble.Points_to_Bins
— FunctionPoints_to_Bins(points; d = Nothing())
Convenience function for constructing a bin structure identified by a sequence of points.
Arguments
points
- An array of points that can be used to define Voronoi cells
Optional Arguments
d = Nothing())
- optional auxliary data ``
This is useful if the bins can be sensibily identified with a set of points in the state space, as in the case of a Voronoi tesselation. Indeed, as Voronoi tesselations are often used, we have
WeightedEnsemble.setup_Voronoi_bins
— Functionsetup_Voronoi_bins(voronoi_pts; d = Nothing())
Convenience function for constructing bins, a bin id function, and a rebinning function based on a set of Voronoi points
Arguments
voronoi_pts
- User specified Voronoi cell centers
Optional Arguments
d = Nothing())
- optional auxliary data
As an example, suppose our Voronoi bins are points in $\mathbb{R}^2$, then the following code will produce all the needed functions:
voronoi_centers = [[-1.0, -2.0], [2.0, 1.0], [1.0, 0.]];
B0, bin_id, rebin! = setup_Voronoi_bins(voronoi_centers);
Samplers
WeightedEnsemble.WEsampler
— TypeWEsampler(mutation!, selection!, rebin!; analysis! = trivial_analysis!)
Arguments
mutation!
- mutation stepselection!
- selection steprebin!
- rebinning step
Optional Arguments
analysis! = trivial_analysis!
- analysis step