createSeedPoint | R Documentation |
Generate a seed point inside a polytope given by a set of linear constraints.
createSeedPoint(constr, homogeneous=FALSE, randomize=FALSE, method="slacklp")
constr |
Constraint definition |
homogeneous |
Whether constr is given in homogeneous coordinate representation |
randomize |
If TRUE, randomize the starting point |
method |
How to obtain the starting point: "slacklp" for a linear program that maximizes the minimum slack, or "vertices" for a weighted average of the vertices of the polytope |
See har
for a description of the constraint definition and the homogeneous coordinate representation.
The "slacklp" method solves a linear program that maximizes the minimum slack on the inequality constraints. When randomized, the slack on each constraint is randomly rescaled before maximization.
The "vertices" method enumerates all vertices of the polytope and then calculates the weighted arithmetic mean of this set of points. If ‘randomize’ is set, the weights are randomly generated, otherwise they are all equal and the generated point is the centroid of the polytope.
A coordinate vector in the appropriate coordinate system.
Gert van Valkenhoef
har
findExtremePoints
findVertices
# constraints: x_1 >= 0, x_2 >= 0, x_1 + x_2 <= 1 A <- rbind(c(-1, 0), c(0, -1), c(1, 1)) b <- c(0, 0, 1) d <- c("<=", "<=", "<=") constr <- list(constr=A, rhs=b, dir=d) x0 <- createSeedPoint(constr) stopifnot(x0 >= 0) stopifnot(sum(x0) <= 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.