Fix SetCoverVerifier accepting subsets not in S, ignoring K - #508
Open
Trosper3 wants to merge 1 commit into
Open
Fix SetCoverVerifier accepting subsets not in S, ignoring K#508Trosper3 wants to merge 1 commit into
Trosper3 wants to merge 1 commit into
Conversation
… bound K The verifier flattened certificates into a bag of loose elements and only checked whether they covered the universe, so any collection of made-up subsets (or even bare elements with no subset structure) that happened to cover U was accepted. Now parses the certificate's actual subset structure via UtilCollection and enforces all three parts of the decision problem: each subset is a genuine member of S, the subset count is <= K, and the union covers U.
Redux Build System — CI Report
Overall: ❌ 4 passed · 1 failed · 3 skipped |
2 tasks
Trosper3
added a commit
that referenced
this pull request
Sep 1, 2026
Superseded by the fix+test file already open in PR #508 (fixes the subset-membership/K check and adds fuller test coverage vs. this PR's 3-test format smoke check). Keeping the instanceFormat/certificateFormat declaration changes; only dropping the file that would otherwise collide on merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SetCoverVerifierflattened certificates into a bag of loose elements (Replace("},{", ",").Replace("{", "").Replace("}", "")), discarding subset structure entirely, and only checked whether the flattened bag covered the universeU. Any collection of made-up subsets — or even bare elements with no subset structure at all — that happened to coverUwas accepted, and the cardinality boundKwas never read.parseCertificatenow usesSPADE.UtilCollectionto parse the certificate's actual nested subset structure.verifyenforces all three parts of the Set Cover decision problem: each listed subset is a genuine (order-independent) member ofS, the subset count is<= K, and the union of accepted subsets coversU. Parse failures are caught and returnfalse, matchingKnapsackVerifier's existing convention.SetCoverBruteForcecalls this verifier as its own search oracle and always builds certificates from genuine indices intoS, so this tightening doesn't change the solver's behavior — confirmed by the full suite passing.Closes #258
Test plan
dotnet test --filter "...SETCOVER_Tests"— 10/10 passed (new test file; no prior tests existed for this problem)dotnet build --configuration Release(gates ondotnet format --verify-no-changes) — cleandotnet test(full suite) — 908/908 passed