A Rust library for NP-hard problem definitions and reductions. We aim to implement >100 NP-hard problems and reductions rule between them, under the assistance of AI.
Add to your Cargo.toml (not yet available):
[dependencies]
problemreductions = "0.1"use problemreductions::prelude::*;
use problemreductions::models::optimization::ILP;
// Create an Independent Set problem on a path graph
let problem = IndependentSet::<i32>::new(4, vec![(0, 1), (1, 2), (2, 3)]);
// Reduce to Integer Linear Programming
let reduction = ReduceTo::<ILP>::reduce_to(&problem);
let ilp = reduction.target_problem();
// Solve with ILP solver (efficient for larger instances)
let solver = ILPSolver::new();
let ilp_solution = solver.solve(ilp).unwrap();
// Extract solution back to original problem
let solution = reduction.extract_solution(&ilp_solution);
assert_eq!(solution.iter().sum::<usize>(), 2); // Max IS size is 2Contribute 10 non-trivial reduction rules and you will be automatically added to the author list of the paper. To facilitate the development, we provide the AI tools to help developers implement their plans. Developers still need to carefully design the test cases and verify the correctness of the reduction rules.
Step by step
- Find or create a GitHub issue describing your proposal, which rule to add and how to test it. You may have some discussions with other developers to refine the proposal.
- Write a detailed plan in
docs/plans/issue-<number>-<slug>.md.- If you use Claude Code, it is recommended to use the issue-to-pr skill. The skill will invoke superpowers:brainstorm to help you write a detailed plan:
Afterwards, the skill creates a PR starting with
/issue-to-pr <issue-number>[action], which automatically triggers Claude CI to implement the plan. - Otherwise, you can write a detailed plan manually (sample). Then create a PR manually. You can start implementing this plan on the CI machine by adding
[action]at the start of the PR description or comments.
- If you use Claude Code, it is recommended to use the issue-to-pr skill. The skill will invoke superpowers:brainstorm to help you write a detailed plan:
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)MIT License - see LICENSE for details.