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 /****************************************************************************/
16 // A DFROUTER-network
17 /****************************************************************************/
18 #ifndef RODFNet_h
19 #define RODFNet_h
20 
21 
22 // ===========================================================================
23 // included modules
24 // ===========================================================================
25 #include <config.h>
26 
28 #include <utils/common/StdDefs.h>
29 #include <utils/common/SUMOTime.h>
30 #include <router/ROEdge.h>
31 #include <router/RONet.h>
32 #include "RODFDetector.h"
33 #include "RODFRouteDesc.h"
34 #include "RODFRouteCont.h"
35 
36 
37 // ===========================================================================
38 // class definitions
39 // ===========================================================================
44 class RODFNet : public RONet {
45 public:
49  RODFNet(bool amInHighwayMode);
50 
51 
53  ~RODFNet();
54 
55 
56  void buildApproachList();
57 
58  void computeTypes(RODFDetectorCon& dets,
59  bool sourcesStrict) const;
60  void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween,
61  bool keepShortestOnly, int maxFollowingLength) const;
62  double getAbsPos(const RODFDetector& det) const;
63 
64  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
65  const RODFDetectorCon& detectors,
66  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
67 
68  void revalidateFlows(const RODFDetectorCon& detectors,
69  RODFDetectorFlows& flows,
70  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
71 
72 
73  void removeEmptyDetectors(RODFDetectorCon& detectors,
74  RODFDetectorFlows& flows);
75 
76  void reportEmptyDetectors(RODFDetectorCon& detectors,
77  RODFDetectorFlows& flows);
78 
80 
81  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
82 
83  bool hasDetector(ROEdge* edge) const;
84  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
85 
86  double getMaxSpeedFactorPKW() const {
87  return myMaxSpeedFactorPKW;
88  }
89 
90  double getMaxSpeedFactorLKW() const {
91  return myMaxSpeedFactorLKW;
92  }
93 
94  double getAvgSpeedFactorPKW() const {
95  return myAvgSpeedFactorPKW;
96  }
97 
98  double getAvgSpeedFactorLKW() const {
99  return myAvgSpeedFactorLKW;
100  }
101 
102 protected:
103  void revalidateFlows(const RODFDetector* detector,
104  RODFDetectorFlows& flows,
105  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
106  bool isSource(const RODFDetector& det,
107  const RODFDetectorCon& detectors, bool strict) const;
108  bool isFalseSource(const RODFDetector& det,
109  const RODFDetectorCon& detectors) const;
110  bool isDestination(const RODFDetector& det,
111  const RODFDetectorCon& detectors) const;
112 
113  ROEdge* getDetectorEdge(const RODFDetector& det) const;
114  bool isSource(const RODFDetector& det, ROEdge* edge,
115  ROEdgeVector& seen, const RODFDetectorCon& detectors,
116  bool strict) const;
117  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
118  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
119  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
120  const RODFDetectorCon& detectors) const;
121 
122  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
123  bool keepUnfoundEnds,
124  bool keepShortestOnly,
125  ROEdgeVector& visited, const RODFDetector& det,
126  RODFRouteCont& into, const RODFDetectorCon& detectors,
127  int maxFollowingLength,
128  ROEdgeVector& seen) const;
129 
131 
132  bool hasApproaching(ROEdge* edge) const;
133  bool hasApproached(ROEdge* edge) const;
134 
136  const RODFDetectorCon& detectors) const;
137  bool hasSourceDetector(ROEdge* edge,
138  const RODFDetectorCon& detectors) const;
139 
140  struct IterationEdge {
141  int depth;
143  };
144 
145 protected:
147  public:
150 
153 
155  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
156  return nod1.duration_2 > nod2.duration_2;
157  }
158  };
159 
160 private:
162  struct idComp {
163  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
164  return lhs->getID() < rhs->getID();
165  }
166  };
167 
169  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
170 
172  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
173 
174  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
175  mutable std::map<std::string, ROEdge*> myDetectorEdges;
176 
179 
181  std::vector<std::string> myDisallowedEdges;
182 
183 
185 
191 
192 };
193 
194 
195 #endif
196 
197 /****************************************************************************/
198 
RODFNet::myDetectorsOnEdges
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:174
RODFDetectorFlows
A container for flows.
Definition: RODFDetectorFlow.h:67
RODFNet::hasInBetweenDetectorsOnly
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:148
RODFNet::isFalseSource
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:686
RODFNet::RODFNet
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:45
RODFDetector
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:81
SUMOTime.h
RODFNet::getDetectorEdge
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:625
RODFNet::buildApproachList
void buildApproachList()
Definition: RODFNet.cpp:62
RODFNet::mySourceNumber
int mySourceNumber
Definition: RODFNet.h:178
RODFNet::buildDetectorEdgeDependencies
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:95
RODFNet::getAbsPos
double getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:670
OptionsCont.h
RODFNet::mesoJoin
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1072
RODFNet::revalidateFlows
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:570
RODFNet::myMaxSpeedFactorPKW
double myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:187
RODFNet::buildRoutes
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:340
SUMOTime
long long int SUMOTime
Definition: SUMOTime.h:34
RODFNet::myApproachingEdges
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:169
RODFDetector.h
RODFNet::DFRouteDescByTimeComperator
Definition: RODFNet.h:146
RODFNet::hasSourceDetector
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:164
RONet
The router's network representation.
Definition: RONet.h:63
RODFNet::IterationEdge::depth
int depth
Definition: RODFNet.h:141
RODFDetectorCon
A container for RODFDetectors.
Definition: RODFDetector.h:220
RODFNet::hasApproaching
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:637
RODFNet::computeRoutesFor
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:181
RODFNet::buildDetectorDependencies
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1025
RODFNet::DFRouteDescByTimeComperator::~DFRouteDescByTimeComperator
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:152
RODFNet::getDetectorList
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:664
RODFNet::myKeepTurnarounds
bool myKeepTurnarounds
Definition: RODFNet.h:184
RODFNet::computeTypes
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:108
RODFNet::hasDetector
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:655
RODFRouteDesc::duration_2
double duration_2
Definition: RODFRouteDesc.h:51
RODFNet::getMaxSpeedFactorPKW
double getMaxSpeedFactorPKW() const
Definition: RODFNet.h:86
RONet.h
RODFRouteDesc
A route within the DFROUTER.
Definition: RODFRouteDesc.h:46
RODFNet::~RODFNet
~RODFNet()
Destructor.
Definition: RODFNet.cpp:57
RODFNet::myInBetweenNumber
int myInBetweenNumber
Definition: RODFNet.h:178
RODFNet::hasApproached
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:646
RODFNet::myDisallowedEdges
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:181
RODFNet::myAvgSpeedFactorLKW
double myAvgSpeedFactorLKW
Definition: RODFNet.h:190
RODFNet::myInvalidNumber
int myInvalidNumber
Definition: RODFNet.h:178
ROEdgeVector
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:35
RODFNet::myDetectorEdges
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:175
RODFNet::IterationEdge
Definition: RODFNet.h:140
RODFNet::isSource
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:678
RODFNet::isDestination
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:693
RODFNet::reportEmptyDetectors
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:607
RODFNet::DFRouteDescByTimeComperator::operator()
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:155
RODFNet::removeEmptyDetectors
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:584
RODFNet::mySinkNumber
int mySinkNumber
Definition: RODFNet.h:178
RODFNet::idComp::operator()
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:163
RODFNet::myAmInHighwayMode
bool myAmInHighwayMode
Definition: RODFNet.h:177
RODFNet::getAvgSpeedFactorPKW
double getAvgSpeedFactorPKW() const
Definition: RODFNet.h:94
RODFNet::myApproachedEdges
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:172
RODFRouteDesc.h
RODFNet
A DFROUTER-network.
Definition: RODFNet.h:44
ROEdge
A basic edge for routing applications.
Definition: ROEdge.h:72
RODFNet::getAvgSpeedFactorLKW
double getAvgSpeedFactorLKW() const
Definition: RODFNet.h:98
RODFNet::IterationEdge::edge
ROEdge * edge
Definition: RODFNet.h:142
config.h
StdDefs.h
RODFRouteCont
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:55
RODFNet::myMaxSpeedFactorLKW
double myMaxSpeedFactorLKW
Definition: RODFNet.h:188
RODFNet::getMaxSpeedFactorLKW
double getMaxSpeedFactorLKW() const
Definition: RODFNet.h:90
RODFNet::myAvgSpeedFactorPKW
double myAvgSpeedFactorPKW
Definition: RODFNet.h:189
Named::getID
const std::string & getID() const
Returns the id.
Definition: Named.h:76
RODFNet::DFRouteDescByTimeComperator::DFRouteDescByTimeComperator
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:149
RODFNet::buildEdgeFlowMap
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:927
ROEdge.h
RODFRouteCont.h
RODFNet::idComp
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable
Definition: RODFNet.h:162