Background
The repository exposes five coarse structural model categories through pred list --category:
algebraic
formula
graph
misc
set
These categories intentionally match the implementation-oriented catalog organization. They are not an academic taxonomy of NP-hard problems, and the existing model directories do not need to move.
Today the category is inferred by parsing ProblemSchemaEntry.module_path. That makes a user-visible catalog property depend implicitly on Rust source placement. Moving or re-exporting a model can therefore change its category without changing its registered contract, while malformed paths produce inconsistent caller-side fallbacks such as other and uncategorized.
Objective
Keep exactly the existing five categories and directory layout, but declare each model's category explicitly in its model-owned schema registration. Category must be closed and strongly typed, required at compile time, and independent of module_path!().
Interface (Input → Output)
Each ProblemSchemaEntry supplies one required value:
category: ProblemCategory::Graph,
The public/display spellings remain exactly:
algebraic
formula
graph
misc
set
ProblemType, reduction graph export, schema/JSON output, pred list, and pred list --category consume this declared value. There is no inferred or fallback category.
Required changes
- Add a closed
ProblemCategory enum to the core registry with the five existing values and one canonical display/CLI spelling.
- Add required
category: ProblemCategory metadata to ProblemSchemaEntry.
- Migrate every schema registration to declare its current structural category explicitly.
- Make all category consumers use the declared typed value.
- Delete module-path category parsing and caller-side
other/uncategorized fallbacks.
- Update the model-development instructions so a new model must select one of the five categories in its schema registration.
- Do not introduce a central canonical-model-name match table.
Verification
Run:
cargo test -p problemreductions problem_category
cargo test -p problemreductions-cli list_category
cargo run -q -p problemreductions-cli -- list
The tests and command must demonstrate that:
- representative explicitly registered models report their declared values:
QUBO -> algebraic
KSatisfiability -> formula
MaximumClique -> graph
JobShopScheduling -> misc
MinimumSetCovering -> set;
- the summary contains exactly the five established spellings and still totals the full registered model count;
- text and JSON category output use the same typed metadata;
pred list --category unknown exits non-zero and lists the five valid values.
Negative controls:
- A compile-fail macro/unit fixture that constructs a
ProblemSchemaEntry without category must fail to compile, proving new models cannot silently omit it.
- A test-only registered model whose module path suggests one category but whose schema explicitly declares another must report the declared category, proving source location is not consulted.
- Restoring module-path parsing or any
other/uncategorized fallback must make the focused tests fail.
Scope
This is an intentionally mechanical full-catalog migration and will touch more than 20 model files. It must land as one replacement PR so no mixed explicit/inferred state exists.
Out of scope
- Introducing an academic or domain taxonomy
- Expanding beyond the existing five categories
- Multi-category models or tags
- Moving or renaming model files/directories
- Registry indexing or random-generation changes
Background
The repository exposes five coarse structural model categories through
pred list --category:algebraicformulagraphmiscsetThese categories intentionally match the implementation-oriented catalog organization. They are not an academic taxonomy of NP-hard problems, and the existing model directories do not need to move.
Today the category is inferred by parsing
ProblemSchemaEntry.module_path. That makes a user-visible catalog property depend implicitly on Rust source placement. Moving or re-exporting a model can therefore change its category without changing its registered contract, while malformed paths produce inconsistent caller-side fallbacks such asotheranduncategorized.Objective
Keep exactly the existing five categories and directory layout, but declare each model's category explicitly in its model-owned schema registration. Category must be closed and strongly typed, required at compile time, and independent of
module_path!().Interface (Input → Output)
Each
ProblemSchemaEntrysupplies one required value:The public/display spellings remain exactly:
ProblemType, reduction graph export, schema/JSON output,pred list, andpred list --categoryconsume this declared value. There is no inferred or fallback category.Required changes
ProblemCategoryenum to the core registry with the five existing values and one canonical display/CLI spelling.category: ProblemCategorymetadata toProblemSchemaEntry.other/uncategorizedfallbacks.Verification
Run:
The tests and command must demonstrate that:
QUBO -> algebraicKSatisfiability -> formulaMaximumClique -> graphJobShopScheduling -> miscMinimumSetCovering -> set;pred list --category unknownexits non-zero and lists the five valid values.Negative controls:
ProblemSchemaEntrywithoutcategorymust fail to compile, proving new models cannot silently omit it.other/uncategorizedfallback must make the focused tests fail.Scope
This is an intentionally mechanical full-catalog migration and will touch more than 20 model files. It must land as one replacement PR so no mixed explicit/inferred state exists.
Out of scope