A Rust library for NP-hard problem definitions and reductions.
- 18+ Problem Types: Implementations of classic NP-hard problems
- Type-Safe Reductions: Compile-time verified problem transformations
- Graph Abstraction: Generic
Graphtrait withSimpleGraphandUnitDiskGraphimplementations - Multiple Solvers: BruteForce and ILP (HiGHS) solvers
- Topology Types: HyperGraph and UnitDiskGraph for specialized constraints
- File I/O: JSON serialization for all problem types
Add to your Cargo.toml:
[dependencies]
problemreductions = "0.1"use problemreductions::prelude::*;
// Create an Independent Set problem
let problem: IndependentSetT = IndependentSetT::new(4, vec![(0, 1), (1, 2), (2, 3)]);
// Solve with brute force
let solver = BruteForce::new();
let solutions = solver.find_best(&problem);
// Apply a reduction
let result = ReduceTo::<VertexCoverT>::reduce_to(&problem);
let vc = result.target_problem();| Category | Problems |
|---|---|
| Satisfiability | SAT, K-SAT, CircuitSAT, Factoring |
| Graph | IndependentSet, MaximalIS, VertexCovering, DominatingSet, Coloring, MaxCut, Matching |
| Set | SetCovering, SetPacking |
| Optimization | SpinGlass, QUBO |
| Specialized | Paintshop, BicliqueCover, BMF |
- IndependentSet ↔ VertexCovering
- IndependentSet ↔ SetPacking
- SpinGlass ↔ QUBO
- SpinGlass ↔ MaxCut
make help # Show all available targets
make build # Build the project
make test # Run all tests
make fmt # Format code with rustfmt
make fmt-check # Check code formatting
make clippy # Run clippy lints
make doc # Build and open documentation
make coverage # Generate coverage report (requires cargo-llvm-cov)
make clean # Clean build artifacts
make check # Quick check before commit (fmt + clippy + test)cargo build --all-features
cargo test --all-features
cargo doc --all-features --no-deps --openMIT License - see LICENSE for details.