decomposeArbFLSSS | R Documentation |
Decompose an arbFLSSS
instance into sub-problems for distributed computing.
decomposeArbFLSSS( len, V, target, approxNinstance = 1000L, maxCore = 7L, ksumTable = NULL, ksumK = 4L, ksumTableSizeScaler = 30L, verbose = TRUE )
len |
See the same argument in |
V |
See the same argument in |
target |
See the same argument in |
approxNinstance |
See the same argument in |
maxCore |
See the same argument in |
ksumTable |
Either |
ksumK |
See the same argument in |
ksumTableSizeScaler |
See the same argument in |
verbose |
See the same argument in |
The rationale follows decomposeMflsss()
. The pair decomposeArbFLSSS()
and arbFLSSSobjRun()
makes up the distributed computing counterpart of arbFLSSS()
.
A list of two:
$arbFLSSSobjects
: a list. Each element is an arbFLSSS
object that would be supplied to arbFLSSSobjRun()
.
$solutionsFound
: a list. Solutions found during decomposition.
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) 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.