SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RODFNet.h
Go to the documentation of this file.
1 /****************************************************************************/
9 // A DFROUTER-network
10 /****************************************************************************/
11 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
12 // Copyright (C) 2001-2016 DLR (http://www.dlr.de/) and contributors
13 /****************************************************************************/
14 //
15 // This file is part of SUMO.
16 // SUMO is free software: you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation, either version 3 of the License, or
19 // (at your option) any later version.
20 //
21 /****************************************************************************/
22 #ifndef RODFNet_h
23 #define RODFNet_h
24 
25 
26 // ===========================================================================
27 // included modules
28 // ===========================================================================
29 #ifdef _MSC_VER
30 #include <windows_config.h>
31 #else
32 #include <config.h>
33 #endif
34 
36 #include <utils/common/StdDefs.h>
37 #include <utils/common/SUMOTime.h>
38 #include <router/ROEdge.h>
39 #include <router/RONet.h>
40 #include "RODFDetector.h"
41 #include "RODFRouteDesc.h"
42 #include "RODFRouteCont.h"
43 
44 
45 // ===========================================================================
46 // class definitions
47 // ===========================================================================
52 class RODFNet : public RONet {
53 public:
57  RODFNet(bool amInHighwayMode);
58 
59 
61  ~RODFNet();
62 
63 
64  void buildApproachList();
65 
66  void computeTypes(RODFDetectorCon& dets,
67  bool sourcesStrict) const;
68  void buildRoutes(RODFDetectorCon& det, bool keepUnfoundEnds, bool includeInBetween,
69  bool keepShortestOnly, int maxFollowingLength) const;
70  SUMOReal getAbsPos(const RODFDetector& det) const;
71 
72  void buildEdgeFlowMap(const RODFDetectorFlows& flows,
73  const RODFDetectorCon& detectors,
74  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
75 
76  void revalidateFlows(const RODFDetectorCon& detectors,
77  RODFDetectorFlows& flows,
78  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
79 
80 
81  void removeEmptyDetectors(RODFDetectorCon& detectors,
82  RODFDetectorFlows& flows);
83 
84  void reportEmptyDetectors(RODFDetectorCon& detectors,
85  RODFDetectorFlows& flows);
86 
88 
89  void mesoJoin(RODFDetectorCon& detectors, RODFDetectorFlows& flows);
90 
91  bool hasDetector(ROEdge* edge) const;
92  const std::vector<std::string>& getDetectorList(ROEdge* edge) const;
93 
95  return myMaxSpeedFactorPKW;
96  }
97 
99  return myMaxSpeedFactorLKW;
100  }
101 
103  return myAvgSpeedFactorPKW;
104  }
105 
107  return myAvgSpeedFactorLKW;
108  }
109 
110 protected:
111  void revalidateFlows(const RODFDetector* detector,
112  RODFDetectorFlows& flows,
113  SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset);
114  bool isSource(const RODFDetector& det,
115  const RODFDetectorCon& detectors, bool strict) const;
116  bool isFalseSource(const RODFDetector& det,
117  const RODFDetectorCon& detectors) const;
118  bool isDestination(const RODFDetector& det,
119  const RODFDetectorCon& detectors) const;
120 
121  ROEdge* getDetectorEdge(const RODFDetector& det) const;
122  bool isSource(const RODFDetector& det, ROEdge* edge,
123  ROEdgeVector& seen, const RODFDetectorCon& detectors,
124  bool strict) const;
125  bool isFalseSource(const RODFDetector& det, ROEdge* edge,
126  ROEdgeVector& seen, const RODFDetectorCon& detectors) const;
127  bool isDestination(const RODFDetector& det, ROEdge* edge, ROEdgeVector& seen,
128  const RODFDetectorCon& detectors) const;
129 
130  void computeRoutesFor(ROEdge* edge, RODFRouteDesc& base, int no,
131  bool keepUnfoundEnds,
132  bool keepShortestOnly,
133  ROEdgeVector& visited, const RODFDetector& det,
134  RODFRouteCont& into, const RODFDetectorCon& detectors,
135  int maxFollowingLength,
136  ROEdgeVector& seen) const;
137 
139 
140  bool hasApproaching(ROEdge* edge) const;
141  bool hasApproached(ROEdge* edge) const;
142 
144  const RODFDetectorCon& detectors) const;
145  bool hasSourceDetector(ROEdge* edge,
146  const RODFDetectorCon& detectors) const;
147 
148  struct IterationEdge {
149  int depth;
151  };
152 
153 protected:
155  public:
158 
161 
163  bool operator()(const RODFRouteDesc& nod1, const RODFRouteDesc& nod2) const {
164  return nod1.duration_2 > nod2.duration_2;
165  }
166  };
167 
168 private:
170  struct idComp {
171  bool operator()(ROEdge* const lhs, ROEdge* const rhs) const {
172  return lhs->getID() < rhs->getID();
173  }
174  };
175 
177  std::map<ROEdge*, ROEdgeVector > myApproachingEdges;
178 
180  std::map<ROEdge*, ROEdgeVector > myApproachedEdges;
181 
182  mutable std::map<ROEdge*, std::vector<std::string>, idComp> myDetectorsOnEdges;
183  mutable std::map<std::string, ROEdge*> myDetectorEdges;
184 
187 
189  std::vector<std::string> myDisallowedEdges;
190 
191 
193 
199 
200 };
201 
202 
203 #endif
204 
205 /****************************************************************************/
206 
void mesoJoin(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:1082
void revalidateFlows(const RODFDetectorCon &detectors, RODFDetectorFlows &flows, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:580
DFRouteDescByTimeComperator()
Constructor.
Definition: RODFNet.h:157
std::vector< std::string > myDisallowedEdges
List of ids of edges that shall not be used.
Definition: RODFNet.h:189
~RODFNet()
Destructor.
Definition: RODFNet.cpp:69
long long int SUMOTime
Definition: SUMOTime.h:43
bool hasInBetweenDetectorsOnly(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:158
ROEdge * getDetectorEdge(const RODFDetector &det) const
Definition: RODFNet.cpp:635
bool isFalseSource(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:696
bool operator()(ROEdge *const lhs, ROEdge *const rhs) const
Definition: RODFNet.h:171
bool isSource(const RODFDetector &det, const RODFDetectorCon &detectors, bool strict) const
Definition: RODFNet.cpp:688
bool myKeepTurnarounds
Definition: RODFNet.h:192
std::map< ROEdge *, ROEdgeVector > myApproachedEdges
Map of edge name->list of names of edges approached by this edge.
Definition: RODFNet.h:180
void reportEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:617
void computeTypes(RODFDetectorCon &dets, bool sourcesStrict) const
Definition: RODFNet.cpp:118
SUMOReal getMaxSpeedFactorPKW() const
Definition: RODFNet.h:94
int myInBetweenNumber
Definition: RODFNet.h:186
SUMOReal getAvgSpeedFactorLKW() const
Definition: RODFNet.h:106
int mySourceNumber
Definition: RODFNet.h:186
bool hasSourceDetector(ROEdge *edge, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:174
A container for flows.
A container for RODFDetectors.
Definition: RODFDetector.h:228
bool hasDetector(ROEdge *edge) const
Definition: RODFNet.cpp:665
SUMOReal getAbsPos(const RODFDetector &det) const
Definition: RODFNet.cpp:680
~DFRouteDescByTimeComperator()
Destructor.
Definition: RODFNet.h:160
void buildRoutes(RODFDetectorCon &det, bool keepUnfoundEnds, bool includeInBetween, bool keepShortestOnly, int maxFollowingLength) const
Definition: RODFNet.cpp:350
comparator for maps using edges as key, used only in myDetectorsOnEdges to make tests comparable ...
Definition: RODFNet.h:170
bool isDestination(const RODFDetector &det, const RODFDetectorCon &detectors) const
Definition: RODFNet.cpp:703
const std::string & getID() const
Returns the id.
Definition: Named.h:66
SUMOReal myAvgSpeedFactorLKW
Definition: RODFNet.h:198
bool hasApproaching(ROEdge *edge) const
Definition: RODFNet.cpp:647
int mySinkNumber
Definition: RODFNet.h:186
RODFNet(bool amInHighwayMode)
Constructor.
Definition: RODFNet.cpp:57
std::vector< ROEdge * > ROEdgeVector
Definition: RODFRouteDesc.h:43
A DFROUTER-network.
Definition: RODFNet.h:52
const std::vector< std::string > & getDetectorList(ROEdge *edge) const
Definition: RODFNet.cpp:674
void buildDetectorEdgeDependencies(RODFDetectorCon &dets) const
Definition: RODFNet.cpp:105
void buildApproachList()
Definition: RODFNet.cpp:74
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:191
A route within the DFROUTER.
Definition: RODFRouteDesc.h:54
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:177
The router's network representation.
Definition: RONet.h:76
void buildEdgeFlowMap(const RODFDetectorFlows &flows, const RODFDetectorCon &detectors, SUMOTime startTime, SUMOTime endTime, SUMOTime stepOffset)
Definition: RODFNet.cpp:937
void buildDetectorDependencies(RODFDetectorCon &detectors)
Definition: RODFNet.cpp:1035
Class representing a detector within the DFROUTER.
Definition: RODFDetector.h:89
std::map< std::string, ROEdge * > myDetectorEdges
Definition: RODFNet.h:183
SUMOReal myAvgSpeedFactorPKW
Definition: RODFNet.h:197
SUMOReal duration_2
Definition: RODFRouteDesc.h:59
bool hasApproached(ROEdge *edge) const
Definition: RODFNet.cpp:656
A container for DFROUTER-routes.
Definition: RODFRouteCont.h:63
SUMOReal getMaxSpeedFactorLKW() const
Definition: RODFNet.h:98
std::map< ROEdge *, std::vector< std::string >, idComp > myDetectorsOnEdges
Definition: RODFNet.h:182
#define SUMOReal
Definition: config.h:214
bool myAmInHighwayMode
Definition: RODFNet.h:185
void removeEmptyDetectors(RODFDetectorCon &detectors, RODFDetectorFlows &flows)
Definition: RODFNet.cpp:594
SUMOReal myMaxSpeedFactorLKW
Definition: RODFNet.h:196
SUMOReal myMaxSpeedFactorPKW
maximum speed factor in measurements
Definition: RODFNet.h:195
bool operator()(const RODFRouteDesc &nod1, const RODFRouteDesc &nod2) const
Comparing method.
Definition: RODFNet.h:163
SUMOReal getAvgSpeedFactorPKW() const
Definition: RODFNet.h:102
int myInvalidNumber
Definition: RODFNet.h:186