Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class RelocateSubtrip
Note: This documentation is automatically generated.
Tries to move subtrips after an insertion node.
A subtrip is a subsequence that contains only matched pickup and delivery
nodes, or pickup-only nodes, i.e. it cannot contain a pickup without a
corresponding delivery or vice-versa.
For a given subtrip given by path indices i_1 ... i_k, we call 'rejected'
the nodes with indices i_1 < j < i_k that are not in the subtrip. If the
base_node is a pickup, this operator selects the smallest subtrip starting
at base_node such that rejected nodes are only deliveries. If the base_node
is a delivery, it selects the smallest subtrip ending at base_node such that
rejected nodes are only pickups.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-08-06 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eRelocateSubtrip\u003c/code\u003e class in C++ aims to efficiently move subtrips (sequences of matched pickup/delivery or pickup-only nodes) within a route after a new node is inserted.\u003c/p\u003e\n"],["\u003cp\u003eIt identifies the smallest valid subtrip starting or ending at a given node (\u003ccode\u003ebase_node\u003c/code\u003e) ensuring that bypassed nodes are either all deliveries (if \u003ccode\u003ebase_node\u003c/code\u003e is a pickup) or all pickups (if \u003ccode\u003ebase_node\u003c/code\u003e is a delivery).\u003c/p\u003e\n"],["\u003cp\u003eThe class provides methods like \u003ccode\u003eDebugString\u003c/code\u003e for debugging and \u003ccode\u003eMakeNeighbor\u003c/code\u003e for applying the relocation to create a neighboring solution.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eRelocateSubtrip\u003c/code\u003e utilizes path indices and node classifications (pickup, delivery) to determine subtrip boundaries and ensure the move's validity based on the \u003ccode\u003ebase_node\u003c/code\u003e type.\u003c/p\u003e\n"]]],["The `RelocateSubtrip` class in C++ aims to move subtrips after an insertion node. Subtrips are sequences of matched pickup/delivery nodes or pickup-only nodes. The method identifies the smallest subtrip starting or ending at a given `base_node`. If the `base_node` is a pickup, rejected nodes (outside the subtrip) must be deliveries; if it's a delivery, rejected nodes must be pickups. Key methods include `MakeNeighbor` (for performing the move) and `DebugString` for a string representation. The class is constructed using path variables, secondary variables, a function to determine the class of an empty path, and routing index pairs.\n"],null,["# RelocateSubtrip\n\nC++ Reference: class RelocateSubtrip\n====================================\n\n\nNote: This documentation is automatically generated.\nTries to move subtrips after an insertion node. A subtrip is a subsequence that contains only matched pickup and delivery nodes, or pickup-only nodes, i.e. it cannot contain a pickup without a corresponding delivery or vice-versa. \n\nFor a given subtrip given by path indices i_1 ... i_k, we call 'rejected' the nodes with indices i_1 \\\u003c j \\\u003c i_k that are not in the subtrip. If the base_node is a pickup, this operator selects the smallest subtrip starting at base_node such that rejected nodes are only deliveries. If the base_node is a delivery, it selects the smallest subtrip ending at base_node such that rejected nodes are only pickups.\n\n| Method ||\n|--------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`DebugString`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L739) | Return type: `std::string ` \u003cbr /\u003e |\n| [`MakeNeighbor`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L740) | Return type: `bool ` \u003cbr /\u003e |\n| [`RelocateSubtrip`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L734) | \u003cbr /\u003e Arguments: `const std::vector\u003cIntVar*\u003e& vars, const std::vector\u003cIntVar*\u003e& secondary_vars, std::function\u003cint(int64_t)\u003e start_empty_path_class, const RoutingIndexPairs& pairs` \u003cbr /\u003e |"]]