Stay organized with collections
Save and categorize content based on your preferences.
C++ Reference: class SwapIndexPairOperator
Note: This documentation is automatically generated.
Operator which iterates through each alternative of a set of pairs. If a
pair has n and m alternatives, n.m alternatives will be explored.
Possible neighbors for the path 1 -> A -> a -> 2 (where (1, 2) are first and
last nodes of a path and A has B, C as alternatives and a has b as
alternative):
1 -> A -> [b] -> 2
1 -> [B] -> a -> 2
1 -> [B] -> [b] -> 2
1 -> [C] -> a -> 2
1 -> [C] -> [b] -> 2
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-06 UTC.
[null,null,["Last updated 2024-08-06 UTC."],[[["\u003cp\u003e\u003ccode\u003eSwapIndexPairOperator\u003c/code\u003e iterates through alternative paths by exploring different combinations of node pairs and their alternatives.\u003c/p\u003e\n"],["\u003cp\u003eIt systematically generates neighboring solutions by swapping node pairs within a given path.\u003c/p\u003e\n"],["\u003cp\u003eThe operator is initialized with index pairs and path variables to define the search space.\u003c/p\u003e\n"],["\u003cp\u003eSeveral methods are available for controlling the iteration process (\u003ccode\u003eMakeNextNeighbor\u003c/code\u003e, \u003ccode\u003eOnStart\u003c/code\u003e) and retrieving debug information (\u003ccode\u003eDebugString\u003c/code\u003e).\u003c/p\u003e\n"]]],["The `SwapIndexPairOperator` class iterates through alternatives of pairs, exploring `n.m` alternatives if a pair has `n` and `m` alternatives. It generates potential neighbors for paths by swapping alternatives within the path. The class includes methods like `MakeNextNeighbor` to generate neighbors, `OnStart` for initialization, and `DebugString` for debugging. It takes input `vars`, `path_vars`, `start_empty_path_class`, and `index_pairs` in its constructor.\n"],null,["# SwapIndexPairOperator\n\nC++ Reference: class SwapIndexPairOperator\n==========================================\n\n\nNote: This documentation is automatically generated.\nOperator which iterates through each alternative of a set of pairs. If a pair has n and m alternatives, n.m alternatives will be explored. Possible neighbors for the path 1 -\\\u003e A -\\\u003e a -\\\u003e 2 (where (1, 2) are first and last nodes of a path and A has B, C as alternatives and a has b as alternative): 1 -\\\u003e A -\\\u003e \\[b\\] -\\\u003e 2 1 -\\\u003e \\[B\\] -\\\u003e a -\\\u003e 2 1 -\\\u003e \\[B\\] -\\\u003e \\[b\\] -\\\u003e 2 1 -\\\u003e \\[C\\] -\\\u003e a -\\\u003e 2 1 -\\\u003e \\[C\\] -\\\u003e \\[b\\] -\\\u003e 2\n\n| Method ||\n|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [`DebugString`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L304) | Return type: `std::string ` \u003cbr /\u003e |\n| [`MakeNextNeighbor`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L302) | Return type: `bool ` Arguments: `Assignment* delta, Assignment* deltadelta` \u003cbr /\u003e |\n| [`OnStart`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L303) | Return type: `void ` \u003cbr /\u003e |\n| [`SwapIndexPairOperator`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L296) | \u003cbr /\u003e Arguments: `const std::vector\u003cIntVar*\u003e& vars, const std::vector\u003cIntVar*\u003e& path_vars, std::function\u003cint(int64_t)\u003e start_empty_path_class, const RoutingIndexPairs& index_pairs` \u003cbr /\u003e |\n| [`~SwapIndexPairOperator`](https://github.com/google/or-tools/blob/v9.4/ortools/constraint_solver/routing_neighborhoods.h#L300) | \u003cbr /\u003e |"]]