problemreductions/registry/
mod.rs

1//! Problem registry and metadata types.
2//!
3//! This module provides types for problem classification, introspection, and discovery.
4//! It enables organizing 100+ NP-complete problems into a hierarchical category system
5//! and provides rich metadata for each problem type.
6//!
7//! # Overview
8//!
9//! - [`ProblemCategory`] - Hierarchical categorization (e.g., `graph/independent`)
10//! - [`ProblemInfo`] - Rich metadata (name, description, complexity, reductions)
11//! - [`ProblemMetadata`] - Trait for problems to provide their own metadata
12//! - [`ComplexityClass`] - Computational complexity classification
13//!
14//! # Example
15//!
16//! ```rust
17//! use problemreductions::registry::{ProblemCategory, GraphSubcategory, ProblemInfo, ComplexityClass};
18//!
19//! // Create a category path
20//! let category = ProblemCategory::Graph(GraphSubcategory::Independent);
21//! assert_eq!(category.path(), "graph/independent");
22//!
23//! // Create problem metadata
24//! let info = ProblemInfo::new("Independent Set", "Find maximum non-adjacent vertices")
25//!     .with_aliases(&["MIS", "Stable Set"])
26//!     .with_complexity(ComplexityClass::NpComplete)
27//!     .with_reduction_from("3-SAT");
28//!
29//! assert!(info.is_np_complete());
30//! ```
31//!
32//! # Using with Problems
33//!
34//! Problems that implement [`ProblemMetadata`] can be queried for their category and info:
35//!
36//! ```rust
37//! use problemreductions::registry::ProblemMetadata;
38//! use problemreductions::models::graph::IndependentSetT;
39//! use problemreductions::topology::SimpleGraph;
40//!
41//! let info = IndependentSetT::<SimpleGraph, i32>::problem_info();
42//! let category = IndependentSetT::<SimpleGraph, i32>::category();
43//!
44//! println!("Problem: {} ({})", info.name, category.path());
45//! ```
46
47mod category;
48mod info;
49
50pub use category::{
51    GraphSubcategory, NetworkSubcategory, OptimizationSubcategory, ProblemCategory,
52    SatisfiabilitySubcategory, SchedulingSubcategory, SetSubcategory, SpecializedSubcategory,
53    StringSubcategory,
54};
55pub use info::{ComplexityClass, ProblemInfo, ProblemMetadata};