Skip to main content

Module registry

Module registry 

Source
Expand description

Problem registry and metadata types.

This module provides types for problem introspection and discovery.

§Overview

§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§

FieldInfo
Description of a struct field for JSON schema export.
FieldInfoJson
JSON-serializable field info.
LoadedDynProblem
A loaded problem with type-erased solve capability.
ProblemInfo
Metadata about a problem type.
ProblemSchemaEntry
A registered problem schema entry for static inventory registration.
ProblemSchemaJson
JSON-serializable problem schema.
ProblemSizeFieldEntry
Optional static size-field metadata for problem types.
VariantDimension
A declared variant dimension for a problem type.

Enums§

ComplexityClass
Computational complexity class of a problem.

Traits§

DynProblem
Type-erased problem interface for dynamic dispatch.
ProblemMetadata
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 Any by exact problem name and exact variant map.

Type Aliases§

SolveValueFn
Function pointer type for brute-force value solve dispatch.
SolveWitnessFn
Function pointer type for brute-force witness solve dispatch.