Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d9b25fb
Add symbolic growth domain (src/growth.rs) (#1075)
isPANN Jul 13, 2026
b198ddc
Rewire big_o_normal_form to the growth domain; delete canonical.rs (#…
isPANN Jul 13, 2026
b4f0753
Replace scalar Dijkstra with measured Pareto label-setting search (#1…
isPANN Jul 13, 2026
99fd008
Add instance-free asymptotic Pareto path search (GrowthLabel) + CLI/M…
isPANN Jul 13, 2026
8944ae8
Fix asymptotic Pareto front completeness: opt out of scalar B&B (#1080)
isPANN Jul 13, 2026
ad2c050
Dedup asymptotic front to one path per distinct growth vector (#1080)
isPANN Jul 13, 2026
015b1c6
Fix ILP i32->bool cast overhead: use size-field name num_vars, not ge…
isPANN Jul 13, 2026
106ca13
Silence expected reduction-probe panics in compute_source_size (#1076)
isPANN Jul 13, 2026
9849e4b
Add randomized property tests for growth domain (#1077)
isPANN Jul 13, 2026
8fd4fa8
Simplify growth/Pareto rendering and dominance (#1083)
isPANN Jul 13, 2026
a01caef
Rewire redundancy analysis to growth dominance (#1081)
isPANN Jul 13, 2026
d21822e
Give pred path --all real Big-O output (#1079)
isPANN Jul 13, 2026
b1a3d6e
Make pred path --all ordering deterministic via name+variant tiebreak…
isPANN Jul 13, 2026
66680dc
Simplify path_all sort: sort_by_cached_key (#1079)
isPANN Jul 13, 2026
5f4e9f2
Fix review blockers: growth classification, search soundness, CLI rou…
isPANN Jul 14, 2026
ba74bff
Simplify path enumeration to a single bounded-heap pass
isPANN Jul 14, 2026
daa61df
Delete branch-and-bound from the path-search kernel entirely
isPANN Jul 14, 2026
c777081
Preserve symbolic exponential bases
isPANN Jul 16, 2026
33026dc
Fix unsound measured path pruning
isPANN Jul 16, 2026
546f579
Make path search exact or explicitly approximate
isPANN Jul 20, 2026
8ac9f1b
Add deterministic solver backend registry
isPANN Jul 20, 2026
ef4a189
Simplify solver dispatch and expand coverage
isPANN Jul 21, 2026
ce27fc7
Distinguish ILP solve failures
isPANN Jul 21, 2026
3ff2300
Merge PR #1091 into PR #1083
isPANN Jul 23, 2026
7cf57c6
Clean up regression test naming and fixtures
isPANN Jul 30, 2026
4788ca0
Clean up regression test naming and fixtures
isPANN Jul 30, 2026
a906729
Make path-cost regressions source-relative
isPANN Aug 2, 2026
e5f5e78
Fix reduction verification type resolution gate
isPANN Aug 2, 2026
45a7fc6
fix reduction path execution contracts
isPANN Aug 5, 2026
83dacc0
fix infeasible reduction bundle solving
isPANN Aug 6, 2026
471a035
reject malformed extracted solutions
isPANN Aug 6, 2026
9e6960e
Establish a repository-wide standard for solution extraction (#1119)
isPANN Aug 6, 2026
07d4b3c
Establish numeric types and arithmetic standard (#1120)
isPANN Aug 7, 2026
61521b4
Make pred inspect respect exact problem variants (#1121)
isPANN Aug 7, 2026
95a7ddb
Fix KthLargestMTuple threshold decision (#1122)
isPANN Aug 7, 2026
4a9f9a0
Refactor path search around Pareto fronts (#1123)
isPANN Aug 8, 2026
7bc3e92
Fix Pareto merge CI regressions (#1124)
isPANN Aug 8, 2026
80bebc9
fix: complete QUBO SpinGlass growth fields
isPANN Aug 8, 2026
f7a8fbe
Introduce a shared exact symbolic expression core (#1127)
isPANN Aug 9, 2026
e962557
fix: propagate example overhead composition errors
isPANN Aug 9, 2026
27840b3
build: reduce development compile overhead
isPANN Aug 10, 2026
e0d7d3e
build: make HiGHS the required ILP backend
isPANN Aug 10, 2026
3ccc85b
ci: test macOS ARM64 and Windows x86_64
isPANN Aug 10, 2026
595e12d
fix: give the CLI a portable stack size
isPANN Aug 10, 2026
172815a
Replace reduction size contracts and add path size reporting (#1130)
isPANN Aug 10, 2026
7cf3bac
Make problem creation registry-driven and model-owned (#1132)
isPANN Aug 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
39 changes: 29 additions & 10 deletions .claude/CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ These repo-local skills live under `.claude/skills/*/SKILL.md`.
- [review-quality](skills/review-quality/SKILL.md) -- Generic code quality review: DRY, KISS, cohesion/coupling, test quality, HCI. Read-only, no code changes. Called by `review-pipeline`.
- [fix-pr](skills/fix-pr/SKILL.md) -- Resolve PR review comments, fix CI failures, and address codecov coverage gaps. Uses `gh api` for codecov (not local `cargo-llvm-cov`).
- [write-model-in-paper](skills/write-model-in-paper/SKILL.md) -- Write or improve a problem-def entry in the Typst paper (standalone, for improving existing entries). Core instructions are inlined in `add-model` Step 6.
- [write-rule-in-paper](skills/write-rule-in-paper/SKILL.md) -- Write or improve a reduction-rule entry in the Typst paper (standalone, for improving existing entries). Core instructions are inlined in `add-rule` Step 5.
- [write-rule-in-paper](skills/write-rule-in-paper/SKILL.md) -- Write or improve a reduction-rule entry in the Typst paper (standalone, for improving existing entries). Core instructions are inlined in `add-rule` Step 6.
- [release](skills/release/SKILL.md) -- Create a new crate release. Determines version bump from diff, verifies tests/clippy, then runs `make release`.
- [check-issue](skills/check-issue/SKILL.md) -- Quality gate for `[Rule]` and `[Model]` issues. Checks usefulness, non-triviality, correctness of literature, and writing quality. Posts structured report and adds failure labels.
- [fix-issue](skills/fix-issue/SKILL.md) -- Fix quality issues found by check-issue — auto-fixes mechanical problems, brainstorms substantive issues with human, then re-checks and moves to Ready.
Expand Down Expand Up @@ -59,7 +59,7 @@ make fmt-check # Check code formatting
make clippy # Run clippy lints
make doc # Build mdBook documentation (includes reduction graph export)
make mdbook # Build and serve mdBook with live reload
make paper # Build Typst paper from checked-in example fixtures
make paper # Generate example data and build the Typst paper
make coverage # Generate coverage report (>95% required)
make check # Quick pre-commit check (fmt + clippy + test)
make rust-export # Generate Julia parity test data (mapping stages)
Expand Down Expand Up @@ -151,13 +151,15 @@ Max<V>, Min<V>, Sum<W>, Or, And, Extremum<V>, ExtremumSense

### Key Patterns
- `variant_params!` macro implements `Problem::variant()` — e.g., `crate::variant_params![G, W]` for two type params, `crate::variant_params![]` for none (see `src/variant.rs`)
- `declare_variants!` proc macro registers concrete type instantiations with best-known complexity and registry-backed load/serialize/value-solve/witness-solve metadata. One entry per problem may be marked `default`, and variable names in complexity strings are validated at compile time against actual getter methods.
- `declare_variants!` proc macro registers concrete type instantiations with best-known complexity and registry-backed load/serialize/value-solve/witness-solve metadata. One entry per problem may be marked `default`, and variable names in complexity strings are validated at compile time against actual getter methods. Ordinary models are constructed directly from their construction schema. When user-facing construction differs from persisted JSON, define a model-local `#[derive(CreateSpec)]` DTO plus `TryFrom<CreateSpec>`, use its generated `FIELDS` in `ProblemSchemaEntry`, and register it with `create LocalSpec`; never add model-name branches in CLI or MCP code.
- `decision_problem_meta!` macro registers `DecisionProblemMeta` for a concrete inner type, providing the `DECISION_NAME` constant.
- `register_decision_variant!` macro generates `declare_variants!`, `ProblemSchemaEntry`, and both `ReductionEntry` submissions (aggregate Decision→Opt + Turing Opt→Decision) for a `Decision<P>` variant. Callers must define inherent getters (`num_vertices()`, `num_edges()`, `k()`) on `Decision<P>` before invoking. Accepts `dims`, `fields`, and `size_getters` parameters for problem-specific size fields.
- `register_decision_variant!` macro generates `declare_variants!`, `ProblemSchemaEntry`, and both `ReductionEntry` submissions (aggregate Decision→Opt + Turing Opt→Decision) for a `Decision<P>` variant. Callers must define inherent getters (`num_vertices()`, `num_edges()`, `k()`) on `Decision<P>` before invoking. Accepts an explicit structural `category` plus `dims`, `fields`, and `size_getters` parameters for problem-specific size fields.
- Problems parameterized by graph type `G` and optionally weight type `W` (problem-dependent)
- `Solver::solve()` computes the aggregate value for any `Problem` whose `Value` implements `Aggregate`
- `BruteForce::find_witness()` / `find_all_witnesses()` recover witnesses only when `P::Value::supports_witnesses()`
- `ReductionResult` provides `target_problem()` and `extract_solution()` for witness/config workflows; `AggregateReductionResult` provides `extract_value()` for aggregate/value workflows
- Every direct `extract_solution()` must call `validate_target_solution()` once before decoding; composed extractors delegate validation to the first direct decoder.
- Decode only the reduction's defined mathematical mapping. Reject malformed structure with `ExtractionError`; never panic, truncate, clamp, invent defaults, or add recovery branches. Explicit mathematical alternatives and sentinels are allowed. Test successful decoding and every rejected representation.
- CLI-facing dynamic formatting uses aggregate wrapper names directly (for example `Max(2)`, `Min(None)`, `Or(true)`, or `Sum(56)`)
- Graph types: SimpleGraph, PlanarGraph, BipartiteGraph, UnitDiskGraph, KingsSubgraph, TriangularSubgraph
- Weight types: `One` (unit weight marker), `i32`, `f64` — all implement `WeightElement` trait
Expand Down Expand Up @@ -202,20 +204,37 @@ Reduction graph nodes use variant key-value pairs from `Problem::variant()`:

### Extension Points
- New models register dynamic load/serialize/brute-force dispatch through `declare_variants!` in the model file, not by adding manual match arms in the CLI
- **CLI creation is schema-driven:** `pred create` automatically maps `ProblemSchemaEntry` fields to CLI flags via `snake_case → kebab-case` convention. New models need only: (1) matching CLI flags in `CreateArgs` + `flag_map()`, and (2) type parser support in `parse_field_value()` if using a new field type. No match arm in `create.rs` is needed.
- **CLI flag names must match schema field names.** The canonical name for a CLI flag is the schema field name in kebab-case (e.g., schema field `universe_size` → `--universe-size`, field `subsets` → `--subsets`). Old aliases (e.g., `--universe`, `--sets`) may exist as clap `alias` for backward compatibility at the clap level, but `flag_map()`, help text, error messages, and documentation must use the schema-derived name. Do not add new backward-compat aliases; if a field is renamed in the schema, update the CLI flag name to match.
- **Decision variants** of optimization problems use `Decision<P>` wrapper. Add via: (1) `decision_problem_meta!` for the inner type, (2) inherent methods on `Decision<Inner>`, (3) `register_decision_variant!` with `dims`, `fields`, `size_getters`. Schema-driven CLI creation auto-restructures flat JSON into `{inner: {...}, bound}`.
- **Model category is explicit registry metadata.** Every `ProblemSchemaEntry` declares exactly one of `Algebraic`, `Formula`, `Graph`, `Misc`, or `Set`; catalog behavior never derives it from `module_path!()` or source location.
- **CLI creation is registry-driven and two-stage:** the static parser discovers the requested problem spec without registering model subcommands, then a second parse adds flags only for the selected concrete variant. Ordinary models use `ProblemSchemaEntry.fields` directly. Models whose construction differs from persisted JSON own a typed `CreateSpec` and fallible conversion beside the model; CLI and MCP only normalize transport values and invoke the registered constructor.
- **Each construction input has one name and one concrete type per variant.** Do not add compatibility aliases or infer types from flag names. `CreateSpec` field names render as `snake_case → kebab-case` in CLI and remain `snake_case` in MCP. Add a reusable codec only for a genuinely new transport representation, never a model-name parser branch.
- **Random generation is optional and variant-owned.** Not every model has a useful, well-defined random-instance distribution. Add `RandomGenerate` only when the generator has clear semantics and a concrete use (for example, testing or examples); never invent arbitrary bounds or distributions merely to make every model support `--random`. Implement it beside the model (normally through `impl_random_generate!` and a typed `CreateSpec` input DTO), then add `random` only to the applicable `declare_variants!` entries. CLI and MCP discover the exact variant's inputs and callback; never add a model-name random dispatch or advertise random generation on an unsupported variant.
- **Decision variants** of optimization problems use `Decision<P>` wrapper. Add via: (1) `decision_problem_meta!` for the inner type, (2) inherent methods on `Decision<Inner>`, (3) `register_decision_variant!` with `dims`, `fields`, `size_getters`. The generated construction spec accepts flat inner fields plus `bound`; persisted JSON remains `{inner: {...}, bound}`.
- Aggregate-only models are first-class in `declare_variants!`; aggregate-only and Turing reduction edges still need manual `ReductionEntry` wiring because `#[reduction]` only registers witness/config reductions today
- Exact registry dispatch lives in `src/registry/`; alias resolution and partial/default variant resolution live in `problemreductions-cli/src/problem_name.rs`
- `pred create` schema-driven dispatch lives in `problemreductions-cli/src/commands/create.rs` (`create_schema_driven()`)
- Canonical paper and CLI examples live in `src/example_db/model_builders.rs` and `src/example_db/rule_builders.rs`
- Canonical model examples live in `src/example_db/model_builders.rs`; rule examples live beside their rules and are collected by `src/rules/mod.rs`

## Conventions

### Numeric Contract

Follow the [numeric types and arithmetic standard](../docs/src/design.md#numeric-types-and-arithmetic)
for every model and reduction. Before implementation, identify each numeric
input and domain, each computed total and result type, the largest supported
value, every range/sign-changing conversion, overflow behavior, and whether
arithmetic is exact or approximate. Use `TryFrom` at range boundaries and
checked arithmetic for derived values that may overflow. Rust construction,
serde, CLI, and MCP must enforce the same range.

Issue contributors provide the mathematical definition, domains, and
constraints; implementers derive the Rust representation. Do not require issue
authors to choose implementation types or add implementation-specific numeric
fields to issue templates. Changes to issue templates require user approval.

### File Naming
- Reduction files: `src/rules/<source>_<target>.rs` (e.g., `maximumindependentset_qubo.rs`)
- Model files: `src/models/<category>/<name>.rs` — category is by input structure: `graph/` (graph input), `formula/` (boolean formula/circuit), `set/` (universe + subsets), `algebraic/` (matrix/linear system/lattice), `misc/` (other)
- Canonical examples: builder functions in `src/example_db/rule_builders.rs` and `src/example_db/model_builders.rs`
- Canonical examples: model builders in `src/example_db/model_builders.rs`; rule-local `canonical_rule_example_specs()` functions collected by `src/rules/mod.rs`
- Example binaries in `examples/`: utility/export tools and pedagogical demos only (not per-reduction files)
- Test naming: `test_<source>_to_<target>_closed_loop`

Expand Down Expand Up @@ -261,7 +280,7 @@ Model review automation checks for a dedicated test file under `src/unit_tests/m
- `.claude/` — Claude Code instructions and skills
- `docs/book/` — mdBook user documentation (built with `make doc`)
- `docs/paper/reductions.typ` — Typst paper with problem definitions and reduction theorems
- `src/example_db/` — Canonical model/rule examples: `model_builders.rs`, `rule_builders.rs` (in-memory builders), `specs.rs` (per-module invariant specs), consumed by `pred create --example` and paper exports
- `src/example_db/` — Model builders, shared example specs, and rule-example aggregation consumed by `pred create --example` and paper exports
- `examples/` — Export utilities, graph-analysis helpers, and pedagogical demos

## Documentation Requirements
Expand Down
Loading
Loading