Commit a4264a6
feat: variant-aware reduction paths with resolve_path (#68)
* feat: add ResolvedPath, ReductionStep, EdgeKind types
Add data types for variant-aware reduction paths:
- ReductionStep: a node with problem name and variant map
- EdgeKind: either a registered Reduction (with overhead) or NaturalCast
- ResolvedPath: sequence of steps connected by edges, with helper methods
Also add Serialize derives to Monomial, Polynomial, and ReductionOverhead
to support serialization of the new EdgeKind::Reduction variant.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add find_best_entry for variant-aware ReductionEntry lookup
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add resolve_path for variant-level reduction paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: deprecate lookup_overhead, migrate KSat example to resolve_path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* rm plan files
* refactor: remove explicit natural reduction, rely on resolve_path
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: add #[allow(deprecated)] to examples and fix formatting
Allow deprecated lookup_overhead calls in examples pending migration,
revert unintended macro indentation change, and apply rustfmt to tests.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add design.md describing variant-aware reduction paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add variant-aware path resolution section to docs/src/design.md
Describes the two-phase resolution approach (name-level discovery +
variant-level resolve_path), KSat disambiguation, natural cast
insertion, and the execution model.
Removes the mistakenly created root design.md.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add interactive reduction diagram design
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: add interactive reduction diagram implementation plan
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: remove unnecessary #[allow(dead_code)] from variant-aware path types
ResolvedPath, ReductionStep, and EdgeKind are actively used in tests
and the KSat example, so the dead_code suppression is no longer needed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* update
* refactor: extract inline JS/CSS from introduction.md to external files
Move the ~340-line inline script and inline styles from the reduction
graph in introduction.md into separate docs/src/static/reduction-graph.js
and docs/src/static/reduction-graph.css files. Update book.toml to load
cytoscape.min.js and the new files via additional-js/additional-css.
Key changes:
- Tooltip element renamed from #tooltip to #cy-tooltip to avoid conflicts
- clearPath() is now a local function with addEventListener instead of
inline onclick handler
- DOMContentLoaded guard ensures the script only runs when #cy exists
- No behavior change; pure mechanical extraction
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: switch reduction diagram to ELK stress layout
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: implement compound nodes for reduction diagram (collapsed view)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add expand/collapse for compound variant nodes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add variant edge filtering on click
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add search bar to reduction diagram
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: integrate path finding with compound node structure
Restructure tap handler so path selection takes priority when a source
node is already selected, allowing variant nodes to participate in
path finding while still supporting single-click variant edge filtering.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add dashed style for natural cast edges
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* docs: update diagram legend and help text for compound nodes
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: polish reduction diagram interactions and edge cases
- Fix CDN URL for cytoscape-elk (correct path: /dist/cytoscape-elk.js)
- Add explicit ELK layout registration with cose fallback when CDN unavailable
- Fix expand/collapse to only show variant edges when both endpoints are visible
- Move search input styles to external CSS file
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add VariantParam trait, CastToParent, impl_variant_param!, variant_params! macros
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: add KValue trait with K2, K3, KN types for type-level K values
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: register SimpleGraph, UnitDiskGraph, HyperGraph with VariantParam
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* feat: register One, i32, f64 with VariantParam
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: migrate KSatisfiability from const K to KValue type parameter
Replace `KSatisfiability<const K: usize>` with `KSatisfiability<K: KValue>`
using the new variant type system (K2, K3, KN types).
Key changes:
- KSatisfiability struct now uses PhantomData<K> with serde skip/bound
- Reduction impls use concrete types (K2, K3, KN) instead of const generics
since the #[reduction] proc macro requires concrete types
- KSAT->SAT registered for KN (generic), K3, and K2
- SAT->KSAT registered for K3 (same as before)
- KSAT->QUBO registered for K2 and K3 (same as before)
- Variant IDs change from "2"/"3"/"N" to "K2"/"K3"/"KN"
- Prelude exports K2, K3, KN, KValue, VariantParam, CastToParent
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: migrate KColoring from const K to KValue type parameter
Replace KColoring<const K: usize, G> with KColoring<K: KValue, G> to use
type-level K parameters (K1, K2, K3, K4, KN) from the variant system.
Key changes:
- Add K1 and K4 types, extend hierarchy: K1 < K2 < K3 < K4 < KN
- Update KColoring model to use KValue trait with PhantomData<K>
- Migrate all reduction rules (SAT->KColoring, KColoring->QUBO, KColoring->ILP)
using helper function + macro pattern for concrete type registrations
- Add k_hierarchy to ReductionGraph built from VariantTypeEntry inventory
for proper subtype checking of K-value variants
- Update all tests, examples, and integration tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: apply variant_params! macro to all Problem implementations
Replace all hand-written variant() implementations with the
variant_params! macro across 19 problem files. Add VariantParam trait
implementations for GridGraph<i32> and Triangular graph types. Propagate
VariantParam bounds to generic ReductionResult impls and test helpers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: unify variant hierarchy in ReductionGraph using VariantTypeEntry
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: remove old GraphSubtypeEntry/WeightSubtypeEntry hierarchy system
The unified VariantTypeEntry system now fully covers all graph and weight
subtype registrations. Add VariantParam impls and VariantTypeEntry
registrations for PlanarGraph and BipartiteGraph (the two marker types
that were only in the old system), then remove GraphSubtypeEntry,
WeightSubtypeEntry, GraphMarker trait, GraphSubtype trait, and the
declare_graph_subtype!/declare_weight_subtype! macros. Rewrite
graph_types tests to verify the new system.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: remove deprecated const_usize_str, short_type_name, const generic rewriting
Remove legacy variant utilities replaced by the new VariantParam trait system:
- const_usize_str and short_type_name from src/variant.rs
- collect_const_generic_names and rewrite_const_generics from proc macro
- Simplify make_variant_fn_body to call Problem::variant() directly
- Remove corresponding tests from unit_tests/variant.rs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: update benchmark to use K3 type parameter instead of const generic
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: formatting fixes and regenerate artifacts after variant system redesign
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* style: apply rustfmt to sat_ksat macro indentation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* update
* refactor: remove Grid type, flatten K hierarchy, clean up exports
- Remove GridGraph/Grid type entirely; MappingResult stores positions,
node_weights, grid_dimensions, and kind (GridKind enum) directly
- Add KingsSubgraph and TriangularSubgraph as public graph types that
compute edges on-the-fly from geometry
- Remove backward-compat aliases from unitdiskmapping/mod.rs; all
consumers now use canonical ksg:: and triangular:: paths
- Flatten K value hierarchy: K1..K5 are direct children of KN with
no chain between them (k-SAT/k-coloring with different k are
independent problem classes)
- Add K5 type
- Regenerate static JSON exports with flat visualization format
- Add variant hierarchy diagram (Typst → SVG) to design docs
- Remove irrelevant plan files from this branch
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* chore: compact JSON output for paper static files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent 2b5f0fd commit a4264a6
165 files changed
Lines changed: 8643 additions & 12744 deletions
File tree
- benches
- docs
- paper
- static
- plans
- src
- reductions
- static
- examples
- problemreductions-macros/src
- src
- models
- graph
- optimization
- satisfiability
- set
- specialized
- rules
- unitdiskmapping
- ksg
- triangular
- topology
- unit_tests
- models
- graph
- optimization
- satisfiability
- set
- specialized
- rules
- unitdiskmapping
- ksg
- triangular
- topology
- unitdiskmapping_algorithms
- tests/suites
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
138 | 139 | | |
139 | 140 | | |
140 | 141 | | |
141 | | - | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
| 12 | + | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
100 | 99 | | |
101 | 100 | | |
102 | 101 | | |
103 | 102 | | |
104 | 103 | | |
105 | 104 | | |
106 | 105 | | |
107 | | - | |
| 106 | + | |
108 | 107 | | |
109 | | - | |
110 | 108 | | |
111 | | - | |
| 109 | + | |
112 | 110 | | |
113 | 111 | | |
114 | 112 | | |
115 | | - | |
116 | | - | |
| 113 | + | |
| 114 | + | |
117 | 115 | | |
118 | 116 | | |
119 | 117 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| |||
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
831 | | - | |
| 831 | + | |
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
| |||
885 | 885 | | |
886 | 886 | | |
887 | 887 | | |
888 | | - | |
| 888 | + | |
889 | 889 | | |
890 | 890 | | |
891 | 891 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
| 1 | + | |
0 commit comments