Python Sparse Random Walks

class polytopewalk.sparse.SparseRandomWalk(self: polytopewalk.sparse.SparseRandomWalk, err: float = 1e-06)

Bases: pybind11_object

Sparse Random Walk Super Class Implementation.

Initialization for Sparse Random Walk Super Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:

err (double, optional) – Constant for error term term (default is 1e-6).

generateCompleteWalk(self: polytopewalk.sparse.SparseRandomWalk, niter: int, init: numpy.ndarray[numpy.float64[m, 1]], A: scipy.sparse.csc_matrix[numpy.float64], b: numpy.ndarray[numpy.float64[m, 1]], k: int, burnin: int = 0, thin: int = 1, seed: int = -1) numpy.ndarray[numpy.float64[m, n]]

Generate values from Sparse Random Walk (virtual function).

Parameters:
  • niter (int) – Number of steps to sample from.

  • init (numpy.ndarray) – Initial point to start sampling from.

  • A (numpy.ndarray) – Constraint matrix.

  • b (numpy.ndarray) – Constraint vector.

  • k (int) – Dimensionality of polytope.

  • burnin (int, optional) – Constant for how many to exclude initially (default is 0).

  • thin (int, optional) – Number of samples to thin (default is 1).

  • seed (int, optional) – Seed number for reproducibility (default is -1 meaning no fixed setting).

Returns:

List of sampled points.

Return type:

numpy.ndarray

class polytopewalk.sparse.SparseBarrierWalk(self: polytopewalk.sparse.SparseBarrierWalk, r: float = 0.5, err: float = 1e-06)

Bases: SparseRandomWalk

Sparse Barrier Walk Implementation.

Initialization for Sparse Barrier Walk Super Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:
  • r (double, optional) – Radius for starting distance (default is 0.5).

  • err (double, optional) – Constant for error term in g^{-1}(x) (default is 1e-6).

generateCompleteWalk(self: polytopewalk.sparse.SparseBarrierWalk, niter: int, init: numpy.ndarray[numpy.float64[m, 1]], A: scipy.sparse.csc_matrix[numpy.float64], b: numpy.ndarray[numpy.float64[m, 1]], k: int, burnin: int = 0, thin: int = 1, seed: int = -1) numpy.ndarray[numpy.float64[m, n]]

Generate values from Sparse Barrier Walk.

Parameters:
  • niter (int) – Number of steps to sample from.

  • init (numpy.ndarray) – Initial point to start sampling from.

  • A (numpy.ndarray) – Constraint matrix.

  • b (numpy.ndarray) – Constraint vector.

  • k (int) – Dimensionality of polytope.

  • burnin (int, optional) – Constant for how many to exclude initially (default is 0).

  • thin (int, optional) – Number of samples to thin (default is 1).

  • seed (int, optional) – Seed number for reproducibility (default is -1 meaning no fixed setting).

Returns:

List of sampled points.

Return type:

numpy.ndarray

generateWeight(self: polytopewalk.sparse.SparseBarrierWalk, x: numpy.ndarray[numpy.float64[m, 1]], A: scipy.sparse.csc_matrix[numpy.float64], k: int) numpy.ndarray[numpy.float64[m, 1]]

Generate weight from Sparse Barrier Walk (virtual function).

Parameters:
  • x (numpy.ndarray) – Point inside polytope.

  • A (numpy.ndarray) – Constraint matrix.

  • k (int) – Dimensionality of polytope.

Returns:

Weight vector (specified by walk type).

Return type:

numpy.ndarray

class polytopewalk.sparse.SparseDikinWalk(self: polytopewalk.sparse.SparseDikinWalk, r: float = 0.5, err: float = 1e-06)

Sparse Dikin Walk Implementation.

Initialization for Sparse Dikin Walk Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:
  • r (double, optional) – Radius for Dikin Ellipsoid (default is 0.5).

  • err (double, optional) – Constant for error term in g^{-1}(x) (default is 1e-6).

class polytopewalk.sparse.SparseVaidyaWalk(self: polytopewalk.sparse.SparseVaidyaWalk, r: float = 0.5, err: float = 1e-06)

Sparse Vaidya Walk Implementation.

Initialization for Sparse Vaidya Walk Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:
  • r (double, optional) – Radius for Vaidya Ellipsoid (default is 0.5).

  • err (double, optional) – Constant for error term in g^{-1}(x) (default is 1e-6).

class polytopewalk.sparse.SparseJohnWalk(self: polytopewalk.sparse.SparseJohnWalk, r: float = 0.5, lim: float = 1e-05, max_iter: int = 1000, err: float = 1e-06)

Sparse John Walk Implementation.

Initialization for Sparse John Walk Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:
  • r (double, optional) – Radius for John Ellipsoid (default is 0.5).

  • lim (double, optional) – Constant for stopping limit in fixed-point iteration (default is 1e-5).

  • max_iter (int, optional) – Constant for maximum number of fixed point iterations (default is 1000).

  • err (double, optional) – Constant for error term in g^{-1}(x) (default is 1e-6).

class polytopewalk.sparse.SparseDikinLSWalk(self: polytopewalk.sparse.SparseDikinLSWalk, r: float = 0.5, g_lim: float = 0.01, step_size: float = 0.1, max_iter: int = 1000, err: float = 1e-06)

Sparse Lee Sidford Walk Implementation.

Initialization for Sparse Lee Sidford Walk Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:
  • r (double, optional) – Radius for Lee-Sidford Ellipsoid (default is 0.5).

  • g_lim (double, optional) – Constant for stopping gradient norm in gradient descent (default is 0.01).

  • step_size (double, optional) – Constant for step size in gradient descent (default is 0.1).

  • max_iter (int, optional) – Constant for maximum number of gradient descent iterations (default is 1000).

  • err (double, optional) – Constant for error term in g^{-1}(x) (default is 1e-6).

class polytopewalk.sparse.SparseBallWalk(self: polytopewalk.sparse.SparseBallWalk, r: float = 0.5)

Sparse Ball Walk Implementation.

Initialization for Sparse Ball Walk Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:

r (double, optional) – Radius for ball (default is 0.5).

class polytopewalk.sparse.SparseHitAndRun(self: polytopewalk.sparse.SparseHitAndRun, r: float = 0.5, err: float = 0.01)

Sparse Hit and Run Implementation.

Initialization for Sparse Hit and Run Class. Runs on Constrained Polytope Form: Ax = b, x >=_k 0.

Parameters:
  • r (double, optional) – Radius for starting distance (default is 0.5).

  • err (double, optional) – Constant for closeness to edge of polytope (default is 0.01).