sample_points {volesti}R Documentation

Sample uniformly or normally distributed points from a convex Polytope (H-polytope, V-polytope, zonotope or intersection of two V-polytopes).

Description

Sample n points with uniform or multidimensional spherical gaussian -with a mode at any point- as the target distribution.

Usage

sample_points(P, n, random_walk = NULL, distribution = NULL)

Arguments

P

A convex polytope. It is an object from class (a) Hpolytope or (b) Vpolytope or (c) Zonotope or (d) VpolytopeIntersection.

n

The number of points that the function is going to sample from the convex polytope.

random_walk

Optional. A list that declares the random walk and some related parameters as follows:

  • walk A string to declare the random walk: i) 'CDHR' for Coordinate Directions Hit-and-Run, ii) 'RDHR' for Random Directions Hit-and-Run, iii) 'BaW' for Ball Walk, iv) 'BiW' for Billiard walk, v) 'BCDHR' boundary sampling by keeping the extreme points of CDHR or vi) 'BRDHR' boundary sampling by keeping the extreme points of RDHR. The default walk is 'BiW' for the uniform distribution or 'CDHR' for the Gaussian distribution.

  • walk_length The number of the steps per generated point for the random walk. The default value is 1.

  • nburns The number of points to burn before start sampling.

  • starting_point A d-dimensional numerical vector that declares a starting point in the interior of the polytope for the random walk. The default choice is the center of the ball as that one computed by the function inner_ball().

  • BaW_rad The radius for the ball walk.

  • L The maximum length of the billiard trajectory.

  • seed A fixed seed for the number generator.

distribution

Optional. A list that declares the target density and some related parameters as follows:

  • density A string: (a) 'uniform' for the uniform distribution or b) 'gaussian' for the multidimensional spherical distribution. The default target distribution is uniform.

  • variance The variance of the multidimensional spherical gaussian. The default value is 1.

  • mode A d-dimensional numerical vector that declares the mode of the Gaussian distribution. The default choice is the center of the as that one computed by the function inner_ball().

Value

A d\times n matrix that contains, column-wise, the sampled points from the convex polytope P.

Examples

# uniform distribution from the 3d unit cube in H-representation using ball walk
P = gen_cube(3, 'H')
points = sample_points(P, n = 100, random_walk = list("walk" = "BaW", "walk_length" = 5))

# gaussian distribution from the 2d unit simplex in H-representation with variance = 2
A = matrix(c(-1,0,0,-1,1,1), ncol=2, nrow=3, byrow=TRUE)
b = c(0,0,1)
P = Hpolytope(A = A, b = b)
points = sample_points(P, n = 100, distribution = list("density" = "gaussian", "variance" = 2))

# uniform points from the boundary of a 2-dimensional random H-polytope
P = gen_rand_hpoly(2,20)
points = sample_points(P, n = 100, random_walk = list("walk" = "BRDHR"))


[Package volesti version 1.1.2-7 Index]