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

Computes the shortest path through a network using the A* algorithm. More...

#include <AStarRouter.h>

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

Data Structures

class  EdgeInfoComparator
 

Public Types

typedef FullLookupTable< E, V > FLT
 
typedef LandmarkLookupTable< E, V > LMLT
 
typedef AbstractLookupTable< E, V > LookupTable
 
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

 AStarRouter (const std::vector< E * > &edges, bool unbuildIsWarning, typename SUMOAbstractRouter< E, V >::Operation operation, const std::shared_ptr< const LookupTable > lookup=nullptr, const bool havePermissions=false, const bool haveRestrictions=false)
 Constructor. More...
 
 AStarRouter (const std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo > &edgeInfos, bool unbuildIsWarning, typename SUMOAbstractRouter< E, V >::Operation operation, const std::shared_ptr< const LookupTable > lookup=nullptr, const bool havePermissions=false, const bool haveRestrictions=false)
 
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 travel time. More...
 
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. 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...
 
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
 
const std::string & getType () const
 
void init (const int edgeID, const SUMOTime msTime)
 
bool isProhibited (const E *const edge, const V *const vehicle) const
 
virtual void prohibit (const std::vector< E * > &toProhibit)
 
double recomputeCosts (const std::vector< const E * > &edges, const V *const v, double fromPos, double toPos, SUMOTime msTime, double *lengthp=nullptr) const
 
double recomputeCosts (const std::vector< const E * > &edges, const V *const v, SUMOTime msTime, double *lengthp=nullptr) const
 
virtual void reset (const V *const vehicle)
 reset internal caches, used by CHRouter More...
 
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 ~AStarRouter ()
 Destructor. More...
 

Protected Attributes

bool myAmClean
 whether we are already initialized More...
 
bool myAutoBulkMode
 whether we are currently trying to detect bulk mode automatically More...
 
bool myBulkMode
 whether we are currently operating several route queries in a bulk More...
 
EdgeInfoComparator myComparator
 
std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfomyEdgeInfos
 The container of edge information. More...
 
MsgHandler *const myErrorMsgHandler
 the handler for routing errors More...
 
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...
 
const bool myHavePermissions
 whether edge permissions need to be considered More...
 
const bool myHaveRestrictions
 whether edge restrictions need to be considered More...
 
const std::shared_ptr< const LookupTablemyLookupTable
 the lookup table for travel time heuristics More...
 
double myMaxSpeed
 maximum speed in the network More...
 
Operation myOperation
 The object's operation to perform. More...
 
std::vector< E * > myProhibited
 The list of explicitly prohibited edges. More...
 
Operation myTTOperation
 The object's operation to perform for travel times. More...
 

Private Attributes

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...
 
const std::string myType
 the type of this router More...
 

Detailed Description

template<class E, class V>
class AStarRouter< E, V >

Computes the shortest path through a network using the A* algorithm.

The template parameters are:

Parameters
EThe edge class to use (MSEdge/ROEdge)
VThe vehicle class to use (MSVehicle/ROVehicle)
BASEThe base class to use (SUMOAbstractRouterPermissions/SUMOAbstractRouter)

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 76 of file AStarRouter.h.

Member Typedef Documentation

◆ FLT

template<class E , class V >
typedef FullLookupTable<E, V> AStarRouter< E, V >::FLT

Definition at line 79 of file AStarRouter.h.

◆ LMLT

template<class E , class V >
typedef LandmarkLookupTable<E, V> AStarRouter< E, V >::LMLT

Definition at line 80 of file AStarRouter.h.

◆ LookupTable

template<class E , class V >
typedef AbstractLookupTable<E, V> AStarRouter< E, V >::LookupTable

Definition at line 78 of file AStarRouter.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 96 of file SUMOAbstractRouter.h.

Constructor & Destructor Documentation

◆ AStarRouter() [1/2]

template<class E , class V >
AStarRouter< E, V >::AStarRouter ( const std::vector< E * > &  edges,
bool  unbuildIsWarning,
typename SUMOAbstractRouter< E, V >::Operation  operation,
const std::shared_ptr< const LookupTable lookup = nullptr,
const bool  havePermissions = false,
const bool  haveRestrictions = false 
)
inline

Constructor.

Definition at line 98 of file AStarRouter.h.

References MAX2(), SUMOAbstractRouter< E, V >::myEdgeInfos, and AStarRouter< E, V >::myMaxSpeed.

◆ AStarRouter() [2/2]

template<class E , class V >
AStarRouter< E, V >::AStarRouter ( const std::vector< typename SUMOAbstractRouter< E, V >::EdgeInfo > &  edgeInfos,
bool  unbuildIsWarning,
typename SUMOAbstractRouter< E, V >::Operation  operation,
const std::shared_ptr< const LookupTable lookup = nullptr,
const bool  havePermissions = false,
const bool  haveRestrictions = false 
)
inline

◆ ~AStarRouter()

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

Destructor.

Definition at line 121 of file AStarRouter.h.

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

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

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

Here is the caller graph for this function:

◆ clone()

◆ compute() [1/2]

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

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

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 173 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 169 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

◆ 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 >
virtual void SUMOAbstractRouter< E, V >::prohibit ( const std::vector< E * > &  toProhibit)
inlinevirtualinherited

◆ recomputeCosts() [1/2]

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

◆ recomputeCosts() [2/2]

◆ 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 CHRouter< E, V >.

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

References SUMOAbstractRouter< E, V >::myAutoBulkMode.

Referenced by LandmarkLookupTable< E, V >::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 IntermodalRouter< E, L, N, V >.

Definition at line 343 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

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

whether we are already initialized

Definition at line 389 of file SUMOAbstractRouter.h.

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

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

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

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

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

◆ myComparator

template<class E , class V >
EdgeInfoComparator AStarRouter< E, V >::myComparator
protected

Definition at line 280 of file AStarRouter.h.

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

◆ myEdgeInfos

◆ myErrorMsgHandler

◆ myFound

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

◆ myFrontierList

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

A container for reusage of the min edge heap.

Definition at line 404 of file SUMOAbstractRouter.h.

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

◆ myHavePermissions

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

◆ myHaveRestrictions

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

◆ myLookupTable

template<class E , class V >
const std::shared_ptr<const LookupTable> AStarRouter< E, V >::myLookupTable
protected

the lookup table for travel time heuristics

Definition at line 283 of file AStarRouter.h.

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

◆ myMaxSpeed

template<class E , class V >
double AStarRouter< E, V >::myMaxSpeed
protected

maximum speed in the network

Definition at line 286 of file AStarRouter.h.

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

◆ 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

The list of explicitly prohibited edges.

Definition at line 398 of file SUMOAbstractRouter.h.

Referenced by 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 416 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 413 of file SUMOAbstractRouter.h.

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

◆ myTTOperation

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

The object's operation to perform for travel times.

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

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


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