|
| 1 | +# Problem Categorization Redesign |
| 2 | + |
| 3 | +## Problem |
| 4 | + |
| 5 | +The current categorization mixes two axes: |
| 6 | +- **Input structure** (graph, set system, formula) |
| 7 | +- **Problem type** (optimization vs satisfaction) |
| 8 | + |
| 9 | +This creates ambiguity: MIS is both a graph problem and an optimization problem. QUBO is on a matrix but lives in `optimization/`. CircuitSAT is a satisfiability problem but lives in `specialized/`. The `specialized/` folder is a catch-all with no unifying principle. |
| 10 | + |
| 11 | +## Design |
| 12 | + |
| 13 | +**Single axis: primary input structure** — "what data type does the problem operate on?" |
| 14 | + |
| 15 | +The optimization/satisfaction distinction is already captured by the trait hierarchy (`OptimizationProblem` vs `SatisfactionProblem`), so folders should not duplicate it. |
| 16 | + |
| 17 | +### New folder structure |
| 18 | + |
| 19 | +``` |
| 20 | +src/models/ |
| 21 | +├── graph/ # Input: a graph (optionally weighted) |
| 22 | +│ ├── maximum_independent_set.rs |
| 23 | +│ ├── maximum_clique.rs |
| 24 | +│ ├── max_cut.rs |
| 25 | +│ ├── maximum_matching.rs |
| 26 | +│ ├── minimum_vertex_cover.rs |
| 27 | +│ ├── minimum_dominating_set.rs |
| 28 | +│ ├── maximal_is.rs |
| 29 | +│ ├── kcoloring.rs |
| 30 | +│ ├── traveling_salesman.rs |
| 31 | +│ ├── spin_glass.rs ← from optimization/ |
| 32 | +│ └── biclique_cover.rs ← from specialized/ |
| 33 | +│ |
| 34 | +├── formula/ # Input: a logical formula or circuit |
| 35 | +│ ├── sat.rs |
| 36 | +│ ├── ksat.rs |
| 37 | +│ └── circuit.rs ← from specialized/ |
| 38 | +│ |
| 39 | +├── set/ # Input: universe + collection of subsets |
| 40 | +│ ├── minimum_set_covering.rs |
| 41 | +│ └── maximum_set_packing.rs |
| 42 | +│ |
| 43 | +├── algebraic/ # Input: matrix, linear system, or lattice |
| 44 | +│ ├── qubo.rs ← from optimization/ |
| 45 | +│ ├── ilp.rs ← from optimization/ |
| 46 | +│ ├── closest_vector_problem.rs ← from optimization/ |
| 47 | +│ └── bmf.rs ← from specialized/ |
| 48 | +│ |
| 49 | +└── misc/ # Problems with unique input structures |
| 50 | + ├── bin_packing.rs ← from optimization/ |
| 51 | + ├── paintshop.rs ← from specialized/ |
| 52 | + └── factoring.rs ← from specialized/ |
| 53 | +``` |
| 54 | + |
| 55 | +### Decision rule for new problems |
| 56 | + |
| 57 | +> "What is the primary data structure in the struct definition?" |
| 58 | +> - Graph → `graph/` |
| 59 | +> - Boolean formula or circuit → `formula/` |
| 60 | +> - Universe + subsets → `set/` |
| 61 | +> - Matrix, linear system, or lattice → `algebraic/` |
| 62 | +> - None of the above → `misc/` |
| 63 | +
|
| 64 | +### What moves |
| 65 | + |
| 66 | +| Problem | From | To | Reason | |
| 67 | +|---|---|---|---| |
| 68 | +| SpinGlass | optimization/ | graph/ | Parameterized by G, operates on graph edges | |
| 69 | +| BicliqueCover | specialized/ | graph/ | Input is a BipartiteGraph | |
| 70 | +| CircuitSAT | specialized/ | formula/ | Input is a boolean circuit | |
| 71 | +| QUBO | optimization/ | algebraic/ | Input is a Q matrix (no graph param) | |
| 72 | +| ILP | optimization/ | algebraic/ | Input is constraint matrix + objective | |
| 73 | +| CVP | optimization/ | algebraic/ | Input is lattice basis matrix | |
| 74 | +| BMF | specialized/ | algebraic/ | Input is a boolean matrix | |
| 75 | +| BinPacking | optimization/ | misc/ | Input is items + capacity | |
| 76 | +| PaintShop | specialized/ | misc/ | Input is a car sequence | |
| 77 | +| Factoring | specialized/ | misc/ | Input is an integer | |
| 78 | + |
| 79 | +### What doesn't change |
| 80 | + |
| 81 | +- Trait hierarchy (`OptimizationProblem`, `SatisfactionProblem`) |
| 82 | +- All public API, type names, re-exports |
| 83 | +- Only `mod.rs` files, `use` paths, and `#[path]` test references change |
| 84 | +- The `optimization/` and `specialized/` folders are eliminated |
0 commit comments