Skip to content

Commit

Permalink
strr_ghost bug fixes for extremely complex overlapping buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
dwachsmuth committed Jul 6, 2023
1 parent 2d9da94 commit d960ca3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions R/strr_ghost.R
Original file line number Diff line number Diff line change
Expand Up @@ -615,10 +615,17 @@ ghost_combine <- function(buffers, predicates, n) {
}) %>%
unique()

# Test if only a single valid combination could exist, and exit if so
if (length(combinations) == 1) return(
dplyr::tibble(value = combinations[[1]]))

# Test if reducer will be necessary to avoid too many combinations
while (sum(purrr::map_dbl(combinations, ~{
factorial(length(.)) / {factorial(n) * factorial(length(.) - n)}
})) > 100000) {
while (
is.nan(sum(purrr::map_dbl(combinations, ~{
factorial(length(.)) / {factorial(n) * factorial(length(.) - n)}
}))) || sum(purrr::map_dbl(combinations, ~{
factorial(length(.)) / {factorial(n) * factorial(length(.) - n)}
})) > 100000) {

# Establish collective centroid
if (length(invalid_pr) > 0) {
Expand Down

0 comments on commit d960ca3

Please sign in to comment.