bestCA: Functions in support of obtaining the best uniform CA for a...

View source: R/bestCA.R

bestCAR Documentation

Functions in support of obtaining the best uniform CA for a combination of t, k and v

Description

Function bestCA uses function Ns to find the best currently implemented CA for the requested scenario. Function bestN just retrieves the best achievable run size. The other exported functions retrieve actual arrays from stored collections of arrays, either within the package or on the internet.

Usage

bestCA(t, k, v, maxN=1000000,
  fixNA=TRUE, seed=NULL, exclude=NULL,
  noderive=FALSE,
  nofuse=FALSE, maxfuse=NULL,
  noadd1=FALSE, maxadd1=1, ...)

bestN(t, k, v, internet=TRUE, exclude=NULL,
  noderive=FALSE,
  nofuse=FALSE, maxfuse=NULL,
  noadd1=FALSE, maxadd1=1, ...)

ckrsCA(t, k, v, ...)

wksCA(t, k, v, ...)

dwyerCA(t, k, v, ...)

nistCA(t, k, v, ...)

tjCA(t, k, v, ...)

Arguments

t

integer: the strength

k

integer: the number of columns

v

integer: the number of levels for each column

maxN

integer: the largest number of runs N for which an array is desired; if the smallest possible N is larger, an error is thrown; default: 1000000 (too large for being created in reasonable time on most computers)

fixNA

logical: should flexible values be fixed?
If the ingoing CA has flexible values, fixNA=TRUE randomly assigns a fixed value to each flexible value.
Thus, a seed is needed for reproducibility.

seed

NULL or an integer seed for making the fixing of NA values reproducible; a non-NULL seed is stored in the attribute fixNA_seed of the returned object.

exclude

NULL or a character vector of method(s) to exclude, in support of size calculations for recursive constructions which need to calculate sizes of best ingredients

noderive

logical; if TRUE, derived designs are not considered

nofuse

logical; if TRUE, fused designs are not considered

maxfuse

maximum number of fuse steps considered; NULL (default) uses the distance to the next larger prime power

noadd1

logical; if TRUE, designs obtained by adding columns with add1Column are not considered

maxadd1

maximum number of add1Column steps considered

...

currently not used

internet

logical; if FALSE, methods whose designs need an internet connection are excluded

Value

bestN returns a named integer: the first method that yields the smallest implemented size.
The other functions return a matrix of class ca, which is a uniform covering array of strength at least t with k columns at v levels.

Details

Function bestCA uses function Ns for locating the best construction for the given scenario, and subsequently implements the first such construction, where the order is that returned by function Ns.

Some constructions ("DWYER" and "NIST") require an internet connection, because the respective CAs are not part of the package.

Some constructions provide CAs with flexible values, which are denoted as NA values in package CAs. These need to be fixed for actual experimentation, and function bestCA fixes them randomly; in such cases, the returned object has an attribute fixNA_seed, which is either the seed that was specified by the user or a seed that was created by the function. Specifying the seed in a subsequent call to the function permits to get the same CA again (provided that no new smaller CAs have been implemented).

The attributes of the returned object contain elements eCAN, CAs-version and date: eCAN gives the current best array, which is from the most recent internet source, if available; the eCAN attribute has the information appended, whether or not a frozen state from the package had to be used. As the best array (and the frozen state) may change, the other attributes provide the context.

See Also

Ns()

Examples

# example with a single best construction
Ns(2,12,4)
bestCA(2,12,4)
# example with three best constructions
Ns(4,8,2)
# bestCA uses the leftmost
bestCA(4,8,2)

Ns(3, 1500, 2)
## powerCT is best
attributes(bestCA(3, 1500, 2))
## it is, of course, also possible to directly use the
## construction functions, in this case powerCA with type="CT".

# a case that is not implemented (would be huge)
Ns(6, 5000, 10)
try(bestCA(6, 5000, 10))

Ns(3, 50, 2)
## DWYER needs internet connection,
## as earlier in list, TJ is preferred
D <- bestCA(3, 50, 2)
dim(D)
# coverage(D, 3)

Ns(6, 50, 2)
## WKS is the only best
D <- bestCA(6, 50, 2)
dim(D)

## fusing is far better than direct construction

## slow, yields 8187 runs by fusing an 8191 run cphfCA
## in 16 levels twice
Ns(3,37,14)
Ns_fuse(3,37,14,maxfuse=2)
bestN(3,37,14)


Ns(3,9,7)
## CKRS and DWYER are best
D <- bestCA(3, 9, 7)
dim(D)

Ns(3,9,6)
## CKRS is best implemented, but 18 runs worse than eCAN
eCAN(3,9,6)
## Torres-Jimenez designs are currently (Sep 2025) unavailable
D <- bestCA(3, 9, 6)
attributes(D)

Ns(3,9,5)
## CK_NRB is the unique best
ks(3,185,5)

Ns(2,26,24) ## fuseBose is best-known
dim(bestCA(2,26,24))

Ns(2,26,23) ## fuseBushtCA is best implemented,
            ## projBoseCA is close
dim(D <- bestCA(2,26,23))
attributes(D)
## eCAN from NCK post processing of projBose
## (removes 7 runs)
eCAN(2,26,23)

Ns(3,6,12)
## the optimum Ji and Yin OA is in the package as oa1728.12.6


## this code needs an internet connection
## and is therefore wrapped in \donttest
## and in try
   try(dim(nistCA(3,5,4)))



CAs documentation built on Nov. 29, 2026, 1:06 a.m.