#include <ROJTRRouter.h>

Definition at line 50 of file ROJTRRouter.h.
Public Member Functions | |
| void | compute (const ROEdge *from, const ROEdge *to, const ROVehicle *const vehicle, SUMOTime time, std::vector< const ROEdge * > &into) |
| Builds the route between the given edges using the minimum afford at the given time The definition of the afford depends on the wished routing scheme. | |
| SUMOReal | recomputeCosts (const std::vector< const ROEdge * > &edges, const ROVehicle *const v, SUMOTime time) throw () |
| ROJTRRouter (RONet &net, bool unbuildIsWarningOnly, bool acceptAllDestinations) | |
| Constructor. | |
| ~ROJTRRouter () | |
| Destructor. | |
Private Attributes | |
| bool | myAcceptAllDestination |
| bool | myIgnoreClasses |
| int | myMaxEdges |
| The maximum number of edges a route may have. | |
| RONet & | myNet |
| The network to use. | |
| bool | myUnbuildIsWarningOnly |
Constructor.
Definition at line 44 of file ROJTRRouter.cpp.
References OptionsCont::getBool(), RONet::getEdgeNo(), OptionsCont::getFloat(), OptionsCont::getOptions(), myIgnoreClasses, myMaxEdges, and SUMOReal.
00046 : myNet(net), myUnbuildIsWarningOnly(unbuildIsWarningOnly), 00047 myAcceptAllDestination(acceptAllDestinations) { 00048 myMaxEdges = (int)( 00049 ((SUMOReal) net.getEdgeNo()) * 00050 OptionsCont::getOptions().getFloat("max-edges-factor")); 00051 myIgnoreClasses = OptionsCont::getOptions().getBool("ignore-classes"); 00052 }
| ROJTRRouter::~ROJTRRouter | ( | ) |
| void ROJTRRouter::compute | ( | const ROEdge * | from, | |
| const ROEdge * | to, | |||
| const ROVehicle *const | vehicle, | |||
| SUMOTime | time, | |||
| std::vector< const ROEdge * > & | into | |||
| ) | [virtual] |
Builds the route between the given edges using the minimum afford at the given time The definition of the afford depends on the wished routing scheme.
Implements SUMOAbstractRouter< ROEdge, ROVehicle >.
Definition at line 59 of file ROJTRRouter.cpp.
References ROJTREdge::chooseNext(), ROEdge::ET_SINK, MsgHandler::getErrorInstance(), ROEdge::getID(), ROEdge::getTravelTime(), ROEdge::getType(), MsgHandler::getWarningInstance(), MsgHandler::inform(), myAcceptAllDestination, myIgnoreClasses, myMaxEdges, myUnbuildIsWarningOnly, and ROEdge::prohibits().
00061 { 00062 const ROJTREdge *current = static_cast<const ROJTREdge*>(from); 00063 // route until a sinks has been found 00064 while (current!=0 00065 && 00066 current->getType()!=ROEdge::ET_SINK 00067 && 00068 (int) into.size()<myMaxEdges) { 00069 00070 into.push_back(current); 00071 time += (SUMOTime) current->getTravelTime(vehicle, time); 00072 current = current->chooseNext(myIgnoreClasses ? 0 : vehicle, time); 00073 assert(myIgnoreClasses||current==0||!current->prohibits(vehicle)); 00074 } 00075 // check whether no valid ending edge was found 00076 if ((int) into.size()>=myMaxEdges) { 00077 if (myAcceptAllDestination) { 00078 return; 00079 } else { 00080 MsgHandler *mh = 0; 00081 if (myUnbuildIsWarningOnly) { 00082 mh = MsgHandler::getWarningInstance(); 00083 } else { 00084 mh = MsgHandler::getErrorInstance(); 00085 } 00086 mh->inform("The route starting at edge '" + from->getID() + "' could not be closed."); 00087 } 00088 } 00089 // append the sink 00090 if (current!=0) { 00091 into.push_back(current); 00092 } 00093 }
| SUMOReal ROJTRRouter::recomputeCosts | ( | const std::vector< const ROEdge * > & | edges, | |
| const ROVehicle *const | v, | |||
| SUMOTime | time | |||
| ) | throw () [virtual] |
Implements SUMOAbstractRouter< ROEdge, ROVehicle >.
Definition at line 97 of file ROJTRRouter.cpp.
References SUMOReal.
00097 { 00098 SUMOReal costs = 0; 00099 for (std::vector<const ROEdge*>::const_iterator i=edges.begin(); i!=edges.end(); i++) { 00100 /* 00101 if (PF::operator()(*i, v)) { 00102 return -1; 00103 } 00104 */ 00105 costs += (*i)->getTravelTime(v, time); 00106 } 00107 return costs; 00108 }
bool ROJTRRouter::myAcceptAllDestination [private] |
bool ROJTRRouter::myIgnoreClasses [private] |
int ROJTRRouter::myMaxEdges [private] |
The maximum number of edges a route may have.
Definition at line 72 of file ROJTRRouter.h.
Referenced by compute(), and ROJTRRouter().
RONet& ROJTRRouter::myNet [private] |
bool ROJTRRouter::myUnbuildIsWarningOnly [private] |
1.5.6