# Enumerate orthogonal arrays

The Orthogonal Array package can completely enumerate all orthogonal arrays of a specified class. In this notebook, we enumerate specific classes of three-level orthogonal arrays and mixel-level orthogonal arrays.

First, we specify the class of three-level orthogonal arrays to enumerate. For example, we consider three-level orthogonal arrays of strength 2 with 27 runs and 8 factors.

[1]:

import oapackage
run_size = 27
strength=2
number_of_factors=8
factor_levels = 3
arrayclass=oapackage.arraydata_t(factor_levels, run_size, strength, number_of_factors)
print(arrayclass)

arrayclass: N 27, k 8, strength 2, s {3,3,3,3,3,3,3,3}, order 0


Second, we create the root array as the starting point of our enumeration.

[2]:

ll2=[arrayclass.create_root()]
ll2[0].showarraycompact()

00
00
00
01
01
01
02
02
02
10
10
10
11
11
11
12
12
12
20
20
20
21
21
21
22
22
22


Third, extend the root array. It is also possible to extend a list of arrays.

[3]:

list3columns = oapackage.extend_arraylist(ll2, arrayclass)
print('extended to %d arrays with 3 columns' % len(list3columns))
list4columns = oapackage.extend_arraylist(list3columns, arrayclass)
print('extended to %d arrays with 4 columns' % len(list4columns))

extended to 9 arrays with 3 columns
extended to 711 arrays with 4 columns


It is also possible to extend selected arrays from a list.

[4]:

ll = oapackage.extend_arraylist(list4columns[0:8], arrayclass)
print('extended first 2 arrays to %d arrays with 5 columns' % len(ll))

extended first 2 arrays to 189 arrays with 5 columns


By adding one column at a time we can enumerate all three-level orthogonal arrays of strength 2 with 27 runs and 8 factors. The total computation time for this would be a couple of hours.

## Mixed-level orthogonal arrays

The package can also enumerate mixed-level orthogonal arrays. For instance, consider enumerating all 16-run strength-2 orthogonal arrays with one four-level factor and nine two-level factors.

[9]:

run_size = 16
strength=2
number_of_factors = 10
factor_levels=[4,2,2,2,2,2,2,2,2,2]
arrayclass=oapackage.arraydata_t(factor_levels, run_size, strength, number_of_factors)
print(arrayclass)

arrayclass: N 16, k 10, strength 2, s {4,2,2,2,2,2,2,2,2,2}, order 0


Create the root array as the starting point of our enumeration.

[10]:

al=arrayclass.create_root()
al.showarraycompact()

00
00
01
01
10
10
11
11
20
20
21
21
30
30
31
31


For these arrays, we can extend a single array or lists of arrays.

[14]:

array_list=[arrayclass.create_root()]
array_list_3columns=oapackage.extend_arraylist(array_list, arrayclass)
array_list_4columns=oapackage.extend_arraylist(array_list_3columns, arrayclass)
print('extended to %d arrays with 3 columns' % len(array_list_3columns))
print('extended to %d arrays with 4 columns' % len(array_list_4columns))

extended to 3 arrays with 3 columns
extended to 10 arrays with 4 columns


Finally, enumerate all 16-run strength-2 orthogonal arrays with one four-level factor and nine two-level factors.

[15]:

arrays = array_list_4columns
for extension_column in range(5, number_of_factors+1):
extensions=oapackage.extend_arraylist(arrays, arrayclass)
print('extended to %d arrays with %d columns' % (len(extensions), extension_column))
arrays=extensions

extended to 28 arrays with 5 columns
extended to 65 arrays with 6 columns
extended to 110 arrays with 7 columns
extended to 123 arrays with 8 columns
extended to 110 arrays with 9 columns
extended to 72 arrays with 10 columns


## Notes

• The numbers of isomorphism classes for various types of classes can be found at the webpage series of orthogonal arrays.

• For larger number of arrays the command line tools are more convenient and more memory efficient.