Skip to content

Commit ddcd60d

Browse files
committed
update docs
1 parent f427b14 commit ddcd60d

2 files changed

Lines changed: 25 additions & 56 deletions

File tree

.github/workflows/docs.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ jobs:
2828
curl -sSL https://github.com/rust-lang/mdBook/releases/download/v0.4.37/mdbook-v0.4.37-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C "$HOME/bin"
2929
echo "$HOME/bin" >> $GITHUB_PATH
3030
31+
- name: Install Typst
32+
run: |
33+
curl -sSL https://github.com/typst/typst/releases/download/v0.12.0/typst-x86_64-unknown-linux-musl.tar.xz | tar -xJ
34+
mv typst-x86_64-unknown-linux-musl/typst "$HOME/bin/"
35+
3136
- name: Build mdBook
3237
run: mdbook build
3338

39+
- name: Build PDF
40+
run: typst compile docs/paper/reductions.typ book/reductions.pdf
41+
3442
- name: Build rustdoc
3543
run: cargo doc --no-deps
3644

README.md

Lines changed: 17 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,14 @@
33
[![CI](https://github.com/CodingThrust/problem-reductions/actions/workflows/ci.yml/badge.svg)](https://github.com/CodingThrust/problem-reductions/actions/workflows/ci.yml)
44
[![codecov](https://codecov.io/github/CodingThrust/problem-reductions/graph/badge.svg?token=0CdEC8GHN0)](https://codecov.io/github/CodingThrust/problem-reductions)
55
[![Documentation](https://github.com/CodingThrust/problem-reductions/actions/workflows/docs.yml/badge.svg)](https://codingthrust.github.io/problem-reductions/)
6+
[![PDF Manual](https://img.shields.io/badge/PDF-Manual-blue)](https://codingthrust.github.io/problem-reductions/reductions.pdf)
67
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
78

8-
A Rust library for NP-hard problem definitions and reductions.
9-
10-
## Features
11-
12-
- **18+ Problem Types**: Implementations of classic NP-hard problems
13-
- **Type-Safe Reductions**: Compile-time verified problem transformations
14-
- **Graph Abstraction**: Generic `Graph` trait with `SimpleGraph` and `UnitDiskGraph` implementations
15-
- **Multiple Solvers**: BruteForce and ILP (HiGHS) solvers
16-
- **Topology Types**: HyperGraph and UnitDiskGraph for specialized constraints
17-
- **File I/O**: JSON serialization for all problem types
9+
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 help of AI.
1810

1911
## Installation
2012

21-
Add to your `Cargo.toml`:
13+
Add to your `Cargo.toml` (not yet available):
2214

2315
```toml
2416
[dependencies]
@@ -29,40 +21,23 @@ problemreductions = "0.1"
2921

3022
```rust
3123
use problemreductions::prelude::*;
24+
use problemreductions::models::optimization::ILP;
3225

33-
// Create an Independent Set problem
34-
let problem: IndependentSetT = IndependentSetT::new(4, vec![(0, 1), (1, 2), (2, 3)]);
35-
36-
// Solve with brute force
37-
let solver = BruteForce::new();
38-
let solutions = solver.find_best(&problem);
39-
40-
// Apply a reduction
41-
let result = ReduceTo::<VertexCoverT>::reduce_to(&problem);
42-
let vc = result.target_problem();
43-
```
44-
45-
## Problem Types
46-
47-
| Category | Problems |
48-
|----------|----------|
49-
| **Satisfiability** | SAT, K-SAT, CircuitSAT, Factoring |
50-
| **Graph** | IndependentSet, MaximalIS, VertexCovering, DominatingSet, Coloring, MaxCut, Matching |
51-
| **Set** | SetCovering, SetPacking |
52-
| **Optimization** | SpinGlass, QUBO |
53-
| **Specialized** | Paintshop, BicliqueCover, BMF |
54-
55-
## Available Reductions
26+
// Create an Independent Set problem on a path graph
27+
let problem = IndependentSet::<i32>::new(4, vec![(0, 1), (1, 2), (2, 3)]);
5628

57-
- IndependentSet ↔ VertexCovering
58-
- IndependentSet ↔ SetPacking
59-
- SpinGlass ↔ QUBO
60-
- SpinGlass ↔ MaxCut
29+
// Reduce to Integer Linear Programming
30+
let reduction = ReduceTo::<ILP>::reduce_to(&problem);
31+
let ilp = reduction.target_problem();
6132

62-
## Documentation
33+
// Solve with ILP solver (efficient for larger instances)
34+
let solver = ILPSolver::new();
35+
let ilp_solution = solver.solve(ilp).unwrap();
6336

64-
- [User Guide](https://CodingThrust.github.io/problem-reductions/)
65-
- [API Reference](https://docs.rs/problemreductions)
37+
// Extract solution back to original problem
38+
let solution = reduction.extract_solution(&ilp_solution);
39+
assert_eq!(solution.iter().sum::<usize>(), 2); // Max IS size is 2
40+
```
6641

6742
## Development
6843

@@ -81,19 +56,11 @@ make clean # Clean build artifacts
8156
make check # Quick check before commit (fmt + clippy + test)
8257
```
8358

84-
### Using Cargo directly
85-
86-
```bash
87-
cargo build --all-features
88-
cargo test --all-features
89-
cargo doc --all-features --no-deps --open
90-
```
91-
9259
## Contributing
9360

9461
### Authorship Recognition
9562

96-
**Contribute 10 non-trivial reduction rules and you will be automatically added to the author list of the paper.**
63+
**Contribute 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.
9764

9865
### Using Claude Code (Recommended)
9966

@@ -105,12 +72,6 @@ cargo doc --all-features --no-deps --open
10572
3. Brainstorm with Claude using `superpowers:brainstorming` to clarify requirements
10673
4. The skill creates a PR starting with `[action]`, which automatically triggers Claude CI to implement the plan
10774

108-
### Manual Contribution
109-
110-
1. Follow guides in `.claude/rules/` for adding reductions or models
111-
2. Run `make test clippy export-graph` before submitting
112-
3. Ensure >95% test coverage for new code
113-
11475
## License
11576

11677
MIT License - see [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)