| ddmin | R Documentation |
General implementation of the ddmin minimization algorithm of Zeller and
Hildebrandt (2002). Given a collection of elements and a predicate that
reports whether a subset still exhibits some behavior of interest, ddmin()
returns a subset that is one-minimal: the predicate holds for it, but fails
for every subset obtained by removing a single element.
ddmin(
items,
interesting,
algorithm = c("cdd", "ddmin"),
max_oracle_calls = Inf,
verbose = FALSE,
.info = NULL
)
items |
A list or atomic vector of elements to minimize. |
interesting |
A predicate applied to a subset of |
algorithm |
Character. The reduction strategy for the first phase, one
of |
max_oracle_calls |
Numeric. An upper bound on the number of predicate evaluations. Must be at least 1. When the budget is exhausted the reduction stops early and returns the smallest set confirmed so far; the result is still guaranteed to reproduce the behavior but may not be one-minimal. |
verbose |
Logical or character. If |
.info |
Optional environment. When supplied, |
The algorithm partitions the current candidate into n blocks (starting with
n = 2). It first tests whether any single block reproduces the behavior; if
so it continues with that block. Otherwise it tests each complement (the
candidate with one block removed) and continues with the first that
reproduces. If neither succeeds the granularity is doubled, up to the point
where each element sits in its own block, which guarantees one-minimality.
Results of the predicate are cached on the set of element indices, so an identical configuration is never evaluated twice.
The one-minimal subset of items, in the original order.
Zeller A, Hildebrandt R (2002). "Simplifying and Isolating Failure-Inducing Input." IEEE Transactions on Software Engineering, 28(2), 183-200. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1109/32.988498")}
Zhang M, Xu Z, Tian Y, Cheng X, Sun C (2025). "Toward a Better Understanding of Probabilistic Delta Debugging." ICSE 2025. arXiv:2408.04735. https://arxiv.org/abs/2408.04735
minex() for the script-reduction front end and reduce_rows() for
reducing data frames.
# Reduce a sentence to the single word a predicate depends on.
words <- strsplit("the quick brown fox", " ")[[1]]
ddmin(words, function(s) "fox" %in% s)
# When several elements are jointly required, all of them are kept.
nums <- 1:6
ddmin(nums, function(s) sum(s) >= 11 && 6 %in% s)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.