Repository navigation
feat(construction): list_k_opt construction with k from 2 to 5 - #189
Merged
Merged
Conversation
The route-local list k-opt kernel implemented only 2-opt and skipped polishing with a warning for any other `k`. For k from 3 to 5 it now scans every set of k cuts in lexicographic order and every reconnection pattern of `enumerate_reconnections(k)`, applies the first improving feasible one and rescans until none is left. Each candidate's distance delta is exact in O(k), asymmetric distances included, from the boundary edges and forward and backward prefix sums. k = 2 keeps its exact 2-opt order and trace identities.
The compiler rejected every construction `k` but 2 ("list k-opt
construction implements only 2-opt"). `list_k_opt` construction now
accepts k from 2 to 5 and polishes each route with that k; values outside
that range are rejected with the key path. Other heuristics do not use `k`
and still reject any value but the default 2, now with a message saying
so.
Closes #179.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #179. Base
main@2ecd40c1, two commits:161ceb1cfeat(list_k_opt): polish routes with k-opt for k from 3 to 56ea7773dfeat(construction): accept k from 2 to 5 for list_k_opt constructionTests: exact O(k) deltas checked against recomputed costs for every cut set and pattern on asymmetric distances (k 3..=5); a feasibility-gated route that only a segment move (not a reversal) sorts, at kernel and end-to-end level (
tests/list_k_opt_construction.rs, a new domain that scores route distance); compile-time k validation.Slice 1 alone: clippy, doc-names, file-length, solver rustdoc, solver lib and list CVRP tests: 757 passed, 0 failed. Gate on
6ea7773d(fmt, clippy, doc-names file-length facade-reachability public-api deps, rustdoc, examples, workspace all-feature tests, doctests): EXIT 0, 1537 passed, 0 failed, 66 result lines. Mutation checks: a wrong reversed inner cost failsdeltas_are_exact_for_every_cut_set_and_pattern; an executor that always passes k = 2 failsconfigured_k_reaches_the_list_k_opt_construction_kernel.While writing the end-to-end test I found that
list_cvrp_k_opt_time_windowcannot fail; filed as #188.