51 template<
class E,
class L,
class N,
class V>
111 bool compute(
const E* from,
const E* to,
const double departPos,
const double arrivalPos,
112 const std::string stopID,
const double speed,
114 std::vector<TripItem>& into,
const double externalFactor = 0.) {
116 _IntermodalTrip trip(from, to, departPos, arrivalPos, speed, msTime, 0, vehicle, modeSet,
myExternalEffort, externalFactor);
117 std::vector<const _IntermodalEdge*> intoEdges;
121 &trip, msTime, intoEdges);
123 std::string lastLine =
"";
129 if (iEdge->includeInRoute(
false)) {
130 if (iEdge->getLine() ==
"!stop") {
131 if (into.size() > 0) {
133 into.back().destStop = iEdge->
getID();
137 if (lastLine ==
"!ped") {
144 into.back().destStop = iEdge->getID();
147 if (iEdge->getLine() != lastLine) {
148 lastLine = iEdge->getLine();
149 if (lastLine ==
"!car") {
150 into.push_back(
TripItem(vehicle->getID()));
151 into.back().vType = vehicle->getParameter().vtypeid;
152 }
else if (lastLine ==
"!ped") {
156 into.back().depart = iEdge->getIntended(time, into.back().intended);
158 into.back().departPos = iEdge->getStartPos();
160 if (into.back().edges.empty() || into.back().edges.back() != iEdge->getEdge()) {
161 into.back().edges.push_back(iEdge->getEdge());
162 into.back().arrivalPos = iEdge->getEndPos();
166 const double prevTime = time, prevEffort = effort, prevLength = length;
169 length += iEdge->getPartialLength(&trip) - iEdge->getLength();
172 into.back().traveltime += time - prevTime;
173 into.back().cost += effort - prevEffort;
174 into.back().length += length - prevLength;
175 if (into.back().depart < 0) {
176 into.back().depart = prevTime;
181 if (into.size() > 0) {
182 into.back().arrivalPos = arrivalPos;
184 #ifdef IntermodalRouter_DEBUG_ROUTES
189 std::cout << iEdge->getID() <<
"(" << iEdge->getLine() <<
"): " << edgeEffort <<
" l=" << iEdge->getLength() <<
" pL=" << iEdge->getPartialLength(&trip) <<
"\n";
191 std::cout <<
TIME2STEPS(msTime) <<
" trip from " << from->getID() <<
" to " << (to !=
nullptr ? to->getID() : stopID)
206 SUMOTime, std::vector<const E*>&,
bool) {
212 std::vector<_IntermodalEdge*> toProhibitPE;
213 for (
typename std::vector<E*>::const_iterator it = toProhibit.begin(); it != toProhibit.end(); ++it) {
239 dev.
writeAttr(
"traveltime", e->getTravelTime(&trip, 0.));
240 dev.
writeAttr(
"effort", e->getEffort(&trip, 0.));
293 std::vector<std::string> edgeLines;
295 edgeLines.push_back(e->getLine());
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
@ SVC_IGNORING
vehicles ignoring classes
@ SVC_PASSENGER
vehicle is a passenger car (a "normal" car)
@ SVC_BICYCLE
vehicle is a bicycle
@ SVC_BUS
vehicle is a bus
const double DEFAULT_PEDESTRIAN_SPEED
int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
@ SUMO_TAG_EDGE
begin/end of the description of an edge
double gWeightsRandomFactor
const double INVALID_DOUBLE
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
Computes the shortest path through a network using the A* algorithm.
Computes the shortest path through a network using the Dijkstra algorithm.
the effort calculator interface
virtual double getEffort(const int numericalID) const =0
virtual std::string output(const int edge) const =0
virtual void init(const std::vector< std::string > &edges)=0
the base edge type that is given to the internal router (SUMOAbstractRouter)
static double getTravelTimeStatic(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
virtual double getTravelTime(const IntermodalTrip< E, N, V > *const, double) const
int getNumericalID() const
static double getEffortStatic(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
virtual double getTravelTimeAggregated(const IntermodalTrip< E, N, V > *const trip, double time) const
static double getTravelTimeStaticRandomized(const IntermodalEdge *const edge, const IntermodalTrip< E, N, V > *const trip, double time)
the intermodal network storing edges, connections and the mappings to the "real" edges
const EdgePair & getBothDirections(const E *e) const
Returns the pair of forward and backward edge.
const std::vector< _IntermodalEdge * > & getAllEdges()
_IntermodalEdge * getArrivalEdge(const E *e, const double pos) const
Returns the arriving intermodal edge.
_IntermodalEdge * getStopEdge(const std::string &stopId) const
Returns the associated stop edge.
void addCarEdges(const std::vector< E * > &edges, double taxiWait)
_IntermodalEdge * getCarEdge(const E *e) const
Returns the associated car edge.
const _IntermodalEdge * getDepartEdge(const E *e, const double pos) const
Returns the departing intermodal edge.
SUMOAbstractRouter< _IntermodalEdge, _IntermodalTrip > _InternalRouter
EffortCalculator * getExternalEffort() const
AStarRouter< _IntermodalEdge, _IntermodalTrip > _InternalAStar
IntermodalTrip< E, N, V > _IntermodalTrip
CreateNetCallback myCallback
static double getCombined(const _IntermodalEdge *const edge, const _IntermodalTrip *const trip, double time)
void(* CreateNetCallback)(IntermodalRouter< E, L, N, V > &)
IntermodalEdge< E, L, N, V > _IntermodalEdge
const int myCarWalkTransfer
Network * myIntermodalNet
virtual ~IntermodalRouter()
Destructor.
IntermodalNetwork< E, L, N, V > Network
IntermodalRouter(Network *net, const int carWalkTransfer, double taxiWait, const std::string &routingAlgorithm, const int routingMode, EffortCalculator *calc)
Network * getNetwork() const
IntermodalRouter(CreateNetCallback callback, const int carWalkTransfer, double taxiWait, const std::string &routingAlgorithm, const int routingMode=0, EffortCalculator *calc=nullptr)
Constructor.
bool compute(const E *, const E *, const _IntermodalTrip *const, SUMOTime, std::vector< const E * > &, bool)
Builds the route between the given edges using the minimum effort at the given time The definition of...
DijkstraRouter< _IntermodalEdge, _IntermodalTrip > _InternalDijkstra
IntermodalRouter & operator=(const IntermodalRouter &s)
Invalidated assignment operator.
const std::string myRoutingAlgorithm
bool compute(const E *from, const E *to, const double departPos, const double arrivalPos, const std::string stopID, const double speed, const V *const vehicle, const SVCPermissions modeSet, const SUMOTime msTime, std::vector< TripItem > &into, const double externalFactor=0.)
Builds the route between the given edges using the minimum effort at the given time The definition of...
void prohibit(const std::vector< E * > &toProhibit)
void writeWeights(OutputDevice &dev)
EffortCalculator *const myExternalEffort
SUMOAbstractRouter< E, _IntermodalTrip > * clone()
_InternalRouter * myInternalRouter
int getCarWalkTransfer() const
void writeNetwork(OutputDevice &dev)
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
const EffortCalculator *const calc
const double externalFactor
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
void updateViaCost(const E *const prev, const E *const e, const V *const v, double &time, double &effort, double &length) const
double getEffort(const E *const e, const V *const v, double t) const
virtual void prohibit(const std::vector< E * > &)
virtual bool compute(const E *from, const E *to, const V *const vehicle, SUMOTime msTime, std::vector< const E * > &into, bool silent=false)=0
Builds the route between the given edges using the minimum effort at the given time The definition of...
TripItem(const std::string &_line="")
std::vector< const E * > edges