R/assertions.R
lvl_violation.RdFor each attribute level, count how often it occurs in the design candidate and find the distance to the nearest allowed number of occurrences. Levels that do not occur in the design candidate are counted as zero occurrences.
lvl_violation(
utility,
x,
rows,
ranges = occurrences(utility, rows),
lvls = expand_attribute_levels(utility)
)A named list of utility functions. See the examples and the vignette for examples of how to define these correctly for different types of experimental designs.
A design candidate with one column per attribute
Number of rows in the design
Level occurrences as returned by occurrences.
Pass these in when calling repeatedly to avoid parsing the utility functions
each time
Attribute levels as returned by
expand_attribute_levels
The total distance summed over all attribute levels. A value of 0 means that the design candidate satisfies all level occurrence constraints.