inst/tinytest/test-optimal-clustering.R

library(tinytest)
library(anticlust)

N <- 12
M <- 5
K <- 2
dat <- matrix(rnorm(N * M), ncol = M)

# just make sure that all runs okay
balanced_clustering(dat, K, method = "ilp", solver = "glpk")

expect_error(
  balanced_clustering(dat, K = 5, method = "ilp", solver = "glpk")
)

expect_error(
  balanced_clustering(dat, K = c(2, 2, 2, 6), method = "ilp", solver = "glpk")
)

expect_error(
  balanced_clustering(dat, K = 5, method = "ilp", solver = "FOO")
)

Try the anticlust package in your browser

Any scripts or data that you put into this service are public.

anticlust documentation built on April 4, 2025, 1:03 a.m.