22 #ifndef DijkstraRouterTT_h
23 #define DijkstraRouterTT_h
71 template<
class E,
class V,
class PF>
81 for (
size_t i = 0; i < noE; i++) {
127 return nod1->
edge->getNumericalID() > nod2->
edge->getNumericalID();
142 for (
typename std::vector<EdgeInfo*>::iterator i =
myFound.begin(); i !=
myFound.end(); i++) {
151 virtual void compute(
const E* from,
const E* to,
const V*
const vehicle,
152 SUMOTime msTime, std::vector<const E*>& into) {
153 assert(from != 0 && to != 0);
158 EdgeInfo*
const fromInfo = &(
myEdgeInfos[from->getNumericalID()]);
159 fromInfo->traveltime = 0;
168 const E*
const minEdge = minimumInfo->edge;
171 myFound.push_back(minimumInfo);
172 #ifdef DijkstraRouterTT_DEBUG_QUERY
173 std::cout <<
"DEBUG: hit '" << minEdge->getID() <<
"' Q: ";
175 std::cout << (*it)->traveltime <<
"," << (*it)->edge->getID() <<
" ";
183 #ifdef DijkstraRouterTT_DEBUG_QUERY_PERF
184 std::cout <<
"visited " +
toString(num_visited) +
" edges (final path length: " +
toString(into.size()) +
")\n";
188 minimumInfo->visited =
true;
189 const SUMOReal traveltime = minimumInfo->traveltime +
getEffort(minEdge, vehicle, time + minimumInfo->traveltime);
192 const unsigned int length_size = minEdge->getNoFollowing();
193 for (i = 0; i < length_size; i++) {
194 const E*
const follower = minEdge->getFollower(i);
195 EdgeInfo*
const followerInfo = &(
myEdgeInfos[follower->getNumericalID()]);
197 if (PF::operator()(follower, vehicle)) {
200 const SUMOReal oldEffort = followerInfo->traveltime;
201 if (!followerInfo->visited && traveltime < oldEffort) {
202 followerInfo->traveltime = traveltime;
203 followerInfo->prev = minimumInfo;
216 #ifdef DijkstraRouterTT_DEBUG_QUERY_PERF
217 std::cout <<
"visited " +
toString(num_visited) +
" edges (final path length: " +
toString(into.size()) +
")\n";
226 for (
typename std::vector<const E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
227 if (PF::operator()(*i, v)) {
238 std::deque<const E*> tmp;
239 while (rbegin != 0) {
240 tmp.push_front((E*) rbegin->edge);
241 rbegin = rbegin->prev;
243 std::copy(tmp.begin(), tmp.end(), std::back_inserter(edges));
262 template<
class E,
class V,
class PF>
284 template<
class E,
class V,
class PF>
virtual SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const =0
EdgeInfo(size_t id)
Constructor.
SUMOReal(* Operation)(const E *const, const V *const, SUMOReal)
Type of the function that is used to retrieve the edge effort.
DijkstraRouterTT_Direct(size_t noE, bool unbuildIsWarningOnly, Operation operation)
SUMOReal traveltime
Effort to reach the edge.
DijkstraRouterTTBase(size_t noE, bool unbuildIsWarning)
Constructor.
EdgeInfo * prev
The previous edge.
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 effort at the given time The definition of...
std::vector< EdgeInfo * > myFound
list of visited Edges (for resetting)
SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const
const E * edge
The current edge.
SUMOReal recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) const
MsgHandler *const myErrorMsgHandler
the handler for routing errors
void buildPathFrom(EdgeInfo *rbegin, std::vector< const E * > &edges)
Builds the path from marked edges.
std::vector< EdgeInfo > myEdgeInfos
The container of edge information.
EdgeInfoByTTComparator myComparator
DijkstraRouterTT_ByProxi(size_t noE, bool unbuildIsWarningOnly, Operation operation)
std::string toString(const T &t, std::streamsize accuracy=OUTPUT_ACCURACY)
Operation myOperation
The object's operation to perform.
SUMOReal(E::* Operation)(const V *const, SUMOReal) const
Type of the function that is used to retrieve the edge effort.
SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const
bool operator()(const EdgeInfo *nod1, const EdgeInfo *nod2) const
Comparing method.
void inform(std::string msg, bool addType=true)
adds a new error to the list
std::vector< EdgeInfo * > myFrontierList
A container for reusage of the min edge heap.
void endQuery(int visits)
virtual ~DijkstraRouterTTBase()
Destructor.
bool visited
The previous edge.