C++ Reference
C++ Reference: Routing
Detailed Description
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:
Then, use 'manager.NodeToIndex(node)' whenever model requires a variable index.
Definition at line 42 of file routing_index_manager.h.
Public Types | |
| typedef RoutingNodeIndex | NodeIndex |
Public Member Functions | |
| RoutingIndexManager (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. More... | |
| RoutingIndexManager (int num_nodes, int num_vehicles, const std::vector< NodeIndex > &starts, const std::vector< NodeIndex > &ends) | |
| RoutingIndexManager (int num_nodes, int num_vehicles, const std::vector< std::pair< NodeIndex, NodeIndex > > &starts_ends) | |
| ~RoutingIndexManager () | |
| int | num_nodes () const |
| int | num_vehicles () const |
| int | num_indices () const |
| int64 | GetStartIndex (int vehicle) const |
| int64 | GetEndIndex (int vehicle) const |
| int64 | NodeToIndex (NodeIndex node) const |
| std::vector< int64 > | NodesToIndices (const std::vector< NodeIndex > &nodes) const |
| NodeIndex | IndexToNode (int64 index) const |
| int | num_unique_depots () const |
| std::vector< NodeIndex > | GetIndexToNodeMap () const |
| gtl::ITIVector< NodeIndex, int64 > | GetNodeToIndexMap () const |
Static Public Attributes | |
| static const int64 | kUnassigned |
Member Typedef Documentation
◆ NodeIndex
| typedef RoutingNodeIndex NodeIndex |
Definition at line 44 of file routing_index_manager.h.
Constructor & Destructor Documentation
◆ RoutingIndexManager() [1/3]
| RoutingIndexManager | ( | 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() [2/3]
| RoutingIndexManager | ( | int | num_nodes, |
| int | num_vehicles, | ||
| const std::vector< NodeIndex > & | starts, | ||
| const std::vector< NodeIndex > & | ends | ||
| ) |
◆ RoutingIndexManager() [3/3]
| RoutingIndexManager | ( | int | num_nodes, |
| int | num_vehicles, | ||
| const std::vector< std::pair< NodeIndex, NodeIndex > > & | starts_ends | ||
| ) |
◆ ~RoutingIndexManager()
|
inline |
Definition at line 58 of file routing_index_manager.h.
Member Function Documentation
◆ GetEndIndex()
|
inline |
Definition at line 64 of file routing_index_manager.h.
◆ GetIndexToNodeMap()
|
inline |
Definition at line 79 of file routing_index_manager.h.
◆ GetNodeToIndexMap()
|
inline |
Definition at line 80 of file routing_index_manager.h.
◆ GetStartIndex()
|
inline |
Definition at line 63 of file routing_index_manager.h.
◆ IndexToNode()
|
inline |
Definition at line 71 of file routing_index_manager.h.
◆ NodesToIndices()
| std::vector<int64> NodesToIndices | ( | const std::vector< NodeIndex > & | nodes | ) | const |
◆ NodeToIndex()
|
inline |
Definition at line 65 of file routing_index_manager.h.
◆ num_indices()
|
inline |
Definition at line 62 of file routing_index_manager.h.
◆ num_nodes()
|
inline |
Definition at line 60 of file routing_index_manager.h.
◆ num_unique_depots()
|
inline |
Definition at line 78 of file routing_index_manager.h.
◆ num_vehicles()
|
inline |
Definition at line 61 of file routing_index_manager.h.
Member Data Documentation
◆ kUnassigned
|
static |
Definition at line 45 of file routing_index_manager.h.
The documentation for this class was generated from the following file: