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

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

#include <CHRouterWrapper.h>

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

Public Types

typedef double(* Operation) (const E *const, const V *const, double)
 Type of the function that is used to retrieve the edge effort.
 
typedef std::map< const E *, double > Prohibitions
 Prohibitions and their estimated end time.
 

Public Member Functions

void buildPathFrom (const typename SUMOAbstractRouter< E, V >::EdgeInfo *rbegin, std::vector< const E * > &edges)
 Builds the path from marked edges.
 
 CHRouterWrapper (const std::vector< E * > &edges, const bool ignoreErrors, typename SUMOAbstractRouter< E, V >::Operation operation, const SUMOTime begin, const SUMOTime end, const SUMOTime weightPeriod, bool havePermissions, const int numThreads)
 Constructor.
 
virtual SUMOAbstractRouter< E, V > * clone ()
 
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 effort at the given time The definition of the effort depends on the wished routing scheme.
 
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 Prohibitions &toProhibit)
 
virtual void prohibit (const std::map< const E *, double > &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)
 reset internal caches, used by CHRouter
 
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
 
 ~CHRouterWrapper ()
 

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.
 
Prohibitions myProhibited
 The list of explicitly prohibited edges and estimated end time of prohibition.
 
Operation myTTOperation
 The object's operation to perform for travel times.
 

Private Types

typedef CHRouter< E, V > CHRouterType
 
typedef std::map< std::pair< const SUMOVehicleClass, const double >, CHRouterType * > RouterMap
 

Private Attributes

const SUMOTime myBegin
 
const std::vector< E * > & myEdges
 all edges with numerical ids
 
const SUMOTime myEnd
 
const bool myIgnoreErrors
 
const int myMaxNumInstances
 
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
 
RouterMap myRouters
 
const std::string myType
 the type of this router
 
const SUMOTime myWeightPeriod
 

Detailed Description

template<class E, class V>
class CHRouterWrapper< 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)

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 61 of file CHRouterWrapper.h.

Member Typedef Documentation

◆ CHRouterType

template<class E , class V >
typedef CHRouter<E, V> CHRouterWrapper< E, V >::CHRouterType
private

Definition at line 111 of file CHRouterWrapper.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 95 of file SUMOAbstractRouter.h.

◆ Prohibitions

template<class E , class V >
typedef std::map<const E*, double> SUMOAbstractRouter< E, V >::Prohibitions
inherited

Prohibitions and their estimated end time.

Definition at line 98 of file SUMOAbstractRouter.h.

◆ RouterMap

template<class E , class V >
typedef std::map<std::pair<const SUMOVehicleClass, const double>, CHRouterType*> CHRouterWrapper< E, V >::RouterMap
private

Definition at line 114 of file CHRouterWrapper.h.

Constructor & Destructor Documentation

◆ CHRouterWrapper()

template<class E , class V >
CHRouterWrapper< E, V >::CHRouterWrapper ( const std::vector< E * > &  edges,
const bool  ignoreErrors,
typename SUMOAbstractRouter< E, V >::Operation  operation,
const SUMOTime  begin,
const SUMOTime  end,
const SUMOTime  weightPeriod,
bool  havePermissions,
const int  numThreads 
)
inline

Constructor.

Definition at line 66 of file CHRouterWrapper.h.

◆ ~CHRouterWrapper()

template<class E , class V >
CHRouterWrapper< E, V >::~CHRouterWrapper ( )
inline

Definition at line 77 of file CHRouterWrapper.h.

References CHRouterWrapper< E, V >::myRouters.

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 380 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:

◆ clone()

◆ compute() [1/2]

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

Builds the route between the given edges using the minimum effort at the given time The definition of the effort depends on the wished routing scheme.

Implements SUMOAbstractRouter< E, V >.

Definition at line 98 of file CHRouterWrapper.h.

