Repository navigation
feat(list): element groups, and joint cascading groups - #274
Merged
Merged
Conversation
A cascading_peers hook joins elements, transitively, into joint groups that propagation computes as one node: after the previous element and every dependency of every member are final, each member once. Two technicians that start a visit together each wait on the other's arrival, which a pair of dependencies would make a cycle. Models without peers run an instance with the group lookups compiled away. Closes #272
The crew example's re-exports were unused, which failed the readme_examples build under -D warnings. A test now builds the documented crew and checks that partner visits start together when the later technician arrives.
`#[planning_list_variable(element_group_fn = "path")]` declares element groups: the hook appends an element's group members in order. Groups of two or more members share one owner and keep their order, with other elements allowed between members. - `list_group_change_move_selector` relocates a whole group to joint positions of one owner; `list_group_swap_move_selector` exchanges equally sized groups on two owners. - `list_ruin_move_selector` ruins whole groups and recreates each one jointly. - `list_cheapest_insertion` and `list_regret_insertion` place each group as one unit; other construction heuristics reject a grouped list. - Single-element list moves keep grouped elements on their owner. - `max_member_distance` and `max_group_owners` (`Option<NonZeroU8>`) bound joint placement. Grouped lists get defaults for construction, group moves and ruin. - Group selectors and ruin bounds require the element-groups capability. `element_group_fn` with precedence hooks is a macro error. Ungrouped models keep the same hot path and every touched struct keeps its size: the precedence-successor and group hooks share one slot field with a kind byte in existing padding, and the bounds are single bytes. Closes #270 BREAKING CHANGE: `ListVariableSlot::precedence_successors_fn` is now a method (`element_group_fn()` shares its private field). `ListRuinMoveSelectorConfig` and `ConstructionHeuristicConfig` gain `max_member_distance` and `max_group_owners`, and `MoveSelectorConfig` gains `ListGroupChangeMoveSelector` and `ListGroupSwapMoveSelector`. Update struct literals and exhaustive matches.
Collaborator
Author
Zero-regression gate —
|
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 #270. Closes #272 (supersedes #273, cherry-picked as authored).
One branch, one gate, one release.
#272: joint cascading groups (
aa944f3c, from #273)#[shadow_variable_updates(cascading_peers = "method")]names elements computed together. Peers are joined transitively into one node of the dependency graph: its inputs are every member's previous element and dependencies, its outputs every member's next element and dependents. A group whose members wait on each other through their lists is a cycle and is unset. Models without peers run a const-generic instance with the group lookups compiled away.1d8dbbebfixes the #273 CI failure: the docs example'sCrewre-exports were unused under-D warnings. A readme test now solves the documented crew and checks partners start together.#270: list element groups
#[planning_list_variable(element_group_fn = "path")],fn(&Solution, element, &mut Vec<usize>), appends the members of an element's group in order. Groups of two or more members share one owner and keep their order; other elements may sit between members.list_group_change_move_selectorrelocates a whole group to joint positions of one owner (max_member_distance).list_group_swap_move_selectorexchanges equally sized groups on two owners.list_ruin_move_selectorruins whole groups and recreates each jointly (max_member_distance,max_group_owners). Every move has exact undo, tabu signatures and candidate-trace identity.list_cheapest_insertionandlist_regret_insertionplace each group as one unit, all member positions chosen together. A member is never placed alone, and assigned members pin the rest of their group to their owner.list_round_robin,list_clarke_wrightand the globalfirst_fit/cheapest_insertionreject a grouped list.element_owner_fnand that is not pinned, in moves, ruin and construction.max_member_distance(positions from one member to the next; 1 = adjacent) and an owner shortlist (max_group_owners, best contiguous fit first). Both areOption<NonZeroU8>, so 0 does not parse. They are rejected on lists without groups and on other heuristics.ListCheapestInsertionwithmax_group_owners = 4(reasonelement_groups_declared), group change plus group swap ahead of the other list families, and its own ruin withmax_member_distance = 7,max_group_owners = 4.ListElementGroupscapability.element_group_fntogether with precedence hooks is a macro error (trybuild case).Models without the hook keep the same hot path. Group data is
Option<Box<_>>decided once per step and frozen into the nearby probe, so ungrouped cursors do no per-candidate work.Every struct this change touches keeps its v0.30.1 size, measured with
size_ofon both trees before the gate:ListVariableSlot280,RuntimeListSlot400;MoveSelectorConfig136,ConstructionHeuristicConfig224,ListRuinMoveSelectorConfig128,PhaseConfig400,SolverConfig208;Two layout decisions keep these sizes:
Tests
list_groups: index, conflicting answers, joint placement enumeration and bounds.list_leaf::tests::groups: exact group change counts (80 unbounded, 28 at distance 1) and group swap counts (4), with do/undo restoring the lists and every pair intact after each move; grouped ruin drawing whole pairs; list change keeping grouped elements on their owner.list_element_groups: a pick-up and delivery model through the default plan and through regret construction plus every group family, both underfull_assert, every job on one vehicle with its pick-up first and hard score 0; round robin rejected.docs/modeling.mdexample is compiled throughreadme_examples.BREAKING CHANGE:
ListVariableSlot::precedence_successors_fnis now a method (the field is private and shared withelement_group_fn());ListRuinMoveSelectorConfigandConstructionHeuristicConfiggain public fields, andMoveSelectorConfiggainsListGroupChangeMoveSelectorandListGroupSwapMoveSelector. Struct literals and exhaustive matches need updating.