Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #619 +/- ##
========================================
Coverage 97.21% 97.21%
========================================
Files 310 312 +2
Lines 40595 40734 +139
========================================
+ Hits 39463 39600 +137
- Misses 1132 1134 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- New satisfaction problem (Metric = bool) for Hamiltonian circuit detection - Permutation encoding: dims() = vec![n; n] - Evaluate checks valid permutation + consecutive edge existence - Held-Karp complexity: O(n^2 * 2^n) in declare_variants! - CLI integration: dispatch, alias (HC), create, random generation - Unit tests: basic, no-solution, solver, serialization - Paper: problem-def + Bjorklund 2014 bibliography entry Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implementation SummaryChanges
Deviations from Plan
Open Questions
|
There was a problem hiding this comment.
Pull request overview
Adds a new NP-complete graph satisfaction model (HamiltonianCircuit) to the core library, integrates it into the CLI (name/alias/dispatch/create), and updates the paper documentation and references.
Changes:
- Introduces
HamiltonianCircuit<G>model with permutation-based encoding and variant declaration. - Adds CLI support: alias resolution (
HC), JSON (de)serialization dispatch, andpred create/ random generation wiring. - Adds unit tests plus paper documentation section and bibliography entry.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/models/graph/hamiltonian_circuit.rs | New Hamiltonian circuit satisfaction model + schema registration + variants + tests hook |
| src/unit_tests/models/graph/hamiltonian_circuit.rs | New unit tests for evaluation, solver enumeration, and serde round-trip |
| src/models/graph/mod.rs | Exposes the new graph model in the graph module |
| src/models/mod.rs | Re-exports HamiltonianCircuit from the top-level models module |
| problemreductions-cli/src/problem_name.rs | Adds HC alias and resolves hc / hamiltoniancircuit |
| problemreductions-cli/src/dispatch.rs | Adds load/serialize support for HamiltonianCircuit<SimpleGraph> as a SAT problem |
| problemreductions-cli/src/commands/create.rs | Adds pred create HamiltonianCircuit and random instance generation support |
| problemreductions-cli/src/cli.rs | Documents CLI flags for HamiltonianCircuit and HC |
| docs/paper/references.bib | Adds Björklund 2014 reference |
| docs/paper/reductions.typ | Adds Hamiltonian Circuit problem definition section in the paper |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fn evaluate(&self, config: &[usize]) -> bool { | ||
| let n = self.graph.num_vertices(); | ||
| if config.len() != n { | ||
| return false; | ||
| } | ||
|
|
|
HC is intentionally a separate model from TSP — it's a |
Resolve conflicts: keep both HamiltonianCircuit (PR) and main's new models (IsomorphicSpanningTree, HamiltonianPath, etc.). Update HamiltonianCircuit to use current ProblemSchemaEntry fields and declare_variants! syntax. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
A Hamiltonian circuit requires at least 3 vertices. Return false early for degenerate cases, addressing Copilot review comment. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use 1.657^num_vertices complexity (Björklund 2014), matching HamiltonianPath - Add canonical_model_example_specs for example-db system - Register in graph/mod.rs example specs aggregator - Add trait_consistency entry - Add edge case tests: n<3 graphs, wrong-length config, out-of-range vertex, K3 triangle, K4 complete graph solution count Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…st/problem-reductions into issue-216-hamiltonian-circuit
Resolve conflicts: keep registry-based dispatch from main, add HamiltonianCircuit alongside main's new models. Update HamiltonianCircuit to current declare_variants!/ProblemSchemaEntry patterns.
…dingThrust/problem-reductions into issue-216-hamiltonian-circuit
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dingThrust/problem-reductions into issue-216-hamiltonian-circuit
Review Pipeline Report
Fix applied
🤖 Generated by review-pipeline |
Review Pipeline Report
Fixes applied during review
🤖 Generated by review-pipeline |
Review Pipeline Report
Fixes Applied
Agentic Test Summary
🤖 Generated by review-pipeline |
Review Pipeline Report
Notes
🤖 Generated by review-pipeline |
Review Pipeline Report
DetailsMerge with main: 7 conflicts resolved (registry-based dispatch from main preferred over manual dispatch). Structural completeness: All checks pass — model file, inventory registration, declare_variants!, Problem + SatisfactionProblem traits, unit tests (6), trait_consistency, CLI create support, paper entry, example-db registration. Quality review: Clean implementation. One formatting fix applied. No critical or important issues. Agentic feature test: Simulated a grad student using HC via CLI and library API. All CLI commands work (list, show, create, solve, inspect, pipe, evaluate). Solver correctly finds circuits and reports no-solution for infeasible graphs. 🤖 Generated by review-pipeline |
Review Pipeline Report
🤖 Generated by review-pipeline |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The entry already existed on main; the PR added a second copy that caused a Typst compile error after merging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add example with figure to HamiltonianCircuit problem-def entry, loading data from canonical examples.json (prism graph) - Extract is_valid_hamiltonian_circuit() pub(crate) helper, matching the HamiltonianPath pattern (is_valid_hamiltonian_path) - Add is_valid_solution() convenience method on HamiltonianCircuit Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new graph decision model, HamiltonianCircuit, and integrates it across the library API surface, CLI instance generation, fixtures, unit tests, and the paper docs.
Changes:
- Introduces
HamiltonianCircuit<G>model (schema registration, variant declaration, example-db spec) with validity checking via permutation + wrap-around edge adjacency. - Adds comprehensive unit tests and wires the model into trait-consistency checks, exports (
models,prelude), and the graph module registry. - Extends CLI support (
pred create+ random generation), example-db fixtures, and paper documentation/references for the new problem.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/models/graph/hamiltonian_circuit.rs |
New HamiltonianCircuit model + schema entry + variants + example-db spec + tests hook |
src/models/graph/mod.rs |
Registers module/export and includes canonical example spec |
src/models/mod.rs |
Re-exports HamiltonianCircuit from models::graph |
src/lib.rs |
Adds HamiltonianCircuit to the prelude exports |
src/unit_tests/models/graph/hamiltonian_circuit.rs |
New unit test suite for evaluation, solver behavior, and serialization |
src/unit_tests/trait_consistency.rs |
Adds trait-consistency check coverage for HamiltonianCircuit |
problemreductions-cli/src/commands/create.rs |
Adds CLI creation + random generation support and help example string |
problemreductions-cli/src/cli.rs |
Documents CLI flags / alias (HC) for HamiltonianCircuit |
src/example_db/fixtures/examples.json |
Adds canonical fixture instance + samples/optimal satisfying configurations |
docs/paper/references.bib |
Adds/normalizes the Björklund 2014 reference used by the paper text |
docs/paper/reductions.typ |
Adds HamiltonianCircuit section with example and figure driven from fixtures |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
Adds the HamiltonianCircuit satisfaction problem — a classical NP-complete problem (Karp, 1972) asking whether an undirected graph contains a cycle visiting every vertex exactly once.
dims() = vec![n; n])Fixes #216