106 bool compute(
const E* from,
const E* to,
const V*
const vehicle,
107 SUMOTime msTime, std::vector<const E*>& into,
bool silent =
false) {
108 assert(from !=
nullptr && (vehicle ==
nullptr || to !=
nullptr));
110 if (this->
myEdgeInfos[from->getNumericalID()].prohibited || this->isProhibited(from, vehicle)) {
116 if (to !=
nullptr && (this->
myEdgeInfos[to->getNumericalID()].prohibited || this->isProhibited(to, vehicle))) {
124#ifdef DijkstraRouter_DEBUG_QUERY
128 const bool ignoreTransient = vehicle ==
nullptr ? false : vehicle->ignoreTransientPermissions();
129 std::tuple<const E*, const V*, SUMOTime> query = std::make_tuple(from, vehicle, msTime);
131#ifdef DijkstraRouter_DEBUG_BULKMODE
133 std::cout <<
" invalid bulk mode. myLastQuery="
138 << std::get<0>(query)->getID() <<
","
139 << std::get<1>(query)->getID() <<
","
143 std::cout <<
" using bulk mode\n";
146 const auto& toInfo = this->
myEdgeInfos[to->getNumericalID()];
147 if (toInfo.visited) {
150#ifdef DijkstraRouter_DEBUG_QUERY_PERF
151 std::cout <<
" instant bulk success for vehicle " << vehicle->getID() <<
"\n";
156 this->
init(from->getNumericalID(), msTime);
165#ifdef DijkstraRouter_DEBUG_QUERY_VISITED
172 const E*
const minEdge = minimumInfo->edge;
173#ifdef DijkstraRouter_DEBUG_QUERY
174 std::cout <<
"DEBUG: hit=" << minEdge->getID()
175 <<
" TT=" << minimumInfo->effort
176 <<
" EF=" << this->
getEffort(minEdge, vehicle, minimumInfo->leaveTime)
177 <<
" Leave: " << minimumInfo->leaveTime <<
" Q: ";
178#ifdef DijkstraRouter_DEBUG_QUERY_FRONTIER
180 std::cout <<
"\n " << edgeInfo->effort <<
", " << edgeInfo->edge->getID();
185#ifdef DijkstraRouter_DEBUG_QUERY_VISITED
186 DijkstraRouter_DEBUG_QUERY_VISITED_OUT <<
" <edge id=\"" << minEdge->getID() <<
"\" index=\"" << num_visited <<
"\" cost=\"" << minimumInfo->effort <<
"\" time=\"" << minimumInfo->leaveTime <<
"\"/>\n";
188 minimumInfo->visited =
true;
193 myExternalEffort->update(minEdge->getNumericalID(), minimumInfo->prev->edge->getNumericalID(), minEdge->getLength());
197#ifdef DijkstraRouter_DEBUG_QUERY_PERF
199 std::cout <<
"visited " +
toString(num_visited) +
" edges (final path length=" +
toString(into.size()) +
" cost=" << cost <<
" edges=" +
toString(into) +
")\n";
201#ifdef DijkstraRouter_DEBUG_QUERY_VISITED
206 std::pop_heap(this->myFrontierList.begin(), this->myFrontierList.end(),
myComparator);
207 this->myFrontierList.pop_back();
208 this->
myFound.push_back(minimumInfo);
209 const double effortDelta = this->
getEffort(minEdge, vehicle, minimumInfo->leaveTime);
210 const double leaveTime = minimumInfo->leaveTime + this->
getTravelTime(minEdge, vehicle, minimumInfo->leaveTime, effortDelta);
212 myExternalEffort->update(minEdge->getNumericalID(), minimumInfo->prev->edge->getNumericalID(), minEdge->getLength());
215 for (
const std::pair<const E*, const E*>& follower : minEdge->getViaSuccessors(vClass, ignoreTransient)) {
216 auto& followerInfo = this->
myEdgeInfos[follower.first->getNumericalID()];
218 if (followerInfo.prohibited || this->isProhibited(follower.first, vehicle)) {
221 double effort = minimumInfo->effort + effortDelta;
222 double time = leaveTime;
224 assert(effort >= minimumInfo->effort);
225 assert(time >= minimumInfo->leaveTime);
226 const double oldEffort = followerInfo.effort;
227 if (!followerInfo.visited && effort < oldEffort) {
228 followerInfo.effort = effort;
229 followerInfo.leaveTime = time;
230 followerInfo.prev = minimumInfo;
231 if (oldEffort == std::numeric_limits<double>::max()) {
232 this->myFrontierList.push_back(&followerInfo);
233 std::push_heap(this->myFrontierList.begin(), this->myFrontierList.end(),
myComparator);
235 std::push_heap(this->myFrontierList.begin(),
236 std::find(this->myFrontierList.begin(), this->myFrontierList.end(), &followerInfo) + 1,
243#ifdef DijkstraRouter_DEBUG_QUERY_PERF
244 std::cout <<
"visited " +
toString(num_visited) +
" edges (unsuccessful path length: " +
toString(into.size()) +
")\n";
246 if (to !=
nullptr && !
mySilent && !silent) {
247 this->
myErrorMsgHandler->informf(
TL(
"No connection between edge '%' and edge '%' found."), from->getID(), to->getID());
249#ifdef DijkstraRouter_DEBUG_QUERY_VISITED