|
1 | 1 | //! # Problem Reductions |
2 | 2 | //! |
3 | | -//! A Rust library for reducing NP-hard problems. |
| 3 | +//! NP-hard problem definitions and reductions. |
| 4 | +//! See the [user guide](https://codingthrust.github.io/problem-reductions/) for tutorials and examples. |
4 | 5 | //! |
5 | | -//! This library provides implementations of various NP-hard computational problems |
6 | | -//! and reduction rules between them. It is designed for algorithm research, |
7 | | -//! education, and quantum optimization studies. |
| 6 | +//! ## API Overview |
8 | 7 | //! |
9 | | -//! ## Features |
| 8 | +//! | Module | Purpose | |
| 9 | +//! |--------|---------| |
| 10 | +//! | [`models`] | Problem types — [`graph`](models::graph), [`satisfiability`](models::satisfiability), [`set`](models::set), [`optimization`](models::optimization), [`specialized`](models::specialized) | |
| 11 | +//! | [`rules`] | Reduction rules, [`ReductionGraph`](rules::ReductionGraph) for path search | |
| 12 | +//! | [`solvers`] | [`BruteForce`] and [`ILPSolver`](solvers::ILPSolver) | |
| 13 | +//! | [`topology`] | Graph types — [`SimpleGraph`](topology::SimpleGraph), [`HyperGraph`](topology::HyperGraph), [`UnitDiskGraph`](topology::UnitDiskGraph), etc. | |
| 14 | +//! | [`traits`] | Core traits — [`Problem`], [`OptimizationProblem`], [`SatisfactionProblem`] | |
| 15 | +//! | [`types`] | [`SolutionSize`], [`Direction`], [`ProblemSize`], [`WeightElement`] | |
| 16 | +//! | [`variant`] | Variant parameter system for problem type parameterization | |
10 | 17 | //! |
11 | | -//! - **Problem Definitions**: Implementations of 21+ NP-hard problems |
12 | | -//! - **Reduction Rules**: Transform problems into equivalent problems |
13 | | -//! - **Solvers**: Brute-force solver for testing and verification |
14 | | -//! - **Validation**: Utilities to verify solution validity |
15 | | -//! |
16 | | -//! ## Example |
17 | | -//! |
18 | | -//! ```rust |
19 | | -//! use problemreductions::prelude::*; |
20 | | -//! use problemreductions::models::graph::MaximumIndependentSet; |
21 | | -//! use problemreductions::topology::SimpleGraph; |
22 | | -//! |
23 | | -//! // Create an Independent Set problem on a triangle graph |
24 | | -//! let problem = MaximumIndependentSet::new(SimpleGraph::new(3, vec![(0, 1), (1, 2), (0, 2)]), vec![1i32; 3]); |
25 | | -//! |
26 | | -//! // Solve with brute force |
27 | | -//! let solver = BruteForce::new(); |
28 | | -//! let solution = solver.find_best(&problem).unwrap(); |
29 | | -//! |
30 | | -//! // Maximum independent set in a triangle has size 1 |
31 | | -//! assert_eq!(solution.iter().sum::<usize>(), 1); |
32 | | -//! ``` |
33 | | -//! |
34 | | -//! ## Problem Categories |
35 | | -//! |
36 | | -//! ### Satisfiability |
37 | | -//! - SAT: Boolean satisfiability with CNF clauses |
38 | | -//! - K-SAT: SAT restricted to k-literal clauses |
39 | | -//! - CircuitSAT: Boolean circuit satisfiability |
40 | | -//! - Factoring: Integer factorization |
41 | | -//! |
42 | | -//! ### Graph Problems |
43 | | -//! - MaximumIndependentSet: Maximum weight independent set |
44 | | -//! - MaximalIS: Maximal independent set |
45 | | -//! - MinimumVertexCover: Minimum weight vertex cover |
46 | | -//! - MinimumDominatingSet: Minimum dominating set |
47 | | -//! - MaximumClique: Maximum weight clique |
48 | | -//! - MaxCut: Maximum cut on weighted graphs |
49 | | -//! - MaximumMatching: Maximum weight matching |
50 | | -//! - KColoring: K-vertex coloring |
51 | | -//! - TravelingSalesman: Minimum weight Hamiltonian cycle |
52 | | -//! |
53 | | -//! ### Set Problems |
54 | | -//! - MinimumSetCovering: Minimum weight set cover |
55 | | -//! - MaximumSetPacking: Maximum weight set packing |
56 | | -//! |
57 | | -//! ### Optimization Problems |
58 | | -//! - SpinGlass: Ising model Hamiltonian |
59 | | -//! - QUBO: Quadratic unconstrained binary optimization |
60 | | -//! - ILP: Integer linear programming |
61 | | -//! |
62 | | -//! ### Specialized Problems |
63 | | -//! - PaintShop: Minimize color switches |
64 | | -//! - BicliqueCover: Biclique cover on bipartite graphs |
65 | | -//! - BMF: Boolean matrix factorization |
| 18 | +//! Use [`prelude`] for convenient imports. |
66 | 19 |
|
67 | 20 | pub mod config; |
68 | 21 | pub mod error; |
|
0 commit comments