Skip to content

Commit 9cf7250

Browse files
GiggleLiuclaude
andcommitted
docs: deduplicate CLAUDE.md, fix CircuitSAT category
- Replace repeated trait/solver/naming details with cross-references - Remove duplicate example test rules and "Before PR" section - Fix CircuitSAT listed under both satisfiability/ and specialized/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cdc64ea commit 9cf7250

1 file changed

Lines changed: 5 additions & 53 deletions

File tree

.claude/CLAUDE.md

Lines changed: 5 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -185,32 +185,17 @@ cargo run --example export_graph
185185

186186
### Trait Implementations
187187

188-
Every problem must implement `Problem` (see `src/traits.rs`). Key points:
189-
190-
- **`type Metric`**`SolutionSize<W>` for optimization, `bool` for satisfaction
191-
- **`fn dims()`** — configuration space dimensions (e.g., `vec![2; n]` for n binary variables)
192-
- **`fn evaluate()`** — return `SolutionSize::Valid(value)` / `SolutionSize::Invalid` for optimization, or `bool` for satisfaction
193-
- **`fn variant()`** — graph and weight type metadata for the reduction registry
194-
195-
Optimization problems additionally implement `OptimizationProblem` (see `src/traits.rs`):
196-
- **`type Value`** — the inner objective type (e.g., `i32`, `f64`, `W`)
197-
- **`fn direction()`**`Direction::Maximize` or `Direction::Minimize`
198-
199-
The supertrait `Problem<Metric = SolutionSize<Self::Value>>` ensures the solver can call `metric.is_valid()` and `metric.is_better()` directly — no per-problem customization needed.
200-
201-
Weight management (`weights()`, `set_weights()`, `is_weighted()`) goes on inherent `impl` blocks, not traits. See the reference implementation for the pattern.
188+
See Trait Hierarchy above for `Problem` and `OptimizationProblem` members. Weight management (`weights()`, `set_weights()`, `is_weighted()`) goes on inherent `impl` blocks, not traits. See the reference implementation for the pattern.
202189

203190
### Categories
204191

205-
- `src/models/satisfiability/` — Satisfiability, KSatisfiability, CircuitSAT
192+
- `src/models/satisfiability/` — Satisfiability, KSatisfiability
206193
- `src/models/graph/` — MaximumIndependentSet, MinimumVertexCover, KColoring, etc.
207194
- `src/models/set/` — MinimumSetCovering, MaximumSetPacking
208195
- `src/models/optimization/` — SpinGlass, QUBO, ILP
209196
- `src/models/specialized/` — CircuitSAT, Factoring, PaintShop, BicliqueCover, BMF
210197

211-
### Naming
212-
213-
Use explicit optimization prefixes: `Maximum` for maximization, `Minimum` for minimization (e.g., `MaximumIndependentSet`, `MinimumVertexCover`).
198+
Naming convention: see Problem Names above.
214199

215200
## Testing Requirements
216201

@@ -232,44 +217,11 @@ New code must have >95% test coverage. Run `make coverage` to check.
232217

233218
### Key Testing Patterns
234219

235-
Follow the reference files above for exact API usage. Summary:
236-
237-
- `solver.find_best(&problem)``Option<Vec<usize>>` — one optimal solution for optimization problems
238-
- `solver.find_satisfying(&problem)``Option<Vec<usize>>` — one satisfying assignment
239-
- `solver.find_all_best(&problem)``Vec<Vec<usize>>` — all optimal solutions (BruteForce only)
240-
- `solver.find_all_satisfying(&problem)``Vec<Vec<usize>>` — all satisfying assignments (BruteForce only)
241-
- `problem.evaluate(&config)` — returns `SolutionSize::Valid(value)` / `SolutionSize::Invalid` for optimization, `bool` for satisfaction
220+
See Key Patterns above for solver API signatures. Follow the reference files for exact usage.
242221

243222
### File Organization
244223

245-
Unit tests live in `src/unit_tests/`, mirroring `src/` structure. Source files reference them via `#[path]`:
246-
247-
```rust
248-
// In src/rules/foo_bar.rs:
249-
#[cfg(test)]
250-
#[path = "../unit_tests/rules/foo_bar.rs"]
251-
mod tests;
252-
```
253-
254-
Integration tests are in `tests/suites/`, consolidated through `tests/main.rs`.
255-
256-
### Example Tests
257-
258-
**Reference:** `tests/suites/examples.rs` — macro-based test harness
259-
260-
Example programs (`examples/reduction_*.rs`) are tested via `include!` in `tests/suites/examples.rs` — each example is compiled directly into the test binary (no subprocess overhead). Each example must expose a `pub fn run()` entry point. See any existing example (e.g., `examples/reduction_minimumvertexcover_to_maximumindependentset.rs`) for the pattern:
261-
262-
- `pub fn run()` with logic + `fn main() { run() }`
263-
- Regular comments (`//`) not inner doc comments (`//!`)
264-
- Hardcoded example name, not `env!("CARGO_BIN_NAME")`
265-
266-
The test harness auto-registers each example as a separate `#[test]`, so `cargo test` runs them in parallel.
267-
268-
### Before PR
269-
270-
```bash
271-
make test clippy
272-
```
224+
Unit tests in `src/unit_tests/` linked via `#[path]` (see Core Modules above). Integration tests in `tests/suites/`, consolidated through `tests/main.rs`. Example tests in `tests/suites/examples.rs` (see Example Program in Adding a Reduction above).
273225

274226
## Documentation Requirements
275227

0 commit comments

Comments
 (0)