The function is a wrapper around expand.grid and generates the full factorial given the supplied attributes. The attributes can either be specified directly by the user or extracted from the list of utility functions using.

full_factorial(attrs)

Arguments

attrs

A named list of attributes and their levels

Value

A matrix containing the full factorial

Details

The full factorial is often used as the starting point to generate a candidate set. Note that the full factorial will include unrealistic and completely dominated alternatives. It is therefore advised to use a subset of the full factorial as a candidate set. The user can call full_factorial and create a subset that is passed to generate_design using the `candidate_set` parameter, or supply a set of restrictions through the `restrictions` argument.

Examples

opts <- list(
  level_balance = FALSE,
  tasks = 10
)
attrs <- list(
  a1 = 1:5,
  a2 = c(0, 1)
)

full_factorial(attrs)
#>    a1 a2
#> 1   1  0
#> 2   2  0
#> 3   3  0
#> 4   4  0
#> 5   5  0
#> 6   1  1
#> 7   2  1
#> 8   3  1
#> 9   4  1
#> 10  5  1

V <- list(
  alt1 = "b_a1[0.1] * a1[1:5] + b_a2[-2] * a2[c(0, 1)]",
  alt2 = "b_a1      * a1      + b_a2     * a2"
)

attrs <- expand_attribute_levels(V)
full_factorial(attrs)
#>     alt1_a1 alt1_a2 alt2_a1 alt2_a2
#> 1         1       0       1       0
#> 2         2       0       1       0
#> 3         3       0       1       0
#> 4         4       0       1       0
#> 5         5       0       1       0
#> 6         1       1       1       0
#> 7         2       1       1       0
#> 8         3       1       1       0
#> 9         4       1       1       0
#> 10        5       1       1       0
#> 11        1       0       2       0
#> 12        2       0       2       0
#> 13        3       0       2       0
#> 14        4       0       2       0
#> 15        5       0       2       0
#> 16        1       1       2       0
#> 17        2       1       2       0
#> 18        3       1       2       0
#> 19        4       1       2       0
#> 20        5       1       2       0
#> 21        1       0       3       0
#> 22        2       0       3       0
#> 23        3       0       3       0
#> 24        4       0       3       0
#> 25        5       0       3       0
#> 26        1       1       3       0
#> 27        2       1       3       0
#> 28        3       1       3       0
#> 29        4       1       3       0
#> 30        5       1       3       0
#> 31        1       0       4       0
#> 32        2       0       4       0
#> 33        3       0       4       0
#> 34        4       0       4       0
#> 35        5       0       4       0
#> 36        1       1       4       0
#> 37        2       1       4       0
#> 38        3       1       4       0
#> 39        4       1       4       0
#> 40        5       1       4       0
#> 41        1       0       5       0
#> 42        2       0       5       0
#> 43        3       0       5       0
#> 44        4       0       5       0
#> 45        5       0       5       0
#> 46        1       1       5       0
#> 47        2       1       5       0
#> 48        3       1       5       0
#> 49        4       1       5       0
#> 50        5       1       5       0
#> 51        1       0       1       1
#> 52        2       0       1       1
#> 53        3       0       1       1
#> 54        4       0       1       1
#> 55        5       0       1       1
#> 56        1       1       1       1
#> 57        2       1       1       1
#> 58        3       1       1       1
#> 59        4       1       1       1
#> 60        5       1       1       1
#> 61        1       0       2       1
#> 62        2       0       2       1
#> 63        3       0       2       1
#> 64        4       0       2       1
#> 65        5       0       2       1
#> 66        1       1       2       1
#> 67        2       1       2       1
#> 68        3       1       2       1
#> 69        4       1       2       1
#> 70        5       1       2       1
#> 71        1       0       3       1
#> 72        2       0       3       1
#> 73        3       0       3       1
#> 74        4       0       3       1
#> 75        5       0       3       1
#> 76        1       1       3       1
#> 77        2       1       3       1
#> 78        3       1       3       1
#> 79        4       1       3       1
#> 80        5       1       3       1
#> 81        1       0       4       1
#> 82        2       0       4       1
#> 83        3       0       4       1
#> 84        4       0       4       1
#> 85        5       0       4       1
#> 86        1       1       4       1
#> 87        2       1       4       1
#> 88        3       1       4       1
#> 89        4       1       4       1
#> 90        5       1       4       1
#> 91        1       0       5       1
#> 92        2       0       5       1
#> 93        3       0       5       1
#> 94        4       0       5       1
#> 95        5       0       5       1
#> 96        1       1       5       1
#> 97        2       1       5       1
#> 98        3       1       5       1
#> 99        4       1       5       1
#> 100       5       1       5       1