Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
CHRouter< E, V > Class Template Reference

Computes the shortest path through a contracted network. More...

#include <CHRouter.h>

Inheritance diagram for CHRouter< E, V >:
[legend]
Collaboration diagram for CHRouter< E, V >:
[legend]

Data Structures

class  Unidirectional
 

Public Types

typedef std::pair< const typename SUMOAbstractRouter< E, V >::EdgeInfo *, const typename SUMOAbstractRouter< E, V >::EdgeInfo * > Meeting
 A meeting point of the two search scopes.
 
typedef double(* Operation) (const E *const, const V *const, double)
 Type of the function that is used to retrieve the edge effort.
 

Public Member Functions

void buildPathFrom (const typename SUMOAbstractRouter< E, V >::EdgeInfo *rbegin, std::vector< const E * > &edges)
 Builds the path from marked edges.
 
void buildPathFromMeeting (Meeting meeting, std::vector< const E * > &into) const
 normal routing methods
 
 CHRouter (const std::vector< E * > &edges, bool unbuildIsWarning, typename SUMOAbstractRouter< E, V >::Operation operation, const SUMOVehicleClass svc, SUMOTime weightPeriod, const bool havePermissions, const bool haveRestrictions)
 Constructor.
 
 CHRouter (const std::vector< E * > &edges, bool unbuildIsWarning, typename SUMOAbstractRouter< E, V >::Operation operation, const SUMOVehicleClass svc, typename CHBuilder< E, V >::Hierarchy *hierarchy, const bool havePermissions, const bool haveRestrictions)
 Cloning constructor, should be used only for time independent instances which build a hierarchy only once.
 
virtual SUMOAbstractRouter< E, V > * clone ()
 
virtual bool compute (const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)
 Builds the route between the given edges using the minimum traveltime in the contracted graph.
 
bool compute (const E *from, double fromPos, const E *to, double toPos, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)
 Builds the route between the given edges using the minimum effort at the given time, also taking into account position along the edges to ensure currect handling of looped routes The definition of the effort depends on the wished routing scheme.
 
bool computeLooped (const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)
 Builds the route between the given edges using the minimum effort at the given time if from == to, return the shortest looped route.
 
void endQuery (int visits)
 
const SUMOAbstractRouter< E, V >::EdgeInfo & getEdgeInfo (int index) const
 
double getEffort (const E *const e, const V *const v, double t) const
 
double getTravelTime (const E *const e, const V *const v, const double t, const double effort) const
 
const std::string & getType () const
 
void init (const int edgeID, const SUMOTime msTime)
 
bool isProhibited (const E *const edge, const V *const vehicle) const
 
bool isValid (const std::vector< const E * > &edges, const V *const v) const
 
virtual void prohibit (const std::vector< E * > &toProhibit)
 
