# Minimal number of runs for an orthognal array

In this example we calculate the minimum number of runs required for an orthogonal array. For more details, see Schoen et al.

:

import itertools
import numpy as np

def minimum_number_of_runs(factor_levels, strength):
"""Calculate the minimum number of runs for an orthogonal array

The minimum number of runs is based on the strength conditions. IWhether a design actually exists
Args:
factor_levels: Factor levels of the design
strength: Strength of the array
Returns:
Minimum number of runs

"""
runs = [np.prod(tt) for tt in itertools.combinations(factor_levels, strength)]
N = np.lcm.reduce(runs)
return N


We run the method on several examples.

:

strength = 3
factor_levels = [2, 3, 3, 4, 5]
N = minimum_number_of_runs(factor_levels, strength)

print(f"for a design of strength {strength} and factor levels {factor_levels} we require (a multiple of) {N} runs")

for a design of strength 3 and factor levels [2, 3, 3, 4, 5] we require (a multiple of) 360 runs

:

strength = 2
factor_levels = [3, 2, 2, 2, 2]
N = minimum_number_of_runs(factor_levels, strength)

print(f"for a design of strength {strength} and factor levels {factor_levels} we require (a multiple of) {N} runs")

for a design of strength 2 and factor levels [3, 2, 2, 2, 2] we require (a multiple of) 12 runs

[ ]: