Skip to content

[Model] MultipleChoiceBranching #253

Closed

Description

@isPANN

name: Problem
about: Propose a new problem type
title: "[Model] MultipleChoiceBranching"
labels: model
assignees: ''

Motivation

MULTIPLE CHOICE BRANCHING from Garey & Johnson, A2 ND11. An NP-complete problem on directed graphs combining branching (arborescence) structure with partition constraints on arcs. The problem asks for a high-weight subset of arcs that forms an acyclic, in-degree-at-most-one subgraph (a branching/forest of arborescences) while respecting a partition constraint that at most one arc from each group is selected. Without the partition constraint, the problem reduces to maximum weight branching — a 2-matroid intersection problem solvable in polynomial time (Tarjan, 1977).

Associated reduction rules:

  • As target: R32 (3SAT -> MULTIPLE CHOICE BRANCHING) via Garey and Johnson (unpublished)

Definition

Name: MultipleChoiceBranching
Canonical name: MULTIPLE CHOICE BRANCHING
Reference: Garey & Johnson, Computers and Intractability, A2 ND11

Mathematical definition:

INSTANCE: Directed graph G = (V, A), a weight w(a) in Z^+ for each arc a in A, a partition of A into disjoint sets A_1, A_2, ..., A_m, and a positive integer K.
QUESTION: Is there a subset A' of A with sum_{a in A'} w(a) >= K such that no two arcs in A' enter the same vertex, A' contains no cycles, and A' contains at most one arc from each of the A_i, 1 <= i <= m?

Variables

  • Count: |A| binary variables (one per arc), indicating whether the arc is selected
  • Per-variable domain: {0, 1} — 0 means arc not selected, 1 means arc selected
  • dims(): vec![2; graph.num_arcs()]
  • Meaning: Variable x_a = 1 means arc a is included in the subset A'. The constraints are: (1) for each vertex v, at most one arc entering v has x_a = 1 (in-degree constraint), (2) the selected arcs form an acyclic subgraph (no directed cycle), (3) for each partition group A_i, at most one arc has x_a = 1 (multiple choice constraint), and (4) the total weight of selected arcs is at least K.

Schema (data type)

Type name: MultipleChoiceBranching
Variants: weight type (W)

Field Type Description
graph DirectedGraph Directed graph G = (V, A)
weights Vec<W> Positive integer weight w(a) for each arc a
partition Vec<Vec<usize>> Partition of arcs into disjoint groups A_1, ..., A_m. Each inner Vec<usize> contains 0-based indices into the arcs. The groups must be pairwise disjoint and their union must cover all arcs (i.e., every arc index in 0..graph.num_arcs() appears in exactly one group).
threshold W Weight threshold K

Size fields (for overhead expressions): num_vertices (from graph.num_vertices()), num_arcs (from graph.num_arcs()), num_partition_groups (from partition.len())

Notes:

  • This is a satisfaction (decision) problem: Metric = bool, implementing SatisfactionProblem.
  • The "no two arcs enter the same vertex" and "no cycles" constraints together define a branching (a forest of in-arborescences).
  • The partition constraint adds the "multiple choice" aspect on top of the branching structure.
  • Let m = partition.len() denote the number of partition groups. The partition must be disjoint and cover all arcs.
  • DirectedGraph is defined in src/topology/directed_graph.rs, wrapping petgraph's DiGraph<(), ()>. It provides num_vertices(), num_arcs(), arcs(), is_dag(). Use variant_params![] (empty) since there is no generic graph type parameter.

Complexity

  • Best known exact algorithm: Brute-force enumeration over all 2^|A| subsets of arcs, checking branching + partition + weight constraints for each.
  • declare_variants! complexity string: "2^num_arcs" (brute-force over all arc subsets)
  • NP-completeness: NP-complete (Garey and Johnson, unpublished). Transformation from 3SAT. Remains NP-complete even if G is strongly connected and all weights are equal.
  • Polynomial special cases:
    • If all A_i have |A_i| = 1 (no choice constraint), the problem becomes maximum weight branching, solvable in polynomial time via 2-matroid intersection (Tarjan, 1977; Edmonds, 1967).
    • If the graph is symmetric, the problem reduces to the "multiple choice spanning tree" problem, also a 2-matroid intersection problem solvable in polynomial time (Suurballe, 1975, as referenced in Garey & Johnson, 1979; exact publication venue unverified).
  • References:
    • R. E. Tarjan (1977). "Finding optimum branchings." Networks 7, pp. 25--35.
    • J. W. Suurballe (1975). "Minimal spanning trees subject to disjoint arc set constraints." (as referenced in Garey & Johnson, 1979; exact publication venue unverified)
    • J. Edmonds (1967). "Optimum branchings." Journal of Research of the National Bureau of Standards 71B, pp. 233--240.

Extra Remark

Full book text:

INSTANCE: Directed graph G = (V,A), a weight w(a) in Z^+ for each arc a in A, a partition of A into disjoint sets A_1, A_2, ..., A_m, and a positive integer K.
QUESTION: Is there a subset A' in A with sum_{a in A'} w(a) >= K such that no two arcs in A' enter the same vertex, A' contains no cycles, and A' contains at most one arc from each of the A_i, 1 <= i <= m?

Reference: [Garey and Johnson, --]. Transformation from 3SAT.
Comment: Remains NP-complete even if G is strongly connected and all weights are equal. If all Ai have |Ai| = 1, the problem becomes simply that of finding a "maximum weight branching," a 2-matroid intersection problem that can be solved in polynomial time (e.g., see [Tarjan, 1977]). (In a strongly connected graph, a maximum weight branching can be viewed as a maximum weight directed spanning tree.) Similarly, if the graph is symmetric, the problem becomes equivalent to the "multiple choice spanning tree" problem, another 2-matroid intersection problem that can be solved in polynomial time [Suurballe, 1975].

How to solve

  • It can be solved by (existing) bruteforce — enumerate all subsets of arcs (at most one per partition group) and check branching + weight constraints.
  • It can be solved by reducing to integer programming — binary variables for each arc, constraints for in-degree, acyclicity (via ordering variables), partition groups, and weight threshold.
  • Other: For the special case without partition constraints, Edmonds' algorithm (maximum weight branching) runs in O(|V| * |A|) time.

Example Instance

Instance 1 (YES — valid branching exists):
Directed graph G with 6 vertices {0, 1, 2, 3, 4, 5} and 8 arcs:

  • Arcs with weights: a0=(0->1, w=3), a1=(0->2, w=2), a2=(1->3, w=4), a3=(2->3, w=1), a4=(1->4, w=2), a5=(3->5, w=3), a6=(4->5, w=1), a7=(2->4, w=3)
  • Partition: A_1 = {a0, a1} (arcs from vertex 0), A_2 = {a2, a3} (arcs to vertex 3), A_3 = {a4, a7} (arcs to vertex 4), A_4 = {a5, a6} (arcs to vertex 5)
  • K = 10
  • Solution: A' = {a0, a2, a7, a5} = {0->1 (w=3), 1->3 (w=4), 2->4 (w=3), 3->5 (w=3)}
    • Total weight = 3+4+3+3 = 13 >= K=10
    • In-degree check: vertex 1 entered by a0 only, vertex 3 by a2 only, vertex 4 by a7 only, vertex 5 by a5 only -- OK
    • Acyclicity: 0->1->3->5 and 2->4, no cycles -- OK
    • Partition: a0 from A_1, a2 from A_2, a7 from A_3, a5 from A_4 -- at most one per group -- OK
  • Answer: YES

Instance 2 (NO — no valid branching meets threshold):
Directed graph G with 4 vertices {0, 1, 2, 3} and 4 arcs:

  • Arcs with weights: a0=(0->1, w=2), a1=(1->2, w=2), a2=(2->3, w=2), a3=(3->1, w=2)
  • Partition: A_1 = {a0, a3} (arcs entering vertex 1), A_2 = {a1, a2}
  • K = 6
  • From A_1, select at most one: a0 or a3. From A_2, select at most one: a1 or a2.
  • Best acyclic branching: a0 + a1 (weight 4), or a0 + a2 (but a2=2->3, need path from 0 through something), or a3 + a2 (but 3->1 and 2->3 form a cycle if both selected... actually no: a3=3->1, a2=2->3. Selected arcs: 3->1 and 2->3. Check cycle: 2->3->1, no cycle back to 2.)
  • Max weight achievable = 4 < K=6
  • Answer: NO

Activity

  1. added this to the Garey & Johnson milestone on Mar 10, 2026
  2. zazabap commented on Mar 11, 2026

    @zazabap
    Collaborator

    Issue Quality Check — Model

    Check Result Details
    Usefulness ✅ Pass Novel problem not yet in the reduction graph; classic GJ ND11 problem
    Non-trivial ✅ Pass Directed graph with branching + partition constraints; distinct from all 24 existing problems
    Correctness ⚠️ Warn Suurballe 1975 reference not independently verified; complexity section lacks concrete time bound
    Well-written ⚠️ Warn Minor issues: missing concrete complexity string, partition field description could be clearer

    Overall: 2 passed, 0 failed, 2 warnings


    Usefulness

    Pass. MultipleChoiceBranching does not exist in the codebase (confirmed via pred show). The problem is from Garey & Johnson's compendium (A2, ND11) and combines branching structure with partition constraints — a genuinely novel input structure for this reduction graph. The issue mentions an associated reduction from 3SAT (R32, Garey and Johnson unpublished), which would connect it to the existing KSatisfiability node.

    One minor note: the Motivation section would benefit from explicitly naming which implemented problems this would connect to (e.g., "enables reduction from KSatisfiability") rather than referencing the abstract "3SAT -> MULTIPLE CHOICE BRANCHING" rule.

    Non-trivial

    Pass. This is a directed graph problem with three simultaneous constraints: (1) in-degree at most one (branching structure), (2) acyclicity, and (3) at most one arc per partition group. No existing problem in the codebase combines these constraints. The closest problems are on undirected graphs (MIS, MaxCut, etc.), formulas (SAT), sets, or algebraic structures. This is genuinely distinct.

    Correctness

    Warn — two items could not be fully verified.

    Verified references:

    • Tarjan (1977) — "Finding optimum branchings," Networks 7, pp. 25–35. ✅ Confirmed via Wiley Online Library. The paper describes O(m log n) algorithms for maximum weight branchings.
    • Edmonds (1967) — "Optimum branchings," JRNBS 71B, pp. 233–240. ✅ Confirmed via NIST publications and Internet Archive. Foundational algorithm for optimum branchings.
    • Garey & Johnson NP-completeness (ND11) — The issue correctly quotes the book text. The NP-completeness is by reduction from 3SAT (Garey and Johnson, unpublished), which is consistent with the book's entry. ✅

    Unverified references:

    • Suurballe (1975) — "Minimal spanning trees subject to disjoint arc set constraints." ⚠️ Could not find this specific publication. Known Suurballe publications are from 1974 (Networks 4(2)) on disjoint paths and 1984 (with Tarjan, Networks 14(2)) on shortest pairs of disjoint paths. The claim that the symmetric graph case is solvable as a 2-matroid intersection problem is plausible given the matroid intersection literature, but this specific 1975 reference could not be independently verified. It may be an obscure technical report or conference paper.

    Complexity section gap:
    The issue does not provide a concrete best-known exact algorithm time bound (e.g., "2^num_arcs" or similar). The declare_variants! macro requires a complexity string with concrete numeric values. The current description ("general case requires exponential time") is too vague for implementation. A brute-force bound of O(product of |A_i|) is mentioned but not formalized into a complexity expression.

    Well-written

    Warn — mostly good, with minor items to address.

    Strengths:

    • The formal definition is well-stated, directly from the book, with all constraints clearly separated
    • Variables section correctly identifies |A| binary variables with clear semantics
    • Schema is reasonable with appropriate fields
    • Both YES and NO examples are provided and appear correct (verified Example 1: A' = {a0, a2, a7, a5} with weight 13 ≥ 10, valid branching, valid partition selection)
    • Solver section has all three methods checked with sensible descriptions

    Items to address:

    1. Missing complexity string: The declare_variants! macro needs a concrete expression like "2^num_arcs". Please add a specific worst-case time bound.
    2. Schema partition field: The type Vec<Vec<usize>> stores arc indices, but it should be clarified whether indices are 0-based and correspond to the order in the arcs vector. Also, the invariant that partition groups are disjoint and cover all arcs should be noted.
    3. Symbol m: Used in the definition ("A_1, A_2, ..., A_m") and partition description but not formally defined as the number of partition groups. Consider adding "let m = |partition|" for consistency.
    4. Naming convention: MultipleChoiceBranching is acceptable for a satisfaction problem (no Maximum/Minimum prefix needed). ✅

    Recommendations

    • For the Suurballe 1975 reference: consider citing it as "Suurballe (1975), as referenced in Garey & Johnson (1979)" to make the provenance clear, or find the exact publication venue.
    • For the complexity string: a conservative bound would be "2^num_arcs" (brute force over all arc subsets). If the partition structure can be exploited, a tighter bound referencing partition group sizes could be used, but the simpler expression is safer for implementation.
    • The threshold field in the schema makes this a decision problem, which is correct. However, consider whether an optimization variant (maximize total weight subject to branching + partition constraints) would also be useful — it could be added as a separate model later.
  3. moved this from Backlog to Ready in Good issueson Mar 12, 2026
  4. moved this from Ready to Backlog in Good issueson Mar 13, 2026
  5. isPANN commented on Mar 13, 2026

    @isPANN
    CollaboratorAuthor

    Changelog — mechanical fixes applied:

    1. Schema partition field: Expanded description to explicitly state that inner vectors contain 0-based indices into the arcs vector, groups must be pairwise disjoint, and their union must cover all arcs (every index in 0..arcs.len() appears in exactly one group).
    2. Complexity prose: Replaced vague "General case requires exponential time. A brute-force approach enumerates..." with concrete: "Brute-force enumeration over all 2^|A| subsets of arcs, checking branching + partition + weight constraints for each."
    3. References: Changed "as cited in" to "as referenced in" for the Suurballe 1975 citation to match project convention.
  6. moved this from Backlog to Ready in Good issueson Mar 13, 2026
  7. moved this from Ready to Backlog in Good issueson Mar 13, 2026
  8. isPANN commented on Mar 13, 2026

    @isPANN
    CollaboratorAuthor

    Changelog (fix-issue-batch, 2026-03-13)

    1. Schema: Replaced num_vertices + arcs fields with single graph: DirectedGraph field — DirectedGraph (in src/topology/directed_graph.rs) wraps petgraph's DiGraph<(), ()>, provides num_vertices(), num_arcs(), arcs(), is_dag().
    2. Size fields: Now derived from graph: num_vertices (from graph.num_vertices()), num_arcs (from graph.num_arcs()), num_partition_groups (from partition.len()).
    3. Variables: Updated dims() to use graph.num_arcs().
    4. Notes: Added note about DirectedGraph type and variant_params![].
  9. moved this from Backlog to Ready in Good issueson Mar 13, 2026
  10. moved this from Ready to In progress in Good issueson Mar 16, 2026
  11. added 2 commits that reference this issue on Mar 16, 2026
  12. moved this from In progress to Review pool in Good issueson Mar 16, 2026
  13. moved this from Review pool to Under review in Good issueson Mar 16, 2026
  14. moved this from Under review to Final review in Good issueson Mar 16, 2026
  15. added a commit that references this issue on Mar 16, 2026
    da12028
  16. moved this from Final review to Done in Good issueson Mar 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    GoodAn issue passed all checks.modelA model problem to be implemented.

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions