Skip to content

Fix SetCoverVerifier accepting subsets not in S, ignoring K - #508

Open
Trosper3 wants to merge 1 commit into
CSharpAPIfrom
fix/setcover-verifier-subset-membership
Open

Fix SetCoverVerifier accepting subsets not in S, ignoring K#508
Trosper3 wants to merge 1 commit into
CSharpAPIfrom
fix/setcover-verifier-subset-membership

Conversation

@Trosper3

Copy link
Copy Markdown
Contributor

Summary

  • SetCoverVerifier flattened certificates into a bag of loose elements (Replace("},{", ",").Replace("{", "").Replace("}", "")), discarding subset structure entirely, and only checked whether the flattened bag covered the universe U. Any collection of made-up subsets — or even bare elements with no subset structure at all — that happened to cover U was accepted, and the cardinality bound K was never read.
  • Fix: parseCertificate now uses SPADE.UtilCollection to parse the certificate's actual nested subset structure. verify enforces all three parts of the Set Cover decision problem: each listed subset is a genuine (order-independent) member of S, the subset count is <= K, and the union of accepted subsets covers U. Parse failures are caught and return false, matching KnapsackVerifier's existing convention.
  • SetCoverBruteForce calls this verifier as its own search oracle and always builds certificates from genuine indices into S, 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 on dotnet format --verify-no-changes) — clean
  • dotnet test (full suite) — 908/908 passed

… 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.
@github-actions

Copy link
Copy Markdown

Redux Build System — CI Report

dotnet · commit f7b89a4

Operation Status Summary Time
audit no known vulnerabilities 4.0s
format-check all files formatted 19.8s
lint 0 issues 31.2s
typecheck ⏭️ covered by lint (dotnet build)
unit-test 908 passed · coverage 70% (min 80%) 38.5s
build built local/redux:ci · 234MB 33.5s
integration-test ⏭️ no [integration] command
push ⏭️ not implemented

Overall: ❌ 4 passed · 1 failed · 3 skipped

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SetCover verifier ignores set family S (and K) — accepts subsets not in S

1 participant