set.seed(42)
d = 5L # Set dimension.
N = 60L # Set size.
len = 10L # Subset size.
roundN = 2L # For rounding the numeric values before conversion to strings.
V = matrix(round(runif(N * d, -1e5, 1e5), roundN), nrow = N) # Make superset.
sol = sample(N, len) # Make a solution.
target = round(colSums(V[sol, ]), roundN) # Target subset sum.
optionSave = options()
options(scipen = 999) # Ensure numeric => string conversion does not
# produce strings like 2e-3.
Vstr = matrix(as.character(V), nrow = N) # String version of V.
targetStr = as.character(target)
# ==============================================================================
# Uncomment the block below since it takes a few seconds to run, which
# does not pass CRAN's Valgrind test.
# ==============================================================================
# system.time({
# theDecomposed = FLSSS::decomposeArbFLSSS(
# len = len, V = Vstr, target = targetStr, approxNinstance = 1000,
# maxCore = 2, ksumTable = NULL, ksumK = 4, verbose = TRUE)
# })
#
#
# # Check if any solution has been found during decomposition.
# str(theDecomposed$solutionsFound)
#
#
# # Check the first arbFLSSS object.
# str(theDecomposed$arbFLSSSobjects[[1]])
#
#
# options(optionSave)
Run the code above in your browser using DataLab