21 #ifndef AStarRouterTT_h
22 #define AStarRouterTT_h
66 template<
class E,
class V,
class PF>
76 for (
size_t i = 0; i < noE; i++) {
93 edge(E::dictionary(id)),
132 return nod1->
edge->getNumericalID() > nod2->
edge->getNumericalID();
147 for (
typename std::vector<EdgeInfo*>::iterator i =
myFound.begin(); i !=
myFound.end(); i++) {
155 virtual void compute(
const E* from,
const E* to,
const V*
const vehicle,
156 SUMOTime msTime, std::vector<const E*>& into) {
157 assert(from != 0 && to != 0);
162 EdgeInfo*
const fromInfo = &(
myEdgeInfos[from->getNumericalID()]);
163 fromInfo->traveltime = 0;
172 const E*
const minEdge = minimumInfo->edge;
175 myFound.push_back(minimumInfo);
184 minimumInfo->visited =
true;
185 const SUMOReal traveltime = minimumInfo->traveltime +
getEffort(minEdge, vehicle, time + minimumInfo->traveltime);
188 const unsigned int length_size = minEdge->getNoFollowing();
189 for (i = 0; i < length_size; i++) {
190 const E*
const follower = minEdge->getFollower(i);
191 EdgeInfo*
const followerInfo = &(
myEdgeInfos[follower->getNumericalID()]);
193 if (PF::operator()(follower, vehicle)) {
196 const SUMOReal oldEffort = followerInfo->traveltime;
197 if (!followerInfo->visited && traveltime < oldEffort) {
199 const SUMOReal heuristic_remaining = minEdge->getDistanceTo(to) / vehicle->getMaxSpeed();
200 followerInfo->traveltime = traveltime;
201 followerInfo->heuristicTime = traveltime + heuristic_remaining;
202 followerInfo->prev = minimumInfo;
222 for (
typename std::vector<const E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
223 if (PF::operator()(*i, v)) {
234 std::deque<const E*> tmp;
235 while (rbegin != 0) {
236 tmp.push_front((E*) rbegin->edge);
237 rbegin = rbegin->prev;
239 std::copy(tmp.begin(), tmp.end(), std::back_inserter(edges));
259 template<
class E,
class V,
class PF>
279 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)