Eclipse SUMO - Simulation of Urban MObility
DijkstraRouter< E, V > Class Template Reference

Computes the shortest path through a network using the Dijkstra algorithm. More...

#include <DijkstraRouter.h>

Inheritance diagram for DijkstraRouter< E, V >:
Collaboration diagram for DijkstraRouter< E, V >:

Data Structures

class  EdgeInfoByEffortComparator
 

Public Types

typedef double(* Operation) (const E *const, const V *const, double)
 Type of the function that is used to retrieve the edge effort. More...
 

Public Member Functions

void buildPathFrom (const typename SUMOAbstractRouter< E, V >::EdgeInfo *rbegin, std::vector< const E * > &edges)
 Builds the path from marked edges. More...
 
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. More...
 
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. More...
 
 DijkstraRouter (const std::vector< E * > &edges, bool unbuildIsWarning, typename SUMOAbstractRouter< E, V >::Operation effortOperation, typename SUMOAbstractRouter< E, V >::Operation ttOperation=nullptr, bool silent=false, EffortCalculator *calc=nullptr, const bool havePermissions=false, const bool haveRestrictions=false)
 Constructor. More...
 
void endQuery (int visits)
 
const SUMOAbstractRouter< E, V >::EdgeInfogetEdgeInfo (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
 
void init ()
 
bool isProhibited (const E *const edge, const V *const vehicle) const
 
void prohibit (const std::vector< E * > &toProhibit)
 
double recomputeCosts (const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
 
void setBulkMode (const bool mode)
 
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 ~DijkstraRouter ()
 Destructor. More...
 

Protected Attributes

bool myBulkMode
 whether we are currently operating several route queries in a bulk More...
 
MsgHandler *const myErrorMsgHandler
 the handler for routing errors More...
 
const bool myHavePermissions
 whether edge permissions need to be considered More...
 
const bool myHaveRestrictions
 whether edge restrictions need to be considered More...
 
Operation myOperation
 The object's operation to perform. More...
 
std::vector< E * > myProhibited
 
Operation myTTOperation
 The object's operation to perform for travel times. More...
 

Private Member Functions

 DijkstraRouter (const std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo > &edgeInfos, bool unbuildIsWarning, typename SUMOAbstractRouter< E, V >::Operation effortOperation, typename SUMOAbstractRouter< E, V >::Operation ttOperation, bool silent, EffortCalculator *calc, const bool havePermissions, const bool haveRestrictions)
 

Private Attributes

EdgeInfoByEffortComparator myComparator
 
std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfomyEdgeInfos
 The container of edge information. More...
 
EffortCalculator *const myExternalEffort
 
std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo * > myFound
 list of visited Edges (for resetting) More...
 
std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo * > myFrontierList
 A container for reusage of the min edge heap. More...
 
long long int myNumQueries
 
long long int myQueryStartTime
 the time spent querying in milliseconds More...
 
long long int myQueryTimeSum
 
long long int myQueryVisits
 counters for performance logging More...
 
bool mySilent
 whether to supress warning/error if no route was found More...
 
const std::string myType
 the type of this router More...
 

Detailed Description

template<class E, class V>
class DijkstraRouter< E, V >

Computes the shortest path through a network using the Dijkstra algorithm.

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 DijkstraRouter.h.

Member Typedef Documentation

◆ 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 96 of file SUMOAbstractRouter.h.

Constructor & Destructor Documentation

◆ DijkstraRouter() [1/2]

template<class E, class V>
DijkstraRouter< E, V >::DijkstraRouter ( const std::vector< E * > &  edges,
bool  unbuildIsWarning,
typename SUMOAbstractRouter< E, V >::Operation  effortOperation,
typename SUMOAbstractRouter< E, V >::Operation  ttOperation = nullptr,
bool  silent = false,
EffortCalculator calc = nullptr,
const bool  havePermissions = false,
const bool  haveRestrictions = false 
)
inline

Constructor.

Definition at line 80 of file DijkstraRouter.h.

References DijkstraRouter< E, V >::myEdgeInfos.

◆ ~DijkstraRouter()

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

Destructor.

Definition at line 91 of file DijkstraRouter.h.

◆ DijkstraRouter() [2/2]

template<class E, class V>
DijkstraRouter< E, V >::DijkstraRouter ( const std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo > &  edgeInfos,
bool  unbuildIsWarning,
typename SUMOAbstractRouter< E, V >::Operation  effortOperation,
typename SUMOAbstractRouter< E, V >::Operation  ttOperation,
bool  silent,
EffortCalculator calc,
const bool  havePermissions,
const bool  haveRestrictions 
)
inlineprivate

Definition at line 255 of file DijkstraRouter.h.

References DijkstraRouter< E, V >::myEdgeInfos.

Member Function Documentation

◆ buildPathFrom()

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

Builds the path from marked edges.

Definition at line 241 of file DijkstraRouter.h.

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

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

◆ clone()

◆ compute()

◆ 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 130 of file SUMOAbstractRouter.h.

Referenced by MSBaseVehicle::reroute(), and MSTriggeredRerouter::rerouteParkingArea().

◆ 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& DijkstraRouter< E, V >::getEdgeInfo ( int  index) const
inline

Definition at line 250 of file DijkstraRouter.h.

References DijkstraRouter< 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

◆ init()

template<class E, class V>
void DijkstraRouter< E, V >::init ( )
inline

◆ isProhibited()

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

◆ prohibit()

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

◆ recomputeCosts()

◆ setBulkMode()

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

Definition at line 230 of file SUMOAbstractRouter.h.

Referenced by ROMAAssignments::incremental().

◆ 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

◆ 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 245 of file SUMOAbstractRouter.h.

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

◆ myComparator

template<class E, class V>
EdgeInfoByEffortComparator DijkstraRouter< E, V >::myComparator
private

Definition at line 280 of file DijkstraRouter.h.

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

◆ myEdgeInfos

template<class E, class V>
std::vector<typename SUMOAbstractRouter<E, V>::EdgeInfo> DijkstraRouter< E, V >::myEdgeInfos
private

◆ myErrorMsgHandler

◆ myExternalEffort

template<class E, class V>
EffortCalculator* const DijkstraRouter< E, V >::myExternalEffort
private

◆ myFound

template<class E, class V>
std::vector<typename SUMOAbstractRouter<E, V>::EdgeInfo*> DijkstraRouter< E, V >::myFound
private

list of visited Edges (for resetting)

Definition at line 278 of file DijkstraRouter.h.

Referenced by DijkstraRouter< E, V >::compute(), and DijkstraRouter< E, V >::init().

◆ myFrontierList

template<class E, class V>
std::vector<typename SUMOAbstractRouter<E, V>::EdgeInfo*> DijkstraRouter< E, V >::myFrontierList
private

A container for reusage of the min edge heap.

Definition at line 276 of file DijkstraRouter.h.

Referenced by DijkstraRouter< E, V >::compute(), and DijkstraRouter< E, V >::init().

◆ myHavePermissions

template<class E, class V>
const bool SUMOAbstractRouter< E, V >::myHavePermissions
protectedinherited

whether edge permissions need to be considered

Definition at line 248 of file SUMOAbstractRouter.h.

Referenced by DijkstraRouter< E, V >::clone(), CHRouter< E, V >::clone(), and SUMOAbstractRouter< E, IntermodalTrip< E, N, V > >::isProhibited().

◆ myHaveRestrictions

template<class E, class V>
const bool SUMOAbstractRouter< E, V >::myHaveRestrictions
protectedinherited

whether edge restrictions need to be considered

Definition at line 251 of file SUMOAbstractRouter.h.

Referenced by DijkstraRouter< E, V >::clone(), CHRouter< E, V >::clone(), and SUMOAbstractRouter< E, IntermodalTrip< E, N, V > >::isProhibited().

◆ myNumQueries

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

◆ myOperation

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

◆ myProhibited

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

◆ myQueryStartTime

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

◆ 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

◆ mySilent

template<class E, class V>
bool DijkstraRouter< E, V >::mySilent
private

whether to supress warning/error if no route was found

Definition at line 268 of file DijkstraRouter.h.

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

◆ myTTOperation

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

The object's operation to perform for travel times.

Definition at line 242 of file SUMOAbstractRouter.h.

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

◆ myType

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

the type of this router

Definition at line 257 of file SUMOAbstractRouter.h.

Referenced by SUMOAbstractRouter< E, IntermodalTrip< E, N, V > >::~SUMOAbstractRouter().


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