enumerate.vertices: Enumerate the vertices of a polytope.

Description Usage Arguments Value Note Author(s) Examples

Description

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

Usage

1
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.

Note

This is a port of the lrs library for vertex enumeration (http://cgm.cs.mcgill.ca/~avis/C/lrs.html). The source was written by David Avis.

Author(s)

Robert Robere robere@cs.toronto.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
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)

Example output

     [,1] [,2]
[1,]    1    0
[2,]    0    0
[3,]    1    1
[4,]    0    1
[1] "Input system contains an extreme ray."
     [,1] [,2]
[1,]    0    0
[2,]    0    1

vertexenum documentation built on May 2, 2019, 9:24 a.m.