52template<
class E,
class L,
class N,
class V>
116 const double departPos,
const std::string& originStopID,
117 const double arrivalPos,
const std::string& stopID,
118 const double speed,
const V*
const vehicle,
121 std::vector<TripItem>& into,
const double externalFactor = 0.) {
123 _IntermodalTrip trip(from, to, departPos, arrivalPos, speed, msTime,
nullptr, pars, vehicle, modeSet,
myExternalEffort, externalFactor);
124 std::vector<const _IntermodalEdge*> intoEdges;
130 std::string lastLine =
"";
138 bool addedEdge =
false;
139 if (iEdge->includeInRoute(
false)) {
140 if (iEdge->getLine() ==
"!stop") {
141 if (into.size() > 0) {
143 into.back().destStop = iEdge->
getID();
147 if (lastLine ==
"!ped") {
154 into.back().destStop = iEdge->getID();
157 if (iEdge->getLine() != lastLine ||
loopedLineTransfer(lastLineEdge, iEdge, lastLineTime, time)) {
158 lastLine = iEdge->getLine();
159 lastLineEdge = iEdge;
161 if (lastLine ==
"!car") {
162 into.push_back(
TripItem(vehicle->getID()));
163 into.back().vType = vehicle->getParameter().vtypeid;
164 }
else if (lastLine ==
"!ped") {
168 into.back().depart = iEdge->
getIntended(time, into.back().intended);
170 into.back().departPos = iEdge->getStartPos();
172 if (into.back().edges.empty() || into.back().edges.back() != iEdge->getEdge()) {
173 into.back().edges.push_back(iEdge->getEdge());
174 into.back().arrivalPos = iEdge->getEndPos();
179 const double prevTime = time;
180 const double prevEffort = effort;
181 const double prevLength = length;
184 length += iEdge->getPartialLength(&trip) - iEdge->getLength();
187 into.back().traveltime += time - prevTime;
188 into.back().cost += effort - prevEffort;
189 into.back().length += length - prevLength;
190 if (into.back().depart < 0) {
191 into.back().depart = prevTime;
194 into.back().exitTimes.push_back(time);
199 const std::string oType = originStopID !=
"" ?
"stop" :
"edge";
200 const std::string oID = originStopID !=
"" ? originStopID : from->
getID();
201 const std::string dType = stopID !=
"" ?
"stop" :
"edge";
202 const std::string dID = stopID !=
"" ? stopID : to->getID();
205 if (into.size() > 0) {
206 into.back().arrivalPos = arrivalPos;
208#ifdef IntermodalRouter_DEBUG_ROUTES
213 std::cout << iEdge->getID() <<
"(" << iEdge->getLine() <<
"): " << edgeEffort <<
" l=" << iEdge->getLength() <<
" pL=" << iEdge->getPartialLength(&trip) <<
"\n";
215 std::cout <<
TIME2STEPS(msTime) <<
" trip from " << from->getID() <<
" to " << (to !=
nullptr ? to->getID() : stopID)
230 SUMOTime, std::vector<const E*>&,
bool) {
244 for (
auto item : toProhibit) {
272 dev.
writeAttr(
"traveltime", e->getTravelTime(&trip, 0.));
273 dev.
writeAttr(
"effort", e->getEffort(&trip, 0.));
326 std::vector<std::string> edgeLines;
328 edgeLines.push_back(e->getLine());
340 assert(prev !=
nullptr);
343 std::string intended1;
344 std::string intended2;
347 return intended1 != intended2;
const std::string & getVehicleClassNames(SVCPermissions permissions, bool expand)
Returns the ids of the given classes, divided using a ' '.
long long int SVCPermissions
bitset where each bit declares whether a certain SVC may use this edge/lane
const std::string DEFAULT_PEDTYPE_ID
const double DEFAULT_PEDESTRIAN_SPEED
@ 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
@ SVC_PEDESTRIAN
pedestrian
@ SUMO_TAG_EDGE
begin/end of the description of an edge
double gWeightsRandomFactor
const double INVALID_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)
const std::string & getLine() const
virtual double getTravelTime(const IntermodalTrip< E, N, V > *const, double) const
int getNumericalID() const
virtual double getIntended(const double, std::string &) const
get intended vehicle id and departure time of next public transport ride
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 std::vector< _IntermodalEdge * > & getAllEdges()
_IntermodalEdge * getCarEdge(const E *e) const
Returns the associated car edge.
_IntermodalEdge * getStopEdge(const std::string &stopId) const
Returns the associated stop edge.
bool isLooped(const std::string lineID) const
const EdgePair & getBothDirections(const E *e) const
Returns the pair of forward and backward edge.
void addCarEdges(const std::vector< E * > &edges, double taxiWait)
_IntermodalEdge * getArrivalEdge(const E *e, const double pos) const
Returns the arriving intermodal edge.
const _IntermodalEdge * getDepartEdge(const E *e, const double pos) const
Returns the departing intermodal edge.
EffortCalculator * getExternalEffort() const
SUMOAbstractRouter< _IntermodalEdge, _IntermodalTrip > _InternalRouter
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 > &)
bool compute(const E *from, const E *to, const double departPos, const std::string &originStopID, const double arrivalPos, const std::string &stopID, const double speed, const V *const vehicle, const SUMOVTypeParameter &pars, 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...
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)
SUMOAbstractRouter< E, _IntermodalTrip > * clone()
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
const std::string myRoutingAlgorithm
IntermodalRouter & operator=(const IntermodalRouter &s)
Invalidated assignment operator.
bool loopedLineTransfer(const _IntermodalEdge *prev, const _IntermodalEdge *cur, double prevTime, double time)
void prohibit(const _Prohibitions &toProhibit)
Network * getNetwork() const
void writeWeights(OutputDevice &dev)
void setBulkMode(const bool mode)
EffortCalculator *const myExternalEffort
SUMOAbstractRouter< E, SUMOVehicle >::Prohibitions _Prohibitions
_InternalRouter * myInternalRouter
int getCarWalkTransfer() const
void writeNetwork(OutputDevice &dev)
MapMatcher< E, L, N > _MapMatcher
AStarRouter< _IntermodalEdge, _IntermodalTrip, _MapMatcher > _InternalAStar
the "vehicle" type that is given to the internal router (SUMOAbstractRouter)
const EffortCalculator *const calc
const double externalFactor
Provides utility functions for matching locations to edges (during route parsing)
void informf(const std::string &format, T value, Targs... Fargs)
adds a new formatted message
const std::string & getID() const
Returns the id.
Static storage of an output device and its base (abstract) implementation.
OutputDevice & writeAttr(const SumoXMLAttr attr, const T &val)
writes a named attribute
OutputDevice & openTag(const std::string &xmlElement)
Opens an XML tag.
bool closeTag(const std::string &comment="")
Closes the most recently opened tag and optionally adds a comment.
virtual void setBulkMode(const bool mode)
std::map< const E *, RouterProhibition > Prohibitions
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 Prohibitions &toProhibit)
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...
MsgHandler * myErrorMsgHandler
the handler for routing errors
Structure representing possible vehicle parameter.
TripItem(const std::string &_line="")
std::vector< double > exitTimes
std::vector< const E * > edges