
Begin A Greedy Pair Switching Search
Source:R/greedy_search.R
initGreedyExperimentalDesignObject.RdThis method creates an object of type greedy_experimental_design and will immediately initiate
a search through allocation space for forced balance designs. For debugging, you can use set the seed
parameter and num_cores = 1 to be assured of deterministic output.
Usage
initGreedyExperimentalDesignObject(
X = NULL,
nT = NULL,
max_designs = 10000,
objective = "mahal_dist",
indicies_pairs = NULL,
Kgram = NULL,
wait = FALSE,
start = TRUE,
max_iters = Inf,
semigreedy = FALSE,
diagnostics = FALSE,
num_cores = 1,
seed = NULL,
verbose = TRUE,
use_safe_inverse = FALSE
)Arguments
- X
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. This parameter must be specified unless you choose objective type
"kernel"in which case, theKgramparameter must be specified.- nT
The number of treatments to assign. Default is
NULLwhich is for forced balance allocation i.e. nT = nC = n / 2 where n is the number of rows in X (or Kgram if X is unspecified).- max_designs
The maximum number of designs to be returned. Default is 10,000. Make this large so you can search however long you wish as the search can be stopped at any time by using the
stopSearchmethod- objective
The objective function to use when searching design space. This is a string with valid values "
mahal_dist" (the default), "abs_sum_diff" or "kernel".- indicies_pairs
A matrix of size $n/2$ times 2 whose rows are indicies pairs. The values of the entire matrix must enumerate all indicies $1, ..., n$. The default is
NULLmeaning to use all possible pairs.- Kgram
If the
objective = kernel, this argument is required to be ann x nmatrix whose entries are the evaluation of the kernel function between subject i and subject j. Default isNULL.- wait
Should the
Rterminal hang until allmax_designsvectors are found? The deafult isFALSE.- start
Should we start searching immediately (default is
TRUE).- max_iters
Should we impose a maximum number of greedy switches? The default is
Infwhich a flag for “no limit.”- semigreedy
Should we use a fully greedy approach or the quicker semi-greedy approach? The default is
FALSEcorresponding to the fully greedy approach.- diagnostics
Returns diagnostic information about the iterations including (a) the initial starting vectors, (b) the switches at every iteration and (c) information about the objective function at every iteration (default is
FALSEto decrease the algorithm's run time).- num_cores
The number of CPU cores you wish to use during the search. The default is
1.- seed
The set to set for deterministic output. This should only be set if
num_cores = 1otherwise the output will not be deterministic. Default isNULLfor no seed set.- verbose
Should the algorithm emit progress output? Default is
TRUE.- use_safe_inverse
Should a regularized inverse be used for the Mahalanobis objective? Default is
FALSE.