Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::PathContainerImpl Class Referenceabstract

Public Member Functions

 PathContainerImpl ()
 
virtual ~PathContainerImpl ()
 
virtual void Initialize (const std::vector< NodeIndex > &sources, const std::vector< NodeIndex > &destinations, NodeIndex num_nodes)=0
 
virtual void Finalize ()
 Called when no more path will be added to the container.
 
virtual PathDistance GetDistance (NodeIndex from, NodeIndex to) const =0
 
virtual NodeIndex GetPenultimateNodeInPath (NodeIndex from, NodeIndex to) const =0
 
virtual void GetPath (NodeIndex from, NodeIndex to, std::vector< NodeIndex > *path) const =0
 Returns path nodes from node "from" to node "to" in a ordered vector.
 
virtual void StoreSingleSourcePaths (NodeIndex from, const std::vector< NodeIndex > &predecessor_in_path_tree, const std::vector< PathDistance > &distance_to_destination)=0
 

Detailed Description

Todo
(user): Currently using StarGraph::kNilNode until the new Ebert graphs appear; switch to kNilNode on the base Ebert graph class when available.

Base path container implementation class. Defines virtual functions used to fill the container (in particular from the shortest path computation function).

Definition at line 43 of file shortest_paths.cc.

Constructor & Destructor Documentation

◆ PathContainerImpl()

operations_research::PathContainerImpl::PathContainerImpl ( )
inline

Definition at line 45 of file shortest_paths.cc.

◆ ~PathContainerImpl()

virtual operations_research::PathContainerImpl::~PathContainerImpl ( )
inlinevirtual

Definition at line 46 of file shortest_paths.cc.

Member Function Documentation

◆ Finalize()

virtual void operations_research::PathContainerImpl::Finalize ( )
inlinevirtual

Called when no more path will be added to the container.

Definition at line 56 of file shortest_paths.cc.

◆ GetDistance()

virtual PathDistance operations_research::PathContainerImpl::GetDistance ( NodeIndex from,
NodeIndex to ) const
pure virtual

Returns the distance between node 'from' and node 'to' following the path out of 'from' and into 'to'. Note that if 'from' == 'to', the distance is not necessarily 0 if the path out of 'to' and back into 'to' has a distance greater than 0. If you do require the distance to be 0 in this case, add to the graph an arc from 'to' to itself with a length of 0. If nodes are not connected, returns kDisconnectedPathDistance.

◆ GetPath()

virtual void operations_research::PathContainerImpl::GetPath ( NodeIndex from,
NodeIndex to,
std::vector< NodeIndex > * path ) const
pure virtual

Returns path nodes from node "from" to node "to" in a ordered vector.

◆ GetPenultimateNodeInPath()

virtual NodeIndex operations_research::PathContainerImpl::GetPenultimateNodeInPath ( NodeIndex from,
NodeIndex to ) const
pure virtual

Returns the penultimate node on the path out of node 'from' into node 'to' (the direct predecessor of node 'to' on the path). If 'from' == 'to', the penultimate node is 'to' only if the shortest path from 'to' to itself is composed of the arc ('to, 'to'), which might not be the case if either this arc doesn't exist or if the length of this arc is greater than the distance of an alternate path. If nodes are not connected, returns kNilNode.

◆ Initialize()

virtual void operations_research::PathContainerImpl::Initialize ( const std::vector< NodeIndex > & sources,
const std::vector< NodeIndex > & destinations,
NodeIndex num_nodes )
pure virtual

Initializes the container on source and destination node vectors (num_nodes is the total number of nodes in the graph containing sources and nodes). Called before adding any paths to the container.

◆ StoreSingleSourcePaths()

virtual void operations_research::PathContainerImpl::StoreSingleSourcePaths ( NodeIndex from,
const std::vector< NodeIndex > & predecessor_in_path_tree,
const std::vector< PathDistance > & distance_to_destination )
pure virtual

Adds a path tree rooted at node 'from', and to a set of implicit destinations:

  • predecessor_in_path_tree[node] is the predecessor of node 'node' in the path from 'from' to 'node', or kNilNode if there is no predecessor (i.e. if 'node' is not in the path tree);
  • distance_to_destination[i] is the distance from 'from' to the i-th destination (see Initialize()).

The documentation for this class was generated from the following file: