Struct BoltzmannHMCWalk

struct BoltzmannHMCWalk

The Hamiltonian Monte Carlo random walk, to sample from the Boltzmann distribution, i.e. e^(-c*x/T).

Public Members

parameters param
struct parameters
template<typename ConvexBody, typename RandomNumberGenerator>
struct Walk

The implementation of the walk Currently implemented only for spectrahedra with template specialization

Template Parameters:
  • ConvexBody – a convex body

  • RandomNumberGenerator

Public Types

typedef ConvexBody::PointType Point

The matrix/vector types we use.

typedef ConvexBody::MT MT
typedef ConvexBody::VT VT
typedef Point::FT NT

Public Functions

inline Walk()
inline Walk(Settings &settings)

Constructor

Parameters:

settings[in] The settings of the random walk

inline void setSettings(Settings &settings)

Change the settings

Parameters:

settings[in] The settings of the random walk

template<typename Point>
inline void apply(ConvexBody &convexbody, Point const &interiorPoint, const unsigned int pointsNum, std::list<Point> &points)

Samples random points from the convexbody from the Boltzmann distribution

Parameters:
  • convexbody[in] A convexbody

  • interiorPoint[in] A point in the interior of the convexbody

  • pointsNum[in] The number of points to sample

  • points[out] The list of the sampled points

Template Parameters:

Point – class Point with NT and VT as declared above in this class

template<typename Point>
inline void getNextPoint(ConvexBody &convexbody, VT &p)

A single step of the HMC random walk: choose a direction and walk on the trajectory for a random distance. If it hits the boundary, the trajectory is reflected. If #reflections < reflectionsBound * dimension, it returns the same point

Parameters:
  • convexbody[in] A convexbody

  • p[inout] An interior point, and the next point in the random walk

Template Parameters:

Point

inline void setTemperature(NT temperature)

Sets the temperature in the distribution

Parameters:

temperature[in] New value of temperature

Public Members

Settings settings

The parameters of the random walk.

struct Settings

A struct containing the parameters for the random walk.

Public Functions

template<typename Point>
inline Settings(const int walkLength, const RandomNumberGenerator &randomNumberGenerator, const Point &c, const NT temperature, const NT diameter, unsigned int reflectionsBound = 100, NT dl = 0.995)

Constructs an object of Settings

Parameters:
  • walkLength[in] The number of points to “burn”, before keeping the following as a sample

  • rng[in] For generating random numbers

  • c[in] The c in the distribution

  • temperature[in] The T in the distribution

  • diameter[in] The diameter of the convexbody

  • reflectionsBound[in] at each iteration allow reflectionsBound*dimension reflections at most

  • dl[in] approach the boundary with a factor of dl, for numerical stability

Returns:

An instance of this struct

inline Settings()

Public Members

int walk_length

The number of points to “burn”, before keeping the following as a sample.

RandomNumberGenerator randomNumberGenerator

For generating random numbers.

VT c

The c in the distribution.

NT temperature

The T in the distribution.

NT diameter

The diameter of the body.

unsigned int reflectionsBound

Set the number of allowed reflections at each step: #reflections < reflectionsBound * dimension.

NT dl

When determining we can move d long till we reach the boundary, we walk d*dl, for numerical stability.