19 #ifndef SUMOAbstractRouter_h 20 #define SUMOAbstractRouter_h 45 template<
class E,
class V>
57 :
edge(e),
effort(std::numeric_limits<double>::max()),
84 effort = std::numeric_limits<double>::max();
96 typedef double(*
Operation)(
const E*
const,
const V*
const, double);
121 virtual bool compute(
const E* from,
const E* to,
const V*
const vehicle,
122 SUMOTime msTime, std::vector<const E*>& into) = 0;
128 inline double getTravelTime(
const E*
const e,
const V*
const v,
const double t,
const double effort)
const {
132 inline void updateViaCost(
const E*
const prev,
const E*
const e,
const V*
const v,
double& time,
double&
effort,
double& length)
const {
133 if (prev !=
nullptr) {
134 for (
const std::pair<const E*, const E*>& follower : prev->getViaSuccessors()) {
135 if (follower.first == e) {
136 const E* viaEdge = follower.second;
137 while (viaEdge !=
nullptr && viaEdge->isInternal()) {
138 const double viaEffortDelta = this->
getEffort(viaEdge, v, time);
140 effort += viaEffortDelta;
141 length += viaEdge->getLength();
142 viaEdge = viaEdge->getViaSuccessors().front().first;
148 const double effortDelta = this->
getEffort(e, v, time);
149 effort += effortDelta;
151 length += e->getLength();
159 const E*
prev =
nullptr;
160 for (
const E*
const e : edges) {
171 inline double getEffort(
const E*
const e,
const V*
const v,
double t)
const {
215 template<
class E,
class V>
228 if (std::find(myProhibited.begin(), myProhibited.end(),
edge) != myProhibited.end()) {
231 return edge->prohibits(vehicle);
235 myProhibited = toProhibit;
double getEffort(const E *const e, const V *const v, double t) const
std::vector< E * > myProhibited
double(* Operation)(const E *const, const V *const, double)
Type of the function that is used to retrieve the edge effort.
double getTravelTime(const E *const e, const V *const v, const double t, const double effort) const
long long int myQueryTimeSum
Operation myTTOperation
The object's operation to perform for travel times.
EdgeInfo & operator=(const EdgeInfo &s)=delete
Invalidated assignment operator.
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E *> &into)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
bool visited
The previous edge.
bool isProhibited(const E *const edge, const V *const vehicle) const
double leaveTime
The time the vehicle leaves the edge.
void prohibit(const std::vector< E *> &toProhibit)
void updateViaCost(const E *const prev, const E *const e, const V *const v, double &time, double &effort, double &length) const
virtual ~SUMOAbstractRouterPermissions()
Destructor.
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
SUMOAbstractRouter(const std::string &type, Operation operation=nullptr, Operation ttOperation=nullptr)
Constructor.
SUMOAbstractRouterPermissions(const std::string &type, typename SUMOAbstractRouter< E, V >::Operation operation=nullptr, typename SUMOAbstractRouter< E, V >::Operation ttOperation=nullptr)
Constructor.
const E * via
The optional internal edge corresponding to prev.
bool myBulkMode
whether we are currently operating several route queries in a bulk
Operation myOperation
The object's operation to perform.
long long int myQueryStartTime
the time spent querying in milliseconds
double effort
Effort to reach the edge.
virtual ~SUMOAbstractRouter()
Destructor.
virtual bool isProhibited(const E *const, const V *const) const
long long int myNumQueries
long long int myQueryVisits
counters for performance logging
EdgeInfo(const E *const e)
Constructor.
void endQuery(int visits)
double recomputeCosts(const std::vector< const E *> &edges, const V *const v, SUMOTime msTime) const
double heuristicEffort
Estimated effort to reach the edge (effort + lower bound on remaining effort)
virtual SUMOAbstractRouter * clone()=0
static long getCurrentMillis()
Returns the current time in milliseconds.
#define WRITE_MESSAGE(msg)
const EdgeInfo * prev
The previous edge.
const std::string myType
the type of this router
void setBulkMode(const bool mode)
const E *const edge
The current edge.