SUMO - Simulation of Urban MObility

RODFNet Class Reference

A DFROUTER-network. More...

#include <RODFNet.h>

Inheritance diagram for RODFNet:
RONet

Data Structures

class  DFRouteDescByTimeComperator
struct  IterationEdge

Public Member Functions

void buildApproachList ()
void buildDetectorDependencies (RODFDetectorCon &detectors)
void buildEdgeFlowMap (const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
void buildRoutes (RODFDetectorCon &det, bool allEndFollower, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
void closeOutput ()
 closes the file output for computed routes
void computeTypes (RODFDetectorCon &dets, bool sourcesStrict) const
SUMOReal getAbsPos (const RODFDetector &det) const
const std::vector< std::string > & getDetectorList (ROEdge *edge) const
const std::map< std::string,
ROEdge * > & 
getEdgeMap () const
unsigned int getEdgeNo () const
 Returns the number of edges thenetwork contains.
ROEdge * getRandomDestination ()
 Returns a random edge which may be used as an ending point.
const ROEdge * getRandomDestination () const
 Returns a random edge which may be used as an ending point.
ROEdge * getRandomSource ()
 Returns a random edge which may be used as a starting point.
const ROEdge * getRandomSource () const
 Returns a random edge which may be used as a starting point.
bool hasDetector (ROEdge *edge) const
bool hasRestrictions () const
void mesoJoin (RODFDetectorCon &detectors, RODFDetectorFlows &flows)
void openOutput (const std::string &filename, bool useAlternatives)
 Opens the output for computed routes.
void removeEmptyDetectors (RODFDetectorCon &detectors, RODFDetectorFlows &flows)
void reportEmptyDetectors (RODFDetectorCon &detectors, RODFDetectorFlows &flows)
void revalidateFlows (const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
 RODFNet (bool amInHighwayMode)
 Constructor.
void setRestrictionFound ()
 ~RODFNet ()
 Destructor.
Insertion and retrieval of graph parts
virtual bool addEdge (ROEdge *edge)
ROEdge * getEdge (const std::string &name) const
 Retrieves an edge from the network.
void addNode (RONode *node)
RONode * getNode (const std::string &id) const
 Retrieves an node from the network.
Insertion and retrieval of vehicle types, vehicles, routes, and route definitions
virtual bool addVehicleType (SUMOVTypeParameter *type)
SUMOVTypeParameter * getVehicleTypeSecure (const std::string &id)
 Retrieves the named vehicle type.
bool addRouteDef (RORouteDef *def)
RORouteDef * getRouteDef (const std::string &name) const
 Returns the named route definition.
virtual bool addVehicle (const std::string &id, ROVehicle *veh)
Processing stored vehicle definitions
SUMOTime saveAndRemoveRoutesUntil (OptionsCont &options, SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime time)
 Computes routes described by their definitions and saves them.
virtual bool furtherStored ()
 Returns the information whether further vehicles are stored.

Protected Member Functions

void buildDetectorEdgeDependencies (RODFDetectorCon &dets) const
void checkSourceAndDestinations () const
 Initialises the lists of source and destination edges.
bool computeRoute (OptionsCont &options, SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const veh)
void computeRoutesFor (ROEdge *edge, RODFRouteDesc &base, int no, bool keepUnfoundEnds, bool keepShortestOnly, std::vector< ROEdge * > &visited, const RODFDetector &det, RODFRouteCont &into, const RODFDetectorCon &detectors, int maxFollowingLength, std::vector< ROEdge * > &seen) const
ROEdge * getDetectorEdge (const RODFDetector &det) const
bool hasApproached (ROEdge *edge) const
bool hasApproaching (ROEdge *edge) const
bool hasInBetweenDetectorsOnly (ROEdge *edge, const RODFDetectorCon &detectors) const
bool hasSourceDetector (ROEdge *edge, const RODFDetectorCon &detectors) const
bool isDestination (const RODFDetector &det, const RODFDetectorCon &detectors) const
bool isDestination (const RODFDetector &det, ROEdge *edge, std::vector< ROEdge * > &seen, const RODFDetectorCon &detectors) const
bool isFalseSource (const RODFDetector &det, ROEdge *edge, std::vector< ROEdge * > &seen, const RODFDetectorCon &detectors) const
bool isFalseSource (const RODFDetector &det, const RODFDetectorCon &detectors) const
bool isSource (const RODFDetector &det, ROEdge *edge, std::vector< ROEdge * > &seen, const RODFDetectorCon &detectors, bool strict) const
bool isSource (const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
void revalidateFlows (const RODFDetector *detector, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)

Protected Attributes

std::vector< ROEdge * > myDestinationEdges
 List of destination edges.
unsigned int myDiscardedRouteNo
 The number of discarded routes.
NamedObjectCont< ROEdge * > myEdges
 Known edges.
bool myHaveRestrictions
 Whether the network contains edges which not all vehicles may pass.
NamedObjectCont< RONode * > myNodes
 Known nodes.
unsigned int myReadRouteNo
 The number of read routes.
OutputDevice * myRouteAlternativesOutput
 The file to write the computed route alternatives into.
NamedObjectCont< RORouteDef * > myRoutes
 Known routes.
OutputDevice * myRoutesOutput
 The file to write the computed routes into.
std::vector< ROEdge * > mySourceEdges
 List of source edges.
ROVehicleCont myVehicles
 Known vehicles.
NamedObjectCont
< SUMOVTypeParameter * > 
myVehicleTypes
 Known vehicle types.
std::set< std::string > myVehIDs
 Known vehicle ids.
unsigned int myWrittenRouteNo
 The number of written routes.

Private Attributes

bool myAmInHighwayMode
std::map< ROEdge
*, std::vector< ROEdge * > > 
myApproachedEdges
 Map of edge name->list of names of edges approached by this edge.
std::map< ROEdge
*, std::vector< ROEdge * > > 
myApproachingEdges
 Map of edge name->list of names of this edge approaching edges.
std::map< std::string, ROEdge * > myDetectorEdges
std::map< ROEdge
*, std::vector< std::string > > 
myDetectorsOnEdges
std::vector< std::string > myDisallowedEdges
 List of ids of edges that shall not be used.
size_t myInBetweenNumber
size_t myInvalidNumber
bool myKeepTurnarounds
size_t mySinkNumber
size_t mySourceNumber

Detailed Description

A DFROUTER-network.

Definition at line 51 of file RODFNet.h.


Constructor & Destructor Documentation

RODFNet::RODFNet ( bool  amInHighwayMode)

Constructor.

Parameters:
[in]amInHighwayModeWhether search for following edges shall stop at slow edges

Definition at line 55 of file RODFNet.cpp.

References OptionsCont::getBool(), OptionsCont::getOptions(), OptionsCont::getStringVector(), myDisallowedEdges, and myKeepTurnarounds.

RODFNet::~RODFNet ( )

Destructor.

Definition at line 63 of file RODFNet.cpp.


Member Function Documentation

bool RONet::addEdge ( ROEdge *  edge) [virtual, inherited]
void RONet::addNode ( RONode *  node) [inherited]
bool RONet::addVehicle ( const std::string &  id,
ROVehicle *  veh 
) [virtual, inherited]
void RODFNet::buildDetectorDependencies ( RODFDetectorCon &  detectors)
void RODFNet::buildDetectorEdgeDependencies ( RODFDetectorCon &  dets) const [protected]
void RONet::checkSourceAndDestinations ( ) const [protected, inherited]

Initialises the lists of source and destination edges.

Definition at line 320 of file RONet.cpp.

References ROEdge::ET_SINK, ROEdge::ET_SOURCE, NamedObjectCont< T >::getMyMap(), ROEdge::getType(), RONet::myDestinationEdges, RONet::myEdges, and RONet::mySourceEdges.

Referenced by RONet::getRandomDestination(), and RONet::getRandomSource().

void RONet::closeOutput ( ) [inherited]

closes the file output for computed routes

Definition at line 121 of file RONet.cpp.

References OutputDevice::close(), RONet::myRouteAlternativesOutput, and RONet::myRoutesOutput.

Referenced by computeRoutes().

bool RONet::furtherStored ( ) [virtual, inherited]

Returns the information whether further vehicles are stored.

Definition at line 265 of file RONet.cpp.

References RONet::myVehicles, and NamedObjectCont< T >::size().

Referenced by ROLoader::processRoutesStepWise().

SUMOReal RODFNet::getAbsPos ( const RODFDetector &  det) const

Definition at line 693 of file RODFNet.cpp.

References getDetectorEdge(), ROEdge::getLength(), and RODFDetector::getPos().

Referenced by isDestination(), and isSource().

ROEdge * RODFNet::getDetectorEdge ( const RODFDetector &  det) const [protected]
const std::vector< std::string > & RODFNet::getDetectorList ( ROEdge *  edge) const

Definition at line 687 of file RODFNet.cpp.

References myDetectorsOnEdges.

ROEdge* RONet::getEdge ( const std::string &  name) const [inline, inherited]
const std::map< std::string, ROEdge * > & RONet::getEdgeMap ( ) const [inherited]
unsigned int RONet::getEdgeNo ( ) const [inherited]

Returns the number of edges thenetwork contains.

Definition at line 340 of file RONet.cpp.

References RONet::myEdges, and NamedObjectCont< T >::size().

Referenced by computeRoutes(), and main().

RONode* RONet::getNode ( const std::string &  id) const [inline, inherited]

Retrieves an node from the network.

Parameters:
[in]nameThe name of the node to retrieve
Returns:
The named node if known, otherwise 0
Todo:
Check whether a const pointer may be returned

Definition at line 124 of file RONet.h.

References NamedObjectCont< T >::get(), and RONet::myNodes.

Referenced by RONetHandler::parseEdge(), and RONetHandler::parseJunction().

const ROEdge * RONet::getRandomDestination ( ) const [inherited]

Returns a random edge which may be used as an ending point.

If the list of possible destinations (roads with no successor, "myDestinationEdges") is empty, it is tried to be built, first.

Returns:
A random edge from the list of edges with no successor

Definition at line 308 of file RONet.cpp.

References RONet::checkSourceAndDestinations(), RandHelper::getRandomFrom(), and RONet::myDestinationEdges.

ROEdge * RONet::getRandomDestination ( ) [inherited]

Returns a random edge which may be used as an ending point.

If the list of possible destinations (roads with no successor, "myDestinationEdges") is empty, it is tried to be built, first.

Returns:
A random edge from the list of edges with no successor

Definition at line 296 of file RONet.cpp.

References RONet::checkSourceAndDestinations(), RandHelper::getRandomFrom(), and RONet::myDestinationEdges.

ROEdge * RONet::getRandomSource ( ) [inherited]

Returns a random edge which may be used as a starting point.

If the list of possible source (roads with no predecessor, "mySourceEdges") is empty, it is tried to be built, first.

Returns:
A random edge from the list of edges with no predecessor

Definition at line 271 of file RONet.cpp.

References RONet::checkSourceAndDestinations(), RandHelper::getRandomFrom(), and RONet::mySourceEdges.

const ROEdge * RONet::getRandomSource ( ) const [inherited]

Returns a random edge which may be used as a starting point.

If the list of possible sources (roads with no predecessor, "mySourceEdges") is empty, it is tried to be built, first.

Returns:
A random edge from the list of edges with no predecessor

Definition at line 283 of file RONet.cpp.

References RONet::checkSourceAndDestinations(), RandHelper::getRandomFrom(), and RONet::mySourceEdges.

RORouteDef* RONet::getRouteDef ( const std::string &  name) const [inline, inherited]

Returns the named route definition.

Parameters:
[in]nameThe name of the route definition to retrieve
Returns:
The named route definition if known, otherwise 0
Todo:

Check whether a const pointer may be returned

Rename myRoutes to myRouteDefinitions

Definition at line 181 of file RONet.h.

References NamedObjectCont< T >::get(), and RONet::myRoutes.

Referenced by RORDLoader_SUMOBase::closeVehicle().

SUMOVTypeParameter * RONet::getVehicleTypeSecure ( const std::string &  id) [inherited]

Retrieves the named vehicle type.

If the named vehicle type was not added to the net before, a default vehicle type which consists of the id only is generated, added to the net and returned.

Only if the name is "", 0 is returned.

Parameters:
[in]idThe id of the vehicle type to return
Returns:
The named vehicle type
Todo:
Check whether a const pointer may be returned

Definition at line 135 of file RONet.cpp.

References RONet::addVehicleType(), NamedObjectCont< T >::get(), SUMOVTypeParameter::id, RONet::myVehicleTypes, and SUMOVTypeParameter::onlyReferenced.

Referenced by RORDLoader_SUMOBase::closeVehicle(), RORDLoader_TripDefs::myEndElement(), and RORDGenerator_ODAmounts::myEndFlowAmountDef().

bool RODFNet::hasApproached ( ROEdge *  edge) const [protected]

Definition at line 669 of file RODFNet.cpp.

References myApproachedEdges.

Referenced by computeRoutesFor(), and isDestination().

bool RODFNet::hasApproaching ( ROEdge *  edge) const [protected]

Definition at line 660 of file RODFNet.cpp.

References myApproachingEdges.

Referenced by isSource().

bool RODFNet::hasInBetweenDetectorsOnly ( ROEdge *  edge,
const RODFDetectorCon &  detectors 
) const [protected]
bool RONet::hasRestrictions ( ) const [inherited]

Definition at line 352 of file RONet.cpp.

References RONet::myHaveRestrictions.

Referenced by computeRoutes().

bool RODFNet::hasSourceDetector ( ROEdge *  edge,
const RODFDetectorCon &  detectors 
) const [protected]
bool RODFNet::isDestination ( const RODFDetector &  det,
const RODFDetectorCon &  detectors 
) const [protected]

Definition at line 716 of file RODFNet.cpp.

References getDetectorEdge().

Referenced by computeTypes(), and isDestination().

bool RODFNet::isDestination ( const RODFDetector &  det,
ROEdge *  edge,
std::vector< ROEdge * > &  seen,
const RODFDetectorCon &  detectors 
) const [protected]
bool RODFNet::isFalseSource ( const RODFDetector &  det,
const RODFDetectorCon &  detectors 
) const [protected]

Definition at line 709 of file RODFNet.cpp.

References getDetectorEdge().

Referenced by computeTypes(), and isFalseSource().

bool RODFNet::isSource ( const RODFDetector &  det,
ROEdge *  edge,
std::vector< ROEdge * > &  seen,
const RODFDetectorCon &  detectors,
bool  strict 
) const [protected]
bool RODFNet::isSource ( const RODFDetector &  det,
const RODFDetectorCon &  detectors,
bool  strict 
) const [protected]

Definition at line 701 of file RODFNet.cpp.

References getDetectorEdge().

Referenced by computeTypes(), and isSource().

void RONet::openOutput ( const std::string &  filename,
bool  useAlternatives 
) [inherited]

Opens the output for computed routes.

If the second parameter is true, a second file for route alternatives will be opened. The route alternatives files is simply the given name with ".alt" appended (before the ".xml"-suffix). If one of the file outputs can not be build, an IOError is thrown

Parameters:
[in]filenameThe (base) name of the file(s) to create
[in]useAlternativesWhether a file for writing alternatives shall be created

Definition at line 105 of file RONet.cpp.

References OutputDevice::getDevice(), RONet::myRouteAlternativesOutput, RONet::myRoutesOutput, and OutputDevice::writeXMLHeader().

Referenced by computeRoutes().

void RODFNet::removeEmptyDetectors ( RODFDetectorCon &  detectors,
RODFDetectorFlows &  flows 
)
void RODFNet::reportEmptyDetectors ( RODFDetectorCon &  detectors,
RODFDetectorFlows &  flows 
)

Definition at line 630 of file RODFNet.cpp.

References RODFDetectorCon::getDetectors(), RODFDetectorFlows::knows(), and WRITE_MESSAGE.

Referenced by startComputation().

void RODFNet::revalidateFlows ( const RODFDetectorCon &  detectors,
RODFDetectorFlows &  flows,
SUMOTime  startTime,
SUMOTime  endTime,
SUMOTime  stepOffset 
)

Definition at line 593 of file RODFNet.cpp.

References RODFDetectorCon::getDetectors().

Referenced by startComputation().

SUMOTime RONet::saveAndRemoveRoutesUntil ( OptionsCont &  options,
SUMOAbstractRouter< ROEdge, ROVehicle > &  router,
SUMOTime  time 
) [inherited]

Computes routes described by their definitions and saves them.

As long a vehicle with a departure time not larger than the given exists, its route is computed and it is written and removed from the internal container.

Parameters:
[in]optionsThe options used during this process
[in]routerThe router to use for routes computation
[in]optionsThe time until which route definitions shall be processed
Returns:
The last seen departure time>=time

Definition at line 221 of file RONet.cpp.

References RONet::computeRoute(), ROVehicleCont::erase(), OptionsCont::getBool(), ROVehicle::getDepartureTime(), ROVehicle::getID(), OptionsCont::getInt(), ROVehicleCont::getTopVehicle(), RONet::myDiscardedRouteNo, RONet::myReadRouteNo, RONet::myRouteAlternativesOutput, RONet::myRoutesOutput, RONet::myVehicles, RONet::myWrittenRouteNo, ROVehicle::saveAllAsXML(), NamedObjectCont< T >::size(), toString(), and WRITE_MESSAGE.

Referenced by ROLoader::makeSingleStep(), and ROLoader::processAllRoutes().

void RONet::setRestrictionFound ( ) [inherited]

Definition at line 358 of file RONet.cpp.

References RONet::myHaveRestrictions.

Referenced by RONetHandler::parseLane().


Field Documentation

Definition at line 163 of file RODFNet.h.

Referenced by computeRoutesFor(), isDestination(), isFalseSource(), and isSource().

std::map<ROEdge*, std::vector<ROEdge*> > RODFNet::myApproachedEdges [private]

Map of edge name->list of names of edges approached by this edge.

Definition at line 158 of file RODFNet.h.

Referenced by buildApproachList(), computeRoutesFor(), hasApproached(), isDestination(), isFalseSource(), and revalidateFlows().

std::map<ROEdge*, std::vector<ROEdge*> > RODFNet::myApproachingEdges [private]

Map of edge name->list of names of this edge approaching edges.

Definition at line 155 of file RODFNet.h.

Referenced by buildApproachList(), hasApproaching(), isSource(), and revalidateFlows().

std::vector<ROEdge*> RONet::myDestinationEdges [mutable, protected, inherited]

List of destination edges.

Definition at line 323 of file RONet.h.

Referenced by RONet::checkSourceAndDestinations(), and RONet::getRandomDestination().

std::map<std::string, ROEdge*> RODFNet::myDetectorEdges [mutable, private]
std::vector<std::string> RODFNet::myDisallowedEdges [private]

List of ids of edges that shall not be used.

Definition at line 167 of file RODFNet.h.

Referenced by buildApproachList(), and RODFNet().

unsigned int RONet::myDiscardedRouteNo [protected, inherited]

The number of discarded routes.

Definition at line 335 of file RONet.h.

Referenced by RONet::saveAndRemoveRoutesUntil().

bool RONet::myHaveRestrictions [protected, inherited]

Whether the network contains edges which not all vehicles may pass.

Definition at line 341 of file RONet.h.

Referenced by RONet::hasRestrictions(), and RONet::setRestrictionFound().

size_t RODFNet::myInBetweenNumber [mutable, private]

Definition at line 164 of file RODFNet.h.

Referenced by computeTypes().

size_t RODFNet::myInvalidNumber [mutable, private]

Definition at line 164 of file RODFNet.h.

Referenced by computeTypes().

Definition at line 170 of file RODFNet.h.

Referenced by buildApproachList(), and RODFNet().

NamedObjectCont<RONode*> RONet::myNodes [protected, inherited]

Known nodes.

Definition at line 305 of file RONet.h.

Referenced by RONet::addNode(), RONet::getNode(), and RONet::~RONet().

unsigned int RONet::myReadRouteNo [protected, inherited]

The number of read routes.

Definition at line 332 of file RONet.h.

Referenced by RONet::addVehicle(), and RONet::saveAndRemoveRoutesUntil().

The file to write the computed route alternatives into.

Definition at line 329 of file RONet.h.

Referenced by RONet::closeOutput(), RONet::openOutput(), and RONet::saveAndRemoveRoutesUntil().

NamedObjectCont<RORouteDef*> RONet::myRoutes [protected, inherited]

Known routes.

Definition at line 314 of file RONet.h.

Referenced by RONet::addRouteDef(), RONet::getRouteDef(), and RONet::~RONet().

OutputDevice* RONet::myRoutesOutput [protected, inherited]

The file to write the computed routes into.

Definition at line 326 of file RONet.h.

Referenced by RONet::closeOutput(), RONet::openOutput(), and RONet::saveAndRemoveRoutesUntil().

size_t RODFNet::mySinkNumber [mutable, private]

Definition at line 164 of file RODFNet.h.

Referenced by computeTypes().

std::vector<ROEdge*> RONet::mySourceEdges [mutable, protected, inherited]

List of source edges.

Definition at line 320 of file RONet.h.

Referenced by RONet::checkSourceAndDestinations(), and RONet::getRandomSource().

size_t RODFNet::mySourceNumber [mutable, private]

Definition at line 164 of file RODFNet.h.

Referenced by computeTypes().

ROVehicleCont RONet::myVehicles [protected, inherited]

Known vehicles.

Definition at line 317 of file RONet.h.

Referenced by RONet::addVehicle(), RONet::furtherStored(), RONet::saveAndRemoveRoutesUntil(), and RONet::~RONet().

Known vehicle types.

Definition at line 311 of file RONet.h.

Referenced by RONet::addVehicleType(), RONet::getVehicleTypeSecure(), and RONet::~RONet().

std::set<std::string> RONet::myVehIDs [protected, inherited]

Known vehicle ids.

Definition at line 302 of file RONet.h.

Referenced by RONet::addVehicle().

unsigned int RONet::myWrittenRouteNo [protected, inherited]

The number of written routes.

Definition at line 338 of file RONet.h.

Referenced by RONet::saveAndRemoveRoutesUntil().


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines