Eclipse SUMO - Simulation of Urban MObility
RODFNet.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2001-2019 German Aerospace Center (DLR) and others.
4 // This program and the accompanying materials
5 // are made available under the terms of the Eclipse Public License v2.0
6 // which accompanies this distribution, and is available at
7 // http://www.eclipse.org/legal/epl-v20.html
8 // SPDX-License-Identifier: EPL-2.0
9 /****************************************************************************/
17 // A DFROUTER-network
18 /****************************************************************************/
19 #ifndef RODFNet_h
20 #define RODFNet_h
21 
22 
23 // ===========================================================================
24 // included modules
25 // ===========================================================================
26 #include <config.h>
27 
29 #include <utils/common/StdDefs.h>
30 #include <utils/common/SUMOTime.h>
31 #include <router/ROEdge.h>
32 #include <router/RONet.h>
33 #include "RODFDetector.h"
34 #include "RODFRouteDesc.h"
35 #include "RODFRouteCont.h"
36 
37 
38 // ===========================================================================
39 // class definitions
40 // ===========================================================================
45 class RODFNet : public RONet {
46 public:
50  RODFNet(bool amInHighwayMode);
51 
52 
54  ~RODFNet();
55 
56 
57  void buildApproachList();
58 
59  void computeTypes(RODFDetectorCon& dets,
60  bool sourcesStrict) const;
61  void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween,
62  bool keepShortestOnly, int maxFollowingLength) const;
63  double getAbsPos(const RODFDetector& det) const;
64 
65  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
66  const RODFDetectorCon& detectors,
67  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
68 
69  void revalidateFlows(const RODFDetectorCon& detectors,
70  RODFDetectorFlows& flows,
71  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
72 
73 
74  void removeEmptyDetectors(RODFDetectorCon& detectors,
75  RODFDetectorFlows& flows);
76 
77  void reportEmptyDetectors(RODFDetectorCon& detectors,
78  RODFDetectorFlows& flows);
79 
81 
82  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
83 
84  bool hasDetector(ROEdge* edge) const;
85  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
86 
87  double getMaxSpeedFactorPKW() const {
88  return myMaxSpeedFactorPKW;
89  }
90 
91  double getMaxSpeedFactorLKW() const {
92  return myMaxSpeedFactorLKW;
93  }
94 
95  double getAvgSpeedFactorPKW() const {
96  return myAvgSpeedFactorPKW;
97  }
98 
99  double getAvgSpeedFactorLKW() const {
100  return myAvgSpeedFactorLKW;
101  }
102 
103 protected:
104  void revalidateFlows(const RODFDetector* detector,
105  RODFDetectorFlows& flows,
106  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
107  bool isSource(const RODFDetector& det,
108  const RODFDetectorCon& detectors, bool strict) const;
109  bool isFalseSource(const RODFDetector& det,
110  const RODFDetectorCon& detectors) const;
111  bool isDestination(const RODFDetector& det,
112  const RODFDetectorCon& detectors) const;
113 
114  ROEdge* getDetectorEdge(const RODFDetector& det) const;
115  bool isSource(const RODFDetector& det, ROEdge* edge,
116  ROEdgeVector& seen, const RODFDetectorCon& detectors,
117  bool strict) const;
118  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
119  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
120  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
121  const RODFDetectorCon& detectors) const;
122 
123  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
124  bool keepUnfoundEnds,
125  bool keepShortestOnly,
126  ROEdgeVector& visited, const RODFDetector& det,
127  RODFRouteCont& into, const RODFDetectorCon& detectors,
128  int maxFollowingLength,
129  ROEdgeVector& seen) const;
130 
132 
133  bool hasApproaching(ROEdge* edge) const;
134  bool hasApproached(ROEdge* edge) const;
135 
137  const RODFDetectorCon& detectors) const;
138  bool hasSourceDetector(ROEdge* edge,
139  const RODFDetectorCon& detectors) const;
140 
141  struct IterationEdge {
142  int depth;
144  };
145 
146 protected:
148  public:
151 
154 
156  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
157  return nod1.duration_2 > nod2.duration_2;
158  }
159  };
160 
161 private:
163  struct idComp {
164  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
165  return lhs->getID() < rhs->getID();
166  }
167  };
168 
170  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
171 
173  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
174 
175  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
176  mutable std::map<std::string, ROEdge*> myDetectorEdges;
177 
180 
182  std::vector<std::string> myDisallowedEdges;
183 
184 
186 
192 
193 };
194 
195 
196 #endif
197 
198 /****************************************************************************/
199 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1073
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:571
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:150
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:182
~RODFNet()
Destructor.
Definition: RODFNet.cpp:58
long long int SUMOTime
Definition: SUMOTime.h:35
double myAvgSpeedFactorLKW
Definition: RODFNet.h:191
double myAvgSpeedFactorPKW
Definition: RODFNet.h:190
double getAvgSpeedFactorPKW() const
Definition: RODFNet.h:95
bool myKeepTurnarounds
Definition: RODFNet.h:185
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:687
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:679
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:109
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:173
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:608
double getMaxSpeedFactorPKW() const
Definition: RODFNet.h:87
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:656
double getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:671
int myInBetweenNumber
Definition: RODFNet.h:179
const std::string & getID() const
Returns the id.
Definition: Named.h:77
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:626
int mySourceNumber
Definition: RODFNet.h:179
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:221
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:153
double duration_2
Definition: RODFRouteDesc.h:52
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:163
double getMaxSpeedFactorLKW() const
Definition: RODFNet.h:91
int mySinkNumber
Definition: RODFNet.h:179
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:46
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:36
A DFROUTER-network.
Definition: RODFNet.h:45
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:665
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:164
void buildApproachList()
Definition: RODFNet.cpp:63
A route within the DFROUTER.
Definition: RODFRouteDesc.h:47
double getAvgSpeedFactorLKW() const
Definition: RODFNet.h:99
A basic edge for routing applications.
Definition: ROEdge.h:73
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:170
double myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:188
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:647
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:341
double myMaxSpeedFactorLKW
Definition: RODFNet.h:189
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:638
The router&#39;s network representation.
Definition: RONet.h:64
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:165
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:928
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:156
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1026
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:82
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:176
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:56
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:149
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:694
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:175
bool myAmInHighwayMode
Definition: RODFNet.h:178
void computeRoutesFor(ROEdge *edge, RODFRouteDesc &base, int no, bool keepUnfoundEnds, bool keepShortestOnly, ROEdgeVector &visited, const RODFDetector &det, RODFRouteCont &into, const RODFDetectorCon &detectors, int maxFollowingLength, ROEdgeVector &seen) const
Definition: RODFNet.cpp:182
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:585
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:96
int myInvalidNumber
Definition: RODFNet.h:179