virtual double recomputeCosts (const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
 
double recomputeCostsPos (const std::vector< const E * > &edges, const V *const v, double fromPos, double toPos, SUMOTime msTime, double *lengthp=nullptr) const
 
virtual void reset (const V *const vehicle)
 trigger hierarchy rebuild
 
void setAutoBulkMode (const bool mode)
 
virtual void setBulkMode (const bool mode)
 
double setHint (const typename std::vector< const E * >::const_iterator routeBegin, const typename std::vector< const E * >::const_iterator routeEnd, const V *const v, SUMOTime msTime)
 
void startQuery ()
 
void updateViaCost (const E *const prev, const E *const e, const V *const v, double &time, double &effort, double &length) const
 
void updateViaEdgeCost (const E *viaEdge, const V *const v, double &time, double &effort, double &length) const
 
virtual ~CHRouter ()
 Destructor.
 

Protected Attributes

bool myAmClean
 whether we are already initialized
 
bool myAutoBulkMode
 whether we are currently trying to detect bulk mode automatically
 
bool myBulkMode
 whether we are currently operating several route queries in a bulk
 
std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo > myEdgeInfos
 The container of edge information.
 
MsgHandler *const myErrorMsgHandler
 the handler for routing errors
 
std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo * > myFound
 list of visited Edges (for resetting)
 
std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo * > myFrontierList
 A container for reusage of the min edge heap.
 
const bool myHavePermissions
 whether edge permissions need to be considered
 
const bool myHaveRestrictions
 whether edge restrictions need to be considered
 
Operation myOperation
 The object's operation to perform.
 
std::vector< E * > myProhibited
 The list of explicitly prohibited edges.
 
Operation myTTOperation
 The object's operation to perform for travel times.
 

Private Member Functions

const E * getVia (const E *forwardFrom, const E *forwardTo) const
 

Private Attributes

Unidirectional myBackwardSearch
 
const std::vector< E * > & myEdges
 all edges with numerical ids
 
Unidirectional myForwardSearch
 the unidirectional search queues
 
CHBuilder< E, V >::Hierarchy * myHierarchy
 
CHBuilder< E, V > * myHierarchyBuilder
 
long long int myNumQueries
 
long long int myQueryStartTime
 the time spent querying in milliseconds
 
long long int myQueryTimeSum
 
long long int myQueryVisits
 counters for performance logging
 
const SUMOVehicleClass mySVC
 the permissions for which the hierarchy was constructed
 
const std::string myType
 the type of this router
 
SUMOTime myValidUntil
 the validity duration of the current hierarchy (exclusive)
 
const SUMOTime myWeightPeriod
 the validity duration of one weight interval
 

Detailed Description

template<class E, class V>
class CHRouter< E, V >

Computes the shortest path through a contracted network.

The template parameters are:

Parameters
EThe edge class to use (MSEdge/ROEdge)
VThe vehicle class to use (MSVehicle/ROVehicle)
PFThe prohibition function to use (prohibited_withPermissions/noProhibitions)

The router is edge-based. It must know the number of edges for internal reasons and whether a missing connection between two given edges (unbuild route) shall be reported as an error or as a warning.

The template parameters are:

Parameters
EThe edge class to use (MSEdge/ROEdge)
VThe vehicle class to use (MSVehicle/ROVehicle)

The router is edge-based. It must know the number of edges for internal reasons and whether a missing connection between two given edges (unbuild route) shall be reported as an error or as a warning.

Definition at line 59 of file CHRouter.h.

Member Typedef Documentation

◆ Meeting

template<class E , class V >
typedef std::pair<const typename SUMOAbstractRouter<E, V>::EdgeInfo*, const typename SUMOAbstractRouter<E, V>::EdgeInfo*> CHRouter< E, V >::Meeting

A meeting point of the two search scopes.

Definition at line 63 of file CHRouter.h.

◆ Operation

template<class E , class V >
typedef double(* SUMOAbstractRouter< E, V >::Operation) (const E *const, const V *const, double)
inherited

Type of the function that is used to retrieve the edge effort.

Definition at line 92 of file SUMOAbstractRouter.h.

Constructor & Destructor Documentation

◆ CHRouter() [1/2]

template<class E , class V >
CHRouter< E, V >::CHRouter ( const std::vector< E * > &  edges,
bool  unbuildIsWarning,
typename SUMOAbstractRouter< E, V >::Operation  operation,
const SUMOVehicleClass  svc,
SUMOTime  weightPeriod,
const bool  havePermissions,
const bool  haveRestrictions 
)
inline

Constructor.

Parameters
[in]validatePermissionsWhether a multi-permission hierarchy shall be built If set to false, the net is pruned in synchronize() and the hierarchy is tailored to the svc

Definition at line 218 of file CHRouter.h.

◆ CHRouter() [2/2]

template<class E , class V >
CHRouter< E, V >::CHRouter ( const std::vector< E * > &  edges,
bool  unbuildIsWarning,
typename SUMOAbstractRouter< E, V >::Operation  operation,
const SUMOVehicleClass  svc,
typename CHBuilder< E, V >::Hierarchy *  hierarchy,
const bool  havePermissions,
const bool  haveRestrictions 
)
inline

Cloning constructor, should be used only for time independent instances which build a hierarchy only once.

Definition at line 235 of file CHRouter.h.

◆ ~CHRouter()

template<class E , class V >
virtual CHRouter< E, V >::~CHRouter ( )
inlinevirtual

Destructor.

Definition at line 251 of file CHRouter.h.

References CHRouter< E, V >::myHierarchy, and CHRouter< E, V >::myHierarchyBuilder.

Member Function Documentation

◆ buildPathFrom()

template<class E , class V >
void SUMOAbstractRouter< E, V >::buildPathFrom ( const typename SUMOAbstractRouter< E, V >::EdgeInfo *  rbegin,
std::vector< const E * > &  edges 
)
inlineinherited

Builds the path from marked edges.

Definition at line 364 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::EdgeInfo::edge, and SUMOAbstractRouter< E, V >::EdgeInfo::prev.

Referenced by AFRouter< E, N, V, M >::compute(), AStarRouter< E, V, M >::compute(), DijkstraRouter< E, V >::compute(), and Node2EdgeRouter< E, N, V, M >::computeNode2Edge().

Here is the caller graph for this function:

◆ buildPathFromMeeting()

template<class E , class V >
void CHRouter< E, V >::buildPathFromMeeting ( Meeting  meeting,
std::vector< const E * > &  into 
) const
inline

normal routing methods

Builds the path from marked edges

Definition at line 346 of file CHRouter.h.

References CHRouter< E, V >::getVia().

Referenced by CHRouter< E, V >::compute().

Here is the caller graph for this function:

◆ clone()

◆ compute() [1/2]

template<class E , class V >
virtual bool CHRouter< E, V >::compute ( const E *  from,
const E *  to,
const V *const  vehicle,
SUMOTime  msTime,
std::vector< const E * > &  into,
bool  silent = false 
)
inlinevirtual

◆ compute() [2/2]

template<class E , class V >
bool SUMOAbstractRouter< E, V >::compute ( const E *  from,
double  fromPos,
const E *  to,
double  toPos,
const V *const  vehicle,
SUMOTime  msTime,
std::vector< const E * > &  into,
bool  silent = false 
)
inlineinherited

Builds the route between the given edges using the minimum effort at the given time, also taking into account position along the edges to ensure currect handling of looped routes The definition of the effort depends on the wished routing scheme.

Definition at line 183 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::compute(), and SUMOAbstractRouter< E, V >::computeLooped().

◆ computeLooped()

template<class E , class V >
bool SUMOAbstractRouter< E, V >::computeLooped ( const E *  from,
const E *  to,
const V *const  vehicle,
SUMOTime  msTime,
std::vector< const E * > &  into,
bool  silent = false 
)
inlineinherited

Builds the route between the given edges using the minimum effort at the given time if from == to, return the shortest looped route.

Definition at line 198 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::compute(), MsgHandler::informf(), SUMOAbstractRouter< E, V >::myErrorMsgHandler, SUMOAbstractRouter< E, V >::recomputeCosts(), SVC_IGNORING, and TL.

Referenced by SUMOAbstractRouter< E, V >::compute(), and MSBaseVehicle::reroute().

Here is the caller graph for this function:

◆ endQuery()

template<class E , class V >
void SUMOAbstractRouter< E, V >::endQuery ( int  visits)
inlineinherited

◆ getEdgeInfo()

template<class E , class V >
const SUMOAbstractRouter< E, V >::EdgeInfo & SUMOAbstractRouter< E, V >::getEdgeInfo ( int  index) const
inlineinherited

Definition at line 169 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::myEdgeInfos.

◆ getEffort()

◆ getTravelTime()

template<class E , class V >
double SUMOAbstractRouter< E, V >::getTravelTime ( const E *const  e,
const V *const  v,
const double  t,
const double  effort 
) const
inlineinherited

◆ getType()

template<class E , class V >
const std::string & SUMOAbstractRouter< E, V >::getType ( ) const
inlineinherited

Definition at line 165 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::myType.

◆ getVia()

template<class E , class V >
const E * CHRouter< E, V >::getVia ( const E *  forwardFrom,
const E *  forwardTo 
) const
inlineprivate

Definition at line 381 of file CHRouter.h.

References CHRouter< E, V >::myHierarchy.

Referenced by CHRouter< E, V >::buildPathFromMeeting().

Here is the caller graph for this function:

◆ init()

template<class E , class V >
void SUMOAbstractRouter< E, V >::init ( const int  edgeID,
const SUMOTime  msTime 
)
inlineinherited

Definition at line 136 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::myAmClean, SUMOAbstractRouter< E, V >::myEdgeInfos, SUMOAbstractRouter< E, V >::myFound, SUMOAbstractRouter< E, V >::myFrontierList, and STEPS2TIME.

Referenced by AStarRouter< E, V, M >::compute(), DijkstraRouter< E, V >::compute(), and SUMOAbstractRouter< E, V >::setHint().

Here is the caller graph for this function:

◆ isProhibited()

template<class E , class V >
bool SUMOAbstractRouter< E, V >::isProhibited ( const E *const  edge,
const V *const  vehicle 
) const
inlineinherited

◆ isValid()

template<class E , class V >
bool SUMOAbstractRouter< E, V >::isValid ( const std::vector< const E * > &  edges,
const V *const  v 
) const
inlineinherited

Definition at line 260 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::isProhibited().

Referenced by RORouteDef::addAlternative().

Here is the caller graph for this function:

◆ prohibit()

template<class E , class V >
virtual void CHRouter< E, V >::prohibit ( const std::vector< E * > &  toProhibit)
inlinevirtual

Reimplemented from SUMOAbstractRouter< E, V >.

Definition at line 270 of file CHRouter.h.

References TL, and WRITE_WARNINGF.

◆ recomputeCosts()

◆ recomputeCostsPos()

template<class E , class V >
double SUMOAbstractRouter< E, V >::recomputeCostsPos ( const std::vector< const E * > &  edges,
const V *const  v,
double  fromPos,
double  toPos,
SUMOTime  msTime,
double *  lengthp = nullptr 
) const
inlineinherited

Definition at line 287 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::getEffort(), SUMOAbstractRouter< E, V >::recomputeCosts(), and STEPS2TIME.

Referenced by MSDispatch::computeDetourTime().

Here is the caller graph for this function:

◆ reset()

template<class E , class V >
virtual void CHRouter< E, V >::reset ( const V *const  vehicle)
inlinevirtual

trigger hierarchy rebuild

Reimplemented from SUMOAbstractRouter< E, V >.

Definition at line 278 of file CHRouter.h.

References CHRouter< E, V >::myHierarchy, CHRouter< E, V >::myHierarchyBuilder, CHRouter< E, V >::myValidUntil, and CHRouter< E, V >::myWeightPeriod.

Referenced by CHRouter< E, V >::compute().

Here is the caller graph for this function:

◆ setAutoBulkMode()

template<class E , class V >
void SUMOAbstractRouter< E, V >::setAutoBulkMode ( const bool  mode)
inlineinherited

Definition at line 348 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::myAutoBulkMode.

Referenced by LandmarkLookupTable< E, V, M >::LandmarkLookupTable().

Here is the caller graph for this function:

◆ setBulkMode()

template<class E , class V >
virtual void SUMOAbstractRouter< E, V >::setBulkMode ( const bool  mode)
inlinevirtualinherited

Reimplemented in AFRouter< E, N, V, M >, IntermodalRouter< E, L, N, V >, Node2EdgeRouter< E, N, V, M >, and Node2EdgeRouter< FlippedEdge< E, N, V >, FlippedNode< E, N, V >, V, M >.

Definition at line 344 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::myBulkMode.

Referenced by ROMAAssignments::computePath(), ROMAAssignments::incremental(), and IntermodalRouter< E, L, N, V >::setBulkMode().

Here is the caller graph for this function:

◆ setHint()

template<class E , class V >
double SUMOAbstractRouter< E, V >::setHint ( const typename std::vector< const E * >::const_iterator  routeBegin,
const typename std::vector< const E * >::const_iterator  routeEnd,
const V *const  v,
SUMOTime  msTime 
)
inlineinherited

◆ startQuery()

template<class E , class V >
void SUMOAbstractRouter< E, V >::startQuery ( )
inlineinherited

◆ updateViaCost()

template<class E , class V >
void SUMOAbstractRouter< E, V >::updateViaCost ( const E *const  prev,
const E *const  e,
const V *const  v,
double &  time,
double &  effort,
double &  length 
) const
inlineinherited

◆ updateViaEdgeCost()

template<class E , class V >
void SUMOAbstractRouter< E, V >::updateViaEdgeCost ( const E *  viaEdge,
const V *const  v,
double &  time,
double &  effort,
double &  length 
) const
inlineinherited

Field Documentation

◆ myAmClean

◆ myAutoBulkMode

template<class E , class V >
bool SUMOAbstractRouter< E, V >::myAutoBulkMode
protectedinherited

whether we are currently trying to detect bulk mode automatically

Definition at line 387 of file SUMOAbstractRouter.h.

Referenced by DijkstraRouter< E, V >::clone(), DijkstraRouter< E, V >::compute(), and SUMOAbstractRouter< E, V >::setAutoBulkMode().

◆ myBackwardSearch

template<class E , class V >
Unidirectional CHRouter< E, V >::myBackwardSearch
private

Definition at line 398 of file CHRouter.h.

Referenced by CHRouter< E, V >::compute().

◆ myBulkMode

template<class E , class V >
bool SUMOAbstractRouter< E, V >::myBulkMode
protectedinherited

whether we are currently operating several route queries in a bulk

Definition at line 384 of file SUMOAbstractRouter.h.

Referenced by AStarRouter< E, V, M >::compute(), DijkstraRouter< E, V >::compute(), and SUMOAbstractRouter< E, V >::setBulkMode().

◆ myEdgeInfos

◆ myEdges

template<class E , class V >
const std::vector<E*>& CHRouter< E, V >::myEdges
private

all edges with numerical ids

Definition at line 394 of file CHRouter.h.

Referenced by CHRouter< E, V >::clone().

◆ myErrorMsgHandler

◆ myForwardSearch

template<class E , class V >
Unidirectional CHRouter< E, V >::myForwardSearch
private

the unidirectional search queues

Definition at line 397 of file CHRouter.h.

Referenced by CHRouter< E, V >::compute().

◆ myFound

◆ myFrontierList

◆ myHavePermissions

◆ myHaveRestrictions

◆ myHierarchy

template<class E , class V >
CHBuilder<E,V>::Hierarchy* CHRouter< E, V >::myHierarchy
private

◆ myHierarchyBuilder

template<class E , class V >
CHBuilder<E, V>* CHRouter< E, V >::myHierarchyBuilder
private

◆ myNumQueries

template<class E , class V >
long long int SUMOAbstractRouter< E, V >::myNumQueries
privateinherited

◆ myOperation

◆ myProhibited

template<class E , class V >
std::vector<E*> SUMOAbstractRouter< E, V >::myProhibited
protectedinherited

The list of explicitly prohibited edges.

Definition at line 399 of file SUMOAbstractRouter.h.

Referenced by RailwayRouter< E, V >::_compute(), RailwayRouter< E, V >::prohibit(), and SUMOAbstractRouter< E, V >::prohibit().

◆ myQueryStartTime

template<class E , class V >
long long int SUMOAbstractRouter< E, V >::myQueryStartTime
privateinherited

the time spent querying in milliseconds

Definition at line 417 of file SUMOAbstractRouter.h.

Referenced by SUMOAbstractRouter< E, V >::endQuery(), and SUMOAbstractRouter< E, V >::startQuery().

◆ myQueryTimeSum

template<class E , class V >
long long int SUMOAbstractRouter< E, V >::myQueryTimeSum
privateinherited

◆ myQueryVisits

template<class E , class V >
long long int SUMOAbstractRouter< E, V >::myQueryVisits
privateinherited

counters for performance logging

Definition at line 414 of file SUMOAbstractRouter.h.

Referenced by SUMOAbstractRouter< E, V >::endQuery(), and SUMOAbstractRouter< E, V >::~SUMOAbstractRouter().

◆ mySVC

template<class E , class V >
const SUMOVehicleClass CHRouter< E, V >::mySVC
private

the permissions for which the hierarchy was constructed

Definition at line 410 of file CHRouter.h.

Referenced by CHRouter< E, V >::clone().

◆ myTTOperation

template<class E , class V >
Operation SUMOAbstractRouter< E, V >::myTTOperation
protectedinherited

The object's operation to perform for travel times.

Definition at line 381 of file SUMOAbstractRouter.h.

Referenced by DijkstraRouter< E, V >::clone(), and SUMOAbstractRouter< E, V >::getTravelTime().

◆ myType

template<class E , class V >
const std::string SUMOAbstractRouter< E, V >::myType
privateinherited

the type of this router

Definition at line 411 of file SUMOAbstractRouter.h.

Referenced by SUMOAbstractRouter< E, V >::getType(), and SUMOAbstractRouter< E, V >::~SUMOAbstractRouter().

◆ myValidUntil

template<class E , class V >
SUMOTime CHRouter< E, V >::myValidUntil
private

the validity duration of the current hierarchy (exclusive)

Definition at line 407 of file CHRouter.h.

Referenced by CHRouter< E, V >::compute(), and CHRouter< E, V >::reset().

◆ myWeightPeriod

template<class E , class V >
const SUMOTime CHRouter< E, V >::myWeightPeriod
private

the validity duration of one weight interval

Definition at line 404 of file CHRouter.h.

Referenced by CHRouter< E, V >::clone(), CHRouter< E, V >::compute(), and CHRouter< E, V >::reset().


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