Skip to content

Commit b0fd4e3

Browse files
committed
Merge branch 'main' of github.com:CodingThrust/problem-reductions
2 parents 1975fc1 + 487517e commit b0fd4e3

121 files changed

Lines changed: 4990 additions & 2284 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ enum Direction { Maximize, Minimize }
7272
### Key Patterns
7373
- Problems parameterized by weight type `W` and graph type `G`
7474
- `ReductionResult` provides `target_problem()` and `extract_solution()`
75-
- `Solver::find_best()` for optimization problems, `Solver::find_satisfying()` for `Metric = bool`
75+
- `Solver::find_best()``Option<Vec<usize>>` for optimization problems; `Solver::find_satisfying()``Option<Vec<usize>>` for `Metric = bool`
76+
- `BruteForce::find_all_best()` / `find_all_satisfying()` return `Vec<Vec<usize>>` for all optimal/satisfying solutions
7677
- Graph types: SimpleGraph, GridGraph, UnitDiskGraph, Hypergraph
7778
- Weight types: `Unweighted` (marker), `i32`, `f64`
7879
- Weight management via inherent methods (`weights()`, `set_weights()`, `is_weighted()`), not traits

.claude/rules/testing.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ New code must have >95% test coverage. Run `make coverage` to check.
2020

2121
Follow the reference files above for exact API usage. Summary:
2222

23-
- `solver.find_best(&problem)` — for optimization problems (`OptimizationProblem`, `Metric = SolutionSize<W>`)
24-
- `solver.find_satisfying(&problem)` — for satisfaction problems (`Metric = bool`)
23+
- `solver.find_best(&problem)``Option<Vec<usize>>` — one optimal solution for optimization problems
24+
- `solver.find_satisfying(&problem)``Option<Vec<usize>>` — one satisfying assignment
25+
- `solver.find_all_best(&problem)``Vec<Vec<usize>>` — all optimal solutions (BruteForce only)
26+
- `solver.find_all_satisfying(&problem)``Vec<Vec<usize>>` — all satisfying assignments (BruteForce only)
2527
- `problem.evaluate(&config)` — returns `SolutionSize::Valid(value)` / `SolutionSize::Invalid` for optimization, `bool` for satisfaction
2628

2729
## File Organization

Makefile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Makefile for problemreductions
22

3-
.PHONY: help build test fmt clippy doc mdbook paper examples clean coverage rust-export compare qubo-testdata export-schemas release run-plan
3+
.PHONY: help build test fmt clippy doc mdbook paper examples clean coverage rust-export compare qubo-testdata export-schemas release run-plan diagrams
44

55
# Default target
66
help:
@@ -11,6 +11,7 @@ help:
1111
@echo " fmt-check - Check code formatting"
1212
@echo " clippy - Run clippy lints"
1313
@echo " doc - Build mdBook documentation"
14+
@echo " diagrams - Generate SVG diagrams from Typst (light + dark)"
1415
@echo " mdbook - Build and serve mdBook (with live reload)"
1516
@echo " paper - Build Typst paper (requires typst)"
1617
@echo " coverage - Generate coverage report (requires cargo-llvm-cov)"
@@ -47,16 +48,26 @@ clippy:
4748
# Build mdBook documentation
4849
doc:
4950
cargo run --example export_graph
50-
cp docs/paper/reduction_graph.json docs/src/reductions/
51+
cargo run --example export_schemas
5152
mdbook build docs
5253
RUSTDOCFLAGS="--default-theme=dark" cargo doc --all-features --no-deps
5354
rm -rf docs/book/api
5455
cp -r target/doc docs/book/api
5556

57+
# Generate SVG diagrams from Typst sources (light + dark themes)
58+
TYPST_DIAGRAMS := $(wildcard docs/src/static/*.typ)
59+
diagrams:
60+
@for src in $(TYPST_DIAGRAMS); do \
61+
base=$$(basename $$src .typ); \
62+
echo "Compiling $$base..."; \
63+
typst compile $$src --input dark=false docs/src/static/$$base.svg; \
64+
typst compile $$src --input dark=true docs/src/static/$$base-dark.svg; \
65+
done
66+
5667
# Build and serve mdBook with API docs
5768
mdbook:
5869
cargo run --example export_graph
59-
cp docs/paper/reduction_graph.json docs/src/reductions/
70+
cargo run --example export_schemas
6071
RUSTDOCFLAGS="--default-theme=dark" cargo doc --all-features --no-deps
6172
mdbook build
6273
rm -rf book/api
@@ -84,7 +95,7 @@ export-schemas:
8495
paper: examples
8596
cargo run --example export_graph
8697
cargo run --example export_schemas
87-
cd docs/paper && typst compile reductions.typ reductions.pdf
98+
cd docs/paper && typst compile --root .. reductions.typ reductions.pdf
8899

89100
# Generate coverage report (requires: cargo install cargo-llvm-cov)
90101
coverage:

0 commit comments

Comments
 (0)