Background
KthLargestMTuple is documented as the decision problem:
Are there at least k distinct m-tuples whose element sum is at least bound?
The original model issue #405 proposed representing each qualifying tuple as Sum(1) and comparing the final count with k externally. The implemented model performs the counting step, but no external threshold comparison is present in the model or deterministic solve output.
Problem
KthLargestMTuple::evaluate never reads self.k. It returns Sum(1) or Sum(0) for each tuple, so aggregate solving returns the exact number of qualifying tuples as Sum(count).
Consequently, instances that differ only in k are observationally identical:
- Example sets and
bound = 12 have 14 qualifying tuples.
- With
k = 14, the documented decision answer is YES.
- With
k = 15, the documented decision answer is NO.
- The current solver returns
Sum(14) for both instances.
The serialized input accepts and preserves k, but the field has no effect on evaluation or solve results. This makes the implementation inconsistent with the schema description, model documentation, and Garey & Johnson decision problem.
Evidence
The mismatch is in src/models/misc/kth_largest_m_tuple.rs:
impl Problem for KthLargestMTuple {
type Value = Sum<u64>;
fn evaluate(&self, config: &[usize]) -> Sum<u64> {
// validates and scores the tuple against bound
// self.k is never used
}
}
The canonical example also records only the per-configuration value 1, while the model documentation describes the final YES/NO answer.
Expected behavior
The public model contract must represent one coherent problem:
- If
KthLargestMTuple remains the threshold decision problem, solving must use k and return the source-side YES/NO result for count >= k.
- If exact counting is the intended model, remove
k and rename/re-document the model as a counting problem.
Given the established Garey & Johnson name and schema, the first option matches the current declared interface.
Verification
Add a regression test using the documented 18-tuple example with 14 qualifying tuples:
k = 14 returns YES.
k = 15 returns NO.
- The two solve results must differ.
Also verify that changing only k can affect the dynamic CLI solve output.
Related
Background
KthLargestMTupleis documented as the decision problem:The original model issue #405 proposed representing each qualifying tuple as
Sum(1)and comparing the final count withkexternally. The implemented model performs the counting step, but no external threshold comparison is present in the model or deterministic solve output.Problem
KthLargestMTuple::evaluatenever readsself.k. It returnsSum(1)orSum(0)for each tuple, so aggregate solving returns the exact number of qualifying tuples asSum(count).Consequently, instances that differ only in
kare observationally identical:bound = 12have 14 qualifying tuples.k = 14, the documented decision answer is YES.k = 15, the documented decision answer is NO.Sum(14)for both instances.The serialized input accepts and preserves
k, but the field has no effect on evaluation or solve results. This makes the implementation inconsistent with the schema description, model documentation, and Garey & Johnson decision problem.Evidence
The mismatch is in
src/models/misc/kth_largest_m_tuple.rs:The canonical example also records only the per-configuration value
1, while the model documentation describes the final YES/NO answer.Expected behavior
The public model contract must represent one coherent problem:
KthLargestMTupleremains the threshold decision problem, solving must usekand return the source-side YES/NO result forcount >= k.kand rename/re-document the model as a counting problem.Given the established Garey & Johnson name and schema, the first option matches the current declared interface.
Verification
Add a regression test using the documented 18-tuple example with 14 qualifying tuples:
k = 14returns YES.k = 15returns NO.Also verify that changing only
kcan affect the dynamic CLI solve output.Related