Learn R Programming

vertexenum (version 1.0.2)

enumerate.vertices: Enumerate the vertices of a polytope.

Description

Returns a d by n + 1 dimensional matrix representing the d vertices of the polytope represented by Ax <= b.

Usage

enumerate.vertices(A, b, warn_if_open=FALSE)

Arguments

A

An m by n matrix.

b

A m by 1 vector.

warn_if_open

Boolean.

Value

A d by n + 1 dimensional matrix. The rows of this matrix represent the d vertices of the polytope represented by the system Ax <= b. If the optional argument warn_if_open is set to TRUE, then a warning will be printed if the system of inequalities is not closed, i.e. if it contains an extreme ray.

Examples

Run this code
# NOT RUN {
library(vertexenum)
## example vertex enumeration
## the system Ax <= b represents a unit square, with
## the lower left corner at the origin

A <- rbind(c(-1, 0), c(0, 1), c(1, 0), c(0, -1))
b <- c(0, 1, 1, 0)
## outputs a 4 x 2 matrix, each row corresponds to a vertex
enumerate.vertices(A, b)

## second example
## this is a unit square, with lower left corner at the origin, missing
## a facet on the right side
A <- rbind(c(-1, 0), c(0, 1), c(0, -1))
b <- c(0, 1, 0)

## outputs a 2 x 2 matrix, each row corresponds to a vertex
## will print a warning, since the input set described by Ax <= b
## is not closed
enumerate.vertices(A, b, warn_if_open=TRUE)
# }

Run the code above in your browser using DataLab