SUMO - Simulation of Urban MObility
|
The router's network representation. More...
#include <RONet.h>
Public Member Functions | |
void | cleanup (SUMOAbstractRouter< ROEdge, ROVehicle > *router) |
closes the file output for computed routes and deletes routers and associated threads if necessary More... | |
const std::map< std::string, ROEdge * > & | getEdgeMap () const |
size_t | getEdgeNo () const |
Returns the total number of edges the network contains including internal edges. More... | |
int | getInternalEdgeNumber () const |
Returns the number of internal edges the network contains. More... | |
OutputDevice * | getRouteOutput (const bool alternative=false) |
bool | hasRestrictions () const |
void | openOutput (const std::string &filename, const std::string altFilename, const std::string typeFilename) |
Opens the output for computed routes. More... | |
RONet () | |
Constructor. More... | |
void | setRestrictionFound () |
virtual | ~RONet () |
Destructor. More... | |
Insertion and retrieval of graph parts | |
virtual bool | addEdge (ROEdge *edge) |
bool | addDistrict (const std::string id, ROEdge *source, ROEdge *sink) |
bool | addDistrictEdge (const std::string tazID, const std::string edgeID, const bool isSource) |
const std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > & | getDistricts () const |
Retrieves all TAZ (districts) from the network. More... | |
ROEdge * | getEdge (const std::string &name) const |
Retrieves an edge from the network. More... | |
void | addNode (RONode *node) |
RONode * | getNode (const std::string &id) const |
Retrieves an node from the network. More... | |
void | addBusStop (const std::string &id, SUMOVehicleParameter::Stop *stop) |
void | addContainerStop (const std::string &id, SUMOVehicleParameter::Stop *stop) |
const SUMOVehicleParameter::Stop * | getBusStop (const std::string &id) const |
Retrieves a bus stop from the network. More... | |
const SUMOVehicleParameter::Stop * | getContainerStop (const std::string &id) const |
Retrieves a container stop from the network. More... | |
Insertion and retrieval of vehicle types, vehicles, routes, and route definitions | |
bool | checkVType (const std::string &id) |
Checks whether the vehicle type (distribution) may be added. More... | |
virtual bool | addVehicleType (SUMOVTypeParameter *type) |
Adds a read vehicle type definition to the network. More... | |
bool | addVTypeDistribution (const std::string &id, RandomDistributor< SUMOVTypeParameter * > *vehTypeDistribution) |
Adds a vehicle type distribution. More... | |
SUMOVTypeParameter * | getVehicleTypeSecure (const std::string &id) |
Retrieves the named vehicle type. More... | |
bool | addRouteDef (RORouteDef *def) |
RORouteDef * | getRouteDef (const std::string &name) const |
Returns the named route definition. More... | |
virtual bool | addVehicle (const std::string &id, ROVehicle *veh) |
bool | addFlow (SUMOVehicleParameter *flow, const bool randomize) |
void | addPerson (const SUMOTime depart, const std::string desc) |
void | addContainer (const SUMOTime depart, const std::string desc) |
Processing stored vehicle definitions | |
SUMOTime | saveAndRemoveRoutesUntil (OptionsCont &options, SUMOAbstractRouter< ROEdge, ROVehicle > &router, SUMOTime time) |
Computes routes described by their definitions and saves them. More... | |
virtual bool | furtherStored () |
Returns the information whether further vehicles, persons or containers are stored. More... | |
Protected Types | |
typedef std::multimap< const SUMOTime, const std::string > | ContainerMap |
Known containers. More... | |
typedef std::multimap< const SUMOTime, const std::string > | PersonMap |
Known persons. More... | |
typedef std::map< std::string, RandomDistributor< SUMOVTypeParameter * > * > | VTypeDistDictType |
Vehicle type distribution dictionary type. More... | |
Protected Member Functions | |
void | checkFlows (SUMOTime time) |
ROVehicleCont & | getVehicles () |
return vehicles for use by RouteAggregator More... | |
Static Protected Member Functions | |
static bool | computeRoute (SUMOAbstractRouter< ROEdge, ROVehicle > &router, const ROVehicle *const veh, const bool removeLoops, MsgHandler *errorHandler) |
Protected Attributes | |
std::map< std::string, SUMOVehicleParameter::Stop * > | myBusStops |
Known bus stops. More... | |
ContainerMap | myContainers |
std::map< std::string, SUMOVehicleParameter::Stop * > | myContainerStops |
Known container stops. More... | |
bool | myDefaultVTypeMayBeDeleted |
Whether no vehicle type was loaded. More... | |
std::map< std::string, std::vector< SUMOTime > > | myDepartures |
Departure times for randomized flows. More... | |
unsigned int | myDiscardedRouteNo |
The number of discarded routes. More... | |
std::map< std::string, std::pair< std::vector< std::string >, std::vector< std::string > > > | myDistricts |
traffic assignment zones with sources and sinks More... | |
NamedObjectCont< ROEdge * > | myEdges |
Known edges. More... | |
MsgHandler * | myErrorHandler |
handler for ignorable error messages More... | |
NamedObjectCont< SUMOVehicleParameter * > | myFlows |
Known flows. More... | |
bool | myHaveRestrictions |
Whether the network contains edges which not all vehicles may pass. More... | |
NamedObjectCont< RONode * > | myNodes |
Known nodes. More... | |
int | myNumInternalEdges |
The number of internal edges in the dictionary. More... | |
PersonMap | myPersons |
unsigned int | myReadRouteNo |
The number of read routes. More... | |
OutputDevice * | myRouteAlternativesOutput |
The file to write the computed route alternatives into. More... | |
NamedObjectCont< RORouteDef * > | myRoutes |
Known routes. More... | |
OutputDevice * | myRoutesOutput |
The file to write the computed routes into. More... | |
OutputDevice * | myTypesOutput |
The file to write the vehicle types into. More... | |
ROVehicleCont | myVehicles |
Known vehicles. More... | |
NamedObjectCont< SUMOVTypeParameter * > | myVehicleTypes |
Known vehicle types. More... | |
std::set< std::string > | myVehIDs |
Known vehicle ids. More... | |
VTypeDistDictType | myVTypeDistDict |
A distribution of vehicle types (probability->vehicle type) More... | |
unsigned int | myWrittenRouteNo |
The number of written routes. More... | |
Private Member Functions | |
RONet & | operator= (const RONet &src) |
Invalidated assignment operator. More... | |
RONet (const RONet &src) | |
Invalidated copy constructor. More... | |
Friends | |
class | RORouteAggregator |
The router's network representation.
A router network is responsible for watching loaded edges, nodes,!!!
|
protected |
|
protected |
|
protected |
RONet::RONet | ( | ) |
Constructor.
Definition at line 58 of file RONet.cpp.
References NamedObjectCont< T >::add(), DEFAULT_VTYPE_ID, SUMOVTypeParameter::id, myVehicleTypes, SUMOVTypeParameter::onlyReferenced, and SVC_IGNORING.
|
virtual |
Destructor.
Definition at line 72 of file RONet.cpp.
References ROVehicleCont::clear(), NamedObjectCont< T >::clear(), myEdges, myNodes, myRoutes, myVehicles, and myVehicleTypes.
|
private |
Invalidated copy constructor.
void RONet::addBusStop | ( | const std::string & | id, |
SUMOVehicleParameter::Stop * | stop | ||
) |
Definition at line 144 of file RONet.cpp.
References myBusStops, and WRITE_ERROR.
Referenced by RONetHandler::parseBusStop().
void RONet::addContainer | ( | const SUMOTime | depart, |
const std::string | desc | ||
) |
Definition at line 313 of file RONet.cpp.
References myContainers.
Referenced by RORouteHandler::closeContainer().
void RONet::addContainerStop | ( | const std::string & | id, |
SUMOVehicleParameter::Stop * | stop | ||
) |
Definition at line 155 of file RONet.cpp.
References myContainerStops, and WRITE_ERROR.
Referenced by RONetHandler::parseContainerStop().
Definition at line 96 of file RONet.cpp.
References addEdge(), ROEdge::ET_DISTRICT, myDistricts, ROEdge::setType(), and WRITE_ERROR.
Referenced by RONetHandler::parseDistrict().
bool RONet::addDistrictEdge | ( | const std::string | tazID, |
const std::string | edgeID, | ||
const bool | isSource | ||
) |
Definition at line 113 of file RONet.cpp.
References ROEdge::addSuccessor(), getEdge(), myDistricts, and WRITE_ERROR.
Referenced by RONetHandler::parseDistrict(), and RONetHandler::parseDistrictEdge().
Definition at line 82 of file RONet.cpp.
References NamedObjectCont< T >::add(), ROEdge::ET_INTERNAL, Named::getID(), ROEdge::getType(), myEdges, myNumInternalEdges, and WRITE_ERROR.
Referenced by addDistrict(), and RONetHandler::parseEdge().
bool RONet::addFlow | ( | SUMOVehicleParameter * | flow, |
const bool | randomize | ||
) |
Definition at line 294 of file RONet.cpp.
References NamedObjectCont< T >::add(), SUMOVehicleParameter::depart, SUMOVehicleParameter::id, myDepartures, myFlows, RandHelper::rand(), SUMOVehicleParameter::repetitionNumber, and SUMOVehicleParameter::repetitionOffset.
Referenced by RORouteHandler::closeFlow().
void RONet::addNode | ( | RONode * | node | ) |
Definition at line 135 of file RONet.cpp.
References NamedObjectCont< T >::add(), Named::getID(), myNodes, and WRITE_ERROR.
Referenced by RONetHandler::parseEdge(), and RONetHandler::parseJunction().
void RONet::addPerson | ( | const SUMOTime | depart, |
const std::string | desc | ||
) |
Definition at line 308 of file RONet.cpp.
References myPersons.
Referenced by RORouteHandler::closePerson().
bool RONet::addRouteDef | ( | RORouteDef * | def | ) |
Definition at line 166 of file RONet.cpp.
References NamedObjectCont< T >::add(), Named::getID(), and myRoutes.
Referenced by RORouteHandler::closeRoute(), and RORouteHandler::closeRouteDistribution().
Definition at line 282 of file RONet.cpp.
References ROVehicleCont::add(), myReadRouteNo, myVehicles, myVehIDs, and WRITE_ERROR.
Referenced by checkFlows(), and RORouteHandler::closeVehicle().
|
virtual |
Adds a read vehicle type definition to the network.
If the vehicle type definition is already known (another one with the same id exists), false is returned, and the vehicle type is deleted.
[in] | def | The vehicle type to add |
Definition at line 259 of file RONet.cpp.
References NamedObjectCont< T >::add(), checkVType(), SUMOVTypeParameter::id, myVehicleTypes, and WRITE_ERROR.
Referenced by RORouteHandler::myEndElement().
bool RONet::addVTypeDistribution | ( | const std::string & | id, |
RandomDistributor< SUMOVTypeParameter * > * | vehTypeDistribution | ||
) |
Adds a vehicle type distribution.
If another vehicle type (or distribution) with the same id exists, false is returned. Otherwise, the vehicle type distribution is added to the internal vehicle type distribution container "myVTypeDistDict".
This control get responsible for deletion of the added vehicle type distribution.
[in] | id | The id of the distribution to add |
[in] | vehTypeDistribution | The vehicle type distribution to add |
Definition at line 272 of file RONet.cpp.
References checkVType(), and myVTypeDistDict.
Referenced by RORouteHandler::closeVehicleTypeDistribution().
|
protected |
Definition at line 352 of file RONet.cpp.
References addVehicle(), RORouteDef::copy(), DEFAULT_VTYPE_ID, DELTA_T, SUMOVehicleParameter::depart, NamedObjectCont< T >::erase(), NamedObjectCont< T >::getMyMap(), getRouteDef(), getVehicleTypeSecure(), SUMOVTypeParameter::id, SUMOVehicleParameter::id, myDepartures, myFlows, RandHelper::rand(), SUMOVehicleParameter::repetitionEnd, SUMOVehicleParameter::repetitionNumber, SUMOVehicleParameter::repetitionOffset, SUMOVehicleParameter::repetitionProbability, SUMOVehicleParameter::repetitionsDone, SUMOVehicleParameter::routeid, toString(), TS, and SUMOVehicleParameter::vtypeid.
Referenced by saveAndRemoveRoutesUntil().
bool RONet::checkVType | ( | const std::string & | id | ) |
Checks whether the vehicle type (distribution) may be added.
This method checks also whether the default type may still be replaced
[in] | id | The id of the vehicle type (distribution) to add |
Definition at line 241 of file RONet.cpp.
References DEFAULT_VTYPE_ID, NamedObjectCont< T >::get(), myDefaultVTypeMayBeDeleted, myVehicleTypes, myVTypeDistDict, and NamedObjectCont< T >::remove().
Referenced by addVehicleType(), and addVTypeDistribution().
void RONet::cleanup | ( | SUMOAbstractRouter< ROEdge, ROVehicle > * | router | ) |
closes the file output for computed routes and deletes routers and associated threads if necessary
Definition at line 191 of file RONet.cpp.
References RouteCostCalculator< R, E, V >::cleanup(), OutputDevice::close(), myRouteAlternativesOutput, myRoutesOutput, and myTypesOutput.
Referenced by computeRoutes().
|
staticprotected |
Definition at line 319 of file RONet.cpp.
References RORouteDef::addAlternative(), RORouteDef::buildCurrentRoute(), ROVehicle::getDepartureTime(), ROVehicle::getID(), ROVehicle::getRouteDefinition(), MsgHandler::inform(), RORoute::recheckForLoops(), and RORoute::size().
Referenced by saveAndRemoveRoutesUntil().
|
virtual |
Returns the information whether further vehicles, persons or containers are stored.
Definition at line 523 of file RONet.cpp.
References myContainers, myFlows, myPersons, myVehicles, and NamedObjectCont< T >::size().
Referenced by ROLoader::openRoutes(), and ROLoader::processRoutes().
|
inline |
Retrieves a bus stop from the network.
[in] | name | The name of the stop to retrieve |
Definition at line 192 of file RONet.h.
References myBusStops.
Referenced by RORouteHandler::addStop().
|
inline |
Retrieves a container stop from the network.
[in] | name | The name of the stop to retrieve |
Definition at line 206 of file RONet.h.
References myContainerStops.
Referenced by RORouteHandler::addStop().
|
inline |
Retrieves all TAZ (districts) from the network.
Definition at line 126 of file RONet.h.
References myDistricts.
Referenced by main().
|
inline |
Retrieves an edge from the network.
This is not very pretty, but necessary, though, as routes run over instances, not over ids.
[in] | name | The name of the edge to retrieve |
Definition at line 138 of file RONet.h.
References NamedObjectCont< T >::get(), and myEdges.
Referenced by addDistrictEdge(), ROLoader::EdgeFloatTimeLineRetriever_EdgeTravelTime::addEdgeWeight(), RORouteHandler::addStop(), ROVehicle::addStop(), ROJTRTurnDefLoader::addToEdge(), ROJTRTurnDefLoader::beginFromEdge(), RODFNet::getDetectorEdge(), ROMAAssignments::getKPaths(), ROMAAssignments::incremental(), loadJTRDefinitions(), RONetHandler::myEndElement(), RODFDetectorHandler::myStartElement(), ROJTRTurnDefLoader::myStartElement(), RONetHandler::parseBusStop(), RONetHandler::parseConnection(), RONetHandler::parseContainerStop(), RORouteHandler::parseEdges(), RORouteHandler::parseFromViaTo(), AGActivityGenHandler::parseStreets(), RORouteHandler::routePedestrian(), ROMAAssignments::sue(), RODFDetectorCon::writeEmitters(), and RODFDetectorCon::writeSpeedTrigger().
const std::map< std::string, ROEdge * > & RONet::getEdgeMap | ( | ) | const |
Definition at line 541 of file RONet.cpp.
References NamedObjectCont< T >::getMyMap(), and myEdges.
Referenced by RODFNet::buildApproachList(), AGCity::completeStreets(), initNet(), ROLoader::loadWeights(), and ROMAAssignments::sue().
size_t RONet::getEdgeNo | ( | ) | const |
Returns the total number of edges the network contains including internal edges.
Definition at line 529 of file RONet.cpp.
References myEdges, and NamedObjectCont< T >::size().
Referenced by computeAllPairs(), computeRoutes(), and main().
int RONet::getInternalEdgeNumber | ( | ) | const |
Returns the number of internal edges the network contains.
Definition at line 535 of file RONet.cpp.
References myNumInternalEdges.
Referenced by computeAllPairs().
|
inline |
Retrieves an node from the network.
[in] | name | The name of the node to retrieve |
Definition at line 160 of file RONet.h.
References NamedObjectCont< T >::get(), and myNodes.
Referenced by RONetHandler::myEndElement(), RONetHandler::parseEdge(), and RONetHandler::parseJunction().
|
inline |
Returns the named route definition.
[in] | name | The name of the route definition to retrieve |
Check whether a const pointer may be returned
Rename myRoutes to myRouteDefinitions
Definition at line 290 of file RONet.h.
References NamedObjectCont< T >::get(), and myRoutes.
Referenced by checkFlows(), RORouteHandler::closeFlow(), RORouteHandler::closeRoute(), RORouteHandler::closeVehicle(), RORouteHandler::openRoute(), and RORouteHandler::openRouteDistribution().
|
inline |
Definition at line 394 of file RONet.h.
References myRouteAlternativesOutput, and myRoutesOutput.
Referenced by computeRoutes().
|
inlineprotected |
return vehicles for use by RouteAggregator
Definition at line 407 of file RONet.h.
References myVehicles.
Referenced by RORouteAggregator::processAllRoutes().
SUMOVTypeParameter * RONet::getVehicleTypeSecure | ( | const std::string & | id | ) |
Retrieves the named vehicle type.
If the name is "" the default type is returned. If the named vehicle type (or typeDistribution) was not added to the net before 0 is returned
[in] | id | The id of the vehicle type to return |
Definition at line 217 of file RONet.cpp.
References DEFAULT_VTYPE_ID, NamedObjectCont< T >::get(), myDefaultVTypeMayBeDeleted, myVehicleTypes, and myVTypeDistDict.
Referenced by checkFlows(), RORouteHandler::closeFlow(), RORouteHandler::closeVehicle(), computeRoutes(), RORouteHandler::openVehicleTypeDistribution(), and ROMAAssignments::ROMAAssignments().
bool RONet::hasRestrictions | ( | ) | const |
Definition at line 547 of file RONet.cpp.
References myHaveRestrictions.
Referenced by computeRoutes().
void RONet::openOutput | ( | const std::string & | filename, |
const std::string | altFilename, | ||
const std::string | typeFilename | ||
) |
Opens the output for computed routes.
If the second parameter is set, a second file for route alternatives will be opened. If one of the file outputs can not be build, an IOError is thrown.
[in] | filename | The (base) name of the file(s) to create |
[in] | altFilename | The name of the file for writing alternatives, "" means no alternatives |
[in] | filename | The name of the vtype file to create, "" means no separate types |
Definition at line 172 of file RONet.cpp.
References OutputDevice::getDevice(), myRouteAlternativesOutput, myRoutesOutput, myTypesOutput, SUMO_TAG_ROUTES, OutputDevice::writeAttr(), OutputDevice::writeHeader(), and OutputDevice::writeXMLHeader().
Referenced by computeRoutes().
SUMOTime RONet::saveAndRemoveRoutesUntil | ( | OptionsCont & | options, |
SUMOAbstractRouter< ROEdge, ROVehicle > & | router, | ||
SUMOTime | time | ||
) |
Computes routes described by their definitions and saves them.
As long as a vehicle with a departure time smaller than the given exists, its route is computed and it is written and removed from the internal container.
[in] | options | The options used during this process |
[in] | router | The router to use for routes computation |
[in] | time | The time until which route definitions shall be processed |
Definition at line 424 of file RONet.cpp.
References checkFlows(), SUMOAbstractRouter< E, V >::clone(), computeRoute(), ROVehicleCont::erase(), NamedObjectCont< T >::erase(), OptionsCont::getBool(), ROVehicle::getDepart(), Named::getID(), ROVehicle::getID(), OptionsCont::getInt(), NamedObjectCont< T >::getMyMap(), ROVehicle::getRouteDefinition(), ROVehicle::getRoutingSuccess(), ROVehicleCont::getTopVehicle(), MIN3(), myContainers, myDiscardedRouteNo, myErrorHandler, myPersons, myReadRouteNo, myRouteAlternativesOutput, myRoutes, myRoutesOutput, myTypesOutput, myVehicles, myWrittenRouteNo, ROVehicle::saveAllAsXML(), ROVehicle::saveTypeAsXML(), NamedObjectCont< T >::size(), SUMOTime_MAX, toString(), WRITE_MESSAGE, and OutputDevice::writePreformattedTag().
Referenced by ROLoader::processAllRoutesWithBulkRouter(), and ROLoader::processRoutes().
void RONet::setRestrictionFound | ( | ) |
Definition at line 553 of file RONet.cpp.
References myHaveRestrictions.
Referenced by RONetHandler::parseLane().
|
friend |
|
protected |
Known bus stops.
Definition at line 426 of file RONet.h.
Referenced by addBusStop(), and getBusStop().
|
protected |
Definition at line 457 of file RONet.h.
Referenced by addContainer(), furtherStored(), and saveAndRemoveRoutesUntil().
|
protected |
Known container stops.
Definition at line 429 of file RONet.h.
Referenced by addContainerStop(), and getContainerStop().
|
protected |
Whether no vehicle type was loaded.
Definition at line 440 of file RONet.h.
Referenced by checkVType(), and getVehicleTypeSecure().
|
protected |
Departure times for randomized flows.
Definition at line 460 of file RONet.h.
Referenced by addFlow(), and checkFlows().
|
protected |
The number of discarded routes.
Definition at line 478 of file RONet.h.
Referenced by saveAndRemoveRoutesUntil().
|
protected |
traffic assignment zones with sources and sinks
Definition at line 463 of file RONet.h.
Referenced by addDistrict(), addDistrictEdge(), and getDistricts().
|
protected |
Known edges.
Definition at line 423 of file RONet.h.
Referenced by addEdge(), getEdge(), getEdgeMap(), getEdgeNo(), and ~RONet().
|
protected |
handler for ignorable error messages
Definition at line 490 of file RONet.h.
Referenced by saveAndRemoveRoutesUntil().
|
protected |
Known flows.
Definition at line 449 of file RONet.h.
Referenced by addFlow(), checkFlows(), and furtherStored().
|
protected |
Whether the network contains edges which not all vehicles may pass.
Definition at line 484 of file RONet.h.
Referenced by hasRestrictions(), and setRestrictionFound().
|
protected |
|
protected |
The number of internal edges in the dictionary.
Definition at line 487 of file RONet.h.
Referenced by addEdge(), and getInternalEdgeNumber().
|
protected |
Definition at line 453 of file RONet.h.
Referenced by addPerson(), furtherStored(), and saveAndRemoveRoutesUntil().
|
protected |
The number of read routes.
Definition at line 475 of file RONet.h.
Referenced by addVehicle(), and saveAndRemoveRoutesUntil().
|
protected |
The file to write the computed route alternatives into.
Definition at line 469 of file RONet.h.
Referenced by cleanup(), getRouteOutput(), openOutput(), and saveAndRemoveRoutesUntil().
|
protected |
Known routes.
Definition at line 443 of file RONet.h.
Referenced by addRouteDef(), getRouteDef(), saveAndRemoveRoutesUntil(), and ~RONet().
|
protected |
The file to write the computed routes into.
Definition at line 466 of file RONet.h.
Referenced by cleanup(), getRouteOutput(), openOutput(), and saveAndRemoveRoutesUntil().
|
protected |
The file to write the vehicle types into.
Definition at line 472 of file RONet.h.
Referenced by cleanup(), openOutput(), and saveAndRemoveRoutesUntil().
|
protected |
Known vehicles.
Definition at line 446 of file RONet.h.
Referenced by addVehicle(), furtherStored(), getVehicles(), saveAndRemoveRoutesUntil(), and ~RONet().
|
protected |
Known vehicle types.
Definition at line 432 of file RONet.h.
Referenced by addVehicleType(), checkVType(), getVehicleTypeSecure(), RONet(), and ~RONet().
|
protected |
|
protected |
A distribution of vehicle types (probability->vehicle type)
Definition at line 437 of file RONet.h.
Referenced by addVTypeDistribution(), checkVType(), and getVehicleTypeSecure().
|
protected |
The number of written routes.
Definition at line 481 of file RONet.h.
Referenced by saveAndRemoveRoutesUntil().