C++ Reference: class RoutingIndexManager

This documentation is automatically generated.

Manager for any NodeIndex <-> variable index conversion. The routing solver uses variable indices internally and through its API. These variable indices are tricky to manage directly because one Node can correspond to a multitude of variables, depending on the number of times they appear in the model, and if they're used as start and/or end points. This class aims to simplify variable index usage, allowing users to use NodeIndex instead.

Usage: auto starts_ends = ...; /// These are NodeIndex. RoutingIndexManager manager(10, 4, starts_ends); // 10 nodes, 4 vehicles. RoutingModel model(manager);

Then, use 'manager.NodeToIndex(node)' whenever model requires a variable index.
Method
GetEndIndex

Return type: int64

Arguments: int vehicle

GetIndexToNodeMap

Return type: std::vector<NodeIndex>

GetNodeToIndexMap

Return type: gtl::ITIVector<NodeIndex, int64>

GetStartIndex

Return type: int64

Arguments: int vehicle

IndexToNode

Return type: NodeIndex

Arguments: int64 index

NodesToIndices

Return type: std::vector<int64>

Arguments: const std::vector<NodeIndex>& nodes

NodeToIndex

Return type: int64

Arguments: NodeIndex node

num_indices

Return type: int

num_nodes

Return type: int

num_unique_depots

Return type: int

TODO(user): Remove when removal of NodeIndex from RoutingModel is complete.

num_vehicles

Return type: int

RoutingIndexManager

Arguments: int num_nodes, int num_vehicles, NodeIndex depot

Creates a NodeIndex to variable index mapping for a problem containing 'num_nodes', 'num_vehicles' and the given starts and ends for each vehicle. If used, any start/end arrays have to have exactly 'num_vehicles' elements.

RoutingIndexManager

Arguments: int num_nodes, int num_vehicles, const std::vector<NodeIndex>& starts, const std::vector<NodeIndex>& ends

RoutingIndexManager

Arguments: int num_nodes, int num_vehicles, const std::vector<std::pair<NodeIndex, NodeIndex> >& starts_ends

~RoutingIndexManager