References CHRouterWrapper< E, V >::myEdges, CHRouterWrapper< E, V >::myIgnoreErrors, SUMOAbstractRouter< E, V >::myOperation, CHRouterWrapper< E, V >::myRouters, and CHRouterWrapper< E, V >::myWeightPeriod.

◆ 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 189 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 204 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(), MSBaseVehicle::optimizeSkipped(), MSBaseVehicle::reroute(), and MSBaseVehicle::routeAlongStops().

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 175 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 171 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::myType.

◆ init()

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

Definition at line 142 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 266 of file SUMOAbstractRouter.h.

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

Referenced by RORouteDef::addAlternative().

Here is the caller graph for this function:

◆ prohibit() [1/2]

template<class E , class V >
virtual void SUMOAbstractRouter< E, V >::prohibit ( const Prohibitions toProhibit)
inlinevirtualinherited

Reimplemented in RailwayRouter< E, V >.

Definition at line 363 of file SUMOAbstractRouter.h.

References SUMOAbstractRouter< E, V >::myEdgeInfos, and SUMOAbstractRouter< E, V >::myProhibited.

Referenced by AFBuild< E, N, V, M >::AFBuild(), RailwayRouter< E, V >::prohibit(), IntermodalRouter< E, L, N, V >::prohibit(), and PedestrianRouter< E, L, N, V >::prohibit().

Here is the caller graph for this function:

◆ prohibit() [2/2]

template<class E , class V >
virtual void CHRouterWrapper< E, V >::prohibit ( const std::map< const E *, double > &  toProhibit)
inlinevirtual

Definition at line 83 of file CHRouterWrapper.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 293 of file SUMOAbstractRouter.h.

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

Referenced by MSDispatch::computeDetourTime(), MSBaseVehicle::optimizeSkipped(), MSBaseVehicle::reroute(), and MSBaseVehicle::routeAlongStops().

Here is the caller graph for this function:

◆ reset()

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

reset internal caches, used by CHRouter

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

Definition at line 167 of file SUMOAbstractRouter.h.

References UNUSED_PARAMETER.

Referenced by computeRoutes(), and ROMAAssignments::incremental().

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 359 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 355 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 403 of file SUMOAbstractRouter.h.

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

◆ myBegin

template<class E , class V >
const SUMOTime CHRouterWrapper< E, V >::myBegin
private

Definition at line 123 of file CHRouterWrapper.h.

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

◆ 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 400 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*>& CHRouterWrapper< E, V >::myEdges
private

all edges with numerical ids

Definition at line 119 of file CHRouterWrapper.h.

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

◆ myEnd

template<class E , class V >
const SUMOTime CHRouterWrapper< E, V >::myEnd
private

Definition at line 124 of file CHRouterWrapper.h.

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

◆ myErrorMsgHandler

◆ myFound

◆ myFrontierList

◆ myHavePermissions

◆ myHaveRestrictions

◆ myIgnoreErrors

template<class E , class V >
const bool CHRouterWrapper< E, V >::myIgnoreErrors
private

◆ myMaxNumInstances

template<class E , class V >
const int CHRouterWrapper< E, V >::myMaxNumInstances
private

Definition at line 126 of file CHRouterWrapper.h.

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

◆ myNumQueries

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

◆ myOperation

◆ myProhibited

template<class E , class V >
Prohibitions SUMOAbstractRouter< E, V >::myProhibited
protectedinherited

The list of explicitly prohibited edges and estimated end time of prohibition.

Definition at line 415 of file SUMOAbstractRouter.h.

Referenced by RailwayRouter< E, V >::_compute(), SUMOAbstractRouter< E, V >::getEffort(), 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 433 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 430 of file SUMOAbstractRouter.h.

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

◆ myRouters

◆ myTTOperation

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

The object's operation to perform for travel times.

Definition at line 397 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 427 of file SUMOAbstractRouter.h.

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

◆ myWeightPeriod

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

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