identify_needed: Identifying needed and redundant elements of SeqCAs

View source: R/identify_needed.R

identify_neededR Documentation

Identifying needed and redundant elements of SeqCAs

Description

from a given SeqCA A and its strength t

Usage

identify_needed(A, t, ...)

Arguments

A

a sequence covering array (SeqCA) with k columns and elements 1,...,k in each row

t

the strength for which the coverage of all permutations of length t must be guaranteed for all combn(k,t) t-element subsets of 1,...,k

...

currently not used

Value

a logical matrix of the same dimensions as A with TRUE for needed values and FALSE for values that can be moved.

The meanings of TRUE and FALSE in the resulting matrix

In an SeqCA of strength t, it is guaranteed that all orders of all t-tuples of elements of 1,...,k are covered; the ordered tuples are also counted as covered if they are interleaved by other values. For example, the sequence 1->4->3->2->5 covers the 3-sequence 1->3->5. The run 14325 covers choose(5,3)=10 3-sequences, and each of its elements is part of six of these. If all six such sequences are already covered in earlier runs, the element is marked as redundant (FALSE), otherwise it is needed (TRUE); for example, if the sequences 1->4->3, 1->4->2, 1->4->5, 4->3->2, 4->3->5, 4->2->5 were already covered by earlier runs, the position of the "4" becomes FALSE. Thus, if the position is TRUE, these sequences might still be covered by later runs, but are not guaranteed to.

Use of AI

Claude 4 was involved in the development of this function.

Examples

### create a trivial SeqCA of strength 2
A <- rbind(1:5, 5:1)
identify_needed(A,2)

## a naive greedy SeqCA
A <- greedySeqCA_naive(5, 3, seed=2323, postop=FALSE)
dim(A)
## identify the necessary elements
(neededs <- identify_needed(A,3))
## there are various FALSE-only rows
## remove those
A <- A[!rowSums(neededs)==0,]
neededs <- neededs[!rowSums(neededs)==0,]
dim(A)
## all sequences are still covered
(cove <- coverageSeqCA(A, 3))
## the count_effective attribute of cove shows
## that the last three rows are only needed for 1 sequence each
attr(cove, "count_effective")
## correspondingly, two elements of each of those rows are redundant
neededs
A[11:13,]
## row 11 is needed for the sequence 3->1->4,
## row 12 for the sequence 5->4->3,
## and row 13 for the sequence 5->1->4


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