Expand description
Problem registry and metadata types.
This module provides types for problem introspection and discovery.
§Overview
ProblemInfo- Rich metadata (name, description, complexity, reductions)ProblemMetadata- Trait for problems to provide their own metadataComplexityClass- Computational complexity classification
§Example
use problemreductions::registry::{ProblemInfo, ComplexityClass};
// Create problem metadata
let info = ProblemInfo::new("Independent Set", "Find maximum non-adjacent vertices")
.with_aliases(&["MIS", "Stable Set"])
.with_complexity(ComplexityClass::NpComplete)
.with_reduction_from("3-SAT");
assert!(info.is_np_complete());§Implementing for Custom Problems
Problems can implement ProblemMetadata to provide introspection:
use problemreductions::registry::{
ProblemMetadata, ProblemInfo, ComplexityClass
};
struct MyProblem;
impl ProblemMetadata for MyProblem {
fn problem_info() -> ProblemInfo {
ProblemInfo::new("My Problem", "Description")
.with_complexity(ComplexityClass::NpComplete)
}
}
let info = MyProblem::problem_info();
println!("Problem: {}", info.name);Re-exports§
pub use problem_ref::parse_catalog_problem_ref;pub use problem_ref::require_graph_variant;pub use problem_ref::ProblemRef;pub use problem_type::find_problem_type;pub use problem_type::find_problem_type_by_alias;pub use problem_type::problem_types;pub use problem_type::ProblemType;pub use variant::find_variant_by_alias;pub use variant::find_variant_entry;pub use variant::validate_variant_aliases;pub use variant::VariantEntry;
Modules§
- problem_
ref - Typed internal problem references with catalog-validated variants.
- problem_
type - Problem type catalog: runtime lookup by name, alias, and variant validation.
- variant
- Explicit variant registration via inventory.
Structs§
- Field
Info - Description of a struct field for JSON schema export.
- Field
Info Json - JSON-serializable field info.
- Loaded
DynProblem - A loaded problem with type-erased solve capability.
- Problem
Info - Metadata about a problem type.
- Problem
Schema Entry - A registered problem schema entry for static inventory registration.
- Problem
Schema Json - JSON-serializable problem schema.
- Problem
Size Field Entry - Optional static size-field metadata for problem types.
- Variant
Dimension - A declared variant dimension for a problem type.
Enums§
- Complexity
Class - Computational complexity class of a problem.
Traits§
- DynProblem
- Type-erased problem interface for dynamic dispatch.
- Problem
Metadata - Trait for problems that provide static metadata.
Functions§
- collect_
schemas - Collect all registered problem schemas into JSON-serializable form.
- declared_
size_ fields - Collect explicitly declared size fields for a problem type.
- format_
metric - Format a metric for CLI- and registry-facing dynamic dispatch.
- load_
dyn - Load a problem from JSON by exact problem name and exact variant map.
- serialize_
any - Serialize a
&dyn Anyby exact problem name and exact variant map.
Type Aliases§
- Solve
Value Fn - Function pointer type for brute-force value solve dispatch.
- Solve
Witness Fn - Function pointer type for brute-force witness solve dispatch.