inside {multinomineq} | R Documentation |
Check Whether Points are Inside a Convex Polytope
Description
Determines whether a point x
is inside a convex poltyope by checking whether
(1) all inequalities A*x <= b
are satisfied or
(2) the point x
is in the convex hull of the vertices in V
.
Usage
inside(x, A, b, V)
Arguments
x |
a vector of length equal to the number of columns of |
A |
a matrix with one row for each linear inequality constraint and one
column for each of the free parameters. The parameter space is defined
as all probabilities |
b |
a vector of the same length as the number of rows of |
V |
a matrix of vertices (one per row) that define the polytope of
admissible parameters as the convex hull over these points
(if provided, |
See Also
Ab_to_V
and V_to_Ab
to change between A/b and V representation.
Examples
# linear order constraints: x1<x2<x3<.5
A <- matrix(c(
1, -1, 0,
0, 1, -1,
0, 0, 1
), ncol = 3, byrow = TRUE)
b <- c(0, 0, .50)
# vertices: admissible points (corners of polytope)
V <- matrix(c(
0, 0, 0,
0, 0, .5,
0, .5, .5,
.5, .5, .5
), ncol = 3, byrow = TRUE)
xin <- c(.1, .2, .45) # inside
inside(xin, A, b)
inside(xin, V = V)
xout <- c(.4, .1, .55) # outside
inside(xout, A, b)
inside(xout, V = V)