#include <DijkstraRouterTT.h>

Definition at line 221 of file DijkstraRouterTT.h.
Public Types | |
| typedef SUMOReal(EC::* | Operation )(const E *const, const V *const, SUMOReal) const |
| Type of the function that is used to retrieve the edge effort. | |
Public Member Functions | |
| void | buildPathFrom (EdgeInfo *rbegin, std::vector< const E * > &edges) |
| Builds the path from marked edges. | |
| virtual void | compute (const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &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. | |
| DijkstraRouterTT_ByProxi (size_t noE, bool unbuildIsWarningOnly, EC *receiver, Operation operation) | |
| SUMOReal | getEffort (const E *const e, const V *const v, SUMOReal t) |
| SUMOReal | recomputeCosts (const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) throw () |
Protected Attributes | |
| EdgeInfoByTTComparator | myComparator |
| std::vector< EdgeInfo > | myEdgeInfos |
| The container of edge information. | |
| std::vector< EdgeInfo * > | myFrontierList |
| A container for reusage of the min edge heap. | |
| bool | myUnbuildIsWarningOnly |
Private Attributes | |
| Operation | myOperation |
| The object's operation to perform. | |
| EC * | myReceiver |
| The object the action is directed to. | |
| typedef SUMOReal(EC::* DijkstraRouterTT_ByProxi< E, V, PF, EC >::Operation)(const E *const, const V *const, SUMOReal) const |
Type of the function that is used to retrieve the edge effort.
| DijkstraRouterTT_ByProxi< E, V, PF, EC >::DijkstraRouterTT_ByProxi | ( | size_t | noE, | |
| bool | unbuildIsWarningOnly, | |||
| EC * | receiver, | |||
| Operation | operation | |||
| ) | [inline] |
Definition at line 226 of file DijkstraRouterTT.h.
00227 : DijkstraRouterTTBase<E, V, PF>(noE, unbuildIsWarningOnly), 00228 myReceiver(receiver), myOperation(operation) {}
| void DijkstraRouterTTBase< E, V, PF >::buildPathFrom | ( | EdgeInfo * | rbegin, | |
| std::vector< const E * > & | edges | |||
| ) | [inline, inherited] |
Builds the path from marked edges.
Definition at line 197 of file DijkstraRouterTT.h.
References DijkstraRouterTTBase< E, V, PF >::EdgeInfo::edge, and DijkstraRouterTTBase< E, V, PF >::EdgeInfo::prev.
Referenced by DijkstraRouterTTBase< E, V, PF >::compute().
00197 { 00198 std::deque<const E*> tmp; 00199 while (rbegin!=0) { 00200 tmp.push_front((E *) rbegin->edge); // !!! 00201 rbegin = rbegin->prev; 00202 } 00203 std::copy(tmp.begin(), tmp.end(), std::back_inserter(edges)); 00204 }
| virtual void DijkstraRouterTTBase< E, V, PF >::compute | ( | const E * | from, | |
| const E * | to, | |||
| const V *const | vehicle, | |||
| SUMOTime | msTime, | |||
| std::vector< const E * > & | into | |||
| ) | [inline, virtual, inherited] |
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< E, V >.
Definition at line 121 of file DijkstraRouterTT.h.
References DijkstraRouterTTBase< E, V, PF >::buildPathFrom(), DijkstraRouterTTBase< E, V, PF >::EdgeInfo::edge, DijkstraRouterTTBase< E, V, PF >::getEffort(), MsgHandler::getErrorInstance(), MsgHandler::inform(), max, DijkstraRouterTTBase< E, V, PF >::myComparator, DijkstraRouterTTBase< E, V, PF >::myEdgeInfos, DijkstraRouterTTBase< E, V, PF >::myFrontierList, DijkstraRouterTTBase< E, V, PF >::myUnbuildIsWarningOnly, DijkstraRouterTTBase< E, V, PF >::EdgeInfo::prev, SUMOReal, DijkstraRouterTTBase< E, V, PF >::EdgeInfo::traveltime, DijkstraRouterTTBase< E, V, PF >::EdgeInfo::visited, and WRITE_WARNING.
Referenced by TraCIServerAPI_Vehicle::processSet(), and MSTriggeredRerouter::reroute().
00122 { 00123 00124 SUMOReal time = (SUMOReal) msTime / 1000.; 00125 for (typename std::vector<EdgeInfo>::iterator i=myEdgeInfos.begin(); i!=myEdgeInfos.end(); i++) { 00126 (*i).traveltime = std::numeric_limits<SUMOReal>::max(); 00127 (*i).visited = false; 00128 } 00129 assert(from!=0&&to!=0); 00130 myFrontierList.clear(); 00131 // add begin node 00132 EdgeInfo* const fromInfo = &(myEdgeInfos[from->getNumericalID()]); 00133 fromInfo->traveltime = 0; 00134 fromInfo->prev = 0; 00135 myFrontierList.push_back(fromInfo); 00136 // loop 00137 while (!myFrontierList.empty()) { 00138 // use the node with the minimal length 00139 EdgeInfo * const minimumInfo = myFrontierList.front(); 00140 const E * const minEdge = minimumInfo->edge; 00141 pop_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); 00142 myFrontierList.pop_back(); 00143 // check whether the destination node was already reached 00144 if (minEdge == to) { 00145 buildPathFrom(minimumInfo, into); 00146 return; 00147 } 00148 minimumInfo->visited = true; 00149 const SUMOReal traveltime = minimumInfo->traveltime + getEffort(minEdge, vehicle, time + (SUMOTime)minimumInfo->traveltime); 00150 // check all ways from the node with the minimal length 00151 unsigned int i = 0; 00152 const unsigned int length_size = minEdge->getNoFollowing(); 00153 for (i=0; i<length_size; i++) { 00154 const E* const follower = minEdge->getFollower(i); 00155 EdgeInfo* const followerInfo = &(myEdgeInfos[follower->getNumericalID()]); 00156 // check whether it can be used 00157 if (PF::operator()(follower, vehicle)) { 00158 continue; 00159 } 00160 const SUMOReal oldEffort = followerInfo->traveltime; 00161 if (!followerInfo->visited && traveltime < oldEffort) { 00162 followerInfo->traveltime = traveltime; 00163 followerInfo->prev = minimumInfo; 00164 if (oldEffort == std::numeric_limits<SUMOReal>::max()) { 00165 myFrontierList.push_back(followerInfo); 00166 push_heap(myFrontierList.begin(), myFrontierList.end(), myComparator); 00167 } else { 00168 push_heap(myFrontierList.begin(), 00169 find(myFrontierList.begin(), myFrontierList.end(), followerInfo) + 1, 00170 myComparator); 00171 } 00172 } 00173 } 00174 } 00175 if (!myUnbuildIsWarningOnly) { 00176 MsgHandler::getErrorInstance()->inform("No connection between '" + from->getID() + "' and '" + to->getID() + "' found."); 00177 } else { 00178 WRITE_WARNING("No connection between '" + from->getID() + "' and '" + to->getID() + "' found."); 00179 } 00180 }
| SUMOReal DijkstraRouterTT_ByProxi< E, V, PF, EC >::getEffort | ( | const E *const | e, | |
| const V *const | v, | |||
| SUMOReal | t | |||
| ) | [inline, virtual] |
Implements DijkstraRouterTTBase< E, V, PF >.
Definition at line 230 of file DijkstraRouterTT.h.
References DijkstraRouterTT_ByProxi< E, V, PF, EC >::myOperation, and DijkstraRouterTT_ByProxi< E, V, PF, EC >::myReceiver.
00230 { 00231 return (myReceiver->*myOperation)(e, v, t); 00232 }
| SUMOReal DijkstraRouterTTBase< E, V, PF >::recomputeCosts | ( | const std::vector< const E * > & | edges, | |
| const V *const | v, | |||
| SUMOTime | msTime | |||
| ) | throw () [inline, virtual, inherited] |
Implements SUMOAbstractRouter< E, V >.
Definition at line 183 of file DijkstraRouterTT.h.
References DijkstraRouterTTBase< E, V, PF >::getEffort(), and SUMOReal.
00183 { 00184 SUMOReal time = (SUMOReal) msTime / 1000.; 00185 SUMOReal costs = 0; 00186 for (typename std::vector<const E*>::const_iterator i=edges.begin(); i!=edges.end(); ++i) { 00187 if (PF::operator()(*i, v)) { 00188 return -1; 00189 } 00190 costs += getEffort(*i, v, (SUMOTime)(time + costs)); 00191 } 00192 return costs; 00193 }
EdgeInfoByTTComparator DijkstraRouterTTBase< E, V, PF >::myComparator [protected, inherited] |
Definition at line 213 of file DijkstraRouterTT.h.
Referenced by DijkstraRouterTTBase< E, V, PF >::compute().
std::vector<EdgeInfo> DijkstraRouterTTBase< E, V, PF >::myEdgeInfos [protected, inherited] |
The container of edge information.
Definition at line 208 of file DijkstraRouterTT.h.
Referenced by DijkstraRouterTTBase< E, V, PF >::compute(), and DijkstraRouterTTBase< E, V, PF >::DijkstraRouterTTBase().
std::vector<EdgeInfo*> DijkstraRouterTTBase< E, V, PF >::myFrontierList [protected, inherited] |
A container for reusage of the min edge heap.
Definition at line 211 of file DijkstraRouterTT.h.
Referenced by DijkstraRouterTTBase< E, V, PF >::compute().
Operation DijkstraRouterTT_ByProxi< E, V, PF, EC >::myOperation [private] |
The object's operation to perform.
Definition at line 239 of file DijkstraRouterTT.h.
Referenced by DijkstraRouterTT_ByProxi< E, V, PF, EC >::getEffort().
EC* DijkstraRouterTT_ByProxi< E, V, PF, EC >::myReceiver [private] |
The object the action is directed to.
Definition at line 236 of file DijkstraRouterTT.h.
Referenced by DijkstraRouterTT_ByProxi< E, V, PF, EC >::getEffort().
bool DijkstraRouterTTBase< E, V, PF >::myUnbuildIsWarningOnly [protected, inherited] |
Definition at line 215 of file DijkstraRouterTT.h.
Referenced by DijkstraRouterTTBase< E, V, PF >::compute().
1.5.6