makeH: make H-representation of convex polyhedron

View source: R/makeH.R

makeHR Documentation

make H-representation of convex polyhedron

Description

Construct H-representation of convex polyhedron, set of points x satisfying

    a1 %*% x <= b1
    a2 %*% x == b2

see scdd for description of valid representations.

Usage

makeH(a1, b1, a2, b2, x = NULL)
addHeq(a, b, x)
addHin(a, b, x)

Arguments

a1

numerical or character matrix for inequality constraints. If vector, treated as matrix with one row.

b1

numerical or character right hand side vector for inequality constraints.

a2

numerical or character matrix for equality constraints. If vector, treated as matrix with one row.

b2

numerical or character right hand side vector for equality constraints.

x

if not NULL, a valid H-representation.

a

numerical or character matrix for constraints. If vector, treated as matrix with one row. Constraints are equality in addHeq and inequality in addHin.

b

numerical or character right hand side vector for constraints.

Arguments a1, b1, a2, and b2 may be missing, but must be missing in pairs. Rows in x, if any, are added to new rows corresponding to the constraints given by the other arguments.

Value

a valid H-representation that can be handed to scdd.

Rational Arithmetic

The input representation may have type "character" in which case its elements are interpreted as unlimited precision rational numbers. They consist of an optional minus sign, a string of digits of any length (the numerator), a slash, and another string of digits of any length (the denominator). The denominator must be positive. If the denominator is one, the slash and the denominator may be omitted. This package provides several functions (see ConvertGMP and ArithmeticGMP) for conversion back and forth between R floating point numbers and rationals and for arithmetic on GMP rationals.

Arguments may be a mix of numeric and character in which case all are converted to GMP rationals (character) and the output is GMP rational.

See Also

scdd, validcdd

Examples

d <- 4
# unit simplex in H-representation
qux <- makeH(- diag(d), rep(0, d), rep(1, d), 1)
print(qux)
# add an inequality constraint
qux <- addHin(c(1, -1, 0, 0), 0, qux)
print(qux)
# drop a constraint
qux <- qux[- 3, ]
print(qux)

rcdd documentation built on May 29, 2024, 2:21 a.m.