Skip to content

Commit f427b14

Browse files
GiggleLiuclaude
andcommitted
Add design for issue 24 and README example fix
- PDF manual download via GitHub Pages - Fix README Quick Start to use correct imports and show ILP reduction 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 2a62192 commit f427b14

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Design: Issue 24 - PDF Download & README Example Fix
2+
3+
## Overview
4+
5+
This design addresses two related improvements:
6+
1. **Issue 24**: Add PDF manual download to documentation
7+
2. **README fix**: Update Quick Start example to use correct imports and show ILP reduction
8+
9+
## Part 1: README Example Fix
10+
11+
### Problem
12+
The current README example uses `IndependentSetT` and `VertexCoverT` which are not exported in `prelude::*`, causing compilation errors.
13+
14+
### Solution
15+
Replace with `IndependentSet` (which IS in prelude) and demonstrate the more valuable ILP reduction workflow.
16+
17+
### Updated Example
18+
19+
```rust
20+
use problemreductions::prelude::*;
21+
use problemreductions::models::optimization::ILP;
22+
23+
// Create an Independent Set problem on a path graph
24+
let problem = IndependentSet::<i32>::new(4, vec![(0, 1), (1, 2), (2, 3)]);
25+
26+
// Reduce to Integer Linear Programming
27+
let reduction = ReduceTo::<ILP>::reduce_to(&problem);
28+
let ilp = reduction.target_problem();
29+
30+
// Solve with ILP solver (efficient for larger instances)
31+
let solver = ILPSolver::new();
32+
let ilp_solution = solver.solve(ilp).unwrap();
33+
34+
// Extract solution back to original problem
35+
let solution = reduction.extract_solution(&ilp_solution);
36+
assert_eq!(solution.iter().sum::<usize>(), 2); // Max IS size is 2
37+
```
38+
39+
This demonstrates the core value proposition: reduce NP-hard problems to ILP for efficient solving.
40+
41+
## Part 2: Issue 24 - PDF Download
42+
43+
### Requirements
44+
- Compile typst paper to PDF in CI
45+
- Host PDF on GitHub Pages
46+
- Add prominent badge in README
47+
48+
### README Badge
49+
50+
Add after existing badges:
51+
```markdown
52+
[![PDF Manual](https://img.shields.io/badge/PDF-Manual-blue)](https://codingthrust.github.io/problem-reductions/reductions.pdf)
53+
```
54+
55+
### Workflow Changes (docs.yml)
56+
57+
Add to build job:
58+
59+
```yaml
60+
- name: Install Typst
61+
run: |
62+
curl -sSL https://github.com/typst/typst/releases/download/v0.12.0/typst-x86_64-unknown-linux-musl.tar.xz | tar -xJ
63+
mv typst-x86_64-unknown-linux-musl/typst "$HOME/bin/"
64+
65+
- name: Build PDF
66+
run: typst compile docs/paper/reductions.typ book/reductions.pdf
67+
```
68+
69+
## Implementation Checklist
70+
71+
- [ ] Update README.md Quick Start example
72+
- [ ] Add PDF badge to README.md
73+
- [ ] Add typst installation step to docs.yml
74+
- [ ] Add PDF compilation step to docs.yml
75+
- [ ] Test workflow locally if possible
76+
77+
## Files to Modify
78+
79+
1. `README.md` - Fix example, add badge
80+
2. `.github/workflows/docs.yml` - Add typst compilation

0 commit comments

Comments
 (0)