Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #619 +/- ##
========================================
Coverage 96.84% 96.85%
========================================
Files 262 264 +2
Lines 35029 35164 +135
========================================
+ Hits 33924 34058 +134
- Misses 1105 1106 +1 ☔ 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 |
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