makeH | R Documentation |
Construct H-representation of convex polyhedron,
set of points x
satisfying
a1 %*% x <= b1 a2 %*% x == b2
see scdd
for description of valid representations.
makeH(a1, b1, a2, b2, x = NULL)
addHeq(a, b, x)
addHin(a, b, x)
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 |
a |
numerical or character matrix for constraints. If vector,
treated as matrix with one row. Constraints are equality
in |
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.
a valid H-representation that can be handed to scdd
.
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.
scdd
, validcdd
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.