Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #57 +/- ##
==========================================
- Coverage 96.94% 96.93% -0.02%
==========================================
Files 174 176 +2
Lines 25043 25337 +294
==========================================
+ Hits 24278 24560 +282
- Misses 765 777 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new graph optimization model, HamiltonianCycle<G, W>, to represent the minimum-weight Hamiltonian cycle problem, along with unit tests and documentation/schema registration so it appears in exported schemas and the paper.
Changes:
- Introduces
HamiltonianCyclemodel (edge-based binary variables, validity check, objective evaluation,from_graphconstructors) and exports it from graph/model modules and the crate prelude. - Adds comprehensive unit tests exercising construction, validation, evaluation, and brute-force solving on small instances.
- Registers/updates documentation artifacts (problem schema JSON + paper
display-nameandproblem-def) and adds an implementation plan document.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/models/graph/hamiltonian_cycle.rs |
New HamiltonianCycle model + schema registration + is_hamiltonian_cycle validator |
src/models/graph/mod.rs |
Wires new model into the graph module and re-exports it |
src/models/mod.rs |
Re-exports HamiltonianCycle at the models module level and updates category docs |
src/lib.rs |
Adds HamiltonianCycle to the crate prelude |
src/unit_tests/models/graph/hamiltonian_cycle.rs |
New unit tests for the model + brute-force solver behavior |
docs/src/reductions/problem_schemas.json |
Adds schema entry for HamiltonianCycle |
docs/paper/reductions.typ |
Adds paper display-name + formal problem definition |
docs/plans/2026-02-13-hamiltonian-cycle-model.md |
Adds implementation plan document for the model |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
docs/paper/reductions.typ
Outdated
| ] | ||
|
|
||
| #problem-def("HamiltonianCycle")[ | ||
| Given an undirected graph $G=(V,E)$ with edge weights $w: E -> RR$, find a cycle visiting every vertex exactly once that minimizes $sum_(e in C) w(e)$. |
There was a problem hiding this comment.
The problem definition uses C in the objective (sum_(e in C) w(e)) but doesn't define what C is. Please define C (e.g., C ⊆ E is the edge set of a Hamiltonian cycle / a cycle visiting every vertex exactly once) so the statement is self-contained and unambiguous.
| Given an undirected graph $G=(V,E)$ with edge weights $w: E -> RR$, find a cycle visiting every vertex exactly once that minimizes $sum_(e in C) w(e)$. | |
| Given an undirected graph $G=(V,E)$ with edge weights $w: E -> RR$, find an edge set $C subset.eq E$ that forms a cycle visiting every vertex exactly once and minimizes $sum_(e in C) w(e)$. |
GiggleLiu
left a comment
There was a problem hiding this comment.
Weighted HamiltonianCycle is equivalent to TravelingSalesman problem. Please rename.
Resolve PR review comments: weighted HamiltonianCycle is equivalent to the Traveling Salesman Problem, so rename accordingly. Also fix problem definition to properly define the edge set C. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
[action]
Summary
HamiltonianCycle<G, W>optimization model: finds minimum-weight cycle visiting every vertex exactly oncedims = [2; num_edges]), with validity check for degree-2, connectivity, and edge countMaximumMatchingpattern (edge weights,from_graphconstructors,is_weighted())problem-defanddisplay-nameentryCloses #47