22 #ifndef DijkstraRouterEffort_h
23 #define DijkstraRouterEffort_h
66 template<
class E,
class V,
class PF>
76 for (
size_t i = 0; i < noE; i++) {
125 return nod1->
edge->getNumericalID() > nod2->
edge->getNumericalID();
141 for (
typename std::vector<EdgeInfo*>::iterator i =
myFound.begin(); i !=
myFound.end(); i++) {
150 virtual void compute(
const E* from,
const E* to,
const V*
const vehicle,
151 SUMOTime msTime, std::vector<const E*>& into) {
152 assert(from != 0 && to != 0);
156 EdgeInfo*
const fromInfo = &(
myEdgeInfos[from->getNumericalID()]);
157 fromInfo->effort = 0;
167 const E*
const minEdge = minimumInfo->edge;
170 myFound.push_back(minimumInfo);
177 minimumInfo->visited =
true;
178 const SUMOReal effort = minimumInfo->effort +
getEffort(minEdge, vehicle, minimumInfo->leaveTime);
179 const SUMOReal leaveTime = minimumInfo->leaveTime +
getTravelTime(minEdge, vehicle, minimumInfo->leaveTime);
182 const unsigned int length_size = minEdge->getNoFollowing();
183 for (i = 0; i < length_size; i++) {
184 const E*
const follower = minEdge->getFollower(i);
185 EdgeInfo*
const followerInfo = &(
myEdgeInfos[follower->getNumericalID()]);
187 if (PF::operator()(follower, vehicle)) {
190 const SUMOReal oldEffort = followerInfo->effort;
191 if (!followerInfo->visited && effort < oldEffort) {
192 followerInfo->effort = effort;
193 followerInfo->leaveTime = leaveTime;
194 followerInfo->prev = minimumInfo;
214 for (
typename std::vector<const E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
215 if (PF::operator()(*i, v)) {
227 std::deque<const E*> tmp;
228 while (rbegin != 0) {
229 tmp.push_front((E*) rbegin->edge);
230 rbegin = rbegin->prev;
232 std::copy(tmp.begin(), tmp.end(), std::back_inserter(edges));
252 template<
class E,
class V,
class PF>
281 template<
class E,
class V,
class PF>
virtual SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const =0
Operation myEffortOperation
The object's operation to perform for obtaining the effort.
Operation myTTOperation
The object's operation to perform for obtaining the travel time.
SUMOReal(E::* Operation)(const V *const, SUMOReal) const
Type of the function that is used to retrieve the edge effort.
DijkstraRouterEffortBase(size_t noE, bool unbuildIsWarning)
Constructor.
EdgeInfo(size_t id)
Constructor.
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...
virtual ~DijkstraRouterEffortBase()
Destructor.
EdgeInfoByEffortComparator myComparator
bool visited
The previous edge.
std::vector< EdgeInfo > myEdgeInfos
The container of edge information.
SUMOReal getTravelTime(const E *const e, const V *const v, SUMOReal t) const
EdgeInfo * prev
The previous edge.
DijkstraRouterEffort_ByProxi(size_t noE, bool unbuildIsWarningOnly, Operation effortOperation, Operation ttOperation)
MsgHandler *const myErrorMsgHandler
the handler for routing errors
virtual SUMOReal getTravelTime(const E *const e, const V *const v, SUMOReal t) const =0
SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const
bool operator()(EdgeInfo *nod1, EdgeInfo *nod2) const
Comparing method.
SUMOReal(* Operation)(const E *const, const V *const, SUMOReal)
Type of the function that is used to retrieve the edge effort.
SUMOReal getTravelTime(const E *const e, const V *const v, SUMOReal t) const
void inform(std::string msg, bool addType=true)
adds a new error to the list
Operation myTTOperation
The object's operation to perform for obtaining the travel time.
SUMOReal recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) const
Operation myEffortOperation
The object's operation to perform for obtaining the effort.
std::vector< EdgeInfo * > myFrontierList
A container for reusage of the min edge heap.
void endQuery(int visits)
void buildPathFrom(EdgeInfo *rbegin, std::vector< const E * > &edges)
Builds the path from marked edges.
DijkstraRouterEffort_Direct(size_t noE, bool unbuildIsWarningOnly, Operation effortOperation, Operation ttOperation)
const E * edge
The current edge.
SUMOReal leaveTime
The time the vehicle leaves the edge.
SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const
SUMOReal effort
Effort to reach the edge.
std::vector< EdgeInfo * > myFound
list of visited Edges (for resetting)