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-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
19 // A DFROUTER-network
20 /****************************************************************************/
21 #ifndef RODFNet_h
22 #define RODFNet_h
23 
24 
25 // ===========================================================================
26 // included modules
27 // ===========================================================================
28 #ifdef _MSC_VER
29 #include <windows_config.h>
30 #else
31 #include <config.h>
32 #endif
33 
35 #include <utils/common/StdDefs.h>
36 #include <utils/common/SUMOTime.h>
37 #include <router/ROEdge.h>
38 #include <router/RONet.h>
39 #include "RODFDetector.h"
40 #include "RODFRouteDesc.h"
41 #include "RODFRouteCont.h"
42 
43 
44 // ===========================================================================
45 // class definitions
46 // ===========================================================================
51 class RODFNet : public RONet {
52 public:
56  RODFNet(bool amInHighwayMode);
57 
58 
60  ~RODFNet();
61 
62 
63  void buildApproachList();
64 
65  void computeTypes(RODFDetectorCon& dets,
66  bool sourcesStrict) const;
67  void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween,
68  bool keepShortestOnly, int maxFollowingLength) const;
69  double getAbsPos(const RODFDetector& det) const;
70 
71  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
72  const RODFDetectorCon& detectors,
73  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
74 
75  void revalidateFlows(const RODFDetectorCon& detectors,
76  RODFDetectorFlows& flows,
77  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
78 
79 
80  void removeEmptyDetectors(RODFDetectorCon& detectors,
81  RODFDetectorFlows& flows);
82 
83  void reportEmptyDetectors(RODFDetectorCon& detectors,
84  RODFDetectorFlows& flows);
85 
87 
88  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
89 
90  bool hasDetector(ROEdge* edge) const;
91  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
92 
93  double getMaxSpeedFactorPKW() const {
94  return myMaxSpeedFactorPKW;
95  }
96 
97  double getMaxSpeedFactorLKW() const {
98  return myMaxSpeedFactorLKW;
99  }
100 
101  double getAvgSpeedFactorPKW() const {
102  return myAvgSpeedFactorPKW;
103  }
104 
105  double getAvgSpeedFactorLKW() const {
106  return myAvgSpeedFactorLKW;
107  }
108 
109 protected:
110  void revalidateFlows(const RODFDetector* detector,
111  RODFDetectorFlows& flows,
112  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
113  bool isSource(const RODFDetector& det,
114  const RODFDetectorCon& detectors, bool strict) const;
115  bool isFalseSource(const RODFDetector& det,
116  const RODFDetectorCon& detectors) const;
117  bool isDestination(const RODFDetector& det,
118  const RODFDetectorCon& detectors) const;
119 
120  ROEdge* getDetectorEdge(const RODFDetector& det) const;
121  bool isSource(const RODFDetector& det, ROEdge* edge,
122  ROEdgeVector& seen, const RODFDetectorCon& detectors,
123  bool strict) const;
124  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
125  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
126  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
127  const RODFDetectorCon& detectors) const;
128 
129  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
130  bool keepUnfoundEnds,
131  bool keepShortestOnly,
132  ROEdgeVector& visited, const RODFDetector& det,
133  RODFRouteCont& into, const RODFDetectorCon& detectors,
134  int maxFollowingLength,
135  ROEdgeVector& seen) const;
136 
138 
139  bool hasApproaching(ROEdge* edge) const;
140  bool hasApproached(ROEdge* edge) const;
141 
143  const RODFDetectorCon& detectors) const;
144  bool hasSourceDetector(ROEdge* edge,
145  const RODFDetectorCon& detectors) const;
146 
147  struct IterationEdge {
148  int depth;
150  };
151 
152 protected:
154  public:
157 
160 
162  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
163  return nod1.duration_2 > nod2.duration_2;
164  }
165  };
166 
167 private:
169  struct idComp {
170  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
171  return lhs->getID() < rhs->getID();
172  }
173  };
174 
176  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
177 
179  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
180 
181  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
182  mutable std::map<std::string, ROEdge*> myDetectorEdges;
183 
186 
188  std::vector<std::string> myDisallowedEdges;
189 
190 
192 
198 
199 };
200 
201 
202 #endif
203 
204 /****************************************************************************/
205 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1079
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:577
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:156
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:188
~RODFNet()
Destructor.
Definition: RODFNet.cpp:64
double myAvgSpeedFactorLKW
Definition: RODFNet.h:197
double myAvgSpeedFactorPKW
Definition: RODFNet.h:196
double getAvgSpeedFactorPKW() const
Definition: RODFNet.h:101
bool myKeepTurnarounds
Definition: RODFNet.h:191
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:693
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:685
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:115
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:179
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:614
double getMaxSpeedFactorPKW() const
Definition: RODFNet.h:93
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:662
double getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:677
int myInBetweenNumber
Definition: RODFNet.h:185
const std::string & getID() const
Returns the id.
Definition: Named.h:74
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:632
int mySourceNumber
Definition: RODFNet.h:185
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:227
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:159
double duration_2
Definition: RODFRouteDesc.h:58
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:169
double getMaxSpeedFactorLKW() const
Definition: RODFNet.h:97
int mySinkNumber
Definition: RODFNet.h:185
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:52
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:42
A DFROUTER-network.
Definition: RODFNet.h:51
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:671
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:170
void buildApproachList()
Definition: RODFNet.cpp:69
A route within the DFROUTER.
Definition: RODFRouteDesc.h:53
double getAvgSpeedFactorLKW() const
Definition: RODFNet.h:105
A basic edge for routing applications.
Definition: ROEdge.h:77
std::map< ROEdge *, ROEdgeVector > myApproachingEdges
Map of edge name->list of names of this edge approaching edges.
Definition: RODFNet.h:176
double myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:194
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:653
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:347
double myMaxSpeedFactorLKW
Definition: RODFNet.h:195
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:644
The router&#39;s network representation.
Definition: RONet.h:74
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:171
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:934
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:162
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1032
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:88
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:182
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:62
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:155
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:700
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:181
bool myAmInHighwayMode
Definition: RODFNet.h:184
long long int SUMOTime
Definition: TraCIDefs.h:51
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:188
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:591
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:102
int myInvalidNumber
Definition: RODFNet.h:185