shrink_into_CH: Identify the position of a point relative to the convex hull...

View source: R/is.inCH.R

shrink_into_CHR Documentation

Identify the position of a point relative to the convex hull of a set of points

Description

This function uses linear programming to find the value by which vector p needs to be scaled towards or away from vector m in order for p to be on the boundary of the convex hull of rows of M. If p is a matrix, a value that scales all rows of p into the convex hull of M is found.

Usage

shrink_into_CH(
  p,
  M,
  m = NULL,
  verbose = FALSE,
  max_run = nrow(M),
  ...,
  solver = c("glpk", "lpsolve")
)

Arguments

p

a d-dimensional vector or a matrix with d columns.

M

an n by d matrix. Each row of M is a d-dimensional vector.

m

a d-dimensional vector specifying the value towards which to shrink; must be in the interior of the convex hull of M, and defaults to its centroid (column means).

verbose

A logical or an integer to control the amount of progress and diagnostic information to be printed. FALSE/0 produces minimal output, with higher values producing more detail. Note that very high values (5+) may significantly slow down processing.

max_run

if there are no decreases in step length in this many consecutive test points, conclude that diminishing returns have been reached and finish.

...

arguments passed directly to linear program solver.

solver

a character string selecting which solver to use; by default, tries Rglpk's but falls back to lpSolveAPI's.

Value

The scaling factor described above is returned. shrink_into_CH() >= 1 indicates that all points in p are in the convex hull of M.

Note

This is a successor to the deprecated function is.inCH(), which was originally written for the "stepping" algorithm of \insertCiteHuHu12i;textualergm. See the updated of \insertCiteKrKu23l;textualergm for detailed discussion of algorithms used in is.inCH() and shrink_into_CH().

References

\insertAllCited

https://www.cs.mcgill.ca/~fukuda/soft/polyfaq/node22.html


statnet/ergm documentation built on April 17, 2024, 12:21 p.m.