14#ifndef OR_TOOLS_CONSTRAINT_SOLVER_ROUTING_INDEX_MANAGER_H_
15#define OR_TOOLS_CONSTRAINT_SOLVER_ROUTING_INDEX_MANAGER_H_
20#include "absl/log/check.h"
50class RoutingIndexManager {
61 const std::vector<NodeIndex>& starts,
62 const std::vector<NodeIndex>& ends);
65 const std::vector<std::pair<NodeIndex, NodeIndex> >& starts_ends);
68 int num_nodes()
const {
return num_nodes_; }
75 return vehicle_to_start_[vehicle];
77 int64_t
GetEndIndex(
int vehicle)
const {
return vehicle_to_end_[vehicle]; }
83 DCHECK_GE(node.value(), 0);
84 DCHECK_LT(node.value(), node_to_index_.size());
85 return node_to_index_[node];
89 const std::vector<NodeIndex>&
nodes)
const;
94 DCHECK_LT(
index, index_to_node_.size());
95 return index_to_node_[
index];
99 const std::vector<int64_t>& indices)
const;
109 const std::vector<std::pair<NodeIndex, NodeIndex> >& starts_ends);
111 std::vector<NodeIndex> index_to_node_;
113 std::vector<int64_t> vehicle_to_start_;
114 std::vector<int64_t> vehicle_to_end_;
117 int num_unique_depots_;
std::vector< NodeIndex > GetIndexToNodeMap() const
int num_unique_depots() const
static const int64_t kUnassigned
int num_indices() const
Returns the number of indices mapped to nodes.
int64_t NodeToIndex(NodeIndex node) const
std::vector< NodeIndex > IndicesToNodes(const std::vector< int64_t > &indices) const
Same as IndexToNode but for a given vector of indices.
RoutingIndexManager(int num_nodes, int num_vehicles, NodeIndex depot)
int64_t GetEndIndex(int vehicle) const
int num_nodes() const
Returns the number of nodes in the manager.
int num_vehicles() const
Returns the number of vehicles in the manager.
RoutingNodeIndex NodeIndex
std::vector< int64_t > NodesToIndices(const std::vector< NodeIndex > &nodes) const
Same as NodeToIndex but for a given vector of nodes.
NodeIndex IndexToNode(int64_t index) const
int64_t GetStartIndex(int vehicle) const
Returns start and end indices of the given vehicle.
In SWIG mode, we don't want anything besides these top-level includes.