23 #ifndef AStarRouterTT_h
24 #define AStarRouterTT_h
68 template<
class E,
class V,
class PF>
78 for (
size_t i = 0; i < noE; i++) {
95 edge(E::dictionary(id)),
134 return nod1->
edge->getNumericalID() > nod2->
edge->getNumericalID();
149 for (
typename std::vector<EdgeInfo*>::iterator i =
myFound.begin(); i !=
myFound.end(); i++) {
157 virtual void compute(
const E* from,
const E* to,
const V*
const vehicle,
158 SUMOTime msTime, std::vector<const E*>& into) {
159 assert(from != 0 && to != 0);
164 EdgeInfo*
const fromInfo = &(
myEdgeInfos[from->getNumericalID()]);
165 fromInfo->traveltime = 0;
174 const E*
const minEdge = minimumInfo->edge;
177 myFound.push_back(minimumInfo);
186 minimumInfo->visited =
true;
187 const SUMOReal traveltime = minimumInfo->traveltime +
getEffort(minEdge, vehicle, time + minimumInfo->traveltime);
190 const unsigned int length_size = minEdge->getNoFollowing();
191 for (i = 0; i < length_size; i++) {
192 const E*
const follower = minEdge->getFollower(i);
193 EdgeInfo*
const followerInfo = &(
myEdgeInfos[follower->getNumericalID()]);
195 if (PF::operator()(follower, vehicle)) {
198 const SUMOReal oldEffort = followerInfo->traveltime;
199 if (!followerInfo->visited && traveltime < oldEffort) {
201 const SUMOReal heuristic_remaining = minEdge->getDistanceTo(to) / vehicle->getMaxSpeed();
202 followerInfo->traveltime = traveltime;
203 followerInfo->heuristicTime = traveltime + heuristic_remaining;
204 followerInfo->prev = minimumInfo;
224 for (
typename std::vector<const E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
225 if (PF::operator()(*i, v)) {
236 std::deque<const E*> tmp;
237 while (rbegin != 0) {
238 tmp.push_front((E*) rbegin->edge);
239 rbegin = rbegin->prev;
241 std::copy(tmp.begin(), tmp.end(), std::back_inserter(edges));
261 template<
class E,
class V,
class PF>
281 template<
class E,
class V,
class PF>
SUMOReal heuristicTime
Estimated time to reach the edge (traveltime + lower bound on remaining time)
bool visited
The previous edge.
EdgeInfoComparator myComparator
SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const
std::vector< EdgeInfo * > myFrontierList
A container for reusage of the min edge heap.
AStarRouterTT_Direct(size_t noE, bool unbuildIsWarningOnly, Operation operation)
std::vector< EdgeInfo > myEdgeInfos
The container of edge information.
bool operator()(const EdgeInfo *nod1, const EdgeInfo *nod2) const
Comparing method.
virtual SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const =0
SUMOReal recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) const
SUMOReal(E::* Operation)(const V *const, SUMOReal) const
Type of the function that is used to retrieve the edge effort.
SUMOReal traveltime
Effort to reach the edge.
SUMOReal(* Operation)(const E *const, const V *const, SUMOReal)
Type of the function that is used to retrieve the edge effort.
virtual ~AStarRouterTTBase()
Destructor.
SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const
std::vector< EdgeInfo * > myFound
list of visited Edges (for resetting)
const E * edge
The current edge.
EdgeInfo * prev
The previous edge.
Operation myOperation
The object's operation to perform.
AStarRouterTTBase(size_t noE, bool unbuildIsWarning)
Constructor.
EdgeInfo(size_t id)
Constructor.
void inform(std::string msg, bool addType=true)
adds a new error to the list
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 travel time.
void endQuery(int visits)
MsgHandler *const myErrorMsgHandler
the handler for routing errors
AStarRouterTT_ByProxi(size_t noE, bool unbuildIsWarningOnly, Operation operation)