22 #ifndef DijkstraRouterEffort_h
23 #define DijkstraRouterEffort_h
65 template<
class E,
class V,
class PF>
74 for (
size_t i = 0; i < noE; i++) {
127 return nod1->
edge->getNumericalID() > nod2->
edge->getNumericalID();
143 for (
typename std::vector<EdgeInfo*>::iterator i =
myFound.begin(); i !=
myFound.end(); i++) {
152 virtual void compute(
const E* from,
const E* to,
const V*
const vehicle,
153 SUMOTime msTime, std::vector<const E*>& into) {
154 assert(from != 0 && to != 0);
159 EdgeInfo*
const fromInfo = &(
myEdgeInfos[from->getNumericalID()]);
160 fromInfo->effort = 0;
170 const E*
const minEdge = minimumInfo->edge;
173 myFound.push_back(minimumInfo);
180 minimumInfo->visited =
true;
181 const SUMOReal effort = minimumInfo->effort + this->
getEffort(minEdge, vehicle, minimumInfo->leaveTime);
182 const SUMOReal leaveTime = minimumInfo->leaveTime +
getTravelTime(minEdge, vehicle, minimumInfo->leaveTime);
184 const std::vector<E*>& successors = minEdge->getSuccessors(vClass);
185 for (
typename std::vector<E*>::const_iterator it = successors.begin(); it != successors.end(); ++it) {
186 const E*
const follower = *it;
187 EdgeInfo*
const followerInfo = &(
myEdgeInfos[follower->getNumericalID()]);
189 if (PF::operator()(follower, vehicle)) {
192 const SUMOReal oldEffort = followerInfo->effort;
193 if (!followerInfo->visited && effort < oldEffort) {
194 followerInfo->effort = effort;
195 followerInfo->leaveTime = leaveTime;
196 followerInfo->prev = minimumInfo;
216 for (
typename std::vector<const E*>::const_iterator i = edges.begin(); i != edges.end(); ++i) {
217 if (PF::operator()(*i, v)) {
229 std::deque<const E*> tmp;
230 while (rbegin != 0) {
231 tmp.push_front((E*) rbegin->edge);
232 rbegin = rbegin->prev;
234 std::copy(tmp.begin(), tmp.end(), std::back_inserter(edges));
static MsgHandler * getWarningInstance()
Returns the instance to add warnings to.
Computes the shortest path through a network using the Dijkstra algorithm.
SUMOReal getTravelTime(const E *const e, const V *const v, SUMOReal t) const
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
void buildPathFrom(EdgeInfo *rbegin, std::vector< const E * > &edges)
Builds the path from marked edges.
bool operator()(EdgeInfo *nod1, EdgeInfo *nod2) const
Comparing method.
SUMOReal recomputeCosts(const std::vector< const E * > &edges, const V *const v, SUMOTime msTime) const
std::vector< EdgeInfo > myEdgeInfos
The container of edge information.
MsgHandler *const myErrorMsgHandler
the handler for routing errors
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...
DijkstraRouterEffort(size_t noE, bool unbuildIsWarning, Operation effortOperation, Operation ttOperation)
Constructor.
const E * edge
The current edge.
SUMOReal(* Operation)(const E *const, const V *const, SUMOReal)
std::vector< EdgeInfo * > myFound
list of visited Edges (for resetting)
SUMOReal leaveTime
The time the vehicle leaves the edge.
EdgeInfoByEffortComparator myComparator
Operation myOperation
The object's operation to perform.
bool visited
The previous edge.
SUMOReal effort
Effort to reach the edge.
void inform(std::string msg, bool addType=true)
adds a new error to the list
void endQuery(int visits)
Operation myTTOperation
The object's operation to perform for travel times.
std::vector< EdgeInfo * > myFrontierList
A container for reusage of the min edge heap.
virtual ~DijkstraRouterEffort()
Destructor.
SUMOReal getEffort(const E *const e, const V *const v, SUMOReal t) const
EdgeInfo * prev
The previous edge.
virtual SUMOAbstractRouter< E, V > * clone() const
vehicles ignoring classes